code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
import numpy as np
from ._parametrize import optimizers_noSBOM
def objective_function(para):
return 1
@pytest.mark.parametrize(*optimizers_noSBOM)
def test_large_search_space_0(Optimizer):
search_space = {
"x1": np.arange(0, 1000000),
"x2": np.arange(0, 1000000),
"x3"... | [
"pytest.mark.parametrize",
"numpy.arange"
] | [((126, 169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['*optimizers_noSBOM'], {}), '(*optimizers_noSBOM)\n', (149, 169), False, 'import pytest\n'), ((479, 522), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['*optimizers_noSBOM'], {}), '(*optimizers_noSBOM)\n', (502, 522), False, 'import pytest\... |
# coding=utf-8
#
# pylint: disable = wildcard-import, unused-wildcard-import
# pylint: disable = missing-docstring, invalid-name, no-member
# pylint: disable = too-many-statements, unused-argument
"""
Copyright (c) 2019, <NAME>. All rights reserved.
license: BSD 3-Clause License, see LICENSE for more details.
"""
... | [
"zm.utils.toList",
"zm.waf.assist.unregisterUsedWafTaskKeys",
"zm.waf.assist.detectTaskFeatures",
"zm.waf.assist.isBuildConfFake",
"zm.waf.assist.handleTaskIncludesParam",
"copy.deepcopy",
"zm.waf.assist.distclean",
"zm.waf.assist.registerUsedWafTaskKeys",
"waflib.ConfigSet.ConfigSet",
"os.path.is... | [((1082, 1092), 'zm.autodict.AutoDict', 'AutoDict', ([], {}), '()\n', (1090, 1092), False, 'from zm.autodict import AutoDict\n'), ((1216, 1226), 'zm.autodict.AutoDict', 'AutoDict', ([], {}), '()\n', (1224, 1226), False, 'from zm.autodict import AutoDict\n'), ((1569, 1579), 'zm.autodict.AutoDict', 'AutoDict', ([], {}), ... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Note: this may not work with bpython, use python 2.6 or upper
# Author: <NAME>
# Contrib: <NAME>
from subprocess import getoutput
from multiprocessing import Process
from os import system
from time import sleep
def list_screens():
"""List all the existing screens and... | [
"os.system",
"subprocess.getoutput",
"time.sleep",
"multiprocessing.Process"
] | [((2072, 2131), 'os.system', 'system', (['(\'screen -x \' + self.name + \' -X eval "stuff \\\\003"\')'], {}), '(\'screen -x \' + self.name + \' -X eval "stuff \\\\003"\')\n', (2078, 2131), False, 'from os import system\n'), ((2256, 2301), 'os.system', 'system', (["('screen -x ' + self.name + ' -X quit')"], {}), "('scre... |
import io
import re
from collections import OrderedDict
from setuptools import setup, find_packages
with io.open('README.rst', 'rt', encoding='utf8') as f:
readme = f.read()
# Make sure that the version of the package always matches the version of the
# tool. The version of the __init__.py is updated with the ma... | [
"collections.OrderedDict",
"setuptools.find_packages",
"io.open"
] | [((107, 151), 'io.open', 'io.open', (['"""README.rst"""', '"""rt"""'], {'encoding': '"""utf8"""'}), "('README.rst', 'rt', encoding='utf8')\n", (114, 151), False, 'import io\n'), ((345, 398), 'io.open', 'io.open', (['"""juniper/__init__.py"""', '"""rt"""'], {'encoding': '"""utf8"""'}), "('juniper/__init__.py', 'rt', enc... |
import numpy as np
from torch.utils.data import SubsetRandomSampler
from torchvision.transforms import transforms
from torchvision.datasets import CIFAR10
from dlex.datasets.torch import Dataset
from dlex.torch import Batch
from dlex.torch.utils.ops_utils import maybe_cuda
class PytorchCIFAR10(Dataset):
... | [
"numpy.floor",
"torch.utils.data.SubsetRandomSampler",
"torchvision.transforms.transforms.Normalize",
"torchvision.transforms.transforms.ToTensor",
"dlex.torch.utils.ops_utils.maybe_cuda",
"numpy.random.shuffle"
] | [((958, 984), 'numpy.random.shuffle', 'np.random.shuffle', (['indices'], {}), '(indices)\n', (975, 984), True, 'import numpy as np\n'), ((1083, 1147), 'torch.utils.data.SubsetRandomSampler', 'SubsetRandomSampler', (["(train_idx if mode == 'train' else valid_idx)"], {}), "(train_idx if mode == 'train' else valid_idx)\n"... |
import os
from organizer.system_handler import SystemHandler
from organizer.logger import Logger
from organizer.files_factory import files_factory
FILES_DESTINATION = {
'images': ['.jpg', '.jpeg', '.png'],
'documents': ['.pdf', '.xlsx', '.docx', '.txt'],
}
FOLDER_TO_ORGANIZE = 'dir_for_testing'
handler = Sys... | [
"os.listdir",
"organizer.files_factory.files_factory",
"os.path.join",
"os.path.isfile",
"organizer.system_handler.SystemHandler",
"os.rmdir",
"organizer.logger.Logger",
"os.mkdir",
"os.remove"
] | [((317, 407), 'organizer.system_handler.SystemHandler', 'SystemHandler', ([], {'folder_to_organize': 'FOLDER_TO_ORGANIZE', 'files_handler': 'FILES_DESTINATION'}), '(folder_to_organize=FOLDER_TO_ORGANIZE, files_handler=\n FILES_DESTINATION)\n', (330, 407), False, 'from organizer.system_handler import SystemHandler\n'... |
from __future__ import print_function
import torch
if __name__ == '__main__':
# 데이터로부터 tensor를 직접 생성합니다.
x = torch.tensor([5.5, 3])
print(x)
# 또는 기존 tensor를 바탕으로 새로운 tensor를 만듭니다.
# 이들 메소드(method)는 사용자로부터 새로운 값을 제공받지 않은 한,
# 입력 tensor의 속성들(예. dtype)을 재사용합니다.
# new_* 메소드는 크기를 받습니다.
x =... | [
"torch.tensor",
"torch.randn_like"
] | [((118, 140), 'torch.tensor', 'torch.tensor', (['[5.5, 3]'], {}), '([5.5, 3])\n', (130, 140), False, 'import torch\n'), ((414, 452), 'torch.randn_like', 'torch.randn_like', (['x'], {'dtype': 'torch.float'}), '(x, dtype=torch.float)\n', (430, 452), False, 'import torch\n')] |
"""Functions to perform correlations"""
import numpy as np
from scipy.stats import norm
def cross_corr(a, b):
"""Cross-correlation
Calculate the cross correlation of array b against array a.
Args:
a (array): numpy vector. Reference against which cross
correlation is calculated.
... | [
"numpy.polyfit",
"numpy.conj",
"numpy.fft.fft",
"numpy.max",
"scipy.stats.norm.pdf",
"numpy.min",
"numpy.fft.ifft",
"numpy.arange"
] | [((688, 701), 'numpy.fft.fft', 'np.fft.fft', (['a'], {}), '(a)\n', (698, 701), True, 'import numpy as np\n'), ((712, 725), 'numpy.fft.fft', 'np.fft.fft', (['b'], {}), '(b)\n', (722, 725), True, 'import numpy as np\n'), ((771, 783), 'numpy.conj', 'np.conj', (['f_a'], {}), '(f_a)\n', (778, 783), True, 'import numpy as np... |
#*********************
#Created by <NAME>
#Date: 17.11.2021
#*********************
#!/usr/bin/env python3
import sys
import os
import string
args= sys.argv
if len(args)<2:
print("You must provide port number to be released")
exit()
command = f'fuser -k {args[1]}/tcp'
command1 = f'fuser -k {args[1]}/udp'
result= o... | [
"os.popen"
] | [((319, 336), 'os.popen', 'os.popen', (['command'], {}), '(command)\n', (327, 336), False, 'import os\n'), ((353, 371), 'os.popen', 'os.popen', (['command1'], {}), '(command1)\n', (361, 371), False, 'import os\n')] |
from django.conf.urls import patterns, url
import teams.views
urlpatterns = patterns('',
url(r'detail/(?P<team_id>\d+)/(?P<year>\d+)/$', teams.views.show_team_detail, name='show_team_detail'),
url(r'history/(?P<team_id>\d+)/$', teams.views.show_team_history, name='show_team_history'),
) | [
"django.conf.urls.url"
] | [((95, 203), 'django.conf.urls.url', 'url', (['"""detail/(?P<team_id>\\\\d+)/(?P<year>\\\\d+)/$"""', 'teams.views.show_team_detail'], {'name': '"""show_team_detail"""'}), "('detail/(?P<team_id>\\\\d+)/(?P<year>\\\\d+)/$', teams.views.\n show_team_detail, name='show_team_detail')\n", (98, 203), False, 'from django.co... |
import ray
from environment.rrt import RRTWrapper
from environment import utils
from environment import RealTimeEnv
from utils import (
parse_args,
load_config,
create_policies,
exit_handler
)
from environment import TaskLoader
import pickle
from signal import signal, SIGINT
from numpy import mean
from ... | [
"os.path.exists",
"numpy.mean",
"pickle.dump",
"environment.TaskLoader",
"distribute.Pool",
"tqdm.tqdm",
"utils.parse_args",
"environment.utils.get_observation_dimensions",
"utils.load_config",
"environment.RealTimeEnv",
"utils.create_policies",
"ray.remote",
"ray.init",
"environment.RealT... | [((432, 444), 'utils.parse_args', 'parse_args', ([], {}), '()\n', (442, 444), False, 'from utils import parse_args, load_config, create_policies, exit_handler\n'), ((478, 502), 'utils.load_config', 'load_config', (['args.config'], {}), '(args.config)\n', (489, 502), False, 'from utils import parse_args, load_config, cr... |
"""module for getting user invoices"""
from time import time
from base64 import b64decode as decode64
from sqlalchemy import or_, and_
from context import LND, GINO
from models import Invoice as DB_Invoice
import rpc_pb2 as ln
from helpers.mixins import LoggerMixin
from .abstract_user_method import AbstractMethod
cla... | [
"context.LND.stub.LookupInvoice",
"context.GINO.db.transaction",
"models.Invoice.timestamp.desc",
"time.time",
"sqlalchemy.and_"
] | [((1718, 1745), 'models.Invoice.timestamp.desc', 'DB_Invoice.timestamp.desc', ([], {}), '()\n', (1743, 1745), True, 'from models import Invoice as DB_Invoice\n'), ((1920, 1941), 'context.GINO.db.transaction', 'GINO.db.transaction', ([], {}), '()\n', (1939, 1941), False, 'from context import LND, GINO\n'), ((1124, 1130)... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import tempfile
import os
from pathlib import Path
import getpass
import shutil
import pytest
from warnings import warn
from testr.test_helper import on_head_network, has_sybase
from .. import report
user = getpass.getuser()
try:
import Ska.DBI
... | [
"os.path.exists",
"pathlib.Path",
"testr.test_helper.has_sybase",
"shutil.rmtree",
"tempfile.mkdtemp",
"os.unlink",
"testr.test_helper.on_head_network",
"pytest.mark.skipif",
"getpass.getuser",
"warnings.warn",
"tempfile.mkstemp"
] | [((274, 291), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (289, 291), False, 'import getpass\n'), ((823, 874), 'os.path.exists', 'os.path.exists', (["report.starcheck.FILES['data_root']"], {}), "(report.starcheck.FILES['data_root'])\n", (837, 874), False, 'import os\n'), ((878, 974), 'pytest.mark.skipif', '... |
from django.conf.urls import patterns, url
from reader import views
urlpatterns = patterns('',
url(r'^$', views.index, name='index'),
url(r'^page/(?P<pageno>\d+)$', views.index, name='index'),
url(r'^category/(?P<category>[a-zA-Z0-9% ]+)/type/(?P<type>[a-zA-Z0-9% ]+)/page/(?P<pageno>\d+)$', views.index, n... | [
"django.conf.urls.url"
] | [((101, 137), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (104, 137), False, 'from django.conf.urls import patterns, url\n'), ((144, 201), 'django.conf.urls.url', 'url', (['"""^page/(?P<pageno>\\\\d+)$"""', 'views.index'], {'name': '"""in... |
from __future__ import annotations
from neo3 import vm
from neo3.core import serialization
from typing import NamedTuple, Union, List, cast
class PlaceHolder(NamedTuple):
type: vm.StackItemType
count: int # type: ignore
class BinarySerializer:
@staticmethod
def serialize(stack_item: vm.StackItem, ... | [
"neo3.core.serialization.BinaryReader",
"neo3.vm.StructStackItem",
"neo3.vm.MapStackItem",
"neo3.core.serialization.BinaryWriter",
"neo3.vm.ArrayStackItem",
"neo3.vm.NullStackItem",
"typing.cast"
] | [((861, 889), 'neo3.core.serialization.BinaryWriter', 'serialization.BinaryWriter', ([], {}), '()\n', (887, 889), False, 'from neo3.core import serialization\n'), ((3366, 3398), 'neo3.core.serialization.BinaryReader', 'serialization.BinaryReader', (['data'], {}), '(data)\n', (3392, 3398), False, 'from neo3.core import ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 3 17:50:16 2021
@author: pedrofRodenas
"""
import os
import tensorflow as tf
AUTOTUNE = tf.data.experimental.AUTOTUNE
class TFRecordsGenerator():
def __init__(self, tfrecords_dir):
# List all *.tfrecord files for the se... | [
"tensorflow.data.TFRecordDataset",
"tensorflow.io.decode_image",
"tensorflow.data.Options",
"os.path.join",
"tensorflow.data.Dataset.list_files",
"tensorflow.io.FixedLenFeature",
"os.path.basename",
"tensorflow.io.parse_example"
] | [((351, 389), 'os.path.join', 'os.path.join', (['tfrecords_dir', '"""*.tfrec"""'], {}), "(tfrecords_dir, '*.tfrec')\n", (363, 389), False, 'import os\n'), ((409, 444), 'tensorflow.data.Dataset.list_files', 'tf.data.Dataset.list_files', (['pattern'], {}), '(pattern)\n', (435, 444), True, 'import tensorflow as tf\n'), ((... |
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"tensorflow_model_analysis.eval_saved_model.example_trainers.fixed_prediction_estimator.simple_fixed_prediction_estimator",
"tensorflow_model_analysis.eval_saved_model.example_trainers.fixed_prediction_estimator_extra_fields.simple_fixed_prediction_estimator_extra_fields",
"tensorflow_model_analysis.api.impl.ev... | [((14448, 14462), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (14460, 14462), True, 'import tensorflow as tf\n'), ((3586, 3656), 'tensorflow_model_analysis.eval_saved_model.example_trainers.linear_classifier.simple_linear_classifier', 'linear_classifier.simple_linear_classifier', (['None', 'temp_eval_expo... |
# -*- coding: utf-8 -*-
import numpy as np
import binarybrain as bb
import binarybrain.core as core
# ----- LUT Layer -----
def make_verilog_lut_layers(module_name: str, net, device=""):
layers = bb.get_model_list(net, flatten=True)
core_layers = []
for layer in layers:
core_layers.append(... | [
"numpy.tile",
"binarybrain.core.make_verilog_lut_cnv_layers",
"binarybrain.get_model_list_for_rtl",
"numpy.stack",
"numpy.array",
"binarybrain.get_model_list",
"binarybrain.core.make_verilog_lut_layers"
] | [((210, 246), 'binarybrain.get_model_list', 'bb.get_model_list', (['net'], {'flatten': '(True)'}), '(net, flatten=True)\n', (227, 246), True, 'import binarybrain as bb\n'), ((349, 411), 'binarybrain.core.make_verilog_lut_layers', 'core.make_verilog_lut_layers', (['module_name', 'core_layers', 'device'], {}), '(module_n... |
""" Guesses randomly """
# 10.0% accuracy
def train(x_data, y_data, classes):
""" trains the algorithm """
_ = x_data
_ = y_data
return classes
def classify(parameters, data):
""" tests the algorithm """
import random
_ = data
classes = parameters
return random.choice(classes)
| [
"random.choice"
] | [((295, 317), 'random.choice', 'random.choice', (['classes'], {}), '(classes)\n', (308, 317), False, 'import random\n')] |
import pymongo
from database.karma_leveled import KarmaLeveled
if __name__ == '__main__':
mongoClient = pymongo.MongoClient("localhost", 27017)
db = KarmaLeveled(mongoClient)
db.listItems() | [
"pymongo.MongoClient",
"database.karma_leveled.KarmaLeveled"
] | [((109, 148), 'pymongo.MongoClient', 'pymongo.MongoClient', (['"""localhost"""', '(27017)'], {}), "('localhost', 27017)\n", (128, 148), False, 'import pymongo\n'), ((158, 183), 'database.karma_leveled.KarmaLeveled', 'KarmaLeveled', (['mongoClient'], {}), '(mongoClient)\n', (170, 183), False, 'from database.karma_levele... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import configparser
import argparse
import visdom
import tqdm
from os import path
import numpy as np
from tabulate import tabulate
from torchvision import datasets, transforms, models
from torchlib.dataloader import PPPP
from... | [
"numpy.log10",
"torchlib.utils.Arguments",
"configparser.ConfigParser",
"torch.nn.CrossEntropyLoss",
"torchlib.models.vgg16",
"torch.cuda.is_available",
"torch.sum",
"visdom.Visdom",
"syft.VirtualWorker",
"argparse.ArgumentParser",
"numpy.asarray",
"torchvision.transforms.ToTensor",
"torchli... | [((507, 532), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (530, 532), False, 'import argparse\n'), ((1559, 1586), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1584, 1586), False, 'import configparser\n'), ((1598, 1626), 'os.path.isfile', 'path.isfile', (['cmd_... |
from pymongo import MongoClient
from influxdb import InfluxDBClient
from bson.son import SON
import json
class API(object):
#Mongo configuration
mongo_uri = "mongodb+srv://demo:<EMAIL>/test?retryWrites=true"
client = MongoClient(mongo_uri)
db = client.atractions
collectionData = db.places
#Influxdb configuratio... | [
"pymongo.MongoClient",
"json.loads",
"json.dumps",
"influxdb.InfluxDBClient"
] | [((221, 243), 'pymongo.MongoClient', 'MongoClient', (['mongo_uri'], {}), '(mongo_uri)\n', (232, 243), False, 'from pymongo import MongoClient\n'), ((332, 395), 'influxdb.InfluxDBClient', 'InfluxDBClient', ([], {'host': '"""influxdb"""', 'port': '(8086)', 'database': '"""pfprueba"""'}), "(host='influxdb', port=8086, dat... |
# Combines all libriTTS WAV->text mappings into a single file
import os
import random
import audio2numpy
import torch
from scipy.io import wavfile
from tqdm import tqdm
from utils.audio_resampler import AudioResampler
def secs_to_frames(secs, sr):
return int(secs*sr)
def get_audio_clip(audio, sr, start, end):... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"utils.audio_resampler.AudioResampler",
"tqdm.tqdm",
"os.path.join",
"torch.tensor",
"os.path.isdir",
"os.path.basename",
"random.random"
] | [((2451, 2489), 'os.makedirs', 'os.makedirs', (['output_dir'], {'exist_ok': '(True)'}), '(output_dir, exist_ok=True)\n', (2462, 2489), False, 'import os\n'), ((2514, 2536), 'os.listdir', 'os.listdir', (['libri_root'], {}), '(libri_root)\n', (2524, 2536), False, 'import os\n'), ((2573, 2586), 'tqdm.tqdm', 'tqdm', (['rea... |
# Copyright 2014 Blue Box Group, 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 requi... | [
"neutronclient.tests.unit.test_cli20.end_url",
"neutronclient.tests.unit.test_cli20.MyResp",
"neutronclient.tests.unit.test_cli20.MyApp",
"mox3.mox.ContainsKeyValue"
] | [((1089, 1117), 'neutronclient.tests.unit.test_cli20.MyApp', 'test_cli20.MyApp', (['sys.stdout'], {}), '(sys.stdout)\n', (1105, 1117), False, 'from neutronclient.tests.unit import test_cli20\n'), ((1770, 1798), 'neutronclient.tests.unit.test_cli20.MyApp', 'test_cli20.MyApp', (['sys.stdout'], {}), '(sys.stdout)\n', (178... |
from __future__ import absolute_import, division, print_function
__project__ = "Electrical Pre-Conditioning of Convective Clouds"
__title__ = "Plotting Radiosonde Data"
__author__ = "<NAME>"
__email__ = "<EMAIL>"
__version__ = "1.14"
__date__ = "28/02/2019"
__status__ = "Stable"
__changelog__ = "Added in Case Study se... | [
"Gilly_Utilities.argcontiguous",
"pandas.read_csv",
"Gilly_Utilities.antinan",
"numpy.log",
"Gilly_Utilities.HuberRegression",
"Gilly_Utilities.fix_recarray",
"Gilly_Utilities.flatten",
"numpy.arctan2",
"sys.exit",
"numpy.sin",
"numpy.arange",
"urllib2.urlopen",
"Gilly_Utilities.broadcast",
... | [((863, 926), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/home/users/th863480/PhD/Global_Functions"""'], {}), "(0, '/home/users/th863480/PhD/Global_Functions')\n", (878, 926), False, 'import sys\n'), ((1360, 1381), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (1375, 1381), False, 'impor... |
import mmcv
import numpy as np
import pycocotools.mask as mask_util
import torch
import torch.nn as nn
import torch.nn.functional as F
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule
from mmdet.core import mask_target, force_fp32, auto_fp16
import matplotlib.pyplot as plt ... | [
"torch.nn.ReLU",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"numpy.round",
"torch.nn.init.kaiming_normal_",
"mmdet.core.auto_fp16",
"torch.nn.Conv2d",
"numpy.array",
"numpy.zeros",
"torch.nn.Upsample",
"torch.zeros_like",
"mmdet.core.mask_target",
"torch.nn.ConvTranspose2d",
"mmcv.i... | [((5944, 5955), 'mmdet.core.auto_fp16', 'auto_fp16', ([], {}), '()\n', (5953, 5955), False, 'from mmdet.core import mask_target, force_fp32, auto_fp16\n'), ((7749, 7784), 'mmdet.core.force_fp32', 'force_fp32', ([], {'apply_to': "('mask_pred',)"}), "(apply_to=('mask_pred',))\n", (7759, 7784), False, 'from mmdet.core imp... |
import inspect
import app
from tflib.mixins.loggable import LoggableMixin
class TestCase(object, LoggableMixin):
def setup(self):
self.log.info("======= START =======")
self.undo_stack = []
app.app.config['TESTING'] = True
self.app = app.app.test_client()
def teardown(self):... | [
"inspect.isclass",
"app.app.test_client"
] | [((274, 295), 'app.app.test_client', 'app.app.test_client', ([], {}), '()\n', (293, 295), False, 'import app\n'), ((585, 606), 'inspect.isclass', 'inspect.isclass', (['step'], {}), '(step)\n', (600, 606), False, 'import inspect\n')] |
#!/usr/bin/env python3
import numpy as np
import copy as cp
from tqdm import tqdm
import lib.metrics as metrics
import sklearn.model_selection as sk_modsel
import sklearn.metrics as sk_metrics
import sklearn.utils as sk_utils
def sk_learn_k_fold_cv(x, y, z, kf_reg, design_matrix, k_splits=4,
... | [
"numpy.mean",
"numpy.sqrt",
"numpy.asarray",
"sklearn.utils.resample",
"lib.metrics.R2",
"numpy.empty",
"sklearn.model_selection.KFold",
"numpy.var"
] | [((581, 615), 'sklearn.model_selection.KFold', 'sk_modsel.KFold', ([], {'n_splits': 'k_splits'}), '(n_splits=k_splits)\n', (596, 615), True, 'import sklearn.model_selection as sk_modsel\n'), ((1138, 1161), 'numpy.asarray', 'np.asarray', (['y_pred_list'], {}), '(y_pred_list)\n', (1148, 1161), True, 'import numpy as np\n... |
from bs4 import BeautifulSoup
# import BeautifulSoup
import requests
import json
from os import path
import os
import datetime
import time
import urllib
#pip3 install Beautifulsoup4
import nonebot
import requests
from aiocqhttp import MessageSegment
from jieba import posseg
from lxml import etree
from no... | [
"os.path.exists",
"nonebot.get_bot",
"requests.get",
"os.chdir",
"datetime.datetime.now",
"nonebot.on_command",
"bs4.BeautifulSoup",
"os.mkdir",
"asyncio.sleep",
"os.startfile",
"os.system"
] | [((806, 918), 'nonebot.on_command', 'on_command', (['"""get_top10_pixiv"""'], {'aliases': "('蓄水',)", 'permission': 'perm.SUPERUSER', 'only_to_me': '(False)', 'shell_like': '(True)'}), "('get_top10_pixiv', aliases=('蓄水',), permission=perm.SUPERUSER,\n only_to_me=False, shell_like=True)\n", (816, 918), False, 'from no... |
from bs4 import BeautifulSoup
import pandas as pd
import numpy as np
import requests
import time
pages = [10, 20, 30, 40, 50]
# Enter URL from Indeed website (should end with '=')
URL = input('Enter URL: ')
job_titles = []
company_name = []
locations = []
job_summary = []
sal = []
for page in pages:
source = r... | [
"pandas.DataFrame",
"requests.get",
"bs4.BeautifulSoup",
"time.sleep"
] | [((1476, 1611), 'pandas.DataFrame', 'pd.DataFrame', (["{'job_title': job_titles, 'company_name': company_name, 'location':\n locations, 'summary': job_summary, 'salary': sal}"], {}), "({'job_title': job_titles, 'company_name': company_name,\n 'location': locations, 'summary': job_summary, 'salary': sal})\n", (148... |
"""Connects Flask-Security datastore to RADIUS."""
import os
from itertools import cycle
from flask import current_app
from flask_security.datastore import SQLAlchemyUserDatastore
from flask_security.utils import config_value
from pyrad.client import Client
from pyrad.dictionary import Dictionary
from pyrad.packet imp... | [
"itertools.cycle",
"os.path.dirname",
"pyrad.dictionary.Dictionary",
"flask_security.utils.config_value",
"flask_security.datastore.SQLAlchemyUserDatastore.__init__"
] | [((627, 693), 'flask_security.datastore.SQLAlchemyUserDatastore.__init__', 'SQLAlchemyUserDatastore.__init__', (['self', 'db', 'user_model', 'role_model'], {}), '(self, db, user_model, role_model)\n', (659, 693), False, 'from flask_security.datastore import SQLAlchemyUserDatastore\n'), ((765, 814), 'flask_security.util... |
import torch
from torch import nn
from torch.utils import model_zoo
from torchvision import models
class OCRResNet18(nn.Module):
def __init__(self, n_out, pretrained=True):
super(OCRResNet18, self).__init__()
resnet18 = models.resnet18(pretrained=pretrained)
self.feature_extractor = nn.Seq... | [
"torch.nn.BatchNorm2d",
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"torch.nn.LeakyReLU",
"torch.nn.ModuleList",
"torch.nn.Dropout2d",
"torch.utils.model_zoo.load_url",
"torchvision.models.resnet18",
"torch.nn.DataParallel",
"torch.nn.Conv2d",
"torchvision.models.vgg19_bn",
"torchvision.models.resnet... | [((242, 280), 'torchvision.models.resnet18', 'models.resnet18', ([], {'pretrained': 'pretrained'}), '(pretrained=pretrained)\n', (257, 280), False, 'from torchvision import models\n'), ((1113, 1151), 'torchvision.models.resnet34', 'models.resnet34', ([], {'pretrained': 'pretrained'}), '(pretrained=pretrained)\n', (1128... |
from pathlib import Path
import json
from arcgis import mapping, features
from GitHub.HelperScripts import get_funcs
from other.my_secrets import MySecrets
def clone_folder(
source_folder,
target_folder,
source_gis,
target_gis,
copy_data=True,
search_existing_items=True,
ignore_item_type=N... | [
"arcgis.features.FeatureCollection.from_featureset",
"pathlib.Path",
"json.dumps",
"other.my_secrets.MySecrets.get_agol_gis",
"arcgis.mapping.WebMap",
"other.my_secrets.MySecrets.get_portal_gis",
"GitHub.HelperScripts.get_funcs.get_items_from_group",
"GitHub.HelperScripts.get_funcs.get_items_from_fold... | [((1270, 1361), 'GitHub.HelperScripts.get_funcs.get_items_from_group', 'get_funcs.get_items_from_group', (['source_gis_obj', 'source_group_id'], {'item_types': 'item_types'}), '(source_gis_obj, source_group_id, item_types=\n item_types)\n', (1300, 1361), False, 'from GitHub.HelperScripts import get_funcs\n'), ((4322... |
#!/usr/bin/env python
"""
Created on Fri Apr 15 15:00:12 2016
This script will be used to see if any changes will prevent the simulator from running.
@author: <NAME>
"""
from SimISR import Path
import scipy as sp
from SimISR.utilFunctions import readconfigfile,makeconfigfile
from SimISR.IonoContainer import IonoContain... | [
"scipy.ones",
"SimISR.utilFunctions.readconfigfile",
"argparse.ArgumentParser",
"scipy.arange",
"scipy.zeros",
"scipy.array",
"scipy.tile",
"scipy.any",
"SimISR.Path"
] | [((924, 946), 'SimISR.utilFunctions.readconfigfile', 'readconfigfile', (['defcon'], {}), '(defcon)\n', (938, 946), False, 'from SimISR.utilFunctions import readconfigfile, makeconfigfile\n'), ((1942, 2004), 'scipy.array', 'sp.array', (['[[100000000000.0, 1100.0], [100000000000.0, 2100.0]]'], {}), '([[100000000000.0, 11... |
# -*- coding: utf-8 -*-
import unittest
from cwr.parser.encoder.file import default_filename_encoder, \
old_filename_encoder
from cwr.file import FileTag
"""
CWR file name encoder tests.
The following cases are tested:
"""
__author__ = '<NAME>'
__license__ = 'MIT'
__status__ = 'Development'
class TestFileNam... | [
"cwr.parser.encoder.file.default_filename_encoder",
"cwr.file.FileTag",
"cwr.parser.encoder.file.old_filename_encoder"
] | [((497, 523), 'cwr.parser.encoder.file.default_filename_encoder', 'default_filename_encoder', ([], {}), '()\n', (521, 523), False, 'from cwr.parser.encoder.file import default_filename_encoder, old_filename_encoder\n'), ((2010, 2032), 'cwr.parser.encoder.file.old_filename_encoder', 'old_filename_encoder', ([], {}), '()... |
from flask import request, jsonify, Blueprint, current_app as app
from flask_jwt_extended import (
jwt_required,
get_jwt_identity,
get_jwt,
current_user
)
from bottle.models import User
from bottle.extensions import pwd_context, jwt
from bottle.auth.helpers import (
revoke_token,
revoke_refresh_tok... | [
"bottle.extensions.pwd_context.verify",
"flask_jwt_extended.get_jwt",
"flask.jsonify",
"bottle.auth.helpers.revoke_refresh_token",
"bottle.auth.helpers.revoke_token",
"flask.request.json.get",
"bottle.models.User.query.get",
"flask_jwt_extended.jwt_required",
"flask_jwt_extended.get_jwt_identity",
... | [((468, 515), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'url_prefix': '"""/auth"""'}), "('auth', __name__, url_prefix='/auth')\n", (477, 515), False, 'from flask import request, jsonify, Blueprint, current_app as app\n'), ((1262, 1288), 'flask_jwt_extended.jwt_required', 'jwt_required', ([], {'refre... |
import impedance as imp
import math
from sympy.physics import units as u
from sympy import sqrt, re, im, I
from constants import constants as c
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib as mpl
from helper_functions import indep_array
rc('text', usetex=True)
mpl.rcPar... | [
"impedance.impedance",
"helper_functions.indep_array",
"matplotlib.pyplot.savefig",
"matplotlib.rcParams.update",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.vlines",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sympy.sqrt",
"numpy.sqrt",
"sympy.re",
... | [((287, 310), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (289, 310), False, 'from matplotlib import rc\n'), ((311, 349), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (["{'font.size': 18}"], {}), "({'font.size': 18})\n", (330, 349), True, 'import matplotlib as mpl\n... |
import numpy as np
def get_int_tuple_from_string_pair(pair):
return tuple((int(x) for x in pair.split(',')))
def get_zeroed_field(vectors):
dimension_size = max(vectors.flat) + 1
return np.zeros((dimension_size, dimension_size), dtype=int)
def get_overlaps_count_from_field(field):
return len([x fo... | [
"numpy.array",
"numpy.zeros"
] | [((2046, 2063), 'numpy.array', 'np.array', (['vectors'], {}), '(vectors)\n', (2054, 2063), True, 'import numpy as np\n'), ((202, 255), 'numpy.zeros', 'np.zeros', (['(dimension_size, dimension_size)'], {'dtype': 'int'}), '((dimension_size, dimension_size), dtype=int)\n', (210, 255), True, 'import numpy as np\n')] |
import h5py
import sys
import logging
import ModuloGeneralReadOptions as MGRO
import ModuloMapsLonLat2Center
import ModuloMapsDraw
import ModuloMapsValidation
import os
from subprocess import call
import subprocess
import ModuloMaps as MM
import ModuloTimeSeriesPlot as MT
import inspect
try:
configFile = 'PythonFi... | [
"ModuloGeneralReadOptions.readOptions.readoptions",
"ModuloMaps.ModuloMapaDeCampos.Maps",
"inspect.currentframe",
"logging.shutdown",
"sys.exit",
"ModuloTimeSeriesPlot.ModuloTimeSeriesPlot.TimeSeries",
"logging.info"
] | [((1412, 1422), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1420, 1422), False, 'import sys\n'), ((676, 701), 'logging.info', 'logging.info', (['""": Started"""'], {}), "(': Started')\n", (688, 701), False, 'import logging\n'), ((718, 758), 'ModuloGeneralReadOptions.readOptions.readoptions', 'MGRO.readOptions.readoption... |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 15 22:28:37 2019
@author: maheshsoundar
"""
import pandas as pd
import random
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler
#class to scale data. Provide chunksize and type of scaler. Use the object of created class to cal... | [
"sklearn.preprocessing.StandardScaler",
"sklearn.preprocessing.MinMaxScaler",
"numpy.random.seed",
"random.seed"
] | [((685, 705), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (699, 705), True, 'import numpy as np\n'), ((715, 732), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (726, 732), False, 'import random\n'), ((504, 520), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n... |
from torchtext import data
from torchtext import datasets
# Testing SNLI
print("Run test on SNLI...")
TEXT = datasets.nli.ParsedTextField()
LABEL = data.LabelField()
TREE = datasets.nli.ShiftReduceField()
train, val, test = datasets.SNLI.splits(TEXT, LABEL, TREE)
print("Fields:", train.fields)
print("Number of examp... | [
"torchtext.datasets.SNLI.iters",
"torchtext.datasets.SNLI.splits",
"torchtext.datasets.nli.ParsedTextField",
"torchtext.data.LabelField",
"torchtext.datasets.MultiNLI.splits",
"torchtext.datasets.MultiNLI.iters",
"torchtext.data.Iterator.splits",
"torchtext.datasets.nli.ShiftReduceField"
] | [((110, 140), 'torchtext.datasets.nli.ParsedTextField', 'datasets.nli.ParsedTextField', ([], {}), '()\n', (138, 140), False, 'from torchtext import datasets\n'), ((149, 166), 'torchtext.data.LabelField', 'data.LabelField', ([], {}), '()\n', (164, 166), False, 'from torchtext import data\n'), ((174, 205), 'torchtext.dat... |
import numpy as np
import torchvision.transforms as T
from labels import *
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import random
def preprocess(images):
images = [img.convert('RGB').resize([400, 600]) for img in images]
return images
def get_transform(normalize = False)... | [
"matplotlib.pyplot.text",
"matplotlib.patches.Rectangle",
"random.randint",
"matplotlib.pyplot.show",
"numpy.argsort",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"torchvision.transforms.Normalize",
"matplotlib.pyplot.axis",
"torchvision.transform... | [((518, 546), 'torchvision.transforms.Compose', 'T.Compose', (['custom_transforms'], {}), '(custom_transforms)\n', (527, 546), True, 'import torchvision.transforms as T\n'), ((585, 612), 'numpy.array', 'np.array', (['bbox'], {'dtype': 'float'}), '(bbox, dtype=float)\n', (593, 612), True, 'import numpy as np\n'), ((2624... |
import csv
import logging.config
from typing import List, Optional
from pydantic import BaseModel
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
class Doorplate(BaseModel):
id: Optional[str]
roomnumber: str
description: str
personname: str
template: str
async def... | [
"csv.reader"
] | [((488, 520), 'csv.reader', 'csv.reader', (['lines'], {'delimiter': '""";"""'}), "(lines, delimiter=';')\n", (498, 520), False, 'import csv\n')] |
# -*- coding: utf-8 -*-
import re
import pandas as pd
# Identify the source text (F0)
src_file = '2701-0.txt'
# Import the text as list of lines
lines = open(src_file, 'r', encoding='utf-8').readlines()
# Trim the cruft we identified
lines = lines[340:21964]
# Convert the lines into one big line, pres... | [
"pandas.DataFrame",
"re.split"
] | [((411, 439), 're.split', 're.split', (['"""\\\\n\\\\n+"""', 'bigline'], {}), "('\\\\n\\\\n+', bigline)\n", (419, 439), False, 'import re\n'), ((902, 939), 'pandas.DataFrame', 'pd.DataFrame', (['paras'], {'columns': "['line']"}), "(paras, columns=['line'])\n", (914, 939), True, 'import pandas as pd\n'), ((543, 565), 'r... |
import rospy
from std_msgs.msg import Float64
from rospy import Subscriber
from common.architectural.Singleton import Singleton
class RAMSensor(metaclass=Singleton):
__ram_sub: Subscriber
__ram_percentage: float = 0.0
def __init__(self):
self.__ram_sub = rospy.Subscriber('/ram_usage', Float64, sel... | [
"rospy.Subscriber"
] | [((277, 339), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/ram_usage"""', 'Float64', 'self.__ram_usage_clbk'], {}), "('/ram_usage', Float64, self.__ram_usage_clbk)\n", (293, 339), False, 'import rospy\n')] |
from model.contact_info import ContactInfo
from random import randrange
def test_delete_some_contact(app):
if app.contact.count() == 0:
app.contact.create(ContactInfo(firstname="Alex", lastname='Ivanov'))
app.contact.create(ContactInfo(firstname="Sasha", lastname='Petrov'))
old_contacts = app.c... | [
"model.contact_info.ContactInfo"
] | [((168, 216), 'model.contact_info.ContactInfo', 'ContactInfo', ([], {'firstname': '"""Alex"""', 'lastname': '"""Ivanov"""'}), "(firstname='Alex', lastname='Ivanov')\n", (179, 216), False, 'from model.contact_info import ContactInfo\n'), ((245, 294), 'model.contact_info.ContactInfo', 'ContactInfo', ([], {'firstname': '"... |
# Generated by Django 3.1.12 on 2021-09-09 11:37
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cms', '0022_auto_20180620_1551'),
('common', '0004_wrapperpluginmodel'),
]
operations = [
migratio... | [
"django.db.models.OneToOneField",
"django.db.models.TextField"
] | [((428, 635), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'auto_created': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'parent_link': '(True)', 'primary_key': '(True)', 'related_name': '"""common_embedpluginmodel"""', 'serialize': '(False)', 'to': '"""cms.cmsplugin"""'}), "(auto_creat... |
"""
ARCHES - a program developed to inventory and manage immovable cultural heritage.
Copyright (C) 2013 <NAME> and World Monuments Fund
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either ... | [
"psycopg2.connect",
"django.core.management.call_command",
"os.path.join",
"os.path.isfile",
"django.apps.apps.get_app_config",
"django.conf.settings.CACHES.items",
"arches.management.commands.utils.get_yn_input"
] | [((4834, 4879), 'django.core.management.call_command', 'management.call_command', (['"""flush"""', '"""--noinput"""'], {}), "('flush', '--noinput')\n", (4857, 4879), False, 'from django.core import management\n'), ((4975, 5067), 'django.core.management.call_command', 'management.call_command', (['"""migrate"""'], {'fak... |
import sys
from Ziggeo import Ziggeo
if(len(sys.argv) < 3):
print ("Error\n")
print ("Usage: $>python _videos_index_duration.py YOUR_API_TOKEN YOUR_PRIVATE_KEY\n")
sys.exit()
api_token = sys.argv[1]
private_key = sys.argv[2]
total_duration = 0.0
count_duration = 0.0
ziggeo = Ziggeo(api_token, private_key)
def ind... | [
"Ziggeo.Ziggeo",
"sys.exit"
] | [((282, 312), 'Ziggeo.Ziggeo', 'Ziggeo', (['api_token', 'private_key'], {}), '(api_token, private_key)\n', (288, 312), False, 'from Ziggeo import Ziggeo\n'), ((169, 179), 'sys.exit', 'sys.exit', ([], {}), '()\n', (177, 179), False, 'import sys\n')] |
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
driver = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver")
products = []
prices = []
ratings = []
driver.get("https://www.pccomponentes.com/ratones")
content = driver.page_source
soup = BeautifulSoup(content)
for a in ... | [
"bs4.BeautifulSoup",
"selenium.webdriver.Chrome",
"pandas.DataFrame"
] | [((91, 149), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""/usr/lib/chromium-browser/chromedriver"""'], {}), "('/usr/lib/chromium-browser/chromedriver')\n", (107, 149), False, 'from selenium import webdriver\n'), ((288, 310), 'bs4.BeautifulSoup', 'BeautifulSoup', (['content'], {}), '(content)\n', (301, 310), F... |
import numpy as np
class NeuralNetwork:
def __init__(self, input_nodes, hidden_nodes, output_nodes, learning_rate,
weights_input_to_hidden=None, weights_hidden_to_output=None):
self.input_nodes = input_nodes
self.hidden_nodes = hidden_nodes
self.output_nodes = output_nodes
... | [
"numpy.dot",
"numpy.zeros",
"numpy.exp",
"numpy.random.normal"
] | [((1578, 1622), 'numpy.zeros', 'np.zeros', (['self.weights_input_to_hidden.shape'], {}), '(self.weights_input_to_hidden.shape)\n', (1586, 1622), True, 'import numpy as np\n'), ((1651, 1696), 'numpy.zeros', 'np.zeros', (['self.weights_hidden_to_output.shape'], {}), '(self.weights_hidden_to_output.shape)\n', (1659, 1696)... |
# Copyright 2015 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.
import re
from recipe_engine.types import freeze
class V8TestingVariants(object):
"""Immutable class to manage the testing variant passed to v8.
There... | [
"recipe_engine.types.freeze"
] | [((21332, 21366), 'recipe_engine.types.freeze', 'freeze', (["{'presubmit': V8Presubmit}"], {}), "({'presubmit': V8Presubmit})\n", (21338, 21366), False, 'from recipe_engine.types import freeze\n'), ((21389, 21418), 'recipe_engine.types.freeze', 'freeze', (["{'run-tests': V8Test}"], {}), "({'run-tests': V8Test})\n", (21... |
from sqlalchemy import (
Column,
String,
DateTime
)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import func
from spendy.db.utils import get_db_engine
Base = declarative_base()
class BankAccount(Base):
__tablename__ = 'bank_accounts'
id = Column(String(50), prima... | [
"sqlalchemy.DateTime",
"spendy.db.utils.get_db_engine",
"sqlalchemy.sql.func.now",
"sqlalchemy.String",
"sqlalchemy.ext.declarative.declarative_base"
] | [((204, 222), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (220, 222), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((792, 807), 'spendy.db.utils.get_db_engine', 'get_db_engine', ([], {}), '()\n', (805, 807), False, 'from spendy.db.utils import get_db_engi... |
# Generated by Django 2.2.13 on 2020-06-29 08:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('flagit', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='flaggedobject',
name='notes',
... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((331, 371), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'default': '""""""'}), "(blank=True, default='')\n", (347, 371), False, 'from django.db import migrations, models\n'), ((500, 774), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('spam', 'Spam or other unrela... |
import asyncio
import functools
def get_request_life_cycle_wrapper(function, api, mimetype):
"""
It is a wrapper used on `EndOfRequestLifecycleDecorator` class.
This function is located in an extra module because python2.7 don't
support the 'yield from' syntax. This function is used to await
the c... | [
"asyncio.coroutine",
"asyncio.iscoroutine",
"functools.wraps"
] | [((446, 471), 'functools.wraps', 'functools.wraps', (['function'], {}), '(function)\n', (461, 471), False, 'import functools\n'), ((1165, 1191), 'asyncio.coroutine', 'asyncio.coroutine', (['wrapper'], {}), '(wrapper)\n', (1182, 1191), False, 'import asyncio\n'), ((1588, 1613), 'functools.wraps', 'functools.wraps', (['f... |
import unittest
from quickbooks.objects.detailline import SalesItemLineDetail, DiscountOverride, DetailLine, SubtotalLineDetail, \
DiscountLineDetail, SubtotalLine, DescriptionLineDetail, DescriptionLine, SalesItemLine, DiscountLine, GroupLine, \
AccountBasedExpenseLineDetail, ItemBasedExpenseLineDetail, Descr... | [
"quickbooks.objects.detailline.DescriptionLineDetail",
"quickbooks.objects.detailline.DetailLine",
"quickbooks.objects.detailline.SalesItemLine",
"quickbooks.objects.detailline.SalesItemLineDetail",
"quickbooks.objects.detailline.DescriptionOnlyLine",
"quickbooks.objects.detailline.ItemBasedExpenseLineDet... | [((446, 458), 'quickbooks.objects.detailline.DetailLine', 'DetailLine', ([], {}), '()\n', (456, 458), False, 'from quickbooks.objects.detailline import SalesItemLineDetail, DiscountOverride, DetailLine, SubtotalLineDetail, DiscountLineDetail, SubtotalLine, DescriptionLineDetail, DescriptionLine, SalesItemLine, Discount... |
import functools
import re
from django.db import connections, connection
from six import text_type
import sqlparse
from . import app_settings
EXPLORER_PARAM_TOKEN = "$$"
# SQL Specific Things
def passes_blacklist(sql):
clean = functools.reduce(lambda sql, term: sql.upper().replace(term, ""), [t.upper() for t... | [
"re.compile",
"django.contrib.auth.views.login",
"django.apps.apps.app_configs.items",
"sqlparse.format",
"django.apps.apps.get_app_config",
"tinys3.Connection",
"six.text_type"
] | [((1139, 1163), 'django.apps.apps.app_configs.items', 'apps.app_configs.items', ([], {}), '()\n', (1161, 1163), False, 'from django.apps import apps\n'), ((2619, 2674), 're.compile', 're.compile', (['"""\\\\$\\\\$([a-z0-9_]+)(?:\\\\:([^\\\\$]+))?\\\\$\\\\$"""'], {}), "('\\\\$\\\\$([a-z0-9_]+)(?:\\\\:([^\\\\$]+))?\\\\$\... |
""" This module defines the chi-squared and related functions
Module author: <NAME>
Year: 2020
Email: <EMAIL>
"""
import numpy as np
import model
def chi2_no_soliton(c, Rs, ups_disk, ups_bulg, gal, DM_profile="NFW"):
"""chi2 for an NFW fit (c, Rs; ups_disk, ups_bulg). Runs over a single galaxy
:param c: co... | [
"numpy.abs",
"numpy.sqrt",
"model.M_sol",
"numpy.append",
"numpy.array",
"model.v2_rot",
"numpy.linspace",
"numpy.meshgrid",
"numpy.logspace"
] | [((591, 647), 'model.v2_rot', 'model.v2_rot', (['gal', 'c', 'Rs', 'ups_bulg', 'ups_disk', 'DM_profile'], {}), '(gal, c, Rs, ups_bulg, ups_disk, DM_profile)\n', (603, 647), False, 'import model\n'), ((1994, 2022), 'numpy.linspace', 'np.linspace', (['(1)', '(80)', 'gridsize'], {}), '(1, 80, gridsize)\n', (2005, 2022), Tr... |
import os
import time
import pytest
from .. import pyqt5ac
def _is_gitlab_ci():
return os.getenv("GITLAB_CI") is not None
def _assert_path_exists(expected_path):
assert expected_path.check(), ("Generated file does not exist " + str(expected_path))
def _assert_path_does_not_exist(expected_path):
asse... | [
"time.sleep",
"pytest.raises",
"os.getenv"
] | [((95, 117), 'os.getenv', 'os.getenv', (['"""GITLAB_CI"""'], {}), "('GITLAB_CI')\n", (104, 117), False, 'import os\n'), ((561, 574), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (571, 574), False, 'import time\n'), ((593, 609), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (603, 609), False, 'import ... |
import hashlib
import json
import os
from argparse import ArgumentParser, Namespace
from collections import defaultdict
from copy import deepcopy
from functools import partial
from typing import Dict, List, Optional, Type
import numpy as np
import pytorch_lightning as pl
import torch
import torch.nn as nn
import torch... | [
"torch.utils.data.ConcatDataset",
"model.module.InputVariationalDropout",
"argparse.Namespace",
"constant.LANGUAGE_TO_ISO639.get",
"transformers.AutoTokenizer.from_pretrained",
"copy.deepcopy",
"torch.nn.functional.softmax",
"transformers.AutoModel.from_pretrained",
"argparse.ArgumentParser",
"jso... | [((1536, 1568), 'pytorch_lightning.seed_everything', 'pl.seed_everything', (['hparams.seed'], {}), '(hparams.seed)\n', (1554, 1568), True, 'import pytorch_lightning as pl\n'), ((1595, 1642), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['hparams.pretrain'], {}), '(hparams.pretrain)\n'... |
import requests,json,os,pprint
list_id=[]
courses_Id = 0
exercise_slug = " "
list_slug=[]
def new_fun():
with open("pandit.json","r") as file:
data=json.load(file)
# print(data)
n=1
for value in data:
list_id.append(value['id'])
print(n,value['name'])
... | [
"os.path.isfile",
"json.load",
"json.dump",
"requests.get"
] | [((1214, 1243), 'os.path.isfile', 'os.path.isfile', (['"""pandit.json"""'], {}), "('pandit.json')\n", (1228, 1243), False, 'import requests, json, os, pprint\n'), ((160, 175), 'json.load', 'json.load', (['file'], {}), '(file)\n', (169, 175), False, 'import requests, json, os, pprint\n'), ((1387, 1428), 'json.dump', 'js... |
# Use shebang here
#Import the necessary methods from tweepy library
from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
import time
import csv
import sys
import json
class StdOutListener(StreamListener):
def __init__(self, api = None):
self.api = api
... | [
"tweepy.Stream",
"csv.writer",
"time.strftime",
"time.sleep",
"json.load",
"tweepy.OAuthHandler"
] | [((3867, 3910), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (3879, 3910), False, 'from tweepy import OAuthHandler\n'), ((3985, 4000), 'tweepy.Stream', 'Stream', (['auth', 'l'], {}), '(auth, l)\n', (3991, 4000), False, 'from tweepy import Stream\... |
# -*- coding: utf-8 -*-
import pytest
from api.base.settings.defaults import API_BASE
from osf_tests.factories import (
AuthUserFactory,
InstitutionFactory,
)
@pytest.mark.django_db
class TestUserInstititutionRelationship:
@pytest.fixture()
def institution_one(self):
return InstitutionFactor... | [
"pytest.fixture",
"osf_tests.factories.InstitutionFactory",
"osf_tests.factories.AuthUserFactory"
] | [((240, 256), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (254, 256), False, 'import pytest\n'), ((330, 346), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (344, 346), False, 'import pytest\n'), ((420, 436), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (434, 436), False, 'import pytest\n'), (... |
import unittest
from fizzbuzz_interview_question import fizz_buzz
class Test(unittest.TestCase):
def test_fizzbuzz_interview_question(self):
self.assertEqual(fizz_buzz(3), "Fizz")
self.assertEqual(fizz_buzz(5), "Buzz")
self.assertEqual(fizz_buzz(15), "FizzBuzz")
self.assertEqual(fiz... | [
"unittest.main",
"fizzbuzz_interview_question.fizz_buzz"
] | [((376, 391), 'unittest.main', 'unittest.main', ([], {}), '()\n', (389, 391), False, 'import unittest\n'), ((171, 183), 'fizzbuzz_interview_question.fizz_buzz', 'fizz_buzz', (['(3)'], {}), '(3)\n', (180, 183), False, 'from fizzbuzz_interview_question import fizz_buzz\n'), ((218, 230), 'fizzbuzz_interview_question.fizz_... |
from io import StringIO
from django.core.management import call_command
from germanium.test_cases.default import GermaniumTestCase
from germanium.tools import assert_equal, assert_false
from fperms.models import Perm
from fperms_iscore.enums import PERM_TYPE_CORE
class CommandsTestCase(GermaniumTestCase):
de... | [
"io.StringIO",
"fperms.models.Perm.objects.exists",
"fperms.models.Perm.objects.count"
] | [((390, 411), 'fperms.models.Perm.objects.exists', 'Perm.objects.exists', ([], {}), '()\n', (409, 411), False, 'from fperms.models import Perm\n'), ((494, 514), 'fperms.models.Perm.objects.count', 'Perm.objects.count', ([], {}), '()\n', (512, 514), False, 'from fperms.models import Perm\n'), ((461, 471), 'io.StringIO',... |
from collections import Counter
from typing import List
from utils import run
def _get_children(data: List[int], days: int):
counter = Counter(data)
for _ in range(days):
counter = Counter({k - 1: v for k, v in counter.items()})
counter[6] += counter[-1]
counter[8] += counter[-1]
... | [
"utils.run",
"collections.Counter"
] | [((376, 391), 'utils.run', 'run', (['""","""'], {'c': 'int'}), "(',', c=int)\n", (379, 391), False, 'from utils import run\n'), ((458, 473), 'utils.run', 'run', (['""","""'], {'c': 'int'}), "(',', c=int)\n", (461, 473), False, 'from utils import run\n'), ((142, 155), 'collections.Counter', 'Counter', (['data'], {}), '(... |
# -*- coding: utf-8 -*-
""" SQL in F(unctions)
SQL in Python __doc__-strings as an alternative to ORMs
"""
import apsw
import atexit
import contextlib
import functools
import inspect
import re
import typeguard
import types
###############################################################################
# Globals... | [
"inspect.signature",
"apsw.Connection",
"functools.wraps",
"re.findall",
"atexit.register"
] | [((433, 460), 'apsw.Connection', 'apsw.Connection', (['""":memory:"""'], {}), "(':memory:')\n", (448, 460), False, 'import apsw\n'), ((461, 496), 'atexit.register', 'atexit.register', (['__connection.close'], {}), '(__connection.close)\n', (476, 496), False, 'import atexit\n'), ((815, 838), 'inspect.signature', 'inspec... |
import json
import csv
import argparse
from analizers.entities.polarity import Polarity
from os import listdir
from os.path import isfile, join, isdir
from utils.dates import find_boundaries
from analizers.vader import vader_sentiment
parser = argparse.ArgumentParser(description='Analyze the sentiments of a bunch of ... | [
"os.listdir",
"argparse.ArgumentParser",
"analizers.vader.vader_sentiment",
"csv.writer",
"os.path.join",
"utils.dates.find_boundaries",
"analizers.entities.polarity.Polarity",
"json.load"
] | [((246, 356), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Analyze the sentiments of a bunch of News and their Reddit coments"""'}), "(description=\n 'Analyze the sentiments of a bunch of News and their Reddit coments')\n", (269, 356), False, 'import argparse\n'), ((1035, 1064), 'os... |
from app.models.APNDevice import APNDevice
from app.instances import db
from app.instances.redis import redis_db
from app.models.User import User
from os import urandom
from uuid import UUID
from flask import g
pn_redis_id_prefix = 'pn-id:'
pn_redis_id_time = 60 * 2 # In seconds
def is_valid_webapn_version(version... | [
"app.instances.db.session.commit",
"app.instances.redis.redis_db.expire",
"app.instances.redis.redis_db.get",
"os.urandom",
"app.models.User.User.query.filter_by",
"app.instances.redis.redis_db.delete",
"app.models.APNDevice.APNDevice.query.filter_by",
"app.instances.redis.redis_db.set",
"app.models... | [((653, 692), 'app.models.APNDevice.APNDevice', 'APNDevice', ([], {'provider': 'provider', 'user': 'user'}), '(provider=provider, user=user)\n', (662, 692), False, 'from app.models.APNDevice import APNDevice\n'), ((697, 719), 'app.instances.db.session.add', 'db.session.add', (['device'], {}), '(device)\n', (711, 719), ... |
from __future__ import absolute_import, division, print_function, unicode_literals
from decimal import Decimal
import unittest
from amaascore.assets.synthetic import Synthetic
from amaascore.tools.generate_asset import generate_synthetic
class SyntheticTest(unittest.TestCase):
def setUp(self):
self.lon... | [
"unittest.main",
"amaascore.tools.generate_asset.generate_synthetic"
] | [((632, 647), 'unittest.main', 'unittest.main', ([], {}), '()\n', (645, 647), False, 'import unittest\n'), ((404, 424), 'amaascore.tools.generate_asset.generate_synthetic', 'generate_synthetic', ([], {}), '()\n', (422, 424), False, 'from amaascore.tools.generate_asset import generate_synthetic\n')] |
# Generated by Django 2.2.10 on 2020-06-23 12:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('overlays', '0001_initial'),
]
operations = [
migrations.AlterModelOptions(
name='overlay',
... | [
"django.db.models.ForeignKey",
"django.db.migrations.AlterModelOptions",
"django.db.models.PositiveIntegerField",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((259, 379), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""overlay"""', 'options': "{'verbose_name': 'Overlay', 'verbose_name_plural': 'Overlays'}"}), "(name='overlay', options={'verbose_name':\n 'Overlay', 'verbose_name_plural': 'Overlays'})\n", (287, 379), False, 'fro... |
import codecs
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*parts):
"""
Build an absolute path from *parts* and and return the contents of the
resulting file. Assume UTF-8 encoding.
"""
with codecs.open(os.path.join(HERE, *part... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((94, 119), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (109, 119), False, 'import os\n'), ((431, 446), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (444, 446), False, 'from setuptools import setup, find_packages\n'), ((296, 322), 'os.path.join', 'os.path.join', (['HERE'... |
import asyncio
import requests
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils.executor import start_webhook
from datetime import datetime
import os
from setup_db import KVStorage
from services.epic_free_games import epicfreegames
from services.apkmirror import apkmirror
imp... | [
"services.apkmirror.apkmirror.ApkMirror",
"service_twitor.Twitor",
"os.getenv",
"datetime.datetime.utcnow",
"service_leekduck.get_raid_bosses",
"service_rss_reader.main",
"setup_db.KVStorage",
"service_leekduck.get_research",
"services.epic_free_games.epicfreegames.EFG",
"asyncio.sleep",
"setup_... | [((398, 422), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (420, 422), False, 'import asyncio\n'), ((478, 493), 'aiogram.dispatcher.Dispatcher', 'Dispatcher', (['bot'], {}), '(bot)\n', (488, 493), False, 'from aiogram.dispatcher import Dispatcher\n'), ((508, 532), 'os.getenv', 'os.getenv', (['"... |
# coding=utf-8
import six
from cio import lazy_shortcut
from cio.conf import settings
from cio.utils.formatters import ContentFormatter
from cio.utils.uri import URI, quote
from cio.utils.imports import import_class
from tests import BaseTest
class UtilsTest(BaseTest):
def test_uri(self):
self.assertEqual... | [
"cio.utils.formatters.ContentFormatter",
"cio.utils.uri.URI",
"cio.utils.uri.quote",
"cio.utils.imports.import_class",
"cio.conf.settings",
"cio.lazy_shortcut"
] | [((397, 464), 'cio.utils.uri.URI', 'URI', ([], {'scheme': '"""i18n"""', 'namespace': '"""sv-se"""', 'path': '"""page/title"""', 'ext': '"""txt"""'}), "(scheme='i18n', namespace='sv-se', path='page/title', ext='txt')\n", (400, 464), False, 'from cio.utils.uri import URI, quote\n'), ((541, 558), 'cio.utils.uri.URI', 'URI... |
from django.contrib import admin
from django.urls import path, include
from rest_framework.authtoken import views
urlpatterns = [
path('admin/', admin.site.urls),
path('api/games/', include('games.api.urls')),
path('api-auth/', include('rest_framework.urls')),
path('api-token-auth/', views.obtain_auth_... | [
"django.urls.path",
"django.urls.include"
] | [((135, 166), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (139, 166), False, 'from django.urls import path, include\n'), ((278, 326), 'django.urls.path', 'path', (['"""api-token-auth/"""', 'views.obtain_auth_token'], {}), "('api-token-auth/', views.obtain_auth... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.shortcuts import render
from companies.models import Company
from jobapplications.models import JobApplication
from joblistings.models import Job
from accounts.models import Candidate
from django.http import HttpRes... | [
"django.shortcuts.render",
"django.db.models.Q",
"django.shortcuts.get_object_or_404",
"django.http.HttpResponseRedirect"
] | [((1747, 1750), 'django.db.models.Q', 'Q', ([], {}), '()\n', (1748, 1750), False, 'from django.db.models import Q\n'), ((2227, 2277), 'django.shortcuts.render', 'render', (['request', '"""dashboard-message.html"""', 'context'], {}), "(request, 'dashboard-message.html', context)\n", (2233, 2277), False, 'from django.sho... |
# Example Serial Job
import time
# Serial task
def serial_task(idx):
time.sleep(0.5)
filename = f'../../Output/Serial/Serial.{idx}.txt'
with open(filename,'w') as f:
for i in range(idx+1):
f.write(f'{i**2}\n')
return
def main():
# Main code
start = time.time()
for i in ran... | [
"time.time",
"time.sleep"
] | [((74, 89), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (84, 89), False, 'import time\n'), ((292, 303), 'time.time', 'time.time', ([], {}), '()\n', (301, 303), False, 'import time\n'), ((362, 373), 'time.time', 'time.time', ([], {}), '()\n', (371, 373), False, 'import time\n')] |
import fnmatch
import os
from rec_to_nwb.processing.exceptions.missing_data_exception import MissingDataException
from rec_to_nwb.processing.metadata.metadata_manager import MetadataManager
from rec_to_nwb.processing.tools.beartype.beartype import beartype
from rec_to_nwb.processing.tools.dataset import Dataset
from r... | [
"rec_to_nwb.processing.tools.file_sorter.FileSorter.sort_filenames",
"os.path.exists",
"os.listdir",
"rec_to_nwb.processing.tools.dataset.Dataset",
"fnmatch.fnmatch",
"rec_to_nwb.processing.exceptions.missing_data_exception.MissingDataException"
] | [((756, 834), 'os.listdir', 'os.listdir', (["(self.data_path + '/' + self.animal_name + '/preprocessing/' + date)"], {}), "(self.data_path + '/' + self.animal_name + '/preprocessing/' + date)\n", (766, 834), False, 'import os\n'), ((843, 881), 'rec_to_nwb.processing.tools.file_sorter.FileSorter.sort_filenames', 'FileSo... |
from faker import Factory as FakerFactory
import factory
from db.models.jobs import Job, JobStatus
from factories.factory_projects import ProjectFactory
from factories.factory_users import UserFactory
from factories.fixtures import job_spec_parsed_content
fake = FakerFactory.create()
class JobFactory(factory.Djang... | [
"faker.Factory.create",
"factory.SubFactory"
] | [((266, 287), 'faker.Factory.create', 'FakerFactory.create', ([], {}), '()\n', (285, 287), True, 'from faker import Factory as FakerFactory\n'), ((397, 428), 'factory.SubFactory', 'factory.SubFactory', (['UserFactory'], {}), '(UserFactory)\n', (415, 428), False, 'import factory\n'), ((443, 477), 'factory.SubFactory', '... |
import math
import tensorflow as tf
def warmup_cosine(x, warmup=0.002):
s = tf.cast(x <= warmup, tf.float32)
return s*(x/warmup) + (1-s)*(0.5 * (1 + tf.cos(math.pi * x)))
def warmup_constant(x, warmup=0.002):
s = tf.cast(x <= warmup, tf.float32)
return s*(x/warmup) + (1-s)*1
def warmup_linear(x, w... | [
"tensorflow.Variable",
"tensorflow.group",
"tensorflow.sqrt",
"tensorflow.convert_to_tensor",
"tensorflow.cast",
"tensorflow.cos",
"tensorflow.clip_by_global_norm"
] | [((82, 114), 'tensorflow.cast', 'tf.cast', (['(x <= warmup)', 'tf.float32'], {}), '(x <= warmup, tf.float32)\n', (89, 114), True, 'import tensorflow as tf\n'), ((229, 261), 'tensorflow.cast', 'tf.cast', (['(x <= warmup)', 'tf.float32'], {}), '(x <= warmup, tf.float32)\n', (236, 261), True, 'import tensorflow as tf\n'),... |
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""
Twisted inetd TAP support
Maintainer: <NAME>
Future Plans: more configurability.
"""
import os, pwd, grp, socket
from twisted.runner import inetd, inetdconf
from twisted.python import log, usage
from twisted.internet.protocol... | [
"twisted.runner.inetdconf.InetdConf",
"twisted.application.internet.TCPServer",
"twisted.application.internet.TCPServer.startService",
"grp.getgrnam",
"twisted.python.log.deferr",
"twisted.python.log.msg",
"twisted.runner.inetd.InetdFactory",
"twisted.runner.inetd.forkPassingFD",
"pwd.getpwnam",
"... | [((1617, 1642), 'twisted.application.service.MultiService', 'appservice.MultiService', ([], {}), '()\n', (1640, 1642), True, 'from twisted.application import internet, service as appservice\n'), ((1654, 1675), 'twisted.runner.inetdconf.InetdConf', 'inetdconf.InetdConf', ([], {}), '()\n', (1673, 1675), False, 'from twis... |
import torch
from pykeops.torch import LazyTensor
from tqdm import tqdm
# Dimension specifications:
# B: Samples in Batch
# N: Number of points to cluster
# E: Dimensionality of the space the points are embedded in
class MeanShiftStep(torch.nn.Module):
GAUSSIAN_KERNEL = 'gaussian'
FLAT_KERNEL = 'flat'
EP... | [
"pykeops.torch.LazyTensor"
] | [((2486, 2506), 'pykeops.torch.LazyTensor', 'LazyTensor', (['points_i'], {}), '(points_i)\n', (2496, 2506), False, 'from pykeops.torch import LazyTensor\n'), ((2530, 2550), 'pykeops.torch.LazyTensor', 'LazyTensor', (['points_j'], {}), '(points_j)\n', (2540, 2550), False, 'from pykeops.torch import LazyTensor\n')] |
import numpy as np
from matplotlib import pyplot as plt
from math import *
from scipy.integrate import quad
from scipy.integrate import dblquad
from scipy import integrate
from scipy import special
from numpy import median
from numpy import linspace
from copy import deepcopy
def catoni(w, X, Y, delta, alpha, valpha):... | [
"numpy.zeros",
"numpy.log",
"numpy.var"
] | [((1040, 1051), 'numpy.zeros', 'np.zeros', (['d'], {}), '(d)\n', (1048, 1051), True, 'import numpy as np\n'), ((856, 869), 'numpy.var', 'np.var', (['ll[k]'], {}), '(ll[k])\n', (862, 869), True, 'import numpy as np\n'), ((1169, 1202), 'numpy.log', 'np.log', (['(1 + xx[k] + xx[k] * xx[k])'], {}), '(1 + xx[k] + xx[k] * xx... |
import logging
import os
from filelock import FileLock
from flowjs.interfaces import IRequest, IConfig, IFile
class ChunkedFile:
def __init__(self, config, request):
# type: (IConfig, IRequest) -> None
if config is None:
raise TypeError('Argument passed to config cannot be None!')
... | [
"os.path.exists",
"os.path.getsize",
"filelock.FileLock",
"logging.debug"
] | [((2284, 2350), 'logging.debug', 'logging.debug', (['"""validate_chunk: Chunk was successfully validated!"""'], {}), "('validate_chunk: Chunk was successfully validated!')\n", (2297, 2350), False, 'import logging\n'), ((3682, 3744), 'logging.debug', 'logging.debug', (['"""validate_file: Chunks successfully validated!""... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : test.py
# Author: Alvin(<NAME> <<EMAIL>>
# Date : 02.05.2021
import json
import logging
import hydra
import pytorch_lightning as pl
import torch
from omegaconf import DictConfig, OmegaConf
log = logging.getLogger(__name__)
@hydra.main(config_path='config', ... | [
"logging.getLogger",
"hydra.main",
"pytorch_lightning.seed_everything",
"hydra.utils.instantiate",
"torch.load",
"omegaconf.OmegaConf.to_yaml",
"pytorch_lightning.Trainer"
] | [((256, 283), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (273, 283), False, 'import logging\n'), ((287, 346), 'hydra.main', 'hydra.main', ([], {'config_path': '"""config"""', 'config_name': '"""test_config"""'}), "(config_path='config', config_name='test_config')\n", (297, 346), False... |
# -*- coding: utf-8 -*-
from django.db import models
# Create your models here.
class Host(models.Model):
ip = models.CharField( max_length=100,verbose_name='主机IP')
os = models.CharField( max_length=100, verbose_name='系统')
partition = models.CharField(max_length=100, verbose_name='分区')
class Meta:
... | [
"django.db.models.DateTimeField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((116, 169), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'verbose_name': '"""主机IP"""'}), "(max_length=100, verbose_name='主机IP')\n", (132, 169), False, 'from django.db import models\n'), ((179, 230), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'verbo... |
from hestia.internal_services import InternalServices
from rest_framework import permissions
from django.http import HttpRequest
from django.views import View
from scopes.authentication.internal import is_authenticated_internal_user
from scopes.permissions.base import PolyaxonPermission
class IsInternal(PolyaxonPer... | [
"scopes.authentication.internal.is_authenticated_internal_user"
] | [((585, 629), 'scopes.authentication.internal.is_authenticated_internal_user', 'is_authenticated_internal_user', (['request.user'], {}), '(request.user)\n', (615, 629), False, 'from scopes.authentication.internal import is_authenticated_internal_user\n'), ((2011, 2055), 'scopes.authentication.internal.is_authenticated_... |
"""Helper functions
Consists of functions to typically be used within templates, but also
available to Controllers. This module is available to templates as 'h'.
"""
from __future__ import absolute_import
import re
import unicodedata
import lxml.html
import lxml.html.clean
import markdown
from webhelpers.html import ... | [
"markdown.Markdown",
"unicodedata.combining",
"re.match",
"webhelpers.html.literal",
"unicodedata.normalize",
"re.sub"
] | [((735, 789), 'markdown.Markdown', 'markdown.Markdown', ([], {'extensions': '[]', 'output_format': '"""html"""'}), "(extensions=[], output_format='html')\n", (752, 789), False, 'import markdown\n'), ((2303, 2368), 're.match', 're.match', (['"""\\\\A<div>(.*)</div>\\\\Z"""', 'friendly_html'], {'flags': 're.DOTALL'}), "(... |
#!/usr/bin/env python3
import cv2
import numpy as np
import os
from pathlib import Path
from tqdm import tqdm
import settings
cwd = Path(os.path.dirname(__file__))
rollouts = cwd/'rollouts'
def make_csv():
files = []
for i in sorted(rollouts.iterdir()):
trajectory = Path(i)
for file in sor... | [
"os.path.dirname",
"pathlib.Path",
"numpy.random.shuffle"
] | [((141, 166), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (156, 166), False, 'import os\n'), ((508, 532), 'numpy.random.shuffle', 'np.random.shuffle', (['files'], {}), '(files)\n', (525, 532), True, 'import numpy as np\n'), ((1005, 1028), 'numpy.random.shuffle', 'np.random.shuffle', (['dir... |
from quart import jsonify, request
from quart_jwt_extended import (
JWTManager, jwt_required, create_access_token,
get_jwt_identity
)
from __main__ import app
from pkg.common import user
@app.route('/login', methods=['POST'])
async def login():
if not request.is_json:
return jsonify({"msg": "Missin... | [
"quart.jsonify",
"pkg.common.user.add_user",
"__main__.app.route",
"quart.request.get_json",
"quart_jwt_extended.create_access_token",
"pkg.common.user.check_user",
"quart_jwt_extended.get_jwt_identity"
] | [((197, 234), '__main__.app.route', 'app.route', (['"""/login"""'], {'methods': "['POST']"}), "('/login', methods=['POST'])\n", (206, 234), False, 'from __main__ import app\n'), ((954, 992), '__main__.app.route', 'app.route', (['"""/signup"""'], {'methods': "['POST']"}), "('/signup', methods=['POST'])\n", (963, 992), F... |
import numpy as np
import pytest
import psyneulink.core.components.functions.nonstateful.selectionfunctions as Functions
import psyneulink.core.globals.keywords as kw
import psyneulink.core.llvm as pnlvm
from psyneulink.core.globals.utilities import _SeededPhilox
np.random.seed(0)
SIZE=10
test_var = np.random.rand(SI... | [
"numpy.allclose",
"psyneulink.core.globals.utilities._SeededPhilox",
"numpy.random.rand",
"pytest.helpers.get_func_execution",
"pytest.mark.parametrize",
"numpy.random.seed"
] | [((266, 283), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (280, 283), True, 'import numpy as np\n'), ((382, 402), 'numpy.random.rand', 'np.random.rand', (['SIZE'], {}), '(SIZE)\n', (396, 402), True, 'import numpy as np\n'), ((445, 465), 'numpy.random.rand', 'np.random.rand', (['SIZE'], {}), '(SIZE)\n... |
#coding:utf-8
from django.db import models
# Create your models here.
class Bookinfo(models.Model):
name = models.CharField(max_length=10)
def __str__(self):
return self.name
class Peopleinfo(models.Model):
name = models.CharField(max_length=10)
gender = models.BooleanField(default=True)
... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((113, 144), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (129, 144), False, 'from django.db import models\n'), ((238, 269), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (254, 269), False, 'from django.db im... |
from typing import List, Tuple, Dict
import re
patterns: Dict[str, re.Pattern] = {
'MOT': re.compile(r"[a-zA-Z]+"),
'NUMBER': re.compile(r"[0-9]+"),
'ESPACE': re.compile(r"[ ]+"),
'PLUS': re.compile(r"\+"),
'MULTIPLIER': re.compile(r"\*"),
'QUESTION': re.compile(r"\?"),
}
def tokenize(text: s... | [
"re.compile"
] | [((95, 118), 're.compile', 're.compile', (['"""[a-zA-Z]+"""'], {}), "('[a-zA-Z]+')\n", (105, 118), False, 'import re\n'), ((135, 155), 're.compile', 're.compile', (['"""[0-9]+"""'], {}), "('[0-9]+')\n", (145, 155), False, 'import re\n'), ((172, 190), 're.compile', 're.compile', (['"""[ ]+"""'], {}), "('[ ]+')\n", (182,... |
import unittest
import torch
from deep_sudoku.metric import grid_accuracy, accuracy
class TestMetric(unittest.TestCase):
def test_grid_accuracy(self):
y_hat = torch.arange(4*9*9).reshape(4, 9, 9)
y = y_hat.clone()
# Without modifying y
self.assertEqual(grid_accuracy(y_hat, y, valid... | [
"deep_sudoku.metric.grid_accuracy",
"deep_sudoku.metric.accuracy",
"unittest.main",
"torch.arange",
"torch.ones"
] | [((803, 818), 'unittest.main', 'unittest.main', ([], {}), '()\n', (816, 818), False, 'import unittest\n'), ((502, 521), 'torch.ones', 'torch.ones', (['(4)', '(9)', '(9)'], {}), '(4, 9, 9)\n', (512, 521), False, 'import torch\n'), ((291, 327), 'deep_sudoku.metric.grid_accuracy', 'grid_accuracy', (['y_hat', 'y'], {'valid... |
from Foundation import *
from AppKit import *
from PyObjCTools import AppHelper
from collections import deque
import contextlib
from enum import Enum
import os
from pathlib import Path
import shutil
import subprocess
import sys
from . import ezntfs
from . import __version__
def create_icon(symbol, description, fall... | [
"PyObjCTools.AppHelper.runEventLoop",
"collections.deque",
"os.getenv",
"pathlib.Path.home",
"shutil.which",
"subprocess.run",
"os.geteuid",
"os.chmod",
"os.chown",
"contextlib.suppress",
"enum.Enum",
"sys.exit"
] | [((948, 1010), 'enum.Enum', 'Enum', (['"""AppState"""', "['READY', 'FAILED', 'RELOADING', 'MOUNTING']"], {}), "('AppState', ['READY', 'FAILED', 'RELOADING', 'MOUNTING'])\n", (952, 1010), False, 'from enum import Enum\n'), ((1031, 1062), 'os.getenv', 'os.getenv', (['"""EZNTFS_ALWAYS_SHOW"""'], {}), "('EZNTFS_ALWAYS_SHOW... |
import serial
import json
import requests
import re
A_SERVER = '192.168.1.4:3333'
COM = '/dev/ttyACM0'
def serial_connection(car_move):
car_move_num = {306: 'b', 312: 'f', 303: 'l', 309: 'r'}
new_car_move = car_move_num[car_move]
print("==== ard START ======")
ser = serial.Serial(COM, 9600)
ser.r... | [
"re.findall",
"json.dumps",
"serial.Serial"
] | [((286, 310), 'serial.Serial', 'serial.Serial', (['COM', '(9600)'], {}), '(COM, 9600)\n', (299, 310), False, 'import serial\n'), ((873, 895), 'json.dumps', 'json.dumps', (['have_error'], {}), '(have_error)\n', (883, 895), False, 'import json\n'), ((601, 625), 're.findall', 're.findall', (['"""\\\\d+"""', 'temp'], {}), ... |
# Copyright (c) <NAME> <<EMAIL>>
# See LICENSE file.
from _sadm import log, cfg
from _sadm.web import tpl
from _sadm.web.app import wapp, view
@wapp.route('/profile')
@view('profile.html')
@tpl.data('profile')
def index():
log.debug('index')
return {
'profiles': _getallProfiles(),
}
def _getallProfiles():
conf... | [
"_sadm.web.tpl.data",
"_sadm.cfg.new",
"_sadm.log.debug",
"_sadm.web.app.wapp.route",
"_sadm.web.app.view"
] | [((146, 168), '_sadm.web.app.wapp.route', 'wapp.route', (['"""/profile"""'], {}), "('/profile')\n", (156, 168), False, 'from _sadm.web.app import wapp, view\n'), ((170, 190), '_sadm.web.app.view', 'view', (['"""profile.html"""'], {}), "('profile.html')\n", (174, 190), False, 'from _sadm.web.app import wapp, view\n'), (... |
import pathlib
import re
in_file = pathlib.Path.cwd().joinpath('16', 'input.txt')
with open(in_file) as input:
lines = input.readlines()
rules = []
my_ticket = []
nearby_tickets = []
departure_indices = []
section = 0
for line in lines:
if line == '\n':
section += 1
continue
if section =... | [
"pathlib.Path.cwd"
] | [((36, 54), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (52, 54), False, 'import pathlib\n')] |
from flask import Flask, request, jsonify, render_template, Markup, session, redirect, abort
from zeep import Client, Settings, xsd
from requests import Session
from requests.auth import AuthBase, HTTPBasicAuth
from zeep.transports import Transport
import os
import sys
import datetime
import time
from classes.client im... | [
"flask.abort",
"os.environ.get",
"sys.exc_info",
"flask.request.get_json",
"middleware.log_details",
"flask.jsonify"
] | [((407, 439), 'os.environ.get', 'os.environ.get', (['"""log_file"""', 'None'], {}), "('log_file', None)\n", (421, 439), False, 'import os\n'), ((1039, 1057), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1055, 1057), False, 'from flask import Flask, request, jsonify, render_template, Markup, session,... |
from django.conf import settings
from django.contrib import admin
from django.urls import path
app_name = "django_calendardate"
urlpatterns = [
path(settings.ADMIN_URL, admin.site.urls),
]
| [
"django.urls.path"
] | [((151, 192), 'django.urls.path', 'path', (['settings.ADMIN_URL', 'admin.site.urls'], {}), '(settings.ADMIN_URL, admin.site.urls)\n', (155, 192), False, 'from django.urls import path\n')] |