code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import torch
import torch.nn as nn
class VanillaCNN(nn.Module):
def __init__(self):
super(VanillaCNN, self).__init__()
#############################################################################
# TODO: Initialize the Vanilla CNN #
# ... | [
"torch.nn.ReLU",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.Conv2d"
] | [((1205, 1345), 'torch.nn.Conv2d', 'nn.Conv2d', (['self.conv_input_dim', 'self.conv_output_dim', 'self.convkernel_dim'], {'stride': 'self.convkernel_stride', 'padding': 'self.convInput_padding'}), '(self.conv_input_dim, self.conv_output_dim, self.convkernel_dim,\n stride=self.convkernel_stride, padding=self.convInpu... |
import random
import pandas as pd
import pytest
from evalml.preprocessing.data_splitters import BalancedClassificationSampler
@pytest.mark.parametrize("ratio,samples,percentage,seed",
[(1, 1, 0.2, 1),
(3.3, 101, 0.5, 100)])
def test_balanced_classification_init(rat... | [
"pandas.Series",
"random.choice",
"pytest.mark.parametrize",
"pytest.raises",
"evalml.preprocessing.data_splitters.BalancedClassificationSampler",
"pandas.testing.assert_frame_equal",
"pandas.testing.assert_series_equal"
] | [((131, 232), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ratio,samples,percentage,seed"""', '[(1, 1, 0.2, 1), (3.3, 101, 0.5, 100)]'], {}), "('ratio,samples,percentage,seed', [(1, 1, 0.2, 1), (\n 3.3, 101, 0.5, 100)])\n", (154, 232), False, 'import pytest\n'), ((1307, 1353), 'pytest.mark.parametrize... |
import itertools
from sims4.tuning.geometric import TunableDistanceSquared
from sims4.tuning.tunable import HasTunableSingletonFactory, AutoFactoryInit, TunableRange, TunableVariant
import sims4.math
class _WaypointStitchingBase(HasTunableSingletonFactory, AutoFactoryInit):
def __call__(self, waypoints, loops=1):... | [
"sims4.tuning.tunable.TunableRange",
"sims4.tuning.geometric.TunableDistanceSquared",
"itertools.repeat"
] | [((500, 682), 'sims4.tuning.geometric.TunableDistanceSquared', 'TunableDistanceSquared', ([], {'description': '"""\n If the route\'s cumulative distance is more than this value, the\n route is split.\n """', 'default': '(500)'}), '(description=\n """\n If the route\'s cumu... |
from lk_utils import relpath
from rich_click import Path
from ._vendor.rich_click_ext import click
@click.grp(help='PyPortable Installer command line interface.')
def cli():
pass
@click.cmd()
@click.arg('directory', default='.', type=Path())
def init(directory='.'):
"""
Initialize project with template... | [
"os.path.exists",
"lk_utils.relpath",
"rich_click.Path",
"shutil.copyfile",
"os.mkdir",
"os.remove"
] | [((664, 700), 'lk_utils.relpath', 'relpath', (['"""./template/pyproject.json"""'], {}), "('./template/pyproject.json')\n", (671, 700), False, 'from lk_utils import relpath\n'), ((878, 902), 'shutil.copyfile', 'copyfile', (['file_i', 'file_o'], {}), '(file_i, file_o)\n', (886, 902), False, 'from shutil import copyfile\n... |
#!/usr/bin/env python3
import os
from shutil import copyfile
import argparse
from subprocess import call
parser = argparse.ArgumentParser()
parser.add_argument('--prod', help='Copy prod version.', action='store_true')
parser.add_argument('--dev', help='Copy dev version.', action='store_true')
parser.add_argument('--c... | [
"shutil.copyfile",
"os.path.join",
"argparse.ArgumentParser",
"os.getcwd"
] | [((116, 141), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (139, 141), False, 'import argparse\n'), ((415, 426), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (424, 426), False, 'import os\n'), ((446, 505), 'os.path.join', 'os.path.join', (['cfs_project_base', '""".."""', '"""chartfactor-toolki... |
import numpy as np
import pyspark.sql.functions as F
import pyspark.sql.types as T
from pyspark.ml.feature import IDF, Tokenizer, CountVectorizer
def isin(element, test_elements, assume_unique=False, invert=False):
"""
Impliments the numpy function isin() for legacy versions of
the library
"""
ele... | [
"pyspark.ml.feature.IDF",
"pyspark.ml.feature.Tokenizer",
"numpy.in1d",
"numpy.asarray",
"pyspark.ml.feature.CountVectorizer",
"pyspark.sql.functions.col"
] | [((327, 346), 'numpy.asarray', 'np.asarray', (['element'], {}), '(element)\n', (337, 346), True, 'import numpy as np\n'), ((2063, 2114), 'pyspark.ml.feature.Tokenizer', 'Tokenizer', ([], {'inputCol': '"""__input"""', 'outputCol': '"""__tokens"""'}), "(inputCol='__input', outputCol='__tokens')\n", (2072, 2114), False, '... |
#!/usr/bin/env python
#
# Copyright (C) 2016 <NAME> <<EMAIL>>
#
# 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 applic... | [
"re.match",
"re.compile"
] | [((638, 674), 're.compile', 're.compile', (['"""^[a-zA-Z0-9_-]+$"""', 're.U'], {}), "('^[a-zA-Z0-9_-]+$', re.U)\n", (648, 674), False, 'import re\n'), ((1205, 1246), 're.match', 're.match', (['"""^[A-Za-z0-9+/]+[=]{0,3}$"""', 'key'], {}), "('^[A-Za-z0-9+/]+[=]{0,3}$', key)\n", (1213, 1246), False, 'import re\n')] |
import math, pickle
from copy import deepcopy
from itertools import count
from functools import reduce
import numpy as np
# from qiskit import QuantumCircuit, QuantumRegister, execute
# # from qiskit.extensions import Initialize
# from qiskit.circuit.library import Diagonal, GroverOperator
#from tqdm.notebook import... | [
"pickle.dump",
"functools.reduce",
"numpy.random.choice",
"numpy.where",
"pickle.load",
"math.sqrt",
"numpy.max",
"numpy.exp",
"numpy.sum",
"numpy.random.randint",
"itertools.count",
"numpy.empty",
"numpy.append",
"math.cos",
"math.sin",
"numpy.arange"
] | [((4782, 4789), 'itertools.count', 'count', ([], {}), '()\n', (4787, 4789), False, 'from itertools import count\n'), ((5104, 5148), 'functools.reduce', 'reduce', (['(lambda e, i: e + prob[i])', 'flags', '(0.0)'], {}), '(lambda e, i: e + prob[i], flags, 0.0)\n', (5110, 5148), False, 'from functools import reduce\n'), ((... |
from raytracing import *
import numpy
import matplotlib.pyplot as plt
from matplotlib import pyplot as plt
import signal
import os
def sig(a, b):
print("got sigint, exitting!")
os._exit(0)
def timercb(e):
print("timer")
signal.signal(signal.SIGINT, sig)
f = 50
f_obj = 5
f_tube = 100
f_galvo = 100
f_pol... | [
"signal.signal",
"matplotlib.pyplot.plot",
"numpy.linspace",
"os._exit",
"matplotlib.pyplot.show"
] | [((235, 268), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'sig'], {}), '(signal.SIGINT, sig)\n', (248, 268), False, 'import signal\n'), ((348, 375), 'numpy.linspace', 'numpy.linspace', (['(-20)', '(20)', '(21)'], {}), '(-20, 20, 21)\n', (362, 375), False, 'import numpy\n'), ((978, 992), 'matplotlib.pyplot.plot... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Expand a shortened URL"
class Input:
FOLLOW = "follow"
URL = "url"
class Output:
URL = "url"
class ExpandInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": ... | [
"json.loads"
] | [((269, 704), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "follow": {\n "type": "boolean",\n "title": "Follow",\n "description": "Whether to follow the URL",\n "default": false,\n "order": 2\n },\n "url": {\n "type": ... |
from pathlib import Path
from sld.yaml import open_yaml
data_dir = Path.cwd() / "tests" / "data"
test_yaml = data_dir / "test.yaml"
def test_open_yaml():
yaml_contents = open_yaml(test_yaml)
assert len(yaml_contents) == 4
assert yaml_contents["a"] == 1
assert yaml_contents["b"] == 2
assert yaml_... | [
"sld.yaml.open_yaml",
"pathlib.Path.cwd"
] | [((178, 198), 'sld.yaml.open_yaml', 'open_yaml', (['test_yaml'], {}), '(test_yaml)\n', (187, 198), False, 'from sld.yaml import open_yaml\n'), ((69, 79), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (77, 79), False, 'from pathlib import Path\n')] |
import unittest
import time
from server.devices.base import BaseEnvironment
from server.forecasting.simulation.devices.consumers import SimulatedThermalConsumer
from server.forecasting.simulation.devices.storages import SimulatedHeatStorage
class SimulatedThermalConsumerTests(unittest.TestCase):
def setUp(self)... | [
"server.forecasting.simulation.devices.consumers.SimulatedThermalConsumer",
"server.devices.base.BaseEnvironment",
"server.forecasting.simulation.devices.storages.SimulatedHeatStorage"
] | [((336, 366), 'server.devices.base.BaseEnvironment', 'BaseEnvironment', ([], {'forecast': '(True)'}), '(forecast=True)\n', (351, 366), False, 'from server.devices.base import BaseEnvironment\n'), ((391, 423), 'server.forecasting.simulation.devices.consumers.SimulatedThermalConsumer', 'SimulatedThermalConsumer', (['(0)'... |
#!/usr/bin/env python
import sys
import os
try:
from setuptools import setup
setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
VERSION = "0.0.4"
setup(
name="python-shorturl",
version=VERSION,
... | [
"os.system",
"sys.exit"
] | [((185, 226), 'os.system', 'os.system', (['"""python setup.py sdist upload"""'], {}), "('python setup.py sdist upload')\n", (194, 226), False, 'import os\n'), ((231, 241), 'sys.exit', 'sys.exit', ([], {}), '()\n', (239, 241), False, 'import sys\n')] |
# vim:ts=4:sts=4:sw=4:expandtab
"""Matching Clients with event queues.
"""
import collections
from satori.objects import Object
from satori.events.misc import Namespace
class Dispatcher(Object):
"""Abstract. Dispatches Events to Clients.
"""
def __init__(self):
self.queues = dict()
sel... | [
"collections.deque",
"satori.events.misc.Namespace"
] | [((432, 443), 'satori.events.misc.Namespace', 'Namespace', ([], {}), '()\n', (441, 443), False, 'from satori.events.misc import Namespace\n'), ((504, 523), 'collections.deque', 'collections.deque', ([], {}), '()\n', (521, 523), False, 'import collections\n'), ((552, 571), 'collections.deque', 'collections.deque', ([], ... |
from blueman.Functions import *
import gettext
from blueman.plugins.AppletPlugin import AppletPlugin
from blueman.main.SignalTracker import SignalTracker
from gi.repository import GObject
from gi.repository import Gtk
class DiscvManager(AppletPlugin):
__depends__ = ["Menu"]
__author__ = "Walmis"
__icon_... | [
"gi.repository.GObject.source_remove",
"blueman.main.SignalTracker.SignalTracker",
"gi.repository.GObject.timeout_add"
] | [((799, 814), 'blueman.main.SignalTracker.SignalTracker', 'SignalTracker', ([], {}), '()\n', (812, 814), False, 'from blueman.main.SignalTracker import SignalTracker\n'), ((1386, 1421), 'gi.repository.GObject.source_remove', 'GObject.source_remove', (['self.timeout'], {}), '(self.timeout)\n', (1407, 1421), False, 'from... |
"""
Generates a powershell script to install Windows agent - dcos_install.ps1
"""
import os
import os.path
import gen.build_deploy.util as util
import gen.template
import gen.util
import pkgpanda
import pkgpanda.util
def generate(gen_out, output_dir):
print("Generating Powershell configuration files for DC/OS"... | [
"os.path.realpath",
"pkgpanda.util.make_directory",
"pkgpanda.util.write_string"
] | [((533, 573), 'pkgpanda.util.make_directory', 'pkgpanda.util.make_directory', (['output_dir'], {}), '(output_dir)\n', (561, 573), False, 'import pkgpanda\n'), ((1642, 1712), 'pkgpanda.util.write_string', 'pkgpanda.util.write_string', (['install_script_filename', 'powershell_script'], {}), '(install_script_filename, pow... |
import os
import pandas as pd
import helpers.hgit as hgit
import helpers.hio as hio
import helpers.hsystem as hsysinte
import helpers.hunit_test as hunitest
class TestCsvToPq(hunitest.TestCase):
def test_csv_to_pq_script(self) -> None:
"""
Test that generated parquet dataset is correct.
... | [
"helpers.hio.create_dir",
"os.path.join",
"helpers.hunit_test.get_dir_signature",
"helpers.hgit.get_amp_abs_path",
"pandas.DataFrame",
"helpers.hsystem.system"
] | [((875, 895), 'helpers.hsystem.system', 'hsysinte.system', (['cmd'], {}), '(cmd)\n', (890, 895), True, 'import helpers.hsystem as hsysinte\n'), ((956, 1017), 'helpers.hunit_test.get_dir_signature', 'hunitest.get_dir_signature', (['pq_dir_path', 'include_file_content'], {}), '(pq_dir_path, include_file_content)\n', (982... |
import json
from os.path import join
data = join('data', 'ThemeProtoSet.json')
with open(data, encoding='UTF-8') as file:
data = json.load(file)
data = data['dataArray']['Array']['data']
theme_ionheight = {}
for theme in data:
theme_ionheight[theme['DisplayName']] = theme['IonHeight']
print(json.dumps(theme_... | [
"json.load",
"json.dumps",
"os.path.join"
] | [((45, 79), 'os.path.join', 'join', (['"""data"""', '"""ThemeProtoSet.json"""'], {}), "('data', 'ThemeProtoSet.json')\n", (49, 79), False, 'from os.path import join\n'), ((134, 149), 'json.load', 'json.load', (['file'], {}), '(file)\n', (143, 149), False, 'import json\n'), ((303, 360), 'json.dumps', 'json.dumps', (['th... |
def do():
import trimesh
return trimesh.creation.icosphere().convex_hull
if __name__ == '__main__':
do()
| [
"trimesh.creation.icosphere"
] | [((42, 70), 'trimesh.creation.icosphere', 'trimesh.creation.icosphere', ([], {}), '()\n', (68, 70), False, 'import trimesh\n')] |
import torch
from torch.utils.data import DataLoader, TensorDataset
from argparse import Namespace
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import numpy as np
import h5py
import json
import os
def load_data_1scale(hdf5_file, ndata, batch_size, singlescale=True):
with h5py.File(hdf5_file... | [
"torch.FloatTensor",
"torch.utils.data.TensorDataset",
"h5py.File"
] | [((301, 326), 'h5py.File', 'h5py.File', (['hdf5_file', '"""r"""'], {}), "(hdf5_file, 'r')\n", (310, 326), False, 'import h5py\n'), ((538, 564), 'torch.utils.data.TensorDataset', 'TensorDataset', (['*data_tuple'], {}), '(*data_tuple)\n', (551, 564), False, 'from torch.utils.data import DataLoader, TensorDataset\n'), ((7... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2019/9/21 14:06
# @Author : ganliang
# @File : ndcopy.py
# @Desc : 数据复制
import numpy as np
a = np.arange(10)
b = np.copy(a)
print ("修改之前:")
print (a)
print (id(a))
print (b)
print (id(b))
a[0] = 100
print ("修改之后:")
print (a)
print (id(a))
print (b)
pr... | [
"numpy.copy",
"numpy.arange"
] | [((163, 176), 'numpy.arange', 'np.arange', (['(10)'], {}), '(10)\n', (172, 176), True, 'import numpy as np\n'), ((181, 191), 'numpy.copy', 'np.copy', (['a'], {}), '(a)\n', (188, 191), True, 'import numpy as np\n')] |
import requests
import json
import time
import logging
log = logging.getLogger(__name__)
sh = logging.StreamHandler()
log.addHandler(sh)
log.setLevel(logging.INFO)
from nose.tools import with_setup
import pymongo
from bson.objectid import ObjectId
db = pymongo.MongoClient('mongodb://localhost:9001/scitran').get_defa... | [
"logging.getLogger",
"json.loads",
"logging.StreamHandler",
"nose.tools.with_setup",
"requests.Session",
"bson.objectid.ObjectId",
"json.dumps",
"pymongo.MongoClient",
"time.time"
] | [((62, 89), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (79, 89), False, 'import logging\n'), ((95, 118), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (116, 118), False, 'import logging\n'), ((2088, 2121), 'nose.tools.with_setup', 'with_setup', (['setup_db', 'tea... |
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
import math
"""
############# GENERAL GAS CLASS ###########
"""
class Gas():
def __init__(self,T,P,R_u=8.31447):
self.T = T
self.P = P
self.R_u=R_u
self.normalshock=self.Shock(s... | [
"matplotlib.pyplot.cm.get_cmap",
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"numpy.log",
"matplotlib.pyplot.figure",
"numpy.linspace",
"numpy.concatenate",
"numpy.sin",
"matplotl... | [((1554, 1579), 'numpy.sqrt', 'np.sqrt', (['(4 / np.pi * area)'], {}), '(4 / np.pi * area)\n', (1561, 1579), True, 'import numpy as np\n'), ((5698, 5742), 'numpy.concatenate', 'np.concatenate', (['(area_upward, area_downward)'], {}), '((area_upward, area_downward))\n', (5712, 5742), True, 'import numpy as np\n'), ((663... |
from importlib import import_module
def import_attribute(attribute_string):
module_string, attribute_name = attribute_string.rsplit('.', maxsplit=1)
return getattr(import_module(module_string), attribute_name)
| [
"importlib.import_module"
] | [((174, 202), 'importlib.import_module', 'import_module', (['module_string'], {}), '(module_string)\n', (187, 202), False, 'from importlib import import_module\n')] |
import numpy as np
import numpy.random as rnd
import simple_optimise as mlopt
vec = rnd.randn(10)
mat = rnd.randn(10, 10)
mat += mat.T
# Single output, single input
def f1_1(x):
return x**2.0
def fD_1(x):
return vec * x
def f1_D(x):
return x.dot(mat.dot(x))
def f1_DD(x):
return vec.dot(x.dot(v... | [
"simple_optimise.finite_difference",
"numpy.random.randn"
] | [((86, 99), 'numpy.random.randn', 'rnd.randn', (['(10)'], {}), '(10)\n', (95, 99), True, 'import numpy.random as rnd\n'), ((106, 123), 'numpy.random.randn', 'rnd.randn', (['(10)', '(10)'], {}), '(10, 10)\n', (115, 123), True, 'import numpy.random as rnd\n'), ((368, 402), 'simple_optimise.finite_difference', 'mlopt.fini... |
import natsort
import numpy as np
import pandas as pd
import plotly.io as pio
import plotly.express as px
import plotly.graph_objects as go
import plotly.figure_factory as ff
import re
import traceback
from io import BytesIO
from sklearn.decomposition import PCA
from sklearn.metrics import pairwise as pw
import json
im... | [
"numpy.prod",
"plotly.graph_objects.layout.YAxis",
"matplotlib.pyplot.Figure",
"io.BytesIO",
"numpy.isfinite",
"pandas.MultiIndex.from_tuples",
"statistics.harmonic_mean",
"plotly.express.box",
"plotly.graph_objects.Bar",
"plotly.graph_objects.Heatmap",
"plotly.express.scatter",
"sklearn.decom... | [((182063, 182074), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (182072, 182074), True, 'import plotly.graph_objects as go\n'), ((633, 652), 'numpy.unique', 'np.unique', (['x.values'], {}), '(x.values)\n', (642, 652), True, 'import numpy as np\n'), ((779, 791), 'numpy.unique', 'np.unique', (['x'], {})... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | [
"logging.basicConfig",
"logging.getLogger",
"logging.debug",
"os.environ.get",
"os.path.join",
"os.getpid",
"time.time"
] | [((666, 716), 'os.environ.get', 'os.environ.get', (['"""SAGEMAKER_METRICS_DIRECTORY"""', '"""."""'], {}), "('SAGEMAKER_METRICS_DIRECTORY', '.')\n", (680, 716), False, 'import os\n'), ((718, 757), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (737, 757), False, ... |
from h2o.estimators import H2ODeepLearningEstimator, H2OGradientBoostingEstimator, H2OGeneralizedLinearEstimator, \
H2ONaiveBayesEstimator, H2ORandomForestEstimator
from sklearn.base import BaseEstimator
import h2o
import pandas as pd
class H2ODecorator(BaseEstimator):
def __init__(self, est_type, est_params,... | [
"h2o.init",
"h2o.H2OFrame"
] | [((1080, 1139), 'h2o.init', 'h2o.init', ([], {'nthreads': 'self.nthreads', 'max_mem_size': 'self.mem_max'}), '(nthreads=self.nthreads, max_mem_size=self.mem_max)\n', (1088, 1139), False, 'import h2o\n'), ((1245, 1271), 'h2o.H2OFrame', 'h2o.H2OFrame', ([], {'python_obj': 'X'}), '(python_obj=X)\n', (1257, 1271), False, '... |
import MagicClick.KCrawler as crawler
import time
if __name__ == "__main__":
# 1. 日间K线数据获取回测
start = time.time()
df_sh_600000 = crawler.get_day_k_data_pre_adjust("sh.600000", [])
print("time cost: ", time.time() - start)
print(df_sh_600000)
start = time.time()
df_sh_600000 = crawler.ge... | [
"MagicClick.KCrawler.get_15_minutes_k_data_post_adjust",
"MagicClick.KCrawler.get_month_k_data_post_adjust",
"MagicClick.KCrawler.get_30_minutes_k_data_pre_adjust",
"MagicClick.KCrawler.get_week_k_data_no_adjust",
"MagicClick.KCrawler.get_60_minutes_k_data_post_adjust",
"MagicClick.KCrawler.get_60_minutes... | [((110, 121), 'time.time', 'time.time', ([], {}), '()\n', (119, 121), False, 'import time\n'), ((141, 191), 'MagicClick.KCrawler.get_day_k_data_pre_adjust', 'crawler.get_day_k_data_pre_adjust', (['"""sh.600000"""', '[]'], {}), "('sh.600000', [])\n", (174, 191), True, 'import MagicClick.KCrawler as crawler\n'), ((279, 2... |
from django.conf import settings
from django.db.backends.postgresql.creation import DatabaseCreation
from psycopg2_extension.utils import init_database
def _patch_execute_create_test_db(self, cursor, parameters, keepdb=False):
if keepdb and self._database_exists(cursor, parameters['dbname']):
return
... | [
"psycopg2_extension.utils.init_database"
] | [((646, 686), 'psycopg2_extension.utils.init_database', 'init_database', (['self.connection', 'self.log'], {}), '(self.connection, self.log)\n', (659, 686), False, 'from psycopg2_extension.utils import init_database\n')] |
import os
import base64
import hashlib
import datetime
# parse an ISO formatted timestamp string, converting it to a python datetime object;
# note: this function is also defined in server code
def parse_json_datetime(json_timestamp):
assert json_timestamp.endswith('Z')
format = ''
if '.' in json_timestam... | [
"datetime.datetime.strptime",
"os.urandom"
] | [((514, 564), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['json_timestamp', 'format'], {}), '(json_timestamp, format)\n', (540, 564), False, 'import datetime\n'), ((681, 695), 'os.urandom', 'os.urandom', (['(32)'], {}), '(32)\n', (691, 695), False, 'import os\n')] |
import click
from kfp import client
from kfp.cli import output
from kfp.cli.utils import parsing
from kfp_server_api.models.api_experiment import ApiExperiment
@click.group()
def experiment():
"""Manage experiment resources."""
pass
@experiment.command()
@click.option(
'-d',
'--description',
hel... | [
"click.argument",
"kfp.cli.utils.parsing.get_param_descr",
"click.confirm",
"click.group",
"click.option",
"kfp.cli.output.print_output",
"kfp.cli.output.print_deleted_text"
] | [((163, 176), 'click.group', 'click.group', ([], {}), '()\n', (174, 176), False, 'import click\n'), ((429, 451), 'click.argument', 'click.argument', (['"""name"""'], {}), "('name')\n", (443, 451), False, 'import click\n'), ((1921, 1952), 'click.argument', 'click.argument', (['"""experiment-id"""'], {}), "('experiment-i... |
from flask import Flask
from model import Model
from app.config import Config
app = Flask(__name__)
app.config.from_object(Config)
model = Model('models/LogisticRegressionCV.pickle')
model.load()
from app import routes | [
"model.Model",
"flask.Flask"
] | [((85, 100), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (90, 100), False, 'from flask import Flask\n'), ((141, 184), 'model.Model', 'Model', (['"""models/LogisticRegressionCV.pickle"""'], {}), "('models/LogisticRegressionCV.pickle')\n", (146, 184), False, 'from model import Model\n')] |
import processor
my_list = [5, 'Dan', '4', 7, 'Steve', 'Amy', 'Rhonda', 4, '9', 'Jill', 7, 'Kim']
my_bad_list = 5
numbers = processor.process_numbers(my_list)
print(numbers)
names = processor.process_names(my_list)
print(names)
numbers = processor.process_numbers(my_bad_list)
print(numbers)
names = processor.proce... | [
"processor.process_numbers",
"processor.process_names"
] | [((126, 160), 'processor.process_numbers', 'processor.process_numbers', (['my_list'], {}), '(my_list)\n', (151, 160), False, 'import processor\n'), ((185, 217), 'processor.process_names', 'processor.process_names', (['my_list'], {}), '(my_list)\n', (208, 217), False, 'import processor\n'), ((242, 280), 'processor.proce... |
from abc import ABC
from distutils.cmd import Command
from distutils.errors import DistutilsOptionError
from pathlib import Path
from typing import Optional, List
PathList = Optional[List[Path]]
class PathCommand(Command, ABC):
def ensure_path_list(self, option):
val = getattr(self, option)
if va... | [
"pathlib.Path"
] | [((497, 504), 'pathlib.Path', 'Path', (['s'], {}), '(s)\n', (501, 504), False, 'from pathlib import Path\n')] |
'''OpenGL extension EXT.color_subtable
Automatically generated by the get_gl_extensions script, do not edit!
'''
from OpenGL import platform, constants, constant, arrays
from OpenGL import extensions
from OpenGL.GL import glget
import ctypes
EXTENSION_NAME = 'GL_EXT_color_subtable'
_DEPRECATED = False
glColorSubTable... | [
"OpenGL.extensions.hasGLExtension",
"OpenGL.platform.createExtensionFunction"
] | [((326, 804), 'OpenGL.platform.createExtensionFunction', 'platform.createExtensionFunction', (['"""glColorSubTableEXT"""'], {'dll': 'platform.GL', 'extension': 'EXTENSION_NAME', 'resultType': 'None', 'argTypes': '(constants.GLenum, constants.GLsizei, constants.GLsizei, constants.GLenum,\n constants.GLenum, ctypes.c_... |
import matplotlib.pyplot as plt
import numpy as np
# データ生成
x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)
# プロット領域(Figure, Axes)の初期化
plt.figure(figsize=(12, 8))
fig1=plt.subplot(131)
fig2=plt.subplot(132)
fig3=plt.subplot(133)
# 棒グラフの作成
fig1.bar([1,2,3],[3,4,5])
fig1.set_xlabel("x")
fig1.set_ylabel("y")
f... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.cos",
"numpy.sin",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((64, 87), 'numpy.linspace', 'np.linspace', (['(0)', '(10)', '(100)'], {}), '(0, 10, 100)\n', (75, 87), True, 'import numpy as np\n'), ((93, 102), 'numpy.sin', 'np.sin', (['x'], {}), '(x)\n', (99, 102), True, 'import numpy as np\n'), ((108, 117), 'numpy.cos', 'np.cos', (['x'], {}), '(x)\n', (114, 117), True, 'import n... |
from .models import *
from django.shortcuts import render
from django.core.handlers.wsgi import WSGIRequest
from django.http import JsonResponse, HttpResponse
from django.db import connection
from .utilities import reconstruct_params, post_request_to_dict_slicer, values_from_dict_by_keys, smart_int, \
null_check, r... | [
"django.shortcuts.render",
"django.http.JsonResponse",
"os.path.join",
"sys.exc_info",
"datetime.datetime.now",
"datetime.date",
"os.walk"
] | [((1463, 1479), 'django.http.JsonResponse', 'JsonResponse', (['{}'], {}), '({})\n', (1475, 1479), False, 'from django.http import JsonResponse, HttpResponse\n'), ((2454, 2470), 'django.http.JsonResponse', 'JsonResponse', (['{}'], {}), '({})\n', (2466, 2470), False, 'from django.http import JsonResponse, HttpResponse\n'... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import cv2, numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--path', default='../data/Lena.png', help='Image path.')
params = parser.parse_args()
image = cv2.imread(params.path)
image_to_show = np.copy(image)
mouse_pressed = False
s_x... | [
"cv2.setMouseCallback",
"numpy.copy",
"cv2.rectangle",
"argparse.ArgumentParser",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.namedWindow"
] | [((98, 123), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (121, 123), False, 'import argparse\n'), ((239, 262), 'cv2.imread', 'cv2.imread', (['params.path'], {}), '(params.path)\n', (249, 262), False, 'import cv2, numpy as np\n'), ((279, 293), 'numpy.copy', 'np.copy', (['image'], {}), '(image... |
from django.contrib import admin
from .models import Cursos, Aulas, Comentarios, NotasAulas
from django.contrib.admin.decorators import display
@admin.register(Cursos)
class CursosAdm(admin.ModelAdmin):
search_fields = ['nome',]
@admin.register(Aulas)
class AulasAdm(admin.ModelAdmin):
list_display = ('nome', ... | [
"django.contrib.admin.register"
] | [((146, 168), 'django.contrib.admin.register', 'admin.register', (['Cursos'], {}), '(Cursos)\n', (160, 168), False, 'from django.contrib import admin\n'), ((236, 257), 'django.contrib.admin.register', 'admin.register', (['Aulas'], {}), '(Aulas)\n', (250, 257), False, 'from django.contrib import admin\n'), ((375, 402), ... |
from django.contrib import admin
from . import models
# Register your models here.
@admin.register(models.Image)
class ImageAdmin(admin.ModelAdmin):
# 어드민 패널 시작할때 보일 리스트 설정 하는 펑션
list_display = (
'id',
'title',
'creator',
'kinds',
'report_count',
'created_at',
... | [
"django.contrib.admin.register"
] | [((86, 114), 'django.contrib.admin.register', 'admin.register', (['models.Image'], {}), '(models.Image)\n', (100, 114), False, 'from django.contrib import admin\n'), ((526, 553), 'django.contrib.admin.register', 'admin.register', (['models.Like'], {}), '(models.Like)\n', (540, 553), False, 'from django.contrib import a... |
"""Contains tests for the model abstractions and different models."""
import unittest
from hbaselines.common.train import parse_options, get_hyperparameters
from hbaselines.common.train import DEFAULT_TD3_HP
class TestTrain(unittest.TestCase):
"""A simple test to get Travis running."""
def test_parse_options... | [
"unittest.main",
"hbaselines.common.train.parse_options",
"hbaselines.common.train.get_hyperparameters"
] | [((3553, 3568), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3566, 3568), False, 'import unittest\n'), ((376, 415), 'hbaselines.common.train.parse_options', 'parse_options', (['""""""', '""""""'], {'args': "['AntMaze']"}), "('', '', args=['AntMaze'])\n", (389, 415), False, 'from hbaselines.common.train import p... |
#!/usr/bin/env /usr/bin/python3
import sys
import numpy as np
import pymesh
import matplotlib
matplotlib.use('Qt5Agg')
from matplotlib import cm
from matplotlib import pyplot as plt
from matplotlib.backends.backend_qt5agg import (
FigureCanvasQTAgg as FigureCanvas,
NavigationToolbar2QT as NavigationToolb... | [
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"numpy.sqrt",
"numpy.log",
"numpy.logical_not",
"matplotlib.collections.LineCollection",
"numpy.count_nonzero",
"numpy.array",
"matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg.updateGeometry",
"PyQt5.QtWidgets.QApplication",
"PyQt5.Qt... | [((95, 119), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (109, 119), False, 'import matplotlib\n'), ((881, 914), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (904, 914), False, 'import warnings\n'), ((2165, 2185), 'numpy.cross', 'np.cross'... |
import matplotlib.pyplot as plt
import numpy as np
import pymc3
import scipy.stats as stats
plt.style.use("ggplot")
# Parameter values for prior and analytic posterior
n = 50
z = 10
alpha = 12
beta = 12
alpha_post = 22
beta_post = 52
# How many samples to carry out for MCMC
iterations = 100000
# Use PyMC3 to constr... | [
"pymc3.Metropolis",
"matplotlib.pyplot.hist",
"pymc3.find_MAP",
"matplotlib.pyplot.ylabel",
"pymc3.traceplot",
"matplotlib.pyplot.xlabel",
"pymc3.Beta",
"matplotlib.pyplot.style.use",
"pymc3.Binomial",
"numpy.linspace",
"pymc3.sample",
"scipy.stats.beta.pdf",
"pymc3.Model",
"matplotlib.pyp... | [((93, 116), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""ggplot"""'], {}), "('ggplot')\n", (106, 116), True, 'import matplotlib.pyplot as plt\n'), ((354, 367), 'pymc3.Model', 'pymc3.Model', ([], {}), '()\n', (365, 367), False, 'import pymc3\n'), ((1078, 1182), 'matplotlib.pyplot.hist', 'plt.hist', (["trace['t... |
import pandas as pd
import deeppavlov
from deeppavlov.models.embedders.elmo_embedder import ELMoEmbedder
elmo = ELMoEmbedder()
# verification = pd.read_csv('/mnt/shdstorage/tmp/classif_tmp/comments_big.csv')
# print(len(verification)) # 15270
previous_weights = "models_dir/model_1542892329.h5"
timing = previous_weig... | [
"deeppavlov.models.embedders.elmo_embedder.ELMoEmbedder",
"pandas.read_csv"
] | [((114, 128), 'deeppavlov.models.embedders.elmo_embedder.ELMoEmbedder', 'ELMoEmbedder', ([], {}), '()\n', (126, 128), False, 'from deeppavlov.models.embedders.elmo_embedder import ELMoEmbedder\n'), ((502, 535), 'pandas.read_csv', 'pd.read_csv', (['path_to_verification'], {}), '(path_to_verification)\n', (513, 535), Tru... |
import os
import unittest
import numpy as np
from pyNastran.bdf.bdf import BDF, BDFCard, CBAR, PBAR, PBARL, GRID, MAT1
from pyNastran.bdf.field_writer_8 import print_card_8
from pyNastran.bdf.mesh_utils.mass_properties import (
mass_properties, mass_properties_nsm) #mass_properties_breakdown
from pyNastran.bdf.c... | [
"pyNastran.op2.op2.OP2",
"pyNastran.bdf.bdf.GRID",
"numpy.array",
"unittest.main",
"os.remove",
"os.path.exists",
"pyNastran.bdf.bdf.MAT1",
"pyNastran.bdf.field_writer_8.print_card_8",
"pyNastran.bdf.mesh_utils.loads.sum_forces_moments",
"numpy.allclose",
"pyNastran.bdf.cards.test.utils.save_loa... | [((25633, 25648), 'unittest.main', 'unittest.main', ([], {}), '()\n', (25646, 25648), False, 'import unittest\n'), ((902, 922), 'pyNastran.bdf.field_writer_8.print_card_8', 'print_card_8', (['fields'], {}), '(fields)\n', (914, 922), False, 'from pyNastran.bdf.field_writer_8 import print_card_8\n'), ((959, 979), 'pyNast... |
from flask import Blueprint
from flask_restful import Api
from api.resources.demo import DemoResource
from api.resources.login import LoginResource
api_bp_v1 = Blueprint('bp_v1', __name__)
api_v1 = Api(api_bp_v1, '/v1')
api_v1.add_resource(DemoResource, '/demo')
api_v1.add_resource(LoginResource, '/login')
BLUEPRIN... | [
"flask.Blueprint",
"flask_restful.Api"
] | [((162, 190), 'flask.Blueprint', 'Blueprint', (['"""bp_v1"""', '__name__'], {}), "('bp_v1', __name__)\n", (171, 190), False, 'from flask import Blueprint\n'), ((200, 221), 'flask_restful.Api', 'Api', (['api_bp_v1', '"""/v1"""'], {}), "(api_bp_v1, '/v1')\n", (203, 221), False, 'from flask_restful import Api\n')] |
from moviepy.editor import VideoFileClip
from davg.lanefinding.Pipeline import Pipeline
left_line = None
right_line = None
pipeline = Pipeline()
def lane_line_diag(img):
global left_line, right_line, pipeline
screen, left_line, right_line = pipeline.visualize_lanes_using_diagnostic_screen(img, left_line, righ... | [
"moviepy.editor.VideoFileClip",
"davg.lanefinding.Pipeline.Pipeline"
] | [((135, 145), 'davg.lanefinding.Pipeline.Pipeline', 'Pipeline', ([], {}), '()\n', (143, 145), False, 'from davg.lanefinding.Pipeline import Pipeline\n'), ((434, 452), 'moviepy.editor.VideoFileClip', 'VideoFileClip', (['src'], {}), '(src)\n', (447, 452), False, 'from moviepy.editor import VideoFileClip\n')] |
#!/usr/bin/env python
import subprocess
import sys
from os.path import join
if __name__ == "__main__":
OUT = 'out/cquery.vsix'
VSCE = 'vsce.cmd' if sys.platform == 'win32' else 'vsce'
VSCE = join('node_modules', '.bin', VSCE)
sys.exit(subprocess.call([VSCE, 'package', '-o', OUT]))
| [
"os.path.join",
"subprocess.call"
] | [((199, 233), 'os.path.join', 'join', (['"""node_modules"""', '""".bin"""', 'VSCE'], {}), "('node_modules', '.bin', VSCE)\n", (203, 233), False, 'from os.path import join\n'), ((245, 290), 'subprocess.call', 'subprocess.call', (["[VSCE, 'package', '-o', OUT]"], {}), "([VSCE, 'package', '-o', OUT])\n", (260, 290), False... |
import requests
class RapidProClient:
def __init__(self, thread):
self.thread = thread
def send_reply(self, text):
response = requests.get(url=self.thread.chatbot.request_url, params={
'from': self.thread.uuid,
'text': text,
}, timeout=10)
return respo... | [
"requests.get"
] | [((154, 269), 'requests.get', 'requests.get', ([], {'url': 'self.thread.chatbot.request_url', 'params': "{'from': self.thread.uuid, 'text': text}", 'timeout': '(10)'}), "(url=self.thread.chatbot.request_url, params={'from': self.\n thread.uuid, 'text': text}, timeout=10)\n", (166, 269), False, 'import requests\n')] |
import sys
from postagger.utils.classifier import MaximumEntropyClassifier
from postagger.utils.common import timeit, get_data_path
from postagger.utils.common import get_tags
from postagger.utils.preprocess import load_save_preprocessed_data
from postagger.utils.decoder import CompData
from postagger.utils.classifier ... | [
"postagger.utils.common.get_tags",
"postagger.utils.preprocess.load_save_preprocessed_data",
"postagger.utils.classifier.save_load_init_model",
"postagger.utils.classifier.MaximumEntropyClassifier",
"postagger.utils.common.get_data_path",
"postagger.utils.decoder.CompData"
] | [((1083, 1103), 'postagger.utils.common.get_data_path', 'get_data_path', (['train'], {}), '(train)\n', (1096, 1103), False, 'from postagger.utils.common import timeit, get_data_path\n'), ((1126, 1146), 'postagger.utils.decoder.CompData', 'CompData', (['train_path'], {}), '(train_path)\n', (1134, 1146), False, 'from pos... |
import json
my_data = {
'device_name': 'rtr1',
'ip_addr': '10.1.1.1',
'username': 'admin',
'password': '<PASSWORD>',
}
some_list = list(range(10))
my_data['some_list'] = some_list
my_data['null_value'] = None
my_data['a_bool'] = False
#print()
#print(some_list)
#print()
#print(my_data)
filename = "... | [
"json.dumps",
"json.dump"
] | [((375, 406), 'json.dump', 'json.dump', (['my_data', 'f'], {'indent': '(4)'}), '(my_data, f, indent=4)\n', (384, 406), False, 'import json\n'), ((505, 524), 'json.dumps', 'json.dumps', (['my_data'], {}), '(my_data)\n', (515, 524), False, 'import json\n')] |
import time
from copy import copy
with open("input/input13.txt") as f:
content = f.read().splitlines()
earliest_departure = int(content[0])
bus_ids = [int(val) for val in content[1].split(',') if val != 'x']
earliest_bus_id = None
minutes_to_wait = None
for bus_id in bus_ids:
minutes_late = earliest_departur... | [
"copy.copy",
"time.time"
] | [((991, 1005), 'copy.copy', 'copy', (['inverted'], {}), '(inverted)\n', (995, 1005), False, 'from copy import copy\n'), ((1599, 1610), 'time.time', 'time.time', ([], {}), '()\n', (1608, 1610), False, 'import time\n')] |
import json
import tweepy
with open("json/bots.json", "r") as bots:
default_bot = json.load(bots)["Default"]
auth = tweepy.OAuthHandler(default_bot["consumer_key"], default_bot["consumer_secret"])
auth.set_access_token(default_bot["access_token"], default_bot["access_token_secret"])
api = tweepy.API... | [
"json.load",
"tweepy.API",
"tweepy.Cursor",
"tweepy.OAuthHandler"
] | [((127, 212), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (["default_bot['consumer_key']", "default_bot['consumer_secret']"], {}), "(default_bot['consumer_key'], default_bot['consumer_secret']\n )\n", (146, 212), False, 'import tweepy\n'), ((310, 383), 'tweepy.API', 'tweepy.API', (['auth'], {'wait_on_rate_limit': ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 24 10:45:47 2020
@author: ben05
"""
import ATL11
import numpy as np
from scipy import stats
import sys, os, h5py, glob, csv
import io
import pointCollection as pc
import matplotlib.pyplot as plt
import matplotlib as mpl
from matplotlib.colors impor... | [
"csv.DictReader",
"argparse.ArgumentParser",
"os.getcwd",
"os.path.isfile",
"h5py.File",
"numpy.array",
"os.path.basename",
"numpy.dtype",
"os.remove"
] | [((4048, 4071), 'os.path.isfile', 'os.path.isfile', (['fileout'], {}), '(fileout)\n', (4062, 4071), False, 'import sys, os, h5py, glob, csv\n'), ((8659, 8684), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8682, 8684), False, 'import argparse\n'), ((4081, 4099), 'os.remove', 'os.remove', (['f... |
from PyQt5 import QtWidgets, QtCore, QtGui
from gui.email_confirm_dialog import Ui_Dialog
from gui import build
from wizard.tools import log
from gui import log_to_gui
logger = log.pipe_log(__name__)
class Main(QtWidgets.QDialog):
def __init__(self, parent, verification_code):
super(Main, self).__in... | [
"PyQt5.QtWidgets.QDialog.__init__",
"gui.log_to_gui.log_viewer",
"gui.email_confirm_dialog.Ui_Dialog",
"wizard.tools.log.pipe_log"
] | [((179, 201), 'wizard.tools.log.pipe_log', 'log.pipe_log', (['__name__'], {}), '(__name__)\n', (191, 201), False, 'from wizard.tools import log\n'), ((381, 421), 'PyQt5.QtWidgets.QDialog.__init__', 'QtWidgets.QDialog.__init__', (['self', 'parent'], {}), '(self, parent)\n', (407, 421), False, 'from PyQt5 import QtWidget... |
import os
import torch
import cv2
import numpy as np
import matplotlib.cm as cm
from src.utils.plotting import make_matching_figure
from src.loftr import LoFTR, default_cfg
# The default config uses dual-softmax.
# The outdoor and indoor models share the same config.
# You can change the default values like thr and c... | [
"src.loftr.LoFTR",
"torch.load",
"src.utils.plotting.make_matching_figure",
"torch.from_numpy",
"matplotlib.cm.jet",
"datetime.datetime.now",
"torch.no_grad",
"cv2.resize",
"cv2.imread"
] | [((348, 373), 'src.loftr.LoFTR', 'LoFTR', ([], {'config': 'default_cfg'}), '(config=default_cfg)\n', (353, 373), False, 'from src.loftr import LoFTR, default_cfg\n'), ((660, 702), 'cv2.imread', 'cv2.imread', (['img0_pth', 'cv2.IMREAD_GRAYSCALE'], {}), '(img0_pth, cv2.IMREAD_GRAYSCALE)\n', (670, 702), False, 'import cv2... |
"""Design a Simple Automaton (Finite State Machine)
https://www.codewars.com/kata/5268acac0d3f019add000203
Create a finite automaton that has three states. Finite automatons are the same as finite state machines for our purposes.
Our simple automaton, accepts the language of A, defined as {0, 1} and should hav... | [
"doctest.testmod"
] | [((3254, 3271), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (3269, 3271), False, 'import doctest\n')] |
from robomaster import robot
import time
if __name__ == '__main__':
ep_robot = robot.Robot()
ep_robot.initialize(conn_type="ap")
ep_chassis = ep_robot.chassis
ep_led = ep_robot.led
ep_chassis.move(x=2, y=0, z=0, xy_speed=0.75).wait_for_completed()
ep_chassis.move(x=0, y=0, z=90, xy_speed=1).w... | [
"robomaster.robot.Robot",
"time.sleep"
] | [((84, 97), 'robomaster.robot.Robot', 'robot.Robot', ([], {}), '()\n', (95, 97), False, 'from robomaster import robot\n'), ((1138, 1152), 'time.sleep', 'time.sleep', (['(20)'], {}), '(20)\n', (1148, 1152), False, 'import time\n')] |
from flask import Flask, render_template
from subprocess import call
app = Flask(__name__)
SENDER_CONFIG = '10101'
SEND_CONFIG = ['-u', '-s']
RECEIVER = {
'A': '1',
'B': '2',
'C': '3',
'D': '4',
}
STATES = {
'on':'1',
'off':'0'
}
def send_signal(receiver, state):
call(['./send', SENDER_CO... | [
"flask.render_template",
"subprocess.call",
"flask.Flask"
] | [((76, 91), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (81, 91), False, 'from flask import Flask, render_template\n'), ((295, 357), 'subprocess.call', 'call', (["['./send', SENDER_CONFIG, *SEND_CONFIG, receiver, state]"], {}), "(['./send', SENDER_CONFIG, *SEND_CONFIG, receiver, state])\n", (299, 357), ... |
"""This file is part of matrix2latex.
Python/MATLAB matrix to LaTeX table converter, originally by <NAME> https://code.google.com/p/matrix2latex/.
Inspired by the work of koehler at in.tum.de who has written a similar package only for matlab http://www.mathworks.com/matlabcentral/fileexchange/4894-matrix2latex.
This cu... | [
"re.match",
"fixEngineeringNotation.fix",
"sys.stderr.write",
"sys.exit",
"IOString.IOString",
"math.isnan"
] | [((14219, 14230), 'IOString.IOString', 'IOString', (['f'], {}), '(f)\n', (14227, 14230), False, 'from IOString import IOString\n'), ((1288, 1301), 'math.isnan', 'math.isnan', (['e'], {}), '(e)\n', (1298, 1301), False, 'import math\n'), ((16908, 16934), 'fixEngineeringNotation.fix', 'fix', (['formatted'], {'table': '(Tr... |
import os
from aztk.models.plugins.plugin_configuration import PluginConfiguration, PluginPort, PluginTargetRole
from aztk.models.plugins.plugin_file import PluginFile
dir_path = os.path.dirname(os.path.realpath(__file__))
def JupyterPlugin():
return PluginConfiguration(
name="jupyter",
ports=[Pl... | [
"os.path.realpath",
"aztk.models.plugins.plugin_configuration.PluginPort",
"os.path.join"
] | [((196, 222), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (212, 222), False, 'import os\n'), ((318, 356), 'aztk.models.plugins.plugin_configuration.PluginPort', 'PluginPort', ([], {'internal': '(8888)', 'public': '(True)'}), '(internal=8888, public=True)\n', (328, 356), False, 'from aztk... |
# Copyright 2021 Adobe. All rights reserved.
# This file is licensed to you 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 ... | [
"target_tools.utils.is_empty"
] | [((1052, 1077), 'target_tools.utils.is_empty', 'is_empty', (['property_tokens'], {}), '(property_tokens)\n', (1060, 1077), False, 'from target_tools.utils import is_empty\n'), ((1120, 1145), 'target_tools.utils.is_empty', 'is_empty', (['property_tokens'], {}), '(property_tokens)\n', (1128, 1145), False, 'from target_to... |
import os
res = os.popen("build/ARM/gem5.opt configs/example/se.py -c configs/fi/qs-arm").read()
#print(res)
| [
"os.popen"
] | [((18, 93), 'os.popen', 'os.popen', (['"""build/ARM/gem5.opt configs/example/se.py -c configs/fi/qs-arm"""'], {}), "('build/ARM/gem5.opt configs/example/se.py -c configs/fi/qs-arm')\n", (26, 93), False, 'import os\n')] |
# Copyright (c) 2021 Qianyun, Inc. All rights reserved.
from cloudchef_integration.tasks.cloud_resources.fusionaccess.client import FusionAccessClient
from cloudchef_integration.tasks.cloud_resources.commoncloud.utils import support_getattr
from cloudchef_integration.tasks.cloud_resources.commoncloud.params import com... | [
"cloudchef_integration.tasks.cloud_resources.commoncloud.params.common_params",
"cloudchef_integration.tasks.cloud_resources.commoncloud.response.common_response",
"cloudchef_integration.tasks.cloud_resources.commoncloud.response.filter_output",
"cloudchef_integration.tasks.cloud_resources.fusionaccess.client... | [((1474, 1505), 'cloudchef_integration.tasks.cloud_resources.commoncloud.params.common_params', 'common_params', (['EmptyDesc.Schema'], {}), '(EmptyDesc.Schema)\n', (1487, 1505), False, 'from cloudchef_integration.tasks.cloud_resources.commoncloud.params import common_params, EmptyDesc\n'), ((1511, 1550), 'cloudchef_in... |
# -*- coding: utf-8 -*-
from collections import defaultdict
from pydefect.util.tools import (
defaultdict_to_dict, flatten_dict, mod_defaultdict)
from pydefect.util.testing import PydefectTest
__author__ = "<NAME>"
__maintainer__ = "<NAME>"
class DefaultdictToDictTest(PydefectTest):
def setUp(self):
... | [
"pydefect.util.tools.mod_defaultdict",
"pydefect.util.tools.defaultdict_to_dict",
"collections.defaultdict",
"pydefect.util.tools.flatten_dict"
] | [((646, 668), 'pydefect.util.tools.defaultdict_to_dict', 'defaultdict_to_dict', (['d'], {}), '(d)\n', (665, 668), False, 'from pydefect.util.tools import defaultdict_to_dict, flatten_dict, mod_defaultdict\n'), ((983, 1007), 'pydefect.util.tools.mod_defaultdict', 'mod_defaultdict', ([], {'depth': '(2)'}), '(depth=2)\n',... |
# Generated by Django 2.2.12 on 2020-05-19 20:16
from django.db import migrations
def populate_project_organizations(apps, schema_editor):
Project = apps.get_model('projects', 'Project')
Organization = apps.get_model('organizations', 'Organization')
# assignment of existing projects to orgs based on proj... | [
"django.db.migrations.RunPython"
] | [((1132, 1184), 'django.db.migrations.RunPython', 'migrations.RunPython', (['populate_project_organizations'], {}), '(populate_project_organizations)\n', (1152, 1184), False, 'from django.db import migrations\n')] |
from src.manager import Maneger
from src.utility import UtilPath
import datetime
option={
"date" : datetime.datetime.now().strftime('%Y%m%d%H%M%S'),
"project" : "linuxtools",
"release4test" : "2",
"variableDependent" : "isBuggy",
"purpose" : "test",
"modelA... | [
"datetime.datetime.now",
"src.manager.Maneger",
"src.utility.UtilPath.Datasets"
] | [((686, 701), 'src.manager.Maneger', 'Maneger', (['option'], {}), '(option)\n', (693, 701), False, 'from src.manager import Maneger\n'), ((117, 140), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (138, 140), False, 'import datetime\n'), ((398, 417), 'src.utility.UtilPath.Datasets', 'UtilPath.Datas... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
# Copyright (c) 2018 <NAME> <<EMAIL>>
#
# 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 ... | [
"numpy.arange",
"os.path.exists",
"numpy.mean",
"argparse.ArgumentParser",
"sklearn.decomposition.PCA",
"tensorflow.Session",
"numpy.max",
"tensorflow.ConfigProto",
"time.localtime",
"tensorflow.one_hot",
"tensorflow.device",
"sklearn.svm.LinearSVC",
"numpy.argmax",
"time.time",
"utils.m... | [((1630, 1664), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""features"""'], {}), "(BASE_DIR, 'features')\n", (1642, 1664), False, 'import os\n'), ((1592, 1617), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1607, 1617), False, 'import os\n'), ((2238, 2265), 'sklearn.decomposition.PCA',... |
from django.contrib import admin
from .models import *
admin.site.register(Visualization)
admin.site.register(Type)
admin.site.register(TypeToVisualization) | [
"django.contrib.admin.site.register"
] | [((56, 90), 'django.contrib.admin.site.register', 'admin.site.register', (['Visualization'], {}), '(Visualization)\n', (75, 90), False, 'from django.contrib import admin\n'), ((91, 116), 'django.contrib.admin.site.register', 'admin.site.register', (['Type'], {}), '(Type)\n', (110, 116), False, 'from django.contrib impo... |
import cv2
import os
import sys
def main():
argc = len(sys.argv)
if (argc != 2):
print("Usage: python3 frame_segment_maker.py <video_name>")
exit()
cap = cv2.VideoCapture(sys.argv[1])
read_stat, img = cap.read()
while read_stat:
read_stat, img = cap.read()
cv2.imsh... | [
"cv2.waitKey",
"cv2.VideoCapture",
"cv2.imshow"
] | [((185, 214), 'cv2.VideoCapture', 'cv2.VideoCapture', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (201, 214), False, 'import cv2\n'), ((312, 336), 'cv2.imshow', 'cv2.imshow', (['"""frame"""', 'img'], {}), "('frame', img)\n", (322, 336), False, 'import cv2\n'), ((349, 364), 'cv2.waitKey', 'cv2.waitKey', (['(25)'], {}), '(... |
''' Forecast time series '''
import random
import sys
import argparse
import numpy as np
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
def build_lstm_graph(n_features, n_targets, quantiles, burn_in,
num_units, input_k... | [
"numpy.sqrt",
"tensorflow.shape",
"numpy.column_stack",
"tensorflow.contrib.rnn.LSTMCell",
"tensorflow.reduce_mean",
"tensorflow.variables_initializer",
"numpy.repeat",
"numpy.isscalar",
"argparse.ArgumentParser",
"tensorflow.Session",
"tensorflow.placeholder",
"tensorflow.nn.dynamic_rnn",
"... | [((3917, 3939), 'numpy.isscalar', 'np.isscalar', (['quantiles'], {}), '(quantiles)\n', (3928, 3939), True, 'import numpy as np\n'), ((4581, 4645), 'tensorflow.get_collection', 'tf.get_collection', (['tf.GraphKeys.GLOBAL_VARIABLES', 'variable_scope'], {}), '(tf.GraphKeys.GLOBAL_VARIABLES, variable_scope)\n', (4598, 4645... |
import re
from pxr import Usd, Sdf, UsdGeom
from avalon import io
def _get_variant_data(asset_name):
"""
Get variant data from asset name
:param asset_name: str. Asset name. eg.'HanMaleA'
:return:
variant_data = {
'lookDefault': [
r'\...\publish\modelDefault\v003\geom.usda',
... | [
"re.compile",
"pxr.Usd.Stage.CreateInMemory",
"pxr.Sdf.Reference",
"avalon.io.find_one",
"pxr.UsdGeom.Xform.Define",
"reveries.common.get_publish_files.get_files",
"avalon.io.find"
] | [((835, 855), 'avalon.io.find_one', 'io.find_one', (['_filter'], {}), '(_filter)\n', (846, 855), False, 'from avalon import io\n'), ((1226, 1242), 'avalon.io.find', 'io.find', (['_filter'], {}), '(_filter)\n', (1233, 1242), False, 'from avalon import io\n'), ((2817, 2837), 'avalon.io.find_one', 'io.find_one', (['_filte... |
# Copyright 2015 <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, softw... | [
"pywayland.server.eventloop.EventLoop",
"os.close",
"time.sleep",
"gc.collect",
"os.getpid",
"os.pipe",
"pywayland.server.listener.Listener",
"time.time"
] | [((1176, 1187), 'pywayland.server.eventloop.EventLoop', 'EventLoop', ([], {}), '()\n', (1185, 1187), False, 'from pywayland.server.eventloop import EventLoop\n'), ((1200, 1209), 'os.pipe', 'os.pipe', ([], {}), '()\n', (1207, 1209), False, 'import os\n'), ((1543, 1554), 'pywayland.server.eventloop.EventLoop', 'EventLoop... |
import json, re
ontologies = ['ontocompchem', 'ontokin', 'wiki']
def process_puncutation(string):
# Load the regular expression library
# Remove punctuation
string_temp = re.sub('[-\n,.!?()\[\]0-9]', '', string)
# Convert the titles to lowercase
string_temp = string_temp.lower()
# Print out ... | [
"re.sub",
"json.dumps"
] | [((187, 232), 're.sub', 're.sub', (['"""[-\n,.!?()\\\\[\\\\]0-9]"""', '""""""', 'string'], {}), '("""[-\n,.!?()\\\\[\\\\]0-9]""", \'\', string)\n', (193, 232), False, 'import json, re\n'), ((633, 651), 'json.dumps', 'json.dumps', (['arrays'], {}), '(arrays)\n', (643, 651), False, 'import json, re\n')] |
import pathlib
import pytest
import parser
import code
TEMPLATE_DIR = pathlib.Path(__file__).resolve().parent.parent
def test_parse_testsuite_0000_sample():
sample = f"{TEMPLATE_DIR}/sample/test-suite-00000-jsonplaceholder.yaml"
ret = parser.yaml2dict(sample)
print(ret)
def test_test_suite_parse_init_one... | [
"parser.TestSuite",
"parser.TestSuites",
"pathlib.Path",
"parser.TestCase",
"parser.yaml2dict",
"code.PytestCodeBuilder"
] | [((245, 269), 'parser.yaml2dict', 'parser.yaml2dict', (['sample'], {}), '(sample)\n', (261, 269), False, 'import parser\n'), ((428, 468), 'parser.TestSuite', 'parser.TestSuite', ([], {'test_suite_file': 'sample'}), '(test_suite_file=sample)\n', (444, 468), False, 'import parser\n'), ((544, 568), 'code.PytestCodeBuilder... |
from typing import Optional
from pydantic import BaseModel, Field
class ContentRepositoryConfig(BaseModel):
upload_size: Optional[int] = Field(None, alias='m.upload.size')
class UploadedFileResponse(BaseModel):
content_uri: str
| [
"pydantic.Field"
] | [((144, 178), 'pydantic.Field', 'Field', (['None'], {'alias': '"""m.upload.size"""'}), "(None, alias='m.upload.size')\n", (149, 178), False, 'from pydantic import BaseModel, Field\n')] |
# -------------------------------------------------------------------------------------------------
# STRING
# -------------------------------------------------------------------------------------------------
print('\n\t\tSTRING\n')
print("Hello Word!") # first example
print('Hello Word!')... | [
"re.split",
"re.match"
] | [((3720, 3764), 're.match', 're.match', (['"""Hello[\t]*(.*)world"""', 'str_example'], {}), "('Hello[\\t]*(.*)world', str_example)\n", (3728, 3764), False, 'import re\n'), ((4091, 4136), 're.match', 're.match', (['"""[/:](.*)[/:](.*)[/:](.*)"""', 'pattern'], {}), "('[/:](.*)[/:](.*)[/:](.*)', pattern)\n", (4099, 4136),... |
"""Tests for loading calibration files."""
from pathlib import Path
from unittest import mock
import pytest
from sb_vision.find_3D_coords import (
ResolutionMismatchError,
load_camera_calibrations,
)
TEST_DATA = Path(__file__).parent / 'test_data'
def test_rejects_mismatching_resolutions():
"""Ensure ... | [
"sb_vision.find_3D_coords.load_camera_calibrations",
"pytest.raises",
"pathlib.Path"
] | [((224, 238), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (228, 238), False, 'from pathlib import Path\n'), ((890, 943), 'sb_vision.find_3D_coords.load_camera_calibrations', 'load_camera_calibrations', (['"""camera-model"""', '(1280, 720)'], {}), "('camera-model', (1280, 720))\n", (914, 943), False, 'fr... |
import pytest
from valid8.validation_lib import gt, gts, lt, lts, between, NotInRange, TooSmall, TooBig
def test_gt():
""" tests that the gt() function works """
assert gt(1)(1)
with pytest.raises(TooSmall):
gt(-1)(-1.1)
def test_gts():
""" tests that the gts() function works """
with p... | [
"valid8.validation_lib.lts",
"valid8.validation_lib.lt",
"valid8.validation_lib.gts",
"valid8.validation_lib.gt",
"pytest.raises",
"valid8.validation_lib.between"
] | [((180, 185), 'valid8.validation_lib.gt', 'gt', (['(1)'], {}), '(1)\n', (182, 185), False, 'from valid8.validation_lib import gt, gts, lt, lts, between, NotInRange, TooSmall, TooBig\n'), ((198, 221), 'pytest.raises', 'pytest.raises', (['TooSmall'], {}), '(TooSmall)\n', (211, 221), False, 'import pytest\n'), ((319, 342)... |
# MIPLearn: Extensible Framework for Learning-Enhanced Mixed-Integer Optimization
# Copyright (C) 2020-2021, UChicago Argonne, LLC. All rights reserved.
# Released under the modified BSD license. See COPYING.md for more details.
import gc
import os
from typing import Any, Optional, List, Dict, TYPE_CHECKING
import p... | [
"os.path.exists",
"pickle.dumps",
"miplearn.features.sample.Hdf5Sample",
"gc.collect",
"pickle.loads"
] | [((738, 762), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (752, 762), False, 'import os\n'), ((812, 832), 'miplearn.features.sample.Hdf5Sample', 'Hdf5Sample', (['filename'], {}), '(filename)\n', (822, 832), False, 'from miplearn.features.sample import Hdf5Sample, Sample\n'), ((3567, 3579), '... |
#
# Copyright (C) [2020] Futurewei Technologies, Inc.
#
# FORCE-RISCV is 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
#
# THIS SOFTWARE IS PRO... | [
"copy.deepcopy"
] | [((9175, 9209), 'copy.deepcopy', 'copy.deepcopy', (['self.handler_memory'], {}), '(self.handler_memory)\n', (9188, 9209), False, 'import copy\n')] |
import tensorflow as tf
from utils.bert import bert_utils
from loss import loss_utils
from utils.bert import albert_modules
from metric import tf_metrics
def classifier(config, seq_output,
input_ids,
sampled_ids,
input_mask,
num_labels,
dropout_prob,
**kargs):
"""
input_ids: origi... | [
"tensorflow.reduce_sum",
"tensorflow.metrics.mean",
"tensorflow.truncated_normal_initializer",
"tensorflow.einsum",
"tensorflow.nn.dropout",
"utils.bert.bert_utils.get_shape_list",
"tensorflow.ones_like",
"tensorflow.zeros_initializer",
"tensorflow.cast",
"tensorflow.compat.v1.metrics.recall",
"... | [((757, 786), 'tensorflow.cast', 'tf.cast', (['input_mask', 'tf.int32'], {}), '(input_mask, tf.int32)\n', (764, 786), True, 'import tensorflow as tf\n'), ((802, 842), 'tensorflow.cast', 'tf.cast', (['(1 - none_replace_mask)', 'tf.int32'], {}), '(1 - none_replace_mask, tf.int32)\n', (809, 842), True, 'import tensorflow ... |
from django.conf import settings
from django.core.mail import send_mail, get_connection
def send_rp_mail(subject, message, mailto):
con = get_connection(settings.EMAIL_BACKEND)
send_mail(
subject,
message,
settings.SERVER_EMAIL,
mailto,
connection = con,
)
| [
"django.core.mail.send_mail",
"django.core.mail.get_connection"
] | [((143, 181), 'django.core.mail.get_connection', 'get_connection', (['settings.EMAIL_BACKEND'], {}), '(settings.EMAIL_BACKEND)\n', (157, 181), False, 'from django.core.mail import send_mail, get_connection\n'), ((186, 260), 'django.core.mail.send_mail', 'send_mail', (['subject', 'message', 'settings.SERVER_EMAIL', 'mai... |
from pathlib import Path
if __name__ == '__main__':
p = Path('..')
print(p)
print([x for x in p.iterdir() if x.is_dir()])
# assign file with path, not exist
q = Path('../data/tmp')
if q.exists() == 0:
# not exist case
print(q.name, 'is not exist!')
# create empty file
... | [
"pathlib.Path"
] | [((61, 71), 'pathlib.Path', 'Path', (['""".."""'], {}), "('..')\n", (65, 71), False, 'from pathlib import Path\n'), ((183, 202), 'pathlib.Path', 'Path', (['"""../data/tmp"""'], {}), "('../data/tmp')\n", (187, 202), False, 'from pathlib import Path\n'), ((766, 775), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", ... |
# -*- coding: utf-8 -*-
""".. moduleauthor:: <NAME>"""
from dataclasses import dataclass
from typing import Tuple, Optional, Dict, Callable, Union, Type, final, Final
from bann.b_container.functions.dict_str_repr import dict_json_repr
from bann.b_container.errors.custom_erors import KnownLRSchedulerStateError
from ban... | [
"bann.b_container.functions.compare_min_max.compare_min_max_float",
"bann.b_container.states.framework.interface.lr_scheduler.LRSchedulerState.get_pre_arg",
"bann.b_container.functions.compare_min_max.compare_min_max_int",
"bann.b_container.functions.compare_min_max.AlwaysCompareNumElem",
"bann.b_container.... | [((3268, 3338), 'bann.b_container.functions.compare_min_max.compare_min_max_int', 'compare_min_max_int', (['params[0]', 'self.min_values[0]', 'self.max_values[0]'], {}), '(params[0], self.min_values[0], self.max_values[0])\n', (3287, 3338), False, 'from bann.b_container.functions.compare_min_max import CompareNumElem, ... |
import os
import wx
class PhotoLabel(wx.App):
c1 = wx.Point(-1,-1)
c2 = wx.Point(-1,-1)
def __init__(self, redirect=False, filename=None):
self.path = "/home/user/Desktop/aEffacer/0003"
self.liste = []
self.listeName = []
self.size = 0
self.n = 0
wx... | [
"wx.TheClipboard.Close",
"wx.BitmapFromImage",
"wx.StaticLine",
"wx.Pen",
"os.walk",
"wx.Image",
"wx.Size",
"wx.Panel",
"wx.Colour",
"wx.Cursor",
"wx.Frame",
"wx.StaticText",
"wx.Point",
"wx.Button",
"wx.App.__init__",
"wx.MemoryDC",
"wx.BoxSizer",
"os.path.join",
"wx.EmptyImage"... | [((61, 77), 'wx.Point', 'wx.Point', (['(-1)', '(-1)'], {}), '(-1, -1)\n', (69, 77), False, 'import wx\n'), ((86, 102), 'wx.Point', 'wx.Point', (['(-1)', '(-1)'], {}), '(-1, -1)\n', (94, 102), False, 'import wx\n'), ((318, 359), 'wx.App.__init__', 'wx.App.__init__', (['self', 'redirect', 'filename'], {}), '(self, redire... |
from math import *
import numpy as np
def f(x, a=1):
return sin(exp(a * x))
def generate(fileName, start=0, end=2, n=20):
X = np.linspace(start, end, n)
Y = list()
for a in range(1, n+1):
Y.append([f(x, a) for x in X])
with open('test/X.csv', 'w') as fs:
line = X.join(',')
... | [
"numpy.linspace"
] | [((136, 162), 'numpy.linspace', 'np.linspace', (['start', 'end', 'n'], {}), '(start, end, n)\n', (147, 162), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from django.conf.urls import *
from django.views.generic import TemplateView
urlpatterns = [
url(r'^currencies/', include('currencies.urls')),
url(r'^$', TemplateView.as_view(template_name='index.html')),
url(r'^context_processor$', TemplateView.as_view(template_name='context_proce... | [
"django.views.generic.TemplateView.as_view"
] | [((188, 236), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '"""index.html"""'}), "(template_name='index.html')\n", (208, 236), False, 'from django.views.generic import TemplateView\n'), ((271, 331), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], ... |
'''
Copyright 2020 Xilinx Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | [
"os.path.exists",
"cv2.imwrite",
"random.shuffle",
"zipfile.ZipFile",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.path.basename",
"shutil.rmtree",
"cv2.resize",
"cv2.imread",
"os.walk"
] | [((2248, 2312), 'cv2.resize', 'cv2.resize', (['image', '(new_w, new_h)'], {'interpolation': 'cv2.INTER_CUBIC'}), '(image, (new_w, new_h), interpolation=cv2.INTER_CUBIC)\n', (2258, 2312), False, 'import cv2\n'), ((7558, 7583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (7581, 7583), False, '... |
from dataclasses import dataclass, field
from typing import List
import dectate
import pytest
from predico.servicemanager.action import ServiceAction
from predico.servicemanager.manager import ServiceManager
from predico.services.request.base_request import Request
from predico.services.resource.base_resource import ... | [
"predico.servicemanager.manager.ServiceManager",
"dataclasses.field",
"dectate.directive"
] | [((613, 640), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (618, 640), False, 'from dataclasses import dataclass, field\n'), ((880, 907), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (885, 907), False, 'from dataclasses impo... |
import pytesseract
class OCR:
def __init__(self):
self.custom_config = r'--oem 3 --psm 6'
def readimage(self,address):
s = pytesseract.image_to_string(address, config=self.custom_config)
return s
# Adding custom options
if __name__ == "__main__":
cc = OCR()
pr... | [
"pytesseract.image_to_string"
] | [((156, 219), 'pytesseract.image_to_string', 'pytesseract.image_to_string', (['address'], {'config': 'self.custom_config'}), '(address, config=self.custom_config)\n', (183, 219), False, 'import pytesseract\n')] |
from flask import Flask, render_template, request, redirect, url_for
from bson import ObjectId
from pymongo import MongoClient
import os
app = Flask(__name__)
title = "Paste-Wise"
heading = "Paste-Wise Dashboard"
mongoClient = MongoClient("mongodb://10.4.64.209:27017") # host uri
dbObject = mongoClient.webex_teams ... | [
"flask.render_template",
"flask.request.args.get",
"flask.Flask",
"flask.url_for",
"pymongo.MongoClient",
"bson.ObjectId"
] | [((144, 159), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (149, 159), False, 'from flask import Flask, render_template, request, redirect, url_for\n'), ((230, 272), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb://10.4.64.209:27017"""'], {}), "('mongodb://10.4.64.209:27017')\n", (241, 272), False, ... |
# Author: <NAME>
# This script will monitor product availability
# of some specfic publishers and retailers.
# Copyright 2021 <NAME>.
# Licensed under the MIT License.
import enum
import json
import re
import requests
import sched
import time
import validators
# import traceback
from datetime import datetime
class ... | [
"json.loads",
"requests.get",
"datetime.datetime.now",
"validators.url",
"sched.scheduler",
"re.search"
] | [((1398, 1424), 'requests.get', 'requests.get', (['original_url'], {}), '(original_url)\n', (1410, 1424), False, 'import requests\n'), ((1901, 1926), 'requests.get', 'requests.get', (['request_url'], {}), '(request_url)\n', (1913, 1926), False, 'import requests\n'), ((2678, 2720), 'requests.get', 'requests.get', (['req... |
from icemac.addressbook.address import phone_number_entity
from icemac.addressbook.address import postal_address_entity
from icemac.addressbook.addressbook import address_book_entity
from icemac.addressbook.entities import Entities, PersistentEntities, Field
from icemac.addressbook.entities import Entity, get_bound_sch... | [
"pytest.fixture",
"icemac.addressbook.entities.Entity",
"icemac.addressbook.entities.Entities",
"icemac.addressbook.entities.PersistentEntities",
"icemac.addressbook.interfaces.IUserFieldStorage",
"icemac.addressbook.addressbook.address_book_entity.getRawField",
"icemac.addressbook.address.postal_addres... | [((1423, 1455), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (1437, 1455), False, 'import pytest\n'), ((1581, 1611), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1595, 1611), False, 'import pytest\n'), ((1774, 1806), 'pytes... |
from time import time
from os import path, listdir
from datetime import timedelta
from datetime import date as dt_date
from datetime import datetime as dt
from numpy import cumprod
from pandas import DataFrame, read_sql_query, read_csv, concat
from functions import psqlEngine
class Investments():
def __init__(se... | [
"os.listdir",
"pandas.read_csv",
"datetime.datetime.strptime",
"os.path.join",
"datetime.timedelta",
"functions.psqlEngine",
"time.time",
"pandas.DataFrame",
"datetime.date.today",
"pandas.concat",
"numpy.cumprod"
] | [((3407, 3418), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (3416, 3418), False, 'from pandas import DataFrame, read_sql_query, read_csv, concat\n'), ((3469, 3494), 'functions.psqlEngine', 'psqlEngine', (['self.database'], {}), '(self.database)\n', (3479, 3494), False, 'from functions import psqlEngine\n'), ((13... |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"google.appengine.ext.ndb.TextProperty",
"json.loads",
"json.dumps",
"google.appengine.ext.ndb.put_multi"
] | [((1076, 1107), 'google.appengine.ext.ndb.TextProperty', 'ndb.TextProperty', ([], {'indexed': '(False)'}), '(indexed=False)\n', (1092, 1107), False, 'from google.appengine.ext import ndb\n'), ((1355, 1376), 'json.dumps', 'json.dumps', (['json_dict'], {}), '(json_dict)\n', (1365, 1376), False, 'import json\n'), ((3696, ... |
import torch
import shutil
import numpy as np
import matplotlib
matplotlib.use('pdf')
import matplotlib.pyplot as plt
# import cv2
from skimage.transform import resize
import torchvision.transforms as transforms
from sklearn.metrics import precision_score, recall_score, f1_score, roc_auc_score
class AverageMeter(obje... | [
"torchvision.transforms.ToPILImage",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"numpy.array",
"torchvision.transforms.ColorJitter",
"sklearn.metrics.roc_auc_score",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.plot",
"numpy.max",
"numpy.stack",
"numpy.min",
"matplotl... | [((64, 85), 'matplotlib.use', 'matplotlib.use', (['"""pdf"""'], {}), "('pdf')\n", (78, 85), False, 'import matplotlib\n'), ((773, 800), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (783, 800), False, 'import torch\n'), ((2629, 2674), 'sklearn.metrics.precision_score', 'precision_score... |
# coding: utf-8
__author__ = 'ZFTurbo: https://kaggle.com/zfturbo'
import os
import time
import pickle
import numpy as np
import pandas as pd
from multiprocessing import Pool, cpu_count
from itertools import repeat
from ensemble_boxes import *
from map_boxes import *
def save_in_file_fast(arr, file_name):
pickl... | [
"pandas.read_csv",
"multiprocessing.cpu_count",
"numpy.array",
"numpy.zeros",
"multiprocessing.Pool",
"numpy.concatenate",
"os.path.basename",
"pandas.DataFrame",
"time.time",
"itertools.repeat"
] | [((479, 496), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (490, 496), True, 'import pandas as pd\n'), ((1336, 1378), 'pandas.DataFrame', 'pd.DataFrame', (['ImageID'], {'columns': "['ImageId']"}), "(ImageID, columns=['ImageId'])\n", (1348, 1378), True, 'import pandas as pd\n'), ((6280, 6324), 'numpy.ar... |
#!/usr/local/bin/python
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
from PIL import Image
import os, glob, argparse, tqdm
from data_loader import get_data
from model import get_model
#==========================================================================#
def create_fol... | [
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"os.makedirs",
"torch.load",
"os.path.join",
"os.path.dirname",
"numpy.array",
"torch.cuda.is_available",
"os.path.isdir",
"os.path.basename",
"data_loader.get_data",
"model.get_model"
] | [((1364, 1389), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1387, 1389), False, 'import torch\n'), ((1722, 1743), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1741, 1743), True, 'import torch.nn as nn\n'), ((4232, 4257), 'argparse.ArgumentParser', 'argparse.Argumen... |