code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Compile Nim libraries as Python Extension Modules.
If you want your namespace to coexist with your pthon code, name this ponim.nim
and then your import will look like `from ponim.nim import adder` and
`from ponim import subtractor`. There must be a way to smooth that out in the
__init__.py file somehow.
Note that ... | [
"os.listdir",
"subprocess.run",
"os.path.join",
"setuptools.Extension",
"os.mkdir",
"shutil.rmtree"
] | [((1214, 1240), 'os.path.join', 'join', (['"""build"""', '"""nim_build"""'], {}), "('build', 'nim_build')\n", (1218, 1240), False, 'from os.path import join, expanduser\n'), ((1375, 1428), 'os.path.join', 'join', (['"""build"""', '"""nim_build"""', 'f"""{module[\'name\']}_build"""'], {}), '(\'build\', \'nim_build\', f"... |
from __future__ import division
from collections import defaultdict
import numpy as np
from time import time
import random
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
# import tensorflow as tf
class DataModule():
def __init__(self, conf, filename):
self.conf = conf
self.data_dict = ... | [
"numpy.reshape",
"tensorflow.compat.v1.disable_v2_behavior",
"numpy.sqrt",
"numpy.array",
"numpy.random.randint",
"collections.defaultdict"
] | [((157, 181), 'tensorflow.compat.v1.disable_v2_behavior', 'tf.disable_v2_behavior', ([], {}), '()\n', (179, 181), True, 'import tensorflow.compat.v1 as tf\n'), ((3493, 3509), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (3504, 3509), False, 'from collections import defaultdict\n'), ((3831, 3847),... |
from xmlrpc.server import MultiPathXMLRPCServer
import torch.nn as nn
import torch.nn.functional as F
import copy
from src.layers.layers import Encoder, EncoderLayer, Decoder, DecoderLayer, PositionwiseFeedForward
from src.layers.preprocessing import Embeddings, PositionalEncoding
from src.layers.attention import Mult... | [
"src.layers.preprocessing.PositionalEncoding",
"src.layers.layers.PositionwiseFeedForward",
"src.layers.preprocessing.Embeddings",
"torch.nn.init.xavier_uniform",
"torch.nn.Linear",
"src.layers.attention.MultiHeadedAttention"
] | [((1828, 1873), 'src.layers.attention.MultiHeadedAttention', 'MultiHeadedAttention', (['h', 'd_model'], {'alpha': 'alpha'}), '(h, d_model, alpha=alpha)\n', (1848, 1873), False, 'from src.layers.attention import MultiHeadedAttention\n'), ((1883, 1930), 'src.layers.layers.PositionwiseFeedForward', 'PositionwiseFeedForwar... |
import os
import timeit
from typing import List
import numpy as np
from numpy.random import RandomState
from numpy.testing import assert_allclose, assert_almost_equal
import pytest
from scipy.special import gamma
import arch.univariate.recursions_python as recpy
CYTHON_COVERAGE = os.environ.get("ARCH_CYTHON_COVERAGE... | [
"pytest.mark.filterwarnings",
"numpy.sqrt",
"arch.univariate.recursions_python.figarch_recursion",
"arch.univariate.recursions_python.figarch_recursion_python",
"numpy.log",
"arch.univariate.recursions_python.harch_recursion",
"arch.univariate.recursions_python.egarch_recursion_python",
"numpy.array",... | [((674, 748), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore::arch.compat.numba.PerformanceWarning"""'], {}), "('ignore::arch.compat.numba.PerformanceWarning')\n", (700, 748), False, 'import pytest\n'), ((284, 327), 'os.environ.get', 'os.environ.get', (['"""ARCH_CYTHON_COVERAGE"""', '"""0"""']... |
##############################################
# The MIT License (MIT)
# Copyright (c) 2014 <NAME>
# see LICENSE for full details
##############################################
# -*- coding: utf-8 -*
from math import atan, pi
def fov(w,f):
"""
Returns the FOV as in degrees, given:
w: image... | [
"math.atan"
] | [((426, 441), 'math.atan', 'atan', (['(w / 2 / f)'], {}), '(w / 2 / f)\n', (430, 441), False, 'from math import atan, pi\n')] |
# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g... | [
"numpy.flip",
"Base.Evaluation.Evaluator.EvaluatorHoldout",
"scipy.sparse.diags",
"pandas.read_csv",
"numpy.ediff1d",
"Data_manager.split_functions.split_train_validation_random_holdout.split_train_in_two_percentage_global_sample",
"HybridRecommender.HybridRecommender",
"numpy.log",
"numpy.argsort",... | [((384, 421), 'pandas.read_csv', 'pd.read_csv', (['"""./input/data_train.csv"""'], {}), "('./input/data_train.csv')\n", (395, 421), True, 'import pandas as pd\n'), ((429, 478), 'pandas.read_csv', 'pd.read_csv', (['"""./input/data_target_users_test.csv"""'], {}), "('./input/data_target_users_test.csv')\n", (440, 478), T... |
import os
import numpy as np
import scipy.io as sio
import tifffile
from sklearn.decomposition import PCA
from sklearn.model_selection import train_test_split
#Load dataset
def loadData(name,data_path):
if name == 'IP':
data = sio.loadmat(os.path.join(data_path, 'Indian_pines_corrected.mat'))['indian_pin... | [
"numpy.reshape",
"sklearn.decomposition.PCA",
"sklearn.model_selection.train_test_split",
"os.path.join",
"numpy.zeros"
] | [((2943, 2974), 'numpy.reshape', 'np.reshape', (['X', '(-1, X.shape[2])'], {}), '(X, (-1, X.shape[2]))\n', (2953, 2974), True, 'import numpy as np\n'), ((2985, 3029), 'sklearn.decomposition.PCA', 'PCA', ([], {'n_components': 'numComponents', 'whiten': '(True)'}), '(n_components=numComponents, whiten=True)\n', (2988, 30... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="marlin_binary_protocol",
version="0.0.7",
author="<NAME>",
author_email="<EMAIL>",
description="Transfer files with Marlin 2.0 firmware using Marlin Binary Protocol Mark II",
long_desc... | [
"setuptools.find_packages"
] | [((478, 504), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (502, 504), False, 'import setuptools\n')] |
# coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | [
"unittest.main",
"os.path.abspath",
"transformers.tokenization_xlnet.XLNetTokenizer.from_pretrained",
"transformers.tokenization_xlnet.XLNetTokenizer"
] | [((5237, 5252), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5250, 5252), False, 'import unittest\n'), ((907, 932), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (922, 932), False, 'import os\n'), ((1247, 1294), 'transformers.tokenization_xlnet.XLNetTokenizer', 'XLNetTokenizer', (['S... |
# forked from https://github.com/single-cell-genetics/cellSNP
## A python wrap of UCSC liftOver function for vcf file
## UCSC liftOver binary and hg19 to hg38 chain file:
## https://genome.ucsc.edu/cgi-bin/hgLiftOver
## http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/liftOver
## http://hgdownload.soe.ucsc.edu/gol... | [
"gzip.open",
"shutil.which",
"optparse.OptionParser",
"sys.exit",
"warnings.filterwarnings"
] | [((2890, 2922), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""error"""'], {}), "('error')\n", (2913, 2922), False, 'import warnings\n'), ((2970, 2984), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (2982, 2984), False, 'from optparse import OptionParser\n'), ((682, 706), 'gzip.open', 'gzip.op... |
import logging
import os
import redis
import moltin_aps
_database = None
db_logger = logging.getLogger('db_logger')
async def get_database_connection():
global _database
if _database is None:
database_password = os.getenv('DB_PASSWORD')
database_host = os.getenv('DB_HOST')
databas... | [
"logging.getLogger",
"moltin_aps.update_customer_info",
"os.getenv",
"redis.Redis",
"moltin_aps.create_customer"
] | [((90, 120), 'logging.getLogger', 'logging.getLogger', (['"""db_logger"""'], {}), "('db_logger')\n", (107, 120), False, 'import logging\n'), ((965, 1024), 'moltin_aps.update_customer_info', 'moltin_aps.update_customer_info', (['customer_id', 'customer_info'], {}), '(customer_id, customer_info)\n', (996, 1024), False, '... |
from pathlib import Path
import plecos
import json
print(plecos.__version__)
#%%
path_to_json_local = Path("~/ocn/plecos/plecos/samples/sample_metadata_local.json").expanduser()
path_to_json_remote = Path("~/ocn/plecos/plecos/samples/sample_metadata_remote.json").expanduser()
path_to_broken_json = Path("~/ocn/plecos/pl... | [
"json.load",
"plecos.list_errors",
"pathlib.Path",
"plecos.is_valid_dict"
] | [((1160, 1191), 'plecos.is_valid_dict', 'plecos.is_valid_dict', (['json_dict'], {}), '(json_dict)\n', (1180, 1191), False, 'import plecos\n'), ((1396, 1443), 'plecos.list_errors', 'plecos.list_errors', (['json_dict', 'path_schema_file'], {}), '(json_dict, path_schema_file)\n', (1414, 1443), False, 'import plecos\n'), (... |
from __future__ import absolute_import, unicode_literals
import itertools
import os
import sys
from copy import copy
import pytest
from virtualenv.discovery.py_spec import PythonSpec
def test_bad_py_spec():
text = "python2.3.4.5"
spec = PythonSpec.from_string_spec(text)
assert text in repr(spec)
as... | [
"os.path.abspath",
"copy.copy",
"virtualenv.discovery.py_spec.PythonSpec.from_string_spec",
"itertools.combinations"
] | [((250, 283), 'virtualenv.discovery.py_spec.PythonSpec.from_string_spec', 'PythonSpec.from_string_spec', (['text'], {}), '(text)\n', (277, 283), False, 'from virtualenv.discovery.py_spec import PythonSpec\n'), ((588, 622), 'virtualenv.discovery.py_spec.PythonSpec.from_string_spec', 'PythonSpec.from_string_spec', (['"""... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
module_definition = json.loads(
"""{
"family": "software_image_management_swim",
"name": "trigger_image_activation",
"operations": {
"post": [
"trigger_software_image_activation"
... | [
"json.loads"
] | [((121, 2254), 'json.loads', 'json.loads', (['"""{\n "family": "software_image_management_swim",\n "name": "trigger_image_activation",\n "operations": {\n "post": [\n "trigger_software_image_activation"\n ]\n },\n "parameters": {\n "trigger_software_image_activation": [\n ... |
"""CoinGecko model"""
__docformat__ = "numpy"
# pylint: disable=C0301, E1101
import logging
import re
from typing import Any, List
import numpy as np
import pandas as pd
from pycoingecko import CoinGeckoAPI
from gamestonk_terminal.cryptocurrency.dataframe_helpers import (
create_df_index,
long_number_format... | [
"logging.getLogger",
"pandas.Series",
"pandas.json_normalize",
"gamestonk_terminal.decorators.log_start_end",
"gamestonk_terminal.cryptocurrency.dataframe_helpers.long_number_format_with_type_check",
"gamestonk_terminal.cryptocurrency.dataframe_helpers.replace_underscores_in_column_names",
"gamestonk_te... | [((531, 558), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (548, 558), False, 'import logging\n'), ((1815, 1840), 'gamestonk_terminal.decorators.log_start_end', 'log_start_end', ([], {'log': 'logger'}), '(log=logger)\n', (1828, 1840), False, 'from gamestonk_terminal.decorators import lo... |
#!/usr/bin/env python
import setuptools
MAINTAINER_NAME = '<NAME>'
MAINTAINER_EMAIL = '<EMAIL>'
URL_GIT = 'https://github.com/TransactPRO/gw3-python-client'
try:
import pypandoc
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError, OSError, RuntimeError):
LONG_DESCRIPTION... | [
"pypandoc.convert",
"setuptools.find_packages"
] | [((209, 245), 'pypandoc.convert', 'pypandoc.convert', (['"""README.md"""', '"""rst"""'], {}), "('README.md', 'rst')\n", (225, 245), False, 'import pypandoc\n'), ((1215, 1241), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (1239, 1241), False, 'import setuptools\n')] |
import pprint
from typing import Optional, List, Tuple, Set, Dict
import numpy as np
from overrides import overrides
from python.handwritten_baseline.pipeline.data.base import Dataset
from python.handwritten_baseline.pipeline.model.feature_extr import DEBUG_EXTR
from python.handwritten_baseline.pipeline.model.feature... | [
"numpy.transpose",
"pprint.pformat",
"numpy.hstack"
] | [((1616, 1659), 'numpy.hstack', 'np.hstack', (['[zero_features, random_features]'], {}), '([zero_features, random_features])\n', (1625, 1659), True, 'import numpy as np\n'), ((2342, 2364), 'pprint.pformat', 'pprint.pformat', (['config'], {}), '(config)\n', (2356, 2364), False, 'import pprint\n'), ((1690, 1718), 'numpy.... |
# -*- coding: utf-8 -*-
#
# Author: <NAME>, Finland 2014
#
# This file is part of Kunquat.
#
# CC0 1.0 Universal, http://creativecommons.org/publicdomain/zero/1.0/
#
# To the extent possible under law, Kunquat Affirmers have waived all
# copyright and related or neighboring rights to Kunquat.
#
from __future__ import... | [
"os.abort",
"traceback.format_exception"
] | [((654, 702), 'traceback.format_exception', 'traceback.format_exception', (['eclass', 'einst', 'trace'], {}), '(eclass, einst, trace)\n', (680, 702), False, 'import traceback\n'), ((1229, 1239), 'os.abort', 'os.abort', ([], {}), '()\n', (1237, 1239), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"proto.Field",
"proto.module"
] | [((648, 719), 'proto.module', 'proto.module', ([], {'package': '"""google.cloud.aiplatform.v1"""', 'manifest': "{'EnvVar'}"}), "(package='google.cloud.aiplatform.v1', manifest={'EnvVar'})\n", (660, 719), False, 'import proto\n'), ((1534, 1569), 'proto.Field', 'proto.Field', (['proto.STRING'], {'number': '(1)'}), '(prot... |
"""
Utility functions and classes shared by multiple backends
"""
from collections import namedtuple
import logging
from . import symbols
from . import types
LOGGER = logging.getLogger('spc.backend_utils')
# NameContexts encapsulate both the function stack (which holds values) and
# the symbol table context (which b... | [
"logging.getLogger",
"collections.namedtuple"
] | [((169, 207), 'logging.getLogger', 'logging.getLogger', (['"""spc.backend_utils"""'], {}), "('spc.backend_utils')\n", (186, 207), False, 'import logging\n'), ((345, 400), 'collections.namedtuple', 'namedtuple', (['"""NameContext"""', "['symbol_ctx', 'func_stack']"], {}), "('NameContext', ['symbol_ctx', 'func_stack'])\n... |
import math
import torch
import unittest
import gpytorch
from torch import optim
from torch.autograd import Variable
from gpytorch.kernels import RBFKernel
from gpytorch.means import ConstantMean
from gpytorch.likelihoods import GaussianLikelihood
from gpytorch.random_variables import GaussianRandomVariable
# Simple ... | [
"gpytorch.ExactMarginalLogLikelihood",
"gpytorch.mlls.ExactMarginalLogLikelihood",
"gpytorch.kernels.RBFKernel",
"torch.sin",
"torch.Tensor",
"torch.max",
"gpytorch.random_variables.GaussianRandomVariable",
"torch.cuda.is_available",
"gpytorch.means.ConstantMean",
"unittest.main",
"gpytorch.like... | [((389, 413), 'torch.linspace', 'torch.linspace', (['(0)', '(1)', '(11)'], {}), '(0, 1, 11)\n', (403, 413), False, 'import torch\n'), ((434, 473), 'torch.sin', 'torch.sin', (['(train_x.data * (2 * math.pi))'], {}), '(train_x.data * (2 * math.pi))\n', (443, 473), False, 'import torch\n'), ((494, 518), 'torch.linspace', ... |
from CyberSource import *
import os
import json
from importlib.machinery import SourceFileLoader
config_file = os.path.join(os.getcwd(), "data", "Configuration.py")
configuration = SourceFileLoader("module.name", config_file).load_module()
# To delete None values in Input Request Json body
def del_none(d):
for ke... | [
"importlib.machinery.SourceFileLoader",
"json.dumps",
"os.getcwd"
] | [((125, 136), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (134, 136), False, 'import os\n'), ((3659, 3681), 'json.dumps', 'json.dumps', (['requestObj'], {}), '(requestObj)\n', (3669, 3681), False, 'import json\n'), ((182, 226), 'importlib.machinery.SourceFileLoader', 'SourceFileLoader', (['"""module.name"""', 'config_f... |
"""
This is where the web application starts running
"""
from app.index import create_app
app = create_app()
if __name__ == "__main__":
app.secret_key = 'mysecret'
app.run(port=8080, host="0.0.0.0", debug=True) | [
"app.index.create_app"
] | [((96, 108), 'app.index.create_app', 'create_app', ([], {}), '()\n', (106, 108), False, 'from app.index import create_app\n')] |
# This script contains the get_joke() function to generate a new dad joke
import requests
def get_joke():
"""Return new joke string from icanhazdadjoke.com."""
url = "https://icanhazdadjoke.com/"
response = requests.get(url, headers={'Accept': 'application/json'})
raw_joke = response.json()
joke ... | [
"requests.get"
] | [((222, 279), 'requests.get', 'requests.get', (['url'], {'headers': "{'Accept': 'application/json'}"}), "(url, headers={'Accept': 'application/json'})\n", (234, 279), False, 'import requests\n')] |
import sys
success = False
in_ironpython = "IronPython" in sys.version
if in_ironpython:
try:
from ironpython_clipboard import GetClipboardText, SetClipboardText
success = True
except ImportError:
pass
else:
try:
from win32_clipboard import GetClipboardText, SetClipboardTex... | [
"win32_clipboard.GetClipboardText"
] | [((1639, 1657), 'win32_clipboard.GetClipboardText', 'GetClipboardText', ([], {}), '()\n', (1655, 1657), False, 'from win32_clipboard import GetClipboardText, SetClipboardText\n')] |
import logging
logging.disable(logging.CRITICAL)
import math
from tabulate import tabulate
from mjrl.utils.make_train_plots import make_train_plots
from mjrl.utils.gym_env import GymEnv
from mjrl.samplers.core import sample_paths
import numpy as np
import torch
import pickle
import imageio
import time as timer
import o... | [
"math.floor",
"math.cos",
"copy.deepcopy",
"os.path.exists",
"exptools.logging.logger.dump_data",
"numpy.asarray",
"matplotlib.pyplot.close",
"mjrl.utils.gym_env.GymEnv",
"os.path.isdir",
"numpy.empty",
"numpy.random.seed",
"os.mkdir",
"logging.disable",
"tabulate.tabulate",
"exptools.lo... | [((15, 48), 'logging.disable', 'logging.disable', (['logging.CRITICAL'], {}), '(logging.CRITICAL)\n', (30, 48), False, 'import logging\n'), ((659, 684), 'os.path.isdir', 'os.path.isdir', (['policy_dir'], {}), '(policy_dir)\n', (672, 684), False, 'import os\n'), ((713, 736), 'os.path.isdir', 'os.path.isdir', (['logs_dir... |
from estimagic.inference.ml_covs import cov_cluster_robust
from estimagic.inference.ml_covs import cov_hessian
from estimagic.inference.ml_covs import cov_jacobian
from estimagic.inference.ml_covs import cov_robust
from estimagic.inference.ml_covs import cov_strata_robust
from estimagic.inference.shared import calculat... | [
"estimagic.inference.shared.get_derivative_case",
"estimagic.parameters.process_constraints.process_constraints",
"estimagic.inference.ml_covs.cov_jacobian",
"estimagic.inference.shared.get_internal_first_derivative",
"estimagic.shared.check_option_dicts.check_numdiff_options",
"estimagic.inference.shared... | [((9264, 9359), 'estimagic.shared.check_option_dicts.check_optimization_options', 'check_optimization_options', (['optimize_options'], {'usage': '"""estimate_ml"""', 'algorithm_mandatory': '(True)'}), "(optimize_options, usage='estimate_ml',\n algorithm_mandatory=True)\n", (9290, 9359), False, 'from estimagic.shared... |
import six
import chainer
import numpy as np
import chainer.links as L
import chainer.functions as F
import nutszebra_chainer
import functools
from collections import defaultdict
class Conv(nutszebra_chainer.Model):
def __init__(self, in_channel, out_channel, filter_size=(3, 3), stride=(1, 1), pad=(1, 1)):
... | [
"chainer.functions.softmax_cross_entropy",
"functools.reduce",
"chainer.functions.concat",
"numpy.argmax",
"chainer.functions.average_pooling_2d",
"numpy.zeros",
"collections.defaultdict",
"chainer.links.Convolution2D",
"chainer.links.BatchNormalization"
] | [((746, 806), 'functools.reduce', 'functools.reduce', (['(lambda a, b: a * b)', 'self.conv.W.data.shape'], {}), '(lambda a, b: a * b, self.conv.W.data.shape)\n', (762, 806), False, 'import functools\n'), ((1473, 1533), 'functools.reduce', 'functools.reduce', (['(lambda a, b: a * b)', 'self.conv.W.data.shape'], {}), '(l... |
import numpy as np
class LinearRegression:
def __init__(self, num_features):
self.num_features = num_features
self.W = np.zeros((self.num_features, 1))
def train(self, x, y, epochs, batch_size, lr, optim):
final_loss = None # loss of final epoch
# Training should b... | [
"numpy.array",
"numpy.zeros",
"numpy.transpose"
] | [((145, 177), 'numpy.zeros', 'np.zeros', (['(self.num_features, 1)'], {}), '((self.num_features, 1))\n', (153, 177), True, 'import numpy as np\n'), ((1880, 1895), 'numpy.array', 'np.array', (['ylist'], {}), '(ylist)\n', (1888, 1895), True, 'import numpy as np\n'), ((1227, 1259), 'numpy.zeros', 'np.zeros', (['(self.num_... |
# Copyright 2012 Nebula, 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 agree... | [
"collections.OrderedDict",
"django.utils.translation.ugettext_lazy",
"horizon.exceptions.handle",
"openstack_dashboard.api.keystone.tenant_list",
"django.urls.reverse_lazy",
"openstack_dashboard.dashboards.admin.volumes.tables.VolumesTable",
"openstack_dashboard.api.cinder.volume_get",
"django.urls.re... | [((1591, 1603), 'django.utils.translation.ugettext_lazy', '_', (['"""Volumes"""'], {}), "('Volumes')\n", (1592, 1603), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((5132, 5143), 'django.utils.translation.ugettext_lazy', '_', (['"""Manage"""'], {}), "('Manage')\n", (5133, 5143), True, 'from djang... |
import re
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk.events import SlotSet
import lark_module
class ActionHelloWorld(Action):
state_map = {}
def name(self) -> Text:
return "action_hello_world"
d... | [
"lark_module.execute",
"re.match"
] | [((4873, 4904), 'lark_module.execute', 'lark_module.execute', (['input_text'], {}), '(input_text)\n', (4892, 4904), False, 'import lark_module\n'), ((3285, 3313), 're.match', 're.match', (['"""\\\\d+"""', 'input_text'], {}), "('\\\\d+', input_text)\n", (3293, 3313), False, 'import re\n'), ((3787, 3815), 're.match', 're... |
# Copyright 2015 Ufora 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 i... | [
"ufora.config.Setup.config",
"ufora.test.ClusterSimulation.Simulator.createGlobalSimulator",
"pyfora.connect",
"ufora.config.Mainline.UnitTestMainline"
] | [((2001, 2028), 'ufora.config.Mainline.UnitTestMainline', 'Mainline.UnitTestMainline', ([], {}), '()\n', (2026, 2028), True, 'import ufora.config.Mainline as Mainline\n'), ((1282, 1296), 'ufora.config.Setup.config', 'Setup.config', ([], {}), '()\n', (1294, 1296), True, 'import ufora.config.Setup as Setup\n'), ((1350, 1... |
import os
import gc
import random
import numpy as np
import torch
def seed_everything(seed):
os.environ['PYTHONHASHSEED'] = str(seed)
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.be... | [
"torch.manual_seed",
"random.seed",
"torch.is_tensor",
"numpy.random.seed",
"gc.collect",
"torch.cuda.manual_seed",
"gc.get_objects",
"torch.cuda.empty_cache"
] | [((143, 160), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (154, 160), False, 'import random\n'), ((165, 185), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (179, 185), True, 'import numpy as np\n'), ((190, 213), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (20... |
from conans import ConanFile, CMake, tools
import os
import shutil
required_conan_version = ">=1.43.0"
class FreeImageConan(ConanFile):
name = "freeimage"
description = "Open Source library project for developers who would like to support popular graphics image formats"\
"like PNG, BMP, JPE... | [
"conans.CMake",
"os.path.join",
"conans.tools.patch",
"conans.tools.check_min_cppstd",
"conans.tools.get"
] | [((2000, 2034), 'conans.tools.check_min_cppstd', 'tools.check_min_cppstd', (['self', '"""11"""'], {}), "(self, '11')\n", (2022, 2034), False, 'from conans import ConanFile, CMake, tools\n'), ((3174, 3285), 'conans.tools.get', 'tools.get', ([], {'destination': 'self._source_subfolder', 'strip_root': '(True)'}), "(**self... |
#!/usr/bin/env python
"""
test_history.py
"""
# Copyright (c) 2011 <NAME>, Real Programmers. All rights reserved.
import unittest
from OR_Client_Library.openrefine_client.google.refine.history import *
class HistoryTest(unittest.TestCase):
def test_init(self):
response = {
u"code": "ok",
... | [
"unittest.main"
] | [((821, 836), 'unittest.main', 'unittest.main', ([], {}), '()\n', (834, 836), False, 'import unittest\n')] |
"""
Provide tests for command line interface's get batch command.
"""
import json
import pytest
from click.testing import CliRunner
from cli.constants import (
DEV_BRANCH_NODE_IP_ADDRESS_FOR_TESTING,
FAILED_EXIT_FROM_COMMAND_CODE,
PASSED_EXIT_FROM_COMMAND_CODE,
)
from cli.entrypoint import cli
from cli.ut... | [
"pytest.mark.parametrize",
"json.loads",
"click.testing.CliRunner",
"cli.utils.dict_to_pretty_json"
] | [((4824, 4930), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""node_url_with_protocol"""', "['http://masternode.com', 'https://masternode.com']"], {}), "('node_url_with_protocol', ['http://masternode.com',\n 'https://masternode.com'])\n", (4847, 4930), False, 'import pytest\n'), ((583, 594), 'click.test... |
import sys
from gssl.datasets import load_dataset
from gssl.inductive.datasets import load_ppi
from gssl.utils import seed
def main():
seed()
# Read dataset name
dataset_name = sys.argv[1]
# Load dataset
if dataset_name == "PPI":
load_ppi()
else:
load_dataset(name=dataset_na... | [
"gssl.inductive.datasets.load_ppi",
"gssl.utils.seed",
"gssl.datasets.load_dataset"
] | [((142, 148), 'gssl.utils.seed', 'seed', ([], {}), '()\n', (146, 148), False, 'from gssl.utils import seed\n'), ((263, 273), 'gssl.inductive.datasets.load_ppi', 'load_ppi', ([], {}), '()\n', (271, 273), False, 'from gssl.inductive.datasets import load_ppi\n'), ((292, 323), 'gssl.datasets.load_dataset', 'load_dataset', ... |
from flask.ext.wtf import Form
from wtforms import StringField, BooleanField, PasswordField
from wtforms.validators import InputRequired, Email, EqualTo, Length
class LoginForm(Form):
nickname = StringField('nickname', validators=[InputRequired()])
password = PasswordField('password', validators=[InputRequired... | [
"wtforms.validators.Email",
"wtforms.BooleanField",
"wtforms.PasswordField",
"wtforms.validators.EqualTo",
"wtforms.validators.Length",
"wtforms.validators.InputRequired"
] | [((343, 385), 'wtforms.BooleanField', 'BooleanField', (['"""remember_me"""'], {'default': '(False)'}), "('remember_me', default=False)\n", (355, 385), False, 'from wtforms import StringField, BooleanField, PasswordField\n'), ((744, 771), 'wtforms.PasswordField', 'PasswordField', (['"""<PASSWORD>"""'], {}), "('<PASSWORD... |
from problem import Problem
from typing import Any, Tuple
from random import randint
import ast
import json
def gen_num():
return str(randint(1, 9))
def gen_op():
return "+-*/"[randint(0, 3)]
def gen_expr(depth):
if randint(0, depth) == 0:
l = gen_expr(depth + 1)
r = gen_expr(depth + 1... | [
"ast.parse",
"random.randint"
] | [((140, 153), 'random.randint', 'randint', (['(1)', '(9)'], {}), '(1, 9)\n', (147, 153), False, 'from random import randint\n'), ((189, 202), 'random.randint', 'randint', (['(0)', '(3)'], {}), '(0, 3)\n', (196, 202), False, 'from random import randint\n'), ((234, 251), 'random.randint', 'randint', (['(0)', 'depth'], {}... |
import tensorflow as tf
import numpy as np
from graphsage.models import FCPartition
from graphsage.partition_train import construct_placeholders
from graphsage.utils import load_graph_data, load_embedded_data, load_embedded_idmap
flags = tf.app.flags
FLAGS = flags.FLAGS
# flags.DEFINE_integer('dim_1', ... | [
"numpy.insert",
"graphsage.partition_train.construct_placeholders",
"graphsage.utils.load_embedded_idmap",
"graphsage.utils.load_embedded_data",
"tensorflow.Session",
"graphsage.models.FCPartition",
"numpy.expand_dims",
"numpy.save"
] | [((744, 779), 'graphsage.partition_train.construct_placeholders', 'construct_placeholders', (['num_classes'], {}), '(num_classes)\n', (766, 779), False, 'from graphsage.partition_train import construct_placeholders\n'), ((1132, 1162), 'graphsage.models.FCPartition', 'FCPartition', (['placeholders', 'dim'], {}), '(place... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Copyright (c) 2015, <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
This parser reads annotated sentences (output from get_relations.py) in a tab-separated format to generate a unified XML format (Tikk et al., 2010. A comprehensive benchmark of kernel methods to extract pr... | [
"re.escape",
"sys.setdefaultencoding",
"xml.sax.saxutils.quoteattr",
"re.match",
"optparse.OptionParser",
"re.finditer"
] | [((605, 636), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (627, 636), False, 'import sys\n'), ((1063, 1077), 'optparse.OptionParser', 'OptionParser', ([], {}), '()\n', (1075, 1077), False, 'from optparse import OptionParser\n'), ((4887, 5014), 're.match', 're.match', (['"""... |
# Kontsioti, Maskell, Dutta & Pirmohamed, A reference set of clinically relevant
# adverse drug-drug interactions (2021)
# Code to extract single-drug side effect data from the BNF website
from bs4 import BeautifulSoup
import urllib
import os, csv
import numpy as np
import pandas as pd
import re
from tqdm i... | [
"re.compile",
"numpy.where",
"bs4.BeautifulSoup",
"pandas.DataFrame",
"pandas.concat",
"urllib.request.urlopen"
] | [((548, 572), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r', '"""lxml"""'], {}), "(r, 'lxml')\n", (561, 572), False, 'from bs4 import BeautifulSoup\n'), ((3904, 3973), 'pandas.DataFrame', 'pd.DataFrame', (['API_to_drugclass'], {'columns': "['API', 'Drug_Class', 'Link']"}), "(API_to_drugclass, columns=['API', 'Drug_Class'... |
from django.utils import timezone
from django.utils.text import slugify
def generate_billed_document_path(instance, filename):
cur_time = timezone.now()
return f"{cur_time.strftime('%Y/%m')}/{slugify(instance.name)}-{cur_time.strftime('%d.%m.%Y %H:%M')}.csv"
| [
"django.utils.timezone.now",
"django.utils.text.slugify"
] | [((144, 158), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (156, 158), False, 'from django.utils import timezone\n'), ((203, 225), 'django.utils.text.slugify', 'slugify', (['instance.name'], {}), '(instance.name)\n', (210, 225), False, 'from django.utils.text import slugify\n')] |
from categorical_embedder.embedders.core.aux.custom_layers import get_custom_layer_class
from categorical_embedder.embedders.core.aux.loss_factory import get_loss_function
def prepare_custom_objects(custom_object_info):
custom_objects = {}
custom_objects.update(_prepare_custom_layers(custom_object_info["layer... | [
"categorical_embedder.embedders.core.aux.custom_layers.get_custom_layer_class",
"categorical_embedder.embedders.core.aux.loss_factory.get_loss_function"
] | [((628, 662), 'categorical_embedder.embedders.core.aux.custom_layers.get_custom_layer_class', 'get_custom_layer_class', (['layer_name'], {}), '(layer_name)\n', (650, 662), False, 'from categorical_embedder.embedders.core.aux.custom_layers import get_custom_layer_class\n'), ((747, 775), 'categorical_embedder.embedders.c... |
"""Utilities."""
from functools import wraps
import re
from typing import Callable, List, Optional, TypeVar, Union
from .data import (
all_classes, all_slots,
)
def pascal_to_snake(s: str, sep: str = "_") -> str:
"""Convert Pascal case to snake case.
Assumes that
a) all words are either all-lowercas... | [
"re.sub",
"functools.wraps",
"typing.TypeVar"
] | [((2016, 2028), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (2023, 2028), False, 'from typing import Callable, List, Optional, TypeVar, Union\n'), ((714, 747), 're.sub', 're.sub', (['"""(?<!^)(?=[A-Z])"""', 'sep', 's'], {}), "('(?<!^)(?=[A-Z])', sep, s)\n", (720, 747), False, 'import re\n'), ((2130, 2141... |
from collections import namedtuple
Accelerometer = namedtuple('Accelerometer', ["timestamp", "x", "y", "z"])
Magnetometer = namedtuple('Magnetometer', ['timestamp', 'x', 'y', 'z'])
Gyroscope = namedtuple('Gyroscope', ['timestamp', 'x', 'y', 'z'])
Euler = namedtuple('Euler', ['timestamp', 'x', 'y', 'z'])
Quaternion = ... | [
"collections.namedtuple"
] | [((52, 109), 'collections.namedtuple', 'namedtuple', (['"""Accelerometer"""', "['timestamp', 'x', 'y', 'z']"], {}), "('Accelerometer', ['timestamp', 'x', 'y', 'z'])\n", (62, 109), False, 'from collections import namedtuple\n'), ((125, 181), 'collections.namedtuple', 'namedtuple', (['"""Magnetometer"""', "['timestamp', ... |
try:
from collections.abc import MutableMapping
except ImportError:
from collections import MutableMapping
import zipfile
class Zip(MutableMapping):
"""Mutable Mapping interface to a Zip file
Keys must be strings, values must be bytes
Parameters
----------
filename: string
mode: stri... | [
"zipfile.ZipFile"
] | [((910, 956), 'zipfile.ZipFile', 'zipfile.ZipFile', (['self.filename'], {'mode': 'self.mode'}), '(self.filename, mode=self.mode)\n', (925, 956), False, 'import zipfile\n')] |
# Copyright 2014 A10 Networks
#
# 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 agree... | [
"six.add_metaclass",
"oslo_log.log.getLogger"
] | [((896, 923), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (913, 923), True, 'from oslo_log import log as logging\n'), ((927, 957), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (944, 957), False, 'import six\n'), ((7466, 7496), 'six.add_metacl... |
import Net
import configparser
import torch
from PIL import Image
config = configparser.ConfigParser()
config.read('./config.ini')
MODEL = config.get("Network", "Model")
transformations = Net.transformations
net = Net.Net()
net.eval()
net.load_state_dict(torch.load(MODEL))
image = Image.open("./html/rwby.jpg")
imag... | [
"PIL.Image.open",
"configparser.ConfigParser",
"torch.load",
"Net.Net",
"torch.autograd.Variable"
] | [((76, 103), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (101, 103), False, 'import configparser\n'), ((216, 225), 'Net.Net', 'Net.Net', ([], {}), '()\n', (223, 225), False, 'import Net\n'), ((286, 315), 'PIL.Image.open', 'Image.open', (['"""./html/rwby.jpg"""'], {}), "('./html/rwby.jpg'... |
import torch
from tuframework.network_architecture.generic_UNet import Generic_UNet
from tuframework.network_architecture.initialization import InitWeights_He
from tuframework.training.network_training.tuframework_variants.data_augmentation.tuframeworkTrainerV2_insaneDA import \
tuframeworkTrainerV2_insaneDA
from t... | [
"torch.cuda.is_available",
"tuframework.network_architecture.initialization.InitWeights_He"
] | [((2410, 2435), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2433, 2435), False, 'import torch\n'), ((2259, 2279), 'tuframework.network_architecture.initialization.InitWeights_He', 'InitWeights_He', (['(0.01)'], {}), '(0.01)\n', (2273, 2279), False, 'from tuframework.network_architecture.ini... |
from build.chart_data_functions import get_confirmed_cases_by_county
from build.chart_data_functions import get_county_by_day
from build.constants import CONFIRMED_CASES_BY_COUNTIES_PATH
from build.constants import COUNTY_MAPPING
from build.constants import COUNTY_POPULATION
from build.constants import DATE_SETTINGS
fr... | [
"build.utils.save_as_json",
"build.utils.logger.info",
"pandas.date_range",
"build.chart_data_functions.get_confirmed_cases_by_county",
"build.chart_data_functions.get_county_by_day",
"build.utils.read_json_from_file"
] | [((719, 758), 'build.utils.logger.info', 'logger.info', (['"""Loading local data files"""'], {}), "('Loading local data files')\n", (730, 758), False, 'from build.utils import logger\n'), ((778, 816), 'build.utils.read_json_from_file', 'read_json_from_file', (['TEST_RESULTS_PATH'], {}), '(TEST_RESULTS_PATH)\n', (797, 8... |
# encoding=utf-8
import rospy
import tf
if __name__ == '__main__':
rospy.init_node('py_tf_broadcaster')
br = tf.TransformBroadcaster()
x = 0.0
y = 0.0
z = 0.0
roll = 0
pitch = 0
yaw = 1.57
rate = rospy.Rate(1)
while not rospy.is_shutdown():
yaw = yaw + 0.1
roll... | [
"tf.TransformBroadcaster",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.Time.now",
"tf.transformations.quaternion_from_euler",
"rospy.Rate"
] | [((73, 109), 'rospy.init_node', 'rospy.init_node', (['"""py_tf_broadcaster"""'], {}), "('py_tf_broadcaster')\n", (88, 109), False, 'import rospy\n'), ((119, 144), 'tf.TransformBroadcaster', 'tf.TransformBroadcaster', ([], {}), '()\n', (142, 144), False, 'import tf\n'), ((235, 248), 'rospy.Rate', 'rospy.Rate', (['(1)'],... |
import torch
import logging
# Transformer version 4.9.1 - Newer versions may not work.
from transformers import AutoTokenizer
from trained_gpt_model import get_inference2
def t5_supp_inference(review_text):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # CPU may not work, got to check.
... | [
"logging.debug",
"torch.load",
"trained_gpt_model.get_inference2",
"torch.cuda.is_available",
"transformers.AutoTokenizer.from_pretrained",
"torch.no_grad"
] | [((464, 511), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['PRETRAINED_MODEL'], {}), '(PRETRAINED_MODEL)\n', (493, 511), False, 'from transformers import AutoTokenizer\n'), ((631, 704), 'torch.load', 'torch.load', (['"""../trained_models/t5_model_hotpot_supporting_facts_last.pth"""']... |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import os
import sys
import... | [
"os.path.isfile"
] | [((4508, 4545), 'os.path.isfile', 'os.path.isfile', (["opt['embedding_file']"], {}), "(opt['embedding_file'])\n", (4522, 4545), False, 'import os\n')] |
"""
Pythonista3 app CodeMirror
"""
import pythonista.wkwebview as wkwebview
import ui
import pathlib
uri = pathlib.Path('./main_index.html')
class View(ui.View):
def __init__(self):
self.wv = wkwebview.WKWebView(flex='WH')
self.wv.load_url(str(uri))
self.add_subview(self.wv)
def will_close(self):
... | [
"pythonista.wkwebview.WKWebView",
"pathlib.Path"
] | [((109, 142), 'pathlib.Path', 'pathlib.Path', (['"""./main_index.html"""'], {}), "('./main_index.html')\n", (121, 142), False, 'import pathlib\n'), ((202, 232), 'pythonista.wkwebview.WKWebView', 'wkwebview.WKWebView', ([], {'flex': '"""WH"""'}), "(flex='WH')\n", (221, 232), True, 'import pythonista.wkwebview as wkwebvi... |
from django.test import TestCase
from search.read_similarities import build_manual_similarity_map
from common.testhelpers.random_test_values import a_string, a_float
class TestReadingManualTaskSimilarities(TestCase):
def test_convert_matrix_to_map_from_topic_to_array_of_services(self):
data = [
... | [
"search.read_similarities.build_manual_similarity_map"
] | [((519, 552), 'search.read_similarities.build_manual_similarity_map', 'build_manual_similarity_map', (['data'], {}), '(data)\n', (546, 552), False, 'from search.read_similarities import build_manual_similarity_map\n'), ((911, 944), 'search.read_similarities.build_manual_similarity_map', 'build_manual_similarity_map', (... |
"""
Fortuna
Python project to visualize uncertatinty in probabilistic exploration models.
Created on 09/06/2018
@authors: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
"""
# Import libraries
import numpy as np
import glob
from matplotlib import pyplot as plt
import pandas as pd
import xarray as xr
import pyproj a... | [
"matplotlib.pyplot.imshow",
"numpy.random.normal",
"numpy.ma.masked_equal",
"numpy.unique",
"pandas.read_csv",
"numpy.arange",
"numpy.where",
"numpy.ma.log2",
"xarray.Dataset",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"numpy.loadtxt",
"numpy.load",
"numpy.zeros_like",
"glob.glob",... | [((1237, 1249), 'xarray.Dataset', 'xr.Dataset', ([], {}), '()\n', (1247, 1249), True, 'import xarray as xr\n'), ((1733, 1749), 'glob.glob', 'glob.glob', (['files'], {}), '(files)\n', (1742, 1749), False, 'import glob\n'), ((2295, 2373), 'pandas.read_csv', 'pd.read_csv', (['"""data/Hackaton/VolumeDistribution/Volumes"""... |
from PIL import Image
# open an image file (.bmp,.jpg,.png,.gif) you have in the working folder
# //imageFile = "03802.png"
import os
arr=os.listdir()
for imageFile in arr:
if "png" in imageFile:
im1 = Image.open(imageFile)
# adjust width and height to your needs
width = 416
heigh... | [
"os.listdir",
"PIL.Image.open"
] | [((140, 152), 'os.listdir', 'os.listdir', ([], {}), '()\n', (150, 152), False, 'import os\n'), ((217, 238), 'PIL.Image.open', 'Image.open', (['imageFile'], {}), '(imageFile)\n', (227, 238), False, 'from PIL import Image\n')] |
from telegram.ext import CommandHandler, run_async
from bot.gDrive import GoogleDriveHelper
from bot.fs_utils import get_readable_file_size
from bot import LOGGER, dispatcher, updater, bot
from bot.config import BOT_TOKEN, OWNER_ID, GDRIVE_FOLDER_ID
from bot.decorators import is_authorised, is_owner
from telegram.error... | [
"bot.LOGGER.error",
"bot.LOGGER.info",
"bot.bot.send_document",
"bot.gDrive.GoogleDriveHelper",
"bot.msg_utils.sendMessage",
"bot.dispatcher.add_handler",
"bot.updater.start_polling",
"bot.clone_status.CloneStatus",
"bot.msg_utils.deleteMessage",
"telegram.ext.CommandHandler"
] | [((594, 779), 'bot.msg_utils.sendMessage', 'sendMessage', (['"""Hello! Please send me a Google Drive Shareable Link to Clone to your Drive!\nSend /help for checking all available commands."""', 'context.bot', 'update', '"""Markdown"""'], {}), '(\n """Hello! Please send me a Google Drive Shareable Link to Clone to yo... |
import calendar
from datetime import datetime, timedelta
import json
import logging
import re
import rfc822
from django.conf import settings
from django.db.utils import IntegrityError
import cronjobs
from multidb.pinning import pin_this_thread
from statsd import statsd
from twython import Twython
from kitsune.custom... | [
"logging.getLogger",
"kitsune.customercare.models.Reply.objects.all",
"json.loads",
"kitsune.customercare.models.Tweet.objects.filter",
"kitsune.customercare.models.TwitterAccount.objects.filter",
"twython.Twython",
"re.compile",
"statsd.statsd.incr",
"json.dumps",
"multidb.pinning.pin_this_thread... | [((486, 524), 're.compile', 're.compile', (['"""https?\\\\:"""', 're.IGNORECASE'], {}), "('https?\\\\:', re.IGNORECASE)\n", (496, 524), False, 'import re\n'), ((535, 570), 're.compile', 're.compile', (['"""^rt\\\\W"""', 're.IGNORECASE'], {}), "('^rt\\\\W', re.IGNORECASE)\n", (545, 570), False, 'import re\n'), ((743, 77... |
import argparse
import sys
import cv2
import os
import os.path as osp
import numpy as np
if sys.version_info[0] == 2:
import xml.etree.cElementTree as ET
else:
import xml.etree.ElementTree as ET
parser = argparse.ArgumentParser(
description='Single Shot MultiBox Detector ... | [
"os.path.join",
"numpy.array",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser"
] | [((240, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Single Shot MultiBox Detector Training With Pytorch"""'}), "(description=\n 'Single Shot MultiBox Detector Training With Pytorch')\n", (263, 335), False, 'import argparse\n'), ((765, 794), 'xml.etree.ElementTree.parse', 'ET.... |
"""Parsing responses from the difficulty command."""
from mcipc.rcon.functions import boolmap
__all__ = ['parse']
SET = 'The difficulty has been set to (\\w+)'
UNCHANGED = 'The difficulty did not change; it is already set to (\\w+)'
def parse(text: str) -> bool:
"""Parses a boolean value from the text
re... | [
"mcipc.rcon.functions.boolmap"
] | [((374, 414), 'mcipc.rcon.functions.boolmap', 'boolmap', (['text'], {'true': 'SET', 'false': 'UNCHANGED'}), '(text, true=SET, false=UNCHANGED)\n', (381, 414), False, 'from mcipc.rcon.functions import boolmap\n')] |
# Generated by Django 2.2.6 on 2019-10-25 12:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("scripts", "0012_auto_20190128_1820")]
operations = [
migrations.AlterField(
model_name="scriptdb",
name="db_typeclass_path",
... | [
"django.db.models.CharField"
] | [((334, 563), 'django.db.models.CharField', 'models.CharField', ([], {'db_index': '(True)', 'help_text': '"""this defines what \'type\' of entity this is. This variable holds a Python path to a module with a valid Evennia Typeclass."""', 'max_length': '(255)', 'null': '(True)', 'verbose_name': '"""typeclass"""'}), '(db... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016 - 2020 -- <NAME>
# All rights reserved.
#
# License: BSD License
#
"""\
Test against issue <https://github.com/pyqrcode/pyqrcodeNG/pull/13/>.
The initial test was created by Mathieu <https://github.com/albatros69>,
see the above mentioned pull request.
Adapted for Segno ... | [
"pytest.main",
"segno.make"
] | [((496, 512), 'segno.make', 'segno.make', (['data'], {}), '(data)\n', (506, 512), False, 'import segno\n'), ((698, 733), 'segno.make', 'segno.make', (['data'], {'encoding': 'encoding'}), '(data, encoding=encoding)\n', (708, 733), False, 'import segno\n'), ((806, 829), 'pytest.main', 'pytest.main', (['[__file__]'], {}),... |
from src import app, db
from .models import User, Role, RoleUsers
from .security_admin import UserAdmin, RoleAdmin
from flask_security import Security, SQLAlchemyUserDatastore, \
login_required, roles_accepted
from flask_security.utils import encrypt_password
def config_security_admin(admin):
admin.add_view(U... | [
"src.db.session.commit",
"src.db.create_all",
"flask_security.SQLAlchemyUserDatastore",
"flask_security.Security",
"flask_security.utils.encrypt_password"
] | [((1667, 1706), 'flask_security.SQLAlchemyUserDatastore', 'SQLAlchemyUserDatastore', (['db', 'User', 'Role'], {}), '(db, User, Role)\n', (1690, 1706), False, 'from flask_security import Security, SQLAlchemyUserDatastore, login_required, roles_accepted\n'), ((1718, 1747), 'flask_security.Security', 'Security', (['app', ... |
import time
from jina.executors.crafters import BaseCrafter
from .helper import foo
class DummyHubExecutorSlow(BaseCrafter):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
time.sleep(15)
foo()
| [
"time.sleep"
] | [((220, 234), 'time.sleep', 'time.sleep', (['(15)'], {}), '(15)\n', (230, 234), False, 'import time\n')] |
import numpy as np
import pandas as pd
from scipy.stats import spearmanr
from sklearn.metrics import f1_score, precision_score, recall_score
from IPython.display import display, clear_output
from sklearn.metrics import confusion_matrix
import scipy.stats as st
def continuous_to_categorical_with_quantiles(data: np.nda... | [
"sklearn.metrics.f1_score",
"scipy.stats.scoreatpercentile",
"numpy.where",
"numpy.delete",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"IPython.display.clear_output",
"numpy.zeros",
"numpy.quantile",
"numpy.isnan",
"scipy.stats.spearmanr",
"sklearn.metrics.confusion_mat... | [((1345, 1369), 'numpy.zeros', 'np.zeros', (['(n_lat, n_lon)'], {}), '((n_lat, n_lon))\n', (1353, 1369), True, 'import numpy as np\n'), ((1814, 1838), 'numpy.zeros', 'np.zeros', (['(n_lat, n_lon)'], {}), '((n_lat, n_lon))\n', (1822, 1838), True, 'import numpy as np\n'), ((4224, 4259), 'numpy.zeros', 'np.zeros', (['(n_c... |
from datetime import datetime,timezone
import sys
import boto3
import json
def pipeline_event(event, context):
state = get_final_state(event)
if state is None:
return
event_time = datetime.strptime(event['time'], '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc)
metric_data = []
if eve... | [
"datetime.datetime.strptime",
"json.dumps",
"boto3.client"
] | [((2854, 2882), 'boto3.client', 'boto3.client', (['"""codepipeline"""'], {}), "('codepipeline')\n", (2866, 2882), False, 'import boto3\n'), ((3265, 3293), 'boto3.client', 'boto3.client', (['"""codepipeline"""'], {}), "('codepipeline')\n", (3277, 3293), False, 'import boto3\n'), ((7079, 7105), 'boto3.client', 'boto3.cli... |
import requests
import crowdstrike_detection as crowdstrike
import logging
import click
import urllib.parse
import ConfigParser
import os
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p')
logger = logging.get... | [
"logging.basicConfig",
"logging.getLogger",
"requests.post",
"click.option",
"ConfigParser.ConfigParser",
"os.path.dirname",
"click.command",
"crowdstrike_detection.fetch_detections"
] | [((139, 285), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s"""', 'datefmt': '"""%m/%d/%Y %I:%M:%S %p"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(name)-15s [%(levelname)-8s]: %(message)s', datefmt=\n '%m/%... |
import requests
import json
HEADERS = {"Authorization": "OAuth <KEY>", "Accept": "*/*"}
URL = "https://cloud-api.yandex.net:443/v1/disk/"
def get_folder_info(folder_name_1, folder_name_2, url=None, headers=None):
"""Получение информации о статусе папок на диске
Args:
folder_name_1: имя корневой пап... | [
"requests.put",
"json.loads",
"requests.get",
"requests.delete"
] | [((602, 719), 'requests.get', 'requests.get', ([], {'url': "(URL + 'resources?path=' + folder_name_1 + '/' + folder_name_2 + '&fields=path'\n )", 'headers': 'HEADERS'}), "(url=URL + 'resources?path=' + folder_name_1 + '/' +\n folder_name_2 + '&fields=path', headers=HEADERS)\n", (614, 719), False, 'import requests... |
import os
from collections import defaultdict
from flask import render_template
from flask_login import login_required
from sqlalchemy import and_
from app import db
from app.decorators import operator_required
from app.models import Student, MonthNameList, Course, PaymentStatus, Payment, Teacher, Schedule
from app.u... | [
"flask.render_template",
"app.models.Teacher.query.count",
"app.users.operator.operator.route",
"app.models.Student.query.count",
"os.environ.get",
"collections.defaultdict",
"app.db.session.query",
"sqlalchemy.and_"
] | [((353, 372), 'app.users.operator.operator.route', 'operator.route', (['"""/"""'], {}), "('/')\n", (367, 372), False, 'from app.users.operator import operator\n'), ((433, 459), 'os.environ.get', 'os.environ.get', (['"""APP_NAME"""'], {}), "('APP_NAME')\n", (447, 459), False, 'import os\n'), ((1000, 1021), 'app.models.S... |
import datetime
from homeschool.courses.tests.factories import (
CourseFactory,
CourseTaskFactory,
GradedWorkFactory,
)
from homeschool.schools.tests.factories import GradeLevelFactory
from homeschool.students.forms import CourseworkForm, EnrollmentForm, GradeForm
from homeschool.students.models import Cou... | [
"homeschool.courses.tests.factories.CourseFactory",
"homeschool.students.tests.factories.CourseworkFactory",
"homeschool.students.forms.EnrollmentForm",
"homeschool.students.tests.factories.EnrollmentFactory",
"homeschool.courses.tests.factories.GradedWorkFactory",
"homeschool.students.forms.GradeForm",
... | [((665, 699), 'homeschool.students.tests.factories.StudentFactory', 'StudentFactory', ([], {'school': 'user.school'}), '(school=user.school)\n', (679, 699), False, 'from homeschool.students.tests.factories import CourseworkFactory, EnrollmentFactory, GradeFactory, StudentFactory\n'), ((722, 772), 'homeschool.schools.te... |
""" @Author Jchakra"""
""" This code is to download project information using GitHub API (Following Amrit's Hero paper criteria of how to find good projects) """
from multiprocessing import Process,Lock
import time
import json
import requests
## Downloading all the projects
def func1():
repo_result = []
To... | [
"multiprocessing.Process",
"requests.get",
"time.sleep",
"multiprocessing.Lock",
"json.dump"
] | [((22908, 22914), 'multiprocessing.Lock', 'Lock', ([], {}), '()\n', (22912, 22914), False, 'from multiprocessing import Process, Lock\n'), ((22926, 22947), 'multiprocessing.Process', 'Process', ([], {'target': 'func1'}), '(target=func1)\n', (22933, 22947), False, 'from multiprocessing import Process, Lock\n'), ((22955,... |
import functools
def create_maybe_get_wire(conn):
c = conn.cursor()
@functools.lru_cache(maxsize=None)
def get_tile_type_pkey(tile):
c.execute('SELECT pkey, tile_type_pkey FROM phy_tile WHERE name = ?',
(tile, ))
return c.fetchone()
@functools.lru_cache(maxsize=None... | [
"functools.lru_cache"
] | [((80, 113), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (99, 113), False, 'import functools\n'), ((288, 321), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (307, 321), False, 'import functools\n')] |
"""A module that provides functionality for accessing the Payments API."""
import enum
import http
import logging
import requests
from fastapi import Depends, Header, HTTPException
from fastapi.security.http import HTTPAuthorizationCredentials
import auth.authentication
import config
import schemas.payment
logger ... | [
"logging.getLogger",
"fastapi.HTTPException",
"fastapi.Header",
"fastapi.Depends"
] | [((322, 349), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (339, 349), False, 'import logging\n'), ((778, 820), 'fastapi.Depends', 'Depends', (['auth.authentication.bearer_scheme'], {}), '(auth.authentication.bearer_scheme)\n', (785, 820), False, 'from fastapi import Depends, Header, HT... |
from datetime import datetime
import inspect
def log_time(msg=None):
def decorator(f):
nonlocal msg
if msg is None:
msg = '{} time spent: '.format(f.__name__)
def inner(*args, **kwargs):
# check if the object has a logger
global logger
if ar... | [
"datetime.datetime.now",
"inspect.getargspec"
] | [((700, 721), 'inspect.getargspec', 'inspect.getargspec', (['f'], {}), '(f)\n', (718, 721), False, 'import inspect\n'), ((415, 429), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (427, 429), False, 'from datetime import datetime\n'), ((539, 553), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (... |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The Bitcoin developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Test that the blockmaxsize and excessiveblocksize paramete... | [
"os.path.join",
"test_framework.util.assert_equal"
] | [((1229, 1283), 'test_framework.util.assert_equal', 'assert_equal', (["gires['maxblocksize']", 'self.maxblocksize'], {}), "(gires['maxblocksize'], self.maxblocksize)\n", (1241, 1283), False, 'from test_framework.util import assert_equal, assert_raises_rpc_error\n'), ((1292, 1356), 'test_framework.util.assert_equal', 'a... |
import pdb
import warnings
from jax import custom_vjp
@custom_vjp
def debug_identity(x):
"""
acts as identity, but inserts a pdb trace on the backwards pass
"""
warnings.warn('Using a module intended for debugging')
return x
def _debug_fwd(x):
warnings.warn('Using a module intended for debu... | [
"warnings.warn",
"pdb.set_trace"
] | [((180, 234), 'warnings.warn', 'warnings.warn', (['"""Using a module intended for debugging"""'], {}), "('Using a module intended for debugging')\n", (193, 234), False, 'import warnings\n'), ((273, 327), 'warnings.warn', 'warnings.warn', (['"""Using a module intended for debugging"""'], {}), "('Using a module intended ... |
#!/usr/bin/env python
# Some helpful links
# https://docs.python.org/3/library/tkinter.html
# https://www.python-course.eu/tkinter_entry_widgets.php
import tkinter as tk
class Application(tk.Frame):
def __init__(self, root=None):
super().__init__(root)
self.root = root
... | [
"tkinter.Button",
"tkinter.Tk",
"tkinter.Entry",
"tkinter.Label"
] | [((448, 462), 'tkinter.Entry', 'tk.Entry', (['self'], {}), '(self)\n', (456, 462), True, 'import tkinter as tk\n'), ((488, 502), 'tkinter.Entry', 'tk.Entry', (['self'], {}), '(self)\n', (496, 502), True, 'import tkinter as tk\n'), ((524, 538), 'tkinter.Label', 'tk.Label', (['self'], {}), '(self)\n', (532, 538), True, '... |
# -*- coding: utf-8 -*-
__author__ = 'isee15'
import LunarSolarConverter
converter = LunarSolarConverter.LunarSolarConverter()
def LunarToSolar(year, month, day, isleap = False):
lunar = LunarSolarConverter.Lunar(year, month, day, isleap)
solar = converter.LunarToSolar(lunar)
return (solar.solarYear, sol... | [
"LunarSolarConverter.GetBitInt",
"LunarSolarConverter.Solar",
"LunarSolarConverter.Lunar",
"LunarSolarConverter.LunarSolarConverter"
] | [((87, 128), 'LunarSolarConverter.LunarSolarConverter', 'LunarSolarConverter.LunarSolarConverter', ([], {}), '()\n', (126, 128), False, 'import LunarSolarConverter\n'), ((194, 245), 'LunarSolarConverter.Lunar', 'LunarSolarConverter.Lunar', (['year', 'month', 'day', 'isleap'], {}), '(year, month, day, isleap)\n', (219, ... |
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"simple_network.SimpleNetwork",
"nvflare.apis.shareable.make_reply",
"torch.as_tensor",
"torch.max",
"nvflare.apis.dxo.DXO",
"nvflare.apis.dxo.from_shareable",
"torchvision.datasets.CIFAR10",
"torch.cuda.is_available",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torch.no_... | [((1404, 1419), 'simple_network.SimpleNetwork', 'SimpleNetwork', ([], {}), '()\n', (1417, 1419), False, 'from simple_network import SimpleNetwork\n'), ((1746, 1803), 'torchvision.datasets.CIFAR10', 'CIFAR10', ([], {'root': '"""~/data"""', 'train': '(False)', 'transform': 'transforms'}), "(root='~/data', train=False, tr... |
# MIT License
# Copyright (c) 2020-2021 <NAME> (https://www.chrisfarris.com)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# t... | [
"logging.getLogger",
"logging.StreamHandler",
"boto3.client",
"os.getenv",
"logging.Formatter",
"json.dumps"
] | [((1237, 1256), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1254, 1256), False, 'import logging\n'), ((1504, 1545), 'os.getenv', 'os.getenv', (['"""TAG_KEY"""'], {'default': '"""WireShark"""'}), "('TAG_KEY', default='WireShark')\n", (1513, 1545), False, 'import os\n'), ((1667, 1686), 'boto3.client', 'b... |
from django.views.generic import View
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.decorators.cache import never_cache
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.urls import reverse
from... | [
"django.shortcuts.render",
"django.http.HttpResponseRedirect",
"gbe.ticketing_idd_interface.get_payment_details",
"django.urls.reverse",
"django.contrib.messages.error",
"django.contrib.messages.warning",
"gbe.ticketing_idd_interface.fee_paid",
"django.shortcuts.get_object_or_404",
"django.utils.dec... | [((7313, 7345), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {}), '(login_required)\n', (7329, 7345), False, 'from django.utils.decorators import method_decorator\n'), ((1078, 1118), 'gbe.functions.validate_profile', 'validate_profile', (['request'], {'require': '(False)'}), '(re... |
# Copyright 2014-2018 The PySCF Developers. 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 appl... | [
"unittest.main",
"pyscf.tools.cubegen.Cube",
"os.path.abspath",
"pyscf.nao.system_vars_c"
] | [((1201, 1216), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1214, 1216), False, 'import os, unittest, numpy as np\n'), ((1001, 1030), 'pyscf.tools.cubegen.Cube', 'Cube', (['sv'], {'nx': '(20)', 'ny': '(20)', 'nz': '(20)'}), '(sv, nx=20, ny=20, nz=20)\n', (1005, 1030), False, 'from pyscf.tools.cubegen import Cu... |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 17 06:44:47 2018
@author: <NAME>
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
# importing the dataset
dataset = pd.read_csv('Position_Salaries.csv')
# take all the columns but leave the last on... | [
"sklearn.tree.DecisionTreeRegressor",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((239, 275), 'pandas.read_csv', 'pd.read_csv', (['"""Position_Salaries.csv"""'], {}), "('Position_Salaries.csv')\n", (250, 275), True, 'import pandas as pd\n'), ((921, 958), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {'random_state': '(0)'}), '(random_state=0)\n', (942, 958), False, 'from skle... |
from itertools import product
import numpy as np
import pandas as pd
import pytest
from sklearn.metrics import matthews_corrcoef as sk_matthews_corrcoef
from evalml.objectives import (
F1,
MAPE,
MSE,
AccuracyBinary,
AccuracyMulticlass,
BalancedAccuracyBinary,
BalancedAccuracyMulticlass,
... | [
"evalml.objectives.PrecisionWeighted",
"numpy.sqrt",
"evalml.objectives.F1Micro",
"evalml.objectives.PrecisionMicro",
"evalml.objectives.F1Macro",
"evalml.objectives.MCCBinary",
"evalml.objectives.RecallMacro",
"sklearn.metrics.matthews_corrcoef",
"numpy.array",
"evalml.objectives.RootMeanSquaredE... | [((843, 865), 'evalml.objectives.utils._all_objectives_dict', '_all_objectives_dict', ([], {}), '()\n', (863, 865), False, 'from evalml.objectives.utils import _all_objectives_dict, get_non_core_objectives\n'), ((1051, 1075), 'numpy.array', 'np.array', (['[np.nan, 0, 0]'], {}), '([np.nan, 0, 0])\n', (1059, 1075), True,... |
# -*- encoding: utf-8 -*-
"""
Unit test for roger_promote.py
"""
import tests.helper
import unittest
import os
import os.path
import pytest
import requests
from mockito import mock, Mock, when
from cli.roger_promote import RogerPromote
from cli.appconfig import AppConfig
from cli.settings import Settings
from cl... | [
"cli.roger_promote.RogerPromote",
"mockito.mock",
"mockito.when"
] | [((551, 565), 'mockito.mock', 'mock', (['Marathon'], {}), '(Marathon)\n', (555, 565), False, 'from mockito import mock, Mock, when\n'), ((590, 604), 'mockito.mock', 'mock', (['Settings'], {}), '(Settings)\n', (594, 604), False, 'from mockito import mock, Mock, when\n'), ((631, 646), 'mockito.mock', 'mock', (['AppConfig... |
from planning_framework import path
import cv2 as cv
import numpy as np
import argparse
import matplotlib.pyplot as plt
parser = argparse.ArgumentParser(description="Path Planning Visualisation")
parser.add_argument(
"-n",
"--n_heuristic",
default=2,
help="Heuristic for A* Algorithm (default = 2). 0 f... | [
"cv2.setMouseCallback",
"matplotlib.pyplot.imshow",
"cv2.rectangle",
"numpy.ones",
"argparse.ArgumentParser",
"planning_framework.path",
"cv2.imshow",
"numpy.array",
"numpy.zeros",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.getWindowProperty",
"cv2.resize",
"cv2.waitKey",
"cv2.namedWind... | [((130, 196), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Path Planning Visualisation"""'}), "(description='Path Planning Visualisation')\n", (153, 196), False, 'import argparse\n'), ((1313, 1346), 'numpy.zeros', 'np.zeros', (['(512, 512, 3)', 'np.uint8'], {}), '((512, 512, 3), np.uin... |
import re
from pkg_resources import parse_requirements
import pathlib
from setuptools import find_packages, setup
README_FILE = 'README.md'
REQUIREMENTS_FILE = 'requirements.txt'
VERSION_FILE = 'mtg/_version.py'
VERSION_REGEXP = r'^__version__ = \'(\d+\.\d+\.\d+)\''
r = re.search(VERSION_REGEXP, open(VERSION_FILE).r... | [
"setuptools.find_packages"
] | [((929, 944), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (942, 944), False, 'from setuptools import find_packages, setup\n')] |
"""
功能:模拟掷骰子
版本:1.0
"""
import random
def roll_dice():
roll = random.randint(1, 6)
return roll
def main():
total_times = 100000
result_list = [0] * 6
for i in range(total_times):
roll = roll_dice()
result_list[roll-1] += 1
for i, x in enumerate(result_list):
... | [
"random.randint"
] | [((77, 97), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (91, 97), False, 'import random\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/11/30 下午3:02
# @Author : Matrix
# @Github : https://github.com/blackmatrix7/
# @Blog : http://www.cnblogs.com/blackmatrix/
# @File : messages.py
# @Software: PyCharm
import json
from ..foundation import *
from json import JSONDecodeError
__author__ = 'blackm... | [
"json.dumps"
] | [((573, 595), 'json.dumps', 'json.dumps', (['msgcontent'], {}), '(msgcontent)\n', (583, 595), False, 'import json\n')] |
# -*- coding: utf-8 -*-
""" p2p-streams (c) 2014 enen92 fightnight
This file contains the livestream addon engine. It is mostly based on divingmule work on livestreams addon!
Functions:
xml_lists_menu() -> main menu for the xml list category
addlista() -> add a new list. It'll ask for local or rem... | [
"urllib2.urlopen",
"xml.etree.ElementTree.parse",
"re.compile",
"urllib.unquote",
"xbmcvfs.exists",
"os.path.join",
"urllib.quote",
"BeautifulSoup.BeautifulSOAP",
"xbmcvfs.delete",
"xbmcgui.ListItem",
"urllib2.Request",
"xbmcgui.Dialog",
"sys.exit",
"re.sub",
"xbmc.executebuiltin"
] | [((4891, 4911), 'xbmcvfs.delete', 'xbmcvfs.delete', (['name'], {}), '(name)\n', (4905, 4911), False, 'import urllib, urllib2, re, xbmcplugin, xbmcgui, xbmc, xbmcaddon, HTMLParser, time, datetime, os, xbmcvfs, sys\n'), ((5033, 5073), 'xbmc.executebuiltin', 'xbmc.executebuiltin', (['"""Container.Refresh"""'], {}), "('Con... |
#!/usr/bin/env python
# ================================================================
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# ================================================================
import sys
import json
import TE
TE.Net.setAppTokenFromEnvName("TX_ACCESS_TOKEN")
postPar... | [
"json.dumps",
"TE.Net.updateThreatDescriptor",
"sys.stderr.write",
"sys.exit",
"TE.Net.setAppTokenFromEnvName"
] | [((263, 311), 'TE.Net.setAppTokenFromEnvName', 'TE.Net.setAppTokenFromEnvName', (['"""TX_ACCESS_TOKEN"""'], {}), "('TX_ACCESS_TOKEN')\n", (292, 311), False, 'import TE\n'), ((537, 596), 'TE.Net.updateThreatDescriptor', 'TE.Net.updateThreatDescriptor', (['postParams', 'showURLs', 'dryRun'], {}), '(postParams, showURLs, ... |
# Copyright 2018 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 a... | [
"loaner.web_app.backend.models.shelf_model.Shelf.enroll",
"mock.patch",
"loaner.web_app.backend.models.device_model.Device.get",
"loaner.web_app.backend.api.messages.shared_messages.SearchExpression",
"loaner.web_app.backend.testing.loanertest.main",
"loaner.web_app.backend.api.messages.shelf_messages.She... | [((3959, 4015), 'mock.patch', 'mock.patch', (['"""__main__.root_api.Service.check_xsrf_token"""'], {}), "('__main__.root_api.Service.check_xsrf_token')\n", (3969, 4015), False, 'import mock\n'), ((4019, 4066), 'mock.patch', 'mock.patch', (['"""__main__.shelf_model.Shelf.enroll"""'], {}), "('__main__.shelf_model.Shelf.e... |
from flask import render_template, jsonify, Flask, redirect, url_for, request
from app import app
import random
import os
# import tensorflow as tf
# import numpy as np
# import sys
# import spacy
# nlp = spacy.load('en')
# sys.path.insert(0, "/content/bert_experimental")
# from bert_experimental.finetuning.text_pre... | [
"flask.render_template",
"random.uniform",
"flask.request.form.get",
"app.app.route",
"random.randint",
"flask.jsonify"
] | [((1029, 1043), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (1038, 1043), False, 'from app import app\n'), ((1117, 1163), 'app.app.route', 'app.route', (['"""/predict"""'], {'methods': "['GET', 'POST']"}), "('/predict', methods=['GET', 'POST'])\n", (1126, 1163), False, 'from app import app\n'), ((1642, ... |
# -*- coding: utf-8 -*-
"""
Complementary Filter
====================
Attitude quaternion obtained with gyroscope and accelerometer-magnetometer
measurements, via complementary filter.
First, the current orientation is estimated at time :math:`t`, from a previous
orientation at time :math:`t-1`, and a given ... | [
"numpy.array",
"numpy.zeros",
"numpy.sqrt",
"numpy.linalg.norm"
] | [((7766, 7792), 'numpy.zeros', 'np.zeros', (['(num_samples, 4)'], {}), '((num_samples, 4))\n', (7774, 7792), True, 'import numpy as np\n'), ((9157, 9278), 'numpy.array', 'np.array', (['[[1.0, -w[0], -w[1], -w[2]], [w[0], 1.0, w[2], -w[1]], [w[1], -w[2], 1.0, w\n [0]], [w[2], w[1], -w[0], 1.0]]'], {}), '([[1.0, -w[0]... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis 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 ... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((1708, 1766), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', 'execution.ExecutionState'], {}), "('state', execution.ExecutionState)\n", (1731, 1766), False, 'import pytest\n'), ((2148, 2206), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', 'execution.ExecutionState'], {}... |
from django.contrib.auth.models import User
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.utils.translation import ugettext_lazy as _
class Task(models.Model):
CLOSE = 'cl'
CANCEL = 'ca'
LATER = 'la'
UNDEFINED = 'un'
CHOICES = (
... | [
"django.core.validators.MinValueValidator",
"django.utils.translation.ugettext_lazy",
"django.core.validators.MaxValueValidator",
"django.db.models.ForeignKey"
] | [((1342, 1416), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Task'], {'related_name': '"""comments"""', 'on_delete': 'models.CASCADE'}), "(Task, related_name='comments', on_delete=models.CASCADE)\n", (1359, 1416), False, 'from django.db import models\n'), ((1431, 1492), 'django.db.models.ForeignKey', 'models.... |
import numpy as np
import hexy as hx
def test_get_hex_line():
expected = [
[-3, 3, 0],
[-2, 2, 0],
[-1, 2, -1],
[0, 2, -2],
[1, 1, -2],
]
start = np.array([-3, 3, 0])
end = np.array([1, 1, -2])
print(hx.get_hex_line(start, end))
... | [
"numpy.array",
"hexy.get_hex_line"
] | [((227, 247), 'numpy.array', 'np.array', (['[-3, 3, 0]'], {}), '([-3, 3, 0])\n', (235, 247), True, 'import numpy as np\n'), ((258, 278), 'numpy.array', 'np.array', (['[1, 1, -2]'], {}), '([1, 1, -2])\n', (266, 278), True, 'import numpy as np\n'), ((289, 316), 'hexy.get_hex_line', 'hx.get_hex_line', (['start', 'end'], {... |
"""
A :py:mod:`filter <tiddlyweb.filters>` type to limit a group of entities
using a syntax similar to SQL Limit::
limit=<index>,<count>
limit=<count>
"""
import itertools
def limit_parse(count='0'):
"""
Parse the argument of a ``limit`` :py:mod:`filter <tiddlyweb.filters>`
for a count and index... | [
"itertools.islice"
] | [((835, 883), 'itertools.islice', 'itertools.islice', (['entities', 'index', '(index + count)'], {}), '(entities, index, index + count)\n', (851, 883), False, 'import itertools\n')] |