code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('home', views.home, name='home'),
path('login', views.ulogin, name='login'),
path('logout', views.ulogout, name='logout'),
path('password_change', views.password_change, name='password_change... | [
"django.urls.path"
] | [((71, 106), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (75, 106), False, 'from django.urls import path\n'), ((112, 149), 'django.urls.path', 'path', (['"""home"""', 'views.home'], {'name': '"""home"""'}), "('home', views.home, name='home')\n",... |
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from sklearn.ensemble import RandomForestClassifier
from sklearn.metrics import f1_score
from sklearn.metrics import accuracy_score, confusi... | [
"sklearn.model_selection.train_test_split",
"sklearn.ensemble.RandomForestClassifier",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"sklearn.tree.plot_tree",
"numpy.genfromtxt",
"sklearn.metrics.accuracy_score",
"numpy.random.shuffle"
] | [((613, 630), 'numpy.random.seed', 'np.random.seed', (['(7)'], {}), '(7)\n', (627, 630), True, 'import numpy as np\n'), ((657, 736), 'numpy.genfromtxt', 'np.genfromtxt', (['"""covid_filtered_1-5_allMin3.csv"""'], {'delimiter': '""","""', 'encoding': '"""utf8"""'}), "('covid_filtered_1-5_allMin3.csv', delimiter=',', enc... |
'''
Micro Object Detector Net
the author:Luis
date : 11.25
'''
import os
import torch
import torch.nn as nn
import torch.nn.functional as F
from layers import *
from models.base_models import vgg, vgg_base
from ptflops import get_model_complexity_info
class BasicConv(nn.Module):
def __init__(self, in_planes, ou... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.Softmax",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.no_grad",
"ptflops.get_model_complexity_info"
] | [((585, 723), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'padding': 'padding', 'dilation': 'dilation', 'groups': 'groups', 'bias': 'bias'}), '(in_planes, out_planes, kernel_size=kernel_size, stride=stride,\n padding=padding, dilation=dilation, gro... |
import binascii
def print_stream(stream, description):
stream.seek(0)
data = stream.read()
print('***' + description + '***')
print(data)
stream.seek(0)
def test_message(encoding='ascii', hex_bitmap=False):
binary_bitmap = b'\xF0\x10\x05\x42\x84\x61\x80\x02\x02\x00\x00\x04\x00\x00\x00\x00'
... | [
"binascii.hexlify"
] | [((382, 413), 'binascii.hexlify', 'binascii.hexlify', (['binary_bitmap'], {}), '(binary_bitmap)\n', (398, 413), False, 'import binascii\n')] |
# Allow tests/ directory to see faster_than_requests/ package on PYTHONPATH
import sys
from pathlib import Path
sys.path.append(str(Path(__file__).parent.parent))
| [
"pathlib.Path"
] | [((132, 146), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (136, 146), False, 'from pathlib import Path\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.conf import settings
from django.http.response import HttpResponse
from django.views.generic import View
class HealthCheckView(View):
def get(self, request, *args, **kwargs):
return HttpResponse(settings.HEALTH_C... | [
"django.http.response.HttpResponse"
] | [((290, 342), 'django.http.response.HttpResponse', 'HttpResponse', (['settings.HEALTH_CHECK_BODY'], {'status': '(200)'}), '(settings.HEALTH_CHECK_BODY, status=200)\n', (302, 342), False, 'from django.http.response import HttpResponse\n')] |
from assertpy import assert_that
import year2020.day21.reader as reader
def test_example():
lines = ['mxmxvkd kfcds sqjhc nhms (contains dairy, fish)\n',
'trh fvjkl sbzzf mxmxvkd (contains dairy)\n',
'sqjhc fvjkl (contains soy)\n',
'sqjhc mxmxvkd sbzzf (contains fish)\n']
... | [
"assertpy.assert_that",
"year2020.day21.reader.read_lines"
] | [((332, 356), 'year2020.day21.reader.read_lines', 'reader.read_lines', (['lines'], {}), '(lines)\n', (349, 356), True, 'import year2020.day21.reader as reader\n'), ((361, 380), 'assertpy.assert_that', 'assert_that', (['result'], {}), '(result)\n', (372, 380), False, 'from assertpy import assert_that\n')] |
from .test_utils import (
BaseManagerTestCase,
skip_unless_module
)
from pulsar.managers.queued_drmaa import DrmaaQueueManager
class DrmaaManagerTest(BaseManagerTestCase):
def setUp(self):
super(DrmaaManagerTest, self).setUp()
self._set_manager()
def tearDown(self):
super(Dr... | [
"pulsar.managers.queued_drmaa.DrmaaQueueManager"
] | [((442, 490), 'pulsar.managers.queued_drmaa.DrmaaQueueManager', 'DrmaaQueueManager', (['"""_default_"""', 'self.app'], {}), "('_default_', self.app, **kwds)\n", (459, 490), False, 'from pulsar.managers.queued_drmaa import DrmaaQueueManager\n')] |
import dico_command
class Basic(dico_command.Addon):
@dico_command.command("ping")
async def ping(self, ctx: dico_command.Context):
await ctx.reply(f"Pong! {round(self.bot.ping*1000)}ms")
def load(bot: dico_command.Bot):
bot.load_addons(Basic)
def unload(bot: dico_command.Bot):
bot.unload_... | [
"dico_command.command"
] | [((60, 88), 'dico_command.command', 'dico_command.command', (['"""ping"""'], {}), "('ping')\n", (80, 88), False, 'import dico_command\n')] |
#!/usr/bin/env python3
from datetime import datetime, timezone, date
import os
import sys
import boto3
import logging
import json
#setup global logger
logger = logging.getLogger("SnapTool")
#set log level
LOGLEVEL = os.environ['LogLevel'].strip()
logger.setLevel(LOGLEVEL.upper())
logging.getLogger("botocore").setLeve... | [
"logging.getLogger",
"os.environ.keys",
"boto3.client",
"datetime.datetime.strptime",
"datetime.datetime.now",
"sys.exit",
"json.load",
"json.dump"
] | [((162, 191), 'logging.getLogger', 'logging.getLogger', (['"""SnapTool"""'], {}), "('SnapTool')\n", (179, 191), False, 'import logging\n'), ((369, 388), 'boto3.client', 'boto3.client', (['"""rds"""'], {}), "('rds')\n", (381, 388), False, 'import boto3\n'), ((11407, 11433), 'datetime.datetime.now', 'datetime.now', (['ti... |
import torch
from fielder import FieldClass
import yaml
class ModelBase(FieldClass, torch.nn.Module):
"""Base Model Class"""
class FCNet(ModelBase):
d_in: int = 10
H: int = 100
n_hidden: int = 1
D_out: int = 1
def __post_init__(self):
super().__post_init__()
self.input_linea... | [
"torch.nn.Softmax",
"torch.tensor",
"torch.einsum",
"torch.nn.Linear",
"torch.layer_norm"
] | [((324, 358), 'torch.nn.Linear', 'torch.nn.Linear', (['self.d_in', 'self.H'], {}), '(self.d_in, self.H)\n', (339, 358), False, 'import torch\n'), ((525, 560), 'torch.nn.Linear', 'torch.nn.Linear', (['self.H', 'self.D_out'], {}), '(self.H, self.D_out)\n', (540, 560), False, 'import torch\n'), ((1796, 1850), 'torch.nn.Li... |
import numpy as np
from pytope import Polytope
import matplotlib.pyplot as plt
np.random.seed(1)
# Create a polytope in R^2 with -1 <= x1 <= 4, -2 <= x2 <= 3
lower_bound1 = (-1, -2) # [-1, -2]' <= x
upper_bound1 = (4, 3) # x <= [4, 3]'
P1 = Polytope(lb=lower_bound1, ub=upper_bound1)
# Print the halfspace represen... | [
"matplotlib.pyplot.setp",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.title",
"numpy.sin",
"matplotlib.pyplot.plot",
"numpy.array",
"numpy.random.seed",
"matplotlib.pyplot.scatter",
"numpy.random.uniform",
"numpy.cos",
"matplotlib.pyplot.axis",
"pytope.Polytope",
"matplotlib.pyplot.subplots... | [((82, 99), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (96, 99), True, 'import numpy as np\n'), ((247, 289), 'pytope.Polytope', 'Polytope', ([], {'lb': 'lower_bound1', 'ub': 'upper_bound1'}), '(lb=lower_bound1, ub=upper_bound1)\n', (255, 289), False, 'from pytope import Polytope\n'), ((511, 555), 'n... |
#python libraries
import re
import os
# this package
from apetools.baseclass import BaseClass
from apetools.commons import enumerations
from apetools.commons import expressions
from apetools.commons.errors import ConfigurationError
MAC_UNAVAILABLE = "MAC Unavailable (use `netcfg`)"
class IfconfigError(Configuration... | [
"re.compile"
] | [((2047, 2069), 're.compile', 're.compile', (['expression'], {}), '(expression)\n', (2057, 2069), False, 'import re\n'), ((2604, 2626), 're.compile', 're.compile', (['expression'], {}), '(expression)\n', (2614, 2626), False, 'import re\n')] |
import retro # pip install gym-retro
import numpy as np # pip install numpy
import cv2 # pip install opencv-python
import neat # pip install neat-python
import pickle # pip install cloudpickle
class Worker(object):
def __init__(self, genome, config):
self.genome = genome
... | [
"pickle.dump",
"neat.StdOutReporter",
"neat.Population",
"numpy.reshape",
"neat.Config",
"neat.nn.FeedForwardNetwork.create",
"neat.Checkpointer.restore_checkpoint",
"neat.StatisticsReporter",
"numpy.ndarray.flatten",
"cv2.cvtColor",
"numpy.interp",
"neat.ParallelEvaluator",
"cv2.resize",
... | [((1918, 2050), 'neat.Config', 'neat.Config', (['neat.DefaultGenome', 'neat.DefaultReproduction', 'neat.DefaultSpeciesSet', 'neat.DefaultStagnation', '"""config-feedforward"""'], {}), "(neat.DefaultGenome, neat.DefaultReproduction, neat.\n DefaultSpeciesSet, neat.DefaultStagnation, 'config-feedforward')\n", (1929, 2... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
import time
import torch
import numpy as np
import torchvision
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from utils import *
from IPython import embed
class DCGAN(o... | [
"matplotlib.pyplot.ylabel",
"torch.cuda.is_available",
"numpy.save",
"os.path.exists",
"numpy.mean",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.mkdir",
"torch.randn",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.title",
"time.time",
"matplotlib.pyplot.legend",
"torch.full... | [((1189, 1201), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (1199, 1201), True, 'import torch.nn as nn\n'), ((3336, 3375), 'torch.randn', 'torch.randn', (['(64)', 'self.args.in_dim', '(1)', '(1)'], {}), '(64, self.args.in_dim, 1, 1)\n', (3347, 3375), False, 'import torch\n'), ((7981, 8008), 'matplotlib.pyplot.f... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# FSRobo-R Package BSDL
# ---------
# Copyright (C) 2019 FUJISOFT. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification,
# are permitted provided that the following conditions are met:
# 1. Redistributions of source code... | [
"socket.socket",
"json.dumps",
"time.sleep",
"json.JSONDecoder",
"socket.error"
] | [((1857, 1906), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1870, 1906), False, 'import socket\n'), ((1931, 1961), 'json.JSONDecoder', 'json.JSONDecoder', ([], {'strict': '(False)'}), '(strict=False)\n', (1947, 1961), False, 'import json\n... |
import unittest
from random import randint
from model.node import Node
from model.linked_list import LinkedList
SIZE = 5
class TestLinkedList(unittest.TestCase):
def test_copy(self):
nodes = []
for i in range(SIZE):
nodes.append(Node(i))
if i:
nodes[i - 1... | [
"unittest.main",
"random.randint",
"model.linked_list.LinkedList",
"model.node.Node"
] | [((1467, 1482), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1480, 1482), False, 'import unittest\n'), ((390, 406), 'random.randint', 'randint', (['(0)', 'SIZE'], {}), '(0, SIZE)\n', (397, 406), False, 'from random import randint\n'), ((530, 550), 'model.linked_list.LinkedList', 'LinkedList', (['nodes[0]'], {})... |
from pygments.lexer import RegexLexer, include, words
from pygments.token import *
# https://docs.nvidia.com/cuda/parallel-thread-execution/index.html
class CustomLexer(RegexLexer):
string = r'"[^"]*?"'
followsym = r'[a-zA-Z0-9_$]*'
identifier = r'(?:[a-zA-Z]' + followsym + r'| [_$%]' + followsym + r')'
... | [
"pygments.lexer.words",
"pygments.lexer.include"
] | [((366, 387), 'pygments.lexer.include', 'include', (['"""whitespace"""'], {}), "('whitespace')\n", (373, 387), False, 'from pygments.lexer import RegexLexer, include, words\n'), ((450, 471), 'pygments.lexer.include', 'include', (['"""definition"""'], {}), "('definition')\n", (457, 471), False, 'from pygments.lexer impo... |
# -*- coding: utf-8 -*-
"""Basic tests for state and entity relationships in dork
"""
import dork.types
from tests.utils import has_many, is_a
def test_items_exist():
"""the dork module should define an Item
"""
assert "Item" in vars(dork.types)
is_a(dork.types.Item, type)
def test_holders_exist():
... | [
"tests.utils.is_a",
"tests.utils.has_many"
] | [((264, 291), 'tests.utils.is_a', 'is_a', (['dork.types.Item', 'type'], {}), '(dork.types.Item, type)\n', (268, 291), False, 'from tests.utils import has_many, is_a\n'), ((419, 448), 'tests.utils.is_a', 'is_a', (['dork.types.Holder', 'type'], {}), '(dork.types.Holder, type)\n', (423, 448), False, 'from tests.utils impo... |
#!/usr/bin/env python2
# coding: utf-8
import sys
def main():
s = ' '.join((u'❄ ☃ ❄', sys.version.split()[0], u'❄ ☃ ❄'))
print(type(s))
return {'snowy_version': s}
if __name__ == '__main__':
main()
| [
"sys.version.split"
] | [((98, 117), 'sys.version.split', 'sys.version.split', ([], {}), '()\n', (115, 117), False, 'import sys\n')] |
import pytest
import cue
def test_basic():
cue.compile('')
assert '1' == str(cue.compile('1'))
assert ['1', '2', '3', '{\n\ta: 1\n}'] == [str(v) for v in cue.compile('[1,2,3,{a:1}]')]
assert [('a', '1'), ('b', '2')] == [(str(k), str(v)) for k, v in cue.compile('{a: 1, b: 2}')]
with pytest.raises(cue.CueErr... | [
"cue.loads",
"cue.compile",
"pytest.raises",
"cue.dumps"
] | [((48, 63), 'cue.compile', 'cue.compile', (['""""""'], {}), "('')\n", (59, 63), False, 'import cue\n'), ((353, 374), 'cue.compile', 'cue.compile', (['"""{a: 1}"""'], {}), "('{a: 1}')\n", (364, 374), False, 'import cue\n'), ((382, 403), 'cue.compile', 'cue.compile', (['"""{a: 2}"""'], {}), "('{a: 2}')\n", (393, 403), Fa... |
from mqfactory.tools import Policy, Rule, CATCH_ALL
def test_empty_policy():
p = Policy()
assert p.match({"something": "something"}) == CATCH_ALL
assert p.match({}) == CATCH_ALL
def test_policy():
p = Policy([
Rule({ "a": 1, "b": 1, "c": 1 }, "a=1,b=1,c=1" ),
Rule({ "a": 1, "b": 1, ... | [
"mqfactory.tools.Rule",
"mqfactory.tools.Policy"
] | [((84, 92), 'mqfactory.tools.Policy', 'Policy', ([], {}), '()\n', (90, 92), False, 'from mqfactory.tools import Policy, Rule, CATCH_ALL\n'), ((224, 269), 'mqfactory.tools.Rule', 'Rule', (["{'a': 1, 'b': 1, 'c': 1}", '"""a=1,b=1,c=1"""'], {}), "({'a': 1, 'b': 1, 'c': 1}, 'a=1,b=1,c=1')\n", (228, 269), False, 'from mqfac... |
from threading import Thread
num = 0
def do_sth():
global num
for i in range(1000000):
num += 1
adda()
addb()
def adda():
global num
num += 1
def addb():
global num
num += 1
t1 = Thread(target=do_sth)
t2 = Thread(target=do_sth)
t1.start()
t2.start()
t1.join()
t2.join()... | [
"threading.Thread"
] | [((228, 249), 'threading.Thread', 'Thread', ([], {'target': 'do_sth'}), '(target=do_sth)\n', (234, 249), False, 'from threading import Thread\n'), ((255, 276), 'threading.Thread', 'Thread', ([], {'target': 'do_sth'}), '(target=do_sth)\n', (261, 276), False, 'from threading import Thread\n')] |
# coding=utf-8
from builtins import input
from optparse import make_option
from django.core import exceptions
from django.utils.encoding import force_str
from django.conf import settings
from django.db.utils import IntegrityError
from django.core.management import call_command
from tenant_schemas.utils import get_ten... | [
"django.core.management.call_command",
"django.utils.encoding.force_str",
"bluebottle.members.models.Member.objects.create",
"optparse.make_option",
"bluebottle.utils.models.Language.objects.get_or_create",
"tenant_schemas.utils.get_tenant_model",
"django.db.connection.set_tenant"
] | [((6095, 6252), 'bluebottle.members.models.Member.objects.create', 'Member.objects.create', ([], {'first_name': '"""admin"""', 'last_name': '"""example"""', 'email': '"""<EMAIL>"""', 'password': 'password', 'is_active': '(True)', 'is_staff': '(True)', 'is_superuser': '(True)'}), "(first_name='admin', last_name='example... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.prod",
"objax.util.image.nhwc",
"objax.util.image.normalize_to_uint8",
"objax.util.image.nchw",
"io.BytesIO",
"jax.numpy.array",
"numpy.zeros",
"objax.util.image.to_png",
"objax.util.image.normalize_to_unit_float",
"unittest.main",
"numpy.arange"
] | [((3549, 3564), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3562, 3564), False, 'import unittest\n'), ((2080, 2094), 'numpy.arange', 'np.arange', (['(256)'], {}), '(256)\n', (2089, 2094), True, 'import numpy as np\n'), ((2107, 2150), 'objax.util.image.normalize_to_unit_float', 'objax.util.image.normalize_to_un... |
from __future__ import print_function
import sys
sys.path.append('./')
from colorprinter.pycolor import PyColor
from colorprinter.pycolor import cprint
@PyColor('ured')
def printer(string):
a = 1
b = 2
print(str((a + b)**4) + string)
class TestClass(object):
def test_pycolor(self):
printer('ed... | [
"colorprinter.pycolor.cprint",
"sys.path.append",
"colorprinter.pycolor.PyColor"
] | [((49, 70), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (64, 70), False, 'import sys\n'), ((154, 169), 'colorprinter.pycolor.PyColor', 'PyColor', (['"""ured"""'], {}), "('ured')\n", (161, 169), False, 'from colorprinter.pycolor import PyColor\n'), ((362, 393), 'colorprinter.pycolor.cprint', 'c... |
import itertools
from pm4py.objects.petri.petrinet import PetriNet
from da4py.main.objects.pnToFormulas import petri_net_to_SAT
from da4py.main.utils import variablesGenerator as vg, formulas
from da4py.main.utils.formulas import Or, And
from da4py.main.utils.unSat2qbfReader import writeQDimacs, cadetOutputQDimacs, r... | [
"da4py.main.utils.formulas.Or",
"da4py.main.utils.formulas.And",
"da4py.main.objects.pnToFormulas.petri_net_to_SAT",
"da4py.main.utils.unSat2qbfReader.runCadet",
"itertools.combinations",
"da4py.main.utils.variablesGenerator.VariablesGenerator",
"da4py.main.utils.unSat2qbfReader.writeQDimacs",
"pm4py.... | [((633, 656), 'da4py.main.utils.variablesGenerator.VariablesGenerator', 'vg.VariablesGenerator', ([], {}), '()\n', (654, 656), True, 'from da4py.main.utils import variablesGenerator as vg, formulas\n'), ((858, 1096), 'da4py.main.objects.pnToFormulas.petri_net_to_SAT', 'petri_net_to_SAT', (['net1', 'm01', 'mf1', 'vars',... |
#!/usr/bin/env python
# Copyright 2016 The Kubernetes Authors.
#
# 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... | [
"logging.basicConfig",
"os.path.exists",
"tarfile.open",
"argparse.ArgumentParser",
"subprocess.check_call",
"os.path.join",
"os.path.isdir",
"tempfile.mkdtemp",
"subprocess.call",
"os.path.commonprefix",
"shutil.rmtree",
"os.unlink"
] | [((932, 962), 'subprocess.call', 'subprocess.call', (['cmd'], {}), '(cmd, **kwargs)\n', (947, 962), False, 'import subprocess\n'), ((1040, 1066), 'subprocess.check_call', 'subprocess.check_call', (['cmd'], {}), '(cmd)\n', (1061, 1066), False, 'import subprocess\n'), ((2898, 2921), 'tarfile.open', 'tarfile.open', (['tf_... |
from src import mining
from tkinter import filedialog
from PyQt4 import QtGui
dir=filedialog.askdirectory()
direcciones, nomArchivo = mining.path(dir)
cont=mining.coincidencias(direcciones,nomArchivo)
for i in range(len(nomArchivo)):
print(nomArchivo[i],cont[i]) | [
"src.mining.coincidencias",
"tkinter.filedialog.askdirectory",
"src.mining.path"
] | [((82, 107), 'tkinter.filedialog.askdirectory', 'filedialog.askdirectory', ([], {}), '()\n', (105, 107), False, 'from tkinter import filedialog\n'), ((135, 151), 'src.mining.path', 'mining.path', (['dir'], {}), '(dir)\n', (146, 151), False, 'from src import mining\n'), ((158, 203), 'src.mining.coincidencias', 'mining.c... |
from django.db import models
from .utils import get_ip_from_request
class Ip(models.Model):
address = models.GenericIPAddressField(unique=True, db_index=True)
@classmethod
def get_or_create(cls, request):
raw_ip = get_ip_from_request(request)
if not raw_ip:
return None
... | [
"django.db.models.GenericIPAddressField"
] | [((109, 165), 'django.db.models.GenericIPAddressField', 'models.GenericIPAddressField', ([], {'unique': '(True)', 'db_index': '(True)'}), '(unique=True, db_index=True)\n', (137, 165), False, 'from django.db import models\n')] |
#! /usr/bin/env python3
# __author__ = "<NAME>"
# __credits__ = []
# __version__ = "0.2.1"
# __maintainer__ = "<NAME>"
# __email__ = "<EMAIL>"
# __status__ = "Prototype"
#
# Responsible for starting the required number of processes and threads
import threading
import time
from qs_backend.workers.... | [
"qs_backend.dal.user_stock_pref_dal.UserStockPrefDAL",
"qs_backend.publisher.publish_stock.PublishStock",
"time.sleep",
"qs_backend.workers.worker_fetch_stock.StockWorker",
"threading.Thread"
] | [((1326, 1386), 'threading.Thread', 'threading.Thread', ([], {'target': 'backend_process.start_stock_tickers'}), '(target=backend_process.start_stock_tickers)\n', (1342, 1386), False, 'import threading\n'), ((1424, 1437), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1434, 1437), False, 'import time\n'), ((1551,... |
from collections import Counter
from utils import read_bits
def run_part_one():
print("--------------------------------")
print("Advent of Code 2021 - 3 - Part 1")
bits = read_bits('input.txt')
gamma_rate = ""
epsilon_rate = ""
for x in range(len(bits[0])):
relevant_bits = get_relevan... | [
"collections.Counter",
"utils.read_bits"
] | [((186, 208), 'utils.read_bits', 'read_bits', (['"""input.txt"""'], {}), "('input.txt')\n", (195, 208), False, 'from utils import read_bits\n'), ((879, 896), 'collections.Counter', 'Counter', (['row_bits'], {}), '(row_bits)\n', (886, 896), False, 'from collections import Counter\n')] |
import os
import sys
import json
import time
import numpy as np
import tensorflow as tf
from blocks.helpers import Monitor
from blocks.helpers import visualize_samples, get_nonlinearity, int_shape, get_trainable_variables, broadcast_masks_np
from blocks.optimizers import adam_updates
import data.load_data as load_data
... | [
"numpy.split",
"numpy.load",
"blocks.helpers.broadcast_masks_np",
"numpy.concatenate"
] | [((4122, 4148), 'numpy.concatenate', 'np.concatenate', (['ds'], {'axis': '(0)'}), '(ds, axis=0)\n', (4136, 4148), True, 'import numpy as np\n'), ((4895, 4924), 'numpy.concatenate', 'np.concatenate', (['x_gen'], {'axis': '(0)'}), '(x_gen, axis=0)\n', (4909, 4924), True, 'import numpy as np\n'), ((974, 1001), 'numpy.spli... |
from nose.tools import *
from unittest.mock import patch, Mock
from rxaws.source.sourcebase import SourceBase
from botocore.client import BaseClient
class BaseClient(Mock):
""" mock boto BaseClient, won't really do anything"""
class TestSourceBase:
# inject the mock BaseClient
@patch('boto3.client', retu... | [
"botocore.client.BaseClient",
"rxaws.source.sourcebase.SourceBase"
] | [((607, 619), 'rxaws.source.sourcebase.SourceBase', 'SourceBase', ([], {}), '()\n', (617, 619), False, 'from rxaws.source.sourcebase import SourceBase\n'), ((330, 342), 'botocore.client.BaseClient', 'BaseClient', ([], {}), '()\n', (340, 342), False, 'from botocore.client import BaseClient\n')] |
import pytest
from checkout_sdk.events.events import RetrieveEventsRequest
from checkout_sdk.events.events_client import EventsClient
@pytest.fixture(scope='class')
def client(mock_sdk_configuration, mock_api_client):
return EventsClient(api_client=mock_api_client, configuration=mock_sdk_configuration)
class T... | [
"pytest.fixture",
"checkout_sdk.events.events_client.EventsClient",
"checkout_sdk.events.events.RetrieveEventsRequest"
] | [((138, 167), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (152, 167), False, 'import pytest\n'), ((232, 310), 'checkout_sdk.events.events_client.EventsClient', 'EventsClient', ([], {'api_client': 'mock_api_client', 'configuration': 'mock_sdk_configuration'}), '(api_client=mo... |
from __future__ import print_function
import os
import numpy as np
from tqdm import trange
from models import *
from utils import save_image
class Trainer(object):
def __init__(self, config, batch_manager):
tf.compat.v1.set_random_seed(config.random_seed)
self.config = config
self.batch_m... | [
"numpy.logical_and",
"numpy.average",
"numpy.where",
"os.path.join",
"numpy.logical_or",
"utils.save_image",
"numpy.sum",
"numpy.isnan",
"tqdm.trange"
] | [((6028, 6066), 'tqdm.trange', 'trange', (['self.start_step', 'self.max_step'], {}), '(self.start_step, self.max_step)\n', (6034, 6066), False, 'from tqdm import trange\n'), ((8716, 8758), 'os.path.join', 'os.path.join', (['self.model_dir', '"""model.ckpt"""'], {}), "(self.model_dir, 'model.ckpt')\n", (8728, 8758), Fal... |
from zerocopy import send_from
from socket import *
s = socket(AF_INET, SOCK_STREAM)
s.bind(('', 25000))
s.listen(1)
c,a = s.accept()
import numpy
a = numpy.arange(0.0, 50000000.0)
send_from(a, c)
c.close()
| [
"zerocopy.send_from",
"numpy.arange"
] | [((153, 182), 'numpy.arange', 'numpy.arange', (['(0.0)', '(50000000.0)'], {}), '(0.0, 50000000.0)\n', (165, 182), False, 'import numpy\n'), ((183, 198), 'zerocopy.send_from', 'send_from', (['a', 'c'], {}), '(a, c)\n', (192, 198), False, 'from zerocopy import send_from\n')] |
# Copyright (C) 2014, 2015 University of Vienna
# All rights reserved.
# BSD license.
# Author: <NAME> <<EMAIL>>
# Heap-based minimum-degree ordering with NO lookahead.
#
# See also min_degree.py which uses lookahead, and simple_md.py which is a
# hacked version of min_degree.py that still uses repeated linear scans... | [
"order_util.get_inverse_perm",
"networkx.max_weight_matching",
"order_util.argsort",
"test_tearing.gen_testproblems",
"order_util.get_row_weights",
"py3compat.cPickle_dumps",
"py3compat.cPickle_loads",
"plot_ordering.plot_hessenberg",
"order_util.coo_matrix_to_bipartite",
"pqueue.PriorityQueue",
... | [((1204, 1265), 'order_util.coo_matrix_to_bipartite', 'coo_matrix_to_bipartite', (['rows', 'cols', 'values', '(n_rows, n_cols)'], {}), '(rows, cols, values, (n_rows, n_cols))\n', (1227, 1265), False, 'from order_util import colp_to_spiked_form, get_hessenberg_order, check_spiked_form, coo_matrix_to_bipartite, partial_r... |
#
# Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
#
import unittest
from deephaven import read_csv, DHError
from deephaven.plot import Color, Colors
from deephaven.plot import Figure
from deephaven.plot import LineEndStyle, LineStyle
from tests.testbase import BaseTestCase
class ColorTestCase(Base... | [
"deephaven.plot.Color.of_hsl",
"deephaven.plot.Color.of_name",
"deephaven.plot.LineStyle",
"deephaven.plot.Color.of_rgb_f",
"deephaven.plot.Color.of_rgb",
"deephaven.plot.Figure",
"unittest.main",
"deephaven.read_csv"
] | [((1658, 1673), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1671, 1673), False, 'import unittest\n'), ((378, 415), 'deephaven.read_csv', 'read_csv', (['"""tests/data/test_table.csv"""'], {}), "('tests/data/test_table.csv')\n", (386, 415), False, 'from deephaven import read_csv, DHError\n'), ((524, 532), 'deeph... |
import uiza
from uiza import Connection
from uiza.api_resources.base.base import UizaBase
from uiza.settings.config import settings
from uiza.utility.utility import set_url
class Entity(UizaBase):
def __init__(self):
self.connection = Connection(workspace_api_domain=uiza.workspace_api_domain, api_key=uiz... | [
"uiza.utility.utility.set_url",
"uiza.Connection"
] | [((250, 341), 'uiza.Connection', 'Connection', ([], {'workspace_api_domain': 'uiza.workspace_api_domain', 'api_key': 'uiza.authorization'}), '(workspace_api_domain=uiza.workspace_api_domain, api_key=uiza.\n authorization)\n', (260, 341), False, 'from uiza import Connection\n'), ((367, 575), 'uiza.utility.utility.set... |
# Copyright 2020 <NAME>
# 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... | [
"datetime",
"EvoMSA.utils.download",
"microtc.weighting.TFIDF.counter",
"microtc.utils.load_model",
"datetime.timedelta",
"b4msa.textmodel.TextModel",
"typing.OrderedDict",
"collections.defaultdict",
"datetime.date.today",
"microtc.utils.Counter"
] | [((6737, 6749), 'datetime.date.today', 'date.today', ([], {}), '()\n', (6747, 6749), False, 'from datetime import date, datetime\n'), ((6764, 6819), 'datetime', 'datetime', ([], {'year': 'hoy.year', 'month': 'hoy.month', 'day': 'hoy.month'}), '(year=hoy.year, month=hoy.month, day=hoy.month)\n', (6772, 6819), False, 'im... |
#!/usr/bin/env python
"""
@package mi.dataset.parser.test.test_nutnrb
@file marine-integrations/mi/dataset/parser/test/test_nutnrb.py
@author <NAME>
@brief Test code for a Nutnrb data parser
"""
import unittest
import gevent
from StringIO import StringIO
from nose.plugins.attrib import attr
from mi.core.log import g... | [
"StringIO.StringIO",
"mi.dataset.parser.nutnrb.NutnrbDataParticle",
"nose.plugins.attrib.attr",
"mi.core.log.get_logger",
"mi.dataset.parser.nutnrb.NutnrbParser",
"mi.dataset.test.test_parser.ParserUnitTestCase.setUp",
"unittest.skip"
] | [((338, 350), 'mi.core.log.get_logger', 'get_logger', ([], {}), '()\n', (348, 350), False, 'from mi.core.log import get_logger\n'), ((631, 699), 'unittest.skip', 'unittest.skip', (['"""Nutnr parser is broken, timestamp needs to be fixed"""'], {}), "('Nutnr parser is broken, timestamp needs to be fixed')\n", (644, 699),... |
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# Name: test_component
# Purpose: Test driver for module component
#
# Author: <NAME> (<EMAIL>)
#
# Copyright: (c) 2014 <NAME>
# ------------------------------------------------------------------------... | [
"camd3.infrastructure.component.implementer",
"camd3.infrastructure.component.component._ABCSet",
"unittest.main",
"camd3.infrastructure.component.Attribute"
] | [((994, 1027), 'camd3.infrastructure.component.implementer', 'implementer', (['TestComp1', 'TestComp2'], {}), '(TestComp1, TestComp2)\n', (1005, 1027), False, 'from camd3.infrastructure.component import Attribute, Component, ComponentLookupError, Immutable, implementer\n'), ((1399, 1421), 'camd3.infrastructure.componen... |
import os
from json import JSONDecodeError
from json import dump
from json import load
import numpy as np
from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound
def upload(net_object, path):
if not os.path.isfile(path):
raise JsonFileNotFound()
try:
with open(path, 'r') as... | [
"core.net_errors.JsonFileStructureIncorrect",
"core.net_errors.JsonFileNotFound",
"os.path.isfile",
"numpy.array",
"numpy.zeros",
"json.load",
"json.dump"
] | [((224, 244), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (238, 244), False, 'import os\n'), ((260, 278), 'core.net_errors.JsonFileNotFound', 'JsonFileNotFound', ([], {}), '()\n', (276, 278), False, 'from core.net_errors import JsonFileStructureIncorrect, JsonFileNotFound\n'), ((359, 369), 'json.loa... |
from env_wrapper import SubprocVecEnv, DummyVecEnv
import numpy as np
import multiagent.scenarios as scenarios
from multiagent.environment import MultiAgentEnv
def make_parallel_env(n_rollout_threads, seed=1):
def get_env_fn(rank):
def init_env():
env = make_env("simple_adversary")
... | [
"multiagent.scenarios.load",
"multiagent.environment.MultiAgentEnv",
"numpy.random.seed"
] | [((765, 851), 'multiagent.environment.MultiAgentEnv', 'MultiAgentEnv', (['world', 'scenario.reset_world', 'scenario.reward', 'scenario.observation'], {}), '(world, scenario.reset_world, scenario.reward, scenario.\n observation)\n', (778, 851), False, 'from multiagent.environment import MultiAgentEnv\n'), ((362, 396)... |
#!/usr/bin/env python
import os
import sys
import anyconfig
import re
import time
import importlib
import pdb
from select import poll, POLLIN
from statsd import StatsClient
def import_class(klass):
(module, klass) = klass.rsplit('.', 1)
module = importlib.import_module(module)
return getattr(module, klass... | [
"anyconfig.load",
"importlib.import_module",
"re.match",
"time.sleep",
"statsd.StatsClient"
] | [((256, 287), 'importlib.import_module', 'importlib.import_module', (['module'], {}), '(module)\n', (279, 287), False, 'import importlib\n'), ((1762, 1793), 'statsd.StatsClient', 'StatsClient', ([], {}), "(**config['statsd'])\n", (1773, 1793), False, 'from statsd import StatsClient\n'), ((2763, 2807), 're.match', 're.m... |
#!/usr/bin/env python3
import os
import time
import binascii
import codecs
def swap_order(d, wsz=16, gsz=2 ):
return "".join(["".join([m[i:i+gsz] for i in range(wsz-gsz,-gsz,-gsz)]) for m in [d[i:i+wsz] for i in range(0,len(d),wsz)]])
expected_genesis_hash = "00000009c4e61bee0e8d6236f847bb1dd23f4c61ca5240b748521... | [
"os.pread",
"os.close",
"os.open",
"os.pwrite",
"codecs.encode",
"time.time"
] | [((778, 815), 'os.open', 'os.open', (['"""/dev/xdma0_user"""', 'os.O_RDWR'], {}), "('/dev/xdma0_user', os.O_RDWR)\n", (785, 815), False, 'import os\n'), ((1175, 1187), 'os.close', 'os.close', (['fd'], {}), '(fd)\n', (1183, 1187), False, 'import os\n'), ((1401, 1438), 'os.open', 'os.open', (['"""/dev/xdma0_user"""', 'os... |
from AlphaGo.models.policy import CNNPolicy
from AlphaGo import go
from AlphaGo.go import GameState
from AlphaGo.ai import GreedyPolicyPlayer, ProbabilisticPolicyPlayer
import numpy as np
import unittest
import os
class TestCNNPolicy(unittest.TestCase):
def test_default_policy(self):
policy = CNNPolicy(["board", ... | [
"AlphaGo.models.policy.CNNPolicy.load_model",
"AlphaGo.models.policy.CNNPolicy",
"AlphaGo.ai.GreedyPolicyPlayer",
"AlphaGo.go.GameState",
"unittest.main",
"AlphaGo.ai.ProbabilisticPolicyPlayer",
"numpy.all",
"os.remove"
] | [((3295, 3310), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3308, 3310), False, 'import unittest\n'), ((300, 365), 'AlphaGo.models.policy.CNNPolicy', 'CNNPolicy', (["['board', 'liberties', 'sensibleness', 'capture_size']"], {}), "(['board', 'liberties', 'sensibleness', 'capture_size'])\n", (309, 365), False, '... |
import time
from anchore_engine import db
from anchore_engine.db import User
def add(userId, password, inobj, session=None):
if not session:
session = db.Session()
#our_result = session.query(User).filter_by(userId=userId, password=password).first()
our_result = session.query(User).filter_by... | [
"time.time",
"anchore_engine.db.User",
"anchore_engine.db.Session"
] | [((166, 178), 'anchore_engine.db.Session', 'db.Session', ([], {}), '()\n', (176, 178), False, 'from anchore_engine import db\n'), ((388, 426), 'anchore_engine.db.User', 'User', ([], {'userId': 'userId', 'password': 'password'}), '(userId=userId, password=password)\n', (392, 426), False, 'from anchore_engine.db import U... |
#!/usr/bin/env python
import sys
from fitparse.records import Crc
if sys.version_info >= (2, 7):
import unittest
else:
import unittest2 as unittest
class RecordsTestCase(unittest.TestCase):
def test_crc(self):
crc = Crc()
self.assertEqual(0, crc.value)
crc.update(b'\x0e\x10\x98\... | [
"fitparse.records.Crc.format",
"unittest2.main",
"fitparse.records.Crc"
] | [((659, 674), 'unittest2.main', 'unittest.main', ([], {}), '()\n', (672, 674), True, 'import unittest2 as unittest\n'), ((241, 246), 'fitparse.records.Crc', 'Crc', ([], {}), '()\n', (244, 246), False, 'from fitparse.records import Crc\n'), ((556, 569), 'fitparse.records.Crc.format', 'Crc.format', (['(0)'], {}), '(0)\n'... |
import tkinter as tk
import gui
wd = tk.Tk()
gui = gui.GUI(wd)
wd.mainloop() | [
"tkinter.Tk",
"gui.GUI"
] | [((43, 50), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (48, 50), True, 'import tkinter as tk\n'), ((58, 69), 'gui.GUI', 'gui.GUI', (['wd'], {}), '(wd)\n', (65, 69), False, 'import gui\n')] |
import datetime
from flask_ldap3_login import LDAP3LoginManager, AuthenticationResponseStatus
from lost.settings import LOST_CONFIG, FLASK_DEBUG
from flask_jwt_extended import create_access_token, create_refresh_token
from lost.db.model import User as DBUser, Group
from lost.db import roles
class LoginManager():
de... | [
"flask_jwt_extended.create_access_token",
"flask_jwt_extended.create_refresh_token",
"datetime.datetime.now",
"lost.db.model.Group",
"flask_ldap3_login.LDAP3LoginManager",
"datetime.timedelta"
] | [((970, 1025), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': 'LOST_CONFIG.session_timeout'}), '(minutes=LOST_CONFIG.session_timeout)\n', (988, 1025), False, 'import datetime\n'), ((1052, 1111), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': '(LOST_CONFIG.session_timeout + 2)'}), '(minutes=L... |
import os
import torch
import numpy as np
import torch.nn as nn
import matplotlib.pyplot as plt
def get_param_matrix(model_prefix, model_dir):
"""
Grabs the parameters of a saved model and returns them as a matrix
"""
# Load and combine the parameters
param_matrix = []
for file in os.listdir(... | [
"os.listdir",
"torch.load",
"os.path.join",
"torch.nn.utils.parameters_to_vector",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.title"
] | [((309, 330), 'os.listdir', 'os.listdir', (['model_dir'], {}), '(model_dir)\n', (319, 330), False, 'import os\n'), ((785, 807), 'numpy.array', 'np.array', (['param_matrix'], {}), '(param_matrix)\n', (793, 807), True, 'import numpy as np\n'), ((1024, 1051), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10... |
import numpy as np
import tor4
import tor4.nn as nn
def test_softmax():
a = tor4.tensor(data=[0, 0, 0.0])
a_sm = nn.functional.softmax(a, dim=0)
assert not a_sm.requires_grad
assert a_sm.tolist() == [1 / 3, 1 / 3, 1 / 3]
def test_softmax2():
a = tor4.tensor(data=[[0, 0, 0], [0, 0, 0.0]])
a... | [
"tor4.tensor",
"tor4.nn.functional.softmax"
] | [((83, 112), 'tor4.tensor', 'tor4.tensor', ([], {'data': '[0, 0, 0.0]'}), '(data=[0, 0, 0.0])\n', (94, 112), False, 'import tor4\n'), ((124, 155), 'tor4.nn.functional.softmax', 'nn.functional.softmax', (['a'], {'dim': '(0)'}), '(a, dim=0)\n', (145, 155), True, 'import tor4.nn as nn\n'), ((272, 314), 'tor4.tensor', 'tor... |
from keras.preprocessing.sequence import pad_sequences
from keras.preprocessing.text import Tokenizer
class KerasBow(object):
"""doc
词袋模型:我们可以为数据集中的所有单词制作一张词表,然后将每个单词和一个唯一的索引关联。
每个句子都是由一串数字组成,这串数字是词表中的独立单词对应的个数。
通过列表中的索引,我们可以统计出句子中某个单词出现的次数。
"""
def __init__(self, num_words=20000, maxlen=None... | [
"keras.preprocessing.sequence.pad_sequences",
"keras.preprocessing.text.Tokenizer"
] | [((739, 777), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', (['self.num_words'], {'lower': '(False)'}), '(self.num_words, lower=False)\n', (748, 777), False, 'from keras.preprocessing.text import Tokenizer\n'), ((1088, 1141), 'keras.preprocessing.sequence.pad_sequences', 'pad_sequences', (['sequences', 'self.maxle... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-02-18 16:24
from django.db import migrations
countries = {
"Ma\u010farsko": "HU",
"Czech Republic": "CZ",
"\u010cesk\xe1 republika": "CZ",
"United Kingdom": "GB",
"Austria": "AT",
"Madarsko": "HU",
"Australia": "AU",
"Srbsko":... | [
"django.db.migrations.RunPython"
] | [((1259, 1298), 'django.db.migrations.RunPython', 'migrations.RunPython', (['fix_country_names'], {}), '(fix_country_names)\n', (1279, 1298), False, 'from django.db import migrations\n')] |
# -*- coding: utf-8 -*-
'''
常量
'''
import base64
from django.utils.translation import ugettext_lazy as _
DOMAIN_BASIC_PARAMS = (
(u"cf_limit_mailbox_cnt", _(u"限定邮箱数量")),
#(u"cf_limit_alias_cnt", u"限定别名数量"), #这个开关没人用
(u"cf_limit_mailbox_size", _(u"限定邮箱空间总容量")),
(u"cf_limit_netdisk_size", _(u"限定... | [
"django.utils.translation.ugettext_lazy",
"base64.encodestring"
] | [((10718, 10767), 'base64.encodestring', 'base64.encodestring', (['DOMAIN_PERSONAL_DEFAULT_CODE'], {}), '(DOMAIN_PERSONAL_DEFAULT_CODE)\n', (10737, 10767), False, 'import base64\n'), ((162, 174), 'django.utils.translation.ugettext_lazy', '_', (['u"""限定邮箱数量"""'], {}), "(u'限定邮箱数量')\n", (163, 174), True, 'from django.util... |
from django.shortcuts import render, redirect
from .forms import UserRegisterForm
def register(request):
if request.method == 'POST':
form = UserRegisterForm(request.POST)
if form.is_valid():
form.save()
return redirect('login')
else:
form = UserRegisterForm()
... | [
"django.shortcuts.render",
"django.shortcuts.redirect"
] | [((330, 387), 'django.shortcuts.render', 'render', (['request', '"""accounts/register.html"""', "{'form': form}"], {}), "(request, 'accounts/register.html', {'form': form})\n", (336, 387), False, 'from django.shortcuts import render, redirect\n'), ((256, 273), 'django.shortcuts.redirect', 'redirect', (['"""login"""'], ... |
import logging
from sockjs.tornado import SockJSConnection
from thunderpush.sortingstation import SortingStation
try:
import simplejson as json
except ImportError:
import json
logger = logging.getLogger()
class ThunderSocketHandler(SockJSConnection):
def on_open(self, info):
logger.debug("New c... | [
"logging.getLogger",
"thunderpush.sortingstation.SortingStation.instance"
] | [((196, 215), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (213, 215), False, 'import logging\n'), ((1820, 1845), 'thunderpush.sortingstation.SortingStation.instance', 'SortingStation.instance', ([], {}), '()\n', (1843, 1845), False, 'from thunderpush.sortingstation import SortingStation\n')] |
import argparse
class appOptions:
show_devices = '--show-devices'
clean_report = '--clean-report'
device_config = '--device-config'
global_config = '--global-config'
test_case = '--test-case'
tests_dir = '--tests-dir'
device = '--device'
test = '--test'
service_address = '--ser... | [
"argparse.ArgumentParser"
] | [((728, 753), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (751, 753), False, 'import argparse\n')] |
import requests
from teste_app import settigns
def google(q: str):
"""Faz uma pesquisa no google"""
return requests.get(settigns.GOOGLE, params={"q": q})
| [
"requests.get"
] | [((119, 165), 'requests.get', 'requests.get', (['settigns.GOOGLE'], {'params': "{'q': q}"}), "(settigns.GOOGLE, params={'q': q})\n", (131, 165), False, 'import requests\n')] |
# github link: https://github.com/ds-praveenkumar/kaggle
# Author: ds-praveenkumar
# file: forcasting/prepare_train_data.py/
# Created by ds-praveenkumar at 13-06-2020 15 34
# feature:
import os
import pandas as pd
import numpy as np
import click
from src.utility.timeit import timeit
root = os.path.dirname(os.getcwd(... | [
"os.path.join",
"os.getcwd",
"click.Path",
"click.command",
"pandas.date_range"
] | [((341, 379), 'os.path.join', 'os.path.join', (['root', '"""data"""', '"""training"""'], {}), "(root, 'data', 'training')\n", (353, 379), False, 'import os\n'), ((403, 443), 'os.path.join', 'os.path.join', (['root', '"""data"""', '"""preprocess"""'], {}), "(root, 'data', 'preprocess')\n", (415, 443), False, 'import os\... |
import psycopg2
import psycopg2.extras
import sys
from sqlalchemy import create_engine
import pandas as pd
def get_cursor():
conn_string = "host='localhost' dbname='HintereggerA' user='HintereggerA' password='<PASSWORD>'"
# print the connection string we will use to connect
print("Connecting to database: {}".forma... | [
"psycopg2.connect",
"sqlalchemy.create_engine",
"pandas.read_sql_query"
] | [((766, 836), 'sqlalchemy.create_engine', 'create_engine', (['"""postgresql://HintereggerA:root@localhost/HintereggerA"""'], {}), "('postgresql://HintereggerA:root@localhost/HintereggerA')\n", (779, 836), False, 'from sqlalchemy import create_engine\n'), ((444, 473), 'psycopg2.connect', 'psycopg2.connect', (['conn_stri... |
# Author: <NAME> <<EMAIL>>
"""Module implementing the FASTA algorithm"""
import numpy as np
from math import sqrt
from scipy import linalg
import time
import logging
def _next_stepsize(deltax, deltaF, t=0):
"""A variation of spectral descent step-size selection: 'adaptive' BB method.
Reference:
-------... | [
"logging.getLogger",
"numpy.copy",
"numpy.random.randn",
"time.time"
] | [((6219, 6245), 'logging.getLogger', 'logging.getLogger', (['"""FASTA"""'], {}), "('FASTA')\n", (6236, 6245), False, 'import logging\n'), ((6270, 6289), 'numpy.copy', 'np.copy', (['coefs_init'], {}), '(coefs_init)\n', (6277, 6289), True, 'import numpy as np\n'), ((6908, 6919), 'time.time', 'time.time', ([], {}), '()\n'... |
# -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Brief:
import os
import pickle
def load_pkl(pkl_path):
"""
加载词典文件
:param pkl_path:
:return:
"""
with open(pkl_path, 'rb') as f:
result = pickle.load(f)
return result
def dump_pkl(vocab, pkl_path, overwrite=True):
"""
存... | [
"pickle.dump",
"os.path.exists",
"pickle.load"
] | [((225, 239), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (236, 239), False, 'import pickle\n'), ((395, 419), 'os.path.exists', 'os.path.exists', (['pkl_path'], {}), '(pkl_path)\n', (409, 419), False, 'import os\n'), ((564, 597), 'pickle.dump', 'pickle.dump', (['vocab', 'f'], {'protocol': '(0)'}), '(vocab, f, p... |
import copy
import _mecab
from collections import namedtuple
from typing import Generator
from mecab import MeCabError
from domain.mecab_domain import MecabWordFeature
def delete_pattern_from_string(string, pattern, index, nofail=False):
""" 문자열에서 패턴을 찾아서 *로 변환해주는 기능 """
# raise an error if index is outsid... | [
"collections.namedtuple",
"_mecab.Lattice",
"domain.mecab_domain.MecabWordFeature",
"_mecab.Tagger",
"copy.deepcopy"
] | [((917, 1037), 'collections.namedtuple', 'namedtuple', (['"""Feature"""', "['pos', 'semantic', 'has_jongseong', 'reading', 'type', 'start_pos',\n 'end_pos', 'expression']"], {}), "('Feature', ['pos', 'semantic', 'has_jongseong', 'reading',\n 'type', 'start_pos', 'end_pos', 'expression'])\n", (927, 1037), False, '... |
from tensorflow.keras.preprocessing import image
from tensorflow.keras.models import model_from_json
import numpy as np
import tensorflow.keras.models as models
def predict(temp_file):
test_image = image.load_img(temp_file, target_size = (224, 224))
test_image = image.img_to_array(test_image)
test_image = ... | [
"tensorflow.keras.preprocessing.image.load_img",
"tensorflow.keras.models.model_from_json",
"numpy.argmax",
"numpy.expand_dims",
"tensorflow.keras.preprocessing.image.img_to_array"
] | [((203, 252), 'tensorflow.keras.preprocessing.image.load_img', 'image.load_img', (['temp_file'], {'target_size': '(224, 224)'}), '(temp_file, target_size=(224, 224))\n', (217, 252), False, 'from tensorflow.keras.preprocessing import image\n'), ((272, 302), 'tensorflow.keras.preprocessing.image.img_to_array', 'image.img... |
#!/usr/bin/env python3
##############################################################################
## This file is part of 'PGP PCIe APP DEV'.
## It is subject to the license terms in the LICENSE.txt file found in the
## top-level directory of this distribution and at:
## https://confluence.slac.stanford.edu/disp... | [
"rogue.interfaces.stream.TcpClient",
"pyrogue.utilities.prbs.PrbsRx",
"axipcie.AxiPcieCore",
"rogue.interfaces.memory.TcpClient",
"argparse.ArgumentParser",
"rogue.hardware.axi.AxiStreamDma",
"pyrogue.utilities.prbs.PrbsTx",
"rogue.hardware.axi.AxiMemMap"
] | [((1107, 1132), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1130, 1132), False, 'import argparse\n'), ((2947, 2985), 'rogue.hardware.axi.AxiMemMap', 'rogue.hardware.axi.AxiMemMap', (['args.dev'], {}), '(args.dev)\n', (2975, 2985), False, 'import rogue\n'), ((3797, 3887), 'axipcie.AxiPcieCor... |
import inspect
import json
from .serialisation import JsonObjHelper, JsonTypeError
class RpcMethod:
"""Encapsulate argument/result (de)serialisation for a function
based on a type-annotated function signature and name.
"""
def __init__(self, name, signature, doc=None):
if (
signat... | [
"json.loads",
"json.dumps",
"inspect.signature"
] | [((1992, 2007), 'json.loads', 'json.loads', (['buf'], {}), '(buf)\n', (2002, 2007), False, 'import json\n'), ((3123, 3138), 'json.loads', 'json.loads', (['buf'], {}), '(buf)\n', (3133, 3138), False, 'import json\n'), ((705, 728), 'inspect.signature', 'inspect.signature', (['func'], {}), '(func)\n', (722, 728), False, '... |
import logging
from cinp import client
MCP_API_VERSIONS = ( '0.10', '0.11', )
class MCP( object ):
def __init__( self, host, proxy, job_id, instance_id, cookie, stop_event ):
self.cinp = client.CInP( host, '/api/v1/', proxy, retry_event=stop_event )
self.job_id = job_id
self.instance_id = instance_id
... | [
"logging.info",
"cinp.client.CInP"
] | [((197, 257), 'cinp.client.CInP', 'client.CInP', (['host', '"""/api/v1/"""', 'proxy'], {'retry_event': 'stop_event'}), "(host, '/api/v1/', proxy, retry_event=stop_event)\n", (208, 257), False, 'from cinp import client\n'), ((686, 726), 'logging.info', 'logging.info', (['"""MCP: Get Contractor Info"""'], {}), "('MCP: Ge... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from sklearn.metrics import r2_score
import datetime
def func(x, a, b):
return a + b*x
def exp_regression(x, y):
p, _ = curve_fit(func, x, np.log(y))
p[0] = np.exp(p[0])
return p
def r2(coe... | [
"pandas.read_csv",
"numpy.log",
"numpy.exp",
"datetime.timedelta",
"pandas.to_datetime"
] | [((543, 573), 'pandas.read_csv', 'pd.read_csv', (['"""error_rates.csv"""'], {}), "('error_rates.csv')\n", (554, 573), True, 'import pandas as pd\n'), ((279, 291), 'numpy.exp', 'np.exp', (['p[0]'], {}), '(p[0])\n', (285, 291), True, 'import numpy as np\n'), ((257, 266), 'numpy.log', 'np.log', (['y'], {}), '(y)\n', (263,... |
"""Tests for IPython.utils.path.py"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from contextlib import contextmanager
from unittest.mock import patch
import pytest
from IPython.lib import latextools
from IPython.testing.decorators import (
onlyif_cmds_ex... | [
"IPython.testing.decorators.onlyif_cmds_exist",
"IPython.lib.latextools.latex_to_png_dvipng",
"IPython.lib.latextools.latex_to_png",
"pytest.mark.parametrize",
"IPython.lib.latextools.latex_to_png_mpl",
"unittest.mock.patch.object",
"IPython.lib.latextools.latex_to_html",
"pytest.skip",
"IPython.lib... | [((404, 459), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""command"""', "['latex', 'dvipng']"], {}), "('command', ['latex', 'dvipng'])\n", (427, 459), False, 'import pytest\n'), ((803, 839), 'IPython.testing.decorators.onlyif_cmds_exist', 'onlyif_cmds_exist', (['"""latex"""', '"""dvipng"""'], {}), "('lat... |
#!/usr/bin/python3
#
# This is a Hello World example of BPF.
from bcc import BPF
# define BPF program
prog = """
int kprobe__sys_clone(void *ctx)
{
bpf_trace_printk("Hello, World!\\n");
return 0;
}
"""
# load BPF program
b = BPF(text=prog)
b.trace_print()
| [
"bcc.BPF"
] | [((235, 249), 'bcc.BPF', 'BPF', ([], {'text': 'prog'}), '(text=prog)\n', (238, 249), False, 'from bcc import BPF\n')] |
from django.contrib import admin
from accounts.models import *
admin.site.register(UserProfile)
admin.site.register(ProjectPage)
admin.site.register(Comment)
| [
"django.contrib.admin.site.register"
] | [((64, 96), 'django.contrib.admin.site.register', 'admin.site.register', (['UserProfile'], {}), '(UserProfile)\n', (83, 96), False, 'from django.contrib import admin\n'), ((97, 129), 'django.contrib.admin.site.register', 'admin.site.register', (['ProjectPage'], {}), '(ProjectPage)\n', (116, 129), False, 'from django.co... |
import imaplib
import email
from email import message
import time
username = 'gmail_id'
password = '<PASSWORD>'
new_message = email.message.Message()
new_message.set_unixfrom('satheesh')
new_message['Subject'] = 'Sample Message'
# from gmail id
new_message['From'] = '<EMAIL>'
# to gmail id
new_message['To'] = '<EMAI... | [
"imaplib.IMAP4_SSL",
"time.time",
"email.message.Message"
] | [((129, 152), 'email.message.Message', 'email.message.Message', ([], {}), '()\n', (150, 152), False, 'import email\n'), ((540, 580), 'imaplib.IMAP4_SSL', 'imaplib.IMAP4_SSL', (['"""imap.googlemail.com"""'], {}), "('imap.googlemail.com')\n", (557, 580), False, 'import imaplib\n'), ((1004, 1015), 'time.time', 'time.time'... |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from keras.applications.xception import Xception
import h5py
import json
import cv2
import math
import logging
from tensorflow.keras.preprocessing import image
from tensorflow.keras.applications.xception import preprocess_input, decode_pr... | [
"logging.basicConfig",
"cv2.resize",
"tensorflow.keras.applications.xception.preprocess_input",
"tensorflow.keras.applications.xception.decode_predictions",
"tensorflow.keras.applications.Xception",
"cv2.VideoCapture",
"numpy.expand_dims",
"tensorflow.keras.preprocessing.image.img_to_array",
"loggin... | [((333, 372), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (352, 372), False, 'import logging\n'), ((519, 549), 'cv2.VideoCapture', 'cv2.VideoCapture', (['_sample_path'], {}), '(_sample_path)\n', (535, 549), False, 'import cv2\n'), ((613, 677), 'logging.info',... |
from django.contrib.auth.models import User
from django.core import serializers
from django.core.exceptions import ObjectDoesNotExist
from django.db import DataError
from django.http import JsonResponse, HttpResponse
from django.views.decorators.csrf import csrf_exempt
from rest_framework.decorators import api_view
fr... | [
"clinicmodels.models.ConsultType.objects.all",
"clinicmodels.models.ConsultType",
"clinicmodels.models.ConsultType.objects.get",
"consult.forms.ConsultForm",
"django.http.HttpResponse",
"django.http.JsonResponse",
"clinicmodels.models.Visit.objects.get",
"django.core.serializers.serialize",
"django.... | [((410, 427), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (418, 427), False, 'from rest_framework.decorators import api_view\n'), ((984, 1002), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (992, 1002), False, 'from rest_framework.decorator... |
import json
import requests
import os
import subprocess
import platform
HTTP = requests.session()
class ClientException(Exception):
message = 'unhandled error'
def __init__(self, message=None):
if message is not None:
self.message = message
def getURL(address):
url = "https://api.e... | [
"os.path.exists",
"requests.session",
"json.loads",
"os.makedirs",
"platform.system",
"subprocess.call",
"json.load",
"os.system"
] | [((80, 98), 'requests.session', 'requests.session', ([], {}), '()\n', (96, 98), False, 'import requests\n'), ((1830, 1851), 'json.loads', 'json.loads', (['clearCode'], {}), '(clearCode)\n', (1840, 1851), False, 'import json\n'), ((2281, 2300), 'os.path.exists', 'os.path.exists', (['dir'], {}), '(dir)\n', (2295, 2300), ... |
from molecules.dna_molecule import DNAMolecule
from molecules.dna_sequence import DNASequence
class GelElectrophoresis:
"""
Produce the Gel Electrophoresis procedure to sort DNA molecules by their size.
"""
@staticmethod
def run_gel(dna_molecules):
"""
Runs the Gel Electrophoresis... | [
"molecules.dna_sequence.DNASequence.create_random_sequence"
] | [((658, 701), 'molecules.dna_sequence.DNASequence.create_random_sequence', 'DNASequence.create_random_sequence', ([], {'size': '(20)'}), '(size=20)\n', (692, 701), False, 'from molecules.dna_sequence import DNASequence\n'), ((711, 754), 'molecules.dna_sequence.DNASequence.create_random_sequence', 'DNASequence.create_ra... |
import time
import os
from pykafka.test.kafka_instance import KafkaInstance, KafkaConnection
def get_cluster():
"""Gets a Kafka cluster for testing, using one already running is possible.
An already-running cluster is determined by environment variables:
BROKERS, ZOOKEEPER, KAFKA_BIN. This is used prim... | [
"time.time",
"os.environ.get",
"time.sleep",
"pykafka.test.kafka_instance.KafkaInstance"
] | [((1225, 1236), 'time.time', 'time.time', ([], {}), '()\n', (1234, 1236), False, 'import time\n'), ((393, 424), 'os.environ.get', 'os.environ.get', (['"""BROKERS"""', 'None'], {}), "('BROKERS', None)\n", (407, 424), False, 'import os\n'), ((438, 471), 'os.environ.get', 'os.environ.get', (['"""ZOOKEEPER"""', 'None'], {}... |
import base64
from scapy.layers.inet import *
from scapy.layers.dns import *
import dissector
class SIPStartField(StrField):
"""
field class for handling sip start field
@attention: it inherets StrField from Scapy library
"""
holds_packets = 1
name = "SIPStartField"
def getfield(self, pk... | [
"dissector.check_stream",
"base64.standard_b64encode"
] | [((844, 1054), 'dissector.check_stream', 'dissector.check_stream', (["pkt.underlayer.underlayer.fields['src']", "pkt.underlayer.underlayer.fields['dst']", "pkt.underlayer.fields['sport']", "pkt.underlayer.fields['dport']", "pkt.underlayer.fields['seq']", 's'], {}), "(pkt.underlayer.underlayer.fields['src'], pkt.\n u... |
from collections import namedtuple
import numpy as np
import scipy as sp
from scipy.sparse.csgraph import minimum_spanning_tree
from .. import logging as logg
from ..neighbors import Neighbors
from .. import utils
from .. import settings
def paga(
adata,
groups='louvain',
use_rna_velocity=Fals... | [
"collections.namedtuple",
"scipy.sparse.lil_matrix",
"numpy.median",
"scipy.stats.entropy",
"numpy.sqrt",
"networkx.Graph",
"numpy.max",
"itertools.combinations",
"numpy.exp",
"numpy.array",
"scipy.sparse.csgraph.minimum_spanning_tree",
"igraph.VertexClustering",
"scipy.stats.ttest_1samp",
... | [((11850, 11891), 'networkx.Graph', 'nx.Graph', (["adata.uns['paga']['confidence']"], {}), "(adata.uns['paga']['confidence'])\n", (11858, 11891), True, 'import networkx as nx\n'), ((13730, 13773), 'networkx.Graph', 'nx.Graph', (["adata1.uns['paga'][adjacency_key]"], {}), "(adata1.uns['paga'][adjacency_key])\n", (13738,... |
#!/usr/bin/env python3
import os
import pytest
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "../lib"))
import dartsense.player
player_list = None
def test_player_list_init(setup_db):
player_list = dartsense.player.PlayerList()
assert isinstance(player_list, dartsense.player.Player... | [
"os.path.dirname"
] | [((90, 115), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (105, 115), False, 'import os\n')] |
from models.contact import Contacts
import random
def test_edit_some_contact(app, db, check_ui):
if len(db.get_contact_list()) == 0:
app.contacts.create_contact(Contacts(lastname="LastNameUser", firstname="<NAME>"))
old_contacts = db.get_contact_list()
randomcontact = random.choice(old_contacts)
... | [
"random.choice",
"models.contact.Contacts"
] | [((290, 317), 'random.choice', 'random.choice', (['old_contacts'], {}), '(old_contacts)\n', (303, 317), False, 'import random\n'), ((378, 457), 'models.contact.Contacts', 'Contacts', ([], {'id': 'randomcontact.id', 'lastname': '"""Lastname"""', 'firstname': '"""ModifyFirstname"""'}), "(id=randomcontact.id, lastname='La... |
"""
This demo will fill the screen with white, draw a black box on top
and then print Hello World! in the center of the display
This example is for use on (Linux) computers that are using CPython with
Adafruit Blinka to support CircuitPython libraries. CircuitPython does
not support PIL/pillow (python imaging library)... | [
"adafruit_pcd8544.PCD8544",
"PIL.Image.new",
"busio.SPI",
"PIL.ImageFont.truetype",
"PIL.ImageDraw.Draw",
"digitalio.DigitalInOut"
] | [((494, 531), 'busio.SPI', 'busio.SPI', (['board.SCK'], {'MOSI': 'board.MOSI'}), '(board.SCK, MOSI=board.MOSI)\n', (503, 531), False, 'import busio\n'), ((537, 569), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D6'], {}), '(board.D6)\n', (559, 569), False, 'import digitalio\n'), ((591, 624), 'digitalio.... |
from pygame import mixer
import speech_recognition as sr
import pyttsx3
import pyjokes
import boto3
import pyglet
import winsound
import datetime
import pywhatkit
import datetime
import time
import os
from PIL import Image
import random
import wikipedia
import smtplib, ssl
from mutagen.mp3 import MP3
import requests, ... | [
"geocoder.ip",
"cv2.rectangle",
"webbrowser.open_new",
"webbrowser.open",
"time.sleep",
"face_recognition.load_image_file",
"os.fsdecode",
"pymongo.MongoClient",
"os.remove",
"os.listdir",
"pygame.mixer.music.load",
"random.randint",
"face_recognition.face_locations",
"pywhatkit.text_to_ha... | [((637, 652), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (650, 652), True, 'import speech_recognition as sr\n'), ((826, 953), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""mongodb+srv://karan:123@cluster0.gfuxd.mongodb.net/myFirstDatabase?retryWrites=true&w=majority"""'], {}), "(\n 'mo... |
"""Test fixture files, using the ``DocutilsRenderer``.
Note, the output AST is before any transforms are applied.
"""
import shlex
from io import StringIO
from pathlib import Path
import pytest
from docutils.core import Publisher, publish_doctree
from myst_parser.parsers.docutils_ import Parser
FIXTURE_PATH = Path(... | [
"pytest.skip",
"pytest.mark.param_file",
"pathlib.Path",
"shlex.split",
"io.StringIO",
"myst_parser.parsers.docutils_.Parser"
] | [((361, 428), 'pytest.mark.param_file', 'pytest.mark.param_file', (["(FIXTURE_PATH / 'docutil_syntax_elements.md')"], {}), "(FIXTURE_PATH / 'docutil_syntax_elements.md')\n", (383, 428), False, 'import pytest\n'), ((1066, 1123), 'pytest.mark.param_file', 'pytest.mark.param_file', (["(FIXTURE_PATH / 'docutil_roles.md')"]... |
import os
import json
from .base import CommunityBaseSettings
class EnvironmentSettings(CommunityBaseSettings):
"""Settings for local development"""
DEBUG = os.environ.get('DEBUG') == 'true'
ALLOW_PRIVATE_REPOS = os.environ['ALLOW_PRIVATE_REPOS'] == 'true'
PRODUCTION_DOMAIN = os.environ['PROD_HOST'... | [
"json.loads",
"os.environ.get"
] | [((1741, 1775), 'json.loads', 'json.loads', (["os.environ['ES_HOSTS']"], {}), "(os.environ['ES_HOSTS'])\n", (1751, 1775), False, 'import json\n'), ((2210, 2238), 'os.environ.get', 'os.environ.get', (['"""FROM_EMAIL"""'], {}), "('FROM_EMAIL')\n", (2224, 2238), False, 'import os\n'), ((2256, 2284), 'os.environ.get', 'os.... |
import unittest
from datetime import datetime, timezone
from src.entity.count_entity import CountEntity
from src.interface_adapter.in_memory_count_repository import \
InMemoryCountRepository
from src.use_case.record_count_input_data import RecordCountInputData
from src.use_case.record_count_use_case_interactor imp... | [
"datetime.datetime",
"src.entity.count_entity.CountEntity",
"src.interface_adapter.in_memory_count_repository.InMemoryCountRepository",
"src.use_case.record_count_input_data.RecordCountInputData",
"src.use_case.record_count_use_case_interactor.RecordCountUseCaseInteractor"
] | [((475, 500), 'src.interface_adapter.in_memory_count_repository.InMemoryCountRepository', 'InMemoryCountRepository', ([], {}), '()\n', (498, 500), False, 'from src.interface_adapter.in_memory_count_repository import InMemoryCountRepository\n'), ((586, 631), 'src.use_case.record_count_use_case_interactor.RecordCountUseC... |
from setuptools import setup
setup(
name='nd',
py_modules=['nd'],
version='1.0.0',
description='user friendly emulation game selection',
license="MIT",
author='<NAME>',
author_email='<EMAIL>',
install_requires=['tkinter', 'nltk', 'pymongo'],
scripts=[]
)
| [
"setuptools.setup"
] | [((30, 267), 'setuptools.setup', 'setup', ([], {'name': '"""nd"""', 'py_modules': "['nd']", 'version': '"""1.0.0"""', 'description': '"""user friendly emulation game selection"""', 'license': '"""MIT"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'install_requires': "['tkinter', 'nltk', 'pymongo']", 's... |
"""add class of delete
Revision ID: <PASSWORD>
Revises: <PASSWORD>
Create Date: 2019-03-04 17:50:54.573744
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ##... | [
"sqlalchemy.VARCHAR",
"alembic.op.drop_column"
] | [((382, 423), 'alembic.op.drop_column', 'op.drop_column', (['"""subscribers"""', '"""username"""'], {}), "('subscribers', 'username')\n", (396, 423), False, 'from alembic import op\n'), ((599, 621), 'sqlalchemy.VARCHAR', 'sa.VARCHAR', ([], {'length': '(255)'}), '(length=255)\n', (609, 621), True, 'import sqlalchemy as ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 5 01:34:00 2021
@author: yrc2
"""
import biosteam as bst
import biorefineries.oilcane as oc
from biosteam.utils import CABBI_colors, colors
from thermosteam.utils import set_figure_size, set_font, roundsigfigs
from thermosteam.units_of_measure import format_units
from co... | [
"matplotlib.pyplot.boxplot",
"biosteam.utils.colors.red.shade",
"matplotlib.pyplot.grid",
"biosteam.utils.CABBI_colors.orange.shade",
"matplotlib.pyplot.ylabel",
"biosteam.plots.plot_quadrants",
"biosteam.plots.style_axis",
"biosteam.MockVariable",
"numpy.array",
"biosteam.utils.CABBI_colors.green... | [((3524, 3546), 'colorpalette.Palette', 'Palette', ([], {}), '(**area_colors)\n', (3531, 3546), False, 'from colorpalette import Palette\n'), ((3762, 3800), 'biosteam.utils.CABBI_colors.orange.copy', 'CABBI_colors.orange.copy', ([], {'hatch': '"""////"""'}), "(hatch='////')\n", (3786, 3800), False, 'from biosteam.utils... |
"""
TODO description.
Author: <NAME>
Autonomous Systems Lab (ASL), Stanford
(GitHub: spenrich)
"""
if __name__ == "__main__":
import pickle
import jax
import jax.numpy as jnp
from jax.experimental.ode import odeint
from utils import spline, random_ragged_spline
from dynamics im... | [
"jax.random.PRNGKey",
"jax.numpy.dstack",
"pickle.dump",
"utils.spline",
"jax.jacfwd",
"dynamics.prior",
"jax.partial",
"jax.numpy.arange",
"dynamics.disturbance",
"dynamics.plant",
"jax.random.beta",
"jax.numpy.array",
"jax.numpy.vstack",
"jax.lax.scan",
"jax.numpy.clip",
"jax.vmap",
... | [((401, 425), 'jax.random.PRNGKey', 'jax.random.PRNGKey', (['seed'], {}), '(seed)\n', (419, 425), False, 'import jax\n'), ((582, 618), 'jax.numpy.array', 'jnp.array', (['[-2.0, -2.0, -jnp.pi / 6]'], {}), '([-2.0, -2.0, -jnp.pi / 6])\n', (591, 618), True, 'import jax.numpy as jnp\n'), ((630, 663), 'jax.numpy.array', 'jn... |
# Generated by Django 3.1.12 on 2021-07-28 21:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('reports', '0016_auto_20210727_2156'),
]
operations = [
migrations.AddIndex(
model_name='report',
index=models.Index... | [
"django.db.models.Index"
] | [((308, 364), 'django.db.models.Index', 'models.Index', ([], {'fields': "['user']", 'name': '"""reports_user_index"""'}), "(fields=['user'], name='reports_user_index')\n", (320, 364), False, 'from django.db import migrations, models\n'), ((457, 527), 'django.db.models.Index', 'models.Index', ([], {'fields': "['user', '... |
#--------------------------------------------------
# mqtt_control.py
# MQTT_Control is a database model to control subscriptions
# and publications
# introduced in u8
# ToraNova
#--------------------------------------------------
from pkg.resrc import res_import as r
from pkg.system.database import dbms
Base = dbms.m... | [
"pkg.resrc.res_import.checkNull",
"pkg.resrc.res_import.Column",
"pkg.resrc.res_import.OrderedDict",
"pkg.resrc.res_import.String",
"datetime.datetime.now",
"pkg.msgapi.mqtt.models.MQTT_Sub.query.filter",
"datetime.timedelta"
] | [((492, 529), 'pkg.resrc.res_import.Column', 'r.Column', (['r.Integer'], {'primary_key': '(True)'}), '(r.Integer, primary_key=True)\n', (500, 529), True, 'from pkg.resrc import res_import as r\n'), ((1078, 1112), 'pkg.resrc.res_import.Column', 'r.Column', (['r.Integer'], {'nullable': '(True)'}), '(r.Integer, nullable=T... |
# SPDX-FileCopyrightText: 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import usb_cdc
import rotaryio
import board
import digitalio
serial = usb_cdc.data
encoder = rotaryio.IncrementalEncoder(board.ROTA, board.ROTB)
button = digitalio.DigitalInOut(board.SWITCH)
button.switch_to_input(pull=digi... | [
"rotaryio.IncrementalEncoder",
"digitalio.DigitalInOut"
] | [((190, 241), 'rotaryio.IncrementalEncoder', 'rotaryio.IncrementalEncoder', (['board.ROTA', 'board.ROTB'], {}), '(board.ROTA, board.ROTB)\n', (217, 241), False, 'import rotaryio\n'), ((251, 287), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.SWITCH'], {}), '(board.SWITCH)\n', (273, 287), False, 'import d... |
import numpy as np
from ..layers.Layer import LayerTrainable
class LayeredModel(object):
def __init__(self, layers):
"""
layers : a list of layers. Treated as a feed-forward model
"""
assert len(layers) > 0, "Model layers must be non-empty"
# check that the output of ... | [
"numpy.shape",
"numpy.zeros",
"numpy.hstack"
] | [((4802, 4817), 'numpy.zeros', 'np.zeros', (['count'], {}), '(count)\n', (4810, 4817), True, 'import numpy as np\n'), ((3096, 3107), 'numpy.shape', 'np.shape', (['X'], {}), '(X)\n', (3104, 3107), True, 'import numpy as np\n'), ((5482, 5499), 'numpy.hstack', 'np.hstack', (['(x, 1)'], {}), '((x, 1))\n', (5491, 5499), Tru... |
#!/usr/bin/env python3
from flask import Flask, send_file, make_response, Response, g, request, stream_with_context
from io import BytesIO
import atexit
import errno
import os
import subprocess
import threading
INPUT = '/dev/video0'
FFMPEG = "/home/test/ffmpeg-nvenc/ffmpeg"
app = Flask(__name__)
@app.route('/pic')
... | [
"flask.Flask",
"os.close",
"subprocess.Popen",
"threading.Lock",
"os.write",
"io.BytesIO",
"os.read",
"threading.Thread",
"os.pipe"
] | [((283, 298), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (288, 298), False, 'from flask import Flask, send_file, make_response, Response, g, request, stream_with_context\n'), ((514, 616), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdin': 'None', 'stdout': 'subprocess.PIPE', 'stderr': 'subproc... |
from unittest import TestCase
from eccCh02 import Point
class PointTest(TestCase):
def test_ne(self):
a = Point(x=3, y=-7, a=5, b=7)
b = Point(x=18, y=77, a=5, b=7)
self.assertTrue(a != b)
self.assertFalse(a != a)
| [
"eccCh02.Point"
] | [((120, 146), 'eccCh02.Point', 'Point', ([], {'x': '(3)', 'y': '(-7)', 'a': '(5)', 'b': '(7)'}), '(x=3, y=-7, a=5, b=7)\n', (125, 146), False, 'from eccCh02 import Point\n'), ((159, 186), 'eccCh02.Point', 'Point', ([], {'x': '(18)', 'y': '(77)', 'a': '(5)', 'b': '(7)'}), '(x=18, y=77, a=5, b=7)\n', (164, 186), False, '... |
#%%
import numpy as np
from sapai.data import data
from sapai.rand import MockRandomState
#%%
class Food():
def __init__(self,
name="food-none",
shop=None,
team=[],
seed_state = None):
"""
Food class definition the types of ... | [
"sapai.rand.MockRandomState",
"numpy.random.RandomState"
] | [((661, 684), 'numpy.random.RandomState', 'np.random.RandomState', ([], {}), '()\n', (682, 684), True, 'import numpy as np\n'), ((804, 821), 'sapai.rand.MockRandomState', 'MockRandomState', ([], {}), '()\n', (819, 821), False, 'from sapai.rand import MockRandomState\n'), ((3925, 3948), 'numpy.random.RandomState', 'np.r... |