code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
from datetime import datetime
from typing import Optional, Any
from rx.internal import PriorityQueue, ArgumentOutOfRangeException
from rx.core import typing
from .schedulerbase import SchedulerBase
from .scheduleditem import ScheduledItem
log = logging.getLogger("Rx")
MAX_SPINNING = 100
class Virtua... | [
"logging.getLogger",
"rx.internal.ArgumentOutOfRangeException",
"rx.internal.PriorityQueue"
] | [((263, 286), 'logging.getLogger', 'logging.getLogger', (['"""Rx"""'], {}), "('Rx')\n", (280, 286), False, 'import logging\n'), ((912, 931), 'rx.internal.PriorityQueue', 'PriorityQueue', (['(1024)'], {}), '(1024)\n', (925, 931), False, 'from rx.internal import PriorityQueue, ArgumentOutOfRangeException\n'), ((3318, 334... |
import bisect
import copy
import datetime
import uuid
import operator
import pytz
import calendar
from elasticsearch_dsl.query import Range, Terms
def string_to_datetime(timestamp):
try:
return datetime.datetime.strptime(timestamp, "%Y-%m-%dT%H:%M:%S.%fZ")
except ValueError:
return datetime.da... | [
"datetime.datetime.utcfromtimestamp",
"datetime.datetime",
"pytz.UTC.localize",
"datetime.datetime.strptime",
"uuid.uuid4",
"datetime.datetime.now",
"copy.deepcopy",
"bisect.bisect_left"
] | [((208, 270), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['timestamp', '"""%Y-%m-%dT%H:%M:%S.%fZ"""'], {}), "(timestamp, '%Y-%m-%dT%H:%M:%S.%fZ')\n", (234, 270), False, 'import datetime\n'), ((825, 874), 'bisect.bisect_left', 'bisect.bisect_left', (['object_ids', "stix_object['id']"], {}), "(object_id... |
# -*- coding: utf-8 -*-
import errno
import logging
import io
import itertools
import nfc
import os
import threading
import time
from config import Config
from .record import BalanceRecord, HistoryRecord
FELICA_SERVICE_BALANCE = 0x008b
FELICA_SERVICE_HISTORY = 0x090f
FELICA_SERVICE_IN_OUT = 0x108f
BUFFER_SIZE = 1024
... | [
"logging.getLogger",
"os.path.exists",
"os.makedirs",
"nfc.ContactlessFrontend",
"nfc.tag.tt3.ServiceCode",
"os.path.join",
"time.sleep",
"itertools.count",
"itertools.tee",
"nfc.tag.tt3.BlockCode"
] | [((327, 361), 'logging.getLogger', 'logging.getLogger', (['"""felica.reader"""'], {}), "('felica.reader')\n", (344, 361), False, 'import logging\n'), ((398, 421), 'itertools.tee', 'itertools.tee', (['iterable'], {}), '(iterable)\n', (411, 421), False, 'import itertools\n'), ((875, 929), 'os.path.join', 'os.path.join', ... |
#%%
import numpy as np
from numpy import pi
import pandas as pd
import matplotlib.pyplot as plt
import os
root_path = os.path.dirname(os.path.abspath('__file__'))
import sys
sys.path.append(root_path+'/config/')
from variables import train_len, dev_len,test_len
from ssa import SSA
station = 'Huaxian' # 'Huaxian', ... | [
"os.path.exists",
"os.makedirs",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"os.path.abspath",
"pandas.concat",
"matplotlib.pyplot.tight_layout",
"pandas.read_excel",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"ssa.SSA",
"sys.path.append",
"matplotlib.pyplot.show"
] | [((176, 215), 'sys.path.append', 'sys.path.append', (["(root_path + '/config/')"], {}), "(root_path + '/config/')\n", (191, 215), False, 'import sys\n'), ((1154, 1208), 'matplotlib.pyplot.title', 'plt.title', (["('Monthly Runoff of ' + station + ' station')"], {}), "('Monthly Runoff of ' + station + ' station')\n", (11... |
import PySimpleGUI as sg
from PIL import Image
import os
import io
from typing import Literal, Tuple
import pandas as pd
import json
import numpy as np
CACHE = "cachefile.json"
ANNOTATION = "annotation/"
INDENT = 4
SPACE = " "
NEWLINE = "\n"
# This program includes software developed by jterrace and <NAME>
# in htt... | [
"pandas.isnull",
"pandas.read_csv",
"os.path.isfile",
"numpy.issubdtype",
"os.path.basename"
] | [((2449, 2479), 'os.path.isfile', 'os.path.isfile', (['annotation_csv'], {}), '(annotation_csv)\n', (2463, 2479), False, 'import os\n'), ((2511, 2548), 'pandas.read_csv', 'pd.read_csv', (['annotation_csv'], {'header': '(0)'}), '(annotation_csv, header=0)\n', (2522, 2548), True, 'import pandas as pd\n'), ((2002, 2023), ... |
from PIL import Image
import numpy as np
from torchvision import transforms, models
import cv2
def load_image_or_video(img_path, shape=None):
in_transform = transforms.Compose([
transforms.Resize((256,256)),
transforms.ToTensor(),
])
... | [
"PIL.Image.open",
"numpy.array",
"cv2.VideoCapture",
"cv2.cvtColor",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor"
] | [((329, 355), 'cv2.VideoCapture', 'cv2.VideoCapture', (['img_path'], {}), '(img_path)\n', (345, 355), False, 'import cv2\n'), ((1281, 1312), 'numpy.array', 'np.array', (['(0.485, 0.456, 0.406)'], {}), '((0.485, 0.456, 0.406))\n', (1289, 1312), True, 'import numpy as np\n'), ((207, 236), 'torchvision.transforms.Resize',... |
# Auto-ML for predicting relational reasoning.
# The model is based on the auto-sklearn library.
import time
import collections
import numpy as np
import ccobra
import autosklearn.classification
# mapping of cardinal direction input
input_mppng = {"north-west": [1,0,0,1], "north":[1,0,0,0], "north-east":[1,... | [
"numpy.array",
"numpy.apply_along_axis"
] | [((1804, 1815), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (1812, 1815), True, 'import numpy as np\n'), ((1839, 1850), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (1847, 1850), True, 'import numpy as np\n'), ((2246, 2288), 'numpy.apply_along_axis', 'np.apply_along_axis', (['np.argmax', '(1)', 'train_y'], {})... |
from tensorboardX import summary
import numpy as np
import pytest
import unittest
from tensorboardX.utils import make_grid
class UtilsTest(unittest.TestCase):
def test_to_HWC(self):
test_image = np.random.randint(0, 256, size=(3, 32, 32), dtype=np.uint8)
converted = convert_to_HWC(test_image, 'chw... | [
"numpy.stack",
"numpy.random.randint",
"tensorboardX.utils.make_grid"
] | [((209, 268), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)'], {'size': '(3, 32, 32)', 'dtype': 'np.uint8'}), '(0, 256, size=(3, 32, 32), dtype=np.uint8)\n', (226, 268), True, 'import numpy as np\n'), ((390, 453), 'numpy.random.randint', 'np.random.randint', (['(0)', '(256)'], {'size': '(16, 3, 32, 32)',... |
import pyxb
import unittest
import pyxb.binding.datatypes as xsd
import datetime
class Test_date (unittest.TestCase):
def verifyTime (self, dt, with_usec=True, with_adj=(0,0), with_tzinfo=True):
self.assertEqual(2002, dt.year)
self.assertEqual(10, dt.month)
self.assertEqual(27, dt.day)... | [
"unittest.main",
"pyxb.binding.datatypes.date"
] | [((1290, 1305), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1303, 1305), False, 'import unittest\n'), ((1178, 1200), 'pyxb.binding.datatypes.date', 'xsd.date', (['"""2002-10-27"""'], {}), "('2002-10-27')\n", (1186, 1200), True, 'import pyxb.binding.datatypes as xsd\n'), ((483, 507), 'pyxb.binding.datatypes.dat... |
from re import L
import requests
import images as img
import boards as board
import time
import sys
from bs4 import BeautifulSoup
from colorama import Fore
# python3 main.py board "insert the url" "location to store at"
desired_folder = sys.argv[3]
print(Fore.LIGHTGREEN_EX + f"Folder = {desired_folder}"+ Fore.WHITE)
... | [
"images.download_file",
"boards.get_active_thread",
"boards.get_archived_thread",
"images.get_file_name",
"requests.get",
"time.sleep",
"bs4.BeautifulSoup",
"images.get_file_url",
"sys.stdout.flush",
"sys.stdout.write"
] | [((1535, 1560), 'requests.get', 'requests.get', (['arch_thread'], {}), '(arch_thread)\n', (1547, 1560), False, 'import requests\n'), ((1576, 1617), 'bs4.BeautifulSoup', 'BeautifulSoup', (['result.text', '"""html.parser"""'], {}), "(result.text, 'html.parser')\n", (1589, 1617), False, 'from bs4 import BeautifulSoup\n'),... |
"""
:codeauthor: <NAME> <<EMAIL>>
"""
import pytest
import salt.modules.monit as monit
from tests.support.mock import MagicMock, patch
@pytest.fixture
def configure_loader_modules():
return {monit: {}}
def test_start():
"""
Test for start
"""
with patch.dict(monit.__salt__, {"cmd.retcode":... | [
"salt.modules.monit.restart",
"salt.modules.monit.id_",
"salt.modules.monit.configtest",
"salt.modules.monit.version",
"salt.modules.monit.unmonitor",
"salt.modules.monit.stop",
"tests.support.mock.MagicMock",
"salt.modules.monit.monitor",
"salt.modules.monit.summary",
"tests.support.mock.patch.di... | [((1274, 1339), 'tests.support.mock.MagicMock', 'MagicMock', ([], {'side_effect': "['daemon is not running', 'A\\nB\\nC\\nD\\nE']"}), "(side_effect=['daemon is not running', 'A\\nB\\nC\\nD\\nE'])\n", (1283, 1339), False, 'from tests.support.mock import MagicMock, patch\n'), ((1833, 1858), 'tests.support.mock.MagicMock'... |
#!/usr/bin/env python3
import os
import sys
import json
import tempfile
temp_dir = tempfile.gettempdir()
output_file_path = os.path.join(temp_dir, 'execute_post_action_entity_script.dat')
http_response_body = sys.argv[3]
entity = json.loads(http_response_body)
with open(output_file_path, "a+") as file_object:
f... | [
"os.path.join",
"json.loads",
"tempfile.gettempdir"
] | [((85, 106), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (104, 106), False, 'import tempfile\n'), ((126, 189), 'os.path.join', 'os.path.join', (['temp_dir', '"""execute_post_action_entity_script.dat"""'], {}), "(temp_dir, 'execute_post_action_entity_script.dat')\n", (138, 189), False, 'import os\n')... |
#!/usr/bin/env python
'''Funktion zur Zuweisung der AKFs zu den Excel Zellen'''
__author__ = '<NAME>'
__version__ = '1.0'
__email__ = '<EMAIL>'
import datetime
from datetime import timedelta
from .writexlsx import write_data
def planning(workbook, sheet, monday, akfs, Prüffeld):
# Create list with weekdates(S... | [
"datetime.timedelta"
] | [((526, 543), 'datetime.timedelta', 'timedelta', ([], {'days': '(1)'}), '(days=1)\n', (535, 543), False, 'from datetime import timedelta\n'), ((446, 463), 'datetime.timedelta', 'timedelta', ([], {'days': 'i'}), '(days=i)\n', (455, 463), False, 'from datetime import timedelta\n')] |
from flask import Blueprint
auth=Blueprint('auth',__name__)
from . import views,forms | [
"flask.Blueprint"
] | [((35, 62), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {}), "('auth', __name__)\n", (44, 62), False, 'from flask import Blueprint\n')] |
#!/usr/bin/env python
import io
import unittest
try:
from fpack.utils import get_length
except ImportError:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(".", "..")))
from fpack.utils import get_length
class TestGetLength(unittest.TestCase):
def test_get_length_memoryvie... | [
"unittest.main",
"fpack.utils.get_length",
"io.BytesIO",
"os.path.join"
] | [((1332, 1347), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1345, 1347), False, 'import unittest\n'), ((721, 755), 'io.BytesIO', 'io.BytesIO', (["b'wlfae;ksddas.fafjew'"], {}), "(b'wlfae;ksddas.fafjew')\n", (731, 755), False, 'import io\n'), ((397, 411), 'fpack.utils.get_length', 'get_length', (['mv'], {}), '(... |
import keras as keras
from keras.models import Sequential, Model
from keras.layers import Dense, Activation, Dropout, TimeDistributed, Concatenate, Input, UpSampling2D, ZeroPadding2D, average, Lambda, Bidirectional
from keras.layers import GRU, LSTM, Conv2D, Conv1D, Reshape, Flatten, Permute, AveragePooling2D, MaxPooli... | [
"keras.layers.Conv2D",
"keras.layers.UpSampling2D",
"keras.layers.Lambda",
"keras.layers.AveragePooling2D",
"keras.layers.LSTM",
"keras.layers.Input",
"keras.layers.concatenate",
"keras.models.Model",
"keras.layers.Conv2DTranspose",
"keras.layers.Dense",
"keras.layers.Reshape",
"keras.layers.Z... | [((1552, 1626), 'keras.layers.Input', 'Input', ([], {'shape': '(frame_seq_len, framelen)', 'dtype': '"""float32"""', 'name': '"""main_input"""'}), "(shape=(frame_seq_len, framelen), dtype='float32', name='main_input')\n", (1557, 1626), False, 'from keras.layers import Dense, Activation, Dropout, TimeDistributed, Concat... |
import tornado.web
import logging
import motor
from settings import routing
from tornado.options import options
import os
import subprocess
import datetime
tornado.options.parse_command_line()
if not os.path.exists(options.log_dir):
os.makedirs(options.log_dir)
logging.basicConfig(
format='%(asctime)s [%(nam... | [
"logging.basicConfig",
"os.path.exists",
"subprocess.check_output",
"logging.getLogger",
"os.makedirs",
"datetime.datetime.now",
"motor.motor_tornado.MotorClient",
"logging.info"
] | [((269, 434), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s [%(name)s] %(levelname)s: %(message)s"""', 'filename': "('%s/%s' % (options.log_dir, options.log_file))", 'level': 'logging.DEBUG'}), "(format=\n '%(asctime)s [%(name)s] %(levelname)s: %(message)s', filename='%s/%s' %\n (o... |
import probeinterface as pi
from .neobaseextractor import NeoBaseRecordingExtractor, NeoBaseSortingExtractor
class BiocamRecordingExtractor(NeoBaseRecordingExtractor):
"""
Class for reading data from a Biocam file from 3Brain.
Based on neo.rawio.BiocamRawIO
Parameters
----------
file_path: s... | [
"probeinterface.read_3brain"
] | [((976, 1017), 'probeinterface.read_3brain', 'pi.read_3brain', (['file_path'], {}), '(file_path, **probe_kwargs)\n', (990, 1017), True, 'import probeinterface as pi\n')] |
# Copyright 2010 National Research Foundation (South African Radio Astronomy Observatory)
# BSD license - see LICENSE for details
""" This is a benchmark client for scenario 2, which cooperate with
benchtxserver or benchserver
"""
from __future__ import absolute_import, division, print_function
import sys
import time... | [
"twisted.internet.reactor.stop",
"katcp.tx.core.run_client",
"util.standard_parser",
"twisted.internet.reactor.run",
"twisted.internet.reactor.callLater",
"sys.stdout.flush"
] | [((1046, 1097), 'twisted.internet.reactor.callLater', 'reactor.callLater', (['TIMEOUT', 'protocol.periodic_check'], {}), '(TIMEOUT, protocol.periodic_check)\n', (1063, 1097), False, 'from twisted.internet import reactor\n'), ((1205, 1219), 'twisted.internet.reactor.stop', 'reactor.stop', ([], {}), '()\n', (1217, 1219),... |
from math import sin, pi
from random import uniform
X = []
for i in range(10000):
s = uniform(0, 2*pi)
X.append([sin(s), s])
X = [str(i) + ',' + str(j) + '\n' for i, j in X]
fh = open('sinx.csv', 'w')
fh.writelines(X)
fh.close()
| [
"random.uniform",
"math.sin"
] | [((92, 110), 'random.uniform', 'uniform', (['(0)', '(2 * pi)'], {}), '(0, 2 * pi)\n', (99, 110), False, 'from random import uniform\n'), ((123, 129), 'math.sin', 'sin', (['s'], {}), '(s)\n', (126, 129), False, 'from math import sin, pi\n')] |
import numpy as np
import typing as t
class ProbRelation:
def __init__(self, probs: t.List[t.List[float]], shape:t.Tuple[int, int]):
self.distibution = np.array(probs)
self.shape = shape | [
"numpy.array"
] | [((165, 180), 'numpy.array', 'np.array', (['probs'], {}), '(probs)\n', (173, 180), True, 'import numpy as np\n')] |
import seaborn as sns
# sns.set()
import matplotlib.pyplot as plt
import pandas as pd
import warnings
from scipy import stats
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
df = pd.read_csv('rugs.csv', header=None, names=['ru... | [
"seaborn.regplot",
"warnings.filterwarnings",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((126, 195), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'message': '"""numpy.dtype size changed"""'}), "('ignore', message='numpy.dtype size changed')\n", (149, 195), False, 'import warnings\n'), ((196, 265), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'mess... |
"""
k_meansによる処理を行う
"""
from sklearn.cluster import KMeans
from src.input_data import input_data
def k_means(file: str, n_clusters: int):
"""
データをk-meansによってクラスタリングする
Paramters
---------
file : str
クラスタリングしたいファイルのパス
データはカンマ区切り
n_clusters : int
クラスタリングにする個数
Re... | [
"sklearn.cluster.KMeans",
"src.input_data.input_data"
] | [((492, 508), 'src.input_data.input_data', 'input_data', (['file'], {}), '(file)\n', (502, 508), False, 'from src.input_data import input_data\n'), ((533, 567), 'sklearn.cluster.KMeans', 'KMeans', (['n_clusters'], {'random_state': '(0)'}), '(n_clusters, random_state=0)\n', (539, 567), False, 'from sklearn.cluster impor... |
"""Support for showing the time in a different time zone."""
from __future__ import annotations
from datetime import tzinfo
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_NAME, CONF_TIME_ZONE
from homeassistant.core import HomeA... | [
"voluptuous.Required",
"homeassistant.util.dt.get_time_zone",
"homeassistant.util.dt.now",
"voluptuous.Optional"
] | [((1175, 1220), 'homeassistant.util.dt.get_time_zone', 'dt_util.get_time_zone', (['config[CONF_TIME_ZONE]'], {}), '(config[CONF_TIME_ZONE])\n', (1196, 1220), True, 'import homeassistant.util.dt as dt_util\n'), ((724, 752), 'voluptuous.Required', 'vol.Required', (['CONF_TIME_ZONE'], {}), '(CONF_TIME_ZONE)\n', (736, 752)... |
from functools import reduce
from teacher.tree import ID3, FDT
from teacher.tree.tests.fdt_legacy_tree import FDT_Legacy
from teacher.tree.tests.id3_legacy_tree import ID3_Legacy
from pytest import fixture
from sklearn import datasets
from sklearn.model_selection import train_test_split
from teacher.fuzzy import get_... | [
"teacher.explanation.m_factual",
"teacher.explanation.c_factual",
"teacher.explanation.mr_factual",
"numpy.random.seed",
"sklearn.datasets.load_iris",
"teacher.fuzzy.get_fuzzy_variables",
"sklearn.model_selection.train_test_split",
"functools.reduce",
"teacher.datasets.load_compas",
"numpy.argmax"... | [((604, 621), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (615, 621), False, 'import random\n'), ((626, 646), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (640, 646), True, 'import numpy as np\n'), ((719, 752), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'as_frame': '(T... |
#!/usr/bin/python
# ex:set fileencoding=utf-8:
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _
from djangobmf.dashboards import ProjectManagement
from djangobmf.sites import Module
from djangobmf.sites import ViewMixin
from djangobmf.sites import register
from .catego... | [
"django.utils.translation.ugettext_lazy",
"djangobmf.sites.register"
] | [((586, 623), 'djangobmf.sites.register', 'register', ([], {'dashboard': 'ProjectManagement'}), '(dashboard=ProjectManagement)\n', (594, 623), False, 'from djangobmf.sites import register\n'), ((689, 726), 'djangobmf.sites.register', 'register', ([], {'dashboard': 'ProjectManagement'}), '(dashboard=ProjectManagement)\n... |
from rest_framework import viewsets
from oidc_provider import models
from rest_framework.permissions import DjangoModelPermissions
from . import renderers, serializers
class ClientViewSet(viewsets.ModelViewSet):
serializer_class = serializers.ClientSerializer
queryset = models.Client.objects.all()
render... | [
"oidc_provider.models.Client.objects.all"
] | [((282, 309), 'oidc_provider.models.Client.objects.all', 'models.Client.objects.all', ([], {}), '()\n', (307, 309), False, 'from oidc_provider import models\n')] |
import discord
from discord.ext import commands
class Swatter(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_message(self, message):
if self.bot.user in message.mentions:
await message.add_reaction('\U0001f5de')
if 'skynet'... | [
"discord.ext.commands.Cog.listener"
] | [((137, 160), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (158, 160), False, 'from discord.ext import commands\n'), ((412, 461), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {'name': '"""on_raw_reaction_add"""'}), "(name='on_raw_reaction_add')\n", (433, 461), Fa... |
import os
import click
import flask_s3
from app import app
@click.command()
def upload_assets():
flask_s3.create_all(app)
if __name__ == '__main__':
upload_assets()
| [
"flask_s3.create_all",
"click.command"
] | [((61, 76), 'click.command', 'click.command', ([], {}), '()\n', (74, 76), False, 'import click\n'), ((102, 126), 'flask_s3.create_all', 'flask_s3.create_all', (['app'], {}), '(app)\n', (121, 126), False, 'import flask_s3\n')] |
import argparse
import os
import sys
from paste import fileapp
from paste import httpserver
import webapp2
from webapp2 import Route
import game_project
class SourcePathsHandler(webapp2.RequestHandler):
def get(self, *args, **kwargs): # pylint: disable=unused-argument
request_path = os.path.relpath(self.requ... | [
"os.path.exists",
"argparse.ArgumentParser",
"paste.fileapp.FileApp",
"webapp2.Route",
"sys.stderr.write",
"webapp2.WSGIApplication",
"os.path.abspath",
"paste.httpserver.serve",
"game_project.GameProject",
"os.path.relpath"
] | [((656, 682), 'game_project.GameProject', 'game_project.GameProject', ([], {}), '()\n', (680, 682), False, 'import game_project\n'), ((795, 845), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', ([], {'routes': 'routes', 'debug': '(True)'}), '(routes=routes, debug=True)\n', (818, 845), False, 'import webapp2\n'), ... |
import cv2
import numpy as np
def get_coarse_match(conf_matrix, input_height, input_width, resolution):
"""
Predicts coarse matches from conf_matrix
Args:
resolution: image
input_width:
input_height:
conf_matrix: [N, L, S]
Returns:
mkpts0_c: [M, 2]
... | [
"numpy.trunc",
"cv2.cvtColor",
"cv2.resize",
"numpy.zeros_like",
"numpy.arange"
] | [((772, 807), 'numpy.zeros_like', 'np.zeros_like', (['j_ids'], {'dtype': 'np.long'}), '(j_ids, dtype=np.long)\n', (785, 807), True, 'import numpy as np\n'), ((820, 857), 'numpy.arange', 'np.arange', (['feature_num'], {'dtype': 'np.long'}), '(feature_num, dtype=np.long)\n', (829, 857), True, 'import numpy as np\n'), ((1... |
from cStringIO import StringIO
import mock
from changes.artifacts.base import ArtifactParseError
from changes.artifacts.collection_artifact import CollectionArtifactHandler
from changes.config import db
from changes.constants import Result
from changes.models.failurereason import FailureReason
from changes.models.job... | [
"cStringIO.StringIO",
"changes.artifacts.collection_artifact.CollectionArtifactHandler",
"mock.Mock",
"mock.patch.object",
"changes.models.failurereason.FailureReason.query.filter",
"changes.config.db.session.rollback",
"changes.artifacts.base.ArtifactParseError"
] | [((433, 485), 'mock.patch.object', 'mock.patch.object', (['JobPlan', '"""get_build_step_for_job"""'], {}), "(JobPlan, 'get_build_step_for_job')\n", (450, 485), False, 'import mock\n'), ((1299, 1351), 'mock.patch.object', 'mock.patch.object', (['JobPlan', '"""get_build_step_for_job"""'], {}), "(JobPlan, 'get_build_step_... |
import hashlib
def get_md5(s):
sig_md5 = hashlib.md5()
sig_md5.update(s.encode("utf-8"))
return sig_md5.hexdigest()
| [
"hashlib.md5"
] | [((47, 60), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (58, 60), False, 'import hashlib\n')] |
import numpy as np
import pandas as pd
from functools import reduce
from itertools import combinations_with_replacement
from amlearn.featurize.base import create_featurizer_backend
from amlearn.utils.packing import load_radii
from sklearn.base import BaseEstimator, TransformerMixin
try:
from amlearn.featurize.src ... | [
"amlearn.featurize.src.bp_symmfunc.bp_radial",
"amlearn.featurize.src.bp_symmfunc.bp_angular",
"amlearn.featurize.base.create_featurizer_backend",
"itertools.combinations_with_replacement",
"numpy.array",
"amlearn.utils.packing.load_radii",
"numpy.arange"
] | [((3108, 3454), 'amlearn.featurize.src.bp_symmfunc.bp_radial', 'bp_symmfunc.bp_radial', ([], {'center_atom_ids': 'atom_ids', 'center_atom_coords': 'atom_coords', 'atom_ids': 'atom_ids', 'atom_types': 'atom_types', 'atom_type_symbols': 'self.atom_type_symbols', 'atom_coords': 'atom_coords', 'pbc': 'self.pbc', 'bds': 'se... |
import re
from functools import partial
from pathlib import Path
from typing import Callable, Pattern
import requests
YT_KEY_FILENAME = 'youtube_data_api.key'
yt_key_path: Path = Path(__file__).resolve().parent / YT_KEY_FILENAME
if yt_key_path.exists():
YT_API_KEY = yt_key_path.read_text().strip()
else:
rais... | [
"functools.partial",
"pathlib.Path",
"requests.get",
"re.compile"
] | [((3219, 3451), 're.compile', 're.compile', (['"""\n (?:youtu\\\\.be/|\n youtube\\\\.com/\n (?:(?:vi?|(?:user/)?\\\\w+#p/(?:\\\\w+/)?\\\\w+/\\\\d+|\n e|embed)/|\n (?:[\\\\w?=]+)?[?&]vi?=)\n )\n ([-_a-zA-Z0-9]{11,12})\n """', 're.VERBOSE'], {}), '(\n """\n (?:youtu\\\\.... |
# from glob import glob
# from os.path import basename
# from os.path import splitext
from setuptools import setup
# from setuptools import find_packages
def _requires_from_file(filename):
return open(filename).read().splitlines()
with open("README.md", "r") as f:
long_description = f.read()
setup(
na... | [
"setuptools.setup"
] | [((307, 942), 'setuptools.setup', 'setup', ([], {'name': '"""densityratio"""', 'version': '"""1.0.1"""', 'license': '"""MIT License + LICENSE file"""', 'description': '"""A Python Package for Direct density estimation by unconstrained Least-Squares Importance Fitting (uLSIF)."""', 'long_description': 'long_description'... |
# Testing serial ports
# https://faradayrf.com/unit-testing-pyserial-code/
# Import modules
import serial
class SerialTestClass(object):
"""A mock serial port test class"""
def __init__(self):
"""Creates a mock serial port which is a loopback object"""
self.device = "test"
self._port... | [
"serial.serial_for_url"
] | [((431, 521), 'serial.serial_for_url', 'serial.serial_for_url', ([], {'url': 'self._port', 'timeout': 'self._timeout', 'baudrate': 'self._baudrate'}), '(url=self._port, timeout=self._timeout, baudrate=self.\n _baudrate)\n', (452, 521), False, 'import serial\n')] |
import numpy as np
import matplotlib.pyplot as plt
# Returns a list of tuples representing points
def read_input(file_name: str):
with open(file_name, 'r') as input_file:
point_list = input_file.read().split('\n')
x_coords = []
y_coords = []
for point in point_list:
x_s... | [
"numpy.asarray",
"numpy.sign",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.subplots",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((893, 909), 'numpy.asarray', 'np.asarray', (['rhos'], {}), '(rhos)\n', (903, 909), True, 'import numpy as np\n'), ((1116, 1152), 'numpy.arange', 'np.arange', ([], {'start': '(0)', 'stop': '(7)', 'step': '(0.5)'}), '(start=0, stop=7, step=0.5)\n', (1125, 1152), True, 'import numpy as np\n'), ((1456, 1474), 'matplotlib... |
import numpy as np
import pandas as pd
from stock.utils.symbol_util import get_stock_symbols, get_archived_trading_dates
from stock.marketdata.storefactory import get_store
from config import store_type
pd.set_option('display.max_rows', None)
store = get_store(store_type)
def get_equity_value(exsymbols, date):
clo... | [
"pandas.DataFrame",
"numpy.mean",
"stock.marketdata.storefactory.get_store",
"pandas.set_option"
] | [((204, 243), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (217, 243), True, 'import pandas as pd\n'), ((252, 273), 'stock.marketdata.storefactory.get_store', 'get_store', (['store_type'], {}), '(store_type)\n', (261, 273), False, 'from stock.marketdata... |
from code.sources import TMDBSource, WatchModeSource, OMDBSource
#Get a query of content
query = input("Enter the content name: ")
contentOMDB = OMDBSource.search(query)
print("Title: ", contentOMDB.title)
print("Score OMDB:", contentOMDB.score)
data = WatchModeSource.search(contentOMDB.id)
print("Score WatchMode:... | [
"code.sources.TMDBSource.search",
"code.sources.WatchModeSource.search",
"code.sources.OMDBSource.search"
] | [((147, 171), 'code.sources.OMDBSource.search', 'OMDBSource.search', (['query'], {}), '(query)\n', (164, 171), False, 'from code.sources import TMDBSource, WatchModeSource, OMDBSource\n'), ((257, 295), 'code.sources.WatchModeSource.search', 'WatchModeSource.search', (['contentOMDB.id'], {}), '(contentOMDB.id)\n', (279,... |
# -*- coding: utf-8 -*-
"""Generic test cases."""
import unittest
import warnings
from textwrap import dedent
from typing import Any, ClassVar, Collection, Generic, Iterable, Mapping, MutableMapping, Optional, Type, TypeVar
__all__ = [
'GenericTestCase',
'MetaTestCase',
'TestsTestCase',
]
T = TypeVar('T... | [
"warnings.warn",
"textwrap.dedent",
"typing.TypeVar"
] | [((310, 322), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (317, 322), False, 'from typing import Any, ClassVar, Collection, Generic, Iterable, Mapping, MutableMapping, Optional, Type, TypeVar\n'), ((327, 339), 'typing.TypeVar', 'TypeVar', (['"""X"""'], {}), "('X')\n", (334, 339), False, 'from typing impo... |
# Generated by Django 2.2.7 on 2019-12-25 15:37
import core.helpers
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20191224_2048'),
('shop', '0008_auto_20191224_2121'),
]
operations = ... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((330, 399), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""payment"""', 'name': '"""stripe_charge_id"""'}), "(model_name='payment', name='stripe_charge_id')\n", (352, 399), False, 'from django.db import migrations, models\n'), ((545, 640), 'django.db.models.CharField', 'models.C... |
# -*- coding: utf-8 -*-
"""
Helpers to make constructing features and labels easier.
"""
import numpy as np
from chess_py import color
from chess_py.pieces.piece_const import PieceValues
def extract_features_from_position(board):
"""
Converts board to 1D numpy array consisting of
piece values.
:typ... | [
"numpy.sum",
"chess_py.pieces.piece_const.PieceValues"
] | [((382, 395), 'chess_py.pieces.piece_const.PieceValues', 'PieceValues', ([], {}), '()\n', (393, 395), False, 'from chess_py.pieces.piece_const import PieceValues\n'), ((973, 989), 'numpy.sum', 'np.sum', (['position'], {}), '(position)\n', (979, 989), True, 'import numpy as np\n')] |
from nltk.corpus import wordnet
# syns = wordnet.synsets("program")
# print(syns)
# for l in syns:
# print(str(l)+" => "+str(l.lemmas()))
# # print(syns[0].lemmas()[0].name())
# # print(syns[0].definition())
# # print(syns[0].examples()[0])
# synonyms = []
# antonyms = []
# for syn in wordnet.synsets("good"):
# ... | [
"nltk.corpus.wordnet.synset"
] | [((493, 520), 'nltk.corpus.wordnet.synset', 'wordnet.synset', (['"""ship.n.01"""'], {}), "('ship.n.01')\n", (507, 520), False, 'from nltk.corpus import wordnet\n'), ((526, 553), 'nltk.corpus.wordnet.synset', 'wordnet.synset', (['"""boat.n.01"""'], {}), "('boat.n.01')\n", (540, 553), False, 'from nltk.corpus import word... |
"""
Returns an array of probability for each class at timepoints sampled at the specified rate.
e.g. event_detector(filename, model, 40) will sample the input file at 40 frame intervals
and concatenate
"""
import cv2
import numpy as np
from keras.models import load_model
def videoscan(filename, model_file, sampling... | [
"numpy.array",
"cv2.resize",
"keras.models.load_model",
"cv2.VideoCapture"
] | [((1436, 1458), 'keras.models.load_model', 'load_model', (['model_file'], {}), '(model_file)\n', (1446, 1458), False, 'from keras.models import load_model\n'), ((1713, 1739), 'cv2.VideoCapture', 'cv2.VideoCapture', (['filename'], {}), '(filename)\n', (1729, 1739), False, 'import cv2\n'), ((3106, 3121), 'numpy.array', '... |
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. 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 requ... | [
"os.path.exists",
"nemo.utils.logging.info",
"helpers.instantiate_model_and_trainer",
"omegaconf.OmegaConf.to_yaml",
"nemo.collections.nlp.data.text_normalization_as_tagging.utils.spoken_preprocessing",
"nemo.core.config.hydra_runner"
] | [((1856, 1930), 'nemo.core.config.hydra_runner', 'hydra_runner', ([], {'config_path': '"""conf"""', 'config_name': '"""thutmose_tagger_itn_config"""'}), "(config_path='conf', config_name='thutmose_tagger_itn_config')\n", (1868, 1930), False, 'from nemo.core.config import hydra_runner\n'), ((2149, 2201), 'helpers.instan... |
#!/usr/bin/python
from bmp180 import bmp180
bmp = bmp180(0x77)
while True:
print("Temp: " + str(bmp.get_temp()) + " Celcius")
print("Pressure: " + str(bmp.get_pressure()) + " Pascal")
print("Altitude: " + str(bmp.get_altitude()) + " meter") | [
"bmp180.bmp180"
] | [((52, 63), 'bmp180.bmp180', 'bmp180', (['(119)'], {}), '(119)\n', (58, 63), False, 'from bmp180 import bmp180\n')] |
# Flask webserver framework
# Nothing built or functional yet
# TODO
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello():
return 'Hello, World!'
| [
"flask.Flask"
] | [((100, 115), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (105, 115), False, 'from flask import Flask\n')] |
import pytz
from datetime import datetime
from mock import patch
from nose.tools import eq_
from django.utils.timezone import make_aware
from mozillians.announcements.models import Announcement
from mozillians.announcements.tests import AnnouncementFactory, TestCase
class AnnouncementManagerTests(TestCase):
de... | [
"datetime.datetime",
"mock.patch",
"mozillians.announcements.models.Announcement.objects.published",
"mozillians.announcements.models.Announcement.objects.unpublished"
] | [((872, 918), 'mock.patch', 'patch', (['"""mozillians.announcements.managers.now"""'], {}), "('mozillians.announcements.managers.now')\n", (877, 918), False, 'from mock import patch\n'), ((1690, 1736), 'mock.patch', 'patch', (['"""mozillians.announcements.managers.now"""'], {}), "('mozillians.announcements.managers.now... |
##########################################################################
# NSAp - Copyright (C) CEA, 2013 - 2016
# Distributed under the terms of the CeCILL-B license, as published by
# the CEA-CNRS-INRIA. Refer to the LICENSE file or to
# http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html for details.
#####... | [
"pyconnectomist.clustering.labeling.export_bundles_to_trk",
"pyconnectomist.clustering.labeling.fast_bundle_labeling",
"os.path.join",
"os.path.isdir",
"os.mkdir"
] | [((6797, 6844), 'os.path.join', 'os.path.join', (['dwi_preproc_dir', 'PREPROC_STEPS[1]'], {}), '(dwi_preproc_dir, PREPROC_STEPS[1])\n', (6809, 6844), False, 'import os\n'), ((7150, 7197), 'os.path.join', 'os.path.join', (['dwi_preproc_dir', 'PREPROC_STEPS[5]'], {}), '(dwi_preproc_dir, PREPROC_STEPS[5])\n', (7162, 7197)... |
# -*- coding: utf-8 -*-
from bson.objectid import ObjectId
from bson.errors import InvalidId
from flask import request
from .exceptions import Message
from .messages import invalid, ok, message, not_allow, not_found, response
from .utils import fix_id, processes_filters, split_path, update_view
def _get_collection(a... | [
"bson.objectid.ObjectId",
"flask.request.form.to_dict"
] | [((1439, 1461), 'flask.request.form.to_dict', 'request.form.to_dict', ([], {}), '()\n', (1459, 1461), False, 'from flask import request\n'), ((2059, 2081), 'flask.request.form.to_dict', 'request.form.to_dict', ([], {}), '()\n', (2079, 2081), False, 'from flask import request\n'), ((776, 797), 'bson.objectid.ObjectId', ... |
from setuptools import setup
setup(
name='sklearn_helpers',
version='0.1',
packages=['sklearn_helpers'],
url='https://github.com/FlorisHoogenboom/sklearn-helpers',
license='MIT',
author='<NAME>',
author_email='<EMAIL>',
description='Some helpers I use when working with scikit-learn',
... | [
"setuptools.setup"
] | [((30, 396), 'setuptools.setup', 'setup', ([], {'name': '"""sklearn_helpers"""', 'version': '"""0.1"""', 'packages': "['sklearn_helpers']", 'url': '"""https://github.com/FlorisHoogenboom/sklearn-helpers"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Some helpe... |
from itertools import cycle
import pygame as pg
from .. import prepare, tools
import string
LOADED_FONTS = {}
BUTTON_DEFAULTS = {"call" : None,
"args" : None,
"call_on_up" : True,
"font" : None,
... | [
"pygame.Surface",
"pygame.key.get_pressed",
"pygame.Color",
"pygame.font.Font",
"pygame.Rect"
] | [((539, 556), 'pygame.Color', 'pg.Color', (['"""white"""'], {}), "('white')\n", (547, 556), True, 'import pygame as pg\n'), ((4062, 4081), 'pygame.Rect', 'pg.Rect', (['rect_style'], {}), '(rect_style)\n', (4069, 4081), True, 'import pygame as pg\n'), ((6998, 7018), 'pygame.key.get_pressed', 'pg.key.get_pressed', ([], {... |
"""
OpenVINO DL Workbench
Interfaces class for error processing classes
Copyright (c) 2018 Intel Corporation
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/licens... | [
"re.compile"
] | [((750, 803), 're.compile', 're.compile', (['"""(?:\\\\[ ERROR \\\\] (?P<error_message>.*))"""'], {}), "('(?:\\\\[ ERROR \\\\] (?P<error_message>.*))')\n", (760, 803), False, 'import re\n')] |
import logging
from pydantic import BaseModel
from .exceptions import JsonErrors, RequestError
from .settings import GREPAPTCHA_TEST_SECRET, BaseSettings
from .utils import get_ip, remove_port
logger = logging.getLogger('atoolbox.auth')
async def check_grecaptcha(m: BaseModel, request, *, error_headers=None):
... | [
"logging.getLogger"
] | [((205, 239), 'logging.getLogger', 'logging.getLogger', (['"""atoolbox.auth"""'], {}), "('atoolbox.auth')\n", (222, 239), False, 'import logging\n')] |
import os, sys, time
from . import Utils
class FileWatcher:
def __init__(self):
self.updateInterval = 1
self.filesDict={}
def addFile( self, filePath, action=None, actionArgs=(), actionKwargs={}, useFilePathAsFirstArg=True, easyAction=None ):
entry = Utils.Object()
self.filesDi... | [
"os.stat",
"subprocess.run",
"time.sleep"
] | [((401, 418), 'os.stat', 'os.stat', (['filePath'], {}), '(filePath)\n', (408, 418), False, 'import os, sys, time\n'), ((1377, 1400), 'os.stat', 'os.stat', (['entry.filePath'], {}), '(entry.filePath)\n', (1384, 1400), False, 'import os, sys, time\n'), ((1890, 1921), 'time.sleep', 'time.sleep', (['self.updateInterval'], ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import importlib
from bot import config
from bot import logger
from bot.events import BotEvents, SystemEvents
from unipath import Path
from telegram import Bot, Update
from telegram.ext import Updater
commands = {}
disabled = []
class EventHandler(object):
@stati... | [
"importlib.import_module",
"bot.logger.log.debug",
"unipath.Path",
"bot.events.BotEvents.instance",
"bot.events.SystemEvents.instance",
"bot.logger.log.warning",
"telegram.ext.Updater"
] | [((878, 906), 'telegram.ext.Updater', 'Updater', (['config.telegram_key'], {}), '(config.telegram_key)\n', (885, 906), False, 'from telegram.ext import Updater\n'), ((1615, 1635), 'bot.events.BotEvents.instance', 'BotEvents.instance', ([], {}), '()\n', (1633, 1635), False, 'from bot.events import BotEvents, SystemEvent... |
import py
import pytest
import sys
import os
# XXX: copied from pypy/tool/cpyext/extbuild.py
if os.name != 'nt':
so_ext = 'so'
else:
so_ext = 'dll'
def _build(cfilenames, outputfilename, compile_extra, link_extra,
include_dirs, libraries, library_dirs):
try:
# monkeypatch distutils for som... | [
"os.path.exists",
"distutils.sysconfig.customize_compiler",
"distutils.ccompiler.new_compiler",
"os.environ.get",
"os.environ.copy",
"distutils.sysconfig.get_config_vars",
"pytest.fixture",
"py.path.local"
] | [((3079, 3110), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (3093, 3110), False, 'import pytest\n'), ((667, 694), 'distutils.sysconfig.get_config_vars', 'sysconfig.get_config_vars', ([], {}), '()\n', (692, 694), False, 'from distutils import sysconfig\n'), ((711, 732), '... |
#!/usr/bin/env python
'''
Run tests for Pannellum, set up with Continuous Integration.
Contributed by <NAME>, JoSS Review 2019.
See the project repository for licensing information.
'''
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.chrome.options import Options
from selenium.webdri... | [
"PIL.ImageChops.difference",
"selenium.webdriver.ChromeOptions",
"socketserver.TCPServer",
"PIL.Image.open",
"argparse.ArgumentParser",
"selenium.webdriver.Chrome",
"selenium.webdriver.Firefox",
"time.sleep",
"os.chdir",
"os.path.dirname",
"sys.exit",
"threading.Thread",
"re.search"
] | [((7931, 7993), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""run tests for Pannellum"""'}), "(description='run tests for Pannellum')\n", (7954, 7993), False, 'import argparse\n'), ((8986, 9000), 'os.chdir', 'os.chdir', (['here'], {}), '(here)\n', (8994, 9000), False, 'import os\n'), ((... |
#!/usr/bin/env python
"""Populate GitHub labels for issue tracker."""
from collections import namedtuple
import codecs
import yaml
import json
import sys
import os
import re
import requests
import urllib.parse
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
__version__ = "1.... | [
"json.loads",
"collections.namedtuple",
"requests.post",
"os.getenv",
"re.compile",
"json.dumps",
"requests.patch",
"requests.get",
"requests.delete"
] | [((343, 372), 're.compile', 're.compile', (['"""#[a-fA-F0-9]{6}"""'], {}), "('#[a-fA-F0-9]{6}')\n", (353, 372), False, 'import re\n'), ((5600, 5675), 'collections.namedtuple', 'namedtuple', (['"""LabelEdit"""', "['old', 'new', 'color', 'description', 'modified']"], {}), "('LabelEdit', ['old', 'new', 'color', 'descripti... |
# -*- coding=utf8 -*-
# !/usr/bin/env python
try:
import cPickle
except:
import pickle as cPickle
import csv
import json
import random
from datetime import datetime
import dateutil
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import pylab as plb
import scipy.stats
from sklearn.metri... | [
"matplotlib.pyplot.hist",
"dateutil.relativedelta.relativedelta",
"pandas.read_csv",
"numpy.irr",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"numpy.log",
"numpy.argsort",
"numpy.array",
"sklearn.metrics.roc_curve",
"numpy.nanmin",
"numpy.arange",
"numpy.mean",
"pylab.find",
"nump... | [((848, 874), 'numpy.zeros', 'np.zeros', (['values1.shape[0]'], {}), '(values1.shape[0])\n', (856, 874), True, 'import numpy as np\n'), ((1235, 1260), 'numpy.zeros', 'np.zeros', (['values.shape[0]'], {}), '(values.shape[0])\n', (1243, 1260), True, 'import numpy as np\n'), ((1503, 1528), 'numpy.zeros', 'np.zeros', (['va... |
from __future__ import print_function
from flask import Flask, make_response, jsonify, request, render_template
from flask_restful import Resource, Api
from skimage import io
import pyzbar.pyzbar as pyzbar
from cloudant import Cloudant
import atexit
import os
import json
app = Flask(__name__, static_url_path... | [
"os.getenv",
"flask_restful.Api",
"flask.Flask",
"pyzbar.pyzbar.decode",
"flask.request.get_json",
"skimage.io.imread",
"flask.jsonify"
] | [((289, 324), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""'}), "(__name__, static_url_path='')\n", (294, 324), False, 'from flask import Flask, make_response, jsonify, request, render_template\n'), ((332, 340), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (335, 340), False, 'from flask_re... |
"""`Coroutine` providers example with @asyncio.coroutine decorator.
Current example works only fot Python 3.4+.
"""
import asyncio
import dependency_injector.providers as providers
@asyncio.coroutine
def coroutine_function(arg1, arg2):
"""Sample coroutine function."""
yield from asyncio.sleep(0.1)
retu... | [
"dependency_injector.providers.Coroutine",
"asyncio.get_event_loop",
"asyncio.iscoroutinefunction",
"asyncio.sleep"
] | [((357, 412), 'dependency_injector.providers.Coroutine', 'providers.Coroutine', (['coroutine_function'], {'arg1': '(1)', 'arg2': '(2)'}), '(coroutine_function, arg1=1, arg2=2)\n', (376, 412), True, 'import dependency_injector.providers as providers\n'), ((453, 477), 'asyncio.get_event_loop', 'asyncio.get_event_loop', (... |
from dotenv import dotenv_values
from TicketView import TicketView
from APIModel import APIModel
class TicketViewerController:
"""
Accepts user input and delgates presentation to the view
and data handling to the model
"""
def __init__(self):
self.config = dotenv_values(".env")
... | [
"TicketView.TicketView",
"dotenv.dotenv_values",
"APIModel.APIModel"
] | [((291, 312), 'dotenv.dotenv_values', 'dotenv_values', (['""".env"""'], {}), "('.env')\n", (304, 312), False, 'from dotenv import dotenv_values\n'), ((334, 424), 'APIModel.APIModel', 'APIModel', (["self.config['subdomain']", "self.config['username']", "self.config['api_token']"], {}), "(self.config['subdomain'], self.c... |
import copy
import logging
import six
from sqlalchemy.orm import (
class_mapper, object_session, properties, attributes)
from sqlalchemy.orm.collections import InstrumentedList
from sqlalchemy.exc import (
InvalidRequestError, IntegrityError, DataError)
from sqlalchemy.orm.exc import MultipleResultsFound, NoRe... | [
"logging.getLogger",
"sqlalchemy.orm.attributes.instance_state",
"nefertari.json_httpexceptions.JHTTPBadRequest",
"copy.deepcopy",
"sqlalchemy.event.listen",
"pyramid_sqlalchemy.Session",
"nefertari.utils.process_fields",
"nefertari.utils.process_limit",
"nefertari.elasticsearch.ES.src2type",
"sql... | [((864, 891), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (881, 891), False, 'import logging\n'), ((32686, 32731), 'six.with_metaclass', 'six.with_metaclass', (['ESMetaclass', 'BaseDocument'], {}), '(ESMetaclass, BaseDocument)\n', (32704, 32731), False, 'import six\n'), ((4421, 4438), ... |
from . import evaluators
from awrams.utils.messaging.general import message
from .communication import *
from awrams.calibration.node import *
from awrams.calibration import sce
from awrams.calibration.logger import CalibrationLogger
from awrams.utils.messaging.binding import build_queues, bound_proxy
import imp
SCE_D... | [
"imp.load_source",
"awrams.calibration.sce.ProxyOptimizer",
"awrams.utils.messaging.binding.build_queues",
"awrams.utils.messaging.general.message"
] | [((580, 594), 'awrams.utils.messaging.binding.build_queues', 'build_queues', ([], {}), '()\n', (592, 594), False, 'from awrams.utils.messaging.binding import build_queues, bound_proxy\n'), ((655, 724), 'imp.load_source', 'imp.load_source', (['"""lobjf_mod"""', 'node_settings.objective.localf.filename'], {}), "('lobjf_m... |
import eventlet
eventlet.monkey_patch()
import requests
import time
import pickle
import random
from collections import deque, defaultdict
from flask import Flask
from flask_cors import CORS
from flask_apscheduler import APScheduler
from flask_socketio import SocketIO, emit
from util import get_data, resolve_bet
from... | [
"collections.deque",
"flask_cors.CORS",
"flask.Flask",
"flask_apscheduler.APScheduler",
"flask_socketio.SocketIO",
"time.sleep",
"util.get_data",
"collections.defaultdict",
"eventlet.monkey_patch",
"time.time",
"random.randint"
] | [((17, 40), 'eventlet.monkey_patch', 'eventlet.monkey_patch', ([], {}), '()\n', (38, 40), False, 'import eventlet\n'), ((390, 405), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (395, 405), False, 'from flask import Flask\n'), ((406, 415), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (410, 415), F... |
'''
Compares stuctured data recursively and reports on differences.
'''
from curry.utility.visitation import dispatch
import collections
import functools
import re
import six
class Difference(Exception):
'''Indicates a found difference.'''
def dissectmethod(wrapped):
'''
Decorator that implements standard pro... | [
"curry.utility.visitation.dispatch.on",
"re.match",
"functools.wraps",
"re.compile"
] | [((812, 836), 'functools.wraps', 'functools.wraps', (['wrapped'], {}), '(wrapped)\n', (827, 836), False, 'import functools\n'), ((1137, 1151), 're.compile', 're.compile', (['""""""'], {}), "('')\n", (1147, 1151), False, 'import re\n'), ((2253, 2269), 'curry.utility.visitation.dispatch.on', 'dispatch.on', (['"""a"""'], ... |
# emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the duecredit package for the
# copyright and license terms.
#
# ## ### ... | [
"pytest.raises",
"six.moves.StringIO"
] | [((577, 587), 'six.moves.StringIO', 'StringIO', ([], {}), '()\n', (585, 587), False, 'from six.moves import StringIO\n'), ((644, 711), 'pytest.raises', 'pytest.raises', (['SystemExit', '__main__.main', "['__main__.py', '--help']"], {}), "(SystemExit, __main__.main, ['__main__.py', '--help'])\n", (657, 711), False, 'imp... |
import subprocess
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QLineEdit, QMenu, QAction
class FindPathLineEdit(QLineEdit):
def __init__(self):
super().__init__()
self.__initUi()
def __initUi(self):
self.setMouseTracking(True)
self.setReadOnly(True)
self.se... | [
"PyQt5.QtWidgets.QAction",
"subprocess.Popen",
"PyQt5.QtWidgets.QMenu"
] | [((826, 837), 'PyQt5.QtWidgets.QMenu', 'QMenu', (['self'], {}), '(self)\n', (831, 837), False, 'from PyQt5.QtWidgets import QLineEdit, QMenu, QAction\n'), ((862, 882), 'PyQt5.QtWidgets.QAction', 'QAction', (['"""Open Path"""'], {}), "('Open Path')\n", (869, 882), False, 'from PyQt5.QtWidgets import QLineEdit, QMenu, QA... |
from brownie import accounts, interface, Contract
from brownie import (Bank, SimpleBankConfig, SimplePriceOracle, PancakeswapPool1Goblin,
StrategyAllBNBOnly, StrategyLiquidate, StrategyWithdrawMinimizeTrading, StrategyAddTwoSidesOptimal, PancakeswapGoblinConfig, TripleSlopeModel, ConfigurableIntere... | [
"brownie.TripleSlopeModel.deploy",
"brownie.ProxyAdminImpl.deploy",
"brownie.ConfigurableInterestBankConfig.deploy",
"brownie.interface.IAny",
"brownie.Bank.deploy"
] | [((507, 547), 'brownie.TripleSlopeModel.deploy', 'TripleSlopeModel.deploy', (["{'from': admin}"], {}), "({'from': admin})\n", (530, 547), False, 'from brownie import Bank, SimpleBankConfig, SimplePriceOracle, PancakeswapPool1Goblin, StrategyAllBNBOnly, StrategyLiquidate, StrategyWithdrawMinimizeTrading, StrategyAddTwoS... |
from datetime import datetime, timedelta
import pytest
from actions.user.authentication import (
UserAuthentication,
InvalidCredentialsException,
)
from database_schemas.users import UserEntry
from data_models.access_token import UserToken
@pytest.fixture(name="user_authentication")
def fixture_user_authenti... | [
"datetime.datetime.utcnow",
"pytest.raises",
"pytest.fixture",
"datetime.timedelta",
"actions.user.authentication.UserAuthentication"
] | [((252, 294), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""user_authentication"""'}), "(name='user_authentication')\n", (266, 294), False, 'import pytest\n'), ((353, 385), 'actions.user.authentication.UserAuthentication', 'UserAuthentication', (['user_profile'], {}), '(user_profile)\n', (371, 385), False, 'fro... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name = "monitorable",
version = "0.0.1",
keywords = ("monitorable"),
description = "monitorable",
long_description = "monitorable",
license = "MIT Licence",
url = "https://github.com/fierflame/monitorable.py",
author = "Fierflame",
pac... | [
"setuptools.find_packages"
] | [((328, 343), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (341, 343), False, 'from setuptools import setup, find_packages\n')] |
"""Slicing"""
import math
from itertools import islice
# Recaps: slicing sequence type
l = [1, 2, 3, 4]
print(l[0:2])
s = slice(0, 2)
print(l[s])
# Slicing an iterator
def factorials(n):
for i in range(n):
yield math.factorial(i)
def slice_(iterable, start, stop):
"""Demonstrate how islice() works... | [
"math.factorial"
] | [((228, 245), 'math.factorial', 'math.factorial', (['i'], {}), '(i)\n', (242, 245), False, 'import math\n')] |
"""Test data for AIOGitHub."""
# pylint: disable=invalid-name
import pytest
@pytest.fixture()
def response_get_repo_awesome():
return {
"id": 99999999,
"full_name": "awesome-dev/awesome-repo",
"pushed_at": "1970-01-01T00:00:00Z",
"archived": False,
"description": "Awesome!"... | [
"pytest.fixture"
] | [((79, 95), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (93, 95), False, 'import pytest\n')] |
import numpy as np
import math
from tf_convex_quad_iou import iou_matrix
sqrt2 = math.sqrt(2)
anchors = np.array([
[
[-1, -1],
[1, -1],
[1, 1],
[-1, 1],
],
[
[0, 0],
[2, 0],
[2, 2],
[0, 2],
],
[
[0, sqrt2],
[-sqrt2, 0]... | [
"numpy.array",
"tf_convex_quad_iou.iou_matrix",
"math.sqrt"
] | [((82, 94), 'math.sqrt', 'math.sqrt', (['(2)'], {}), '(2)\n', (91, 94), False, 'import math\n'), ((106, 336), 'numpy.array', 'np.array', (['[[[-1, -1], [1, -1], [1, 1], [-1, 1]], [[0, 0], [2, 0], [2, 2], [0, 2]], [[\n 0, sqrt2], [-sqrt2, 0], [0, -sqrt2], [sqrt2, 0]], [[-1, 1], [0, 0], [1,\n 0], [2, 1]], [[1, 1], ... |
import time
from leek_demo.tasks.low import failed_task, succeeded_task, rejected_task, parent_task
from leek_demo.tasks.high import critical_task, revoked_expired_task, recovered_task, revoked_terminated_task
while True:
succeeded_task.delay(4, 4)
failed_task.delay()
rejected_task.delay()
critical_ta... | [
"leek_demo.tasks.high.revoked_expired_task.delay",
"leek_demo.tasks.low.rejected_task.delay",
"leek_demo.tasks.low.succeeded_task.delay",
"leek_demo.tasks.high.critical_task.delay",
"time.sleep",
"leek_demo.tasks.low.parent_task.delay",
"leek_demo.tasks.high.revoked_terminated_task.delay",
"leek_demo.... | [((228, 254), 'leek_demo.tasks.low.succeeded_task.delay', 'succeeded_task.delay', (['(4)', '(4)'], {}), '(4, 4)\n', (248, 254), False, 'from leek_demo.tasks.low import failed_task, succeeded_task, rejected_task, parent_task\n'), ((259, 278), 'leek_demo.tasks.low.failed_task.delay', 'failed_task.delay', ([], {}), '()\n'... |
# Copyright (c) 2018, 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
from nose... | [
"nose.plugins.skip.SkipTest",
"ansible.module_utils.oracle.oci_resource_utils.convert_input_data_to_model_class"
] | [((932, 1034), 'ansible.module_utils.oracle.oci_resource_utils.convert_input_data_to_model_class', 'oci_resource_utils.convert_input_data_to_model_class', (['data', 'oci.core.models.LaunchInstanceDetails'], {}), '(data, oci.core.models.\n LaunchInstanceDetails)\n', (984, 1034), False, 'from ansible.module_utils.orac... |
import pytest
from power import power
def test_one():
assert power(2,-3) == 0.125
def test_two():
assert power(2,1) == 2
def test_three():
assert power(2,2) == 4
def test_four():
assert power(2,3) == 8
def test_five():
assert power(2,4) == 16
def test_six():
assert power(2,9) == 512
def test_seven():
ass... | [
"pytest.approx",
"power.power"
] | [((64, 76), 'power.power', 'power', (['(2)', '(-3)'], {}), '(2, -3)\n', (69, 76), False, 'from power import power\n'), ((110, 121), 'power.power', 'power', (['(2)', '(1)'], {}), '(2, 1)\n', (115, 121), False, 'from power import power\n'), ((153, 164), 'power.power', 'power', (['(2)', '(2)'], {}), '(2, 2)\n', (158, 164)... |
import argparse
import json
import subprocess
from jinja2 import Template
import toml
import black
# Template and target file locations of files that need to be generated
CODEGEN_FILES = [
("codegen/kanji_lists.jinja2", "kanji_lists/kanji_lists.py"),
("codegen/__init__.jinja2", "kanji_lists/__init__.py"),
... | [
"json.load",
"subprocess.call",
"argparse.ArgumentParser",
"toml.load"
] | [((1747, 1767), 'subprocess.call', 'subprocess.call', (['cmd'], {}), '(cmd)\n', (1762, 1767), False, 'import subprocess\n'), ((1876, 1965), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Helper script for code generation and linting"""'}), "(description=\n 'Helper script for code gene... |
"""
Django settings for fastshop project.
Generated by 'django-admin startproject' using Django 1.10.6.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import o... | [
"os.path.abspath",
"os.path.join",
"oscar.get_core_apps"
] | [((1382, 1403), 'oscar.get_core_apps', 'oscar.get_core_apps', ([], {}), '()\n', (1401, 1403), False, 'import oscar\n'), ((480, 505), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (495, 505), False, 'import os\n'), ((3204, 3240), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""db.sqlite3"""... |
from django.db import models
from accounts.models import Account
from store.models import Product
class Payment(models.Model):
user = models.ForeignKey(Account, on_delete=models.CASCADE)
payment_id = models.CharField(max_length=100)
payment_method = models.CharField(max_length=100)
amount_paid = model... | [
"django.db.models.EmailField",
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((140, 192), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Account'], {'on_delete': 'models.CASCADE'}), '(Account, on_delete=models.CASCADE)\n', (157, 192), False, 'from django.db import models\n'), ((210, 242), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)... |
"""
The arm_large module contains the class ArmLarge that simulated the arms as seen from above.
"""
import math
from arcade import Sprite
import arcade
from ev3dev2simulator.config.config import get_simulation_settings
from ev3dev2simulator.obstacle.arm_floor import ArmFloor
class ArmLarge(Sprite):
"""
Cl... | [
"arcade.load_texture",
"math.radians",
"ev3dev2simulator.obstacle.arm_floor.ArmFloor",
"math.cos",
"ev3dev2simulator.config.config.get_simulation_settings",
"math.sin"
] | [((588, 625), 'ev3dev2simulator.obstacle.arm_floor.ArmFloor', 'ArmFloor', (['(300)', '(10)', 'arcade.color.BLACK'], {}), '(300, 10, arcade.color.BLACK)\n', (596, 625), False, 'from ev3dev2simulator.obstacle.arm_floor import ArmFloor\n'), ((1270, 1295), 'ev3dev2simulator.config.config.get_simulation_settings', 'get_simu... |
import binascii
import struct
import hashlib
import math
import bittensor
import rich
import time
def hex_bytes_to_u8_list( hex_bytes: bytes ):
hex_chunks = [int(hex_bytes[i:i+2], 16) for i in range(0, len(hex_bytes), 2)]
return hex_chunks
def u8_list_to_hex( values: list ):
total = 0
for val in rever... | [
"math.pow",
"binascii.hexlify",
"time.time"
] | [((1752, 1763), 'time.time', 'time.time', ([], {}), '()\n', (1761, 1763), False, 'import time\n'), ((3626, 3648), 'binascii.hexlify', 'binascii.hexlify', (['seal'], {}), '(seal)\n', (3642, 3648), False, 'import binascii\n'), ((858, 874), 'math.pow', 'math.pow', (['(2)', '(256)'], {}), '(2, 256)\n', (866, 874), False, '... |
from tortoise.models import Model
from tortoise import fields, Tortoise, run_async
import logging
class MyAbstractBaseModel(Model):
id = fields.IntField(pk=True)
class Meta:
abstract = True
class TimestampMixin():
datetime = fields.DatetimeField(auto_now_add=True)
class Weather(TimestampMixin, M... | [
"tortoise.fields.CharField",
"tortoise.fields.DatetimeField",
"tortoise.fields.FloatField",
"tortoise.fields.IntField"
] | [((142, 166), 'tortoise.fields.IntField', 'fields.IntField', ([], {'pk': '(True)'}), '(pk=True)\n', (157, 166), False, 'from tortoise import fields, Tortoise, run_async\n'), ((248, 287), 'tortoise.fields.DatetimeField', 'fields.DatetimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (268, 287), False... |
#------------------------------------------------------------------------------
# Create side by side trajectories on video frame and sat image
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Settings and... | [
"numpy.array",
"copy.deepcopy",
"pandas.read_csv",
"modules.homography.PixelMapper"
] | [((505, 547), 'pandas.read_csv', 'pd.read_csv', (['"""../output/2-sample-2020.csv"""'], {}), "('../output/2-sample-2020.csv')\n", (516, 547), True, 'import pandas as pd\n'), ((2616, 2672), 'modules.homography.PixelMapper', 'PixelMapper', (["quad_coords['pixel']", "quad_coords['lonlat']"], {}), "(quad_coords['pixel'], q... |
import sys
import click
from dagger.pipeline.task_factory import TaskFactory
from dagger.utils import Printer
task_factory = TaskFactory()
valid_tasks = task_factory.factory.keys()
@click.command()
@click.option("--type", "-t", help="Type of task")
def init_task(type: str) -> None:
"""
Printing task templat... | [
"click.option",
"click.command",
"dagger.pipeline.task_factory.TaskFactory"
] | [((127, 140), 'dagger.pipeline.task_factory.TaskFactory', 'TaskFactory', ([], {}), '()\n', (138, 140), False, 'from dagger.pipeline.task_factory import TaskFactory\n'), ((186, 201), 'click.command', 'click.command', ([], {}), '()\n', (199, 201), False, 'import click\n'), ((203, 252), 'click.option', 'click.option', (['... |
import numpy as np
def compute_quantity (plan, stype):
if stype == 'stack':
return compute_quantity_stack (plan['packages']['children'])
elif stype == 'shelf':
return compute_quantity_shelf (plan['packages']['children'])
else:
return compute_quantity_apr (plan['packages']['chil... | [
"numpy.roll"
] | [((1847, 1860), 'numpy.roll', 'np.roll', (['y', '(1)'], {}), '(y, 1)\n', (1854, 1860), True, 'import numpy as np\n'), ((1870, 1883), 'numpy.roll', 'np.roll', (['x', '(1)'], {}), '(x, 1)\n', (1877, 1883), True, 'import numpy as np\n')] |
from torchvision.models.segmentation import deeplabv3_resnet50
def setup_model(config):
return deeplabv3_resnet50(num_classes=config.num_classes)
| [
"torchvision.models.segmentation.deeplabv3_resnet50"
] | [((101, 151), 'torchvision.models.segmentation.deeplabv3_resnet50', 'deeplabv3_resnet50', ([], {'num_classes': 'config.num_classes'}), '(num_classes=config.num_classes)\n', (119, 151), False, 'from torchvision.models.segmentation import deeplabv3_resnet50\n')] |
# Generated by Django 3.0.8 on 2020-07-28 14:32
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('sites', '0002_alter_domain_unique'),
('database', '0002_auto_20190129_2304'),
]
operations = [
migr... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((681, 768), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""constance"""', 'unique_together': "{('key', 'site')}"}), "(name='constance', unique_together={('key',\n 'site')})\n", (711, 768), False, 'from django.db import migrations, models\n'), ((416, 510), 'django.db... |
import time
import math
import tempfile
import operator
import os
import json
from typing import Union, List, Tuple
import unittest
import h5py
import numpy as np
from PythonExtras import numpy_extras as npe
from PythonExtras import patching_tools
from PythonExtras import volume_tools
from PythonExtras.CppWrapper imp... | [
"PythonExtras.numpy_extras.var_large_array_masked",
"PythonExtras.numpy_extras.aggregate_attention_volume",
"PythonExtras.BufferedNdArray.BufferedNdArray",
"numpy.fromfile",
"PythonExtras.CppWrapper.CppWrapper.test",
"numpy.logical_not",
"numpy.equal",
"PythonExtras.numpy_extras.abs_diff_hdf_arrays_ma... | [((2484, 2495), 'time.time', 'time.time', ([], {}), '()\n', (2493, 2495), False, 'import time\n'), ((4303, 4337), 'numpy.not_equal', 'np.not_equal', (['allDataY', 'emptyValue'], {}), '(allDataY, emptyValue)\n', (4315, 4337), True, 'import numpy as np\n'), ((4467, 4520), 'numpy.logical_or', 'np.logical_or', (['nonemptyP... |
#-*- coding:utf-8 -*-
from tornado.httpclient import HTTPClient, AsyncHTTPClient
import tornado.ioloop
from tornado.concurrent import Future
from tornado import gen
import time
from concurrent.futures import ThreadPoolExecutor
executor = ThreadPoolExecutor(max_workers=4)
#同步方法调用
def synchronous_fetch(url, callback):
... | [
"tornado.concurrent.Future",
"concurrent.futures.ThreadPoolExecutor",
"time.sleep",
"tornado.httpclient.HTTPClient",
"tornado.gen.Return",
"tornado.httpclient.AsyncHTTPClient"
] | [((239, 272), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(4)'}), '(max_workers=4)\n', (257, 272), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((338, 350), 'tornado.httpclient.HTTPClient', 'HTTPClient', ([], {}), '()\n', (348, 350), False, 'from tornado.httpcl... |
import math
def distance(p1, p2):
result = math.sqrt( (p2[0] - p1[0])**2 + (p2[1] - p1[1])**2 )
return result
def distances(points):
p1, p2, p3, p4 = points
d1 = distance(p1, p2)
d2 = distance(p2, p3)
d3 = distance(p3, p4)
d4 = distance(p4, p1)
return [d1, d2, d3, d4]
def angles(poin... | [
"math.sqrt",
"math.acos"
] | [((48, 102), 'math.sqrt', 'math.sqrt', (['((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2)'], {}), '((p2[0] - p1[0]) ** 2 + (p2[1] - p1[1]) ** 2)\n', (57, 102), False, 'import math\n'), ((585, 636), 'math.acos', 'math.acos', (['((a ** 2 + b ** 2 - h ** 2) / (2 * a * b))'], {}), '((a ** 2 + b ** 2 - h ** 2) / (2 * a * b))\... |
import odespy
from vib_odespy import run_solvers_and_plot, RHS, \
VibSolverWrapper4Odespy, plt
from numpy import pi, sin
# Primary ODE: m=1, s(u)=(2*pi)**2*u, such that the period is 1.
# Then we add linear damping and a force term A*sin(w*t) where
# w is half and double of the frequency of the free oscillations.... | [
"vib_odespy.VibSolverWrapper4Odespy",
"odespy.CrankNicolson",
"vib_odespy.plt.show",
"vib_odespy.RHS",
"odespy.BackwardEuler",
"vib_odespy.run_solvers_and_plot",
"odespy.ForwardEuler",
"numpy.sin",
"vib_odespy.plt.figure"
] | [((1672, 1682), 'vib_odespy.plt.show', 'plt.show', ([], {}), '()\n', (1680, 1682), False, 'from vib_odespy import run_solvers_and_plot, RHS, VibSolverWrapper4Odespy, plt\n'), ((1555, 1567), 'vib_odespy.plt.figure', 'plt.figure', ([], {}), '()\n', (1565, 1567), False, 'from vib_odespy import run_solvers_and_plot, RHS, V... |
from argparse import ArgumentParser
from pathlib import Path
import os
import time
import glob
import torch
import logging
import json
import random
import numpy as np
import pandas as pd
from contextlib import contextmanager
from collections import namedtuple, defaultdict
from tempfile import TemporaryDirectory
impor... | [
"torch.cuda.device_count",
"numpy.array",
"torch.utils.data.distributed.DistributedSampler",
"torch.cuda.is_available",
"pytorch_transformers.modeling_bert.BertForPreTraining.from_pretrained",
"utils.Timers",
"torch.distributed.get_rank",
"logging.info",
"os.remove",
"os.path.exists",
"numpy.mea... | [((1091, 1179), 'collections.namedtuple', 'namedtuple', (['"""InputFeatures"""', '"""input_ids input_mask segment_ids lm_label_ids is_next"""'], {}), "('InputFeatures',\n 'input_ids input_mask segment_ids lm_label_ids is_next')\n", (1101, 1179), False, 'from collections import namedtuple, defaultdict\n'), ((1220, 12... |
# Generated by Django 2.2.2 on 2019-06-18 18:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tv', '0006_auto_20190618_1300'),
]
operations = [
migrations.AlterField(
model_name='movietvshow',
name='name_es',
... | [
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((337, 424), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)', 'verbose_name': '"""Spanish Latin America"""'}), "(blank=True, max_length=255, verbose_name=\n 'Spanish Latin America')\n", (353, 424), False, 'from django.db import migrations, models\n'), ((550, 605), 'd... |
import json
import pytest
from indy.ledger import build_acceptance_mechanisms_request
from indy_common.authorize.auth_actions import ADD_PREFIX
from indy_common.authorize.auth_constraints import AuthConstraint, IDENTITY_OWNER
from indy_common.types import Request
from indy_node.test.auth_rule.auth_framework.basic imp... | [
"plenum.common.util.randomString",
"indy_node.test.helper.build_auth_rule_request_json",
"plenum.test.helper.sdk_sign_request_from_dict",
"json.dumps",
"plenum.test.helper.sdk_get_and_check_replies",
"pytest.raises",
"indy_common.authorize.auth_constraints.AuthConstraint",
"plenum.common.util.get_utc_... | [((1174, 1274), 'plenum.test.pool_transactions.helper.sdk_sign_and_send_prepared_request', 'sdk_sign_and_send_prepared_request', (['self.looper', 'self.trustee_wallet', 'self.sdk_pool_handle', 'req'], {}), '(self.looper, self.trustee_wallet, self.\n sdk_pool_handle, req)\n', (1208, 1274), False, 'from plenum.test.po... |
import os
import argparse
import tempfile
import json
# Функция для чтения данных из хранилища
def get_data(storage_path, key):
# Читатаем словарь из файла
with open(storage_path, 'r') as storage:
dictionary = json.load(storage)
# В зависимости от того, есть ли нужный ключ, возвращаем либо список... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"tempfile.gettempdir",
"json.load",
"json.dump"
] | [((978, 1056), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(True)', 'description': '"""KeyValue storage utility"""'}), "(add_help=True, description='KeyValue storage utility')\n", (1001, 1056), False, 'import argparse\n'), ((1687, 1732), 'os.path.join', 'os.path.join', (['files_directory', ... |
import pytest
import matplotlib.pyplot as plt
import astropy.units as u
import numpy as np
from ..skySurvey import SkySurvey
# Set up the random number generator.
np.random.seed(1234)
# Local directory:
# "/Users/dk/Data/WHAM/wham-ss-DR1-v161116-170912.fits"
survey = SkySurvey()
BASELINE_DIR = 'baseline'
@pytest.... | [
"cartopy.crs.Stereographic",
"pytest.mark.mpl_image_compare",
"matplotlib.pyplot.figure",
"numpy.random.seed"
] | [((165, 185), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (179, 185), True, 'import numpy as np\n'), ((313, 383), 'pytest.mark.mpl_image_compare', 'pytest.mark.mpl_image_compare', ([], {'baseline_dir': 'BASELINE_DIR', 'tolerance': '(20)'}), '(baseline_dir=BASELINE_DIR, tolerance=20)\n', (342, 3... |
"""
Helper to upload data into blob storage
"""
import os
import logging
import uuid
import dotenv
from azure.storage.blob import BlockBlobService
from azure.storage.blob import ContentSettings
def uploadblob(content):
""" Uploads content string into blob storage
"""
storage_account = os... | [
"logging.basicConfig",
"uuid.uuid4",
"dotenv.load_dotenv",
"azure.storage.blob.ContentSettings",
"azure.storage.blob.BlockBlobService"
] | [((614, 685), 'azure.storage.blob.BlockBlobService', 'BlockBlobService', ([], {'account_name': 'storage_account', 'account_key': 'storage_key'}), '(account_name=storage_account, account_key=storage_key)\n', (630, 685), False, 'from azure.storage.blob import BlockBlobService\n'), ((1012, 1067), 'logging.basicConfig', 'l... |