code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
###############################################################################
#
# GetToken
# Retrieves an access token that can be used to authenticate with the Microsoft Translator API.
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the Apache License, V... | [
"json.loads"
] | [((2857, 2872), 'json.loads', 'json.loads', (['str'], {}), '(str)\n', (2867, 2872), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# *****************************************************************************
# ufit, a universal scattering fitting suite
#
# Copyright (c) 2013-2019, <NAME> and contributors. All rights reserved.
# Licensed under a 2-clause BSD license, see LICENSE.
# **************************************... | [
"copy.deepcopy",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.array",
"matplotlib.pyplot.errorbar",
"numpy.ravel",
"ufit.plotting.DataPlotter",
"matplotlib.pyplot.subplots",
"ufit.pycompat.iteritems"
] | [((983, 1002), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (996, 1002), False, 'import copy\n'), ((4222, 4244), 'ufit.plotting.DataPlotter', 'DataPlotter', ([], {'axes': 'axes'}), '(axes=axes)\n', (4233, 4244), False, 'from ufit.plotting import DataPlotter\n'), ((4790, 4812), 'ufit.plotting.DataPlotte... |
import lzma
def lzma_compress(data):
# https://svn.python.org/projects/external/xz-5.0.3/doc/lzma-file-format.txt
compressed_data = lzma.compress(
data,
format=lzma.FORMAT_ALONE,
filters=[
{
"id": lzma.FILTER_LZMA1,
"preset": 6,
... | [
"lzma.compress"
] | [((142, 266), 'lzma.compress', 'lzma.compress', (['data'], {'format': 'lzma.FORMAT_ALONE', 'filters': "[{'id': lzma.FILTER_LZMA1, 'preset': 6, 'dict_size': 16 * 1024}]"}), "(data, format=lzma.FORMAT_ALONE, filters=[{'id': lzma.\n FILTER_LZMA1, 'preset': 6, 'dict_size': 16 * 1024}])\n", (155, 266), False, 'import lzm... |
'''
training for Navier Stokes with Reynolds number 500, 0.5 second time period
'''
import csv
import random
from timeit import default_timer
import deepxde as dde
from deepxde.optimizers.config import set_LBFGS_options
import numpy as np
from baselines.data import NSdata
import tensorflow as tf
Re = 500
def forcin... | [
"deepxde.PointSetBC",
"deepxde.geometry.Rectangle",
"deepxde.data.TimePDE",
"deepxde.Model",
"deepxde.geometry.GeometryXTime",
"deepxde.grad.jacobian",
"tensorflow.math.cos",
"csv.writer",
"timeit.default_timer",
"deepxde.grad.hessian",
"deepxde.metrics.l2_relative_error",
"baselines.data.NSda... | [((604, 637), 'deepxde.grad.jacobian', 'dde.grad.jacobian', (['u', 'x'], {'i': '(0)', 'j': '(0)'}), '(u, x, i=0, j=0)\n', (621, 637), True, 'import deepxde as dde\n'), ((653, 698), 'deepxde.grad.hessian', 'dde.grad.hessian', (['u', 'x'], {'component': '(0)', 'i': '(0)', 'j': '(0)'}), '(u, x, component=0, i=0, j=0)\n', ... |
# Collections module: is a a built in module that implements specialized container
# datatypes providing alternatives to python's general purpose built-in containers.
# Counter: is a dictionary subclass which helps counting hashable objects.
from collections import Counter
l1 =[1,2,3,4,523,2,1,3,41,3,5,5]
# Counte... | [
"collections.Counter"
] | [((396, 407), 'collections.Counter', 'Counter', (['l1'], {}), '(l1)\n', (403, 407), False, 'from collections import Counter\n'), ((452, 463), 'collections.Counter', 'Counter', (['s1'], {}), '(s1)\n', (459, 463), False, 'from collections import Counter\n'), ((594, 605), 'collections.Counter', 'Counter', (['s2'], {}), '(... |
import datetime
import random
from locust import HttpUser, task, between
class QuickstartUser(HttpUser):
wait_time = between(2, 3.5)
@task
def send_event(self):
event = {
'id': random.randint(0, 99),
'timestamp': datetime.datetime.now().isoformat(),
... | [
"datetime.datetime.now",
"random.randint",
"locust.between"
] | [((129, 144), 'locust.between', 'between', (['(2)', '(3.5)'], {}), '(2, 3.5)\n', (136, 144), False, 'from locust import HttpUser, task, between\n'), ((223, 244), 'random.randint', 'random.randint', (['(0)', '(99)'], {}), '(0, 99)\n', (237, 244), False, 'import random\n'), ((714, 737), 'random.randint', 'random.randint'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
from hwt.hdl.constants import Time
from hwt.simulator.simTestCase import SingleUnitSimTestCase
from hwtLib.abstract.discoverAddressSpace import AddressSpaceProbe
from hwtLib.amba.axiLite_comp.endpoint_test import addrGetter
from hwtLib.amba.axis_comp.fram... | [
"unittest.TestSuite",
"hwtLib.amba.axiLite_comp.sim.mem_space_master.AxiLiteMemSpaceMaster",
"hwtLib.amba.axis_comp.frameGen.AxisFrameGen",
"pyMathBitPrecise.bit_utils.mask",
"unittest.makeSuite",
"unittest.TextTestRunner",
"hwtLib.abstract.discoverAddressSpace.AddressSpaceProbe"
] | [((2275, 2295), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (2293, 2295), False, 'import unittest\n'), ((2408, 2444), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(3)'}), '(verbosity=3)\n', (2431, 2444), False, 'import unittest\n'), ((575, 589), 'hwtLib.amba.axis_comp.fram... |
from peewee import *
from datetime import datetime
db = SqliteDatabase('entries.db')
class BaseModel(Model):
class Meta:
database = db
class Entry(BaseModel):
date = DateField()
employee_name = CharField()
task_name = CharField()
time_spent = IntegerField()
notes = TextField()
... | [
"datetime.datetime.today"
] | [((346, 362), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (360, 362), False, 'from datetime import datetime\n')] |
"""帮助查看器"""
if __name__ == '__main__':
import __init__
__init__.test_editor(__file__)
import io
import sys
if sys.version_info > (3, 6):
from idlelib.textview import view_text
else:
from idlelib.textView import view_text
def HelpText(object): # TODO 读取真正的object而不是string
# 在pydoc.ttypager和pydo... | [
"io.StringIO",
"__init__.test_editor"
] | [((65, 95), '__init__.test_editor', '__init__.test_editor', (['__file__'], {}), '(__file__)\n', (85, 95), False, 'import __init__\n'), ((390, 403), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (401, 403), False, 'import io\n')] |
#!/usr/bin/env python
import pytest
import mock
import status
import fixtures
import os
import twitter
import requests
os.environ['TWITTER_CONSUMER_KEY'] = 'TEST_TWITTER_CONSUMER_KEY'
os.environ['TWITTER_CONSUMER_SECRET'] = 'TEST_TWITTER_CONSUMER_SECRET'
os.environ['TWITTER_ACCESS_TOKEN_KEY'] = 'TEST_TW... | [
"status.main",
"requests.post.assert_called_once",
"status.send_request.assert_called_once",
"status.parse_arguments.assert_called_once",
"status.build_request.assert_called_once",
"status.build_post_from_json",
"status.post_to_twitter",
"status.send_request",
"status.build_request",
"status.conve... | [((463, 511), 'status.convert_to_datetime', 'status.convert_to_datetime', (['fixtures.time_string'], {}), '(fixtures.time_string)\n', (489, 511), False, 'import status\n'), ((849, 897), 'status.extract_segment_json', 'status.extract_segment_json', (['fixtures.valid_json'], {}), '(fixtures.valid_json)\n', (876, 897), Fa... |
# -*- coding: utf-8 -*-
import os
import subprocess
def main():
# Get the path of the root CKAN directory.
root_path = os.path.abspath(os.path.join(os.path.curdir, ".."))
# Update the repositories.
update_repository("core", root_path)
update_repository("cmdline", root_path)
update_reposit... | [
"os.chdir",
"os.path.exists",
"os.path.join",
"subprocess.call"
] | [((641, 682), 'os.path.join', 'os.path.join', (['root_path', 'ckan_folder_name'], {}), '(root_path, ckan_folder_name)\n', (653, 682), False, 'import os\n'), ((757, 783), 'os.chdir', 'os.chdir', (['ckan_folder_path'], {}), '(ckan_folder_path)\n', (765, 783), False, 'import os\n'), ((834, 886), 'subprocess.call', 'subpro... |
import os
import gzip
from mcb.outputs import Output
class Filesystem(Output):
def setup(self):
self.name = 'filesystem'
self.pretty_name = 'Filesystem'
self.addConfig('path', 'Path')
self.addConfig('gzip', 'GZIP', 'bool', False)
def getId(self):
return self.name + '_' + self.path
def get... | [
"os.makedirs",
"gzip.open",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir"
] | [((734, 776), 'os.path.join', 'os.path.join', (['self.path', 'self.prefix', 'name'], {}), '(self.path, self.prefix, name)\n', (746, 776), False, 'import os\n'), ((1194, 1214), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (1208, 1214), False, 'import os\n'), ((584, 605), 'os.path.dirname', 'os.path.di... |
import partitura
import pandas as pd
import numpy as np
import os
def save_csv_for_parangonada(outdir, part, ppart, align, zalign=None, feature = None):
part = partitura.utils.music.ensure_notearray(part)
ppart = partitura.utils.music.ensure_notearray(ppart)
# ___ create np array for features
ff... | [
"pandas.DataFrame",
"numpy.array",
"partitura.utils.music.ensure_notearray"
] | [((167, 211), 'partitura.utils.music.ensure_notearray', 'partitura.utils.music.ensure_notearray', (['part'], {}), '(part)\n', (205, 211), False, 'import partitura\n'), ((224, 269), 'partitura.utils.music.ensure_notearray', 'partitura.utils.music.ensure_notearray', (['ppart'], {}), '(ppart)\n', (262, 269), False, 'impor... |
"""Incorporate ETH Zurich's BIWI (EWAP) dataset into simple gridworld."""
import os
from pathlib import Path
from matplotlib.image import imread
import matplotlib.pyplot as plt
import numpy as np
from .simple_gw import SimpleGridworld
# Grid constants
OBSTACLE = 2
GOAL = 6
PERSON = 9
ROBOT = 15
class EwapDataset:
... | [
"numpy.copy",
"numpy.eye",
"numpy.abs",
"pathlib.Path",
"numpy.where",
"numpy.max",
"numpy.array",
"numpy.pad",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.pause",
"numpy.loadtxt",
"os.path.abspath",
"numpy.round"
] | [((897, 942), 'numpy.loadtxt', 'np.loadtxt', (["(self.sequence_path / 'obsmat.txt')"], {}), "(self.sequence_path / 'obsmat.txt')\n", (907, 942), True, 'import numpy as np\n'), ((1024, 1068), 'numpy.loadtxt', 'np.loadtxt', (["(self.sequence_path / 'shift.txt')"], {}), "(self.sequence_path / 'shift.txt')\n", (1034, 1068)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 23 09:20:15 2019
@author: zchuri
"""
# Clear workspace
#%reset -f
# Set working directory
import os
os.chdir("/misc/sherrington/zgtabuenca/nipype/Scripts/")
print("####################################################")
print("Nipype - DWI preproc... | [
"nipype.interfaces.mrtrix3.MRConvert",
"os.makedirs",
"nipype.interfaces.mrtrix3.FitTensor",
"os.chdir",
"os.path.isdir",
"os.system",
"nipype.interfaces.mrtrix3.DWIDenoise",
"nipype.interfaces.mrtrix3.BrainMask",
"nipype.interfaces.mrtrix3.TensorMetrics"
] | [((173, 229), 'os.chdir', 'os.chdir', (['"""/misc/sherrington/zgtabuenca/nipype/Scripts/"""'], {}), "('/misc/sherrington/zgtabuenca/nipype/Scripts/')\n", (181, 229), False, 'import os\n'), ((1376, 1395), 'nipype.interfaces.mrtrix3.MRConvert', 'mrtrix3.MRConvert', ([], {}), '()\n', (1393, 1395), True, 'import nipype.int... |
import random
import h5py
import numpy as np
import torch
import torch.utils.data as udata
import glob
import os
from PIL import Image
import torchvision.transforms as transforms
# import torch.nn.functional as F
def normalize():
return transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
def norm(data, max_v... | [
"random.shuffle",
"os.path.join",
"h5py.File",
"numpy.array",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"numpy.transpose",
"torchvision.transforms.Compose"
] | [((243, 297), 'torchvision.transforms.Normalize', 'transforms.Normalize', (['(0.5, 0.5, 0.5)', '(0.5, 0.5, 0.5)'], {}), '((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))\n', (263, 297), True, 'import torchvision.transforms as transforms\n'), ((1589, 1621), 'h5py.File', 'h5py.File', (['self.keys[index]', '"""r"""'], {}), "(self.keys[... |
import sys
import os
from pathlib import Path
# parameter handling
path = 0
if len(sys.argv)>1:
path = sys.argv[1]
else:
raise RuntimeError("missing argument")
src = Path(path)
if not src.exists():
raise RuntimeError("path does not exist")
if src.parts[0] != "pycqed":
raise RuntimeError("path should ... | [
"os.system",
"pathlib.Path"
] | [((176, 186), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (180, 186), False, 'from pathlib import Path\n'), ((498, 512), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (507, 512), False, 'import os\n'), ((350, 368), 'pathlib.Path', 'Path', (['"""deprecated"""'], {}), "('deprecated')\n", (354, 368), False, ... |
import subprocess
from colorama import Fore
import tempfile
import os
from pathlib import Path
import re
load_cmd = '/opt/p2llvm/bin/loadp2'
load_args = ['-ZERO', '-l', '0', '-v', '-FIFO', '4096']
def load(port, app, baud, verbose=False, retries=3):
result = False
while retries:
args = load_... | [
"subprocess.Popen",
"tempfile.gettempdir",
"pathlib.Path",
"re.search"
] | [((1504, 1617), 'subprocess.Popen', 'subprocess.Popen', (["['/opt/p2llvm/bin/llvm-objcopy', '-O', 'binary', elf_file, outfile]"], {'stdout': 'subprocess.PIPE'}), "(['/opt/p2llvm/bin/llvm-objcopy', '-O', 'binary', elf_file,\n outfile], stdout=subprocess.PIPE)\n", (1520, 1617), False, 'import subprocess\n'), ((2186, 2... |
import random
def do_something(count, out_list):
for i in range(count):
out_list.append(random.random())
| [
"random.random"
] | [((102, 117), 'random.random', 'random.random', ([], {}), '()\n', (115, 117), False, 'import random\n')] |
import logging
from datetime import datetime
from django.db import models
from django.contrib.auth.models import User
from wouso.core.common import Item, CachedItem
from wouso.core.decorators import cached_method, drop_cache
from wouso.core.game import get_games
from wouso.core.game.models import Game
class Coin(Cach... | [
"django.db.models.Sum",
"django.db.models.FloatField",
"wouso.core.game.get_games",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"wouso.core.decorators.drop_cache",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((494, 539), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'unique': '(True)'}), '(max_length=100, unique=True)\n', (510, 539), False, 'from django.db import models\n'), ((607, 653), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Game'], {'blank': '(True)', 'null': '(True)'}), ... |
import os
import logging
import requests
from deep_security_provider import DeepSecurityProvider
import copy
log = logging.getLogger()
log.setLevel(os.environ.get("LOG_LEVEL", "INFO"))
request_schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"required": ["Type"],
"p... | [
"logging.getLogger",
"requests.post",
"os.environ.get"
] | [((117, 136), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (134, 136), False, 'import logging\n'), ((150, 185), 'os.environ.get', 'os.environ.get', (['"""LOG_LEVEL"""', '"""INFO"""'], {}), "('LOG_LEVEL', 'INFO')\n", (164, 185), False, 'import os\n'), ((3244, 3330), 'requests.post', 'requests.post', (['se... |
"""
WSGI config for painindex project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/
"""
import os
from dj_static import Cling # heroku staticfiles collection
os.environ["DJANGO_SETTI... | [
"django.core.wsgi.get_wsgi_application"
] | [((441, 463), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (461, 463), False, 'from django.core.wsgi import get_wsgi_application\n')] |
"""Methods for retrieving device information."""
import json
import logging
from dataclasses import dataclass, field
from ..const import (CURRENT_SPEED, CURRENT_TRANSPORT_STATE,
CURRENT_TRANSPORT_STATUS, DEFAULT_TRANSPORT_SPEED,
DEFAULT_TRANSPORT_STATE, KNOWN_COUNTRIES,
... | [
"logging.getLogger",
"json.loads",
"json.dumps",
"dataclasses.field"
] | [((657, 684), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (674, 684), False, 'import logging\n'), ((3754, 3796), 'dataclasses.field', 'field', ([], {'init': '(True)', 'repr': '(True)', 'compare': '(False)'}), '(init=True, repr=True, compare=False)\n', (3759, 3796), False, 'from datacla... |
import copy
import numpy as np
from math import sqrt, pi, e
from bisection import bisection
class LegendrePolynomial:
def __init__(self, n):
self.degree = n
self.coef = [1]
while n and len(self.coef) < n + 1:
self.coef.append(0)
def get(self, x):
res = 0
fo... | [
"numpy.zeros",
"numpy.linalg.inv",
"bisection.bisection",
"copy.deepcopy"
] | [((1949, 1965), 'numpy.zeros', 'np.zeros', (['(n, n)'], {}), '((n, n))\n', (1957, 1965), True, 'import numpy as np\n'), ((1974, 1990), 'numpy.zeros', 'np.zeros', (['(n, 1)'], {}), '((n, 1))\n', (1982, 1990), True, 'import numpy as np\n'), ((2112, 2128), 'numpy.linalg.inv', 'np.linalg.inv', (['A'], {}), '(A)\n', (2125, ... |
'''
Copyright: ESSS - Engineering Simulation and Scientific Software Ltda
License: LGPL
Based on: https://github.com/ESSS/ben10/blob/master/source/python/ben10/foundation/callback.py
To use a callback do:
class MyObject(object):
def receive_notification(self, arg):
print('Receive notification: ... | [
"pyvmmonitor_core.compat.items",
"collections.OrderedDict",
"types.instancemethod",
"sys.exc_info",
"types.MethodType",
"pyvmmonitor_core.thread_utils.is_in_main_thread",
"weakref.ref"
] | [((1818, 1825), 'collections.OrderedDict', 'odict', ([], {}), '()\n', (1823, 1825), True, 'from collections import OrderedDict as odict\n'), ((7119, 7142), 'pyvmmonitor_core.compat.items', 'compat.items', (['callbacks'], {}), '(callbacks)\n', (7131, 7142), False, 'from pyvmmonitor_core import compat\n'), ((8103, 8122),... |
# Generated by Django 3.0.5 on 2020-04-19 18:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('store', '0002_publisher'),
]
operations = [
migrations.AddField(
model_name='app',
... | [
"django.db.models.URLField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((356, 400), 'django.db.models.CharField', 'models.CharField', ([], {'default': '""""""', 'max_length': '(120)'}), "(default='', max_length=120)\n", (372, 400), False, 'from django.db import migrations, models\n'), ((558, 602), 'django.db.models.TextField', 'models.TextField', ([], {'default': '""""""', 'max_length': ... |
"""Installer for pythontexfigures.sty.
Author: <NAME>
Date: July 2019
"""
import subprocess
import sys
from pathlib import Path
from .sty import sty_file_as_string
def install(tree="TEXMFLOCAL"):
"""Copy pythontexfigures.sty into the given TeX tree, then reun mktexlsr."""
texmf_path = subprocess.check_outp... | [
"subprocess.check_output",
"pathlib.Path",
"subprocess.check_call"
] | [((299, 359), 'subprocess.check_output', 'subprocess.check_output', (["['kpsewhich', '-var-value=' + tree]"], {}), "(['kpsewhich', '-var-value=' + tree])\n", (322, 359), False, 'import subprocess\n'), ((656, 689), 'subprocess.check_call', 'subprocess.check_call', (['"""mktexlsr"""'], {}), "('mktexlsr')\n", (677, 689), ... |
import torch
def kl_divergence(mu, sigma, mu_prior, sigma_prior):
kl = 0.5 * (2 * torch.log(sigma_prior / sigma) - 1 + (sigma / sigma_prior).pow(2) + ((mu_prior - mu) / sigma_prior).pow(2)).sum()
return kl
def softplusinv(x):
return torch.log(torch.exp(x)-1.) | [
"torch.log",
"torch.exp"
] | [((259, 271), 'torch.exp', 'torch.exp', (['x'], {}), '(x)\n', (268, 271), False, 'import torch\n'), ((88, 118), 'torch.log', 'torch.log', (['(sigma_prior / sigma)'], {}), '(sigma_prior / sigma)\n', (97, 118), False, 'import torch\n')] |
import csv
from datetime import datetime
from dateutil.relativedelta import relativedelta
from savReaderWriter import SavReader
# Mortality Dataset
input_uuid_col = 0
is_dead_col = 4
death_date_col = 5
input_uuid_file = './csv/data_mortality_orig.csv'
print('[-] Loading Filter UUIDs from {} ...'.format(input_uuid_fil... | [
"datetime.datetime",
"dateutil.relativedelta.relativedelta",
"csv.writer",
"csv.reader",
"savReaderWriter.SavReader"
] | [((385, 402), 'datetime.datetime', 'datetime', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (393, 402), False, 'from datetime import datetime\n'), ((555, 588), 'csv.reader', 'csv.reader', (['uuidFile'], {'strict': '(True)'}), '(uuidFile, strict=True)\n', (565, 588), False, 'import csv\n'), ((1403, 1425), 'dateutil.relat... |
# coding: utf-8
import unittest
import doctest
import os
from workspacemanager import setup
from workspacemanager import generateSetup
from workspacemanager.utils import *
from shutil import *
from workspacemanager.test.utils import *
# The level allow the unit test execution to choose only the top level test
min = ... | [
"unittest.main",
"os.path.isdir",
"doctest.testmod",
"workspacemanager.generateSetup"
] | [((1388, 1403), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1401, 1403), False, 'import unittest\n'), ((483, 505), 'doctest.testmod', 'doctest.testmod', (['setup'], {}), '(setup)\n', (498, 505), False, 'import doctest\n'), ((909, 963), 'workspacemanager.generateSetup', 'generateSetup', ([], {'theProjectDirecto... |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from . import views
urlpatterns = [
path('categories', views.categories, name='categories'),
]
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpat... | [
"django.conf.urls.static.static",
"django.urls.path"
] | [((147, 202), 'django.urls.path', 'path', (['"""categories"""', 'views.categories'], {'name': '"""categories"""'}), "('categories', views.categories, name='categories')\n", (151, 202), False, 'from django.urls import path\n'), ((246, 309), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document... |
import os
from core.new import commands
def packs(event):
"""view plugins"""
args = " ".join(event.args)
verified = ["clock_1", "example"]
blocked = [".DS_Store", "__pycache__", "__init__.py", "PluginCommands.txt", "plugincodes.py", "verified.py"]
plugins = os.listdir(commands.getMainPath() + 'cor... | [
"core.new.commands.getMainPath"
] | [((291, 313), 'core.new.commands.getMainPath', 'commands.getMainPath', ([], {}), '()\n', (311, 313), False, 'from core.new import commands\n')] |
"""
A Reader simply reads data from disk and returns it almost as is, based on
a "primary key", which for the case of VisDial v1.0 dataset, is the
``image_id``. Readers should be utilized by torch ``Dataset``s. Any type of
data pre-processing is not recommended in the reader, such as tokenizing words
to integers, embed... | [
"json.load",
"copy.copy",
"h5py.File",
"copy.deepcopy"
] | [((7195, 7228), 'copy.copy', 'copy.copy', (['self.dialogs[image_id]'], {}), '(self.dialogs[image_id])\n', (7204, 7228), False, 'import copy\n'), ((1739, 1762), 'json.load', 'json.load', (['visdial_file'], {}), '(visdial_file)\n', (1748, 1762), False, 'import json\n'), ((7397, 7434), 'copy.deepcopy', 'copy.deepcopy', ([... |
from IPython.display import HTML
from jupyter_client import find_connection_file
from tornado.escape import url_escape
from tornado.httpclient import HTTPClient
import collections
import intrusion
import json
import ndstore
import neuroglancer
# volumes of all viewer instances
volumes = {}
class Viewer(neuroglancer.B... | [
"jupyter_client.find_connection_file",
"tornado.httpclient.HTTPClient",
"collections.OrderedDict",
"IPython.display.HTML"
] | [((380, 405), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (403, 405), False, 'import collections\n'), ((1229, 1326), 'IPython.display.HTML', 'HTML', (['(large_html + \'<iframe src="\' + viewer_url +\n \'" width="100%" height="1024px"><\\\\iframe>\')'], {}), '(large_html + \'<iframe src="\... |
# -*- coding: utf-8 -*-
"""
This is a script for satellite image classification
Last updated on Aug 6 2019
@author: <NAME>
@Email: <EMAIL>
@functions
1. generate samples from satellite images
2. grid search SVM/random forest parameters
3. object-based post-classification refinement
superpixel-based regularization for... | [
"sklearn.model_selection.GridSearchCV",
"numpy.array",
"copy.deepcopy",
"numpy.flip",
"numpy.repeat",
"numpy.reshape",
"numpy.where",
"numpy.memmap",
"matplotlib.pyplot.close",
"numpy.concatenate",
"numpy.random.permutation",
"matplotlib.pyplot.savefig",
"numpy.ones",
"sklearn.ensemble.Ran... | [((7045, 7064), 'copy.deepcopy', 'copy.deepcopy', (['cmap'], {}), '(cmap)\n', (7058, 7064), False, 'import copy\n'), ((7397, 7417), 'numpy.zeros', 'np.zeros', (['(ncl, ncl)'], {}), '((ncl, ncl))\n', (7405, 7417), True, 'import numpy as np\n'), ((7600, 7628), 'numpy.zeros', 'np.zeros', (['(ncl + 2, ncl + 1)'], {}), '((n... |
# Wechat Jump Bot (iOS)
# ----------------------------------------------------------------------------
import os
CURRENT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PROJECT_ROOT = os.path.dirname(CURRENT_DIR)
PROJECT_DIR = "jumpbot/"
# -----------------------------------------------------------... | [
"os.path.abspath",
"os.path.dirname"
] | [((204, 232), 'os.path.dirname', 'os.path.dirname', (['CURRENT_DIR'], {}), '(CURRENT_DIR)\n', (219, 232), False, 'import os\n'), ((161, 186), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (176, 186), False, 'import os\n')] |
from datetime import datetime, timedelta
from dateutil.parser import parse
from json import loads
from os import listdir
from os.path import join
from re import match
FILE_START = "Grailbird.data.tweets_(\d*)_(\d*)"
def get_all_files(export_path):
return [join(export_path, file) for file in listdir(export_path)]
... | [
"dateutil.parser.parse",
"json.loads",
"os.listdir",
"os.path.join",
"re.match",
"datetime.datetime.now",
"datetime.timedelta"
] | [((1071, 1085), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1083, 1085), False, 'from datetime import datetime, timedelta\n'), ((1103, 1137), 'datetime.timedelta', 'timedelta', ([], {'days': '(number_months * 30)'}), '(days=number_months * 30)\n', (1112, 1137), False, 'from datetime import datetime, tim... |
from pyvirtualdisplay import Display
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import WebDriverException
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by ... | [
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"time.sleep",
"pandas.DataFrame.from_dict",
"datetime.datetime.now",
"io.StringIO",
"fake_useragent.UserAgent",
"pyvirtualdisplay.Display"
] | [((927, 962), 'pyvirtualdisplay.Display', 'Display', ([], {'visible': '(0)', 'size': '(800, 600)'}), '(visible=0, size=(800, 600))\n', (934, 962), False, 'from pyvirtualdisplay import Display\n'), ((1058, 1083), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (1081, 1083), False, 'from ... |
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import vplot as vpl
import sys
import os
import subprocess
# Check correct number of arguments
if (len(sys.argv) != 2):
print('ERROR: Incorrect number of arguments.')
print('Usage: '+sys.argv[0]+' <pdf | png>')
exit(1)
if (sys.arg... | [
"matplotlib.pyplot.savefig",
"os.chdir",
"matplotlib.pyplot.close",
"vplot.GetOutput",
"subprocess.call",
"matplotlib.pyplot.subplots"
] | [((603, 623), 'os.chdir', 'os.chdir', (['"""WaterCPL"""'], {}), "('WaterCPL')\n", (611, 623), False, 'import os\n'), ((651, 689), 'subprocess.call', 'subprocess.call', (["['vplanet', 'vpl.in']"], {}), "(['vplanet', 'vpl.in'])\n", (666, 689), False, 'import subprocess\n'), ((691, 714), 'os.chdir', 'os.chdir', (['"""../W... |
import xlwt
class ExcelManager:
def __init__(self, filename="example.xls"):
self.filename = filename
def saveData(self, filelist):
excel_file = xlwt.Workbook(encoding='utf-8')
worksheet = excel_file.add_sheet('file_list')
for i in range(len(filelist)):
worksheet.wr... | [
"xlwt.Workbook"
] | [((170, 201), 'xlwt.Workbook', 'xlwt.Workbook', ([], {'encoding': '"""utf-8"""'}), "(encoding='utf-8')\n", (183, 201), False, 'import xlwt\n')] |
from torchvision import datasets
ds = datasets.UCF101(root='/datasets/UCF101-24',
annotation_path='/datasets/UCF101-24/UCF101_24Action_Detection_Annotations/UCF101_24Action_Detection_Annotations',
frames_per_clip=4)
import pdb; pdb.set_trace() | [
"torchvision.datasets.UCF101",
"pdb.set_trace"
] | [((39, 226), 'torchvision.datasets.UCF101', 'datasets.UCF101', ([], {'root': '"""/datasets/UCF101-24"""', 'annotation_path': '"""/datasets/UCF101-24/UCF101_24Action_Detection_Annotations/UCF101_24Action_Detection_Annotations"""', 'frames_per_clip': '(4)'}), "(root='/datasets/UCF101-24', annotation_path=\n '/datasets... |
import requests
from webapp.utils import API_URL_FLASK
import logging
log = logging.getLogger('webapp_logger')
API_PATH = "http://" + API_URL_FLASK
def get_hijack_by_key(hijack_key):
try:
log.debug("send request for total get_hijack_by_key")
url_ = API_PATH + "/view_hijacks?key=eq." + hijack_key... | [
"logging.getLogger",
"requests.get"
] | [((77, 111), 'logging.getLogger', 'logging.getLogger', (['"""webapp_logger"""'], {}), "('webapp_logger')\n", (94, 111), False, 'import logging\n'), ((340, 362), 'requests.get', 'requests.get', ([], {'url': 'url_'}), '(url=url_)\n', (352, 362), False, 'import requests\n')] |
import openpyxl as xl
from openpyxl.styles.colors import Color
def colorToDescription(name, color):
"""色にはいくつか種類があるので、対応します
Parameters
----------
color : Color
色オブジェクト
"""
if color.type=='theme':
return f'{name}(theme={color.theme} tint={color.tint})'
elif color.type=='index... | [
"openpyxl.load_workbook"
] | [((1149, 1193), 'openpyxl.load_workbook', 'xl.load_workbook', (['"""test-data/test-data.xlsx"""'], {}), "('test-data/test-data.xlsx')\n", (1165, 1193), True, 'import openpyxl as xl\n')] |
"""ImpulseDict class for manipulating impulse responses."""
import numpy as np
from .result_dict import ResultDict
from ..utilities.ordered_set import OrderedSet
from ..utilities.bijection import Bijection
from .steady_state_dict import SteadyStateDict
class ImpulseDict(ResultDict):
def __init__(self, data, int... | [
"numpy.zeros"
] | [((3996, 4012), 'numpy.zeros', 'np.zeros', (['self.T'], {}), '(self.T)\n', (4004, 4012), True, 'import numpy as np\n'), ((4222, 4238), 'numpy.zeros', 'np.zeros', (['self.T'], {}), '(self.T)\n', (4230, 4238), True, 'import numpy as np\n')] |
import io
import yaml
import os
import logging
logger = logging.getLogger(__name__)
def ensure_empty(directory):
if len(os.listdir(directory)) == 0:
return True
else:
return False
def ensure_default_values(data):
""" Set default values matching the local dev deployment of Studio. """
... | [
"logging.getLogger",
"os.path.exists",
"os.listdir",
"yaml.dump",
"pathlib.Path",
"os.path.join",
"yaml.load",
"io.open",
"os.getcwd",
"os.path.expanduser"
] | [((58, 85), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (75, 85), False, 'import logging\n'), ((2786, 2818), 'os.path.exists', 'os.path.exists', (['config_file_path'], {}), '(config_file_path)\n', (2800, 2818), False, 'import os\n'), ((2863, 2886), 'os.path.expanduser', 'os.path.expand... |
import gym
from tf_rl.common.wrappers import CartPole_Pixel
env = CartPole_Pixel(gym.make('CartPole-v0'))
for ep in range(2):
env.reset()
for t in range(100):
o, r, done, _ = env.step(env.action_space.sample())
print(o.shape, o.min(), o.max())
if done:
break
env.close()
| [
"gym.make"
] | [((82, 105), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (90, 105), False, 'import gym\n')] |
__author__ = '<NAME>'
__copyright__ = 'Copyright (c)2017, <NAME>'
__license__ = 'MIT'
__email__ = '<EMAIL>'
import sys
import os
import cli_commands
import logger
import fnmatch
def print_env_vars():
"""
Print all environment variables available for current process.
"""
print("Current process environ... | [
"os.path.join",
"os.environ.items",
"os.path.isfile",
"sys.exit",
"os.walk",
"sys.stdout.write"
] | [((354, 372), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (370, 372), False, 'import os\n'), ((564, 582), 'os.environ.items', 'os.environ.items', ([], {}), '()\n', (580, 582), False, 'import os\n'), ((2325, 2352), 'os.path.isfile', 'os.path.isfile', (['config_file'], {}), '(config_file)\n', (2339, 2352), ... |
#!/usr/bin/env python -O
# -*- coding: utf-8 -*-
#
# tests.unit._dao.TestRTKFailureMode.py is part of The RTK Project
#
# All rights reserved.
"""
This is the test class for testing the RTKFailureMode module algorithms and
models.
"""
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(di... | [
"sqlalchemy.orm.sessionmaker",
"os.path.dirname",
"sqlalchemy.create_engine",
"nose.plugins.attrib.attr"
] | [((1451, 1476), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (1455, 1476), False, 'from nose.plugins.attrib import attr\n'), ((2132, 2157), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (2136, 2157),... |
from __future__ import annotations
from typing import Optional, TypeVar, Union
import numpy as np
from typing_extensions import Final
from ...representation import FData
from ...representation._typing import NDArrayFloat
from .._math import cosine_similarity, cosine_similarity_matrix
from ._utils import pairwise_met... | [
"typing.TypeVar"
] | [((342, 388), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': 'Union[NDArrayFloat, FData]'}), "('T', bound=Union[NDArrayFloat, FData])\n", (349, 388), False, 'from typing import Optional, TypeVar, Union\n')] |
#!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Unit tests for the contents of device_temp_file.py.
"""
import logging
import os
import sys
import unittest
from pylib import con... | [
"logging.getLogger",
"pylib.utils.device_temp_file.DeviceTempFile",
"logging.debug",
"os.path.join",
"unittest.main",
"mock.call",
"mock.MagicMock"
] | [((385, 449), 'os.path.join', 'os.path.join', (['constants.DIR_SOURCE_ROOT', '"""third_party"""', '"""pymock"""'], {}), "(constants.DIR_SOURCE_ROOT, 'third_party', 'pymock')\n", (397, 449), False, 'import os\n'), ((1660, 1686), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1673, 1686... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from . import ... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((1381, 1411), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""nodeName"""'}), "(name='nodeName')\n", (1394, 1411), False, 'import pulumi\n'), ((3180, 3210), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""nodeName"""'}), "(name='nodeName')\n", (3193, 3210), False, 'import pulumi\n'), ((8684, 8714), 'pulumi.ge... |
from pysat.solvers import Glucose3
from USP import UspWeaknessVerifier, GenerateUsp
import math
def ExtractAssignment(U, model):
"""
Extracts assignment in permutations given a model from pysat
"""
n = len(U)
k = len(U[0])
# Function to translate any glucose number into it's
# correspondi... | [
"pysat.solvers.Glucose3",
"USP.GenerateUsp",
"USP.UspWeaknessVerifier"
] | [((980, 990), 'pysat.solvers.Glucose3', 'Glucose3', ([], {}), '()\n', (988, 990), False, 'from pysat.solvers import Glucose3\n'), ((4332, 4349), 'USP.GenerateUsp', 'GenerateUsp', (['(8)', '(8)'], {}), '(8, 8)\n', (4343, 4349), False, 'from USP import UspWeaknessVerifier, GenerateUsp\n'), ((3892, 3911), 'USP.GenerateUsp... |
import pytest
import json
import datetime
import pytz
import uuid
from dataclasses import dataclass, field, asdict
from typing import (
Optional,
List,
Dict,
Any,
Generic,
TypeVar,
Mapping,
)
from marshmallow import ValidationError, Schema, fields, post_load, pre_dump, validates
from fractio... | [
"grahamcracker.dataclass_schema",
"marshmallow.ValidationError",
"dataclasses.dataclass",
"grahamcracker.schema_for",
"datetime.time",
"dataclasses.asdict",
"grahamcracker.Garams",
"fractions.Fraction",
"marshmallow.validates",
"dataclasses.field",
"grahamcracker.EmailStr",
"json.loads",
"uu... | [((1573, 1587), 'typing.TypeVar', 'TypeVar', (['"""Var"""'], {}), "('Var')\n", (1580, 1587), False, 'from typing import Optional, List, Dict, Any, Generic, TypeVar, Mapping\n'), ((1961, 1973), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1971, 1973), False, 'import uuid\n'), ((1990, 2024), 'datetime.datetime.now', 'd... |
"""
MediaFS: A pure-Python filesystem caching system for easy searching and metadata storage
Author: <NAME>
License: MIT (See accompanying file LICENSE or copy at http://opensource.org/licenses/MIT)
"""
import os
import re
import sys
import json
import fnmatch
import hashlib
import binascii
from datetime ... | [
"re.compile",
"os.path.exists",
"os.listdir",
"fnmatch.fnmatchcase",
"os.path.isdir",
"os.path.getsize",
"hashlib.md5",
"os.rename",
"os.path.isfile",
"os.path.dirname",
"os.path.getmtime",
"binascii.crc32",
"os.path.abspath",
"os.path.join",
"os.path.getatime",
"os.path.basename",
"... | [((852, 868), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (862, 868), False, 'import os\n'), ((1553, 1575), 'os.path.basename', 'os.path.basename', (['path'], {}), '(path)\n', (1569, 1575), False, 'import os\n'), ((8349, 8374), 'os.path.exists', 'os.path.exists', (['self.path'], {}), '(self.path)\n', (8363,... |
#!/usr/bin/env python
"""stereo_rgb.py: Python functions for interacting with stereo RGB Camera sensor data in TERRA-REF project."""
__author__ = "<NAME>, <NAME>"
import logging
import numpy as np
from scipy.ndimage.filters import convolve
from PIL import Image, ImageFilter
from terrautils.formats import create_geo... | [
"logging.getLogger",
"PIL.Image.fromarray",
"numpy.fromfile",
"terrautils.formats.create_geotiff",
"numpy.asarray",
"numpy.count_nonzero",
"numpy.array",
"numpy.zeros",
"scipy.ndimage.filters.convolve",
"numpy.rot90",
"numpy.zeros_like"
] | [((333, 360), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (350, 360), False, 'import logging\n'), ((2746, 2763), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '(im)\n', (2759, 2763), True, 'import numpy as np\n'), ((2772, 2789), 'numpy.zeros_like', 'np.zeros_like', (['im'], {}), '... |
import pprint
import xml.etree.ElementTree as ET
class Utils():
def printDict(self, dict):
pp = pprint.PrettyPrinter(indent=4, compact=False)
pp.pprint(dict)
def printETree(self, eTree):
#print(ET.tostring(eTree, encoding='utf8', method='xml'))
print(ET.tostring(eTree, encoding... | [
"xml.etree.ElementTree.tostring",
"pprint.PrettyPrinter"
] | [((109, 154), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)', 'compact': '(False)'}), '(indent=4, compact=False)\n', (129, 154), False, 'import pprint\n'), ((293, 345), 'xml.etree.ElementTree.tostring', 'ET.tostring', (['eTree'], {'encoding': '"""unicode"""', 'method': '"""xml"""'}), "(eTree, enc... |
import collections
import functools
import operator
class Node:
name = "Node"
@property
def children(self):
return self._children
def __init__(self, template, dto):
self.template = template
self.dto = dto
self.parent = None
self.siblings = []
self._chi... | [
"functools.reduce"
] | [((874, 919), 'functools.reduce', 'functools.reduce', (['operator.add', 'self.children'], {}), '(operator.add, self.children)\n', (890, 919), False, 'import functools\n')] |
import os
import sqlite3
import json
import datetime
from shutil import copyfile
from werkzeug._compat import iteritems, to_bytes, to_unicode
from jam.third_party.filelock import FileLock
import jam
LANG_FIELDS = ['id', 'f_name', 'f_language', 'f_country', 'f_abr', 'f_rtl']
LOCALE_FIELDS = [
'f_decimal_point', 'f... | [
"os.path.exists",
"json.loads",
"werkzeug._compat.to_unicode",
"locale.setlocale",
"json.dumps",
"os.path.join",
"os.path.dirname",
"datetime.datetime.now",
"locale.nl_langinfo",
"werkzeug._compat.iteritems",
"locale.localeconv"
] | [((679, 722), 'os.path.join', 'os.path.join', (['task.work_dir', '"""langs.sqlite"""'], {}), "(task.work_dir, 'langs.sqlite')\n", (691, 722), False, 'import os\n'), ((4379, 4414), 'locale.setlocale', 'locale.setlocale', (['locale.LC_ALL', '""""""'], {}), "(locale.LC_ALL, '')\n", (4395, 4414), False, 'import locale\n'),... |
import discord
import os
import json
import datetime
import asyncio
import time
import traceback
import sys
from discord.ext import commands
cwd = os.path.dirname(__file__)
jsonPath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "config2.json")
config = json.loads(open(jsonPath, "r").read())
roleD... | [
"discord.ext.commands.Cog.listener",
"discord.ext.commands.has_permissions",
"os.path.dirname",
"datetime.datetime.now",
"asyncio.sleep",
"os.path.abspath",
"discord.Embed",
"discord.ext.commands.command"
] | [((149, 174), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (164, 174), False, 'import os\n'), ((1076, 1099), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (1097, 1099), False, 'from discord.ext import commands\n'), ((1963, 1986), 'discord.ext.commands.Cog.l... |
"""Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dis... | [
"utils.format_data",
"random.randint",
"bitstring.BitArray"
] | [((1323, 1345), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (1337, 1345), False, 'import random\n'), ((1394, 1428), 'bitstring.BitArray', 'BitArray', ([], {'uint': 'temp_data', 'length': '(8)'}), '(uint=temp_data, length=8)\n', (1402, 1428), False, 'from bitstring import BitArray, BitStrea... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from faker import Faker
import random
import logging
import time
import json
import os
faker = Faker("zh-CN")
# print("尝试连接mongodb数据库...")
#
# client = pymongo.MongoClient(host="localhost", port=20000)
# db = client.testdb
#
# print("连接数据库成功.")
#
# col =... | [
"faker.Faker",
"random.randint"
] | [((151, 165), 'faker.Faker', 'Faker', (['"""zh-CN"""'], {}), "('zh-CN')\n", (156, 165), False, 'from faker import Faker\n'), ((593, 615), 'random.randint', 'random.randint', (['(15)', '(60)'], {}), '(15, 60)\n', (607, 615), False, 'import random\n')] |
import pytest
@pytest.mark.skip("ipv4 device tests are available")
def test_device_ipv4_fixed(api, utils):
"""Test the creation of ipv4 fixed properties"""
port = utils.settings.ports[0]
config = api.config()
port1 = config.ports.port()[-1]
port1.location = port
port1.name = "port 1"
dev =... | [
"pytest.mark.skip"
] | [((17, 68), 'pytest.mark.skip', 'pytest.mark.skip', (['"""ipv4 device tests are available"""'], {}), "('ipv4 device tests are available')\n", (33, 68), False, 'import pytest\n'), ((691, 742), 'pytest.mark.skip', 'pytest.mark.skip', (['"""ipv4 device tests are available"""'], {}), "('ipv4 device tests are available')\n"... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from .feature_bert_qa import BertQaDataBuilder
class EbertQaDataBuilder(BertQaDataBuilder):
TASK_FEATURES = ('feature_id', 'question_ids', 'context_ids')
def __init__(self, config):
super().__init__(config)
self.max_first_length = config.max_fir... | [
"common.tf.io.FixedLenFeature"
] | [((1544, 1579), 'common.tf.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['[]', 'tf.int64'], {}), '([], tf.int64)\n', (1565, 1579), False, 'from common import tf\n'), ((1609, 1656), 'common.tf.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['[max_q_length]', 'tf.int64'], {}), '([max_q_length], tf.int64)\n', (1630, 165... |
# Copyright (c) 2012-2015 Netforce Co. Ltd.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publ... | [
"json.loads",
"requests.post",
"os.unlink",
"requests.put",
"re.search"
] | [((1761, 1792), 'requests.post', 'requests.post', (['url'], {'data': 'params'}), '(url, data=params)\n', (1774, 1792), False, 'import requests\n'), ((1839, 1859), 'json.loads', 'json.loads', (['res.text'], {}), '(res.text)\n', (1849, 1859), False, 'import json\n'), ((2072, 2087), 'os.unlink', 'os.unlink', (['path'], {}... |
from rest_framework import serializers
from modules.achievements.models import UserAchievement
class UserAchievementSerializer(serializers.ModelSerializer):
metadata = serializers.JSONField(source='achievement.metadata', read_only=True)
class Meta:
model = UserAchievement
fields = ('id', 'or... | [
"rest_framework.serializers.JSONField"
] | [((175, 243), 'rest_framework.serializers.JSONField', 'serializers.JSONField', ([], {'source': '"""achievement.metadata"""', 'read_only': '(True)'}), "(source='achievement.metadata', read_only=True)\n", (196, 243), False, 'from rest_framework import serializers\n')] |
# Data uploader for workflow automation using Agave v2 for actors and file upload.
import json
from agavepy import Agave
import pickle
import random
import sys
import time
import os
from os.path import join, isdir, isfile, relpath, basename, realpath, dirname
from multiprocessing import cpu_count
from multi... | [
"multiprocessing.cpu_count",
"agavepy.Agave",
"os.walk",
"os.remove",
"threading.Lock",
"traceback.print_exception",
"multiprocessing.pool.ThreadPool",
"os.path.isdir",
"os.mkdir",
"os.path.relpath",
"random.uniform",
"pickle.load",
"requests.get",
"os.path.isfile",
"shutil.copyfile",
... | [((1195, 1206), 'time.time', 'time.time', ([], {}), '()\n', (1204, 1206), False, 'import time\n'), ((2053, 2064), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (2062, 2064), False, 'from multiprocessing import cpu_count\n'), ((6454, 6476), 'agavepy.Agave', 'Agave', ([], {}), '(**agave_options)\n', (6459, ... |
from django.contrib import admin
from jobs.models import JobOffer
admin.site.register(JobOffer)
| [
"django.contrib.admin.site.register"
] | [((67, 96), 'django.contrib.admin.site.register', 'admin.site.register', (['JobOffer'], {}), '(JobOffer)\n', (86, 96), False, 'from django.contrib import admin\n')] |
import os
# Define available genres for training
GENRES = {
16: 'Animation',
35: 'Comedy',
10751: 'Family',
12: 'Adventure',
14: 'Fantasy',
10749: 'Romance',
18: 'Drama',
28: 'Action',
80: 'Crime',
53: 'Thriller',
27: 'Horror',
36: 'History',
878: 'Science Fiction'... | [
"os.path.join"
] | [((607, 639), 'os.path.join', 'os.path.join', (['"""model"""', '"""encoder"""'], {}), "('model', 'encoder')\n", (619, 639), False, 'import os\n'), ((658, 723), 'os.path.join', 'os.path.join', (['"""data"""', '"""the-movies-dataset"""', '"""movies_metadata.csv"""'], {}), "('data', 'the-movies-dataset', 'movies_metadata.... |
import hashlib
import json
from time import time
from textwrap import dedent
from uuid import uuid4
from flask import Flask, jsonify, request
class Blockchain(object):
def __init__(self):
self.chain = []
self.current_transactions = []
self.new_block(previous_hash=1, proof=100);
def ne... | [
"hashlib.sha256",
"flask.Flask",
"json.dumps",
"uuid.uuid4",
"flask.request.get_json",
"time.time",
"flask.jsonify"
] | [((1606, 1621), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1611, 1621), False, 'from flask import Flask, jsonify, request\n'), ((2489, 2507), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (2505, 2507), False, 'from flask import Flask, jsonify, request\n'), ((2379, 2396), 'flask.jsoni... |
# Copyright 2017 <NAME>
#
# Licensed under the MIT License. If the LICENSE file is missing, you
# can find the MIT license terms here: https://opensource.org/licenses/MIT
from datetime import datetime
from flask import abort, current_app, flash, make_response
from flask import render_template, request, url_for
from . ... | [
"flask.render_template",
"flask.abort",
"flask.request.environ.get"
] | [((391, 420), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (406, 420), False, 'from flask import render_template, request, url_for\n'), ((545, 592), 'flask.request.environ.get', 'request.environ.get', (['"""werkzeug.server.shutdown"""'], {}), "('werkzeug.server.shutdown')\... |
import os.path as osp
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from mmdet.core import BitmapMasks, PolygonMasks
from ..builder import PIPELINES
@PIPELINES.register_module()
class Stack:
def __init__(self):
pass
def __call__(self, results):
"""Call functions to lo... | [
"numpy.concatenate"
] | [((610, 649), 'numpy.concatenate', 'np.concatenate', (['[img, img, img]'], {'axis': '(2)'}), '([img, img, img], axis=2)\n', (624, 649), True, 'import numpy as np\n')] |
#!/usr/bin/python2
try:
import gi
gi.require_version('NumCosmo', '1.0')
gi.require_version('NumCosmoMath', '1.0')
except:
pass
import math
import numpy as np
import matplotlib.pyplot as plt
from gi.repository import GObject
from gi.repository import NumCosmo as Nc
from gi.repository import NumCosmoMath as Nc... | [
"gi.repository.NumCosmo.HIReionCamb.new",
"gi.repository.NumCosmoMath.cfg_init",
"matplotlib.pyplot.savefig",
"gi.repository.NumCosmo.HICosmo.new_from_name",
"gi.repository.NumCosmo.CBE.prec_new",
"gi.repository.NumCosmoMath.Vector.new",
"matplotlib.pyplot.ylabel",
"gi.repository.NumCosmo.HIPrimPowerL... | [((422, 436), 'gi.repository.NumCosmoMath.cfg_init', 'Ncm.cfg_init', ([], {}), '()\n', (434, 436), True, 'from gi.repository import NumCosmoMath as Ncm\n'), ((551, 574), 'gi.repository.NumCosmo.HIPrimPowerLaw.new', 'Nc.HIPrimPowerLaw.new', ([], {}), '()\n', (572, 574), True, 'from gi.repository import NumCosmo as Nc\n'... |
# import the libraries
from guizero import App, Text, PushButton, Slider, Window
from gpiozero import Robot, LED, AngularServo
from gpiozero.pins.pigpio import PiGPIOFactory
# Define the app
robot_movement = App("Linus Movement")
servo_window = Window(app, "Servo Control")
# Background color
robot_movement.bg = (88, 2... | [
"guizero.PushButton",
"guizero.App",
"guizero.Window",
"guizero.Slider",
"gpiozero.Robot",
"gpiozero.LED",
"guizero.Text",
"gpiozero.AngularServo",
"gpiozero.pins.pigpio.PiGPIOFactory"
] | [((209, 230), 'guizero.App', 'App', (['"""Linus Movement"""'], {}), "('Linus Movement')\n", (212, 230), False, 'from guizero import App, Text, PushButton, Slider, Window\n'), ((246, 274), 'guizero.Window', 'Window', (['app', '"""Servo Control"""'], {}), "(app, 'Servo Control')\n", (252, 274), False, 'from guizero impor... |
"""This module tests user creation and log in."""
import json
from test_api import ApiTestCase
from app.models import User
class TestUserAuth(ApiTestCase):
"""Test user authentication and registration."""
def test_user_register(self):
"""Test user registration."""
self.user = {'username': 'ma... | [
"json.loads",
"app.models.User"
] | [((500, 523), 'json.loads', 'json.loads', (['result.data'], {}), '(result.data)\n', (510, 523), False, 'import json\n'), ((800, 823), 'json.loads', 'json.loads', (['result.data'], {}), '(result.data)\n', (810, 823), False, 'import json\n'), ((1116, 1139), 'json.loads', 'json.loads', (['result.data'], {}), '(result.data... |
#!/usr/bin/env python3
import http.cookiejar
import requests.utils
from mylib.easy import *
from mylib.easy import fstk
class Constants:
netscape_http_cookie_file_header_string = '# Netscape HTTP Cookie File'
class UserAgentExamples:
"""https://www.networkinghowtos.com/howto/common-user-agent-list/"""
... | [
"mylib.easy.fstk.read_json_file"
] | [((3867, 3901), 'mylib.easy.fstk.read_json_file', 'fstk.read_json_file', (['json_filepath'], {}), '(json_filepath)\n', (3886, 3901), False, 'from mylib.easy import fstk\n')] |
import selenium_similar
from webapp.saving_to_database import *
import config
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config.from_pyfile('config.py')
app.config['SQLALCHEMY_DATABASE_URI'] = config.SQLALCHEMY_DATABASE_URI
db = SQLAlchemy(app)
def save_to_base():
i... | [
"flask_sqlalchemy.SQLAlchemy",
"selenium_similar.get_html",
"flask.Flask"
] | [((150, 165), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'from flask import Flask\n'), ((278, 293), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (288, 293), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((326, 376), 'selenium_similar.get_html', 'selen... |
from flask_wtf import Form
from wtforms import StringField, TextAreaField, SubmitField
from wtforms.validators import DataRequired
class SubmitIssueForm(Form):
subject = StringField("Subject", validators=[DataRequired()])
body = TextAreaField("Body", validators=[DataRequired()])
logs = TextAreaField("Appl... | [
"wtforms.SubmitField",
"wtforms.validators.DataRequired",
"wtforms.TextAreaField"
] | [((301, 338), 'wtforms.TextAreaField', 'TextAreaField', (['"""Applicable Chat Logs"""'], {}), "('Applicable Chat Logs')\n", (314, 338), False, 'from wtforms import StringField, TextAreaField, SubmitField\n'), ((353, 386), 'wtforms.SubmitField', 'SubmitField', ([], {'label': '"""Submit Issue"""'}), "(label='Submit Issue... |
from django.urls import path
from blog import views
urlpatterns = [
path('', views.home, name='home'),
path('post/', views.post, name='post'),
path('post/add/', views.new_post, name='new_post'),
path('post/<slug:title>/', views.post_detail, name='post_detail'),
path('post/<slug:title>/edit/', views... | [
"django.urls.path"
] | [((73, 106), 'django.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (77, 106), False, 'from django.urls import path\n'), ((112, 150), 'django.urls.path', 'path', (['"""post/"""', 'views.post'], {'name': '"""post"""'}), "('post/', views.post, name='post')\n", (... |
from ctypes import *
import pylightnet as ln
class compiler(object):
def __init__(self, source, target, outfile='out.json', options=[]):
argv = ['', '-c', '-t', target, '-o', outfile, source] + options
self.option = ln.option.create(ln.lib.str_array(argv))
ln.msg.init(self.option)
l... | [
"pylightnet.option.get_outfile",
"pylightnet.name.cleanup",
"pylightnet.msg.init",
"pylightnet.option.get_target",
"pylightnet.msg.cleanup",
"pylightnet.option.free",
"pylightnet.option.get_source",
"pylightnet.context.free",
"pylightnet.name.init",
"pylightnet.lib.str_array",
"pylightnet.arch.c... | [((286, 310), 'pylightnet.msg.init', 'ln.msg.init', (['self.option'], {}), '(self.option)\n', (297, 310), True, 'import pylightnet as ln\n'), ((319, 333), 'pylightnet.arch.init', 'ln.arch.init', ([], {}), '()\n', (331, 333), True, 'import pylightnet as ln\n'), ((342, 356), 'pylightnet.name.init', 'ln.name.init', ([], {... |
from ..Helpers.Singleton import Singleton
from .Network import Network
import random
class ReuseNetworks(Network,metaclass=Singleton):
number_networks = 100 # TODO: this sould be configurable
networks = []
last = -1
def __init__(self, n, incremental = False):
self.per_state ... | [
"random.randint"
] | [((790, 833), 'random.randint', 'random.randint', (['(0)', '(self.number_networks - 1)'], {}), '(0, self.number_networks - 1)\n', (804, 833), False, 'import random\n')] |
#from bs4 import BeautifulSoup
from pprint import pprint
from bs4 import BeautifulSoup
import requests
import urllib2
import re
'''
info = 'http://codeforces.com/api/user.status?handle=tacklemore&from=1&count=1'
solution = 'view-source:http://codeforces.com/contest/686/submission/18671530'
do not include problems wi... | [
"bs4.BeautifulSoup",
"requests.get",
"re.search"
] | [((400, 417), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (412, 417), False, 'import requests\n'), ((576, 618), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html_content', '"""html.parser"""'], {}), "(html_content, 'html.parser')\n", (589, 618), False, 'from bs4 import BeautifulSoup\n'), ((849, 899), 're.sear... |
"""
1.初始化数据和模型
1.1解析dicom文件
1.2加载model和模型权重
2.预测ED ES
2.1数据输入给Siamese-model,输出n*2的tensor
2.2n*2的tensor输入给后处理算法-->ED ES
3.预测结构参数
3.1ED ES 输入给seg-model
3.2分割后的mask通过后处理方法得到height area
3.3如果单个视角则直接计算volume,如果两个视角则通过simpson方法计算volume
3.4计算EF
4.plot—figure and visualization
"""
from postproc... | [
"cv2.imwrite",
"postprocess.cardiac_parameter.cmpt_single_volum_",
"os.path.exists",
"plot_tool.visualization.window",
"plot_tool.visualization.putTextIntoImg",
"preprocess.interpretDicom.parse_scale",
"model.u_net.u_net",
"preprocess.interpretDicom.interpretDicom",
"model.load_Comparison_model.load... | [((620, 727), 'model.load_Comparison_model.load_model', 'load_Comparison_model.load_model', ([], {'input_size': '(128)', 'load_weight': '(True)', 'weight_path': '"""model_weight/a4c.hdf5"""'}), "(input_size=128, load_weight=True,\n weight_path='model_weight/a4c.hdf5')\n", (652, 727), False, 'from model import load_C... |
from typing import Optional, Tuple
from random import uniform
from kivy.app import App
from kivy.core.window import Window
from kivy.graphics import BorderImage
from kivy.graphics.texture import Texture
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.floatlayout import FloatLayout
from kivy.uix.widget import W... | [
"random.uniform",
"kivy.uix.floatlayout.FloatLayout",
"kivy.graphics.BorderImage"
] | [((1119, 1212), 'kivy.graphics.BorderImage', 'BorderImage', ([], {'size': 'self.size', 'pos': 'self.pos', 'border': 'border_tuple', 'texture': 'border_image_tex'}), '(size=self.size, pos=self.pos, border=border_tuple, texture=\n border_image_tex)\n', (1130, 1212), False, 'from kivy.graphics import BorderImage\n'), (... |
from .ni_task_wrap import NI_TaskWrap
from .ni_adc_task import NI_AdcTask
from .ni_dac_task import NI_DacTask
from .ni_counter_task import NI_CounterTask
import PyDAQmx as mx
import numpy as np
import logging
logger = logging.getLogger(__name__)
class NI_SyncTaskSet(object):
'''
creates simultaneous input ... | [
"logging.getLogger",
"PyDAQmx.create_string_buffer"
] | [((220, 247), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (237, 247), False, 'import logging\n'), ((1728, 1761), 'PyDAQmx.create_string_buffer', 'mx.create_string_buffer', (['buffSize'], {}), '(buffSize)\n', (1751, 1761), True, 'import PyDAQmx as mx\n')] |
# Reference:
# https://github.com/aws/aws-xray-sdk-python/blob/aed8e43fc03e68c0d012a6a6e11a2e859b0bf247/tests/util.py
import threading
from aws_xray_sdk.core.emitters.udp_emitter import UDPEmitter
from aws_xray_sdk.core.recorder import AWSXRayRecorder
from aws_xray_sdk.core.sampling.sampler import DefaultSampler
from... | [
"threading.local",
"aws_xray_sdk.core.recorder.AWSXRayRecorder",
"aws_xray_sdk.core.async_recorder.AsyncAWSXRayRecorder"
] | [((541, 558), 'threading.local', 'threading.local', ([], {}), '()\n', (556, 558), False, 'import threading\n'), ((1065, 1082), 'aws_xray_sdk.core.recorder.AWSXRayRecorder', 'AWSXRayRecorder', ([], {}), '()\n', (1080, 1082), False, 'from aws_xray_sdk.core.recorder import AWSXRayRecorder\n'), ((1186, 1208), 'aws_xray_sdk... |
from comdaan import parse_issues, parse_mail, parse_repositories
from comdaan import network, Network
import os
PATH_TO_RESOURCES = os.path.join(os.path.dirname(__file__), "resources/")
def test_network_return_type():
repo = PATH_TO_RESOURCES + "repo"
if not os.listdir(repo):
raise Exception("Empty g... | [
"comdaan.network",
"os.listdir",
"comdaan.parse_issues",
"comdaan.parse_repositories",
"comdaan.parse_mail",
"os.path.dirname"
] | [((146, 171), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (161, 171), False, 'import os\n'), ((380, 404), 'comdaan.parse_repositories', 'parse_repositories', (['repo'], {}), '(repo)\n', (398, 404), False, 'from comdaan import parse_issues, parse_mail, parse_repositories\n'), ((675, 699), '... |
from bs4 import BeautifulSoup
from locust import TaskSet
import config
class UzTaskSet(TaskSet):
def request_resources(self, response=None):
"""
Parse HTML response content to extract resource urls (javascript
and css) and request those resources from the host.
Args:
... | [
"bs4.BeautifulSoup"
] | [((391, 437), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""html.parser"""'], {}), "(response.content, 'html.parser')\n", (404, 437), False, 'from bs4 import BeautifulSoup\n')] |
import sys
def prompt(msg):
sys.stdout.write(msg)
sys.stdout.write(" ")
sys.stdout.flush()
return sys.stdin.readline().strip()
def ask(msg, defaultValue=None):
out = msg + " (%s):" % defaultValue
userInput = prompt(out)
if userInput:
return userInput
else:
return defaultValue | [
"sys.stdin.readline",
"sys.stdout.flush",
"sys.stdout.write"
] | [((31, 52), 'sys.stdout.write', 'sys.stdout.write', (['msg'], {}), '(msg)\n', (47, 52), False, 'import sys\n'), ((55, 76), 'sys.stdout.write', 'sys.stdout.write', (['""" """'], {}), "(' ')\n", (71, 76), False, 'import sys\n'), ((79, 97), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (95, 97), False, 'import... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import classifier_pb2 as classifier__pb2
class ClassifierStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((1364, 1435), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""Classifier"""', 'rpc_method_handlers'], {}), "('Classifier', rpc_method_handlers)\n", (1400, 1435), False, 'import grpc\n'), ((1085, 1313), 'grpc.unary_unary_rpc_method_handler', 'grpc.unary_unary_rpc_method_handler', ... |
# -*- coding: UTF-8 -*-
import cv2
import numpy as np
import matplotlib.pyplot as plt
# 读取图像添加文字(可用于图像添加水印)
def img_channel(imgPath):
img=cv2.imread(imgPath,cv2.IMREAD_COLOR) # 打开文件
cv2.imshow('Original_img',img )
font = cv2.FONT_HERSHEY_DUPLEX # 设置字体
img_word = cv2.putText(img, "li... | [
"cv2.putText",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.imread"
] | [((147, 184), 'cv2.imread', 'cv2.imread', (['imgPath', 'cv2.IMREAD_COLOR'], {}), '(imgPath, cv2.IMREAD_COLOR)\n', (157, 184), False, 'import cv2\n'), ((198, 229), 'cv2.imshow', 'cv2.imshow', (['"""Original_img"""', 'img'], {}), "('Original_img', img)\n", (208, 229), False, 'import cv2\n'), ((300, 361), 'cv2.putText', '... |
from speculator.features.RSI import RSI
import unittest
class RSITest(unittest.TestCase):
def test_eval_rs(self):
gains = [0.07, 0.73, 0.51, 0.28, 0.34, 0.43, 0.25, 0.15, 0.68, 0.24]
losses = [0.23, 0.53, 0.18, 0.40]
self.assertAlmostEqual(RSI.eval_rs(gains, losses), 2.746, places=3)
d... | [
"speculator.features.RSI.RSI.eval_algorithm",
"speculator.features.RSI.RSI.eval_rs"
] | [((269, 295), 'speculator.features.RSI.RSI.eval_rs', 'RSI.eval_rs', (['gains', 'losses'], {}), '(gains, losses)\n', (280, 295), False, 'from speculator.features.RSI import RSI\n'), ((500, 533), 'speculator.features.RSI.RSI.eval_algorithm', 'RSI.eval_algorithm', (['gains', 'losses'], {}), '(gains, losses)\n', (518, 533)... |
#!/usr/bin/env python3
import pickle
import os
import numpy as np
def get_sweep_parameters(parameters, env_config, index):
"""
Gets the parameters for the hyperparameter sweep defined by the index.
Each hyperparameter setting has a specific index number, and this function
will get the appropriate par... | [
"numpy.sqrt",
"pickle.dump",
"numpy.ones",
"pickle.load",
"os.path.join",
"numpy.argsort",
"numpy.array",
"numpy.stack",
"numpy.std"
] | [((7054, 7078), 'numpy.argsort', 'np.argsort', (['mean_returns'], {}), '(mean_returns)\n', (7064, 7078), True, 'import numpy as np\n'), ((13995, 14055), 'numpy.array', 'np.array', (["data['experiment']['agent']['parameters'][hp_name]"], {}), "(data['experiment']['agent']['parameters'][hp_name])\n", (14003, 14055), True... |
""" Module for image routines"""
from io import BytesIO
try:
from PIL import Image
except ImportError:
print("Warning: You need to install PIL to write SDSS cutout images")
try:
import requests
except ImportError:
print("Warning: You need to install requests to handle SDSS images")
from matplotlib im... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.text",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.clf",
"io.BytesIO",
"requests.get",
"matplotlib.pyplot.show"
] | [((538, 555), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (550, 555), False, 'import requests\n'), ((1142, 1151), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (1149, 1151), True, 'from matplotlib import pyplot as plt\n'), ((1156, 1263), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {'aspect... |
# Generated by Django 2.1.3 on 2019-01-30 07:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('modelchimp', '0043_machinelearningmodel_grid_search'),
]
operations = [
mi... | [
"django.db.models.OneToOneField",
"django.db.models.CharField"
] | [((424, 487), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '"""Unknown"""', 'max_length': '(200)'}), "(blank=True, default='Unknown', max_length=200)\n", (440, 487), False, 'from django.db import migrations, models\n'), ((608, 730), 'django.db.models.OneToOneField', 'models.OneT... |
# -*- coding:utf-8 -*-
# email:<EMAIL>
# create: 2020/12/4
import logging, os
logger = logging.getLogger("root")
log_formatter = logging.Formatter(fmt='%(asctime)s\t%(levelname)s\t%(name)s '
'%(filename)s:%(lineno)s - %(message)s', datefmt='%Y-%m-%d %H:%M:%S')
logging.basicConf... | [
"logging.getLogger",
"logging.basicConfig",
"logging.Formatter",
"os.path.isfile",
"logging.FileHandler"
] | [((89, 114), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (106, 114), False, 'import logging, os\n'), ((132, 270), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': '"""%(asctime)s\t%(levelname)s\t%(name)s %(filename)s:%(lineno)s - %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"... |
import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt
# read Excel
df = pd.read_excel('xacts.xlsx', sheetname='All Transactions')
# Sort types
df['Date'] = pd.to_datetime(df['Date'])
df['Inflow'] = pd.to_numeric(df['Inflow'])
df['Outflow'] = pd.to_numeric(df['Outflow'])
df['Net'] = pd... | [
"pandas.pivot_table",
"pandas.to_numeric",
"pandas.to_datetime",
"pandas.read_excel"
] | [((106, 163), 'pandas.read_excel', 'pd.read_excel', (['"""xacts.xlsx"""'], {'sheetname': '"""All Transactions"""'}), "('xacts.xlsx', sheetname='All Transactions')\n", (119, 163), True, 'import pandas as pd\n'), ((191, 217), 'pandas.to_datetime', 'pd.to_datetime', (["df['Date']"], {}), "(df['Date'])\n", (205, 217), True... |
#!/usr/bin/env python3
import struct
layout = (
#key ,byte, descriptions
("登番" , 4 , "3415"),
("名前漢字" , 16 , "松井 繁"),
("名前カナ" , 15 , "<NAME>"),
("支部" , 4 , "大阪"),
("級" , 2... | [
"IPython.embed"
] | [((8302, 8317), 'IPython.embed', 'IPython.embed', ([], {}), '()\n', (8315, 8317), False, 'import IPython\n')] |
from wtforms import Form, BooleanField, RadioField, StringField, PasswordField, validators, IntegerField, Field, \
SubmitField
from wtforms.fields.html5 import EmailField
class RegistrationForm(Form):
email = EmailField('Email (username)', [validators.Length(min=6, max=50),
... | [
"wtforms.validators.NumberRange",
"wtforms.Form.__init__",
"wtforms.validators.Email",
"wtforms.Form.validate",
"wtforms.PasswordField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.Optional",
"wtforms.validators.Length",
"wtforms.validators.DataRequired"
] | [((610, 643), 'wtforms.PasswordField', 'PasswordField', (['"""Confirm Password"""'], {}), "('Confirm Password')\n", (623, 643), False, 'from wtforms import Form, BooleanField, RadioField, StringField, PasswordField, validators, IntegerField, Field, SubmitField\n'), ((1528, 1551), 'wtforms.SubmitField', 'SubmitField', (... |
from magpie import Magpie
import time
count = 10
magpie = Magpie()
while (count <= 500):
start = time.clock()
magpie.train_word2vec('data/hep-categories', vec_dim=count)
magpie.save_word2vec_model('save/embeddings/here'+str(count), overwrite=True)
end = time.clock()
runtime = end - start
print(... | [
"time.clock",
"magpie.Magpie"
] | [((59, 67), 'magpie.Magpie', 'Magpie', ([], {}), '()\n', (65, 67), False, 'from magpie import Magpie\n'), ((102, 114), 'time.clock', 'time.clock', ([], {}), '()\n', (112, 114), False, 'import time\n'), ((271, 283), 'time.clock', 'time.clock', ([], {}), '()\n', (281, 283), False, 'import time\n')] |
"""
Plot figure 4A, the results of swapping tissue types between cancer types
and the effect on the performance of svMIL2.
"""
## for eah cancer type, get the performance from all swap folders
import os
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
#Names of the cancer... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"seaborn.heatmap",
"os.path.isfile",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"pandas.DataFrame",
"numpy.loadtxt"
] | [((3141, 3167), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 5)'}), '(figsize=(5, 5))\n', (3151, 3167), True, 'import matplotlib.pyplot as plt\n'), ((3175, 3217), 'pandas.DataFrame', 'pd.DataFrame', (['differencesAcrossCancerTypes'], {}), '(differencesAcrossCancerTypes)\n', (3187, 3217), True, 'impor... |