repo_name stringlengths 7 94 | repo_path stringlengths 4 237 | repo_head_hexsha stringlengths 40 40 | content stringlengths 10 680k | apis stringlengths 2 680k |
|---|---|---|---|---|
Enflow-io/dhf-pay-python | dhf_wrapper/base_client.py | 7c32461d3b2a5018151b2a16a0cc0ad6850b88b1 | from typing import Optional, Callable
import requests
from requests.auth import AuthBase
from requests.exceptions import RequestException
class BearerAuth(AuthBase):
def __init__(self, token):
self.token = token
def __call__(self, r):
r.headers['Authorization'] = f'Bearer {self.token}'
... | [((856, 874), 'requests.Session', 'requests.Session', ([], {}), '()\n', (872, 874), False, 'import requests\n')] |
Edinburgh-Genome-Foundry/Flametree | flametree/utils.py | a189de5d83ca1eb3526a439320e41df9e2a1162e | import os
import shutil
from .ZipFileManager import ZipFileManager
from .DiskFileManager import DiskFileManager
from .Directory import Directory
import string
printable = set(string.printable) - set("\x0b\x0c")
def is_hex(s):
return any(c not in printable for c in s)
def file_tree(target, replace=False):
... | [] |
artigianitecnologici/marrtino_apps | audio/audio_client.py | b58bf4daa1d06db2f1c8a47be02b29948d41f48d | import sys
import socket
import time
ip = '127.0.0.1'
port = 9001
if (len(sys.argv)>1):
ip = sys.argv[1]
if (len(sys.argv)>2):
port = int(sys.argv[2])
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((ip,port))
sock.send('bip\n\r')
data = sock.recv(80)
print data
sock.send('TTS[it-IT... | [] |
yulinfeng000/qmotor | qmotor/message/matcher.py | ad3e9eea291f5b87e09fcdd5e42f1eb13d752565 | from abc import ABC, abstractmethod
from typing import List
from .common import (
AtCell,
BasicMessage,
GroupMessage,
FriendMessage,
MsgCellType,
MessageType,
PlainCell,
)
from ..utils import is_str_blank, str_contains
class MsgMatcher(ABC):
def msg_chain_from_ctx(self, ctx):
r... | [] |
Atri10/Leet-code---Atri_Patel | invert-binary-tree/invert-binary-tree.py | 49fc59b9147a44ab04a66128fbb2ef259b5f7b7c | class Solution:
def invertTree(self, root: Optional[TreeNode]) -> Optional[TreeNode]:
if root:
root.left,root.right = self.invertTree(root.right),self.invertTree(root.left)
return root
return None | [] |
sinahmr/childf | main/admin.py | 4e01f46867425b36b6431713b79debf585d69d37 | from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as DjangoUserAdmin
from django.contrib.auth.models import Group
from django.utils.translation import ugettext_lazy as _
from main.models import UserInfo, User, Child, Volunteer, Donor, Letter, Need, PurchaseForInstitute, PurchaseForNeed, ... | [((355, 375), 'django.contrib.admin.register', 'admin.register', (['User'], {}), '(User)\n', (369, 375), False, 'from django.contrib import admin\n'), ((1093, 1121), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['Group'], {}), '(Group)\n', (1114, 1121), False, 'from django.contrib import admin\n'),... |
MoyTW/RL_Arena_Experiment | hunting/display/render.py | fb79c67576cd4de3e4a58278b4515098f38fb584 | import tdl
import time
import hunting.constants as c
class Renderer:
def __init__(self, main_console=None, level_display_width=c.SCREEN_WIDTH, level_display_height=c.SCREEN_HEIGHT):
if main_console is None:
self.main_console = tdl.init(level_display_width, level_display_height, 'From Renderer ... | [((2494, 2515), 'time.sleep', 'time.sleep', (['show_time'], {}), '(show_time)\n', (2504, 2515), False, 'import time\n'), ((543, 597), 'tdl.Console', 'tdl.Console', (['level_display_width', 'level_display_height'], {}), '(level_display_width, level_display_height)\n', (554, 597), False, 'import tdl\n'), ((1432, 1443), '... |
neosergio/hackatrix-api | ideas/models.py | 27f0180415efa97bd7345d100b314d8807486b67 | from django.db import models
class Idea(models.Model):
title = models.CharField(max_length=255, unique=True)
description = models.TextField()
author = models.OneToOneField('events.Registrant',
related_name='author_idea',
on_delete=models.... | [((69, 114), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)'}), '(max_length=255, unique=True)\n', (85, 114), False, 'from django.db import models\n'), ((133, 151), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (149, 151), False, 'from django.db im... |
ssheikh85/AIHCND_c3_3d_imaging | section2/out/src/data_prep/SlicesDataset.py | 6502985d4199244328a683459b4d819090d58f3c | """
Module for Pytorch dataset representations
"""
import torch
from torch.utils.data import Dataset
class SlicesDataset(Dataset):
"""
This class represents an indexable Torch dataset
which could be consumed by the PyTorch DataLoader class
"""
def __init__(self, data):
self.data = data
... | [((1971, 2003), 'torch.from_numpy', 'torch.from_numpy', (['img[(None), :]'], {}), '(img[(None), :])\n', (1987, 2003), False, 'import torch\n'), ((2081, 2113), 'torch.from_numpy', 'torch.from_numpy', (['seg[(None), :]'], {}), '(seg[(None), :])\n', (2097, 2113), False, 'import torch\n')] |
uktrade/zenslackchat | zenslackchat/zendesk_webhooks.py | 8071757e1ea20a433783c6a7c47f25b046692682 | from zenslackchat.zendesk_base_webhook import BaseWebHook
from zenslackchat.zendesk_email_to_slack import email_from_zendesk
from zenslackchat.zendesk_comments_to_slack import comments_from_zendesk
class CommentsWebHook(BaseWebHook):
"""Handle Zendesk Comment Events.
"""
def handle_event(self, event, slac... | [((501, 559), 'zenslackchat.zendesk_comments_to_slack.comments_from_zendesk', 'comments_from_zendesk', (['event', 'slack_client', 'zendesk_client'], {}), '(event, slack_client, zendesk_client)\n', (522, 559), False, 'from zenslackchat.zendesk_comments_to_slack import comments_from_zendesk\n'), ((789, 844), 'zenslackcha... |
groupdocs-merger-cloud/groupdocs-merger-cloud-python-samples | Examples/PagesOperations/MovePage.py | af736c94240eeefef28bd81012c96ab2ea779088 | # Import modules
import groupdocs_merger_cloud
from Common import Common
# This example demonstrates how to move document page to a new position
class MovePage:
@classmethod
def Run(cls):
pagesApi = groupdocs_merger_cloud.PagesApi.from_config(Common.GetConfig())
options = groupdocs_merger_cl... | [((301, 337), 'groupdocs_merger_cloud.MoveOptions', 'groupdocs_merger_cloud.MoveOptions', ([], {}), '()\n', (335, 337), False, 'import groupdocs_merger_cloud\n'), ((366, 431), 'groupdocs_merger_cloud.FileInfo', 'groupdocs_merger_cloud.FileInfo', (['"""WordProcessing/four-pages.docx"""'], {}), "('WordProcessing/four-pag... |
joseluistello/Regression-Analysis-Apple-Data | src/models/predict_model.py | 85952edd22ba8c382f43357efc510763185fd6d1 | y_pred=ml.predict(x_test)
print(y_pred)
from sklearn.metrics import r2_score
r2_score(y_test,y_pred)
pred_y_df=pd.DataFrame({'Actual Value':y_test,'Predicted Value':y_pred, 'Difference': y_test-y_pred})
pred_y_df[0:20] | [((78, 102), 'sklearn.metrics.r2_score', 'r2_score', (['y_test', 'y_pred'], {}), '(y_test, y_pred)\n', (86, 102), False, 'from sklearn.metrics import r2_score\n')] |
Soufiane-Fartit/cars-prices | src/models/utils_func.py | 8eee8aa168251adab7f4947c45a78752e4145041 | # -*- coding: utf-8 -*-
""" This module offers util functions to be called and used
in other modules
"""
from datetime import datetime
import os
import json
import pickle
import string
import random
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
from sklearn impo... | [((4051, 4152), 'pandas.DataFrame', 'pd.DataFrame', (['[tree.feature_importances_ for tree in model.estimators_]'], {'columns': 'features.columns'}), '([tree.feature_importances_ for tree in model.estimators_],\n columns=features.columns)\n', (4063, 4152), True, 'import pandas as pd\n'), ((4231, 4260), 'matplotlib.p... |
KpaBap/palbot | modules/finance.py | 38d2b7958e310f45a28cf1b3173967b92f819946 | import asyncio
import discord
from discord.ext import commands
import re
import sqlite3
from urllib.parse import quote as uriquote
import html
CURR = ["AUD", "BRL", "CAD", "CHF", "CLP", "CNY", "CZK", "DKK", "EUR",
"GBP", "HKD", "HUF", "IDR", "ILS", "INR", "JPY", "KRW", "MXN",
"MYR", "NOK", "NZD", "P... | [((487, 505), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (503, 505), False, 'from discord.ext import commands\n'), ((4741, 4770), 'discord.ext.commands.command', 'commands.command', ([], {'hidden': '(True)'}), '(hidden=True)\n', (4757, 4770), False, 'from discord.ext import commands\n'), ((47... |
shubha1593/MovieReviewAnalysis | SG_GetDataForClassifier.py | c485eea0c8b35e554027cce7a431212b406e672c | from SG_GetFeatureMatrix import *
from SG_VectorY import *
featureMatrix = featureMatrixFromReviews()
Y = getYVector()
def getDataForClassifier() :
return featureMatrix, Y | [] |
Carnales/green-bounty | greenbounty/bounties/migrations/0001_initial.py | beb765082b32c096139463bf75ccc1ec3d530692 | # Generated by Django 3.1.4 on 2021-01-17 19:12
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((441, 534), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
osrg/nova | nova/tests/virt/docker/test_driver.py | 14b6bc655145c832bd9c822e48f877818e0e53ff | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2013 dotCloud, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache... | [] |
l04m33/pyx | pyx/tests/test_http.py | b70efec605832ba3c7079e991584db3f5d1da8cb | import unittest
import unittest.mock as mock
import asyncio
import pyx.http as http
def create_dummy_message():
msg = http.HttpMessage(None)
msg.headers = [
http.HttpHeader('Server', 'Pyx'),
http.HttpHeader('Cookie', 'a'),
http.HttpHeader('Cookie', 'b'),
]
return msg
def crea... | [((124, 146), 'pyx.http.HttpMessage', 'http.HttpMessage', (['None'], {}), '(None)\n', (140, 146), True, 'import pyx.http as http\n'), ((354, 378), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (376, 378), False, 'import asyncio\n'), ((393, 424), 'asyncio.StreamReader', 'asyncio.StreamReader', ([... |
kidosoft/splinter | tests/test_webdriver_chrome.py | 6d5052fd73c0a626299574cea76924e367c67faa | # -*- coding: utf-8 -*-
# Copyright 2013 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import unittest
from splinter import Browser
from .fake_webapp import EXAMPLE_APP
from .base import WebDriverTests
from selen... | [((411, 428), 'splinter.Browser', 'Browser', (['"""chrome"""'], {}), "('chrome')\n", (418, 428), False, 'from splinter import Browser\n'), ((624, 641), 'splinter.Browser', 'Browser', (['"""chrome"""'], {}), "('chrome')\n", (631, 641), False, 'from splinter import Browser\n'), ((1492, 1526), 'splinter.Browser', 'Browser... |
DuskXi/ArkX | main.py | 7b416ae0c4ec2b383c6f414ed475930dd228909f | import os
import json
from File.file import File
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
def fileRead(fileName, encoding='utf-8'):
with open(fileName, encoding=encoding) as f:
return f.read()
def main():
from Automation.distributor import Distributor
from Performance import recoder
from ... | [((887, 1050), 'Performance.recoder.Recoder.initDataSet', 'recoder.Recoder.initDataSet', (["[modelConfig['objectDetectionModel']['modelName'], modelConfig[\n 'addSanityModel']['modelName']]", "[classifyModel['modelName']]"], {}), "([modelConfig['objectDetectionModel'][\n 'modelName'], modelConfig['addSanityModel'... |
cprogrammer1994/miniglm | tests/test_simple.py | 696764ff200dd106dd533264ff45a060d5f7b230 | import struct
import numpy as np
import pytest
import miniglm
def test_add_vec_vec():
res = miniglm.add((1.0, 2.0, 3.0), (1.5, 1.8, 1.2))
np.testing.assert_almost_equal(res, (2.5, 3.8, 4.2))
assert type(res) is tuple
def test_add_vec_scalar():
res = miniglm.add((1.0, 2.0, 3.0), 0.5)
np.testing... | [((100, 145), 'miniglm.add', 'miniglm.add', (['(1.0, 2.0, 3.0)', '(1.5, 1.8, 1.2)'], {}), '((1.0, 2.0, 3.0), (1.5, 1.8, 1.2))\n', (111, 145), False, 'import miniglm\n'), ((150, 202), 'numpy.testing.assert_almost_equal', 'np.testing.assert_almost_equal', (['res', '(2.5, 3.8, 4.2)'], {}), '(res, (2.5, 3.8, 4.2))\n', (180... |
konstantin1985/forum | flaskbb/plugins/news/views.py | 7d4de24ccc932e9764699d89c8cc9d210b7fac7f | # -*- coding: utf-8 -*-
from flask import Blueprint, redirect
from flaskbb.utils.helpers import render_template
from .forms import AddForm, DeleteForm
from .models import MyPost
from flaskbb.extensions import db
news = Blueprint("news", __name__, template_folder="templates")
def inject_news_link():
return rende... | [((221, 277), 'flask.Blueprint', 'Blueprint', (['"""news"""', '__name__'], {'template_folder': '"""templates"""'}), "('news', __name__, template_folder='templates')\n", (230, 277), False, 'from flask import Blueprint, redirect\n'), ((315, 357), 'flaskbb.utils.helpers.render_template', 'render_template', (['"""navigatio... |
nkhetia31/stix-shifter | stix_shifter_modules/aws_athena/tests/stix_translation/test_aws_athena_json_to_stix.py | ace07581cb227fd35e450b2f8871475227a041d0 | from stix_shifter_utils.stix_translation.src.json_to_stix import json_to_stix_translator
from stix_shifter_utils.stix_translation.src.utils.transformer_utils import get_module_transformers
from stix_shifter_modules.aws_athena.entry_point import EntryPoint
import unittest
MODULE = "aws_athena"
entry_point = EntryPoint(... | [((309, 321), 'stix_shifter_modules.aws_athena.entry_point.EntryPoint', 'EntryPoint', ([], {}), '()\n', (319, 321), False, 'from stix_shifter_modules.aws_athena.entry_point import EntryPoint\n'), ((6403, 6434), 'stix_shifter_utils.stix_translation.src.utils.transformer_utils.get_module_transformers', 'get_module_transf... |
CodingGorit/Coding-with-Python | Python Spider/xpath/03 login.py | b0f1d5d704b816a85b0ae57b46d00314de2a67b9 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#file: 03 login.py
#@author: Gorit
#@contact: gorit@qq.com
#@time: 2020/1/20 12:44
import requests
from lxml import etree
# 封装类,进行学习猿地的登录和订单的获取
class lMonKey():
# 登录请求地址
loginUrl = "https://www.lmonkey.com/login"
# 账户中心地址
orderUrl = "https://www.lmonkey.com/my... | [((670, 688), 'requests.session', 'requests.session', ([], {}), '()\n', (686, 688), False, 'import requests\n'), ((1056, 1076), 'lxml.etree.HTML', 'etree.HTML', (['res.text'], {}), '(res.text)\n', (1066, 1076), False, 'from lxml import etree\n'), ((2042, 2062), 'lxml.etree.HTML', 'etree.HTML', (['res.text'], {}), '(res... |
fireclawthefox/AnkandoraLight | src/gui/MultiplayerPlayerInfo.py | 05b71e1a2919141cce02cb1aade95fbac682614b | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This file was created using the DirectGUI Designer
from direct.gui import DirectGuiGlobals as DGG
from direct.gui.DirectFrame import DirectFrame
from direct.gui.DirectLabel import DirectLabel
from direct.gui.DirectButton import DirectButton
from direct.gui.DirectOptionMenu... | [((648, 667), 'panda3d.core.LVecBase3f', 'LVecBase3f', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (658, 667), False, 'from panda3d.core import LPoint3f, LVecBase3f, LVecBase4f, TextNode\n'), ((733, 750), 'panda3d.core.LPoint3f', 'LPoint3f', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (741, 750), False, 'from panda3d.c... |
mkoo21/rss-review-scraper | publications/time_mag.py | 4adde8586ce55d7bb211bcfbb9bcccd1edc8b6a5 | from . import FROM_FEED_PUBLISHED_TODAY, STRINGIFY
def filter_by_tag(tag, entries):
matches = list(filter(
lambda x: any(list(map(
lambda y: y.term == tag,
x.tags
))),
entries
))
if len(matches) == 0:
return ""
return "<h2>TIME {} - {} result... | [] |
irobin591/advent-of-code-2019 | 2020/21/code.py | 279c28a2863558bd014b289802fff4b444c5d6cf | # Advent of Code 2020
# Day 21
# Author: irobin591
import os
import doctest
import re
re_entry = re.compile(r'^([a-z ]+) \(contains ([a-z, ]*)\)$')
with open(os.path.join(os.path.dirname(__file__), "input.txt"), 'r') as input_file:
input_data = input_file.read().strip().split('\n')
def part1(input_data):
"... | [((99, 150), 're.compile', 're.compile', (['"""^([a-z ]+) \\\\(contains ([a-z, ]*)\\\\)$"""'], {}), "('^([a-z ]+) \\\\(contains ([a-z, ]*)\\\\)$')\n", (109, 150), False, 'import re\n'), ((2887, 2904), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (2902, 2904), False, 'import doctest\n'), ((174, 199), 'os.path... |
copart/pandoc-mustache | tests/test_html_escaping.py | f6ace29cd0c8d6b4d8f182eedcf36ad38a2412fa | """
Test that escaping characters for HTML is disabled.
"""
import os, subprocess
def test_escape_singlequote(tmpdir):
# Define empty dictionaries
doc = {}
template = {}
# Prepare file names
doc['path'] = tmpdir.join("document.md")
template['path'] = tmpdir.join("template.yaml")
# Prepar... | [((800, 930), 'subprocess.check_output', 'subprocess.check_output', (["['pandoc', doc['path'].strpath, '--filter', 'pandoc-mustache', '--to=plain']"], {'universal_newlines': '(True)'}), "(['pandoc', doc['path'].strpath, '--filter',\n 'pandoc-mustache', '--to=plain'], universal_newlines=True)\n", (823, 930), False, '... |
iandees/microdata2osm | app.py | 1505b8072880055033ddbb85626fcdb857c97d4e | from flask import Flask, jsonify, request
from w3lib.html import get_base_url
import extruct
import requests
app = Flask(__name__)
def extract_osm_tags(data):
tags = {}
schema_org_type = data.get('@type')
if schema_org_type == 'Restaurant':
tags['amenity'] = 'restaurant'
serves_cuisine... | [((116, 131), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (121, 131), False, 'from flask import Flask, jsonify, request\n'), ((1866, 1889), 'flask.request.args.get', 'request.args.get', (['"""url"""'], {}), "('url')\n", (1882, 1889), False, 'from flask import Flask, jsonify, request\n'), ((2036, 2053), ... |
davemasino/airflow101 | dags/simple_python_taskflow_api.py | f940e169b9c562e3834a201827b615744a99b86d | """
A simple Python DAG using the Taskflow API.
"""
import logging
import time
from datetime import datetime
from airflow import DAG
from airflow.decorators import task
log = logging.getLogger(__name__)
with DAG(
dag_id='simple_python_taskflow_api',
schedule_interval=None,
start_date=datetime(2021, 1, 1)... | [((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((381, 410), 'airflow.decorators.task', 'task', ([], {'task_id': '"""hello_message"""'}), "(task_id='hello_message')\n", (385, 410), False, 'from airflow.decorators import task\n'), ((535,... |
kenkellner/pyunmarked | pyunmarked/roylenichols.py | 485bd96b4ca12a019b478fc19f68f577279ac9b8 | from . import model
import numpy as np
from scipy import special, stats
class RoyleNicholsModel(model.UnmarkedModel):
def __init__(self, det_formula, abun_formula, data):
self.response = model.Response(data.y)
abun = model.Submodel("Abundance", "abun", abun_formula, np.exp, data.site_covs)
... | [((522, 533), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (530, 533), True, 'import numpy as np\n'), ((1524, 1549), 'numpy.random.poisson', 'np.random.poisson', (['lam', 'N'], {}), '(lam, N)\n', (1541, 1549), True, 'import numpy as np\n'), ((1631, 1647), 'numpy.empty', 'np.empty', (['(N, J)'], {}), '((N, J))\n', (... |
pgriewank/ASR_tools | proc_chords_xarray.py | 306a7d92725888485a35f8824433ad7b0451b569 | #Contains the functions needed to process both chords and regularized beards
# proc_chords is used for chords
#proc_beard_regularize for generating beards
#proc_pdf saves pdfs of a variable below cloud base
#Both have a large overlap, but I split them in two to keep the one script from getting to confusing.
import nu... | [((2599, 2614), 'time.time', 'ttiimmee.time', ([], {}), '()\n', (2612, 2614), True, 'import time as ttiimmee\n'), ((2799, 2836), 'numpy.array', 'np.array', (['[5, 10, 35, 50, 65, 90, 95]'], {}), '([5, 10, 35, 50, 65, 90, 95])\n', (2807, 2836), True, 'import numpy as np\n'), ((4604, 4636), 'netCDF4.Dataset', 'Dataset', ... |
jfear/larval_gonad | expression-atlas-wf/scripts/dmel_tau_housekeeping.py | 624a71741864b74e0372f89bdcca578e5cca3722 | """D. mel housekeeping genes based on tau.
Uses the intersection of w1118 and orgR to create a list of
D. mel housekeeping genes.
"""
import os
from functools import partial
import pandas as pd
from larval_gonad.io import pickle_load, pickle_dump
def main():
# Load mapping of YOgn to FBgn
annot = pickle_loa... | [((310, 347), 'larval_gonad.io.pickle_load', 'pickle_load', (['snakemake.input.annot[0]'], {}), '(snakemake.input.annot[0])\n', (321, 347), False, 'from larval_gonad.io import pickle_load, pickle_dump\n'), ((912, 943), 'os.getenv', 'os.getenv', (['"""SNAKE_DEBUG"""', '(False)'], {}), "('SNAKE_DEBUG', False)\n", (921, 9... |
TK-IBM-Call-for-Code-Challange-2021/call-for-code-challenge-2021 | api-server/server/core/key.py | 7a3d78d4067303d61c4a25d45c0671ae7e984222 | """
Api Key validation
"""
from typing import Optional
from fastapi.security.api_key import APIKeyHeader
from fastapi import HTTPException, Security, Depends
from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_400_BAD_REQUEST, HTTP_403_FORBIDDEN
from server.core.security import verify_key
from server.db.mongodb ... | [((495, 543), 'fastapi.security.api_key.APIKeyHeader', 'APIKeyHeader', ([], {'name': '"""X-API-KEY"""', 'auto_error': '(False)'}), "(name='X-API-KEY', auto_error=False)\n", (507, 543), False, 'from fastapi.security.api_key import APIKeyHeader\n'), ((559, 608), 'fastapi.security.api_key.APIKeyHeader', 'APIKeyHeader', ([... |
Osirium/linuxkit | scripts/kconfig-split.py | b710224cdf9a8425a7129cdcb84fc1af00f926d7 | #!/usr/bin/env python
# This is a slightly modified version of ChromiumOS' splitconfig
# https://chromium.googlesource.com/chromiumos/third_party/kernel/+/stabilize-5899.B-chromeos-3.14/chromeos/scripts/splitconfig
"""See this page for more details:
http://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/kern... | [((514, 562), 're.match', 're.match', (['"""#*\\\\s*CONFIG_(\\\\w+)[\\\\s=](.*)$"""', 'line'], {}), "('#*\\\\s*CONFIG_(\\\\w+)[\\\\s=](.*)$', line)\n", (522, 562), False, 'import re\n')] |
Mannan2812/azure-cli-extensions | src/synapse/azext_synapse/vendored_sdks/azure_synapse/models/livy_statement_output.py | e2b34efe23795f6db9c59100534a40f0813c3d95 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | [] |
mafshar/sub-puppo | src/main.py | 20fe5bf3ca3d250d846c545085f748e706c4a33e | #!/usr/bin/env python
'''
Notes:
- Weak implies weakly supervised learning (4 classes)
- Strong implies strongly (fully) superversied learning (10 classes)
- frame number is set to 22ms (default); that is the "sweet spot" based on dsp literature
- sampling rate is 16kHz (for the MFCC of each track)
... | [] |
nmantani/FileInsight-plugins | plugins/Operations/Crypto/blowfish_encrypt_dialog.py | a6b036672e4c72ed06678729a86293212b7213db | #
# Blowfish encrypt - Encrypt selected region with Blowfish
#
# Copyright (c) 2019, Nobutaka Mantani
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code... | [((4675, 4698), 'sys.stdin.buffer.read', 'sys.stdin.buffer.read', ([], {}), '()\n', (4696, 4698), False, 'import sys\n'), ((4732, 4744), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (4742, 4744), False, 'import tkinter\n'), ((4855, 4888), 'tkinter.Label', 'tkinter.Label', (['root'], {'text': '"""Mode:"""'}), "(root, t... |
preo/dnspython | dns/rdtypes/IN/IPSECKEY.py | 465785f85f87508209117264c677080e901e957c | # Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | [((3869, 3940), 'struct.pack', 'struct.pack', (['"""!BBB"""', 'self.precedence', 'self.gateway_type', 'self.algorithm'], {}), "('!BBB', self.precedence, self.gateway_type, self.algorithm)\n", (3880, 3940), False, 'import struct\n'), ((4620, 4668), 'struct.unpack', 'struct.unpack', (['"""!BBB"""', 'wire[current:current ... |
Projjol/py-multistream-select | multistream_select/__init__.py | 624becaaeefa0a76d6841e27fbf7dea3240d2fe0 | __version = '0.1.0'
__all__ = ['MultiStreamSelect', 'hexify']
__author__ = 'Natnael Getahun (connect@ngetahun.me)'
__name__ = 'multistream'
from .multistream import MultiStreamSelect
from .utils import hexify
| [] |
dagesundholm/DAGE | python/input_reader.py | 0d0ef1d3e74ba751ca4d288db9f1ac7f9a822138 |
"""---------------------------------------------------------------------------------*
* Copyright (c) 2010-2018 Pauli Parkkinen, Eelis Solala, Wen-Hua Xu, *
* Sergio Losilla, Elias Toivanen, Jonas Juselius *
* ... | [((4551, 4564), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (4562, 4564), False, 'from collections import OrderedDict\n'), ((5096, 5126), 'os.path.dirname', 'os.path.dirname', (['complete_path'], {}), '(complete_path)\n', (5111, 5126), False, 'import os\n'), ((5798, 5827), 'os.path.exists', 'os.path.exi... |
MacHu-GWU/pathlib_mate-project | tests/test_mate_hashes_methods.py | 5b8f5441e681730d02209211cce7f46986147418 | # -*- coding: utf-8 -*-
import pytest
from pathlib_mate.pathlib2 import Path
class TestHashesMethods(object):
def test(self):
p = Path(__file__)
assert len({
p.md5, p.get_partial_md5(nbytes=1 << 20),
p.sha256, p.get_partial_sha256(nbytes=1 << 20),
p.sha512, p.g... | [((430, 456), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (446, 456), False, 'import os\n'), ((461, 505), 'pytest.main', 'pytest.main', (["[basename, '-s', '--tb=native']"], {}), "([basename, '-s', '--tb=native'])\n", (472, 505), False, 'import pytest\n'), ((145, 159), 'pathlib_mate.path... |
shoes22/openpilot | tools/lib/auth.py | a965de3c96a53b67d106cfa775e3407db82dd0e1 | #!/usr/bin/env python3
"""
Usage::
usage: auth.py [-h] [{google,apple,github,jwt}] [jwt]
Login to your comma account
positional arguments:
{google,apple,github,jwt}
jwt
optional arguments:
-h, --help show this help message and exit
Examples::
./auth.py # Log in with google accou... | [((2877, 2910), 'webbrowser.open', 'webbrowser.open', (['oauth_uri'], {'new': '(2)'}), '(oauth_uri, new=2)\n', (2892, 2910), False, 'import webbrowser\n'), ((3563, 3629), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Login to your comma account"""'}), "(description='Login to your comma ... |
IgorRidanovic/flapi | datedfolder.py | 7eb35cc670a5d1a06b01fb13982ffa63345369de | #! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Create a Baselight folder with current date and time stamp.
You must refresh the Job Manager after running the script.
Copyright (c) 2020 Igor Riđanović, Igor [at] hdhead.com, www.metafide.com
'''
import flapi
from getflapi import getflapi
from datetime import dateti... | [] |
zhidou2/PyElastica | elastica/wrappers/callbacks.py | 0f5502bc5349ab5e5dc794d8dfc82b7c2bd69eb6 | __doc__ = """
CallBacks
-----------
Provides the callBack interface to collect data over time (see `callback_functions.py`).
"""
from elastica.callback_functions import CallBackBaseClass
class CallBacks:
"""
CallBacks class is a wrapper for calling callback functions, set by the user. If the user
wants ... | [] |
HoonMinJeongUm/Hunmin-vitrage | vitrage/evaluator/template_data.py | 37d43d6b78e8b76fa6a2e83e5c739e9e4917a7b6 | # Copyright 2016 - Nokia
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [((624, 690), 'collections.namedtuple', 'namedtuple', (['"""ActionSpecs"""', "['id', 'type', 'targets', 'properties']"], {}), "('ActionSpecs', ['id', 'type', 'targets', 'properties'])\n", (634, 690), False, 'from collections import namedtuple\n'), ((714, 773), 'collections.namedtuple', 'namedtuple', (['"""EdgeDescripti... |
rpetit3/anthrax-metagenome-study | scripts/summarize-kmer-counts.py | b4a6f2c4d49b57aeae898afd6a95c8f6cb437945 | #! /usr/bin/env python3
"""Parse through the simulated sequencing group specific kmer counts."""
import argparse as ap
from collections import OrderedDict
import glob
import gzip
import os
import sys
import time
import numpy as np
import multiprocessing as mp
SAMPLES = OrderedDict()
KMERS = {}
HAMMING = OrderedDict()
... | [((271, 284), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (282, 284), False, 'from collections import OrderedDict\n'), ((306, 319), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (317, 319), False, 'from collections import OrderedDict\n'), ((1866, 1884), 'numpy.array', 'np.array', (['covera... |
te0dor/netguru-movies | movies/exceptions.py | 8e2cc4585851ad31794ec9e6a3e4dd70cc0980c5 | from marshmallow.exceptions import ValidationError
class ObjectDoesNotExist(Exception):
"""Exception if not found results"""
pass
class CommunicationError(Exception):
"""Exception for diferents problem with communications."""
pass
__all__ = ('ValidationError', 'ObjectDoesNotExist', 'CommunicationE... | [] |
fejiroofficial/Simple_music | music_api/apps/music_app/admin.py | 2dd9dcf8e5c7374e29dcf96987c053eebf1cba2a | from django.contrib import admin
from .models import Songs
admin.site.register(Songs)
# Register your models here.
| [((60, 86), 'django.contrib.admin.site.register', 'admin.site.register', (['Songs'], {}), '(Songs)\n', (79, 86), False, 'from django.contrib import admin\n')] |
JIC-Image-Analysis/senescence-in-field | scripts/generate_image_series.py | f310e34df377eb807423c38cf27d1ade0782f5a2 | # Draw image time series for one or more plots
from jicbioimage.core.image import Image
import dtoolcore
import click
from translate_labels import rack_plot_to_image_plot
from image_utils import join_horizontally, join_vertically
def identifiers_where_match_is_true(dataset, match_function):
return [i for i i... | [] |
Venafi/pytpp | pytpp/properties/response_objects/system_status.py | 42af655b2403b8c9447c86962abd4aaa0201f646 | from pytpp.properties.response_objects.dataclasses import system_status
from pytpp.tools.helpers.date_converter import from_date_string
class SystemStatus:
@staticmethod
def Engine(response_object: dict):
if not isinstance(response_object, dict):
response_object = {}
return system_... | [] |
mikkelfo/Title-prediction-from-abstract | src/data/dataModule.py | 45c9b64c963ae9b00c6b34a3f2b9f7c25496350e | from typing import Optional
import pytorch_lightning as pl
import torch
from omegaconf import OmegaConf
from torch.utils.data import DataLoader, random_split
from transformers import T5Tokenizer
from src.data.PaperDataset import PaperDataset
class ArvixDataModule(pl.LightningDataModule):
def __init__(self, conf... | [((412, 434), 'omegaconf.OmegaConf.load', 'OmegaConf.load', (['config'], {}), '(config)\n', (426, 434), False, 'from omegaconf import OmegaConf\n'), ((517, 555), 'transformers.T5Tokenizer.from_pretrained', 'T5Tokenizer.from_pretrained', (['"""t5-base"""'], {}), "('t5-base')\n", (544, 555), False, 'from transformers imp... |
ansobolev/shs | shs/gui/RootFrame.py | 7a5f61bd66fe1e8ae047a4d3400b055175a53f4e | # -*- coding: utf-8 -*-
import os
import sys
import time
import subprocess
import wx
import ConfigParser
from wx.lib.mixins.listctrl import getListCtrlSelection
from wx.lib.pubsub import pub
from gui.RootGUI import RootGUI
from StepsDialog import StepsDialog
from PlotFrame import PlotFuncFrame, PlotCorrFrame
import i... | [((614, 637), 'interface.dataClasses', 'interface.dataClasses', ([], {}), '()\n', (635, 637), False, 'import interface\n'), ((1645, 1679), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.local/shs"""'], {}), "('~/.local/shs')\n", (1663, 1679), False, 'import os\n'), ((1702, 1741), 'os.path.join', 'os.path.join', (... |
acabezasg/urpi-master | saleor/order/migrations/0015_auto_20170206_0407.py | 7c9cd0fbe6d89dad70652482712ca38b21ba6f84 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-06 10:07
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_prices.models
class Migration(migrations.Migration):
dependencies = [
... | [((392, 532), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""deliverygroup"""', 'options': "{'verbose_name': 'Delivery Group', 'verbose_name_plural': 'Delivery Groups'}"}), "(name='deliverygroup', options={'verbose_name':\n 'Delivery Group', 'verbose_name_plural': 'Delive... |
tonybearpan/testrail-lib | testrail_client/api/configurations.py | 267070bd017bb1d80ac40e1b84ea40dc2c2e3956 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from .base import TestRailAPIBase
class Config(TestRailAPIBase):
"""
Use the following API methods to request details
... | [] |
QARancher/k8s_client | tests/asserts_wrapper.py | b290caa5db12498ed9fbb2c972ab20141ff2c401 | def assert_not_none(actual_result, message=""):
if not message:
message = f"{actual_result} resulted with None"
assert actual_result, message
def assert_equal(actual_result, expected_result, message=""):
if not message:
message = f"{actual_result} is not equal to expected " \
... | [] |
ctring/Detock | tools/proto/transaction_pb2.py | a1171a511d9cd1f79cc3a8d54ec17f759d088de4 | # -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: proto/transaction.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from goo... | [((477, 503), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (501, 503), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((521, 4603), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""proto/transaction.prot... |
google/simple-reinforcement-learning | srl/simulation_test.py | 9bdac29427cd5c556d7ea7531b807645f043aae3 | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [((773, 796), 'srl.world.World.parse', 'world.World.parse', (['"""@^"""'], {}), "('@^')\n", (790, 796), False, 'from srl import world\n'), ((1017, 1040), 'srl.world.World.parse', 'world.World.parse', (['"""@."""'], {}), "('@.')\n", (1034, 1040), False, 'from srl import world\n'), ((1231, 1257), 'srl.world.World.parse',... |
Tejvinder/thesis-ghidra | src/xmltollvm.py | 2e59bc48d6bb820ecf6b390e5cf5893fc6ea0216 | from llvmlite import ir
import xml.etree.ElementTree as et
int32 = ir.IntType(32)
int64 = ir.IntType(64)
int1 = ir.IntType(1)
void_type = ir.VoidType()
function_names = []
registers, functions, uniques, extracts = {}, {}, {}, {}
internal_functions = {}
memory = {}
flags = ["ZF", "CF", "OF", "SF"]
pointers = ["RSP", "R... | [((68, 82), 'llvmlite.ir.IntType', 'ir.IntType', (['(32)'], {}), '(32)\n', (78, 82), False, 'from llvmlite import ir\n'), ((91, 105), 'llvmlite.ir.IntType', 'ir.IntType', (['(64)'], {}), '(64)\n', (101, 105), False, 'from llvmlite import ir\n'), ((113, 126), 'llvmlite.ir.IntType', 'ir.IntType', (['(1)'], {}), '(1)\n', ... |
Farz7/Darkness | modules/WPSeku/modules/discovery/generic/wplisting.py | 4f3eb5fee3d8a476d001ad319ca22bca274eeac9 | #/usr/bin/env python
# -*- Coding: UTF-8 -*-
#
# WPSeku: Wordpress Security Scanner
#
# @url: https://github.com/m4ll0k/WPSeku
# @author: Momo Outaadi (M4ll0k)
import re
from lib import wphttp
from lib import wpprint
class wplisting:
chk = wphttp.UCheck()
out = wpprint.wpprint()
def __init__(self,agent,proxy... | [] |
toscawidgets/tw2.jit | tw2/jit/widgets/__init__.py | c5e8059975115385f225029ba5c7380673524122 |
from tw2.jit.widgets.chart import (AreaChart, BarChart, PieChart)
from tw2.jit.widgets.graph import (ForceDirectedGraph, RadialGraph)
from tw2.jit.widgets.tree import (SpaceTree, HyperTree, Sunburst,
Icicle, TreeMap)
from tw2.jit.widgets.ajax import AjaxRadialGraph
from tw2.jit.widget... | [] |
tiianprb/TikTok-Downloader-Bot | bot.py | 91b6fd64d5a151c3e439772c69850a18b7562ceb | import json, requests, os, shlex, asyncio, uuid, shutil
from typing import Tuple
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, CallbackQuery
# Configs
API_HASH = os.environ['API_HASH']
APP_ID = int(os.environ['APP_ID'])
BOT_TOKEN = os.environ['BOT_T... | [((887, 960), 'pyrogram.Client', 'Client', (['"""TikTokDL"""'], {'api_id': 'APP_ID', 'api_hash': 'API_HASH', 'bot_token': 'BOT_TOKEN'}), "('TikTokDL', api_id=APP_ID, api_hash=API_HASH, bot_token=BOT_TOKEN)\n", (893, 960), False, 'from pyrogram import Client, filters\n'), ((1067, 1083), 'shlex.split', 'shlex.split', (['... |
skyu0221/660-iot | frontend-gui/rpanel.py | d31f973c93871bfa8122f1b83364d0147d402e9e | import wx
import wx.adv
import random
import util
import config
import time
import datetime
import threading
import requests
import json
from functools import partial
class ReqeusterThread(threading.Thread):
# https://www.oreilly.com/library/view/python-cookbook/0596001673/ch06s03.html
def __init__(self, ... | [((364, 406), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {'name': 'name'}), '(self, name=name)\n', (389, 406), False, 'import threading\n'), ((442, 459), 'threading.Event', 'threading.Event', ([], {}), '()\n', (457, 459), False, 'import threading\n'), ((1280, 1316), 'threading.Thread.join', 't... |
henchan/memfinity | webapp/search.py | 3860985e29b203f0569f60eea68ffb22aaf34b1f | """High-level search API.
This module implements application-specific search semantics on top of
App Engine's search API. There are two chief operations: querying for
entities, and managing entities in the search facility.
Add and remove Card entities in the search facility:
insert_cards([models.Card])
delete_ca... | [((1805, 1839), 'google.appengine.api.search.Index', 'search.Index', ([], {'name': 'CARD_INDEX_NAME'}), '(name=CARD_INDEX_NAME)\n', (1817, 1839), False, 'from google.appengine.api import search\n'), ((1968, 2002), 'google.appengine.api.search.Index', 'search.Index', ([], {'name': 'CARD_INDEX_NAME'}), '(name=CARD_INDEX_... |
Baidi96/AI-Agent-for-Light-Rider | Bot/Bot/board.py | 6ae0cd4ea07248751c0f015ed74123ae3dec33d1 | import copy
import sys
PLAYER1, PLAYER2, EMPTY, BLOCKED = [0, 1, 2, 3]
S_PLAYER1, S_PLAYER2, S_EMPTY, S_BLOCKED, = ['0', '1', '.', 'x']
CHARTABLE = [(PLAYER1, S_PLAYER1), (PLAYER2, S_PLAYER2), (EMPTY, S_EMPTY), (BLOCKED, S_BLOCKED)]
DIRS = [
((-1, 0), "up"),
((1, 0), "down"),
((0, 1), "right"),
((0, ... | [((3157, 3179), 'sys.stderr.write', 'sys.stderr.write', (['"""\n"""'], {}), "('\\n')\n", (3173, 3179), False, 'import sys\n'), ((3188, 3206), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (3204, 3206), False, 'import sys\n'), ((2931, 2952), 'sys.stderr.write', 'sys.stderr.write', (['"""!"""'], {}), "('!')\n... |
wonnerky/coteMaster | baekjoon/1012.py | 360e491e6342c1ee42ff49750b838a2ead865613 | import sys
sys.setrecursionlimit(10000)
def dfs(r, c):
global visit
visit[r][c] = True
mov = [(-1, 0), (0, -1), (1, 0), (0, 1)]
for i in range(4):
dr, dc = mov[i]
nr, nc = r + dr, c + dc
if 0 <= nr < N and 0 <= nc < M and visit[nr][nc] == False and board[nr][nc] == 1:
... | [((12, 40), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10000)'], {}), '(10000)\n', (33, 40), False, 'import sys\n')] |
daemonslayer/Notebook | collection/cp/algorithms-master/python/binary_tree.py | a9880be9bd86955afd6b8f7352822bc18673eda3 | """
Binary Tree and basic properties
1. In-Order Traversal
2. Pre-Order Traversal
3. Post-Order Traversal
4. Level-Order Traversal
"""
from collections import deque
class BinaryTree(object):
"""
Representation of a general binary tree
data: value of element
left: Left subtree
right: Right subtree
... | [((4823, 4830), 'collections.deque', 'deque', ([], {}), '()\n', (4828, 4830), False, 'from collections import deque\n')] |
rohankapoorcom/vaddio_conferenceshot | custom_components/vaddio_conferenceshot/const.py | 71744710df10f77e21e9e7568e3f6c7175b0d11d | import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PATH, CONF_USERNAME
DOMAIN = "vaddio_conferenceshot"
DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_HOST): cv.string,
vol.Required(CONF_USERNAME): cv.string,... | [((237, 260), 'voluptuous.Required', 'vol.Required', (['CONF_HOST'], {}), '(CONF_HOST)\n', (249, 260), True, 'import voluptuous as vol\n'), ((281, 308), 'voluptuous.Required', 'vol.Required', (['CONF_USERNAME'], {}), '(CONF_USERNAME)\n', (293, 308), True, 'import voluptuous as vol\n'), ((329, 356), 'voluptuous.Required... |
lightonai/lightonml | lightonml/opu.py | 451327cccecdca4e8ec65df30f30d3fd8ad2194f | # Copyright (c) 2020 LightOn, All Rights Reserved.
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
"""
This module contains the OPU class
"""
import time
from math import sqrt
import pkg_resources
from lightonml.encoding.base import NoEnco... | [((5881, 5905), 'lightonml.get_debug_fn', 'lightonml.get_debug_fn', ([], {}), '()\n', (5903, 5905), False, 'import lightonml\n'), ((5928, 5952), 'lightonml.get_trace_fn', 'lightonml.get_trace_fn', ([], {}), '()\n', (5950, 5952), False, 'import lightonml\n'), ((5975, 5999), 'lightonml.get_print_fn', 'lightonml.get_print... |
demiurgestudios/shovel | example/shovel/bar.py | 3db497164907d3765fae182959147d19064671c7 | from shovel import task
@task
def hello(name='Foo'):
'''Prints "Hello, " followed by the provided name.
Examples:
shovel bar.hello
shovel bar.hello --name=Erin
http://localhost:3000/bar.hello?Erin'''
print('Hello, %s' % name)
@task
def args(*args):
'''Echos back all the ar... | [] |
timgates42/trex-core | scripts/external_libs/scapy-2.4.3/scapy/config.py | efe94752fcb2d0734c83d4877afe92a3dbf8eccd | # This file is part of Scapy
# See http://www.secdev.org/projects/scapy for more information
# Copyright (C) Philippe Biondi <phil@secdev.org>
# This program is published under a GPLv2 license
"""
Implementation of the configuration object.
"""
from __future__ import absolute_import
from __future__ import print_funct... | [((11246, 11290), 're.match', 're.match', (['version_regexp', 'module.__version__'], {}), '(version_regexp, module.__version__)\n', (11254, 11290), False, 'import re\n'), ((16251, 16274), 'scapy.error.log_scapy.setLevel', 'log_scapy.setLevel', (['val'], {}), '(val)\n', (16269, 16274), False, 'from scapy.error import lo... |
Prodigy123/rasa_nlu_zh | tests/base/test_server.py | b85717063a493f6b148504ee550a0642c6c379ae | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import tempfile
import pytest
import time
from treq.testing import StubTreq
from rasa_nlu.config import RasaNLUConfig
import json
import io
fr... | [((426, 456), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (440, 456), False, 'import pytest\n'), ((669, 715), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'suffix': '"""_rasa_nlu_logs.json"""'}), "(suffix='_rasa_nlu_logs.json')\n", (685, 715), False, 'import tempfile\n'),... |
ForroKulcs/bugsnag-python | bugsnag/configuration.py | 107c1add31a2202cc08ef944aa00ab96996b247a | import os
import platform
import socket
import sysconfig
from typing import List, Any, Tuple, Union
import warnings
from bugsnag.sessiontracker import SessionMiddleware
from bugsnag.middleware import DefaultMiddleware, MiddlewareStack
from bugsnag.utils import (fully_qualified_class_name, validate_str_setter,
... | [((703, 746), 'contextvars.ContextVar', 'ContextVar', (['"""bugsnag-request"""'], {'default': 'None'}), "('bugsnag-request', default=None)\n", (713, 746), False, 'from contextvars import ContextVar\n'), ((850, 899), 'bugsnag.utils.ThreadContextVar', 'ThreadContextVar', (['"""bugsnag-request"""'], {'default': 'None'}), ... |
failk8s/failk8s-operator | secret_injector/secret.py | 457890a09a2551b9002eec73386b11a37469569f | import kopf
from .functions import global_logger, reconcile_secret
@kopf.on.event("", "v1", "secrets")
def injector_secret_event(type, event, logger, **_):
obj = event["object"]
namespace = obj["metadata"]["namespace"]
name = obj["metadata"]["name"]
# If secret already exists, indicated by type bein... | [((71, 105), 'kopf.on.event', 'kopf.on.event', (['""""""', '"""v1"""', '"""secrets"""'], {}), "('', 'v1', 'secrets')\n", (84, 105), False, 'import kopf\n')] |
openforis/collectearthonline | src/py/gee/utils.py | 1af48e373c393a1d8c48b17472f6aa6c41f65769 | import datetime
import os
import ee
import math
import sys
import json
from ee.ee_exception import EEException
from gee.inputs import getLandsat, getS1
########## Helper functions ##########
def initialize(ee_account='', ee_key_path=''):
try:
if ee_account and ee_key_path and os.path.exis... | [((2528, 2543), 'ee.Image', 'ee.Image', (['image'], {}), '(image)\n', (2536, 2543), False, 'import ee\n'), ((2887, 2914), 'ee.ImageCollection', 'ee.ImageCollection', (['assetId'], {}), '(assetId)\n', (2905, 2914), False, 'import ee\n'), ((3383, 3410), 'ee.ImageCollection', 'ee.ImageCollection', (['assetId'], {}), '(ass... |
shubhamguptaorg/user_managementl | userManagement/management/urls.py | ad98e0e4886d9b0547b05ae424c10d8f6268d470 | from django.contrib import admin
from django.urls import path,include
from django.views.generic import TemplateView
from .views import Index,SignUp,UserDashboard,AdminDashboard,logout,showAdminData,deleteuser,activeUser,deactiveUser,UserDetailEdit,uploadImage
# from .views import Index,UserDashboard,SignUp,AdminDashboa... | [((734, 825), 'django.urls.path', 'path', (['"""admindashboard/showuserdata/deleteuser/<userId>"""', 'deleteuser'], {'name': '"""deleteuser"""'}), "('admindashboard/showuserdata/deleteuser/<userId>', deleteuser, name=\n 'deleteuser')\n", (738, 825), False, 'from django.urls import path, include\n'), ((824, 915), 'dj... |
Branlala/docker-sickbeardfr | sickbeard/lib/hachoir_parser/container/riff.py | 3ac85092dc4cc8a4171fb3c83e9682162245e13e | # -*- coding: UTF-8 -*-
"""
RIFF parser, able to parse:
* AVI video container
* WAV audio container
* CDA file
Documents:
- libavformat source code from ffmpeg library
http://ffmpeg.mplayerhq.hu/
- Video for Windows Programmer's Guide
http://www.opennet.ru/docs/formats/avi.txt
- What is an animated curso... | [((3846, 3937), 'lib.hachoir_core.field.String', 'String', (['self', '"""fourcc"""', '(4)', '"""Stream four character code"""'], {'strip': "' \\x00'", 'charset': '"""ASCII"""'}), "(self, 'fourcc', 4, 'Stream four character code', strip=' \\x00',\n charset='ASCII')\n", (3852, 3937), False, 'from lib.hachoir_core.fiel... |
MartinEngen/NaiveBayesianClassifier | Utils.py | a28813708a4d2adcdcd629e6d4d8b4f438a9c799 | import os
import re
def get_subfolder_paths(folder_relative_path: str) -> list:
"""
Gets all subfolders of a given path
:param folder_relative_path: Relative path of folder to find subfolders of
:return: list of relative paths to any subfolders
"""
return [f.path for f in os.scandir(folder_rel... | [((299, 331), 'os.scandir', 'os.scandir', (['folder_relative_path'], {}), '(folder_relative_path)\n', (309, 331), False, 'import os\n')] |
carlboudreau007/ecosys | tools/ldbc_benchmark/neo4j/load_scripts/time_index.py | d415143837a85ceb6213a0f0588128a86a4a3984 | from datetime import datetime
with open('/home/neo4j/neo4j-community-3.5.1/logs/debug.log', 'r') as log:
begin = []
end = []
for line in log:
if 'Index population started' in line:
begin.append(line[:23])
elif 'Index creation finished' in line:
end.append(line[:23])
if len(begin) == 0 or le... | [((573, 624), 'datetime.datetime.strptime', 'datetime.strptime', (['begin[i]', '"""%Y-%m-%d %H:%M:%S.%f"""'], {}), "(begin[i], '%Y-%m-%d %H:%M:%S.%f')\n", (590, 624), False, 'from datetime import datetime\n'), ((641, 690), 'datetime.datetime.strptime', 'datetime.strptime', (['end[i]', '"""%Y-%m-%d %H:%M:%S.%f"""'], {})... |
Ziki2001/new-school-sdk | zf-setup.py | b606e666888e1c9813e2f1a6a64bbede3744026e | # -*- coding: utf-8 -*-
'''
:file: setup.py
:author: -Farmer
:url: https://blog.farmer233.top
:date: 2021/09/20 11:11:54
'''
from os import path
from setuptools import setup, find_packages
basedir = path.abspath(path.dirname(__file__))
with open(path.join(basedir, "README.md"), encoding='utf-8') as f... | [((230, 252), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (242, 252), False, 'from os import path\n'), ((265, 296), 'os.path.join', 'path.join', (['basedir', '"""README.md"""'], {}), "(basedir, 'README.md')\n", (274, 296), False, 'from os import path\n'), ((703, 718), 'setuptools.find_package... |
antx-code/funcode | RunIt/airt/poker_cards.py | a8a9b99274e169562771b488a3a9551277ef4b99 | # Square 方片 => sq => RGB蓝色(Blue)
# Plum 梅花 => pl => RGB绿色(Green)
# Spade 黑桃 => sp => RGB黑色(Black)
# Heart 红桃 => he => RGB红色(Red)
init_poker = {
'local': {
'head': [-1, -1, -1],
'mid': [-1, -1, -1, -1, -1],
'tail': [-1, -1, -1, -1, -1],
'drop': [-1, -1... | [] |
reflective21/iportfolio | main.py | 39db626a9754c1df44ac698f3d8988fdc4e7c6d5 | name = "David Asiru Adetomiwa"
print(name) | [] |
kdeltared/tcex | tcex/services/api_service.py | 818c0d09256764f871e42d9ca5916f92d941d882 | """TcEx Framework API Service module."""
# standard library
import json
import sys
import threading
import traceback
from io import BytesIO
from typing import Any
from .common_service import CommonService
class ApiService(CommonService):
"""TcEx Framework API Service module."""
def __init__(self, tcex: obje... | [((5617, 5634), 'threading.Event', 'threading.Event', ([], {}), '()\n', (5632, 5634), False, 'import threading\n'), ((4158, 4178), 'json.dumps', 'json.dumps', (['response'], {}), '(response)\n', (4168, 4178), False, 'import json\n'), ((1505, 1527), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (1525... |
vsatyakumar/mmpose | mmpose/core/optimizer/builder.py | 2fffccb19dad3b59184b41be94653f75523b8585 | from mmcv.runner import build_optimizer
def build_optimizers(model, cfgs):
"""Build multiple optimizers from configs.
If `cfgs` contains several dicts for optimizers, then a dict for each
constructed optimizers will be returned.
If `cfgs` only contains one optimizer config, the constructed optimizer
... | [((1511, 1539), 'mmcv.runner.build_optimizer', 'build_optimizer', (['model', 'cfgs'], {}), '(model, cfgs)\n', (1526, 1539), False, 'from mmcv.runner import build_optimizer\n'), ((1430, 1459), 'mmcv.runner.build_optimizer', 'build_optimizer', (['module', 'cfg_'], {}), '(module, cfg_)\n', (1445, 1459), False, 'from mmcv.... |
angel-vazquez25/My-Backlog-Handler | register/views.py | 60880cfc6bcc5a7fb2d5c752c11bdfe741f76531 | import datetime
from django.contrib.auth import logout
from django.shortcuts import render, redirect
from .forms import RegisterForm
from django.http import HttpResponse
from django.contrib.auth.forms import AuthenticationForm
from django.conf import settings
from django.contrib.auth import authenticate, login
from dj... | [((499, 519), 'django.shortcuts.redirect', 'redirect', (['"""homepage"""'], {}), "('homepage')\n", (507, 519), False, 'from django.shortcuts import render, redirect\n'), ((1128, 1186), 'django.shortcuts.render', 'render', (['response', '"""register/register.html"""', "{'form': form}"], {}), "(response, 'register/regist... |
Aerodlyn/mu | forum/migrations/0001_initial.py | 2c3b95e5a83d0f651dd8ad287b471803e1fec3a1 | # Generated by Django 3.1.7 on 2021-03-26 01:27
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Community',
fields=[
('name', models.CharFi... | [((307, 373), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'primary_key': '(True)', 'serialize': '(False)'}), '(max_length=64, primary_key=True, serialize=False)\n', (323, 373), False, 'from django.db import migrations, models\n'), ((408, 426), 'django.db.models.TextField', 'models.Text... |
shirley-wu/text_to_table | custom_train.py | 44cb100b8ff2543b5b4efe1461502c00c34ef846 | #!/usr/bin/env python3 -u
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Train a new model on one or across multiple GPUs.
"""
import collections
import logging
import math
import os
im... | [((1010, 1048), 'logging.getLogger', 'logging.getLogger', (['"""fairseq_cli.train"""'], {}), "('fairseq_cli.train')\n", (1027, 1048), False, 'import logging\n'), ((9829, 9855), 'fairseq.logging.metrics.aggregate', 'metrics.aggregate', (['"""train"""'], {}), "('train')\n", (9846, 9855), False, 'from fairseq.logging impo... |
JessicaWiedemeier/IDV | src/ucar/unidata/idv/resources/python/griddiag.py | e5f67c755cc95f8ad2123bdc45a91f0e5eca0d64 | """
This is the doc for the Grid Diagnostics module. These functions
are based on the grid diagnostics from the GEneral Meteorological
PAcKage (GEMPAK). Note that the names are case sensitive and some
are named slightly different from GEMPAK functions to avoid conflicts
with Jython built-ins (e.g. st... | [] |
DevilBit/Twitter-Bot | app.py | 6f1b285aeb5faf37906d575775a927e69a5321d6 | from selenium import webdriver #to get the browser
from selenium.webdriver.common.keys import Keys #to send key to browser
import getpass #to get password safely
import time #to pause the program
#a calss to store all twetter related objects and functions
class twitter_bot:
def __init__(self, username, pas... | [((2188, 2217), 'getpass.getpass', 'getpass.getpass', (['"""Password: """'], {}), "('Password: ')\n", (2203, 2217), False, 'import getpass\n'), ((2331, 2345), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (2341, 2345), False, 'import time\n'), ((416, 435), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([],... |
shyhyawJou/GradCAM-pytorch | visualization.py | 8159f077552fc71055fe97c17bf8544d32cc8b0f | import torch
import torch.nn as nn
from torch.nn import functional as F
from PIL import Image
import cv2 as cv
from matplotlib import cm
import numpy as np
class GradCAM:
"""
#### Args:
layer_name: module name (not child name), if None,
will use the last layer befor... | [((1644, 1659), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1657, 1659), False, 'import torch\n'), ((2015, 2032), 'torch.nn.functional.relu', 'F.relu', (['cam', '(True)'], {}), '(cam, True)\n', (2021, 2032), True, 'from torch.nn import functional as F\n'), ((2200, 2245), 'cv2.resize', 'cv.resize', (['cam', 'im... |
Mechachleopteryx/CogAlg | frame_2D_alg/alternative versions/intra_blob_xy.py | 723104e1f57010e52f1dc249ba53ba58db0a991b | '''
2D version of 1st-level algorithm is a combination of frame_blobs, intra_blob, and comp_P: optional raster-to-vector conversion.
intra_blob recursively evaluates each blob for two forks of extended internal cross-comparison and sub-clustering:
der+: incremental derivation cross-comp in high-variati... | [((5849, 5856), 'collections.deque', 'deque', ([], {}), '()\n', (5854, 5856), False, 'from collections import deque, defaultdict\n'), ((5919, 5940), 'class_bind.AdjBinder', 'AdjBinder', (['CDeepStack'], {}), '(CDeepStack)\n', (5928, 5940), False, 'from class_bind import AdjBinder\n'), ((7019, 7039), 'class_bind.AdjBind... |
felipeek/bullet3 | examples/pybullet/gym/pybullet_envs/minitaur/envs/env_randomizers/minitaur_terrain_randomizer.py | 6a59241074720e9df119f2f86bc01765917feb1e | """Generates a random terrain at Minitaur gym environment reset."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path... | [((398, 430), 'os.sys.path.insert', 'os.sys.path.insert', (['(0)', 'parentdir'], {}), '(0, parentdir)\n', (416, 430), False, 'import os, inspect\n'), ((313, 340), 'os.path.dirname', 'os.path.dirname', (['currentdir'], {}), '(currentdir)\n', (328, 340), False, 'import os, inspect\n'), ((370, 396), 'os.path.dirname', 'os... |
furious-luke/polecat | polecat/db/sql/expression/values.py | 7be5110f76dc42b15c922c1bb7d49220e916246d | from functools import partial
from polecat.db.query import query as query_module
from psycopg2.sql import SQL, Placeholder
from .expression import Expression
class Values(Expression):
def __init__(self, values, relation=None):
self.values = values
self.relation = relation
self.keyword = ... | [((438, 491), 'functools.partial', 'partial', (['self.get_values_sql_from_values', 'self.values'], {}), '(self.get_values_sql_from_values, self.values)\n', (445, 491), False, 'from functools import partial\n'), ((565, 616), 'functools.partial', 'partial', (['self.get_values_sql_from_dict', 'self.values'], {}), '(self.g... |
swilcox/2019adventofcode | python/day3p1.py | b67261aae74805ba8c2f4b72f09dd79277224ebb | # 2019 advent day 3
MOVES = {
'R': (lambda x: (x[0], x[1] + 1)),
'L': (lambda x: (x[0], x[1] - 1)),
'U': (lambda x: (x[0] + 1, x[1])),
'D': (lambda x: (x[0] - 1, x[1])),
}
def build_route(directions: list) -> list:
current_location = (0, 0)
route = []
for d in directions:
directio... | [] |
JavDomGom/mist | examples/demo/python/catalog.py | 83ae9f67df61ff2387a7d424cff0f8591a6a645f | import asyncio
async def searchDomains(domain, q):
domains = []
proc = await asyncio.create_subprocess_shell(f"dnsrecon -d {domain} -t crt", stdout=asyncio.subprocess.PIPE)
line = True
while line:
line = (await proc.stdout.readline()).decode('utf-8')
fields = line.split()
if len... | [((86, 186), 'asyncio.create_subprocess_shell', 'asyncio.create_subprocess_shell', (['f"""dnsrecon -d {domain} -t crt"""'], {'stdout': 'asyncio.subprocess.PIPE'}), "(f'dnsrecon -d {domain} -t crt', stdout=\n asyncio.subprocess.PIPE)\n", (117, 186), False, 'import asyncio\n'), ((541, 641), 'asyncio.create_subprocess_... |
CiscoISE/ciscoisesdk | tests/api/v3_1_0/test_security_groups_acls.py | 860b0fc7cc15d0c2a39c64608195a7ab3d5f4885 | # -*- coding: utf-8 -*-
"""IdentityServicesEngineAPI security_groups_acls API fixtures and tests.
Copyright (c) 2021 Cisco and/or its affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software w... | [((1432, 1533), 'pytest.mark.skipif', 'pytest.mark.skipif', (["(IDENTITY_SERVICES_ENGINE_VERSION != '3.1.0')"], {'reason': '"""version does not match"""'}), "(IDENTITY_SERVICES_ENGINE_VERSION != '3.1.0', reason=\n 'version does not match')\n", (1450, 1533), False, 'import pytest\n'), ((2346, 2400), 'pytest.raises', ... |
stefanheyder/geomstats | geomstats/geometry/riemannian_metric.py | c4e6d959db7b1bcc99b00b535b8aa5d832b62e28 | """Riemannian and pseudo-Riemannian metrics."""
import math
import warnings
import autograd
import geomstats.backend as gs
from geomstats.geometry.connection import Connection
EPSILON = 1e-4
N_CENTERS = 10
TOLERANCE = 1e-5
N_REPETITIONS = 20
N_MAX_ITERATIONS = 50000
N_STEPS = 10
def loss(y_pred, y_true, metric):... | [((1052, 1096), 'geomstats.backend.transpose', 'gs.transpose', (['inner_prod_mat'], {'axes': '(0, 2, 1)'}), '(inner_prod_mat, axes=(0, 2, 1))\n', (1064, 1096), True, 'import geomstats.backend as gs\n'), ((2163, 2191), 'geomstats.backend.linalg.inv', 'gs.linalg.inv', (['metric_matrix'], {}), '(metric_matrix)\n', (2176, ... |
hettlage/salt-data-quality-site | app/main/pages/instrument/hrs/red/order/plots.py | da9ff4a51e8affa47e0bc1c0383c7fdeaac2155e | import pandas as pd
from bokeh.models import HoverTool
from bokeh.models.formatters import DatetimeTickFormatter
from bokeh.palettes import Plasma256
from bokeh.plotting import figure, ColumnDataSource
from app import db
from app.decorators import data_quality
# creates your plot
date_formatter = DatetimeTickFormatt... | [((301, 535), 'bokeh.models.formatters.DatetimeTickFormatter', 'DatetimeTickFormatter', ([], {'microseconds': "['%f']", 'milliseconds': "['%S.%2Ns']", 'seconds': "[':%Ss']", 'minsec': "[':%Mm:%Ss']", 'minutes': "['%H:%M:%S']", 'hourmin': "['%H:%M:']", 'hours': "['%H:%M']", 'days': "['%d %b']", 'months': "['%d %b %Y']",... |
yannickbf-prog/python | p6e8.py | da4bd2c8668966359b829a8ac2a896afeca2b150 | #Yannick p6e8 Escribe un programa que te pida primero un número y luego te pida números hasta que la suma de los números introducidos coincida con el número inicial. El programa termina escribiendo la lista de números.
limite = int(input("Escribe limite:"))
valores = int(input("Escribe un valor:"))
listavalore... | [] |
RivtLib/replit01 | .venv/lib/python3.8/site-packages/cleo/application.py | ce1ae18b446a9c844f40e88a51c71fbc45ab3ad7 | from typing import Optional
from typing import Tuple
from clikit.console_application import ConsoleApplication
from .commands import BaseCommand
from .commands.completions_command import CompletionsCommand
from .config import ApplicationConfig
class Application(ConsoleApplication, object):
"""
A... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.