code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
GF_SECURITY_ADMIN_USER = os.environ["GF_SECURITY_ADMIN_USER"]
GF_SECURITY_ADMIN_PASSWORD = os.environ["GF_SECURITY_ADMIN_PASSWORD"]
METRICS_DB_URL = os.environ["REDATA_METRICS_DB_URL"]
REDATA_METRICS_DATABASE_HOST = os.environ["REDATA_METRICS_DATABASE_HOST"]
REDATA_METRICS_DATABASE_USER = os.environ["REDAT... | [
"os.environ.get"
] | [((1905, 1952), 'os.environ.get', 'os.environ.get', (['"""REDATA_SLACK_NOTIFICATION_URL"""'], {}), "('REDATA_SLACK_NOTIFICATION_URL')\n", (1919, 1952), False, 'import os\n'), ((1976, 2017), 'os.environ.get', 'os.environ.get', (['"""REDATA_FLASK_SECRET_KEY"""'], {}), "('REDATA_FLASK_SECRET_KEY')\n", (1990, 2017), False,... |
from pandas_datareader import data
start_date = '2014-01-01'
end_date = '2018-01-01'
goog_data = data.DataReader('GOOG', 'yahoo', start_date, end_date)
import numpy as np
import pandas as pd
goog_data_signal = pd.DataFrame(index=goog_data.index)
goog_data_signal['price'] = goog_data['Adj Close']
goog_data_signal['da... | [
"pandas_datareader.data.DataReader",
"numpy.where",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"matplotlib.pyplot.show"
] | [((97, 151), 'pandas_datareader.data.DataReader', 'data.DataReader', (['"""GOOG"""', '"""yahoo"""', 'start_date', 'end_date'], {}), "('GOOG', 'yahoo', start_date, end_date)\n", (112, 151), False, 'from pandas_datareader import data\n'), ((213, 248), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'goog_data.index'})... |
#!/usr/bin/python3
from tools import *
from sys import argv
from os.path import join
import h5py
import matplotlib.pylab as plt
from matplotlib.patches import Wedge
import numpy as np
if len(argv) > 1:
pathToSimFolder = argv[1]
else:
pathToSimFolder = "../data/"
parameters, electrodes = readParameters(pathT... | [
"matplotlib.pylab.subplots",
"numpy.sqrt",
"matplotlib.colors.to_rgba",
"os.path.join",
"numpy.max",
"numpy.cos",
"matplotlib.pylab.close",
"numpy.sin",
"numpy.bincount"
] | [((2761, 2773), 'numpy.max', 'np.max', (['data'], {}), '(data)\n', (2767, 2773), True, 'import numpy as np\n'), ((2839, 2857), 'numpy.bincount', 'np.bincount', (['added'], {}), '(added)\n', (2850, 2857), True, 'import numpy as np\n'), ((4035, 4087), 'matplotlib.pylab.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsiz... |
import sys
import numpy as np
from starfish import ImageStack
from starfish.spots import FindSpots
from starfish.types import Axes
def test_lmpf_uniform_peak():
data_array = np.zeros(shape=(1, 1, 1, 100, 100), dtype=np.float32)
data_array[0, 0, 0, 45:55, 45:55] = 1
imagestack = ImageStack.from_numpy(dat... | [
"starfish.ImageStack.from_numpy",
"numpy.zeros",
"starfish.spots.FindSpots.LocalMaxPeakFinder"
] | [((182, 235), 'numpy.zeros', 'np.zeros', ([], {'shape': '(1, 1, 1, 100, 100)', 'dtype': 'np.float32'}), '(shape=(1, 1, 1, 100, 100), dtype=np.float32)\n', (190, 235), True, 'import numpy as np\n'), ((295, 328), 'starfish.ImageStack.from_numpy', 'ImageStack.from_numpy', (['data_array'], {}), '(data_array)\n', (316, 328)... |
import copy
import json
from collections import defaultdict
from jsonschema import ValidationError
from trapi_model.base import TrapiBaseClass
from trapi_model.biolink.constants import get_biolink_entity
from trapi_model.exceptions import *
from reasoner_validator import validate
def merge_meta_knowledge_graphs(list... | [
"trapi_model.biolink.constants.get_biolink_entity",
"json.load",
"reasoner_validator.validate",
"copy.deepcopy"
] | [((4815, 4834), 'copy.deepcopy', 'copy.deepcopy', (['self'], {}), '(self)\n', (4828, 4834), False, 'import copy\n'), ((2164, 2211), 'reasoner_validator.validate', 'validate', (['_dict', '"""MetaNode"""', 'self.trapi_version'], {}), "(_dict, 'MetaNode', self.trapi_version)\n", (2172, 2211), False, 'from reasoner_validat... |
import pytest
from aio_aws.aws_batch_models import AWSBatchJob
#
# TODO: create fixtures for the same job-name with different job-id and different status
#
#
# TODO: create fixtures for the same job-name with different status
#
#
# TODO: change all fixtures with different job-name and job-id with different status
#... | [
"aio_aws.aws_batch_models.AWSBatchJob"
] | [((1681, 1704), 'aio_aws.aws_batch_models.AWSBatchJob', 'AWSBatchJob', ([], {}), '(**job_data)\n', (1692, 1704), False, 'from aio_aws.aws_batch_models import AWSBatchJob\n'), ((4179, 4202), 'aio_aws.aws_batch_models.AWSBatchJob', 'AWSBatchJob', ([], {}), '(**job_data)\n', (4190, 4202), False, 'from aio_aws.aws_batch_mo... |
from flask_gaming import create_app
app = create_app('development.cfg')
| [
"flask_gaming.create_app"
] | [((43, 72), 'flask_gaming.create_app', 'create_app', (['"""development.cfg"""'], {}), "('development.cfg')\n", (53, 72), False, 'from flask_gaming import create_app\n')] |
import logging
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from .overflow_helper import OverflowHelper
from configs.config import *
class OverflowFacade:
def __init__(self, token=SLACK_BOT_TOKEN,
bot_name=SLACK_BOT_NAME):
self.token = token
self.def... | [
"slack_sdk.WebClient",
"logging.info",
"logging.error"
] | [((449, 476), 'slack_sdk.WebClient', 'WebClient', ([], {'token': 'self.token'}), '(token=self.token)\n', (458, 476), False, 'from slack_sdk import WebClient\n'), ((1552, 1610), 'logging.info', 'logging.info', (['f"""Response text from Slack {slack_response}"""'], {}), "(f'Response text from Slack {slack_response}')\n",... |
# pylint: disable=no-member, missing-docstring
from unittest import TestCase
from pytest import mark
from celery import shared_task
from django.test.utils import override_settings
from edx_django_utils.cache import RequestCache
@mark.django_db
class TestClearRequestCache(TestCase):
"""
Tests _clear_request... | [
"django.test.utils.override_settings",
"edx_django_utils.cache.RequestCache"
] | [((618, 680), 'django.test.utils.override_settings', 'override_settings', ([], {'CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION': '(True)'}), '(CLEAR_REQUEST_CACHE_ON_TASK_COMPLETION=True)\n', (635, 680), False, 'from django.test.utils import override_settings\n'), ((412, 449), 'edx_django_utils.cache.RequestCache', 'RequestCa... |
import numpy as np
import os
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.init as init
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
#from scipy import stats
from shallow_model import Model
class z24Dataset(Dataset):
def __init__(self, damage_ca... | [
"torch.mean",
"torch.load",
"numpy.memmap",
"torch.numel",
"numpy.sum",
"torch.nn.MSELoss",
"numpy.array",
"torch.cuda.is_available",
"torch.sum",
"torch.utils.data.DataLoader",
"numpy.loadtxt",
"numpy.load",
"torch.std",
"torch.zeros"
] | [((2117, 2202), 'numpy.loadtxt', 'np.loadtxt', (["('../data/z24_damage/damage_' + damage_case + '_index.txt')"], {'dtype': 'str'}), "('../data/z24_damage/damage_' + damage_case + '_index.txt', dtype=str\n )\n", (2127, 2202), True, 'import numpy as np\n'), ((2296, 2383), 'torch.load', 'torch.load', ([], {'f': '"""../... |
#!/usr/bin/env python3
# Copyright (c) 2021 The Ttm Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
import time
from test_framework.messages import msg_qgetdata, msg_qwatch
from test_framework.mininode import (
... | [
"test_framework.messages.msg_qwatch",
"test_framework.messages.msg_qgetdata",
"test_framework.util.assert_equal",
"test_framework.mininode.network_thread_join",
"time.sleep",
"test_framework.util.force_finish_mnsync",
"test_framework.util.wait_until",
"test_framework.mininode.network_thread_start",
... | [((1510, 1563), 'test_framework.util.assert_equal', 'assert_equal', (['qdata.quorum_type', 'qgetdata.quorum_type'], {}), '(qdata.quorum_type, qgetdata.quorum_type)\n', (1522, 1563), False, 'from test_framework.util import assert_equal, assert_raises_rpc_error, connect_nodes, force_finish_mnsync, wait_until\n'), ((1568,... |
from browser import document
import brySVG.transformcanvas as SVG
canvas = SVG.CanvasObject("95vw", "100%", "cyan")
document["demo3"] <= canvas
canvas.mouseMode = SVG.MouseMode.TRANSFORM
tiles = [SVG.ClosedBezierObject([((-100,50), (50,100), (200,50)), ((-100,50), (50,0), (200,50))]),
SVG.GroupObject([SVG.Pol... | [
"brySVG.transformcanvas.CanvasObject",
"brySVG.transformcanvas.SmoothClosedBezierObject",
"brySVG.transformcanvas.SmoothBezierObject",
"brySVG.transformcanvas.PolylineObject",
"brySVG.transformcanvas.BezierObject",
"brySVG.transformcanvas.RectangleObject",
"brySVG.transformcanvas.EllipseObject",
"bryS... | [((76, 116), 'brySVG.transformcanvas.CanvasObject', 'SVG.CanvasObject', (['"""95vw"""', '"""100%"""', '"""cyan"""'], {}), "('95vw', '100%', 'cyan')\n", (92, 116), True, 'import brySVG.transformcanvas as SVG\n'), ((198, 297), 'brySVG.transformcanvas.ClosedBezierObject', 'SVG.ClosedBezierObject', (['[((-100, 50), (50, 10... |
from __future__ import annotations
from typing import Sequence
from pathlib import Path
import numpy as np
import pandas as pd
from dscience.core.exceptions import *
from dscience.core.extended_df import *
from dscience.ml.confusion_matrix import *
from kale.ml.accuracy_frames import *
class DecisionFrame(OrganizingF... | [
"pandas.DataFrame",
"pathlib.Path"
] | [((1860, 1891), 'pandas.DataFrame', 'pd.DataFrame', (['decision_function'], {}), '(decision_function)\n', (1872, 1891), True, 'import pandas as pd\n'), ((3188, 3223), 'pandas.DataFrame', 'pd.DataFrame', (['correct_confused_with'], {}), '(correct_confused_with)\n', (3200, 3223), True, 'import pandas as pd\n'), ((4216, 4... |
#!/usr/bin/env python
#
# Copyright (c) 2015 10X Genomics, Inc. All rights reserved.
#
import collections
import itertools
import json
import numpy as np
import os
import re
import sys
import tenkit.constants as tk_constants
import tenkit.fasta as tk_fasta
import tenkit.safe_json as tk_safe_json
import tenkit.seq as tk... | [
"cellranger.io.mkdir",
"numpy.array",
"cellranger.io.open_maybe_gzip",
"itertools.izip",
"tenkit.seq.get_rev_comp",
"cellranger.utils.load_barcode_whitelist",
"tenkit.constants.SAMPLE_INDEX_MAP.get",
"cellranger.utils.get_fastq_read1",
"tenkit.fasta.find_input_fastq_files_10x_preprocess",
"tenkit.... | [((1268, 1297), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1291, 1297), False, 'import collections\n'), ((2369, 2445), 'itertools.islice', 'itertools.islice', (['read_iter', 'cr_constants.NUM_CHECK_BARCODES_FOR_ORIENTATION'], {}), '(read_iter, cr_constants.NUM_CHECK_BARCODES_FOR_... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from commonconf import settings
from restclients_core.dao import DAO
from os.path import abspath, dirname
import os
import json
class MDOT(DAO):
"""
DAO with methods for getting uwresources from the mdot-rest API.
Us... | [
"os.path.dirname",
"json.loads"
] | [((856, 881), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (866, 881), False, 'import json\n'), ((1790, 1807), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (1797, 1807), False, 'from os.path import abspath, dirname\n')] |
import glob
import os.path as osp
import re
from .bases import ImageDataset
from ..datasets import DATASET_REGISTRY
@DATASET_REGISTRY.register()
class CarlaVehicle(ImageDataset):
"""
"""
dataset_dir = "carla_vehicles_random_1000"
dataset_name = "carla_vehicles_random_1000"
# dataset_dir = "carl... | [
"os.path.join",
"re.compile"
] | [((479, 511), 'os.path.join', 'osp.join', (['root', 'self.dataset_dir'], {}), '(root, self.dataset_dir)\n', (487, 511), True, 'import os.path as osp\n'), ((2788, 2835), 're.compile', 're.compile', (['"""c([\\\\d]+)[-_]([\\\\d]+)[-_]([\\\\d]+)"""'], {}), "('c([\\\\d]+)[-_]([\\\\d]+)[-_]([\\\\d]+)')\n", (2798, 2835), Fal... |
import gc
import numpy as np
import pandas as pd
from keras import backend as K
from keras.callbacks import CSVLogger, ModelCheckpoint, Callback
from sklearn.model_selection import ParameterGrid
import datetime
import os
import numpy as np
import h5py
import pickle
from models import MDAD_model
from experiment_helpers... | [
"sklearn.model_selection.ParameterGrid",
"keras.callbacks.CSVLogger",
"os.makedirs",
"keras.callbacks.ModelCheckpoint",
"os.path.isdir",
"keras.backend.tensorflow_backend._get_available_gpus",
"keras.backend.clear_session",
"gc.collect",
"models.MDAD_model",
"experiment_helpers.load_final_PCA_data... | [((434, 476), 'keras.backend.tensorflow_backend._get_available_gpus', 'K.tensorflow_backend._get_available_gpus', ([], {}), '()\n', (474, 476), True, 'from keras import backend as K\n'), ((779, 805), 'sklearn.model_selection.ParameterGrid', 'ParameterGrid', (['hyperparams'], {}), '(hyperparams)\n', (792, 805), False, '... |
from __future__ import annotations
import numpy as np
from edutorch.typing import NPArray
from .module import Module
from .rnn_cell import RNNCell
class RNN(Module):
def __init__(self, input_size: int, hidden_size: int, batch_size: int) -> None:
super().__init__()
self.input_size = input_size
... | [
"numpy.random.normal",
"numpy.zeros",
"numpy.zeros_like"
] | [((431, 473), 'numpy.random.normal', 'np.random.normal', ([], {'scale': '(0.001)', 'size': '(N, H)'}), '(scale=0.001, size=(N, H))\n', (447, 473), True, 'import numpy as np\n'), ((491, 533), 'numpy.random.normal', 'np.random.normal', ([], {'scale': '(0.001)', 'size': '(D, H)'}), '(scale=0.001, size=(D, H))\n', (507, 53... |
import cv2
import glob
import pickle
from main.RECOGNITION import RECOG
from maim.embed_save import SAVE_EMBDED
emb =SAVE_EMBDED()
recg=RECOG()
path = "./crop/"
process = input(" What do you want to do recognition or register:")
if process == "recognition":
image = glob.glob(path+"*")
for file in image:
... | [
"maim.embed_save.SAVE_EMBDED",
"glob.glob",
"main.RECOGNITION.RECOG",
"cv2.imread"
] | [((118, 131), 'maim.embed_save.SAVE_EMBDED', 'SAVE_EMBDED', ([], {}), '()\n', (129, 131), False, 'from maim.embed_save import SAVE_EMBDED\n'), ((137, 144), 'main.RECOGNITION.RECOG', 'RECOG', ([], {}), '()\n', (142, 144), False, 'from main.RECOGNITION import RECOG\n'), ((274, 295), 'glob.glob', 'glob.glob', (["(path + '... |
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserve.
#
# 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... | [
"logging.getLogger",
"sys.setdefaultencoding",
"logging.StreamHandler",
"paddle.fluid.cuda_places",
"models.language_model.lm_model.lm_model",
"numpy.array",
"paddle.fluid.cpu_places",
"paddle.fluid.clip.GradientClipByGlobalNorm",
"sys.path.append",
"paddle.fluid.ExecutionStrategy",
"paddle.flui... | [((1083, 1105), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (1098, 1105), False, 'import sys\n'), ((1051, 1082), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (1073, 1082), False, 'import sys\n'), ((2305, 2334), 'numpy.savez', 'np.savez', (['"""mod... |
'''
M-1: Using Python -> Transfer EOS tokens from 'toecom111111' to `toecom111112`
M-2: Using cleos -> cleost push action eosio.token transfer '["toecom111111", "toecom111112", "1.0000 EOS", "for fun"]' -p toecom111111@active
'''
import asyncio
from aioeos import EosAccount, EosJsonRpc, EosTransaction
from ... | [
"json.loads",
"aioeos.EosJsonRpc",
"asyncio.get_event_loop",
"aioeos.EosTransaction",
"aioeos.EosAccount"
] | [((469, 521), 'aioeos.EosAccount', 'EosAccount', ([], {'name': '"""toecom111111"""', 'private_key': '"""<KEY>"""'}), "(name='toecom111111', private_key='<KEY>')\n", (479, 521), False, 'from aioeos import EosAccount, EosJsonRpc, EosTransaction\n'), ((748, 798), 'aioeos.EosJsonRpc', 'EosJsonRpc', ([], {'url': '"""http://... |
import numpy as np
import pandas as pd
import statsmodels.api as sm
from statsmodels.imputation.bayes_mi import BayesGaussMI, MI
from numpy.testing import assert_allclose
def test_pat():
x = np.asarray([[1, np.nan, 3], [np.nan, 2, np.nan], [3, np.nan, 0],
[np.nan, 1, np.nan], [3, 2, 1]])
... | [
"numpy.random.normal",
"numpy.abs",
"numpy.sqrt",
"numpy.testing.assert_allclose",
"numpy.asarray",
"numpy.random.seed",
"statsmodels.imputation.bayes_mi.MI",
"pandas.DataFrame",
"numpy.cov",
"statsmodels.imputation.bayes_mi.BayesGaussMI"
] | [((198, 299), 'numpy.asarray', 'np.asarray', (['[[1, np.nan, 3], [np.nan, 2, np.nan], [3, np.nan, 0], [np.nan, 1, np.nan],\n [3, 2, 1]]'], {}), '([[1, np.nan, 3], [np.nan, 2, np.nan], [3, np.nan, 0], [np.nan, 1,\n np.nan], [3, 2, 1]])\n', (208, 299), True, 'import numpy as np\n'), ((325, 340), 'statsmodels.imputa... |
import numpy as np
import h5py
import tensorflow as tf
# import keras
import os
import sys
import pickle
# We are going to try to do some residual netowrks
expr_name = sys.argv[0][:-3]
expr_no = '1'
save_dir = os.path.abspath(os.path.join(os.path.expanduser('~/fluoro/code/jupyt/vox_fluoro'), expr_name))
print(save_... | [
"tensorflow.keras.layers.Conv3D",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.AveragePooling2D",
"tensorflow.keras.layers.SpatialDropout3D",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.backend.square",
"os.path.expanduser",
"tensorf... | [((325, 361), 'os.makedirs', 'os.makedirs', (['save_dir'], {'exist_ok': '(True)'}), '(save_dir, exist_ok=True)\n', (336, 361), False, 'import os\n'), ((8976, 9048), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': 'vox_input_shape', 'name': '"""input_vox"""', 'dtype': '"""float32"""'}), "(shape=vox_input_shap... |
# Copyright 2016 <NAME>, alexggmatthews
#
# 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 wr... | [
"tensorflow.eye",
"tensorflow.shape",
"tensorflow.transpose",
"tensorflow.reduce_sum",
"numpy.log",
"tensorflow.sqrt",
"tensorflow.constant",
"tensorflow.matmul",
"tensorflow.square",
"tensorflow.expand_dims",
"tensorflow.cholesky",
"tensorflow.diag_part",
"tensorflow.log",
"tensorflow.mat... | [((2654, 2670), 'tensorflow.cholesky', 'tf.cholesky', (['Kuu'], {}), '(Kuu)\n', (2665, 2670), True, 'import tensorflow as tf\n'), ((2687, 2720), 'tensorflow.sqrt', 'tf.sqrt', (['self.likelihood.variance'], {}), '(self.likelihood.variance)\n', (2694, 2720), True, 'import tensorflow as tf\n'), ((2843, 2876), 'tensorflow.... |
# Copyright 2015-2016 Yelp 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 writin... | [
"re.match",
"paasta_tools.utils.timeout",
"paasta_tools.utils._run"
] | [((3054, 3190), 'paasta_tools.utils.timeout', 'timeout', ([], {'seconds': '(20)', 'error_message': '"""Timed out connecting to git server, is it reachable from where you are?"""', 'use_signals': '(False)'}), "(seconds=20, error_message=\n 'Timed out connecting to git server, is it reachable from where you are?',\n ... |
# -*- coding: utf-8 -*-
import logging
import os
import pytest
from datetime import datetime
from datetime import timedelta
from dateutil.parser import parse as dt
from dateutil.tz import tzutc
from unittest import mock
from elastalert.util import add_raw_postfix
from elastalert.util import build_es_conn_config
fro... | [
"unittest.mock.patch.dict",
"dateutil.tz.tzutc",
"elastalert.util.resolve_string",
"elastalert.util.dt_to_ts",
"elastalert.util.inc_ts",
"datetime.timedelta",
"unittest.mock.patch",
"elastalert.util.replace_dots_in_field_names",
"elastalert.util.lookup_es_key",
"datetime.datetime",
"elastalert.u... | [((10836, 12310), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['test_build_es_conn_config_param', "[('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', True),\n ('localhost', '', '', '', '', '', '', '', '', '', '', '', '', '', '',\n '', '', True), ('localhost', 9200, '', '', '', '', ''... |
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV
import json
import pickle
import numpy as np
import time
def get_data():
data_file = 'data/train.json'
with open(data_file, 'r') as f:
data = json.load(f)
print('Loaded Data')
X = []
Y = []
for key, values i... | [
"pickle.dump",
"numpy.argmax",
"json.load",
"time.time",
"sklearn.svm.SVC"
] | [((703, 714), 'time.time', 'time.time', ([], {}), '()\n', (712, 714), False, 'import time\n'), ((814, 825), 'time.time', 'time.time', ([], {}), '()\n', (823, 825), False, 'import time\n'), ((926, 948), 'numpy.argmax', 'np.argmax', (['predictions'], {}), '(predictions)\n', (935, 948), True, 'import numpy as np\n'), ((23... |
#!/usr/bin/env python
import webapp2
from bqloader import BQLoader
class MainHandler(webapp2.RequestHandler):
def get(self):
bq_loader = BQLoader()
bq_loader.create_table()
self.response.write('ok')
app = webapp2.WSGIApplication([
('/tasks/create_bq_table', MainHandler)
], debug=... | [
"bqloader.BQLoader",
"webapp2.WSGIApplication"
] | [((241, 319), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/tasks/create_bq_table', MainHandler)]"], {'debug': '(True)'}), "([('/tasks/create_bq_table', MainHandler)], debug=True)\n", (264, 319), False, 'import webapp2\n'), ((152, 162), 'bqloader.BQLoader', 'BQLoader', ([], {}), '()\n', (160, 162), False... |
# BSD 3-Clause License
#
# Copyright (c) 2019, Elasticsearch BV
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, t... | [
"mock.patch",
"mock.Mock",
"time.sleep",
"pytest.mark.parametrize",
"elasticapm.metrics.base_metrics.MetricsRegistry",
"tests.fixtures.TempStoreClient",
"multiprocessing.dummy.Pool"
] | [((2355, 2515), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""elasticapm_client"""', "[{'metrics_sets': 'tests.metrics.base_tests.DummyMetricSet',\n 'disable_metrics': 'a.*,*c'}]"], {'indirect': '(True)'}), "('elasticapm_client', [{'metrics_sets':\n 'tests.metrics.base_tests.DummyMetricSet', 'disabl... |
import argparse
import os
import logging
from seml.start import get_command_from_exp
from seml.database import get_collection
from seml.sources import load_sources_from_db
from seml.settings import SETTINGS
States = SETTINGS.STATES
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description=... | [
"logging.getLogger",
"logging.StreamHandler",
"os.listdir",
"argparse.ArgumentParser",
"logging.Formatter",
"seml.sources.load_sources_from_db",
"seml.database.get_collection",
"seml.start.get_command_from_exp"
] | [((275, 490), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Get the config and executable of the experiment with given ID and check whether it has been cancelled before its start."""', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(description=\n 'Get the config and executab... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | [
"logging.getLogger",
"django.utils.translation.ugettext_lazy",
"gcloud.utils.cmdb.get_business_host_topo",
"functools.partial",
"gcloud.utils.ip.get_ip_by_regex",
"pipeline_plugins.base.utils.inject.supplier_account_for_business"
] | [((1327, 1354), 'logging.getLogger', 'logging.getLogger', (['"""celery"""'], {}), "('celery')\n", (1344, 1354), False, 'import logging\n'), ((1426, 1441), 'django.utils.translation.ugettext_lazy', '_', (['"""配置平台(CMDB)"""'], {}), "('配置平台(CMDB)')\n", (1427, 1441), True, 'from django.utils.translation import ugettext_laz... |
import os
import sys
sys.path.append("../..")
sys.path.append("../../../")
import numpy as np
import torch
from yacs.config import CfgNode
from lib.config.config import pth, cfg
from lib.datasets.make_datasets import make_data_loader
from lib.evaluators.make_evaluator import make_evaluator
from lib.models.make_netwo... | [
"lib.evaluators.make_evaluator.make_evaluator",
"lib.utils.net_utils.load_network",
"os.path.join",
"lib.datasets.make_datasets.make_data_loader",
"yacs.config.CfgNode",
"sys.path.append",
"traceback.print_exc",
"lib.train.trainers.make_trainer.make_trainer",
"torch.cuda.empty_cache",
"lib.models.... | [((22, 46), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (37, 46), False, 'import sys\n'), ((47, 75), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('../../../')\n", (62, 75), False, 'import sys\n'), ((523, 784), 'lib.datasets.make_datasets.make_data_loader', 'make_dat... |
import json
import logging
import os
import boto3
STAGES = ['TEST', 'QA', 'PROD-EXTERNAL']
STAGE = os.getenv('STAGE', 'TEST')
DEPLOYMENT_REGION = os.getenv('AWS_DEPLOYMENT_REGION', 'us-west-2')
log_level = os.getenv('LOG_LEVEL', logging.ERROR)
logger = logging.getLogger(__name__)
logger.setLevel(log_level)
secrets_... | [
"logging.getLogger",
"json.loads",
"boto3.client",
"os.getenv",
"json.dumps"
] | [((102, 128), 'os.getenv', 'os.getenv', (['"""STAGE"""', '"""TEST"""'], {}), "('STAGE', 'TEST')\n", (111, 128), False, 'import os\n'), ((149, 196), 'os.getenv', 'os.getenv', (['"""AWS_DEPLOYMENT_REGION"""', '"""us-west-2"""'], {}), "('AWS_DEPLOYMENT_REGION', 'us-west-2')\n", (158, 196), False, 'import os\n'), ((209, 24... |
from IEventGenerator import (
IEventGenerator
)
from Side import (
SIDE
)
class ILimitOrderGenerator(IEventGenerator):
"""
Implements common methods used by all limit order event
generators
"""
def __init__(self, event_type, side, arrival_rate, tick, level):
IEventGenerator.__ini... | [
"IEventGenerator.IEventGenerator.__init__"
] | [((299, 367), 'IEventGenerator.IEventGenerator.__init__', 'IEventGenerator.__init__', (['self', 'event_type', 'side', 'arrival_rate', 'tick'], {}), '(self, event_type, side, arrival_rate, tick)\n', (323, 367), False, 'from IEventGenerator import IEventGenerator\n')] |
# PhonopyImporter/CASTEP.py
# ----------------
# Module Docstring
# ----------------
""" Contains routines for working with the CASTEP code. """
# -------
# Imports
# -------
import numpy as np
# ---------
# Functions
# ---------
def ReadPhonon(file_path):
"""
Parse the CASTEP .phonon file at file_path... | [
"numpy.array"
] | [((4617, 4646), 'numpy.array', 'np.array', (['v'], {'dtype': 'np.float64'}), '(v, dtype=np.float64)\n', (4625, 4646), True, 'import numpy as np\n'), ((4700, 4731), 'numpy.array', 'np.array', (['pos'], {'dtype': 'np.float64'}), '(pos, dtype=np.float64)\n', (4708, 4731), True, 'import numpy as np\n'), ((5088, 5117), 'num... |
# =============================================================================
# PROJECT CHRONO - http://projectchrono.org
#
# Copyright (c) 2014 projectchrono.org
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file at the top level of the distr... | [
"pychrono.sensor.ChFilterIMUAccess",
"pychrono.core.ChBoxShape",
"pychrono.core.SetChronoDataPath",
"pychrono.core.ChVectorD",
"pychrono.irrlicht.ChVisualSystemIrrlicht",
"pychrono.core.ChBody",
"pychrono.core.GetChronoDataFile",
"pychrono.core.ChLinkRevolute",
"pychrono.core.ChSystemNSC",
"pychro... | [((796, 838), 'pychrono.core.SetChronoDataPath', 'chrono.SetChronoDataPath', (['"""../../../data/"""'], {}), "('../../../data/')\n", (820, 838), True, 'import pychrono.core as chrono\n'), ((974, 994), 'pychrono.core.ChSystemNSC', 'chrono.ChSystemNSC', ([], {}), '()\n', (992, 994), True, 'import pychrono.core as chrono\... |
#!/usr/bin/python
"""Plot occupancy curves of each staple type."""
import argparse
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib import gridspec
import numpy as np
from matplotlibstyles import styles
from origamipy import plot
from origamipy import utility
def main():
args = parse_... | [
"origamipy.plot.read_expectations",
"argparse.ArgumentParser",
"numpy.max",
"matplotlib.gridspec.GridSpec",
"matplotlib.pyplot.figure",
"matplotlibstyles.styles.set_thin_style",
"numpy.min",
"matplotlibstyles.styles.darken_color",
"matplotlibstyles.styles.cm_to_inches",
"matplotlibstyles.styles.cr... | [((359, 426), 'matplotlib.gridspec.GridSpec', 'gridspec.GridSpec', (['(1)', '(2)', 'f'], {'width_ratios': '[10, 1]', 'height_ratios': '[1]'}), '(1, 2, f, width_ratios=[10, 1], height_ratios=[1])\n', (376, 426), False, 'from matplotlib import gridspec\n'), ((697, 720), 'matplotlibstyles.styles.set_thin_style', 'styles.s... |
#
# Copyright 2016 The BigDL 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 applicable law or agreed to in ... | [
"bigdl.orca.automl.model.base_pytorch_model.PytorchModelBuilder",
"json.dump",
"os.path.join",
"bigdl.chronos.autots.utils.recalculate_n_sampling",
"os.path.isdir",
"bigdl.orca.automl.model.base_keras_model.KerasModelBuilder",
"os.mkdir",
"json.load",
"torch.rand",
"bigdl.orca.automl.auto_estimato... | [((1752, 1805), 'bigdl.orca.automl.auto_estimator.AutoEstimator', 'AutoEstimator', (['model_builder'], {}), '(model_builder, **self._auto_est_config)\n', (1765, 1805), False, 'from bigdl.orca.automl.auto_estimator import AutoEstimator\n'), ((13094, 13153), 'os.path.join', 'os.path.join', (['checkpoint_path', 'self._DEF... |
#! /usr/bin/env python
"""Extract and plot channel long profiles.
Plotting functions to extract and plot channel long profiles.
Call all three functions in sequence from the main code.
The functions will return the long profile nodes, return distances upstream of
those nodes, and plot the long profiles, respectively.... | [
"six.moves.range",
"numpy.amin",
"numpy.where",
"matplotlib.pyplot.plot",
"numpy.argmax",
"numpy.argsort",
"numpy.array",
"warnings.warn"
] | [((4790, 4798), 'six.moves.range', 'range', (['(4)'], {}), '(4)\n', (4795, 4798), False, 'from six.moves import range\n'), ((977, 1029), 'warnings.warn', 'warnings.warn', (['"""matplotlib not found"""', 'ImportWarning'], {}), "('matplotlib not found', ImportWarning)\n", (990, 1029), False, 'import warnings\n'), ((2865,... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author:_defined
@Time: 2018/09/08 18:43
@Description: 基于微信搜狗的持续抓取指定公众号发布文章;这里需要注意有两种不同的验证码模式
"""
import time
from ..downloader import (
WechatAPI
)
from ..db import (
KeywordsOperate, SpiderStatusDao
)
from ..config import (
update_internal
)
from ..lo... | [
"time.sleep"
] | [((1300, 1327), 'time.sleep', 'time.sleep', (['update_internal'], {}), '(update_internal)\n', (1310, 1327), False, 'import time\n'), ((1109, 1124), 'time.sleep', 'time.sleep', (['(300)'], {}), '(300)\n', (1119, 1124), False, 'import time\n')] |
'''
We'll put utility functions here - timing decorators, exiting functions, and maths stuff are here atm.
<NAME>
28/10/2019
'''
#------------------------------------------------------------------
import time
from math import sqrt
import sys
from ast import literal_eval as lit
import random
from pathlib import Path
... | [
"util.message.message.timing.items",
"random.sample",
"util.message.message.logDebug",
"pickle.dump",
"pandas.read_csv",
"pathlib.Path",
"util.message.message.logTiming",
"pickle.load",
"ast.literal_eval",
"sys.exit",
"util.message.message.logError",
"time.time",
"pandas.to_datetime"
] | [((1266, 1276), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1274, 1276), False, 'import sys\n'), ((1551, 1578), 'pickle.dump', 'pkl.dump', (['save_this', 'output'], {}), '(save_this, output)\n', (1559, 1578), True, 'import pickle as pkl\n'), ((1667, 1685), 'pickle.load', 'pkl.load', (['pkl_file'], {}), '(pkl_file)\n', (... |
from builtins import object
import collections
import logging
logger = logging.getLogger(__name__)
class Database(object):
def __init__(self):
self._vm_models = {}
self._dpg_models = {}
self._supported_dvses = set()
self._physical_interfaces = collections.defaultdict(list)
... | [
"logging.getLogger",
"collections.defaultdict"
] | [((72, 99), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (89, 99), False, 'import logging\n'), ((283, 312), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (306, 312), False, 'import collections\n'), ((346, 375), 'collections.defaultdict', 'collections.... |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... | [
"collections.namedtuple",
"importlib.import_module",
"csv.writer",
"nnabla.clear_parameters",
"nnabla.initializer.NormalInitializer",
"nnabla.Variable",
"nnabla.context_scope",
"time.time"
] | [((822, 874), 'collections.namedtuple', 'namedtuple', (['"""Inspec"""', "['shape', 'init', 'need_grad']"], {}), "('Inspec', ['shape', 'init', 'need_grad'])\n", (832, 874), False, 'from collections import namedtuple, OrderedDict\n'), ((951, 1002), 'collections.namedtuple', 'namedtuple', (['"""Benchmark"""', "['mean_time... |
import transformers as trans
import torch
import pytorch_lightning as pl
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.models.auto.configuration_auto import AutoConfig
from transformers import AutoTokenizer
from openue.data.utils import get_labels_ner, get_labels_seq, OutputExample
from typing import... | [
"torch.nn.Dropout",
"torch.nn.CrossEntropyLoss",
"torch.max",
"torch.sum",
"transformers.AutoTokenizer.from_pretrained",
"torch.arange",
"openue.data.utils.get_labels_seq",
"torch.unsqueeze",
"transformers.BertModel",
"torch.sparse.torch.eye",
"torch.nn.BCEWithLogitsLoss",
"openue.data.utils.g... | [((520, 543), 'transformers.BertModel', 'trans.BertModel', (['config'], {}), '(config)\n', (535, 543), True, 'import transformers as trans\n'), ((583, 637), 'torch.nn.Linear', 'torch.nn.Linear', (['config.hidden_size', 'config.num_labels'], {}), '(config.hidden_size, config.num_labels)\n', (598, 637), False, 'import to... |
#!/usr/bin/env python3
"""Test running an enrichment using any annotation file format."""
from __future__ import print_function
__copyright__ = "Copyright (C) 2010-2019, <NAME>, <NAME>. All rights reserved."
import os
import itertools
from goatools.base import get_godag
from goatools.associations import dnld_annofil... | [
"goatools.associations.dnld_annofile",
"os.path.join",
"goatools.base.get_godag",
"goatools.gosubdag.gosubdag.GoSubDag",
"goatools.anno.factory.get_objanno",
"os.path.abspath",
"goatools.goea.go_enrichment_ns.GOEnrichmentStudyNS"
] | [((656, 714), 'goatools.base.get_godag', 'get_godag', (['"""go-basic.obo"""'], {'optional_attrs': "['relationship']"}), "('go-basic.obo', optional_attrs=['relationship'])\n", (665, 714), False, 'from goatools.base import get_godag\n'), ((1994, 2115), 'goatools.goea.go_enrichment_ns.GOEnrichmentStudyNS', 'GOEnrichmentSt... |
from datetime import timedelta
from django.apps import apps
from django.contrib.auth.models import User
from django.template import Context, Template
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from ..models import Category, Post, Tag
from ..templatetags.blog_ext... | [
"django.contrib.auth.models.User.objects.create_superuser",
"django.template.Template",
"django.utils.timezone.now",
"django.urls.reverse",
"datetime.timedelta",
"django.template.Context"
] | [((562, 654), 'django.contrib.auth.models.User.objects.create_superuser', 'User.objects.create_superuser', ([], {'username': '"""admin"""', 'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "(username='admin', email='<EMAIL>', password=\n '<PASSWORD>')\n", (591, 654), False, 'from django.contrib.auth.model... |
from flask import current_app, session
from log_viewer.controllers.exceptions import BadUserOrPasswordException
class SessionController:
"""
Class to control the user's session.
"""
def __init__(self):
self._db_user = current_app.config['USER']
self._db_psw = current_app.config['PASSW... | [
"log_viewer.controllers.exceptions.BadUserOrPasswordException"
] | [((1386, 1437), 'log_viewer.controllers.exceptions.BadUserOrPasswordException', 'BadUserOrPasswordException', (['"""Bad user or password."""'], {}), "('Bad user or password.')\n", (1412, 1437), False, 'from log_viewer.controllers.exceptions import BadUserOrPasswordException\n')] |
import cv2
import streamlit as st
def setup_parameters():
st.markdown(
"""
<style>
[data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
width: 350px;
}
[data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
width: 350px;
margin-left: -35... | [
"streamlit.sidebar.title",
"streamlit.markdown",
"streamlit.columns",
"streamlit.sidebar.text",
"streamlit.sidebar.video",
"streamlit.sidebar.markdown",
"streamlit.sidebar.slider",
"streamlit.sidebar.subheader",
"streamlit.sidebar.selectbox",
"streamlit.set_option",
"streamlit.title"
] | [((64, 377), 'streamlit.markdown', 'st.markdown', (['"""\n <style>\n [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {\n width: 350px;\n }\n [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {\n width: 350px;\n margin-left: -350px;\n }\n </style>... |
from pathlib import Path
from setuptools import setup
VERSION = "0.1.6"
def get_long_description():
readme_path = Path(__file__).parent / "README.md"
with open(readme_path.absolute(), mode="r", encoding="utf8") as fp:
return fp.read()
setup(
name="datasette-dashboards",
description="Datase... | [
"pathlib.Path"
] | [((122, 136), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (126, 136), False, 'from pathlib import Path\n')] |
# Copyright 2014 Red Hat, 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 agre... | [
"oslo_reports.views.text.process.ProcessView"
] | [((1154, 1178), 'oslo_reports.views.text.process.ProcessView', 'text_views.ProcessView', ([], {}), '()\n', (1176, 1178), True, 'import oslo_reports.views.text.process as text_views\n')] |
import datetime
import io
import lzma
import pickle
from mongoengine import signals
def now():
return datetime.datetime.now()
def to_pickle(obj):
buff = pickle.dumps(obj, protocol=pickle.HIGHEST_PROTOCOL)
cbuff = lzma.compress(buff, format=lzma.FORMAT_XZ)
return io.BytesIO(cbuff)
def from_pickle(... | [
"pickle.dumps",
"datetime.datetime.now",
"io.BytesIO",
"lzma.compress"
] | [((109, 132), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (130, 132), False, 'import datetime\n'), ((166, 217), 'pickle.dumps', 'pickle.dumps', (['obj'], {'protocol': 'pickle.HIGHEST_PROTOCOL'}), '(obj, protocol=pickle.HIGHEST_PROTOCOL)\n', (178, 217), False, 'import pickle\n'), ((230, 272), 'lz... |
# Generated by Django 3.1.5 on 2021-02-09 14:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('subjects', '0004_subject_classroom'),
]
operations = [
migrations.RemoveField(
model_name='subject',
name='classroom',
... | [
"django.db.migrations.RemoveField"
] | [((227, 289), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""subject"""', 'name': '"""classroom"""'}), "(model_name='subject', name='classroom')\n", (249, 289), False, 'from django.db import migrations\n')] |
import re
import time
import torch
from datetime import timedelta
import numpy as np
from numpy.core.arrayprint import printoptions
import pandas as pd
from config import logger, opt
from transformers import BertTokenizer
from torch.utils.data import Dataset
from pprint import pprint
pattern = re.compile(r'http[s]?://... | [
"numpy.ones",
"re.compile",
"torch.LongTensor",
"transformers.BertTokenizer.from_pretrained",
"numpy.asarray",
"config.logger.info",
"numpy.sum",
"re.sub",
"time.time"
] | [((296, 400), 're.compile', 're.compile', (['"""http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\\\(\\\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+"""'], {}), "(\n 'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\\\\(\\\\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+'\n )\n", (306, 400), False, 'import re\n'), ((454, 465), 'time.time', 'time.tim... |
'''OpenGL extension NVX.blend_equation_advanced_multi_draw_buffers
This module customises the behaviour of the
OpenGL.raw.GLES2.NVX.blend_equation_advanced_multi_draw_buffers to provide a more
Python-friendly API
Overview (from the spec)
This extension adds support for using advanced blend equations
in... | [
"OpenGL.extensions.hasGLExtension"
] | [((1386, 1428), 'OpenGL.extensions.hasGLExtension', 'extensions.hasGLExtension', (['_EXTENSION_NAME'], {}), '(_EXTENSION_NAME)\n', (1411, 1428), False, 'from OpenGL import extensions\n')] |
'''
Dataloader for DWARF
It load 4 frames and 3 grount truths:
left_t0 (png), right_t0 (png), left_t1(png), right_t1(png), disp_t0_gt(pfm),
disp_t01_gt(pfm), forward_flow_gt(pfm)
Author: <NAME>
Mail: <EMAIL>
'''
import tensorflow as tf
from main_utils.flow_utils import tf_load_flo
from main_utils.disp_utils impo... | [
"main_utils.disp_utils.tf_load_disparity_pfm",
"main_utils.flow_utils.tf_load_flo",
"tensorflow.variable_scope"
] | [((736, 768), 'tensorflow.variable_scope', 'tf.variable_scope', (['"""load_images"""'], {}), "('load_images')\n", (753, 768), True, 'import tensorflow as tf\n'), ((995, 1037), 'main_utils.disp_utils.tf_load_disparity_pfm', 'tf_load_disparity_pfm', (['self.image_paths[4]'], {}), '(self.image_paths[4])\n', (1016, 1037), ... |
import pytest
from keras.preprocessing import image
from PIL import Image
import numpy as np
import os
import shutil
import tempfile
class TestImage:
def setup_class(cls):
img_w = img_h = 20
rgb_images = []
gray_images = []
for n in range(8):
bias = np.... | [
"keras.preprocessing.image.img_to_array",
"numpy.random.rand",
"numpy.random.random",
"os.path.join",
"keras.preprocessing.image.ImageDataGenerator",
"pytest.main",
"tempfile.mkdtemp",
"numpy.vstack",
"pytest.raises",
"shutil.rmtree",
"keras.preprocessing.image.array_to_img",
"numpy.arange"
] | [((7334, 7357), 'pytest.main', 'pytest.main', (['[__file__]'], {}), '([__file__])\n', (7345, 7357), False, 'import pytest\n'), ((2301, 2492), 'keras.preprocessing.image.ImageDataGenerator', 'image.ImageDataGenerator', ([], {'featurewise_center': '(True)', 'samplewise_center': '(True)', 'featurewise_std_normalization': ... |
from datetime import date
from marstuff.bases import Object
from marstuff.utils import convert, Extras
class Manifest(Object):
def __init__(self, id=None, name=None, landing_date=None, launch_date=None, status=None, **extras):
self.id = convert(id, int)
self.name = convert(name, str)
self... | [
"marstuff.utils.convert"
] | [((252, 268), 'marstuff.utils.convert', 'convert', (['id', 'int'], {}), '(id, int)\n', (259, 268), False, 'from marstuff.utils import convert, Extras\n'), ((289, 307), 'marstuff.utils.convert', 'convert', (['name', 'str'], {}), '(name, str)\n', (296, 307), False, 'from marstuff.utils import convert, Extras\n'), ((336, ... |
import docking
def test_compute_simple_masking_from_int():
mask = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X'
val = 11
assert 73 == docking.apply_mask(val, mask)
val = 101
assert 101 == docking.apply_mask(val, mask)
val = 0
assert 64 == docking.apply_mask(val, mask)
def test_compute_init_p... | [
"docking.compute_init_2",
"docking.compute_addresses",
"docking.apply_mask",
"docking.compute_init"
] | [((142, 171), 'docking.apply_mask', 'docking.apply_mask', (['val', 'mask'], {}), '(val, mask)\n', (160, 171), False, 'import docking\n'), ((205, 234), 'docking.apply_mask', 'docking.apply_mask', (['val', 'mask'], {}), '(val, mask)\n', (223, 234), False, 'import docking\n'), ((265, 294), 'docking.apply_mask', 'docking.a... |
from django.db import models
from django.urls import reverse_lazy
from django.contrib.auth.models import User
from vulnman.models import VulnmanModel, VulnmanProjectModel
from apps.methodologies import constants
from apps.assets.models import ASSET_TYPES_CHOICES
TASK_STATUS_CHOICES = [
(0, "Open"),
(1, "Close... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((441, 473), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (457, 473), False, 'from django.db import models\n'), ((485, 517), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (501, 517), False, 'from django.d... |
from django.contrib import admin
from .models import Contact
# Register your models here.
class ContactAdmin(admin.ModelAdmin):
readonly_fields = ["first_name","last_name","email","message"]
admin.site.register(Contact,ContactAdmin) | [
"django.contrib.admin.site.register"
] | [((195, 237), 'django.contrib.admin.site.register', 'admin.site.register', (['Contact', 'ContactAdmin'], {}), '(Contact, ContactAdmin)\n', (214, 237), False, 'from django.contrib import admin\n')] |
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"ml_collections.ConfigDict"
] | [((982, 1021), 'ml_collections.ConfigDict', 'ml_collections.ConfigDict', (['self.patches'], {}), '(self.patches)\n', (1007, 1021), False, 'import ml_collections\n'), ((1434, 1473), 'ml_collections.ConfigDict', 'ml_collections.ConfigDict', (['self.patches'], {}), '(self.patches)\n', (1459, 1473), False, 'import ml_colle... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
"""
This is the interface for interacting with MyPlan.
https://wiki.cac.washington.edu/display/MyPlan/Plan+Resource+v1
"""
from uw_myplan.dao import MyPlan_DAO
from restclients_core.exceptions import DataFailureException
from uw_my... | [
"json.loads",
"uw_myplan.models.MyPlanCourseSection",
"uw_myplan.models.MyPlanCourse",
"uw_myplan.models.MyPlan",
"uw_myplan.dao.MyPlan_DAO",
"uw_myplan.models.MyPlanTerm"
] | [((469, 481), 'uw_myplan.dao.MyPlan_DAO', 'MyPlan_DAO', ([], {}), '()\n', (479, 481), False, 'from uw_myplan.dao import MyPlan_DAO\n'), ((718, 743), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (728, 743), False, 'import json\n'), ((756, 764), 'uw_myplan.models.MyPlan', 'MyPlan', ([], {}), ... |
from typing import TYPE_CHECKING
from chainer import functions as F, links as L
from chainer import reporter
if TYPE_CHECKING:
from typing import Optional, Tuple
from chainer import Variable
def calculate_continuous_value_loss(predicted: 'Variable', actual: 'Variable') -> 'Variable':
"""
Calculate l... | [
"chainer.functions.transpose",
"chainer.functions.expand_dims",
"chainer.functions.softmax_cross_entropy",
"chainer.functions.concat",
"chainer.functions.softmax",
"chainer.functions.split_axis",
"chainer.functions.mean",
"chainer.reporter.report",
"chainer.functions.gaussian_nll",
"chainer.functi... | [((556, 586), 'chainer.functions.separate', 'F.separate', (['predicted'], {'axis': '(-1)'}), '(predicted, axis=-1)\n', (566, 586), True, 'from chainer import functions as F, links as L\n'), ((598, 646), 'chainer.functions.gaussian_nll', 'F.gaussian_nll', (['actual', 'mean', 'scale'], {'reduce': '"""no"""'}), "(actual, ... |
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils.validation import check_is_fitted
from feature_engine.dataframe_checks import (
_is_dataframe,
_check_input_matches_training_df,
)
from feature_engine.variable_manipulation import _define_variables, _find_all_variable... | [
"sklearn.utils.validation.check_is_fitted",
"feature_engine.variable_manipulation._define_variables",
"feature_engine.dataframe_checks._is_dataframe",
"feature_engine.dataframe_checks._check_input_matches_training_df",
"feature_engine.variable_manipulation._find_all_variables"
] | [((1723, 1751), 'feature_engine.variable_manipulation._define_variables', '_define_variables', (['variables'], {}), '(variables)\n', (1740, 1751), False, 'from feature_engine.variable_manipulation import _define_variables, _find_all_variables\n'), ((2267, 2283), 'feature_engine.dataframe_checks._is_dataframe', '_is_dat... |
from floodsystem.geo import stations_within_radius
from floodsystem.stationdata import build_station_list
stations = build_station_list()
radius = 10
centre_coord = (52.2053, 0.1218)
stations_in_radius = stations_within_radius(stations, centre_coord, radius)
def test_list_types():
for station in stations_... | [
"floodsystem.stationdata.build_station_list",
"floodsystem.geo.stations_within_radius"
] | [((118, 138), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (136, 138), False, 'from floodsystem.stationdata import build_station_list\n'), ((208, 262), 'floodsystem.geo.stations_within_radius', 'stations_within_radius', (['stations', 'centre_coord', 'radius'], {}), '(stations, c... |
## Biomass, synthetic fuels and carbon management
#
#In this example we show how to manage different biomass stocks with different potentials and costs, carbon dioxide hydrogenation from biogas, direct air capture (DAC) and carbon capture and usage/sequestration/cycling (CCU/S/C).
#
#Demand for electricity and diesel t... | [
"pypsa.components.component_attrs.items",
"pypsa.Network"
] | [((2016, 2080), 'pypsa.Network', 'pypsa.Network', ([], {'override_component_attrs': 'override_component_attrs'}), '(override_component_attrs=override_component_attrs)\n', (2029, 2080), False, 'import pypsa\n'), ((1328, 1368), 'pypsa.components.component_attrs.items', 'pypsa.components.component_attrs.items', ([], {}), ... |
# 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
# distributed under t... | [
"debtcollector.removals.removed_module",
"yaml.load",
"yaml.dump"
] | [((594, 760), 'debtcollector.removals.removed_module', 'removals.removed_module', (['"""solumclient.common.yamlutils"""'], {'version': '"""3.0.0"""', 'removal_version': '"""4.0.0"""', 'message': '"""The solumclient.common.yamlutils will be removed"""'}), "('solumclient.common.yamlutils', version='3.0.0',\n removal_v... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Defines TestPackageApk to help run APK-based native tests."""
# pylint: disable=W0212
import itertools
import logging
import os
import posixpath
impo... | [
"pylib.android_commands.NewLineNormalizer",
"pylib.gtest.test_package.TestPackage.__init__",
"pylib.device.intent.Intent",
"time.sleep",
"pylib.pexpect.spawn",
"pylib.gtest.gtest_test_instance.ParseGTestListTests",
"pylib.constants.GetOutDirectory",
"pylib.gtest.local_device_gtest_run.PullAppFilesImpl... | [((894, 932), 'pylib.gtest.test_package.TestPackage.__init__', 'TestPackage.__init__', (['self', 'suite_name'], {}), '(self, suite_name)\n', (914, 932), False, 'from pylib.gtest.test_package import TestPackage\n'), ((2408, 2468), 'pylib.pexpect.spawn', 'pexpect.spawn', (['"""adb"""', 'args'], {'timeout': 'timeout', 'lo... |
"""
The ledger_data method retrieves contents of
the specified ledger. You can iterate through
several calls to retrieve the entire contents
of a single ledger version.
`See ledger data <https://xrpl.org/ledger_data.html>`_
"""
from dataclasses import dataclass, field
from typing import Any, Optional, Union
from xrpl.... | [
"dataclasses.dataclass",
"dataclasses.field"
] | [((454, 476), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (463, 476), False, 'from dataclasses import dataclass, field\n'), ((789, 841), 'dataclasses.field', 'field', ([], {'default': 'RequestMethod.LEDGER_DATA', 'init': '(False)'}), '(default=RequestMethod.LEDGER_DATA, init=Fal... |
from rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_builder import \
FlAssociatedFilesBuilder
from rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_reader import \
FlAssociatedFilesReader
from rec_to_nwb.processing.tools.beartype.beartype import beartype
cla... | [
"rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_builder.FlAssociatedFilesBuilder",
"rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_reader.FlAssociatedFilesReader"
] | [((530, 555), 'rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_reader.FlAssociatedFilesReader', 'FlAssociatedFilesReader', ([], {}), '()\n', (553, 555), False, 'from rec_to_nwb.processing.nwb.components.associated_files.fl_associated_files_reader import FlAssociatedFilesReader\n'), ((599, 625)... |
from __future__ import generator_stop
from fissix import fixer_base, pytree
from fissix.pgen2 import token
import libmodernize
class FixClassicDivision(fixer_base.BaseFix):
PATTERN = """
'/=' | '/'
"""
def start_tree(self, tree, name):
super().start_tree(tree, name)
self.skip = "div... | [
"libmodernize.add_future",
"fissix.pytree.Leaf"
] | [((510, 551), 'libmodernize.add_future', 'libmodernize.add_future', (['node', '"""division"""'], {}), "(node, 'division')\n", (533, 551), False, 'import libmodernize\n'), ((602, 658), 'fissix.pytree.Leaf', 'pytree.Leaf', (['token.DOUBLESLASH', '"""//"""'], {'prefix': 'node.prefix'}), "(token.DOUBLESLASH, '//', prefix=n... |
import torch.nn as nn
class MaskL1Loss(nn.Module):
"""
Loss from paper <Pose Guided Person Image Generation> Sec3.1 pose mask loss
"""
def __init__(self, ratio=1):
super(MaskL1Loss, self).__init__()
self.criterion = nn.L1Loss()
self.ratio = ratio
def forward(self, generat... | [
"torch.nn.L1Loss"
] | [((251, 262), 'torch.nn.L1Loss', 'nn.L1Loss', ([], {}), '()\n', (260, 262), True, 'import torch.nn as nn\n')] |
import cv2
import numpy as np
#Example -2 (bright) -11(dark)
exposure=-5
#Example -130 (dark) +130(bright)
brightness=0
#Example -130 (dark) +130(bright)
contrast=0
#Example 0 - 500
focus=0
#0 to N (camera index, 0 is the default OS main camera)
camera_id=0
live_feed=False
vid = cv2.VideoCapture(camera_id)
if n... | [
"cv2.imshow",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.waitKey"
] | [((288, 315), 'cv2.VideoCapture', 'cv2.VideoCapture', (['camera_id'], {}), '(camera_id)\n', (304, 315), False, 'import cv2\n'), ((402, 435), 'numpy.zeros', 'np.zeros', (['(200, 200, 3)', 'np.uint8'], {}), '((200, 200, 3), np.uint8)\n', (410, 435), True, 'import numpy as np\n'), ((2817, 2840), 'cv2.destroyAllWindows', '... |
import datetime
import pathlib
import re
import packaging.version
import requests
import tabulate
FILE_HEAD = r"""Plugins List
============
PyPI projects that match "pytest-\*" are considered plugins and are listed
automatically. Packages classified as inactive are excluded.
"""
DEVELOPMENT_STATUS_CLASSIFIERS = (
... | [
"tabulate.tabulate",
"pathlib.Path",
"requests.get",
"re.finditer",
"re.sub"
] | [((683, 722), 'requests.get', 'requests.get', (['"""https://pypi.org/simple"""'], {}), "('https://pypi.org/simple')\n", (695, 722), False, 'import requests\n'), ((740, 773), 're.finditer', 're.finditer', (['regex', 'response.text'], {}), '(regex, response.text)\n', (751, 773), False, 'import re\n'), ((2615, 2673), 'tab... |
# coding: utf-8
import os, sys, time, concurrent.futures
import pandas as pd
import numpy as np
import online_node2vec.evaluation.ndcg_computer as ndcgc
import online_node2vec.data.tennis_handler as th
import online_node2vec.data.n2v_embedding_handler as n2veh
output_folder = "../results/"
delta_time = 3600*6
# updat... | [
"os.path.exists",
"numpy.mean",
"os.makedirs",
"numpy.std",
"online_node2vec.evaluation.ndcg_computer.parallel_eval_ndcg",
"numpy.min",
"numpy.max",
"online_node2vec.data.tennis_handler.get_data_info",
"time.time",
"pandas.concat",
"online_node2vec.data.n2v_embedding_handler.load_n2v_features"
] | [((797, 899), 'online_node2vec.data.n2v_embedding_handler.load_n2v_features', 'n2veh.load_n2v_features', (['features_dir', 'delta_time', 'total_days', 'player_labels', 'eval_window'], {'sep': '""","""'}), "(features_dir, delta_time, total_days, player_labels,\n eval_window, sep=',')\n", (820, 899), True, 'import onl... |
# Copyright 2017 Google 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, s... | [
"torch.mul",
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"torch.LongTensor",
"torch.nn.init.orthogonal",
"torch.max",
"math.sqrt",
"torch.from_numpy",
"torch.nn.init.xavier_normal",
"torch.arange",
"torch.tanh",
"sling.myelin.lexical_encoder.LexicalEncoder",
"parser_state.ParserState",
"... | [((1727, 1756), 'torch.from_numpy', 'torch.from_numpy', (['numpy_array'], {}), '(numpy_array)\n', (1743, 1756), False, 'import torch\n'), ((2600, 2624), 'torch.mm', 'torch.mm', (['x', 'self.weight'], {}), '(x, self.weight)\n', (2608, 2624), False, 'import torch\n'), ((5181, 5201), 'torch.sigmoid', 'torch.sigmoid', (['i... |
import re
from ..exceptions import RouteConfigurationError
class PatternParser:
PARAM_REGEX = re.compile(b'<.*?>')
DYNAMIC_CHARS = bytearray(b'*?.[]()')
CAST = {
str: lambda x: x.decode('utf-8'),
int: lambda x: int(x),
float: lambda x: float(x)
}
@classmethod
def val... | [
"re.compile"
] | [((101, 121), 're.compile', 're.compile', (["b'<.*?>'"], {}), "(b'<.*?>')\n", (111, 121), False, 'import re\n'), ((1325, 1348), 're.compile', 're.compile', (['new_pattern'], {}), '(new_pattern)\n', (1335, 1348), False, 'import re\n')] |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | [
"aria.modeling.models.aria_declarative_base.metadata.remove",
"tests.mock.models.create_service",
"aria.storage.ModelStorage",
"tests.modeling.MockModel",
"pytest.raises",
"aria.application_model_storage",
"pytest.fixture",
"tests.mock.models.create_service_template",
"sqlalchemy.Column",
"tests.s... | [((1407, 1451), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""', 'autouse': '(True)'}), "(scope='module', autouse=True)\n", (1421, 1451), False, 'import pytest\n'), ((1147, 1246), 'aria.storage.ModelStorage', 'ModelStorage', (['sql_mapi.SQLAlchemyModelAPI'], {'initiator': 'tests_storage.init_inmemory_... |
# Copyright (c) 2017 Sony Corporation. 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 applicabl... | [
"nnabla.logger.logger.critical",
"itertools.chain.from_iterable",
"nnabla.logger.logger.debug"
] | [((710, 747), 'nnabla.logger.logger.critical', 'logger.critical', (['"""Network traceback:"""'], {}), "('Network traceback:')\n", (725, 747), False, 'from nnabla.logger import logger\n'), ((9883, 9906), 'nnabla.logger.logger.debug', 'logger.debug', (['func.name'], {}), '(func.name)\n', (9895, 9906), False, 'from nnabla... |
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
import gensim.downloader as api
import re
from sklearn.neighbors import KNeighborsClassifier
from sklearn import preprocessing
class process_txt:
def __init__(self):
print("Loading pre-trained Word2Vec model...")
... | [
"numpy.mean",
"sklearn.preprocessing.LabelEncoder",
"numpy.unique",
"sklearn.neighbors.KNeighborsClassifier",
"gensim.downloader.load",
"numpy.array",
"numpy.zeros",
"re.sub"
] | [((341, 377), 'gensim.downloader.load', 'api.load', (['"""word2vec-google-news-300"""'], {}), "('word2vec-google-news-300')\n", (349, 377), True, 'import gensim.downloader as api\n'), ((396, 424), 'sklearn.preprocessing.LabelEncoder', 'preprocessing.LabelEncoder', ([], {}), '()\n', (422, 424), False, 'from sklearn impo... |
from __future__ import print_function
import argparse
import os
from keras import callbacks, optimizers
from keras.utils import plot_model
from data import load_data
from learning_rate import create_lr_schedule
from loss import dice_coef_loss, dice_coef, recall, precision
from nets.MobileUNet import MobileUNet
check... | [
"nets.MobileUNet.MobileUNet",
"os.path.exists",
"keras.callbacks.CSVLogger",
"keras.callbacks.ModelCheckpoint",
"data.load_data",
"argparse.ArgumentParser",
"learning_rate.create_lr_schedule",
"os.makedirs",
"keras.callbacks.TensorBoard",
"keras.optimizers.SGD"
] | [((641, 671), 'data.load_data', 'load_data', (['img_file', 'mask_file'], {}), '(img_file, mask_file)\n', (650, 671), False, 'from data import load_data\n'), ((791, 868), 'nets.MobileUNet.MobileUNet', 'MobileUNet', ([], {'input_shape': '(img_height, img_width, 4)', 'alpha': '(0.75)', 'alpha_up': '(0.25)'}), '(input_shap... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2014-2016 pocsuite developers (https://seebug.org)
See the file 'docs/COPYING' for copying permission
"""
import sys
from pocsuite_cli import pcsInit
from .lib.core.common import banner
from .lib.core.common import dataToStdout
from .lib.core.settings im... | [
"pocsuite_cli.pcsInit",
"sys.exit"
] | [((850, 870), 'pocsuite_cli.pcsInit', 'pcsInit', (['PCS_OPTIONS'], {}), '(PCS_OPTIONS)\n', (857, 870), False, 'from pocsuite_cli import pcsInit\n'), ((574, 585), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (582, 585), False, 'import sys\n')] |
import torch
import numpy as np
def fit(train_loader, val_loader, model, loss_fn, optimizer, scheduler, n_epochs, cuda, log_interval, metrics=[],
start_epoch=0):
"""
Loaders, model, loss function and metrics should work together for a given task,
i.e. The model should be able to process data outpu... | [
"torch.no_grad",
"numpy.mean"
] | [((3527, 3542), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3540, 3542), False, 'import torch\n'), ((3210, 3225), 'numpy.mean', 'np.mean', (['losses'], {}), '(losses)\n', (3217, 3225), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from school_api.utils import to_text, ObjectDict
from school_api.config import URL_PATH_LIST, CLASS_TIME
from school_api.client.base import BaseUserClient
from school_api.client.api.score import Score
from school_api.client.api.schedule i... | [
"school_api.client.api.user_info.UserInfo",
"school_api.session.memorystorage.MemoryStorage",
"school_api.client.utils.ApiPermissions",
"school_api.utils.to_text",
"school_api.client.api.schedule.Schedule",
"school_api.client.utils.get_time_list",
"school_api.utils.ObjectDict",
"school_api.client.api.... | [((2307, 2314), 'school_api.client.api.score.Score', 'Score', ([], {}), '()\n', (2312, 2314), False, 'from school_api.client.api.score import Score\n'), ((2326, 2336), 'school_api.client.api.user_info.UserInfo', 'UserInfo', ([], {}), '()\n', (2334, 2336), False, 'from school_api.client.api.user_info import UserInfo\n')... |
import math
import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as F
from .encdec_attention_func import encdec_attn_func
import onmt
class EncdecMultiheadAttn(nn.Module):
"""Multi-headed encoder-decoder attention.
See "Attention Is All You Need" for more details.
""... | [
"torch.Tensor",
"math.sqrt",
"torch.nn.functional.dropout",
"torch.tensor",
"torch.nn.Linear",
"torch.no_grad",
"torch.nn.init.uniform_",
"torch.nn.functional.softmax",
"torch.nn.init.normal_"
] | [((833, 867), 'torch.Tensor', 'torch.Tensor', (['embed_dim', 'embed_dim'], {}), '(embed_dim, embed_dim)\n', (845, 867), False, 'import torch\n'), ((912, 950), 'torch.Tensor', 'torch.Tensor', (['(2 * embed_dim)', 'embed_dim'], {}), '(2 * embed_dim, embed_dim)\n', (924, 950), False, 'import torch\n'), ((993, 1027), 'torc... |
import tensorflow as tf
l2 = tf.keras.regularizers.l2(0.01)
def rnn_layer(units):
return tf.keras.layers.LSTM(units, recurrent_activation="sigmoid", recurrent_initializer="glorot_uniform",
kernel_regularizer=l2, recurrent_regularizer=l2, dropout=0.5, recurrent_dropout=0.5,
... | [
"tensorflow.keras.layers.LSTM",
"tensorflow.keras.regularizers.l2"
] | [((30, 60), 'tensorflow.keras.regularizers.l2', 'tf.keras.regularizers.l2', (['(0.01)'], {}), '(0.01)\n', (54, 60), True, 'import tensorflow as tf\n'), ((96, 334), 'tensorflow.keras.layers.LSTM', 'tf.keras.layers.LSTM', (['units'], {'recurrent_activation': '"""sigmoid"""', 'recurrent_initializer': '"""glorot_uniform"""... |
"""23. Merge k Sorted Lists
https://leetcode.com/problems/merge-k-sorted-lists/
You are given an array of k linked-lists lists, each linked-list is sorted in
ascending order.
Merge all the linked-lists into one sorted linked-list and return it.
Example 1:
Input: lists = [[1,4,5],[1,3,4],[2,6]]
Output: [1,1,2,3,4,4,... | [
"heapq.heappop",
"collections.defaultdict",
"heapq.heapify",
"heapq.heappush",
"common.list_node.ListNode"
] | [((888, 899), 'common.list_node.ListNode', 'ListNode', (['(0)'], {}), '(0)\n', (896, 899), False, 'from common.list_node import ListNode\n'), ((913, 942), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (936, 942), False, 'import collections\n'), ((966, 986), 'heapq.heapify', 'heapq.he... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import numpy as np
from asdf.versioning import AsdfVersion
from astropy.modeling.bounding_box import ModelBoundingBox, CompoundBoundingBox
from astropy.modeling import mappings
from astropy.modeling import functional_models
from a... | [
"astropy.modeling.functional_models.Const2D",
"astropy.modeling.functional_models.Const1D",
"numpy.isfinite",
"astropy.modeling.bounding_box.CompoundBoundingBox.validate",
"asdf.versioning.AsdfVersion",
"astropy.modeling.mappings.UnitsMapping"
] | [((9308, 9348), 'astropy.modeling.mappings.UnitsMapping', 'mappings.UnitsMapping', (['mapping'], {}), '(mapping, **kwargs)\n', (9329, 9348), False, 'from astropy.modeling import mappings\n'), ((5651, 5671), 'asdf.versioning.AsdfVersion', 'AsdfVersion', (['"""1.4.0"""'], {}), "('1.4.0')\n", (5662, 5671), False, 'from as... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"apache_beam.typehints.schemas.named_tuple_to_schema",
"apache_beam.coders.coders.Coder.register_urn",
"array.array",
"apache_beam.coders.coders.FloatCoder",
"apache_beam.typehints.schemas.named_tuple_from_schema",
"apache_beam.coders.coders.TupleCoder",
"apache_beam.coders.coders.VarIntCoder",
"apach... | [((2768, 2833), 'apache_beam.coders.coders.Coder.register_urn', 'Coder.register_urn', (['common_urns.coders.ROW.urn', 'schema_pb2.Schema'], {}), '(common_urns.coders.ROW.urn, schema_pb2.Schema)\n', (2786, 2833), False, 'from apache_beam.coders.coders import Coder\n'), ((2345, 2381), 'apache_beam.typehints.schemas.named... |
# -*- coding: utf-8 -*-
"""
Conversion between Dialog-2010 (http://ru-eval.ru/) and aot.ru tags.
Dialog-2010 tags are less detailed than aot tags so aot -> dialog2010
conversion discards information.
"""
from __future__ import absolute_import, unicode_literals
import itertools
from russian_tagsets import converters
fr... | [
"itertools.chain",
"russian_tagsets.utils.invert_mapping",
"russian_tagsets.converters.add",
"russian_tagsets.aot.split_tag"
] | [((1806, 1834), 'russian_tagsets.utils.invert_mapping', 'invert_mapping', (['GRAMINFO_MAP'], {}), '(GRAMINFO_MAP)\n', (1820, 1834), False, 'from russian_tagsets.utils import invert_mapping\n'), ((2803, 2846), 'russian_tagsets.converters.add', 'converters.add', (['"""dialog2010"""', '"""aot"""', 'to_aot'], {}), "('dialo... |
import logging
from django.conf import settings
from django.contrib import auth
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseRedirect, HttpResponseServerError
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_exe... | [
"logging.getLogger",
"django.http.HttpResponseRedirect",
"django.core.exceptions.PermissionDenied",
"onelogin.saml2.utils.OneLogin_Saml2_Utils.get_self_url",
"django.http.HttpResponse",
"django.contrib.auth.login",
"django.conf.settings.ONELOGIN_SAML_SETTINGS.get_sp_metadata",
"django.conf.settings.ON... | [((440, 472), 'logging.getLogger', 'logging.getLogger', (['"""django_saml"""'], {}), "('django_saml')\n", (457, 472), False, 'import logging\n'), ((1455, 1525), 'onelogin.saml2.auth.OneLogin_Saml2_Auth', 'OneLogin_Saml2_Auth', (['req'], {'old_settings': 'settings.ONELOGIN_SAML_SETTINGS'}), '(req, old_settings=settings.... |
# pylint: disable=no-self-use,invalid-name
from allennlp.common.testing import ModelTestCase
from allennlp.data.dataset import Batch
class TestBidirectionalLanguageModelTokenEmbedder(ModelTestCase):
def setUp(self):
super().setUp()
self.set_up_model(self.FIXTURES_ROOT / 'bidirectional_lm' / 'chara... | [
"allennlp.data.dataset.Batch"
] | [((682, 703), 'allennlp.data.dataset.Batch', 'Batch', (['self.instances'], {}), '(self.instances)\n', (687, 703), False, 'from allennlp.data.dataset import Batch\n')] |
import numpy as np
# import cupy as np
# def softmax_cross_entropy(x, y):
# ''' 对输入先进行 softmax 操作后再使用交叉熵求损失 '''
# # softmax forward
# x = x - np.max(x)
# out = np.exp(x) / np.reshape(np.sum(np.exp(x), 1), (x.shape[0], 1))
# loss, dout = cross_entropy(out, y)
# diag = np.zeros((dout.shape[0],do... | [
"numpy.clip",
"numpy.ones_like",
"numpy.log",
"numpy.sum",
"numpy.maximum",
"numpy.zeros_like",
"numpy.arange"
] | [((1177, 1200), 'numpy.clip', 'np.clip', (['pred', '(1e-10)', '(1)'], {}), '(pred, 1e-10, 1)\n', (1184, 1200), True, 'import numpy as np\n'), ((1318, 1337), 'numpy.zeros_like', 'np.zeros_like', (['pred'], {}), '(pred)\n', (1331, 1337), True, 'import numpy as np\n'), ((1905, 1940), 'numpy.maximum', 'np.maximum', (['(0)'... |
"""Basic pipette data state and store."""
from dataclasses import dataclass
from typing import Dict, List, Mapping, Optional, Tuple
from typing_extensions import final
from opentrons_shared_data.pipette.dev_types import PipetteName
from opentrons.hardware_control.dev_types import PipetteDict
from opentrons.types impor... | [
"dataclasses.dataclass"
] | [((454, 476), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (463, 476), False, 'from dataclasses import dataclass\n'), ((588, 610), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (597, 610), False, 'from dataclasses import dataclass\n')] |
import random
class BayesNet:
def __init__(self):
self.variables = {}
self.letters = []
self.query = None
self.letters = None
def add_children(self, variable, parents):
# Adds variable to the children list of each parent
for parent in parents:
... | [
"random.uniform",
"random.choice"
] | [((1125, 1149), 'random.uniform', 'random.uniform', (['(0.0)', '(1.0)'], {}), '(0.0, 1.0)\n', (1139, 1149), False, 'import random\n'), ((4579, 4607), 'random.choice', 'random.choice', (['[True, False]'], {}), '([True, False])\n', (4592, 4607), False, 'import random\n')] |
import torchvision
from torchvision import models
import torch
class DeepLabV3Wrapper(torch.nn.Module):
def __init__(self, model):
super(DeepLabV3Wrapper, self).__init__()
self.model = model
def forward(self, input):
output = self.model(input)['out']
return output
def initiali... | [
"torchvision.models.segmentation.deeplabv3_resnet101",
"torchvision.models.segmentation.deeplabv3.DeepLabHead"
] | [((547, 633), 'torchvision.models.segmentation.deeplabv3_resnet101', 'models.segmentation.deeplabv3_resnet101', ([], {'pretrained': 'use_pretrained', 'progress': '(True)'}), '(pretrained=use_pretrained, progress\n =True)\n', (586, 633), False, 'from torchvision import models\n'), ((846, 918), 'torchvision.models.seg... |
"""
Helper views for the debug toolbar. These are dynamically installed when the
debug toolbar is displayed, and typically can do Bad Things, so hooking up these
views in any other way is generally not advised.
"""
import os
import django.views.static
from django.conf import settings
from django.db import connection
f... | [
"django.utils.simplejson.loads",
"django.template.loader.find_template_source",
"django.http.HttpResponseBadRequest",
"django.utils.hashcompat.sha_constructor",
"pygments.lexers.HtmlDjangoLexer",
"os.path.join",
"pygments.formatters.HtmlFormatter",
"os.path.dirname",
"django.db.connection.cursor",
... | [((7780, 7899), 'django.shortcuts.render_to_response', 'render_to_response', (['"""debug_toolbar/panels/template_source.html"""', "{'source': source, 'template_name': template_name}"], {}), "('debug_toolbar/panels/template_source.html', {'source':\n source, 'template_name': template_name})\n", (7798, 7899), False, '... |
"""This file contains code used in "Think Bayes",
by <NAME>, available from greenteapress.com
Copyright 2012 <NAME>
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import matplotlib.pyplot as pyplot
import thinkplot
import numpy
import csv
import random
import shelv... | [
"thinkbayes2.Suite.Update",
"numpy.log",
"thinkbayes2.PmfProbLess",
"numpy.array",
"shelve.open",
"thinkbayes2.Beta",
"thinkplot.Plot",
"thinkplot.Clf",
"numpy.mean",
"thinkbayes2.MakeMixture",
"thinkbayes2.Dirichlet",
"thinkplot.Cdf",
"thinkbayes2.BinomialCoef",
"numpy.max",
"numpy.exp"... | [((383, 429), 'warnings.simplefilter', 'warnings.simplefilter', (['"""error"""', 'RuntimeWarning'], {}), "('error', RuntimeWarning)\n", (404, 429), False, 'import warnings\n'), ((13979, 13998), 'thinkbayes2.Joint', 'thinkbayes2.Joint', ([], {}), '()\n', (13996, 13998), False, 'import thinkbayes2\n'), ((15402, 15416), '... |
#!/usr/bin/env python
"""
This is the interface for Dashboard information submission
It's meant to be run after every job, parsing information out
of the job and the report.
"""
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from xml.dom import minidom
... | [
"traceback.format_exc",
"logging.debug",
"WMCore.WMSpec.WMWorkload.getWorkloadFromTask",
"xml.dom.minidom.Document",
"os.getcwd",
"future.standard_library.install_aliases",
"socket.gethostname",
"logging.info",
"logging.error"
] | [((256, 290), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (288, 290), False, 'from future import standard_library\n'), ((1180, 1216), 'logging.debug', 'logging.debug', (["('contacting %s' % url)"], {}), "('contacting %s' % url)\n", (1193, 1216), False, 'import loggin... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((4697, 4722), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (4716, 4722), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |