code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from rest_framework import serializers
from .models import Reply
from users.models import Profile
from comments.models import Comment
class ReplySerializer(serializers.HyperlinkedModelSerializer):
user = serializers.PrimaryKeyRelatedField(queryset=Profile.objects.all())
comment = serializers.PrimaryKeyRelatedField... | [
"rest_framework.serializers.HyperlinkedRelatedField",
"users.models.Profile.objects.all",
"comments.models.Comment.objects.all"
] | [((251, 272), 'users.models.Profile.objects.all', 'Profile.objects.all', ([], {}), '()\n', (270, 272), False, 'from users.models import Profile\n'), ((330, 351), 'comments.models.Comment.objects.all', 'Comment.objects.all', ([], {}), '()\n', (349, 351), False, 'from comments.models import Comment\n'), ((716, 811), 'res... |
#!/usr/bin/env python
#
# collect.py renames files from subdirectories
#
# Copyright <NAME>, 2007--2018
"""
Synopsis:
Rename files or folders following a pattern containing an integer index,
as in 'image0001.png'. The file will be moved in the current directory
The number in the file name is inc... | [
"os.mkdir",
"os.path.isdir",
"shutil.copy2",
"os.path.dirname",
"os.path.exists",
"os.rename",
"os.path.isfile",
"sys.stderr.write",
"os.path.join",
"os.listdir"
] | [((2020, 2039), 'os.path.isfile', 'os.path.isfile', (['src'], {}), '(src)\n', (2034, 2039), False, 'import sys, shutil, os, curses.ascii\n'), ((2656, 2679), 'os.path.isfile', 'os.path.isfile', (['pattern'], {}), '(pattern)\n', (2670, 2679), False, 'import sys, shutil, os, curses.ascii\n'), ((2049, 2071), 'shutil.copy2'... |
import os
from dotenv import find_dotenv
from dotenv import load_dotenv
# Find and load dotenv
load_dotenv(find_dotenv())
class Config:
def __init__(self):
# Source and target languages
self.SRC = os.environ.get("SRC")
self.TGT = os.environ.get("TGT")
# Dirs
self.BASE_D... | [
"os.environ.get",
"dotenv.find_dotenv"
] | [((108, 121), 'dotenv.find_dotenv', 'find_dotenv', ([], {}), '()\n', (119, 121), False, 'from dotenv import find_dotenv\n'), ((222, 243), 'os.environ.get', 'os.environ.get', (['"""SRC"""'], {}), "('SRC')\n", (236, 243), False, 'import os\n'), ((263, 284), 'os.environ.get', 'os.environ.get', (['"""TGT"""'], {}), "('TGT'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import cv2
import numpy as np
from cnocr import CnOcr
# 后续生成票据图像时的大小,按照标准增值税发票版式240mmX140mm来设定
height_resize = 1400
width_resize = 2400
# 实例化不同用途CnOcr对象
ocr = CnOcr(name='') # 混合字符
ocr_numbers = CnOcr(name='numbers', cand_alphabet='0123456789.') # 纯数字
ocr_UpperSerial =... | [
"cv2.GaussianBlur",
"cv2.approxPolyDP",
"cv2.getPerspectiveTransform",
"cv2.arcLength",
"numpy.argmax",
"numpy.ones",
"numpy.argmin",
"cv2.rectangle",
"cv2.imencode",
"cv2.imshow",
"cv2.line",
"cv2.warpPerspective",
"cv2.contourArea",
"cv2.dilate",
"cv2.imwrite",
"cv2.resize",
"cnocr... | [((208, 222), 'cnocr.CnOcr', 'CnOcr', ([], {'name': '""""""'}), "(name='')\n", (213, 222), False, 'from cnocr import CnOcr\n'), ((245, 295), 'cnocr.CnOcr', 'CnOcr', ([], {'name': '"""numbers"""', 'cand_alphabet': '"""0123456789."""'}), "(name='numbers', cand_alphabet='0123456789.')\n", (250, 295), False, 'from cnocr im... |
from collections import deque
from dataclasses import dataclass
from enum import Enum, auto
class Type(Enum):
ERROR = auto()
INCOMPLETE = auto()
@dataclass
class SyntaxScore:
type: Type
value: int
OPENERS_CLOSERS = {
"(": ")",
"[": "]",
"{": "}",
"<": ">",
}
def get_score(entry: ... | [
"enum.auto",
"aocd.models.Puzzle",
"collections.deque",
"aocd.transforms.lines"
] | [((124, 130), 'enum.auto', 'auto', ([], {}), '()\n', (128, 130), False, 'from enum import Enum, auto\n'), ((148, 154), 'enum.auto', 'auto', ([], {}), '()\n', (152, 154), False, 'from enum import Enum, auto\n'), ((416, 423), 'collections.deque', 'deque', ([], {}), '()\n', (421, 423), False, 'from collections import dequ... |
from thespian.system.transport import ResultCallback
from datetime import datetime, timedelta
from time import sleep
class TestUnitResultCallback(object):
def _good(self, result, value):
if not hasattr(self, 'goods'): self.goods = []
self.goods.append( (result, value) )
def _fail(self, resul... | [
"thespian.system.transport.ResultCallback"
] | [((525, 563), 'thespian.system.transport.ResultCallback', 'ResultCallback', (['self._good', 'self._fail'], {}), '(self._good, self._fail)\n', (539, 563), False, 'from thespian.system.transport import ResultCallback\n'), ((766, 804), 'thespian.system.transport.ResultCallback', 'ResultCallback', (['self._good', 'self._fa... |
import sys
from cli_augments import arg_parser
from htmlreader import read_page
purgeFiles = False
newItem = False
weight = ''
upc = ''
video_link = None
# parse arguments
processedArgs = arg_parser(sys.argv)
if type(processedArgs) == str:
url = processedArgs
read_page(url, False)
elif type(processedArgs) ==... | [
"cli_augments.arg_parser",
"htmlreader.read_page"
] | [((190, 210), 'cli_augments.arg_parser', 'arg_parser', (['sys.argv'], {}), '(sys.argv)\n', (200, 210), False, 'from cli_augments import arg_parser\n'), ((271, 292), 'htmlreader.read_page', 'read_page', (['url', '(False)'], {}), '(url, False)\n', (280, 292), False, 'from htmlreader import read_page\n'), ((331, 362), 'ht... |
from abc import abstractmethod
from weakref import WeakValueDictionary
from typing import Iterable, Tuple, Type, Generic, TypeVar
T = TypeVar('T')
class ResourceLevels(Generic[T]):
"""
Common class for named resource levels
Representation for the levels of multiple named resources. Every set of resourc... | [
"typing.TypeVar",
"weakref.WeakValueDictionary"
] | [((136, 148), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (143, 148), False, 'from typing import Iterable, Tuple, Type, Generic, TypeVar\n'), ((2751, 2772), 'weakref.WeakValueDictionary', 'WeakValueDictionary', ([], {}), '()\n', (2770, 2772), False, 'from weakref import WeakValueDictionary\n')] |
import numpy as np
# create array data
predict = np.array([[1,2,2,1],
[4.5,2.5,10,0.5],
[6,6,8,4],
[6.26,6.26,8.26,4.26]],np.double)
truth = np.array([[1,4,3,3],
[1.2,2.2,2.2,1.2],
[5,2,8,1],
[6.1,6.1,8.1,4.1],... | [
"numpy.zeros",
"numpy.any",
"numpy.array",
"numpy.argmax"
] | [((51, 152), 'numpy.array', 'np.array', (['[[1, 2, 2, 1], [4.5, 2.5, 10, 0.5], [6, 6, 8, 4], [6.26, 6.26, 8.26, 4.26]]', 'np.double'], {}), '([[1, 2, 2, 1], [4.5, 2.5, 10, 0.5], [6, 6, 8, 4], [6.26, 6.26, \n 8.26, 4.26]], np.double)\n', (59, 152), True, 'import numpy as np\n'), ((202, 322), 'numpy.array', 'np.array'... |
from kb import KB, TRAIN_LABEL, DEV_LABEL, TEST_LABEL
import random
import numpy as np
class SampleKB:
def __init__(self, num_relations, num_entities,
arities=[0.0, 1.0, 0.0],
fb_densities=[0.0, 0.0, 0.0],
arg_densities=[0., 0.1, 0.0],
fact_prob=0... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"random.uniform",
"random.sample",
"kb.KB",
"random.seed",
"os.path.join",
"numpy.random.shuffle"
] | [((7344, 7364), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (7358, 7364), True, 'import numpy as np\n'), ((7398, 7493), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""create artificial dataset (train+test) with rules (all arity 2)"""'], {}), "(\n 'create artificial dataset (train+... |
'''
@author: <NAME>
'''
import time
import numpy as np
import matplotlib.pyplot as plt
from algorithms import primes1, primes2, primes3, primes4, primes5, primes6, primes7, primes8
ubounds = range(0, 10000, 100)
num = len(ubounds)
results = []
for algorithm in (primes1, primes2, primes3, primes4, primes5, primes6... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"time.time",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((812, 848), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Upper bound for primes"""'], {}), "('Upper bound for primes')\n", (822, 848), True, 'import matplotlib.pyplot as plt\n'), ((849, 897), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Time in seconds to generate primes"""'], {}), "('Time in seconds to generat... |
from flask import Flask, render_template
from flask import request
from database import Tableone
from database import db
from database import app
from selenium import webdriver
from bs4 import BeautifulSoup
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/coin', methods = ['P... | [
"database.app.route",
"database.db.session.add",
"database.Tableone",
"database.app.run",
"selenium.webdriver.Firefox",
"database.db.session.commit",
"flask.render_template",
"bs4.BeautifulSoup"
] | [((210, 229), 'database.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (219, 229), False, 'from database import app\n'), ((287, 323), 'database.app.route', 'app.route', (['"""/coin"""'], {'methods': "['POST']"}), "('/coin', methods=['POST'])\n", (296, 323), False, 'from database import app\n'), ((254,... |
from graphics import *
import random
import math
max_width = 500
max_height = 500
n = int(input("Ile bokow: "))
win = GraphWin('<NAME> zadanie 6', max_width, max_height)
win.setBackground('brown')
center = (250, 250)
r = 125
for item in range(n):
start_point = Point(center[0] + r * math.cos(2 * math.pi * item ... | [
"math.cos",
"math.sin"
] | [((292, 324), 'math.cos', 'math.cos', (['(2 * math.pi * item / n)'], {}), '(2 * math.pi * item / n)\n', (300, 324), False, 'import math\n'), ((342, 374), 'math.sin', 'math.sin', (['(2 * math.pi * item / n)'], {}), '(2 * math.pi * item / n)\n', (350, 374), False, 'import math\n'), ((442, 480), 'math.cos', 'math.cos', ([... |
import rpyc
conn = rpyc.connect("localhost", 12345)
unload = rpyc.async_(conn.root.unload)
unload()
| [
"rpyc.connect",
"rpyc.async_"
] | [((22, 54), 'rpyc.connect', 'rpyc.connect', (['"""localhost"""', '(12345)'], {}), "('localhost', 12345)\n", (34, 54), False, 'import rpyc\n'), ((65, 94), 'rpyc.async_', 'rpyc.async_', (['conn.root.unload'], {}), '(conn.root.unload)\n', (76, 94), False, 'import rpyc\n')] |
# coding: utf-8
#
import base64
import io
import json
import os
import platform
import queue
import subprocess
import sys
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from subprocess import PIPE
from typing import Union
import six
import tornado
from logzero import logger
from PIL im... | [
"os.environ.copy",
"base64.b64decode",
"json.dumps",
"os.path.join",
"traceback.print_exc",
"json.loads",
"traceback.format_exc",
"concurrent.futures.ThreadPoolExecutor",
"json.dump",
"subprocess.Popen",
"io.BytesIO",
"time.sleep",
"platform.system",
"queue.Queue",
"os.listdir",
"torna... | [((1494, 1507), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (1505, 1507), False, 'import queue\n'), ((1583, 1616), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(4)'}), '(max_workers=4)\n', (1601, 1616), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((5595, 56... |
"""
echopype data model inherited from based class EchoData for EK60 data.
"""
import datetime as dt
import numpy as np
import xarray as xr
from .echo_data import EchoData
class EchoDataEK60(EchoData):
"""Class for manipulating EK60 echo data that is already converted to netCDF."""
def __init__(self, file_p... | [
"numpy.log10",
"xarray.open_dataset",
"datetime.datetime.now"
] | [((956, 1008), 'xarray.open_dataset', 'xr.open_dataset', (['self.file_path'], {'group': '"""Environment"""'}), "(self.file_path, group='Environment')\n", (971, 1008), True, 'import xarray as xr\n'), ((1027, 1072), 'xarray.open_dataset', 'xr.open_dataset', (['self.file_path'], {'group': '"""Beam"""'}), "(self.file_path,... |
from __future__ import nested_scopes
# Levenberg Marquardt minimization routines
"""
fmin_lm : standard Levenberg Marquardt
fmin_lmNoJ : Levenberg Marquardt using a cost function instead of
a residual function and a gradient/J^tJ pair instead
of the derivative of the residual function. Usefu... | [
"scipy.isinf",
"scipy.sum",
"scipy.ones",
"copy.copy",
"scipy.arccos",
"scipy.linalg.svd",
"scipy.asarray",
"scipy.linalg.norm",
"scipy.isnan",
"scipy.zeros",
"scipy.transpose",
"scipy.dot",
"scipy.mat",
"scipy.finfo"
] | [((3469, 3486), 'scipy.isnan', 'scipy.isnan', (['cost'], {}), '(cost)\n', (3480, 3486), False, 'import scipy\n'), ((6131, 6144), 'copy.copy', 'copy.copy', (['x0'], {}), '(x0)\n', (6140, 6144), False, 'import copy\n'), ((6663, 6685), 'scipy.zeros', 'zeros', (['n', 'scipy.float_'], {}), '(n, scipy.float_)\n', (6668, 6685... |
import os
import time
import socket
import zipfile
from datetime import datetime, timedelta
from flask import Flask, request, g, render_template, jsonify, redirect, Response
from chaac.chaacdb import ChaacDB
app = Flask(__name__)
app.config.from_object(__name__) # load config from this file , flaskr.py
# Load defau... | [
"zipfile.ZipFile",
"flask.redirect",
"chaac.chaacdb.ChaacDB",
"flask.Flask",
"time.time",
"socket.gethostname",
"flask.jsonify",
"datetime.timedelta",
"flask.render_template",
"datetime.datetime.fromtimestamp",
"flask.g.sqlite_db.close",
"os.getenv"
] | [((215, 230), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'from flask import Flask, request, g, render_template, jsonify, redirect, Response\n'), ((478, 498), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (496, 498), False, 'import socket\n'), ((2529, 2542), 'flask.jso... |
import random
#
# RANDOM FUNCTION EXAMPLE
#
def random_example_function(data, param_min, param_max):
parameters = random.uniform(param_min, param_max)
transformed_data, _ = example_function(data, parameters)
transform = ["example_function", example_function, {"parameters": parameters}]
return transform... | [
"random.uniform"
] | [((119, 155), 'random.uniform', 'random.uniform', (['param_min', 'param_max'], {}), '(param_min, param_max)\n', (133, 155), False, 'import random\n')] |
# Copyright (c) 2015 by <NAME> and <NAME>
# See https://github.com/scisoft/autocmake/blob/master/LICENSE
import subprocess
import os
import sys
import shutil
def module_exists(module_name):
try:
__import__(module_name)
except ImportError:
return False
else:
return True
def che... | [
"subprocess.Popen",
"os.makedirs",
"os.path.isdir",
"os.getcwd",
"os.path.exists",
"shutil.rmtree",
"sys.stderr.write",
"os.path.join",
"os.chdir",
"sys.exit"
] | [((469, 581), 'subprocess.Popen', 'subprocess.Popen', (["('%s --version' % cmake_command)"], {'shell': '(True)', 'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE'}), "('%s --version' % cmake_command, shell=True, stdin=\n subprocess.PIPE, stdout=subprocess.PIPE)\n", (485, 581), False, 'import subprocess\n'), ((... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 31 14:42:37 2019
@author: owenmadin
"""
import numpy
from bayesiantesting.kernels.bayes import ThermodynamicIntegration
from bayesiantesting.models.continuous import GaussianModel
def main():
priors = {"uniform": ("uniform", numpy.array([-5... | [
"bayesiantesting.kernels.bayes.ThermodynamicIntegration",
"numpy.array",
"bayesiantesting.models.continuous.GaussianModel"
] | [((377, 420), 'bayesiantesting.models.continuous.GaussianModel', 'GaussianModel', (['"""gaussian"""', 'priors', '(0.0)', '(1.0)'], {}), "('gaussian', priors, 0.0, 1.0)\n", (390, 420), False, 'from bayesiantesting.models.continuous import GaussianModel\n'), ((575, 712), 'bayesiantesting.kernels.bayes.ThermodynamicIntegr... |
from PIL import Image
import numpy as np
img = Image.open('cifar.png')
pic = np.array(img)
noise = np.random.randint(-10,10,pic.shape[-1])
print(noise.shape)
pic = pic+noise
pic = pic.astype(np.uint8)
asd = Image.fromarray(pic) | [
"PIL.Image.fromarray",
"numpy.random.randint",
"numpy.array",
"PIL.Image.open"
] | [((47, 70), 'PIL.Image.open', 'Image.open', (['"""cifar.png"""'], {}), "('cifar.png')\n", (57, 70), False, 'from PIL import Image\n'), ((77, 90), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (85, 90), True, 'import numpy as np\n'), ((99, 140), 'numpy.random.randint', 'np.random.randint', (['(-10)', '(10)', 'pic... |
import torch
from torch.autograd import Variable
from scattering.scattering1d.utils import pad1D, modulus, subsample_fourier
from scattering.scattering1d.utils import compute_border_indices
import numpy as np
import pytest
def test_pad1D(random_state=42):
"""
Tests the correctness and differentiability of pad... | [
"numpy.abs",
"torch.sqrt",
"numpy.ones",
"torch.randn",
"scattering.scattering1d.utils.subsample_fourier",
"numpy.fft.fft",
"numpy.random.RandomState",
"pytest.raises",
"scattering.scattering1d.utils.modulus",
"numpy.max",
"torch.zeros",
"scattering.scattering1d.utils.pad1D",
"numpy.fft.ifft... | [((335, 366), 'torch.manual_seed', 'torch.manual_seed', (['random_state'], {}), '(random_state)\n', (352, 366), False, 'import torch\n'), ((2321, 2352), 'torch.manual_seed', 'torch.manual_seed', (['random_state'], {}), '(random_state)\n', (2338, 2352), False, 'import torch\n'), ((2463, 2473), 'scattering.scattering1d.u... |
# -*- coding: utf8 -*-
import os
from shlex import split as shlex_split
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
from subprocess import check_output, CalledProcessError
from typing import Dict, List, Optional, Tuple
import psycopg2
DEFAULT_DSN = 'postgresql://postgres@localhos... | [
"os.path.join",
"shlex.split",
"psycopg2.connect"
] | [((1081, 1106), 'psycopg2.connect', 'psycopg2.connect', ([], {'dsn': 'dsn'}), '(dsn=dsn)\n', (1097, 1106), False, 'import psycopg2\n'), ((5558, 5612), 'os.path.join', 'os.path.join', (['data_dir_host', 'logging_info.log_dir', '"""*"""'], {}), "(data_dir_host, logging_info.log_dir, '*')\n", (5570, 5612), False, 'import ... |
from rest_framework import viewsets, status
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.decorators import action
import json
from .serializers import SEOSerializer
from .utils import website_analysis
class SEOViewSet(viewsets.ViewSet):
""... | [
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((377, 453), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)', 'methods': "['post']", 'permission_classes': '[IsAuthenticated]'}), "(detail=False, methods=['post'], permission_classes=[IsAuthenticated])\n", (383, 453), False, 'from rest_framework.decorators import action\n'), ((963, 1022), 'rest... |
import logging, yaml, os, sys, json, urllib3, requests
from cerberus import Validator
from files import JSONFile
from common import Singleton
from common import ContextInfo
from urllib.parse import urlparse
from .data_type_config import DataTypeConfig
logger = logging.getLogger(__name__)
class DataFileManager(meta... | [
"common.ContextInfo",
"yaml.load",
"os.path.abspath",
"files.JSONFile",
"os.path.basename",
"urllib3.PoolManager",
"os.path.splitext",
"cerberus.Validator",
"sys.exit",
"urllib3.disable_warnings",
"logging.getLogger"
] | [((264, 291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (281, 291), False, 'import logging, yaml, os, sys, json, urllib3, requests\n'), ((413, 426), 'common.ContextInfo', 'ContextInfo', ([], {}), '()\n', (424, 426), False, 'from common import ContextInfo\n'), ((598, 644), 'yaml.load'... |
from pathlib import Path
import numpy as np
from .config import Config
from .spin import Spin
def load(path: Path) -> Config:
with path.open() as file:
lines = file.readlines()
global_optimum, best_solution = lines[0].split(' ')
global_optimum = float(global_optimum.strip())
b... | [
"numpy.array"
] | [((445, 468), 'numpy.array', 'np.array', (['best_solution'], {}), '(best_solution)\n', (453, 468), True, 'import numpy as np\n')] |
from typing import List, Optional, Sequence, Union
import os
from aiocache import cached, Cache
from aiocache.serializers import PickleSerializer
from asyncpg import Connection, Record
from pypika import Query
from app.db.errors import EntityDoesNotExist
from app.db.queries.queries import queries
from app.db.queries.... | [
"app.db.queries.queries.queries.add_tags_to_article",
"app.db.queries.tables.Parameter",
"app.db.repositories.tags.TagsRepository",
"app.db.queries.queries.queries.add_article_to_favorites",
"app.db.queries.queries.queries.remove_article_from_favorites",
"app.db.queries.queries.queries.get_article_by_slug... | [((1034, 1058), 'app.db.repositories.profiles.ProfilesRepository', 'ProfilesRepository', (['conn'], {}), '(conn)\n', (1052, 1058), False, 'from app.db.repositories.profiles import ProfilesRepository\n'), ((1085, 1105), 'app.db.repositories.tags.TagsRepository', 'TagsRepository', (['conn'], {}), '(conn)\n', (1099, 1105)... |
"""
Server for publication db
"""
import os
import logging
import binascii
from functools import wraps
from urllib.parse import urlparse
import base64
import csv
from io import StringIO
import itertools
from tornado.web import RequestHandler, HTTPError
from rest_tools.server import RestServer, from_environment, catch... | [
"io.StringIO",
"tornado.web.HTTPError",
"os.path.abspath",
"rest_tools.server.RestServer",
"logging.debug",
"binascii.hexlify",
"urllib.parse.urlparse",
"base64.b64decode",
"logging.info",
"functools.wraps",
"rest_tools.server.from_environment",
"logging.getLogger"
] | [((584, 611), 'logging.getLogger', 'logging.getLogger', (['"""server"""'], {}), "('server')\n", (601, 611), False, 'import logging\n'), ((642, 655), 'functools.wraps', 'wraps', (['method'], {}), '(method)\n', (647, 655), False, 'from functools import wraps\n'), ((11068, 11100), 'rest_tools.server.from_environment', 'fr... |
import lyse
import runmanager.remote as rm
import numpy as np
import mloop_config
import sys
import logging
import os
from labscript_utils.setup_logging import LOG_PATH
try:
from labscript_utils import check_version
except ImportError:
raise ImportError('Require labscript_utils > 2.1.0')
check_v... | [
"numpy.isnan",
"labscript_utils.check_version",
"logging.Formatter",
"lyse.data",
"mloop_config.get",
"os.path.join",
"logging.FileHandler",
"lyse.routine_storage.queue.put",
"Queue.Queue",
"runmanager.remote.get_globals",
"threading.Thread",
"lyse.routine_storage.optimisation.is_alive",
"lo... | [((313, 350), 'labscript_utils.check_version', 'check_version', (['"""lyse"""', '"""2.5.0"""', '"""4.0"""'], {}), "('lyse', '2.5.0', '4.0')\n", (326, 350), False, 'from labscript_utils import check_version\n'), ((352, 394), 'labscript_utils.check_version', 'check_version', (['"""zprocess"""', '"""2.13.1"""', '"""4.0"""... |
# Copyright (c) 2021, Hitachi America Ltd. 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 appli... | [
"pdf_struct.core.transition_labels.load_annos",
"copy.deepcopy",
"json.dump",
"pdf_struct.core.structure_evaluation.evaluate_labels",
"pdf_struct.loader.pdf.load_from_directory",
"click.command",
"click.Choice",
"pdf_struct.loader.text.load_from_directory",
"click.Path",
"pdf_struct.core.structure... | [((3302, 3317), 'click.command', 'click.command', ([], {}), '()\n', (3315, 3317), False, 'import click\n'), ((3191, 3214), 'copy.deepcopy', 'copy.deepcopy', (['document'], {}), '(document)\n', (3204, 3214), False, 'import copy\n'), ((3859, 3897), 'pdf_struct.core.transition_labels.load_annos', 'transition_labels.load_a... |
import argparse
import json
import logging
import os
import pprint
import re
import sys
import click._compat
import pkg_resources
from prettytable import PrettyTable
import beowulf as bwf
from beowulfbase.account import PrivateKey
from beowulfbase.storage import configStorage
from .account import Account
from .amount i... | [
"sys.stdout.write",
"argparse.ArgumentParser",
"pkg_resources.require",
"json.dumps",
"logging.Formatter",
"os.path.isfile",
"sys.stdout.flush",
"prettytable.PrettyTable",
"pprint.pprint",
"beowulf.Beowulf",
"json.loads",
"math.log10",
"beowulfbase.account.PasswordKey",
"sys.stdin.read",
... | [((729, 886), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.RawDescriptionHelpFormatter', 'description': '"""Command line tool to interact with the Beowulf network"""'}), "(formatter_class=argparse.\n RawDescriptionHelpFormatter, description=\n 'Command line tool to inte... |
from pythonrouge import pythonrouge
ROUGE = './RELEASE-1.5.5/ROUGE-1.5.5.pl'
data_path = './RELEASE-1.5.5/data'
peer = "Tokyo is the one of the biggest city in the world."
model = "The capital of Japan, Tokyo, is the center of Japanese economy."
score = pythonrouge.pythonrouge(peer, model, ROUGE, data_path)
print(sco... | [
"pythonrouge.pythonrouge.pythonrouge"
] | [((256, 310), 'pythonrouge.pythonrouge.pythonrouge', 'pythonrouge.pythonrouge', (['peer', 'model', 'ROUGE', 'data_path'], {}), '(peer, model, ROUGE, data_path)\n', (279, 310), False, 'from pythonrouge import pythonrouge\n'), ((450, 504), 'pythonrouge.pythonrouge.pythonrouge', 'pythonrouge.pythonrouge', (['peer', 'model... |
#!/usr/bin/env python3
#
# Copyright 2013-2014 University of Southern California
#
# 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
#
# Unles... | [
"webauthn2.merge_config",
"webauthn2.Manager"
] | [((759, 922), 'webauthn2.merge_config', 'webauthn2.merge_config', ([], {'jsonFileName': '"""ermrest_config.json"""', 'built_ins': "{'default_limit': 100, 'db': 'microscopy', 'dbn': 'postgres',\n 'dbmaxconnections': 8}"}), "(jsonFileName='ermrest_config.json', built_ins={\n 'default_limit': 100, 'db': 'microscopy'... |
import os
from mock import MagicMock
from bxcommon.services.extension_transaction_service import ExtensionTransactionService
from bxcommon.services.transaction_service import TransactionService
from bxcommon.test_utils import helpers
from bxcommon.utils import convert
from bxcommon.utils.object_hash import Sha256Hash,... | [
"os.path.abspath",
"bxcommon.services.extension_transaction_service.ExtensionTransactionService",
"bxcommon.utils.convert.hex_to_bytes",
"bxgateway.messages.eth.protocol.new_block_eth_protocol_message.NewBlockEthProtocolMessage",
"bxgateway.services.eth.eth_extension_block_cleanup_service.EthExtensionBlockC... | [((977, 988), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', (986, 988), False, 'from mock import MagicMock\n'), ((1031, 1075), 'bxgateway.services.eth.eth_block_queuing_service.EthBlockQueuingService', 'EthBlockQueuingService', (['self.node', 'node_conn'], {}), '(self.node, node_conn)\n', (1053, 1075), False, 'from ... |
# Copyright 2021 Netflix, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
"logging.getLogger"
] | [((791, 819), 'logging.getLogger', 'logging.getLogger', (['"""repokid"""'], {}), "('repokid')\n", (808, 819), False, 'import logging\n')] |
from if97 import region1, region2, region3, region4
###########################################################
##### Pressure-Temperature Formulation #####
###########################################################
def idRegion(P, T):
"""Identification of region from IF97 specification
using p... | [
"if97.region4.a_s",
"if97.region4.kfg",
"if97.region1.dsdh_h",
"if97.region4.cvfg",
"if97.region1.dvdP",
"if97.region2.dhdT",
"if97.region2.w",
"if97.region2.dsdT",
"if97.region4.cv_h",
"if97.region1.g_h",
"if97.region4.cpf",
"if97.region1.v",
"if97.region2.s",
"if97.region2.k_h",
"if97.... | [((7618, 7642), 'if97.region1.h', 'region1.h', (['Pbnd4', 'Tbnd01'], {}), '(Pbnd4, Tbnd01)\n', (7627, 7642), False, 'from if97 import region1, region2, region3, region4\n'), ((7656, 7680), 'if97.region2.h', 'region2.h', (['Pbnd0', 'Tbnd25'], {}), '(Pbnd0, Tbnd25)\n', (7665, 7680), False, 'from if97 import region1, regi... |
import hashlib
import os
from django.contrib.auth import models as auth_models
from django.contrib.auth.backends import ModelBackend
# http://fredericiana.com/2010/10/12/adding-support-for-stronger-password-hashes-to-django/
"""
from future import django_sha256_support
Monkey-patch SHA-256 support into Django's aut... | [
"os.urandom"
] | [((855, 868), 'os.urandom', 'os.urandom', (['(5)'], {}), '(5)\n', (865, 868), False, 'import os\n')] |
from django.contrib import admin
from wallet.models import Wallet, Transaction
admin.site.register([
Wallet,
Transaction,
])
| [
"django.contrib.admin.site.register"
] | [((82, 124), 'django.contrib.admin.site.register', 'admin.site.register', (['[Wallet, Transaction]'], {}), '([Wallet, Transaction])\n', (101, 124), False, 'from django.contrib import admin\n')] |
"""
call monitoring API
"""
from typing import Optional, Union
from pydantic import Field
from .common import PersonSettingsApiChild
from ..base import ApiModel, webex_id_to_uuid
from ..common import MonitoredMember, CallParkExtension
__all__ = ['MonitoredElementMember', 'MonitoredElement', 'Monitoring',
... | [
"pydantic.Field"
] | [((480, 503), 'pydantic.Field', 'Field', ([], {'alias': '"""location"""'}), "(alias='location')\n", (485, 503), False, 'from pydantic import Field\n'), ((966, 998), 'pydantic.Field', 'Field', ([], {'alias': '"""callparkextension"""'}), "(alias='callparkextension')\n", (971, 998), False, 'from pydantic import Field\n')] |
from django.urls import path
from scrapyinfo import views
urlpatterns = [
path('refresh_platform_information', views.RefreshPlatformView.as_view()),
path('scrapyds', views.ScrapydList.as_view()),
path('scrapyd/<pk>', views.ScrapydDetial.as_view()),
path('projects', views.ProjectList.as_view()),
p... | [
"scrapyinfo.views.GroupList.as_view",
"scrapyinfo.views.ScrapydDetial.as_view",
"scrapyinfo.views.GroupDetial.as_view",
"scrapyinfo.views.SpiderList.as_view",
"scrapyinfo.views.RefreshPlatformView.as_view",
"scrapyinfo.views.ProjectDetial.as_view",
"scrapyinfo.views.SpiderDetial.as_view",
"scrapyinfo.... | [((118, 153), 'scrapyinfo.views.RefreshPlatformView.as_view', 'views.RefreshPlatformView.as_view', ([], {}), '()\n', (151, 153), False, 'from scrapyinfo import views\n'), ((177, 204), 'scrapyinfo.views.ScrapydList.as_view', 'views.ScrapydList.as_view', ([], {}), '()\n', (202, 204), False, 'from scrapyinfo import views\... |
from .util import Audio
from abc import ABC, abstractmethod
import numpy as np
from scipy import fft, signal
from IPython.display import display
from bokeh.plotting import figure, show
from bokeh.layouts import gridplot
from bokeh.models.mappers import LinearColorMapper
from bokeh.models.ranges import DataRange1d
from ... | [
"bokeh.io.output_notebook",
"bokeh.plotting.figure",
"numpy.abs",
"numpy.asarray",
"scipy.fft.rfft",
"numpy.ndim",
"bokeh.models.tools.HoverTool",
"bokeh.models.mappers.LinearColorMapper",
"numpy.log10",
"scipy.signal.stft"
] | [((431, 448), 'bokeh.io.output_notebook', 'output_notebook', ([], {}), '()\n', (446, 448), False, 'from bokeh.io import output_notebook\n'), ((2962, 3132), 'bokeh.plotting.figure', 'figure', ([], {'width': '(800)', 'height': '(400)', 'x_axis_label': '"""time [s]"""', 'y_axis_label': '"""amplitude"""', 'tools': '"""pan,... |
from starlette.authentication import (
AuthCredentials,
AuthenticationBackend,
UnauthenticatedUser,
)
from .aad_authentication_client import AadAuthenticationClient
class AadSessionMiddleware(AuthenticationBackend):
async def authenticate(self, request):
"""Authenticate a request.
If ... | [
"starlette.authentication.AuthCredentials",
"starlette.authentication.UnauthenticatedUser"
] | [((979, 1007), 'starlette.authentication.AuthCredentials', 'AuthCredentials', (['user.scopes'], {}), '(user.scopes)\n', (994, 1007), False, 'from starlette.authentication import AuthCredentials, AuthenticationBackend, UnauthenticatedUser\n'), ((497, 518), 'starlette.authentication.AuthCredentials', 'AuthCredentials', (... |
#
# DeepRacer Guru
#
# Version 3.0 onwards
#
# Copyright (c) 2021 dmh23
#
import tkinter as tk
from src.analyze.track.track_analyzer import TrackAnalyzer
from src.episode.episode import LAP_COMPLETE, OFF_TRACK, CRASHED, REVERSED, LOST_CONTROL
from src.graphics.track_graphics import TrackGraphics
from src.analyze.cor... | [
"src.analyze.core.controls.OutcomesCheckButtonControl",
"src.analyze.core.controls.EpisodeRadioButtonControl"
] | [((646, 712), 'src.analyze.core.controls.EpisodeRadioButtonControl', 'EpisodeRadioButtonControl', (['guru_parent_redraw', 'control_frame', '(True)'], {}), '(guru_parent_redraw, control_frame, True)\n', (671, 712), False, 'from src.analyze.core.controls import EpisodeRadioButtonControl, OutcomesCheckButtonControl\n'), (... |
import pandas as pd
import numpy as np
from urllib.parse import urlparse
import io
import gc
import re
import string
from utils import *
import tensorflow as tf
def load_vectors(fname,count_words):
fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore')
n, d = map(int, fin.readline()... | [
"tensorflow.keras.preprocessing.text.Tokenizer",
"numpy.zeros",
"numpy.mean",
"numpy.array",
"numpy.random.multivariate_normal",
"numpy.reshape",
"io.open",
"numpy.cov",
"pandas.concat"
] | [((213, 281), 'io.open', 'io.open', (['fname', '"""r"""'], {'encoding': '"""utf-8"""', 'newline': '"""\n"""', 'errors': '"""ignore"""'}), "(fname, 'r', encoding='utf-8', newline='\\n', errors='ignore')\n", (220, 281), False, 'import io\n'), ((1759, 1831), 'pandas.concat', 'pd.concat', (['[entity1, mention_dt, url_dt1, ... |
""" Generate the wavelength templates for Keck/DEIMOS"""
import os
from pypeit.core.wavecal import templates
# Keck/DEIMOS
def keck_deimos_600ZD():
binspec = 1
slits = [0, 1]
lcut = [7192.]
xidl_file = os.path.join(templates.template_path, 'Keck_DEIMOS', '600ZD', 'deimos_600.sav')
outroot = 'kec... | [
"pypeit.core.wavecal.templates.build_template",
"os.path.join"
] | [((222, 301), 'os.path.join', 'os.path.join', (['templates.template_path', '"""Keck_DEIMOS"""', '"""600ZD"""', '"""deimos_600.sav"""'], {}), "(templates.template_path, 'Keck_DEIMOS', '600ZD', 'deimos_600.sav')\n", (234, 301), False, 'import os\n'), ((343, 429), 'pypeit.core.wavecal.templates.build_template', 'templates... |
from setuptools import find_packages
from setuptools import setup
def readme():
with open('README.rst') as f:
return f.read()
setup(name='lcmap-merlin',
version='2.3.1',
description='Python client library for LCMAP rasters',
long_description=readme(),
classifiers=[
'Devel... | [
"setuptools.find_packages"
] | [((640, 655), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (653, 655), False, 'from setuptools import find_packages\n')] |
from datetime import datetime
from unittest import TestCase
from flask import Flask
from flask_sqlalchemy import SQLAlchemy, Model
from sqlalchemy import Integer, String, Column, func
from flask_resource_chassis import ChassisService, ValidationError
class Test(Model):
id = Column(Integer, primary_key=True)
... | [
"flask_resource_chassis.ChassisService",
"sqlalchemy.func.now",
"flask.Flask",
"flask_sqlalchemy.SQLAlchemy",
"sqlalchemy.Column",
"sqlalchemy.String"
] | [((283, 316), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (289, 316), False, 'from sqlalchemy import Integer, String, Column, func\n'), ((335, 344), 'sqlalchemy.String', 'String', (['(5)'], {}), '(5)\n', (341, 344), False, 'from sqlalchemy import Integer, St... |
from typing import Dict, List, Iterator
import json
import logging
from overrides import overrides
import tqdm
import os
import sys
import codecs
import numpy as np
from allennlp.common import Params
from allennlp.common.file_utils import cached_path
from allennlp.data.dataset_readers.dataset_reader import DatasetRe... | [
"allennlp.data.tokenizers.Token",
"codecs.open",
"allennlp.data.instance.Instance",
"allennlp.data.fields.LabelField",
"allennlp.data.dataset_readers.dataset_reader.DatasetReader.register",
"allennlp.data.tokenizers.WordTokenizer",
"allennlp.data.token_indexers.SingleIdTokenIndexer",
"logging.getLogge... | [((592, 619), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (609, 619), False, 'import logging\n'), ((623, 661), 'allennlp.data.dataset_readers.dataset_reader.DatasetReader.register', 'DatasetReader.register', (['"""word_vectors"""'], {}), "('word_vectors')\n", (645, 661), False, 'from a... |
import docker
import logging
from nodemgr.common.docker_mem_cpu import DockerMemCpuUsageData
class DockerContainersInterface:
def __init__(self):
self._client = docker.from_env()
if hasattr(self._client, 'api'):
self._client = self._client.api
def list(self, all_=True):
re... | [
"docker.from_env",
"logging.exception",
"nodemgr.common.docker_mem_cpu.DockerMemCpuUsageData"
] | [((175, 192), 'docker.from_env', 'docker.from_env', ([], {}), '()\n', (190, 192), False, 'import docker\n'), ((1792, 1841), 'nodemgr.common.docker_mem_cpu.DockerMemCpuUsageData', 'DockerMemCpuUsageData', (['id_', 'last_cpu_', 'last_time_'], {}), '(id_, last_cpu_, last_time_)\n', (1813, 1841), False, 'from nodemgr.commo... |
#!/usr/bin/env python3
import os, time, json
import numpy as np
import pandas as pd
from pprint import pprint
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from matplotlib.colors import LogNorm
import scipy.signal as signal
import argparse
import pdb
import tinydb as db
f... | [
"argparse.ArgumentParser",
"numpy.amin",
"matplotlib.pyplot.clf",
"numpy.histogram",
"matplotlib.colors.LogNorm",
"numpy.arange",
"numpy.exp",
"numpy.mean",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.hlines",
"pandas.DataFrame",
"matplotlib.pyplot.locator_p... | [((532, 555), 'pygama.utils.set_plot_style', 'set_plot_style', (['"""clint"""'], {}), "('clint')\n", (546, 555), False, 'from pygama.utils import set_plot_style\n'), ((669, 732), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""waveform viewer for mj60"""'}), "(description='waveform viewer... |
# -*- coding: utf-8 -*-
"""
USAGE: DU_Table_Annotator.py input-folder
You must run this on your GT collection to create a training collection.
If you pass a folder, you get a new folder with name postfixed by a_
Does 2 things:
- 1 -
Annotate textlines for Table understan... | [
"os.mkdir",
"os.path.abspath",
"os.path.isdir",
"common.trace.traceln",
"os.path.join"
] | [((1771, 1815), 'common.trace.traceln', 'traceln', (['""" - Output will be in """', 'sOutputDir'], {}), "(' - Output will be in ', sOutputDir)\n", (1778, 1815), False, 'from common.trace import traceln\n'), ((2474, 2493), 'common.trace.traceln', 'traceln', (['lsFilename'], {}), '(lsFilename)\n', (2481, 2493), False, 'f... |
# -*- coding: utf-8 -*-
import json
import logging
import time
from multiprocessing import Process
from uuid import uuid4
import schedule
from jsonschema import validate
from scheduler import Scheduler as CronSchedulerServer
from spaceone.core import queue
from spaceone.core.error import ERROR_CONFIGURATION
from spac... | [
"schedule.run_pending",
"scheduler.Scheduler",
"jsonschema.validate",
"uuid.uuid4",
"spaceone.core.queue.put",
"spaceone.core.error.ERROR_CONFIGURATION",
"json.dumps",
"time.sleep",
"schedule.every",
"logging.getLogger"
] | [((391, 418), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (408, 418), False, 'import logging\n'), ((3327, 3350), 'scheduler.Scheduler', 'CronSchedulerServer', (['(10)'], {}), '(10)\n', (3346, 3350), True, 'from scheduler import Scheduler as CronSchedulerServer\n'), ((1856, 1878), 'sche... |
import base64 as b64
import struct
import encodings
from .wireformat import *
from . import constants
MAX_PACKET_SIZE = 4000
_rcode_strings = [ 'No error',
'Format error',
'Server failure',
'Non-existent domain',
'Not implemented',
... | [
"encodings.idna.ToASCII",
"base64.b64encode",
"struct.pack",
"encodings.idna.ToUnicode"
] | [((4458, 4505), 'struct.pack', 'struct.pack', (["b'>HHHHHH'", 'uid', 'flags', '(1)', '(0)', '(0)', '(1)'], {}), "(b'>HHHHHH', uid, flags, 1, 0, 0, 1)\n", (4469, 4505), False, 'import struct\n'), ((4872, 4918), 'struct.pack', 'struct.pack', (["b'>BHH'", '(0)', 'query.q_type', 'q_class'], {}), "(b'>BHH', 0, query.q_type,... |
# Generated by Django 3.0.4 on 2020-03-09 20:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hobbies', '0003_userhobbies'),
]
operations = [
migrations.AlterField(
model_name='hobbies',
name='img_url',
... | [
"django.db.models.URLField"
] | [((331, 447), 'django.db.models.URLField', 'models.URLField', ([], {'default': '"""https://www.okea.org/wp-content/uploads/2019/10/placeholder.png"""', 'max_length': '(1000)'}), "(default=\n 'https://www.okea.org/wp-content/uploads/2019/10/placeholder.png',\n max_length=1000)\n", (346, 447), False, 'from django.d... |
"""Cascading configuration from the CLI and config files."""
__version__ = "0.2.0"
import json
import os
from abc import ABC, abstractmethod
from argparse import ArgumentParser, Namespace
from typing import Dict
import jsonschema
class CascadeConfig:
"""Cascading configuration."""
def __init__(self, valid... | [
"json.load"
] | [((6441, 6461), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (6450, 6461), False, 'import json\n'), ((8087, 8107), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (8096, 8107), False, 'import json\n')] |
from invoke import task
from invoke.exceptions import Exit
from pathlib import Path
from typing import Optional
import os
import shutil
import sys
BUILD_DIR_DEFAULT = Path(os.environ['BUILD_DIR'].replace(":", ""))
def _get_vcvars_paths():
template = r"%PROGRAMFILES(X86)%\Microsoft Visual Studio\2017\{edition}\VC... | [
"sys.platform.startswith",
"invoke.exceptions.Exit",
"os.path.expandvars",
"pathlib.Path",
"os.path.relpath",
"shutil.rmtree",
"os.chdir"
] | [((2818, 2848), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (2841, 2848), False, 'import sys\n'), ((367, 395), 'os.path.expandvars', 'os.path.expandvars', (['template'], {}), '(template)\n', (385, 395), False, 'import os\n'), ((2317, 2347), 'sys.platform.startswith', 'sys.pla... |
import sys
import os
import shutil
import json
from glob import glob
#sys.path.insert(0, os.path.abspath('..'))
#sys.path.insert(0, os.path.abspath('.'))
#print(sys.path)
import mimir.backend.database
from mimir.backend.database import DataBase, Model
from mimir.backend.entry import Item, ListItem
import unittest
impor... | [
"unittest.main",
"copy.deepcopy",
"json.load",
"os.makedirs",
"shutil.rmtree",
"os.getcwd",
"pytest.fixture",
"os.system",
"os.path.exists",
"datetime.date.today",
"pytest.raises",
"mimir.backend.database.Model",
"glob.glob",
"pytest.mark.parametrize",
"mimir.backend.database.DataBase",
... | [((1269, 1299), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1283, 1299), False, 'import pytest\n'), ((15709, 15855), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""Query, IDsExp"""', "[('!Lavender', ['0', '1', '2', '5']), ('!Xi', ['1', '2', '3', '4', '5']), (... |
import numpy as np
import torch
import torchvision.transforms as transforms
import torch.utils.data as data
import os
import pickle
import numpy as np
import nltk
from PIL import Image
import cv2
import glob
import random
# depracated
# def get_data_direct(img_size, texture_size,
# imgs_fn = None, ... | [
"numpy.uint8",
"cv2.waitKey",
"cv2.imwrite",
"random.sample",
"random.shuffle",
"numpy.zeros",
"numpy.transpose",
"numpy.argmin",
"PIL.Image.open",
"random.choice",
"numpy.asarray",
"numpy.random.randint",
"numpy.array",
"numpy.arange",
"numpy.random.choice",
"cv2.imshow",
"os.path.j... | [((3733, 3770), 'numpy.transpose', 'np.transpose', (['imgs_data', '[0, 3, 1, 2]'], {}), '(imgs_data, [0, 3, 1, 2])\n', (3745, 3770), True, 'import numpy as np\n'), ((9622, 9654), 'cv2.imwrite', 'cv2.imwrite', (['"""test_img.png"""', 'img'], {}), "('test_img.png', img)\n", (9633, 9654), False, 'import cv2\n'), ((10027, ... |
# -*- coding: utf-8 -*-
import base64
import os
def loader(file, decoder, split=True):
file_dir = os.path.dirname(os.path.abspath(os.path.realpath(__file__)))
cdata_path = os.path.join(os.path.split(file_dir)[0], "static", file)
if decoder == "hexstring":
decoder = bytes.fromhex
elif decoder ... | [
"os.path.realpath",
"os.path.split"
] | [((136, 162), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (152, 162), False, 'import os\n'), ((195, 218), 'os.path.split', 'os.path.split', (['file_dir'], {}), '(file_dir)\n', (208, 218), False, 'import os\n')] |
from django.test import TestCase
from dbcron.calendar import JobCalendar
from dbcron import models
from dbcron.tests.factories import JobFactory
class JobCalendarFormatMonthTest(TestCase):
factory = JobFactory
jobs = models.Job.objects.all()
def test_meth(self):
self.factory.create_batch(5, min=0... | [
"dbcron.calendar.JobCalendar",
"dbcron.models.Job.objects.all"
] | [((227, 251), 'dbcron.models.Job.objects.all', 'models.Job.objects.all', ([], {}), '()\n', (249, 251), False, 'from dbcron import models\n'), ((587, 611), 'dbcron.models.Job.objects.all', 'models.Job.objects.all', ([], {}), '()\n', (609, 611), False, 'from dbcron import models\n'), ((348, 370), 'dbcron.calendar.JobCale... |
#!/usr/bin/python3
# _*_ coding: utf-8 _*_
# @Time : 2022/1/31 19:21
import re
import os
import pandas as pd
from mirsnp.parse_rnahybrid import parse_rnahybrid, get_position, get_mirna_name, get_trans_name
from mirsnp.utils import check_outputf, DEFAULT_ENERGY, INTERVAL
def get_pt_map(pt):
pt_map = {}
w... | [
"mirsnp.utils.check_outputf",
"mirsnp.parse_rnahybrid.get_trans_name",
"pandas.read_csv",
"mirsnp.parse_rnahybrid.get_position",
"pandas.merge",
"mirsnp.parse_rnahybrid.parse_rnahybrid",
"os.path.join",
"mirsnp.parse_rnahybrid.get_mirna_name"
] | [((847, 883), 'pandas.read_csv', 'pd.read_csv', (['variants_file'], {'sep': '"""\t"""'}), "(variants_file, sep='\\t')\n", (858, 883), True, 'import pandas as pd\n'), ((2581, 2612), 'mirsnp.parse_rnahybrid.parse_rnahybrid', 'parse_rnahybrid', (['pt', 'trans_info'], {}), '(pt, trans_info)\n', (2596, 2612), False, 'from m... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
#
# Copyright 2015-2019 European Commission (JRC);
# Licensed under the EUPL (the 'Licence');
# You may not use this work except in compliance with the Licence.
# You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
import doctest
import io
import re
imp... | [
"wltp.cli.main",
"io.StringIO",
"docutils.core.publish_string",
"os.path.dirname",
"unittest.mock.patch",
"os.path.join",
"doctest.testmod"
] | [((450, 471), 'os.path.dirname', 'osp.dirname', (['__file__'], {}), '(__file__)\n', (461, 471), True, 'import os.path as osp\n'), ((484, 505), 'os.path.join', 'osp.join', (['mydir', '""".."""'], {}), "(mydir, '..')\n", (492, 505), True, 'import os.path as osp\n'), ((520, 553), 'os.path.join', 'osp.join', (['proj_path',... |
# -*- coding: utf-8 -*-
"""Connecting different investment variables.
This file is part of project oemof (github.com/oemof/oemof). It's copyrighted
by the contributors recorded in the version control history of the file,
available from its original location
oemof/tests/test_scripts/test_solph/test_connect_invest/test... | [
"oemof.solph.EnergySystem",
"oemof.solph.Bus",
"pandas.date_range",
"oemof.outputlib.views.node",
"oemof.solph.Investment",
"pandas.read_csv",
"os.path.dirname",
"oemof.solph.Flow",
"logging.info",
"oemof.outputlib.processing.results",
"oemof.solph.constraints.equate_variables",
"oemof.solph.M... | [((603, 654), 'pandas.date_range', 'pd.date_range', (['"""1/1/2012"""'], {'periods': '(24 * 7)', 'freq': '"""H"""'}), "('1/1/2012', periods=24 * 7, freq='H')\n", (616, 654), True, 'import pandas as pd\n'), ((675, 720), 'oemof.solph.EnergySystem', 'solph.EnergySystem', ([], {'timeindex': 'date_time_index'}), '(timeindex... |
# this method sucks, takes over 30 hours to run on machine!!!
from functools import reduce
from fast_prime import primes, is_prime
import time
start = time.time()
p = primes(1000000)
#p = primes(100000)
long_num = 0
long_sum = 0
print('prime time = ', time.time() - start)
start = time.time()
for x in p[::-1]:
... | [
"functools.reduce",
"fast_prime.primes",
"time.time"
] | [((155, 166), 'time.time', 'time.time', ([], {}), '()\n', (164, 166), False, 'import time\n'), ((172, 187), 'fast_prime.primes', 'primes', (['(1000000)'], {}), '(1000000)\n', (178, 187), False, 'from fast_prime import primes, is_prime\n'), ((288, 299), 'time.time', 'time.time', ([], {}), '()\n', (297, 299), False, 'imp... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='django-async-messages-redux',
version='0.4.1',
url='https://github.com/maurizi/django-async-messages',
author='<NAME>',
author_email='<EMAIL>',
description="Send asynchronous messages to users (eg from offline s... | [
"setuptools.find_packages"
] | [((432, 464), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (445, 464), False, 'from setuptools import setup, find_packages\n')] |
"""empty message
Revision ID: 13934f10a019
Revises:
Create Date: 2019-10-04 16:58:16.891916
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '13934f10a019'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Numeric",
"sqlalchemy.Boolean",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((6854, 6882), 'alembic.op.drop_table', 'op.drop_table', (['"""roles_users"""'], {}), "('roles_users')\n", (6867, 6882), False, 'from alembic import op\n'), ((6887, 6912), 'alembic.op.drop_table', 'op.drop_table', (['"""property"""'], {}), "('property')\n", (6900, 6912), False, 'from alembic import op\n'), ((6917, 693... |
from gudhi.wasserstein import wasserstein_distance
import numpy as np
""" This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
Author(s): <NAME>
Copyright (C) 2019 Inria
... | [
"numpy.array",
"gudhi.wasserstein.wasserstein_distance",
"numpy.sqrt"
] | [((531, 582), 'numpy.array', 'np.array', (['[[2.7, 3.7], [9.6, 14.0], [34.2, 34.974]]'], {}), '([[2.7, 3.7], [9.6, 14.0], [34.2, 34.974]])\n', (539, 582), True, 'import numpy as np\n'), ((595, 631), 'numpy.array', 'np.array', (['[[2.8, 4.45], [9.5, 14.1]]'], {}), '([[2.8, 4.45], [9.5, 14.1]])\n', (603, 631), True, 'imp... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('app.views',
(r'^$', 'home'),
(r'^account/(?P<account_id>.+)$', 'account'),
)
| [
"django.conf.urls.patterns"
] | [((67, 153), 'django.conf.urls.patterns', 'patterns', (['"""app.views"""', "('^$', 'home')", "('^account/(?P<account_id>.+)$', 'account')"], {}), "('app.views', ('^$', 'home'), ('^account/(?P<account_id>.+)$',\n 'account'))\n", (75, 153), False, 'from django.conf.urls import patterns, include, url\n')] |
import logging
from logging.config import fileConfig
from util import DatabaseUtil as dbu
class StockTechIndicator(object):
def __init__(self):
self.logger = logging.getLogger(__name__)
pass
def save_tech_data(self, stock_code, date, dict):
update_tech_sql = "update pdtb_stock_tech_dat... | [
"util.DatabaseUtil.update",
"logging.getLogger"
] | [((171, 198), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (188, 198), False, 'import logging\n'), ((591, 618), 'util.DatabaseUtil.update', 'dbu.update', (['update_tech_sql'], {}), '(update_tech_sql)\n', (601, 618), True, 'from util import DatabaseUtil as dbu\n')] |
import os
import click
from subprocess import call
import yaml
from datetime import datetime
import logging
logging.basicConfig(level="INFO")
tool = "./bin/config-slicer/config-slicer-3.1.14.7.jar"
# Fetches a manifest file from the staging server
@click.group()
def cli():
pass
def read_config():
with open... | [
"os.remove",
"click.argument",
"logging.basicConfig",
"click.option",
"datetime.datetime.now",
"subprocess.call",
"click.group",
"os.path.expanduser"
] | [((109, 142), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': '"""INFO"""'}), "(level='INFO')\n", (128, 142), False, 'import logging\n'), ((253, 266), 'click.group', 'click.group', ([], {}), '()\n', (264, 266), False, 'import click\n'), ((460, 489), 'click.argument', 'click.argument', (['"""environment"""'... |
from yt_dlp import YoutubeDL
from dataclasses import dataclass
from spotidl.spotify import SpotifySong
from spotidl.utils import make_song_title, check_file
@dataclass
class YoutubeSong:
id: str
title: str
video_url: str
def get_config(user_params: dict, song: SpotifySong) -> dict:
"""
Prepare... | [
"spotidl.utils.make_song_title",
"spotidl.utils.check_file",
"yt_dlp.YoutubeDL"
] | [((1050, 1074), 'yt_dlp.YoutubeDL', 'YoutubeDL', ([], {'params': 'params'}), '(params=params)\n', (1059, 1074), False, 'from yt_dlp import YoutubeDL\n'), ((2651, 2672), 'spotidl.utils.check_file', 'check_file', (['file_name'], {}), '(file_name)\n', (2661, 2672), False, 'from spotidl.utils import make_song_title, check_... |
# !/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time : 2020/6/22 上午10:07
# @Author: <EMAIL>
# @Notes : 身份证实体抽取,身份证补全,身份证检测等功能
import json
import os
import re
from datetime import datetime
class NumberNotShortError(Exception):
...
class IDCardNotStingError(Exception):
...
class IDCardFormatError(Exceptio... | [
"json.load",
"re.finditer",
"os.path.dirname",
"re.match",
"datetime.datetime.now"
] | [((5451, 5490), 're.finditer', 're.finditer', (['"""[0-9*]{17}[0-9*xX]"""', 'card'], {}), "('[0-9*]{17}[0-9*xX]', card)\n", (5462, 5490), False, 'import re\n'), ((826, 839), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (835, 839), False, 'import json\n'), ((1395, 1426), 're.match', 're.match', (['"""[0-9X]"""', 'i... |
import numpy as np
import itertools
from graph_nets import utils_tf
from root_gnn.src.datasets.base import DataSet
n_node_features = 6
max_nodes = 3 # including the particle that decays
def num_particles(event):
return len(event) // n_node_features
def make_graph(event, debug=False):
# each particle contains... | [
"numpy.zeros",
"numpy.array",
"graph_nets.utils_tf.data_dicts_to_graphs_tuple"
] | [((1265, 1300), 'numpy.array', 'np.array', (['[x[0] for x in all_edges]'], {}), '([x[0] for x in all_edges])\n', (1273, 1300), True, 'import numpy as np\n'), ((1317, 1352), 'numpy.array', 'np.array', (['[x[1] for x in all_edges]'], {}), '([x[1] for x in all_edges])\n', (1325, 1352), True, 'import numpy as np\n'), ((207... |
from __future__ import absolute_import
from __future__ import division
import torch
import copy
from torch import nn
from torch.nn import functional as F
from torchvision.models.resnet import resnet50, Bottleneck
from .hacnn import SoftBlock, SoftHardBlock
import torchvision
class ResNet50(nn.Module):
def __init... | [
"torch.nn.Dropout",
"copy.deepcopy",
"torchvision.models.resnet.Bottleneck",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.cat",
"torchvision.models.resnet.resnet50.children",
"torchvision.models.resnet50",
"torch.nn.BatchNorm2d",
"torchvision.models.resnet.resnet50",
"torc... | [((466, 510), 'torchvision.models.resnet50', 'torchvision.models.resnet50', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (493, 510), False, 'import torchvision\n'), ((604, 632), 'torch.nn.Linear', 'nn.Linear', (['(2048)', 'num_classes'], {}), '(2048, num_classes)\n', (613, 632), False, 'from torch import nn\n... |
import os
import uuid
from django.db import models
from accounts.models import Student
from accounts.models import Teacher
import cloudinary
class CourseORM(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
name = models.CharField(max_length=150)
slug = models.Sl... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"uuid.uuid4",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.SlugField",
"django.db.models.SmallIntegerField",
"cloudinary.models... | [((185, 255), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (201, 255), False, 'from django.db import models\n'), ((267, 299), 'django.db.models.CharField', 'models.CharField'... |
'''
Code modified by the authors of the paper: "Low-rank Subspaces for Unsupervised Entity Linking" to enable working with "Wikidata" instead of "Freebase"
'''
import argparse
sup_train=False
MAX_POS = 10
MAX_N_POSS_TEST = 100
MAX_N_POSS_TRAIN = 100
N_NEGS = 10
SAMPLE_NEGS = True
TYPE_OPT = 'mean'
parser = argparse.... | [
"argparse.ArgumentParser"
] | [((311, 336), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (334, 336), False, 'import argparse\n')] |
# Load the necessary libraries
import matplotlib.pyplot as plt
import numpy
import pandas
import sklearn.cluster as cluster
import sklearn.metrics as metrics
bikeshare = pandas.read_csv('C:\\Users\\minlam\\Documents\\IIT\\Machine Learning\\Data\\BikeSharingDemand_Train.csv',
delimit... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"sklearn.cluster.KMeans",
"numpy.zeros",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.tree.export_graphviz",
"sklearn.metrics.silhouette_score",
"graphviz.Source",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
... | [((178, 308), 'pandas.read_csv', 'pandas.read_csv', (['"""C:\\\\Users\\\\minlam\\\\Documents\\\\IIT\\\\Machine Learning\\\\Data\\\\BikeSharingDemand_Train.csv"""'], {'delimiter': '""","""'}), "(\n 'C:\\\\Users\\\\minlam\\\\Documents\\\\IIT\\\\Machine Learning\\\\Data\\\\BikeSharingDemand_Train.csv'\n , delimiter=... |
from tfc import utfc
from tfc.utils import TFCDictRobust, egrad, NllsClass, MakePlot
import numpy as onp
import jax.numpy as np
from jax import vmap, jacfwd, jit, lax
import tqdm
import pickle
from scipy.optimize import fsolve
from scipy.integrate import simps
from time import process_time as timer
## TEST PARAMETE... | [
"jax.numpy.array",
"jax.numpy.dot",
"tfc.utils.egrad",
"tfc.utils.TFCDictRobust",
"time.process_time",
"scipy.optimize.fsolve",
"jax.numpy.finfo",
"jax.numpy.sqrt",
"numpy.ones",
"tfc.utils.NllsClass",
"jax.numpy.linalg.norm",
"jax.numpy.hstack",
"jax.numpy.zeros",
"jax.numpy.abs",
"tfc.... | [((754, 797), 'tfc.utfc', 'utfc', (['N', 'nCx', 'ms'], {'basis': '"""CP"""', 'x0': '(-1)', 'xf': '(1.0)'}), "(N, nCx, ms, basis='CP', x0=-1, xf=1.0)\n", (758, 797), False, 'from tfc import utfc\n'), ((804, 847), 'tfc.utfc', 'utfc', (['N', 'nCy', 'mc'], {'basis': '"""CP"""', 'x0': '(-1)', 'xf': '(1.0)'}), "(N, nCy, mc, ... |
"""
Data
================
data storage and manipulation classes, should be sufficient to run the game without display
"""
from enum import Enum
import numpy
class Facing(Enum):
YP = 0
XP = 1
ZN = 2
YN = 3
XN = 4
ZP = 5
# gives a directional delta array in hex coordinates for given Facing
de... | [
"numpy.add",
"numpy.subtract"
] | [((1398, 1433), 'numpy.add', 'numpy.add', (['self.position', 'direction'], {}), '(self.position, direction)\n', (1407, 1433), False, 'import numpy\n'), ((1442, 1482), 'numpy.add', 'numpy.add', (['self.momentum_next', 'direction'], {}), '(self.momentum_next, direction)\n', (1451, 1482), False, 'import numpy\n'), ((1867,... |
from icecube.icetray import OMKey
from icecube.simclasses import I3MapModuleKeyI3ExtraGeometryItemCylinder, I3ExtraGeometryItemCylinder
from icecube.dataclasses import I3Position, ModuleKey
from I3Tray import I3Units
import numpy as np
from os.path import expandvars
from_cable_shadow = expandvars("$I3_BUILD/ice-mod... | [
"icecube.simclasses.I3MapModuleKeyI3ExtraGeometryItemCylinder",
"numpy.radians",
"os.path.expandvars",
"icecube.dataclasses.I3Position",
"numpy.loadtxt"
] | [((291, 396), 'os.path.expandvars', 'expandvars', (['"""$I3_BUILD/ice-models/resources/models/cable_position/orientation.cable_shadow.txt"""'], {}), "(\n '$I3_BUILD/ice-models/resources/models/cable_position/orientation.cable_shadow.txt'\n )\n", (301, 396), False, 'from os.path import expandvars\n'), ((399, 496),... |
import i18n
from config import config
from definitions import LANG_PATH
i18n.load_path.append(LANG_PATH)
i18n.set('locale', config["language"])
| [
"i18n.set",
"i18n.load_path.append"
] | [((74, 106), 'i18n.load_path.append', 'i18n.load_path.append', (['LANG_PATH'], {}), '(LANG_PATH)\n', (95, 106), False, 'import i18n\n'), ((107, 145), 'i18n.set', 'i18n.set', (['"""locale"""', "config['language']"], {}), "('locale', config['language'])\n", (115, 145), False, 'import i18n\n')] |
import PyQt5.QtWidgets
import MainForm
app_module = PyQt5.QtWidgets.QApplication([])
app = MainForm.MainForm()
app.show()
app_module.exec() | [
"MainForm.MainForm"
] | [((93, 112), 'MainForm.MainForm', 'MainForm.MainForm', ([], {}), '()\n', (110, 112), False, 'import MainForm\n')] |
from observers.observer import Observer
from observers.eys_state import EyeStateItem, ChooseState
import json
import os
class JsonObserver(Observer):
CSV_FILE_NAME = 'db.json'
def __init__(self):
super().__init__()
def trigger(self, eye_state_item: EyeStateItem):
if eye_state_item.choos... | [
"json.dump",
"json.load"
] | [((757, 772), 'json.dump', 'json.dump', (['j', 'f'], {}), '(j, f)\n', (766, 772), False, 'import json\n'), ((476, 488), 'json.load', 'json.load', (['f'], {}), '(f)\n', (485, 488), False, 'import json\n')] |
import itertools
import operator
import os
import pickle
import re
import sys
import time
import cv2
from keras import backend as K
from keras.layers import Input
from keras.models import Model
import skvideo.io
from keras_frcnn import roi_helpers
import keras_frcnn.resnet as nn
import numpy as np
video_folder = '..... | [
"numpy.argmax",
"os.popen",
"os.walk",
"keras.models.Model",
"keras.backend.image_dim_ordering",
"pickle.load",
"numpy.random.randint",
"cv2.rectangle",
"keras.layers.Input",
"sys.setrecursionlimit",
"os.path.join",
"os.path.abspath",
"numpy.transpose",
"numpy.max",
"re.findall",
"cv2.... | [((375, 425), 'os.path.abspath', 'os.path.abspath', (["(video_folder + videoName + '.mp4')"], {}), "(video_folder + videoName + '.mp4')\n", (390, 425), False, 'import os\n'), ((446, 508), 'os.path.abspath', 'os.path.abspath', (["(video_folder + 'OUTPUT/' + videoName + '.mp4')"], {}), "(video_folder + 'OUTPUT/' + videoN... |
import logging
from sqlalchemy import create_engine
from joblib import Parallel, delayed
logger = logging.getLogger(__name__)
def _to_sql(df, table, url, **kwargs):
to_sql_kwargs = {
'index': False,
'method': 'multi',
'if_exists': 'append'
}
to_sql_kwargs.update(kwargs)
engin... | [
"sqlalchemy.create_engine",
"joblib.delayed",
"logging.getLogger",
"joblib.Parallel"
] | [((100, 127), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (117, 127), False, 'import logging\n'), ((324, 342), 'sqlalchemy.create_engine', 'create_engine', (['url'], {}), '(url)\n', (337, 342), False, 'from sqlalchemy import create_engine\n'), ((765, 788), 'joblib.Parallel', 'Parallel'... |
import logging
import requests
import json
from celery import shared_task
from system.models import Users
from seal import settings
logger = logging.getLogger('system_celery')
@shared_task
def system_demo(one):
##因为开启了时区,所以django在数据库里面保存的为 utc 时间, 调用的时候会帮你 转为 东八区, celery会自动识别时间
from django.utils import timezo... | [
"django.utils.timezone.localtime",
"system.models.Users.objects.all",
"logging.getLogger",
"json.dumps"
] | [((141, 175), 'logging.getLogger', 'logging.getLogger', (['"""system_celery"""'], {}), "('system_celery')\n", (158, 175), False, 'import logging\n'), ((336, 355), 'system.models.Users.objects.all', 'Users.objects.all', ([], {}), '()\n', (353, 355), False, 'from system.models import Users\n'), ((1081, 1097), 'json.dumps... |
import json
from django import forms
from django.template.loader import render_to_string
class AceMarkdownWidget(forms.widgets.Textarea):
template_name = 'django_cradmin/acemarkdown/widget.django.html'
directiveconfig = {
# 'showTextarea': False,
# 'theme': 'tomorrow'
}
@property
... | [
"django.forms.Media",
"json.dumps"
] | [((352, 419), 'django.forms.Media', 'forms.Media', ([], {'js': "['django_cradmin/dist/vendor/js/ace-editor/ace.js']"}), "(js=['django_cradmin/dist/vendor/js/ace-editor/ace.js'])\n", (363, 419), False, 'from django import forms\n'), ((834, 866), 'json.dumps', 'json.dumps', (['self.directiveconfig'], {}), '(self.directiv... |
import numpy as np # type: ignore
city_num = 20
file_path = "./coordinates/"
output_file = "random_" + str(city_num) + "_cities.csv"
if __name__ == "__main__":
# “continuous uniform” distribution random
np_cities = np.random.random((city_num, 2))
np.savetxt(file_path + output_file, np_cities, delimiter="... | [
"numpy.savetxt",
"numpy.random.random"
] | [((226, 257), 'numpy.random.random', 'np.random.random', (['(city_num, 2)'], {}), '((city_num, 2))\n', (242, 257), True, 'import numpy as np\n'), ((262, 323), 'numpy.savetxt', 'np.savetxt', (['(file_path + output_file)', 'np_cities'], {'delimiter': '""","""'}), "(file_path + output_file, np_cities, delimiter=',')\n", (... |
from django.conf import settings
from django.core.checks import Warning
def check_production_settings(app_configs, **kwargs):
issues = []
if settings.DEBUG:
return issues
if not settings.EMAIL_HOST_PASSWORD or 'TODO' in settings.EMAIL_HOST_PASSWORD:
issues.append(
Warning(
... | [
"django.core.checks.Warning"
] | [((309, 399), 'django.core.checks.Warning', 'Warning', (['"""EMAIL_HOST_PASSWORD setting is not set to proper value"""'], {'id': '"""tg_utils.W001"""'}), "('EMAIL_HOST_PASSWORD setting is not set to proper value', id=\n 'tg_utils.W001')\n", (316, 399), False, 'from django.core.checks import Warning\n'), ((524, 598),... |
"""Contains DeepSpeech2 model."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import os
import time
import logging
import gzip
import copy
import numpy as np
import inspect
from utils.decoder.swig_wrapper import Scorer
from utils.decoder.swig_... | [
"copy.deepcopy",
"gzip.open",
"numpy.shape",
"inspect.isgeneratorfunction",
"utils.decoder.swig_wrapper.Scorer",
"utils.decoder.swig_wrapper.ctc_beam_search_decoder_batch"
] | [((3843, 4070), 'utils.decoder.swig_wrapper.ctc_beam_search_decoder_batch', 'ctc_beam_search_decoder_batch', ([], {'probs_split': 'probs_split', 'vocabulary': 'vocab_list', 'beam_size': 'beam_size', 'num_processes': 'num_processes', 'ext_scoring_func': 'self._ext_scorer', 'cutoff_prob': 'cutoff_prob', 'cutoff_top_n': '... |
import slicer
def cliRunSync(module, node=None, parameters=None, delete_temporary_files=True, update_display=True):
"""Run CLI module. If ipywidgets are installed then it reports progress.
"""
try:
from ipywidgets import IntProgress
from IPython.display import display
# Asynchronous run, with proge... | [
"slicer.cli.run",
"IPython.display.display",
"time.sleep",
"ipywidgets.IntProgress",
"slicer.cli.runSync",
"slicer.app.processEvents"
] | [((358, 528), 'slicer.cli.run', 'slicer.cli.run', (['module'], {'node': 'node', 'parameters': 'parameters', 'wait_for_completion': '(False)', 'delete_temporary_files': 'delete_temporary_files', 'update_display': 'update_display'}), '(module, node=node, parameters=parameters,\n wait_for_completion=False, delete_tempo... |
import flask
from flask_restful import Resource
from fence.auth import login_user
from fence.blueprints.login.redirect import validate_redirect
from fence.errors import InternalError, Unauthorized
from fence.models import IdentityProvider
from fence.config import config
class ShibbolethLogin(Resource):
def get(s... | [
"fence.errors.InternalError",
"flask.redirect",
"flask.request.headers.get",
"flask.request.args.get",
"flask.session.get",
"fence.auth.login_user",
"fence.errors.Unauthorized",
"fence.blueprints.login.redirect.validate_redirect"
] | [((705, 739), 'flask.request.args.get', 'flask.request.args.get', (['"""redirect"""'], {}), "('redirect')\n", (727, 739), False, 'import flask\n'), ((748, 779), 'fence.blueprints.login.redirect.validate_redirect', 'validate_redirect', (['redirect_url'], {}), '(redirect_url)\n', (765, 779), False, 'from fence.blueprints... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import torch
import unittest
from torch.autograd import Variable
from gpytorch.lazy import RootLazyVariable
from gpytorch.utils import approx_equal
class TestRootLazyVa... | [
"unittest.main",
"torch.eye",
"torch.autograd.Variable",
"torch.randn",
"gpytorch.utils.approx_equal",
"gpytorch.lazy.RootLazyVariable"
] | [((2028, 2043), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2041, 2043), False, 'import unittest\n'), ((453, 475), 'gpytorch.lazy.RootLazyVariable', 'RootLazyVariable', (['root'], {}), '(root)\n', (469, 475), False, 'from gpytorch.lazy import RootLazyVariable\n'), ((827, 844), 'torch.randn', 'torch.randn', (['... |
"""
Run PyTorch NAF on many envs.
"""
import random
import railrl.torch.pytorch_util as ptu
from railrl.exploration_strategies.ou_strategy import OUStrategy
from railrl.launchers.launcher_util import run_experiment
from railrl.torch.naf import NafPolicy, NAF
from rllab.envs.mujoco.ant_env import AntEnv
from rllab.envs... | [
"random.randint",
"railrl.exploration_strategies.ou_strategy.OUStrategy",
"railrl.launchers.launcher_util.run_experiment",
"rllab.envs.normalized_env.normalize",
"railrl.torch.naf.NAF"
] | [((586, 600), 'rllab.envs.normalized_env.normalize', 'normalize', (['env'], {}), '(env)\n', (595, 600), False, 'from rllab.envs.normalized_env import normalize\n'), ((610, 651), 'railrl.exploration_strategies.ou_strategy.OUStrategy', 'OUStrategy', ([], {'action_space': 'env.action_space'}), '(action_space=env.action_sp... |
from tests.fixtures import client
def test_point_json(client):
rv = client.get("/points/51.501,-0.2936")
point_json = rv.get_json()
assert rv.headers["Access-Control-Allow-Origin"] == "*"
assert (
point_json.get("data", {})
.get("relationships", {})
.get("nearest_postcode", {}... | [
"tests.fixtures.client.get"
] | [((74, 110), 'tests.fixtures.client.get', 'client.get', (['"""/points/51.501,-0.2936"""'], {}), "('/points/51.501,-0.2936')\n", (84, 110), False, 'from tests.fixtures import client\n'), ((617, 658), 'tests.fixtures.client.get', 'client.get', (['"""/points/51.501,-0.2936.html"""'], {}), "('/points/51.501,-0.2936.html')\... |
import os
import pathlib
import re
import time
import sys
import json
import cv2
import h5py
import math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.path as mpath
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import matplotlib as mpl
from scipy.s... | [
"PyQt5.QtCore.pyqtSignal",
"numpy.sum",
"numpy.abs",
"numpy.argmax",
"matplotlib.pyplot.axes",
"numpy.empty",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtGui.QColor",
"numpy.iinfo",
"numpy.clip",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QVBoxLayout",
"matplotlib.pyplot.fig... | [((1200, 1216), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (1209, 1216), True, 'import matplotlib.pyplot as plt\n'), ((2367, 2474), 'numpy.array', 'np.array', (['[[0, 0, 0, 0.3], [0, 0, 1, 1], [0, 0.7, 0, 1], [1, 0, 0, 1], [0.7, 0.5, 0, 1]]'], {'dtype': '"""float"""'}), "([[0, 0, 0, 0.3],... |
from hashlib import sha256
from remerkleable.byte_arrays import Bytes32
from typing import Union
ZERO_BYTES32 = b'\x00' * 32
def hash(x: Union[bytes, bytearray, memoryview]) -> Bytes32:
return Bytes32(sha256(x).digest())
| [
"hashlib.sha256"
] | [((208, 217), 'hashlib.sha256', 'sha256', (['x'], {}), '(x)\n', (214, 217), False, 'from hashlib import sha256\n')] |
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
#
# Created on: Sat Nov 2 14:41:15 CET 2019
#
# Author(s): <NAME> <https://urbanij.github.io>
#
# Description: Unit test for traveling_wave_1.py
#
# ==========================================================
import unittest
from wave import *
from functions imp... | [
"unittest.main"
] | [((641, 656), 'unittest.main', 'unittest.main', ([], {}), '()\n', (654, 656), False, 'import unittest\n')] |
from django.urls import path, include
urlpatterns = [
path('api/examiner/', include('core.examiner.urls')),
path('api/taker/', include('core.taker.urls')),
]
| [
"django.urls.include"
] | [((81, 110), 'django.urls.include', 'include', (['"""core.examiner.urls"""'], {}), "('core.examiner.urls')\n", (88, 110), False, 'from django.urls import path, include\n'), ((136, 162), 'django.urls.include', 'include', (['"""core.taker.urls"""'], {}), "('core.taker.urls')\n", (143, 162), False, 'from django.urls impor... |