repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
840k
sauli6692/barbershop
employees/choices.py
862357bd78235e720b2e3b868d2423a57bb4e328
from django.utils.translation import ugettext_lazy as _ USER_TYPE_STAFF = 'STAFF' USER_TYPE_ADMIN = 'ADMIN' USER_TYPE_BARBER = 'BARBER' USER_TYPE_CHOICES = ( (USER_TYPE_STAFF, _('Dev')), (USER_TYPE_ADMIN, _('Admin')), (USER_TYPE_BARBER, _('Barber')), )
[((8, 22, 8, 30), 'django.utils.translation.ugettext_lazy', '_', ({(8, 24, 8, 29): '"""Dev"""'}, {}), "('Dev')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((9, 22, 9, 32), 'django.utils.translation.ugettext_lazy', '_', ({(9, 24, 9, 31): '"""Admin"""'}, {}), "('Admin')", True, 'from django.util...
google-ar/chromium
tools/chrome_proxy/integration_tests/chrome_proxy_pagesets/html5test.py
2441c86a5fd975f09a6c30cddb57dfb7fc239699
# Copyright 2016 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. from common.chrome_proxy_shared_page_state import ChromeProxySharedPageState from telemetry.page import page as page_module from telemetry import story cla...
[]
eliranM98/python_course
lessons/sqlite_example/database.py
d9431dd6c0f27fca8ca052cc2a821ed0b883136c
""" in this example we want to create a user credentials database with: user_id & password logger showing connection logs, DB version, errors during fetching & executing """ import sqlite3 from lessons.sqlite_example.log import create as create_logger class Commands: create_users_table = ''' CREATE TABLE...
[((111, 10, 111, 42), 'lessons.sqlite_example.log.create', 'create_logger', (), '', True, 'from lessons.sqlite_example.log import create as create_logger\n'), ((38, 30, 38, 54), 'sqlite3.connect', 'sqlite3.connect', ({(38, 46, 38, 53): 'db_file'}, {}), '(db_file)', False, 'import sqlite3\n'), ((109, 31, 109, 56), 'os.p...
emmawoollett/projectx
backend/app/projectx/routing.py
c061df01d581456884f46c2b8e3b478626501dec
from django.urls import re_path from projectx.consumers import UserWebSocketConsumer from .consumers import UserWebSocketConsumer websocket_urlpatterns = [ re_path(r"^ws/$", UserWebSocketConsumer.as_asgi()), ]
[((8, 22, 8, 53), 'projectx.consumers.UserWebSocketConsumer.as_asgi', 'UserWebSocketConsumer.as_asgi', ({}, {}), '()', False, 'from projectx.consumers import UserWebSocketConsumer\n')]
lab360-ch/aldryn-search
aldryn_search/cms_apps.py
15a319edac126aa1e44f22d34a7bcb5aec3e3dde
from django.utils.translation import ugettext_lazy as _ from cms.app_base import CMSApp from cms.apphook_pool import apphook_pool from .conf import settings class AldrynSearchApphook(CMSApp): name = _("aldryn search") def get_urls(self, *args, **kwargs): return ['aldryn_search.urls'] if settings....
[((10, 11, 10, 29), 'django.utils.translation.ugettext_lazy', '_', ({(10, 13, 10, 28): '"""aldryn search"""'}, {}), "('aldryn search')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((17, 4, 17, 46), 'cms.apphook_pool.apphook_pool.register', 'apphook_pool.register', ({(17, 26, 17, 45): 'AldrynSea...
t2y/python-study
BizPy/openpyxl/20200513/horizontal_chart.py
52a132ea600d4696164e540d8a8f8f5fc58e097a
import pandas as pd from openpyxl import Workbook from openpyxl.chart import BarChart, Reference wb = Workbook() ws = wb.active df = pd.read_csv('population.csv') ws.append(df.columns.tolist()) for row in df.values: ws.append(list(row)) row_length = 1 + len(df.values) values = Reference(ws, min_col=...
[((5, 5, 5, 15), 'openpyxl.Workbook', 'Workbook', ({}, {}), '()', False, 'from openpyxl import Workbook\n'), ((8, 5, 8, 34), 'pandas.read_csv', 'pd.read_csv', ({(8, 17, 8, 33): '"""population.csv"""'}, {}), "('population.csv')", True, 'import pandas as pd\n'), ((14, 9, 14, 75), 'openpyxl.chart.Reference', 'Reference', ...
alex/changes
changes/api/serializer/models/logsource.py
69a17b4c639e7082a75d037384ccb68ead3a0b4b
from changes.api.serializer import Serializer, register from changes.models.log import LogSource @register(LogSource) class LogSourceSerializer(Serializer): def serialize(self, instance, attrs): return { 'id': instance.id.hex, 'job': { 'id': instance.job_id.hex, ...
[((5, 1, 5, 20), 'changes.api.serializer.register', 'register', ({(5, 10, 5, 19): 'LogSource'}, {}), '(LogSource)', False, 'from changes.api.serializer import Serializer, register\n')]
IsaacYangSLA/NVFlare
examples/prostate/data_preparation/utils/nrrd_to_nifti.py
8c6582894c9a8431f64479bc9f472fefcd71e5a7
# Copyright (c) 2021-2022, NVIDIA CORPORATION. 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.org/licenses/LICENSE-2.0 # # Unless required by ...
[((21, 9, 21, 100), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ({(21, 33, 21, 99): '"""Convert nrrd label to nifti with reference image file for affine"""'}, {}), "(\n 'Convert nrrd label to nifti with reference image file for affine')", False, 'import argparse\n'), ((27, 6, 27, 35), 'nibabel.load', 'nib....
jszakmeister/rst2ctags
setup.py
22f4035d9ea1e43a07b91f806014d318b3dc5097
from setuptools import setup import io import os import re version_re = re.compile(r'^__version__ = "([^"]*)"$') # Find the version number. with open('rst2ctags.py', 'r') as f: for line in f: line = line.rstrip() m = version_re.match(line) if m: version = m.group(1) ...
[((8, 13, 8, 53), 're.compile', 're.compile', ({(8, 24, 8, 52): '"""^__version__ = "([^"]*)"$"""'}, {}), '(\'^__version__ = "([^"]*)"$\')', False, 'import re\n'), ((29, 0, 58, 1), 'setuptools.setup', 'setup', (), '', False, 'from setuptools import setup\n'), ((24, 27, 24, 52), 'os.path.dirname', 'os.path.dirname', ({(2...
rerobots/hardshare
py-ws/hardshare/cli.py
456e7d1d1eb21d03efc3cd1f7960a1729b62527b
#!/usr/bin/env python # Copyright (C) 2018 rerobots, 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
[((77, 16, 77, 46), 'logging.getLogger', 'logging.getLogger', ({(77, 34, 77, 45): '"""hardshare"""'}, {}), "('hardshare')", False, 'import logging\n'), ((79, 17, 79, 107), 'logging.handlers.WatchedFileHandler', 'logging.handlers.WatchedFileHandler', (), '', False, 'import logging\n'), ((88, 16, 89, 98), 'argparse.Argum...
kkcookies99/UAST
Dataset/Leetcode/train/7/93.py
fff81885aa07901786141a71e5600a08d7cb4868
class Solution: def XXX(self, x: int) -> int: def solve(x): a = list(map(int,str(x))) p = {} d=0 for ind, val in enumerate(a): p[ind] = val for i, v in p.items(): d += v*(10**i) if (2**31 - 1>= d >= -(2**...
[]
JenBanks8585/Labs_CitySpireDS
app/realty.py
4755bd5ce718ee2f65f6a53a5918bd0cf18b2ddf
"""Realty Info""" import os import requests from dotenv import load_dotenv from fastapi import APIRouter, Depends import sqlalchemy from pydantic import BaseModel, SecretStr from app import config from app.walk_score import * load_dotenv() router = APIRouter() headers = {'x-rapidapi-key': os.getenv('api_key'), ...
[((14, 0, 14, 13), 'dotenv.load_dotenv', 'load_dotenv', ({}, {}), '()', False, 'from dotenv import load_dotenv\n'), ((16, 9, 16, 20), 'fastapi.APIRouter', 'APIRouter', ({}, {}), '()', False, 'from fastapi import APIRouter, Depends\n'), ((18, 29, 18, 49), 'os.getenv', 'os.getenv', ({(18, 39, 18, 48): '"""api_key"""'}, {...
v0rts/docker-weewx
dist/weewx-4.0.0b3/bin/weewx/junk2.py
70b2f252051dfead4fcb74e74662b297831e6342
from __future__ import print_function import time import weeutil.weeutil import weewx.manager import weewx.xtypes archive_sqlite = {'database_name': '/home/weewx/archive/weepwr.sdb', 'driver': 'weedb.sqlite'} archive_mysql = {'database_name': 'weewx', 'user': 'weewx', 'password': 'weewx', 'driver': 'weedb.mysql'} sq...
[]
a6502/fast_lemon_api
fast_lemon_api_test.py
09a5b6eec3e84d1d006f927e502a7071a28739cc
#!/usr/bin/env pytest-3 from fastapi.testclient import TestClient from fast_lemon_api import app client = TestClient(app) def test_get_root(): response = client.get("/") assert response.status_code == 200 assert response.text == "Welcome to the fast-lemon-api!\n" neworder = { "isin": "blablablabl...
[((7, 9, 7, 24), 'fastapi.testclient.TestClient', 'TestClient', ({(7, 20, 7, 23): 'app'}, {}), '(app)', False, 'from fastapi.testclient import TestClient\n')]
andrewkozlik/pam-u2f
tests/regenerate_credentials.py
5b504783c9af972c790bdcb506867bad7df5e333
#!/bin/python2 import collections import re import subprocess import sys PUC = "../pamu2fcfg/pamu2fcfg" resident = ["", "-r"] presence = ["", "-P"] pin = ["", "-N"] verification = ["", "-V"] Credential = collections.namedtuple("Credential", "keyhandle pubkey attributes oldformat") sshformat = 0 def print_test_...
[((18, 13, 18, 90), 'collections.namedtuple', 'collections.namedtuple', ({(18, 36, 18, 48): '"""Credential"""', (18, 50, 18, 89): '"""keyhandle pubkey attributes oldformat"""'}, {}), "('Credential', 'keyhandle pubkey attributes oldformat')", False, 'import collections\n'), ((124, 11, 124, 61), 'subprocess.check_output'...
zhangyujing/tensorflow
tensorflow/contrib/distributions/python/kernel_tests/bijectors/affine_scalar_test.py
c7a04561fb8972fb64907acc5f10f3c6d4cef9f2
# Copyright 2016 The TensorFlow Authors. 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.org/licenses/LICENSE-2.0 # # Unless required by applica...
[((153, 2, 153, 13), 'tensorflow.python.platform.test.main', 'test.main', ({}, {}), '()', False, 'from tensorflow.python.platform import test\n'), ((37, 17, 37, 39), 'tensorflow.contrib.distributions.python.ops.bijectors.affine_scalar.AffineScalar', 'AffineScalar', (), '', False, 'from tensorflow.contrib.distributions....
bricerisingalgorand/mule
mule/util/algorand_util.py
721b73f691076e5c3e2ebb8a79313da486fb0f96
import os import subprocess import json import urllib.request from mule.util import os_util from mule.util import file_util from mule.util import time_util from mule.util import s3_util from mule.util import semver_util import platform def build_algo_release_url(package_type, channel, os_type, cpu_arch_type, package_v...
[((16, 14, 16, 35), 'mule.util.os_util.get_os_type', 'os_util.get_os_type', ({}, {}), '()', False, 'from mule.util import os_util\n'), ((17, 20, 17, 47), 'mule.util.os_util.get_cpu_arch_type', 'os_util.get_cpu_arch_type', ({}, {}), '()', False, 'from mule.util import os_util\n'), ((25, 21, 25, 70), 'mule.util.semver_ut...
allbuttonspressed/pyjs
examples/showcase/src/demos_panels/scrollPanel.py
c726fdead530eb63ee4763ae15daaa58d84cd58f
""" The ``ui.ScrollPanel`` class implements a panel that scrolls its contents. If you want the scroll bars to be always visible, call ``setAlwaysShowScrollBars(True)``. You can also change the current scrolling position programmatically by calling ``setScrollPosition(vPos)`` and ``setScrollHorizontalPosition(hPos)`` ...
[((25, 8, 25, 34), 'pyjamas.ui.SimplePanel.SimplePanel.__init__', 'SimplePanel.__init__', ({(25, 29, 25, 33): 'self'}, {}), '(self)', False, 'from pyjamas.ui.SimplePanel import SimplePanel\n'), ((26, 15, 26, 30), 'pyjamas.ui.VerticalPanel.VerticalPanel', 'VerticalPanel', ({}, {}), '()', False, 'from pyjamas.ui.Vertical...
xiongchiamiov/phone-suitable-domain-name
psdn.py
da8d28c5783415f406e19b8ef2cde4c790a4c95d
#!/usr/bin/env python3 # May you recognize your weaknesses and share your strengths. # May you share freely, never taking more than you give. # May you find love and love everyone you find. import re import time import whois phone_spellable = re.compile(r'^[filoqrsuwxy]+$') candidate_words = [] with open('/usr/sha...
[((12, 18, 12, 49), 're.compile', 're.compile', ({(12, 29, 12, 48): '"""^[filoqrsuwxy]+$"""'}, {}), "('^[filoqrsuwxy]+$')", False, 'import re\n'), ((27, 20, 27, 51), 'whois.query', 'whois.query', ({(27, 32, 27, 50): "'%s.com' % word[1]"}, {}), "('%s.com' % word[1])", False, 'import whois\n'), ((30, 12, 30, 25), 'time.s...
akzare/Elevator_Sys_Design
src/requester/py/ElevatorTestCaseList.py
2f7d7381d68699515a43ec4cf7a8a8afade726f3
''' * @file ElevatorTestCaseList.py * @author Armin Zare Zadeh * @date 30 July 2020 * @version 0.1 * @brief Implements a class to hold all the test cases during the program life cycle. ''' #!/usr/bin/env python3 import sys import ctypes import ElevatorConfig as cfg import ElevatorMsgProtocol as msgProto ...
[((35, 15, 40, 94), 'ElevatorMsgProtocol.MsgHeader', 'msgProto.MsgHeader', (), '', True, 'import ElevatorMsgProtocol as msgProto\n'), ((53, 15, 58, 94), 'ElevatorMsgProtocol.MsgHeader', 'msgProto.MsgHeader', (), '', True, 'import ElevatorMsgProtocol as msgProto\n'), ((41, 31, 47, 94), 'ElevatorMsgProtocol.EncodeReqPack...
pmaigutyak/mp-cart
cart/views.py
53adbbdeea7f8f8b2d432b103f7347d89adf3e30
from django.utils.translation import ugettext from django.views.decorators.http import require_POST from django.http import JsonResponse from django.shortcuts import render from django.core.exceptions import ValidationError from django.views.decorators.csrf import csrf_exempt from cart.lib import get_cart from cart.f...
[((21, 11, 21, 28), 'cart.lib.get_cart', 'get_cart', ({(21, 20, 21, 27): 'request'}, {}), '(request)', False, 'from cart.lib import get_cart\n'), ((28, 11, 32, 6), 'django.http.JsonResponse', 'JsonResponse', ({(28, 24, 32, 5): "{'message': message, 'result': result, 'total': cart.printable_total}"}, {}), "({'message': ...
darius-luca-tech/AI_Projects
ChessAI/src/const.py
3cff26878807121e077375e5dbef39390fea0189
#------ game constants -----# #players WHITE = 0 BLACK = 1 BOTH = 2 #color for onTurnLabel PLAYER_COLOR = ["white", "black"] #figures PAWN = 1 KNIGHT = 2 BISHOP = 3 ROOK = 4 QUEEN = 5 KING = 6 FIGURE_NAME = [ "", "pawn", "knight", "bishop", "rook", "queen", "king" ] #used in move 32bit for prom...
[]
kapzlok2408/Pokemon-Showdown-Node-Bot
agent.py
c759eb9106fd2a3da3ebe4692a6730c37b2e5ee3
import gym import gym_pokemon import random if __name__ == "__main__": env = gym.make("Pokemon-v0") total_reward = 0.0 total_steps = 0 obs = env.reset() while True: action = random.randint(-1,8) obs, reward, done, _ = env.step(action) total_reward += reward total_steps += 1 print("Currently %d steps, t...
[((6, 7, 6, 29), 'gym.make', 'gym.make', ({(6, 16, 6, 28): '"""Pokemon-v0"""'}, {}), "('Pokemon-v0')", False, 'import gym\n'), ((12, 11, 12, 31), 'random.randint', 'random.randint', ({(12, 26, 12, 28): '-1', (12, 29, 12, 30): '8'}, {}), '(-1, 8)', False, 'import random\n')]
victor-da-costa/Aprendendo-Python
Curso-Em-Video-Python/Mundo-2/EXs/EX038.py
8fd19b93a13953cda30de02de7dac22b4e62fb5b
num1 = int(input('Digite o 1º número: ')) num2 = int(input('Digite o 2º número: ')) if num1 > num2: print('O {} é maior que {}'.format(num1, num2)) elif num1 < num2: print('O {} é maior que4 {}'.format(num2, num1)) else: print('Os números são iguais')
[]
danjjl/ipyfilechooser
setup.py
19d2e906207b2c3426675eda7889267f5956b182
#!/usr/bin/env python import os from setuptools import setup, find_packages def read(fname): """Open files relative to package.""" return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='ipyfilechooser', version='0.3.1', author='Thomas Bouve (@crahan)', author_email='...
[((24, 13, 24, 28), 'setuptools.find_packages', 'find_packages', ({}, {}), '()', False, 'from setuptools import setup, find_packages\n'), ((8, 29, 8, 54), 'os.path.dirname', 'os.path.dirname', ({(8, 45, 8, 53): '__file__'}, {}), '(__file__)', False, 'import os\n')]
mithro/chromium-infra
appengine/chromium_build_logs/handler.py
d27ac0b230bedae4bc968515b02927cf9e17c2b7
# Copyright (c) 2011 The Chromium 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 appengine_config import datetime import json import logging import os.path import pickle import sys import urllib sys.path.append( os.path.j...
[]
tedye/leetcode
tools/leetcode.127.Word Ladder/leetcode.127.Word Ladder.submission1.py
975d7e3b8cb9b6be9e80e07febf4bcf6414acd46
class Solution: # @param {string} beginWord # @param {string} endWord # @param {set<string>} wordDict # @return {integer} def ladderLength(self, beginWord, endWord, wordDict): # BFS scanLayer = [beginWord] distRecord = [1] while scanLayer: curWord = scanLa...
[]
YevhenVieskov/ML-DL-in-production
aws_lambda/pytorch/source/caffe2/python/operator_test/elementwise_op_broadcast_test.py
03839abcb93a49d4f05c43aa4e446a040027cdb0
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import unittest from hypothesis import given import numpy as np from caffe2.proto import caffe2_pb2 from caffe2.python import core, workspace import caffe2.python.hypot...
[((19, 5, 19, 20), 'hypothesis.given', 'given', ({}, {}), '(**hu.gcs)', False, 'from hypothesis import given\n'), ((70, 5, 70, 20), 'hypothesis.given', 'given', ({}, {}), '(**hu.gcs)', False, 'from hypothesis import given\n'), ((121, 5, 121, 20), 'hypothesis.given', 'given', ({}, {}), '(**hu.gcs)', False, 'from hypothe...
jovial/kayobe
kayobe/tests/unit/cli/test_commands.py
49e61fef4a221ee9fcfcee2b7bac02b6acc5bd0c
# Copyright (c) 2017 StackHPC Ltd. # # 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 wr...
[((36, 5, 36, 58), 'mock.patch.object', 'mock.patch.object', (), '', False, 'import mock\n'), ((37, 5, 38, 46), 'mock.patch.object', 'mock.patch.object', ({(37, 23, 37, 50): 'commands.KayobeAnsibleMixin', (38, 23, 38, 45): '"""run_kayobe_playbooks"""'}, {}), "(commands.KayobeAnsibleMixin, 'run_kayobe_playbooks')", Fals...
CNugteren/keras-onnx
keras2onnx/proto/tfcompat.py
b3d6b6486fe56640c48c62dd098e9405e35b4e9f
############################################################################### # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. ############################################################################### imp...
[((11, 57, 11, 79), 'distutils.version.StrictVersion', 'StrictVersion', ({(11, 71, 11, 78): '"""2.0.0"""'}, {}), "('2.0.0')", False, 'from distutils.version import StrictVersion\n'), ((23, 18, 23, 46), 'os.environ.get', 'os.environ.get', ({(23, 33, 23, 45): '"""TB_LOG_DIR"""'}, {}), "('TB_LOG_DIR')", False, 'import os\...
excentis/ByteBlower_python_examples
back2back/httpmulticlient.py
0e082e17413abf5e25f6d14b85e50e7f73e7f965
""" HTTP MultiServer/MultiClient for the ByteBlower Python API. All examples are guaranteed to work with Python 2.7 and above Copyright 2018, Excentis N.V. """ # Needed for python2 / python3 print function compatibility from __future__ import print_function # import the ByteBlower module import byteblowerll.byteblowe...
[((116, 27, 116, 76), 'byteblowerll.byteblower.ParseHTTPRequestMethodFromString', 'ParseHTTPRequestMethodFromString', ({(116, 60, 116, 75): 'http_method_arg'}, {}), '(http_method_arg)', False, 'from byteblowerll.byteblower import ParseHTTPRequestMethodFromString\n'), ((130, 30, 130, 65), 'byteblowerll.byteblower.ByteBl...
24-timmarsseglingarna/app
tools/pod-xml-to-geojson.py
0c028bd2eb284c6893cb16dd91bd093b2222338f
#!/usr/bin/env python # Converts a PoD XML file to a GeoJSON file. # # With the --javascript parameter, the generated file is a javascript # file defining a variable 'basePodSpec'. # # Get the PoD XML file from http://dev.24-timmars.nu/PoD/xmlapi_app.php. import xml.etree.ElementTree as etree import argparse import r...
[((26, 13, 26, 38), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ({}, {}), '()', False, 'import argparse\n'), ((32, 11, 32, 35), 'xml.etree.ElementTree.parse', 'etree.parse', ({(32, 23, 32, 34): 'args.infile'}, {}), '(args.infile)', True, 'import xml.etree.ElementTree as etree\n'), ((45, 13, 45, 54), 'codecs.o...
carderne/raster-vision
rastervision/plugin.py
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
import os import json import importlib from pluginbase import PluginBase import rastervision as rv from rastervision.protos.plugin_pb2 import PluginConfig as PluginConfigMsg from rastervision.utils.files import download_if_needed class PluginError(Exception): pass def load_conf_list(s): """Loads a list of...
[((37, 15, 37, 50), 'rastervision._registry._get_plugin_registry', 'rv._registry._get_plugin_registry', ({}, {}), '()', True, 'import rastervision as rv\n'), ((49, 31, 49, 63), 'os.path.join', 'os.path.join', ({(49, 44, 49, 51): 'rv_home', (49, 53, 49, 62): '"""plugins"""'}, {}), "(rv_home, 'plugins')", False, 'import ...
eldar/acsm
acsm/nnutils/resunet.py
04069e8bb4c12185473dc10c3355e5367fa98968
from __future__ import absolute_import from __future__ import division from __future__ import print_function from absl import app from absl import flags import os import os.path as osp import numpy as np import torch import torchvision import torch.nn as nn from torch.autograd import Variable import functools from . ...
[((39, 13, 40, 79), 'torch.nn.Conv2d', 'nn.Conv2d', (), '', True, 'import torch.nn as nn\n'), ((42, 23, 42, 46), 'torch.nn.Sequential', 'nn.Sequential', ({(42, 37, 42, 45): '*decoder'}, {}), '(*decoder)', True, 'import torch.nn as nn\n'), ((59, 22, 59, 66), 'torchvision.models.resnet18', 'torchvision.models.resnet18', ...
marinang/uproot-methods
uproot_methods/common/TVector.py
1d16d51ab7da19b4f31070d24e8fbfed3ae3ec8f
#!/usr/bin/env python # Copyright (c) 2018, DIANA-HEP # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, this # list ...
[((45, 15, 45, 49), 'awkward.util.numpy.sqrt', 'awkward.util.numpy.sqrt', ({(45, 39, 45, 48): 'self.mag2'}, {}), '(self.mag2)', False, 'import awkward\n'), ((85, 15, 85, 43), 'awkward.util.numpy.sqrt', 'awkward.util.numpy.sqrt', ({(85, 39, 85, 42): 'out'}, {}), '(out)', False, 'import awkward\n'), ((89, 15, 89, 57), 'a...
pennyarcade/TPPP
tpp/controller/ConversionController.py
9bb6db774d77f74c54ed2fa004e97c1aa114fff9
""" Implements a non interactive controller to controt non-interactive visualizers. (i.e. those that are used for converting TPP souce code into another format) """ from tpp.FileParser import FileParser from tpp.controller.TPPController import TPPController class ConversionController(TPPController): """ Impl...
[((27, 17, 27, 39), 'tpp.FileParser.FileParser', 'FileParser', ({(27, 28, 27, 38): 'input_file'}, {}), '(input_file)', False, 'from tpp.FileParser import FileParser\n')]
ZachGeo/covidGR_API
scrapers/covid_scraper.py
2f316337dda65bd33ac895df336481c3c2abe2c6
from bs4 import BeautifulSoup from datetime import date from lxml import html import requests import re import json class CovidScraper: def __init__(self): self.api_url = 'http://127.0.0.1:5000/covidgr' self.api_sum_url = 'http://127.0.0.1:5000/summary/covidgr' self.api_test_url = 'http://...
[((47, 15, 47, 44), 'requests.get', 'requests.get', ({(47, 28, 47, 43): 'self.scrape_url'}, {}), '(self.scrape_url)', False, 'import requests\n'), ((48, 15, 48, 57), 'bs4.BeautifulSoup', 'BeautifulSoup', ({(48, 29, 48, 41): 'page.content', (48, 43, 48, 56): '"""html.parser"""'}, {}), "(page.content, 'html.parser')", Fa...
schorsche/css3-imageslider
img/autoeditimg.py
6d15b2e77f141b8e871bdce2049ee7b2567981fe
#!/usr/bin/python2.7 import os from PIL import Image DATEI_WEB_GROSSE = 700 def isimg(isitimg): ext = os.path.splitext(isitimg)[1].lower() if ext == ".jpg" or ext == ".png" or ext == ".gif": return True return False def bearbeiten(datei): img = Image.open(datei) wrel = DATEI_WEB_GROSSE / float(img.size[0]) h...
[]
brisberg/Kiri-Cogs
wow/wow.py
9a5307ff8fbaa5e0560ec518cf26df52347da98d
import discord from discord.ext import commands class WowCog: """Custom Cog that had commands for WoW Memes""" def __init__(self, bot): self.bot = bot async def _play(self, url, ctx): """Helper for aliasing Play in the Audio module""" audio = self.bot.get_cog('Audio') if ...
[((19, 5, 19, 52), 'discord.ext.commands.command', 'commands.command', (), '', False, 'from discord.ext import commands\n')]
henrik997/privacy-evaluator
tests/attacks/class_test.py
f1d0e6c10ff58e582a44243788ab66c1d453bfa0
import pytest from privacy_evaluator.attacks.sample_attack import Sample_Attack """ This test only test if no error is thrown when calling the function, can be removed in the future """ def test_sample_attack(): test = Sample_Attack(0, 0, 0) test.perform_attack()
[((9, 11, 9, 33), 'privacy_evaluator.attacks.sample_attack.Sample_Attack', 'Sample_Attack', ({(9, 25, 9, 26): '0', (9, 28, 9, 29): '0', (9, 31, 9, 32): '0'}, {}), '(0, 0, 0)', False, 'from privacy_evaluator.attacks.sample_attack import Sample_Attack\n')]
Oli2/presto-python-client
setup.py
11a89c2528a35d5af6916e9c9175cb3e1f84160b
# 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, software # distributed under th...
[((19, 14, 19, 51), 're.compile', 're.compile', ({(19, 25, 19, 50): '"""__version__\\\\s+=\\\\s+(.*)"""'}, {}), "('__version__\\\\s+=\\\\s+(.*)')", False, 'import re\n'), ((36, 21, 40, 8), 'textwrap.dedent', 'textwrap.dedent', ({(36, 37, 40, 7): '"""\n Client for Presto (https://prestodb.io), a distributed SQL engin...
TausifAnsari/PyHub
Graphs/Pie Chart.py
f6c949dc6a3974f57d7d146708443d0ceeb4418f
import matplotlib.pyplot as graph subject = ["Probability", "Calculas", "Discrete Mathematics", "Adv Engineering Mathematics", "Linear Algebra", "Cryptography"] weightage = [250,900,850,1200,290,345] seperator = [0.05,0,0,0,0.05,0.05] graph.title("Mathematics Topic Weightage") graph.pie(weightage,labels=subject,au...
[((10, 0, 10, 42), 'matplotlib.pyplot.title', 'graph.title', ({(10, 12, 10, 41): '"""Mathematics Topic Weightage"""'}, {}), "('Mathematics Topic Weightage')", True, 'import matplotlib.pyplot as graph\n'), ((11, 0, 11, 72), 'matplotlib.pyplot.pie', 'graph.pie', (), '', True, 'import matplotlib.pyplot as graph\n'), ((12,...
noavilk/IML.HUJI
exercises/perform_model_selection.py
35aa4e6fbe489239e4fe72bf38c0dba3e6c81f37
from __future__ import annotations import numpy as np import pandas as pd from sklearn import datasets from IMLearn.metrics import mean_square_error from IMLearn.utils import split_train_test from IMLearn.model_selection import cross_validate from IMLearn.learners.regressors import PolynomialFitting, LinearRegression, ...
[((34, 8, 34, 39), 'numpy.linspace', 'np.linspace', ({(34, 20, 34, 24): '-1.2', (34, 26, 34, 27): '2', (34, 29, 34, 38): 'n_samples'}, {}), '(-1.2, 2, n_samples)', True, 'import numpy as np\n'), ((40, 13, 40, 38), 'numpy.linspace', 'np.linspace', ({(40, 25, 40, 29): '-1.4', (40, 31, 40, 32): '2', (40, 34, 40, 37): '100...
unfoldingWord-dev/d43-catalog
libraries/tools/media_utils.py
6c36f59b9b326e0ead45739c09631ef1e57c4932
import re import copy def parse_media(media, content_version, project_chapters): """ Converts a media object into formats usable in the catalog :param media: the media object :type media: dict :param content_version: the current version of the source content :type content_version: string :p...
[((192, 11, 192, 33), 'copy.copy', 'copy.copy', ({(192, 21, 192, 32): 'media_block'}, {}), '(media_block)', False, 'import copy\n')]
Brad19940809/django-customflow
django_customflow/mixins.py
502eed512d7c29e8d176c67fa62a7fce0be492d7
# -*- coding:utf-8 -*- # create_time: 2019/8/5 16:02 # __author__ = 'brad' from . import utils from .tasks.base import WaitingTask, BaseTask class WorkflowMixin(object): """Mixin class to make objects workflow aware. """ def get_workflow(self): """Returns the current workflow of the object. ...
[]
fossabot/django-video-encoding
video_encoding/fields.py
16a88c2d61d28e6f5ec2b49956ce356f8c458c67
from django.db.models.fields.files import (FieldFile, ImageField, ImageFileDescriptor) from django.utils.translation import ugettext as _ from .backends import get_backend_class from .files import VideoFile class VideoFileDescriptor(ImageFileDescriptor): pass class Vi...
[((24, 18, 24, 28), 'django.utils.translation.ugettext', '_', ({(24, 20, 24, 27): '"""Video"""'}, {}), "('Video')", True, 'from django.utils.translation import ugettext as _\n')]
boristown/leetcode
BST.py
2e510b7913653da75cd9d10f1adce4c466e74768
class BST: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right @staticmethod def array2BST(array): ''' array:sorted array ''' n = len(array) if n == 0: return None m = n//2 left,...
[]
raghu1121/SLM-Lab
test/spec/test_spec.py
58e98b6521f581515d04ebacff5226105237ed9b
from flaky import flaky from slm_lab.experiment.control import Trial from slm_lab.experiment.monitor import InfoSpace from slm_lab.lib import util from slm_lab.spec import spec_util import os import pandas as pd import pytest import sys # helper method to run all tests in test_spec def run_trial_test(spec_file, spec_...
[((23, 1, 27, 2), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(23, 25, 23, 46): '"""spec_file,spec_name"""', (23, 48, 27, 1): "[('experimental/reinforce.json', 'reinforce_mlp_cartpole'), (\n 'experimental/reinforce.json', 'reinforce_rnn_cartpole')]"}, {}), "('spec_file,spec_name', [(\n 'experimental/r...
Sfairat00/training_python
test/test_modify_group.py
14562b377d19bf22fc077e02efc7e56e73785a55
from model.group import Group def test_modify_group_name(app): if app.group.count() == 0: app.group.create(Group(name="test")) old_groups = app.group.get_group_list() app.group.modify_first_group(Group(name="New group")) new_groups = app.group.get_group_list() assert len(old_groups) == len...
[((8, 33, 8, 56), 'model.group.Group', 'Group', (), '', False, 'from model.group import Group\n'), ((18, 33, 18, 59), 'model.group.Group', 'Group', (), '', False, 'from model.group import Group\n'), ((6, 25, 6, 43), 'model.group.Group', 'Group', (), '', False, 'from model.group import Group\n'), ((16, 25, 16, 45), 'mod...
readmeio/metrics-sdks-python
readme_metrics/MetricsMiddleware.py
02bc6e486260641f1a62760d20370157a4928af6
import io import time import datetime from readme_metrics.Metrics import Metrics from readme_metrics.MetricsApiConfig import MetricsApiConfig from readme_metrics.ResponseInfoWrapper import ResponseInfoWrapper from werkzeug import Request class MetricsMiddleware: """Core middleware class for ReadMe Metrics A...
[((31, 28, 31, 43), 'readme_metrics.Metrics.Metrics', 'Metrics', ({(31, 36, 31, 42): 'config'}, {}), '(config)', False, 'from readme_metrics.Metrics import Metrics\n'), ((41, 14, 41, 30), 'werkzeug.Request', 'Request', ({(41, 22, 41, 29): 'environ'}, {}), '(environ)', False, 'from werkzeug import Request\n'), ((55, 34,...
deekshaarya4/gymexperiments
kbrl.py
2d503ba14fcfba41339de25dd78d649bd12693e6
import numpy as np import gym from sklearn.neighbors import NearestNeighbors import matplotlib.pyplot as plt import argparse parser = argparse.ArgumentParser(description='KBRL with KNN') parser.add_argument('--episodes', nargs='?', type=int, default=500) parser.add_argument('--max_timesteps', nargs='?', type=int, defa...
[((7, 9, 7, 61), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (), '', False, 'import argparse\n'), ((126, 0, 126, 22), 'matplotlib.pyplot.xlabel', 'plt.xlabel', ({(126, 11, 126, 21): '"""Episodes"""'}, {}), "('Episodes')", True, 'import matplotlib.pyplot as plt\n'), ((127, 0, 127, 31), 'matplotlib.pyplot.ylabe...
vinci-project/rootShard
shardDesigner/shardTemplateDir/shardStemDir/log/elast.py
2f6633c7fb1c1b690c0a38ffbb16af0b50d532bb
import elasticsearch from elasticsearch import Elasticsearch from elasticsearch import helpers import time, json, datetime, os class elalog: def __init__(self, date): es_host = os.getenv("ES_PORT_9200_TCP_ADDR") or '<%ELASTICIP%>' es_port = os.getenv("ES_PORT_9200_TCP_PORT") or '9200' sel...
[((13, 18, 13, 69), 'elasticsearch.Elasticsearch', 'Elasticsearch', ({(13, 32, 13, 68): "[{'host': es_host, 'port': es_port}]"}, {}), "([{'host': es_host, 'port': es_port}])", False, 'from elasticsearch import Elasticsearch\n'), ((10, 18, 10, 52), 'os.getenv', 'os.getenv', ({(10, 28, 10, 51): '"""ES_PORT_9200_TCP_ADDR"...
dslowikowski/commcare-hq
corehq/apps/sms/tests.py
ad8885cf8dab69dc85cb64f37aeaf06106124797
#!/usr/bin/env python # vim: ai ts=4 sts=4 et sw=4 encoding=utf-8 from util import clean_phone_number, clean_outgoing_sms_text from django.test import TestCase class UtilTestCase(TestCase): def setUp(self): pass def testCleanPhoneNumber(self): phone_number = " 324 23-23421241" cl...
[((13, 18, 13, 50), 'util.clean_phone_number', 'clean_phone_number', ({(13, 37, 13, 49): 'phone_number'}, {}), '(phone_number)', False, 'from util import clean_phone_number, clean_outgoing_sms_text\n'), ((18, 18, 18, 47), 'util.clean_outgoing_sms_text', 'clean_outgoing_sms_text', ({(18, 42, 18, 46): 'text'}, {}), '(tex...
cjgalvin/deepchem
deepchem/models/atomic_conv.py
64993a129e7f0f78fed9500298b1828ac8a0757a
__author__ = "Joseph Gomes" __copyright__ = "Copyright 2017, Stanford University" __license__ = "MIT" import sys from deepchem.models import KerasModel from deepchem.models.layers import AtomicConvolution from deepchem.models.losses import L2Loss from tensorflow.keras.layers import Input, Layer import numpy as np im...
[((51, 6, 51, 36), 'tensorflow.Variable', 'tf.Variable', (), '', True, 'import tensorflow as tf\n'), ((52, 6, 52, 35), 'tensorflow.Variable', 'tf.Variable', (), '', True, 'import tensorflow as tf\n'), ((47, 14, 47, 78), 'tensorflow.random.truncated_normal', 'tf.random.truncated_normal', (), '', True, 'import tensorflow...
cotobadesign/cotoba-agent-oss
dialogue-engine/test/programytest/config/brain/test_oob.py
3833d56e79dcd7529c3e8b3a3a8a782d513d9b12
""" Copyright (c) 2020 COTOBA DESIGN, Inc. 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 without restriction, including without limitation the rights to use, copy, modify, merge, publish, distri...
[((26, 15, 26, 38), 'programy.config.file.yaml_file.YamlConfigurationFile', 'YamlConfigurationFile', ({}, {}), '()', False, 'from programy.config.file.yaml_file import YamlConfigurationFile\n'), ((40, 21, 40, 53), 'programy.config.brain.oob.BrainOOBConfiguration', 'BrainOOBConfiguration', ({(40, 43, 40, 52): '"""defaul...
candyninja001/pypad
pypad/active_skill/interfaces/orb_generator_asi.py
82bfc104c2524ca54cc415d37d2c21fec471838f
import abc from ...orb_attribute import OrbAttribute # Interface for active skills that create specific orb types (whether board change, orb change, orb spawn, etc) class OrbGeneratorASI(abc.ABC): @abc.abstractmethod def does_orb_generator_create_orb_attribute(self, orb_attribute: OrbAttribute) -> bool: ...
[]
DivoK/mystery
setup.py
b656eebe678c64864b2a5762765f36bddd540933
""" Core business logic for `mystery`. This code will run when the package is being built and installed. """ import json import pathlib import random import tempfile import urllib.request import typing import setuptools from setuptools.command.sdist import sdist # Load the configuration file. CONFIG_PATH = pathlib.P...
[((17, 14, 17, 41), 'pathlib.Path', 'pathlib.Path', ({(17, 27, 17, 40): '"""config.json"""'}, {}), "('config.json')", False, 'import pathlib\n'), ((112, 19, 112, 42), 'pathlib.Path', 'pathlib.Path', ({(112, 32, 112, 41): '"""mystery"""'}, {}), "('mystery')", False, 'import pathlib\n'), ((79, 25, 81, 9), 'random.choice'...
CrazyIvanPro/Optimal_Transport
ADMM_primal.py
aa782820a5ca5a01909ed3c32acbada43f6cfa0f
#!/usr/bin/env python # -*- coding: utf-8 -*- # ======================================= # File Name: ADMM_primal.py # Purpose : implementation for ADMM method # for solving primal problem # ======================================= from utils import get_params import numpy as np import sys def ADMM_primal(...
[((19, 9, 19, 25), 'numpy.zeros', 'np.zeros', ({(19, 18, 19, 24): '(m, n)'}, {}), '((m, n))', True, 'import numpy as np\n'), ((20, 13, 20, 29), 'numpy.zeros', 'np.zeros', ({(20, 22, 20, 28): '(m, n)'}, {}), '((m, n))', True, 'import numpy as np\n'), ((21, 8, 21, 24), 'numpy.zeros', 'np.zeros', ({(21, 17, 21, 23): '(m, ...
pombase/legacy-eg-loader
misc_scripts/CleanVCFparams.py
1a324121325ffc3b9a4c15922f7a12756a9c3206
#!/usr/bin/python import os import sys import pprint import argparse parser = argparse.ArgumentParser(description='Clean up the data for a given parameter') parser.add_argument('--infile', help="Path to the VCF file", default='test.vcf') parser.add_argument('--outfile', help="Path to the new VCF file", default='test....
[((8, 9, 8, 87), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (), '', False, 'import argparse\n')]
UKPLab/acl20-dialogue-coherence-assessment
create_coherency_dataset.py
328b888855dc833b4b0c05c259ee7115f4219dbe
import math import os from copy import deepcopy from ast import literal_eval import pandas as pd from math import factorial import random from collections import Counter, defaultdict import sys from nltk import word_tokenize from tqdm import tqdm, trange import argparse import numpy as np import re import csv from skle...
[((514, 13, 514, 38), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ({}, {}), '()', False, 'import argparse\n'), ((547, 4, 547, 26), 'random.seed', 'random.seed', ({(547, 16, 547, 25): 'args.seed'}, {}), '(args.seed)', False, 'import random\n'), ((548, 4, 548, 29), 'numpy.random.seed', 'np.random.seed', ({(548,...
swimmio/sqlalchemy_swimm
tests/test_selections.py
d24accb7792743cf586bd7062531d108e7063eba
import typing import pytest from src import selections @pytest.mark.parametrize( 'min_time, min_bytes, expected_result', [ ( 10 * 60 * 1000, 500 * 1024 * 1024, [ (2820,), (2827,), (2832,), (2834,), ...
[((7, 1, 497, 1), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(8, 4, 8, 42): '"""min_time, min_bytes, expected_result"""', (9, 4, 496, 5): '[(10 * 60 * 1000, 500 * 1024 * 1024, [(2820,), (2827,), (2832,), (2834,), (\n 2842,), (2844,), (2851,), (2852,), (2859,), (2862,), (2872,), (2878,),\n (2881,), (2...
richardqiu/pyjanitor
tests/utils/test_clean_accounting_column.py
aa3150e7b8e2adc4733ea206ea9c3093e21d4025
import pytest from janitor.utils import _clean_accounting_column @pytest.mark.utils def test_clean_accounting_column(): test_str = "(1,000)" assert _clean_accounting_column(test_str) == float(-1000) @pytest.mark.utils def test_clean_accounting_column_zeroes(): test_str = "()" assert _clean_accounti...
[((9, 11, 9, 45), 'janitor.utils._clean_accounting_column', '_clean_accounting_column', ({(9, 36, 9, 44): 'test_str'}, {}), '(test_str)', False, 'from janitor.utils import _clean_accounting_column\n'), ((15, 11, 15, 45), 'janitor.utils._clean_accounting_column', '_clean_accounting_column', ({(15, 36, 15, 44): 'test_str...
icadot86/bert
downloadParagraph.py
42070209183dab3b5ff59b0dea1398a9538960f3
# coding=utf-8 import sys, getopt import urllib import requests import requests_cache import re import time from bs4 import BeautifulSoup from requests import Session sys.path.append("/home/taejoon1kim/BERT/my_bert") from utils.cacheUtils import cacheExist, writeCache, readCache, getDownloadCachePath from utils.path...
[((12, 0, 12, 49), 'sys.path.append', 'sys.path.append', ({(12, 16, 12, 48): '"""/home/taejoon1kim/BERT/my_bert"""'}, {}), "('/home/taejoon1kim/BERT/my_bert')", False, 'import sys, getopt\n'), ((76, 11, 76, 45), 'requests.get', 'requests.get', (), '', False, 'import requests\n'), ((114, 12, 114, 38), 'utils.cacheUtils....
LucasChenLC/courseManager2
data_io.py
3f91ea72dbc0a3f3afcc88c7f0959edb6c33adf9
from xml.dom.minidom import Document, parse class InfoBatch: def __init__(self, title, pre_node_titles): self.title = title self.pre_node_titles = pre_node_titles def save_data_xml(course_list, file_path): doc = Document() courses = doc.createElement('course_list') doc.appendChild(co...
[((11, 10, 11, 20), 'xml.dom.minidom.Document', 'Document', ({}, {}), '()', False, 'from xml.dom.minidom import Document, parse\n'), ((42, 10, 42, 26), 'xml.dom.minidom.parse', 'parse', ({(42, 16, 42, 25): 'file_path'}, {}), '(file_path)', False, 'from xml.dom.minidom import Document, parse\n')]
jlandrum/theheck
tests/rules/test_git_rm_local_modifications.py
d2c008b6ca14220504be95f887253ddd9f5e9f72
import pytest from theheck.rules.git_rm_local_modifications import match, get_new_command from theheck.types import Command @pytest.fixture def output(target): return ('error: the following file has local modifications:\n {}\n(use ' '--cached to keep the file, or -f to force removal)').format(targe...
[((12, 1, 14, 31), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(12, 25, 12, 41): '"""script, target"""', (12, 43, 14, 30): "[('git rm foo', 'foo'), ('git rm foo bar', 'bar')]"}, {}), "('script, target', [('git rm foo', 'foo'), (\n 'git rm foo bar', 'bar')])", False, 'import pytest\n'), ((19, 1, 19, 78), ...
statisticsnorway/microdata-data-service
application.py
d477b7b75589d4c977771122558c948c040a1106
import logging import json_logging import tomlkit import uvicorn from fastapi import FastAPI, status from fastapi.encoders import jsonable_encoder from fastapi.openapi.docs import ( get_redoc_html, get_swagger_ui_html, get_swagger_ui_oauth2_redirect_html, ) from fastapi.responses import JSONResponse from f...
[((27, 19, 27, 57), 'fastapi.FastAPI', 'FastAPI', (), '', False, 'from fastapi import FastAPI, status\n'), ((28, 34, 28, 65), 'fastapi.staticfiles.StaticFiles', 'StaticFiles', (), '', False, 'from fastapi.staticfiles import StaticFiles\n'), ((36, 11, 42, 5), 'fastapi.openapi.docs.get_swagger_ui_html', 'get_swagger_ui_h...
dtborders/graspologic
graspologic/embed/n2v.py
8ea9a47cabe35ad28ec9d381e525358c2027f619
# Copyright (c) Microsoft Corporation and contributors. # Licensed under the MIT License. import logging import math import time from typing import Any, List, Optional, Tuple, Union import networkx as nx import numpy as np from ..utils import remap_node_ids def node2vec_embed( graph: Union[nx.Graph, nx.DiGraph...
[((102, 19, 102, 58), 'numpy.random.RandomState', 'np.random.RandomState', (), '', True, 'import numpy as np\n'), ((113, 12, 113, 23), 'time.time', 'time.time', ({}, {}), '()', False, 'import time\n'), ((128, 10, 128, 21), 'time.time', 'time.time', ({}, {}), '()', False, 'import time\n'), ((205, 12, 214, 5), 'gensim.mo...
NotBlizzard/blizzybot
bot.py
41a6f07e4d3bb97772b07aa9d6a3af935b78fb9a
# bot.py # TODO: # organize imports # organize from websocket import create_connection from threading import Thread from battle import Battle import commands import traceback import requests import inspect import json from fractions import Fraction import random import time import sys import re imp...
[((59, 21, 59, 57), 're.sub', 're.sub', ({(59, 28, 59, 40): '"""[^A-z0-9]"""', (59, 42, 59, 44): '""""""', (59, 46, 59, 56): 'message[1]'}, {}), "('[^A-z0-9]', '', message[1])", False, 'import re\n'), ((101, 8, 101, 18), 'sys.exit', 'sys.exit', ({}, {}), '()', False, 'import sys\n'), ((130, 15, 130, 52), 're.sub', 're....
Yao-14/stAnalysis
stRT/tdr/widgets/changes.py
d08483ce581f5b03cfcad8be500aaa64b0293f74
from typing import Optional, Tuple, Union import numpy as np import pandas as pd import pyvista as pv from pyvista import DataSet, MultiBlock, PolyData, UnstructuredGrid try: from typing import Literal except ImportError: from typing_extensions import Literal from .ddrtree import DDRTree, cal_ncenter from .s...
[((140, 27, 140, 59), 'numpy.triu', 'np.triu', ({(140, 35, 140, 55): 'matrix_edges_weights', (140, 57, 140, 58): '1'}, {}), '(matrix_edges_weights, 1)', True, 'import numpy as np\n'), ((181, 8, 181, 21), 'numpy.asarray', 'np.asarray', ({(181, 19, 181, 20): 'X'}, {}), '(X)', True, 'import numpy as np\n'), ((182, 15, 182...
nkoshkina/Python_Training3
test/test_add_group.py
e917440d37883dbcaa527a0700bcfa1478a1c1ce
# -*- coding: utf-8 -*- from model.group import Group import pytest import allure_pytest def test_add_group(app, db, check_ui, json_groups): group0 = json_groups #with pytest.allure.step("Given a group list"): old_groups = db.get_group_list() #with pytest.allure.step("When I add a group %s to the list"...
[]
testinggg-art/Cyberbrain
cyberbrain/frame_tree.py
e38c74c174e23aa386d005b03f09b30aa1b3a0ae
from __future__ import annotations from .frame import Frame from .generated.communication_pb2 import CursorPosition class FrameTree: """A tree to store all frames. For now it's a fake implementation. Each node in the tree represents a frame that ever exists during program execution. Caller and callee fr...
[]
moggers87/django-otp-yubikey
src/otp_yubikey/models.py
2d7cf9dc91ba57b65aa62254532997cc1e6261dd
from __future__ import absolute_import, division, print_function, unicode_literals from base64 import b64decode from binascii import hexlify, unhexlify from struct import pack import six from django.db import models from django.utils.encoding import force_text from django_otp.models import Device from django_otp.ut...
[((59, 17, 65, 5), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((67, 10, 72, 5), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((74, 14, 77, 5), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerF...
gavinIRL/RHBot
v1/hsvfilter.py
1e22ae5ca7b67ebd6a72c23d9f46d5a8eb6e99cf
import typing # custom data structure to hold the state of an HSV filter class HsvFilter: def __init__(self, hMin=None, sMin=None, vMin=None, hMax=None, sMax=None, vMax=None, sAdd=None, sSub=None, vAdd=None, vSub=None): self.hMin = hMin self.sMin = sMin self.vMin = vMin ...
[]
HPLegion/glue
glue/core/tests/test_state_objects.py
1843787ccb4de852dfe103ff58473da13faccf5f
import numpy as np from numpy.testing import assert_allclose from echo import CallbackProperty, ListCallbackProperty from glue.core import Data, DataCollection from .test_state import clone from ..state_objects import (State, StateAttributeLimitsHelper, StateAttributeSingleValueHelper, ...
[((15, 8, 15, 26), 'echo.CallbackProperty', 'CallbackProperty', ({}, {}), '()', False, 'from echo import CallbackProperty, ListCallbackProperty\n'), ((16, 8, 16, 26), 'echo.CallbackProperty', 'CallbackProperty', ({}, {}), '()', False, 'from echo import CallbackProperty, ListCallbackProperty\n'), ((17, 11, 17, 33), 'ech...
victormartinez/ecommerceapi
ecommerce_api/core/cart/exceptions.py
a887d9e938050c15ebf52001f63d7aa7f33fa5ee
from typing import Iterable, Optional class ProductsNotFound(Exception): def __init__(self, product_ids: Optional[Iterable[int]] = None): self.product_ids = product_ids or [] self.message = "One or more products are invalid." super().__init__(self.message)
[]
jsoref/neo4j-python-driver
test/unit/test_record.py
32c130c9a975dbf8c0d345b362d096b5e1dd3e5b
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Copyright (c) 2002-2018 "Neo Technology," # Network Engine for Objects in Lund AB [http://neotechnology.com] # # This file is part of Neo4j. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Li...
[((30, 18, 30, 77), 'neo4j.v1.Record', 'Record', ({(30, 25, 30, 43): "['name', 'empire']", (30, 45, 30, 76): "['Nigel', 'The British Empire']"}, {}), "(['name', 'empire'], ['Nigel', 'The British Empire'])", False, 'from neo4j.v1 import Record\n'), ((31, 18, 31, 77), 'neo4j.v1.Record', 'Record', ({(31, 25, 31, 43): "['n...
hugocool/explainerdashboard
tests/integration_tests/test_dashboards.py
e725528c3d94a1a45b51bd9632686d0697274f54
import dash from catboost import CatBoostClassifier, CatBoostRegressor from xgboost import XGBClassifier, XGBRegressor from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor from explainerdashboard.explainers import ClassifierExplainer, RegressionExplainer from explainerdashboard.datasets import...
[((15, 39, 15, 56), 'explainerdashboard.datasets.titanic_survive', 'titanic_survive', ({}, {}), '()', False, 'from explainerdashboard.datasets import titanic_survive, titanic_fare, titanic_embarked, titanic_names\n'), ((36, 39, 36, 53), 'explainerdashboard.datasets.titanic_fare', 'titanic_fare', ({}, {}), '()', False, ...
dgrechka/bengaliai-cv19
code/scripts/GeneratePNG_Preview_AsIs.py
9ef15c5b140628337ae6efe0d76e7ec5d291dc17
import tensorflow as tf import sys import os from glob import glob import png sys.path.append(os.path.join(__file__,'..','..')) from tfDataIngest import tfDataSetParquet as tfDsParquet inputDataDir = sys.argv[1] outputDir = sys.argv[2] # test app if __name__ == "__main__": files = glob(os.path.join(inputDataDir...
[((7, 16, 7, 48), 'os.path.join', 'os.path.join', ({(7, 29, 7, 37): '__file__', (7, 38, 7, 42): '""".."""', (7, 43, 7, 47): '""".."""'}, {}), "(__file__, '..', '..')", False, 'import os\n'), ((19, 9, 19, 55), 'tfDataIngest.tfDataSetParquet.create_parquet_dataset', 'tfDsParquet.create_parquet_dataset', ({(19, 44, 19, 54...
RSabet/wxGlade
widgets/datepicker_ctrl/codegen.py
8b62eb8397308e60977857455b2765727b1b940f
"""\ Code generator functions for wxDatePickerCtrl objects @copyright: 2002-2007 Alberto Griggio @copyright: 2014-2016 Carsten Grohmann @copyright: 2016-2021 Dietmar Schwertberger @license: MIT (see LICENSE.txt) - THIS PROGRAM COMES WITH NO WARRANTY """ import common, compat import wcodegen class PythonDatePickerCt...
[((81, 4, 81, 56), 'common.register', 'common.register', ({(81, 20, 81, 25): '"""XRC"""', (81, 30, 81, 35): 'klass', (81, 37, 81, 55): 'xrc_code_generator'}, {}), "('XRC', klass, xrc_code_generator)", False, 'import common, compat\n'), ((33, 8, 33, 72), 'wcodegen.PythonWidgetCodeWriter._prepare_tmpl_content', 'wcodegen...
lck1201/simple-effective-3Dpose-baseline
train.py
790a185b44e48a9cc619f52b6615aae729bff76b
import pprint import mxnet as mx from mxnet import gluon from mxnet import init from lib.core.get_optimizer import * from lib.core.metric import MPJPEMetric from lib.core.loss import MeanSquareLoss from lib.core.loader import JointsDataIter from lib.network import get_net from lib.net_module import * from lib.utils i...
[((17, 9, 17, 48), 'config.update_config_from_args', 'update_config_from_args', ({(17, 33, 17, 39): 'config', (17, 41, 17, 47): 's_args'}, {}), '(config, s_args)', False, 'from config import config, gen_config, update_config_from_args, s_args\n'), ((57, 10, 57, 25), 'lib.network.get_net', 'get_net', ({(57, 18, 57, 24):...
WangFeng18/dino
FastLinear/generate_memory_bank.py
1a4e49bd0e99d7e205338b14994a1d57c3084cfe
import os from tqdm import tqdm import torch.backends.cudnn as cudnn import torch from datasets import ImageNetInstance, ImageNetInstanceLMDB from torchvision import transforms import argparse from BaseTaskModel.task_network import get_moco_network, get_swav_network, get_selfboost_network, get_minmaxent_network, get_si...
[((15, 0, 15, 33), 'warnings.filterwarnings', 'warnings.filterwarnings', ({(15, 24, 15, 32): '"""ignore"""'}, {}), "('ignore')", False, 'import warnings\n'), ((24, 4, 24, 72), 'torch.distributed.all_gather', 'torch.distributed.all_gather', (), '', False, 'import torch\n'), ((26, 13, 26, 45), 'torch.cat', 'torch.cat', (...
anuragtr/fabric8-analytics-rudra
tests/utils/test_mercator.py
13fb15539d195fcb89ced02b205d034ec0c18e00
import pytest from rudra.utils.mercator import SimpleMercator class TestSimpleMercator: pom_xml_content = """ <project> <dependencies> <dependency> <groupId>grp1.id</groupId> <artifactId>art1.id</artifactId> </dependency...
[((29, 17, 29, 53), 'rudra.utils.mercator.SimpleMercator', 'SimpleMercator', ({(29, 32, 29, 52): 'self.pom_xml_content'}, {}), '(self.pom_xml_content)', False, 'from rudra.utils.mercator import SimpleMercator\n'), ((68, 17, 68, 40), 'rudra.utils.mercator.SimpleMercator', 'SimpleMercator', ({(68, 32, 68, 39): 'content'}...
stjordanis/mljar-supervised
tests/checks/run_performance_tests.py
8c3f9d1ed527dfcfdaef91cf82e2779c5832e294
import os import sys import unittest from tests.tests_bin_class.test_performance import * if __name__ == "__main__": unittest.main()
[((8, 4, 8, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n')]
wookiee2187/vc3-login-pod
task/CheckAllocations.py
3c0f5490c094bf0b4587a743efac68d722ea5ee2
#!/usr/bin/env python from vc3master.task import VC3Task class CheckAllocations(VC3Task): ''' Plugin to do consistency/sanity checks on Allocations. ''' def runtask(self): ''' ''' self.log.info("Running task %s" % self.section)
[]
Captricity/airbrake-django
django_airbrake/utils/client.py
2ea126653883732a13f1a80c9e567b7076601620
import sys import traceback from django.conf import settings from django.urls import resolve from lxml import etree from six.moves.urllib.request import urlopen, Request class Client(object): API_URL = '%s://airbrake.io/notifier_api/v2/notices' ERRORS = { 403: "Cannot use SSL", 422: "Invalid X...
[((45, 14, 45, 49), 'six.moves.urllib.request.Request', 'Request', ({(45, 22, 45, 30): 'self.url', (45, 32, 45, 39): 'payload', (45, 41, 45, 48): 'headers'}, {}), '(self.url, payload, headers)', False, 'from six.moves.urllib.request import urlopen, Request\n'), ((46, 15, 46, 61), 'six.moves.urllib.request.urlopen', 'ur...
jean1042/plugin-azure-cloud-services
src/spaceone/inventory/connector/snapshot.py
3a75a516c9a4d1e8a4962988934ead3fd40e8494
import logging from spaceone.inventory.libs.connector import AzureConnector from spaceone.inventory.error import * from spaceone.inventory.error.custom import * __all__ = ['SnapshotConnector'] _LOGGER = logging.getLogger(__name__) class SnapshotConnector(AzureConnector): def __init__(self, **kwargs): su...
[((7, 10, 7, 37), 'logging.getLogger', 'logging.getLogger', ({(7, 28, 7, 36): '__name__'}, {}), '(__name__)', False, 'import logging\n')]
theasylum/wired
docs/tutorial/context/app.py
6b6a3e83702b18ebb41ca1f94e957bdf7e44986d
""" A customer walks into a store. Do the steps to interact with them: - Get *a* (not *the*) greeter - Interact with them Simple wired application: - Settings that say what punctuation to use - Registry - Two factories that says hello, one for the FrenchCustomer context - A default Customer and FrenchCustomer ...
[((59, 15, 59, 32), 'wired.ServiceRegistry', 'ServiceRegistry', ({}, {}), '()', False, 'from wired import ServiceRegistry\n')]
GeoSensorWebLab/FEAST_PtE
feast/DetectionModules/ldar_program.py
63ff8b7925873d756666f3c0c4b9f0f84abd5eb2
""" This module defines the LDARProgram class. """ import numpy as np import copy from .repair import Repair from ..EmissionSimModules.result_classes import ResultDiscrete, ResultContinuous class LDARProgram: """ An LDAR program contains one or more detection methods and one or more repair methods. Each LDAR...
[((25, 25, 25, 59), 'copy.deepcopy', 'copy.deepcopy', ({(25, 39, 25, 58): 'gas_field.emissions'}, {}), '(gas_field.emissions)', False, 'import copy\n'), ((46, 24, 46, 71), 'numpy.mod', 'np.mod', ({(46, 31, 46, 48): 'time.current_time', (46, 50, 46, 70): 'tech.survey_interval'}, {}), '(time.current_time, tech.survey_int...
sjmoran/SIDGAN
src/CycleGAN.py
169bd69974bbb7f5760c28a00c231a856017e51c
#Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved. #This program is free software; you can redistribute it and/or modify it under the terms of the BSD 0-Clause License. #This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ...
[((135, 26, 135, 91), 'keras.engine.topology.Network', 'Network', (), '', False, 'from keras.engine.topology import Network\n'), ((136, 26, 136, 91), 'keras.engine.topology.Network', 'Network', (), '', False, 'from keras.engine.topology import Network\n'), ((219, 8, 219, 26), 'sys.stdout.flush', 'sys.stdout.flush', ({}...
edson-dev/neoway
application/fastapi/main.py
f792e16c0f627e8b94b54f001e87e076f36311ab
import uvicorn from fastapi import FastAPI from fastapi.staticfiles import StaticFiles from routes import doc, api from fastapi.templating import Jinja2Templates from starlette.requests import Request # configure static and templates file on jinja 2 app = FastAPI( title=f"Technical Case", description=f"endpoi...
[((10, 6, 15, 1), 'fastapi.FastAPI', 'FastAPI', (), '', False, 'from fastapi import FastAPI\n'), ((19, 0, 19, 17), 'routes.doc.init_app', 'doc.init_app', ({(19, 13, 19, 16): 'app'}, {}), '(app)', False, 'from routes import doc, api\n'), ((20, 0, 20, 25), 'routes.api.init_app', 'api.init_app', ({(20, 13, 20, 16): 'app',...
jsfalk/civis-python
civis/io/_tables.py
39b6498b2d67d838d720d9631d74f3d3d43f7c1a
import json import concurrent.futures import csv from os import path import io import logging import os import shutil from tempfile import TemporaryDirectory import warnings import zlib import gzip import zipfile from civis import APIClient from civis._utils import maybe_get_random_name from civis.base import EmptyRe...
[((37, 6, 37, 33), 'logging.getLogger', 'logging.getLogger', ({(37, 24, 37, 32): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((50, 1, 50, 37), 'civis._deprecation.deprecate_param', 'deprecate_param', ({(50, 17, 50, 25): '"""v2.0.0"""', (50, 27, 50, 36): '"""api_key"""'}, {}), "('v2.0.0', 'api_key')", Fa...
chschroeder/small-text
tests/unit/small_text/integrations/pytorch/test_strategies.py
ef28e91ba0c94fe938dde4f16253aa8695ea13b7
import unittest import pytest from small_text.integrations.pytorch.exceptions import PytorchNotFoundError try: from small_text.integrations.pytorch.query_strategies import ( BADGE, ExpectedGradientLength, ExpectedGradientLengthMaxWord) except PytorchNotFoundError: pass @pytest.mark....
[((20, 19, 20, 27), 'small_text.integrations.pytorch.query_strategies.BADGE', 'BADGE', ({(20, 25, 20, 26): '2'}, {}), '(2)', False, 'from small_text.integrations.pytorch.query_strategies import BADGE, ExpectedGradientLength, ExpectedGradientLengthMaxWord\n'), ((24, 19, 24, 27), 'small_text.integrations.pytorch.query_st...
stonewell/pymterm
pymterm/colour/tango.py
af36656d5f7fb008533178d14b00d83d72ba00cf
TANGO_PALLETE = [ '2e2e34343636', 'cccc00000000', '4e4e9a9a0606', 'c4c4a0a00000', '34346565a4a4', '757550507b7b', '060698989a9a', 'd3d3d7d7cfcf', '555557575353', 'efef29292929', '8a8ae2e23434', 'fcfce9e94f4f', '72729f9fcfcf', 'adad7f7fa8a8', '34...
[]
voegtlel/auth-manager-backend
user_manager/oauth/oauth2.py
20d40de0abc9deeb3fcddd892ffe2e635301917a
from datetime import datetime, timedelta from enum import Enum from typing import List, Optional, Tuple, Dict, Any, Union import time from authlib.common.security import generate_token from authlib.consts import default_json_headers from authlib.oauth2 import ( OAuth2Request, AuthorizationServer as _Authorizat...
[((331, 18, 331, 64), 'user_manager.common.mongo.client_collection.find_one', 'client_collection.find_one', ({(331, 45, 331, 63): "{'_id': client_id}"}, {}), "({'_id': client_id})", False, 'from user_manager.common.mongo import authorization_code_collection, token_collection, client_collection, client_user_cache_collec...
claws/adsb
src/adsb/sbs/server.py
4a7d35880dece6baaf24370fab445e2571fc19e9
import asyncio import datetime import logging import socket from . import protocol from typing import Tuple from asyncio import AbstractEventLoop logger = logging.getLogger(__name__) class Server(object): def __init__( self, host: str = "localhost", port: int = 30003, backlog...
[((13, 9, 13, 36), 'logging.getLogger', 'logging.getLogger', ({(13, 27, 13, 35): '__name__'}, {}), '(__name__)', False, 'import logging\n'), ((25, 28, 25, 52), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ({}, {}), '()', False, 'import asyncio\n')]
kandahk/robusta
src/robusta/core/model/events.py
61a2001cb1c4e90e8a74b810463ec99e6cb80787
import logging import uuid from enum import Enum from typing import List, Optional, Dict, Any from dataclasses import dataclass, field from pydantic import BaseModel from ...integrations.scheduled.playbook_scheduler import PlaybooksScheduler from ..reporting.base import Finding, BaseBlock class EventType(Enum): ...
[((31, 35, 31, 68), 'dataclasses.field', 'field', (), '', False, 'from dataclasses import dataclass, field\n'), ((70, 12, 72, 13), 'logging.warning', 'logging.warning', ({(71, 16, 71, 97): 'f"""Overriding existing finding. finding_key: {finding_key} new finding: {finding}"""'}, {}), "(\n f'Overriding existing findin...
pfrantz/graphene-mongo
examples/django_mongoengine/bike/models.py
f7d4f3e194ec41793e6da547934c34e11fd9ef51
from mongoengine import Document from mongoengine.fields import ( FloatField, StringField, ListField, URLField, ObjectIdField, ) class Shop(Document): meta = {"collection": "shop"} ID = ObjectIdField() name = StringField() address = StringField() website = URLField() class Bi...
[((13, 9, 13, 24), 'mongoengine.fields.ObjectIdField', 'ObjectIdField', ({}, {}), '()', False, 'from mongoengine.fields import FloatField, StringField, ListField, URLField, ObjectIdField\n'), ((14, 11, 14, 24), 'mongoengine.fields.StringField', 'StringField', ({}, {}), '()', False, 'from mongoengine.fields import Float...
jedhsu/tensor
src/tensor/tensor/movement/__init__.py
3b2fe21029fa7c50b034190e77d79d1a94ea5e8f
from ._movement import Movement from .path import MovementPath from .paths import MovementPaths
[]
sauloal/ipython
opticalmapping/standalone/om_augmenter.py
35c24a10330da3e54b5ee29df54ee263f5268d18
#!/usr/bin/python import os import sys from om_shared import * def parse_args(args): parser = argparse.ArgumentParser(description="Bionano Genomics MAP parser") parser.add_argument( 'infile', help="MAP file" ) parser.add_ar...
[]
OpenIxia/ixnetwork_restpy
uhd_restpy/testplatform/sessions/ixnetwork/impairment/profile/fixedclassifier/fixedclassifier.py
f628db450573a104f327cf3c737ca25586e067ae
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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 without restriction, including without limitation # the rights to use, copy, modify,...
[((59, 19, 59, 32), 'uhd_restpy.testplatform.sessions.ixnetwork.impairment.profile.fixedclassifier.pattern.pattern.Pattern', 'Pattern', ({(59, 27, 59, 31): 'self'}, {}), '(self)', False, 'from uhd_restpy.testplatform.sessions.ixnetwork.impairment.profile.fixedclassifier.pattern.pattern import Pattern\n')]