code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from diofant.utilities.decorator import no_attrs_in_subclass
__all__ = ()
def test_no_attrs_in_subclass():
class A:
x = 'test'
A.x = no_attrs_in_subclass(A, A.x)
class B(A):
pass
assert hasattr(A, 'x') is True
assert hasattr(B, 'x') is False
| [
"diofant.utilities.decorator.no_attrs_in_subclass"
] | [((154, 182), 'diofant.utilities.decorator.no_attrs_in_subclass', 'no_attrs_in_subclass', (['A', 'A.x'], {}), '(A, A.x)\n', (174, 182), False, 'from diofant.utilities.decorator import no_attrs_in_subclass\n')] |
import argparse
from ccc_client.app_repo.AppRepoRunner import AppRepoRunner
from ccc_client.utils import print_API_response
def run(args):
runner = AppRepoRunner(args.host, args.port, args.authToken)
r = runner.upload_image(args.imageBlob, args.imageName, args.imageTag)
print_API_response(r)
if args... | [
"ccc_client.app_repo.AppRepoRunner.AppRepoRunner",
"ccc_client.utils.print_API_response",
"argparse.ArgumentParser"
] | [((440, 465), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (463, 465), False, 'import argparse\n'), ((155, 206), 'ccc_client.app_repo.AppRepoRunner.AppRepoRunner', 'AppRepoRunner', (['args.host', 'args.port', 'args.authToken'], {}), '(args.host, args.port, args.authToken)\n', (168, 206), Fals... |
#!/usr/bin/python2.6
#-*- coding: utf-8 -*-
import signal
import subprocess
from glob import glob
from os import listdir
from os.path import basename, dirname
label = 'CentOS_6.9_Final'
def listifaces():
ethernet = []
for iface in listdir('/sys/class/net/'):
if iface != 'lo':
ethernet.app... | [
"os.path.dirname",
"subprocess.Popen",
"os.listdir",
"glob.glob"
] | [((242, 268), 'os.listdir', 'listdir', (['"""/sys/class/net/"""'], {}), "('/sys/class/net/')\n", (249, 268), False, 'from os import listdir\n'), ((573, 634), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdout': 'subprocess.PIPE', 'shell': '(True)'}), '(command, stdout=subprocess.PIPE, shell=True)\n', (589, ... |
from ckan_cloud_operator import kubectl
def get(what, *args, required=True, namespace=None, get_cmd=None, **kwargs):
return kubectl.get(what, *args, required=required, namespace=namespace, get_cmd=get_cmd, **kwargs)
| [
"ckan_cloud_operator.kubectl.get"
] | [((130, 226), 'ckan_cloud_operator.kubectl.get', 'kubectl.get', (['what', '*args'], {'required': 'required', 'namespace': 'namespace', 'get_cmd': 'get_cmd'}), '(what, *args, required=required, namespace=namespace, get_cmd=\n get_cmd, **kwargs)\n', (141, 226), False, 'from ckan_cloud_operator import kubectl\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: <NAME>, ph4r05, 2018
import operator
import sys
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
indexbytes = operator.getitem
intlist2bytes = bytes
int2byte = operator.methodcaller("to_bytes", 1, "big")
else... | [
"operator.methodcaller"
] | [((271, 314), 'operator.methodcaller', 'operator.methodcaller', (['"""to_bytes"""', '(1)', '"""big"""'], {}), "('to_bytes', 1, 'big')\n", (292, 314), False, 'import operator\n')] |
import os.path as osp
from argparse import ArgumentParser
from mmcv import Config
from pytorch_lightning import Trainer, seed_everything
from pytorch_lightning.callbacks import ModelCheckpoint
from torch.utils.data import DataLoader
from datasets import build_dataset
from models import MODELS
import torch
def parse... | [
"pytorch_lightning.callbacks.ModelCheckpoint",
"models.MODELS.build",
"argparse.ArgumentParser",
"pytorch_lightning.seed_everything",
"os.path.join",
"torch.set_default_dtype",
"datasets.build_dataset",
"pytorch_lightning.Trainer",
"torch.utils.data.DataLoader"
] | [((342, 390), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Training with DDP."""'}), "(description='Training with DDP.')\n", (356, 390), False, 'from argparse import ArgumentParser\n'), ((815, 853), 'torch.set_default_dtype', 'torch.set_default_dtype', (['torch.float32'], {}), '(torch.float32)\... |
""" This Script contain the different function used in the framework
part1. Data processing
part2. Prediction and analisys
part3. Plotting
"""
import numpy as np
import librosa
import matplotlib.pyplot as plt
from sklearn import metrics
import os
import pickle
import time
import struct
""" Data processing """
def g... | [
"matplotlib.pyplot.ylabel",
"librosa.feature.mfcc",
"numpy.arange",
"librosa.load",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sklearn.metrics.confusion_matrix",
"pickle.load",
"struct.unpack",
"matplotlib.pyplot.title",
"librosa.util.normalize",
"matplotlib.pyplot.legend",
"matp... | [((3975, 3992), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (3986, 3992), False, 'import pickle\n'), ((5073, 5118), 'os.path.join', 'os.path.join', (['audio_path', 'fold_num', 'file_name'], {}), '(audio_path, fold_num, file_name)\n', (5085, 5118), False, 'import os\n'), ((5135, 5222), 'os.path.join', 'os.... |
"""
jb2.py
~~~~~~
Use JBIG2, and an external compressor, for black and white images.
"""
import os, sys, subprocess, struct, zipfile, random
from . import pdf_image
from . import pdf_write
from . import pdf
import PIL.Image as _PILImage
_default_jbig2_exe = os.path.join(os.path.abspath(".."), "agl-jbig2enc", "jbig2.... | [
"os.listdir",
"random.choice",
"PIL.Image.open",
"zipfile.ZipFile",
"subprocess.run",
"os.path.join",
"os.chdir",
"os.rmdir",
"struct.unpack",
"os.mkdir",
"os.path.abspath",
"os.remove"
] | [((274, 295), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (289, 295), False, 'import os, sys, subprocess, struct, zipfile, random\n'), ((887, 955), 'subprocess.run', 'subprocess.run', (['args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(args, stdout=subprocess.PIPE, stderr... |
#!/usr/bin/env python3
import argparse
import sys
from mpopt import ct, utils
if __name__ == '__main__':
parser = argparse.ArgumentParser(prog='ct_jug', description='Optimizer for *.jug cell tracking models.')
parser.add_argument('-B', '--batch-size', type=int, default=ct.DEFAULT_BATCH_SIZE)
parser.add_... | [
"mpopt.ct.construct_tracker",
"mpopt.ct.GurobiDecomposedModel",
"argparse.ArgumentParser",
"mpopt.ct.format_jug_primals",
"mpopt.ct.parse_jug_model",
"mpopt.utils.smart_open",
"mpopt.ct.GurobiStandardModel",
"mpopt.ct.extract_primals_from_tracker"
] | [((122, 222), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""ct_jug"""', 'description': '"""Optimizer for *.jug cell tracking models."""'}), "(prog='ct_jug', description=\n 'Optimizer for *.jug cell tracking models.')\n", (145, 222), False, 'import argparse\n'), ((872, 899), 'mpopt.ct.constr... |
import os
from setuptools import setup, find_packages
# For development and local builds use this version number, but for real builds replace it
# with the tag found in the environment
package_version = "4.0.0.dev0"
if 'BITBUCKET_TAG' in os.environ:
package_version = os.environ['BITBUCKET_TAG'].lstrip('v')
elif '... | [
"setuptools.find_packages"
] | [((1235, 1268), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['test/*']"}), "(exclude=['test/*'])\n", (1248, 1268), False, 'from setuptools import setup, find_packages\n')] |
import os
import tarfile
import time
import pickle
import numpy as np
from Bio.Seq import Seq
from scipy.special import expit
from scipy.special import logit
import torch
import torch.nn.functional as F
""" Get directories for model and seengenes """
module_dir = os.path.dirname(os.path.realpath(__file__))
model_dir ... | [
"tarfile.open",
"torch.LongTensor",
"Bio.Seq.Seq",
"torch.cuda.device_count",
"time.sleep",
"numpy.argsort",
"numpy.count_nonzero",
"os.path.exists",
"numpy.asarray",
"torch.hub.load",
"pickle.load",
"torch.hub.set_dir",
"torch.nn.functional.one_hot",
"torch.cuda.empty_cache",
"torch.sta... | [((322, 363), 'os.path.join', 'os.path.join', (['module_dir', '"""balrog_models"""'], {}), "(module_dir, 'balrog_models')\n", (334, 363), False, 'import os\n'), ((282, 308), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (298, 308), False, 'import os\n'), ((3091, 3136), 'torch.tensor', 'tor... |
#!/usr/bin/env python3
# system imports
import argparse
import sys
# obspy imports
from obspy.clients.fdsn import Client
from obspy import read, read_inventory, UTCDateTime
from scipy import signal
from obspy.signal.cross_correlation import correlate, xcorr_max
from obspy.clients.fdsn.header import FDSNNoDataExceptio... | [
"matplotlib.pyplot.ylabel",
"matplotlib.rc",
"sys.exit",
"obspy.core.stream.Stream",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"obspy.signal.cross_correlation.correlate",
"obspy.clients.fdsn.Client",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.savefig",
... | [((573, 678), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Cross correlate sensor streams"""', 'formatter_class': 'SmartFormatter'}), "(description='Cross correlate sensor streams',\n formatter_class=SmartFormatter)\n", (596, 678), False, 'import argparse\n'), ((3255, 3273), 'obspy.... |
import urllib
from cloudbridge.cloud.interfaces.resources import TrafficDirection
from rest_auth.serializers import UserDetailsSerializer
from rest_framework import serializers
from rest_framework.reverse import reverse
from . import models
from . import view_helpers
from .drf_helpers import CustomHyperlinkedIdenti... | [
"rest_framework.serializers.IntegerField",
"rest_framework.serializers.SerializerMethodField",
"rest_framework.serializers.ValidationError",
"rest_framework.serializers.IPAddressField",
"rest_framework.serializers.FileField",
"rest_framework.serializers.CharField",
"urllib.parse.urljoin",
"rest_framew... | [((486, 523), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'read_only': '(True)'}), '(read_only=True)\n', (507, 523), False, 'from rest_framework import serializers\n'), ((535, 572), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'read_only': '(True)'}), '(read_only=Tru... |
# CircuitPlaygroundExpress_LightSensor
# reads the on-board light sensor and graphs the brighness with NeoPixels
import time
from adafruit_circuitplayground.express import cpx
from simpleio import map_range
cpx.pixels.brightness = 0.05
while True:
# light value remaped to pixel position
peak = map_range(cpx... | [
"simpleio.map_range",
"time.sleep"
] | [((307, 342), 'simpleio.map_range', 'map_range', (['cpx.light', '(10)', '(325)', '(0)', '(9)'], {}), '(cpx.light, 10, 325, 0, 9)\n', (316, 342), False, 'from simpleio import map_range\n'), ((534, 550), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (544, 550), False, 'import time\n')] |
"""
Copyright (c) 2019-present NAVER Corp.
MIT License
"""
import os
import sys
import json
import logging
import argparse
import pickle
from tqdm import tqdm
from dataset import read_data, PrefixDataset
from trie import Trie
from metric import calc_rank, calc_partial_rank, mrr_summary, mrl_summary
logging.basicCo... | [
"logging.basicConfig",
"logging.getLogger",
"trie.Trie",
"sys.setrecursionlimit",
"argparse.ArgumentParser",
"metric.mrr_summary",
"metric.calc_partial_rank",
"tqdm.tqdm",
"metric.mrl_summary",
"dataset.PrefixDataset",
"os.path.join",
"json.dumps",
"os.path.isfile",
"os.path.dirname",
"m... | [((305, 415), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=logging.INFO)\n", (324, 415), False, 'import logging\n'), ((420... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 16 18:18:29 2020
@author: xuhuiying
"""
import numpy as np
import matplotlib.pyplot as plt
def plotHistory(history,times,xLabelText,yLabelText,legendText):#画出每个history plot each history
history = np.array(history) #history是二维数组 history is a 2D... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.plot",
"numpy.array"
] | [((273, 290), 'numpy.array', 'np.array', (['history'], {}), '(history)\n', (281, 290), True, 'import numpy as np\n'), ((589, 623), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['xLabelText'], {'fontsize': '(8)'}), '(xLabelText, fontsize=8)\n', (599, 623), True, 'import matplotlib.pyplot as plt\n'), ((629, 663), 'matplotl... |
#!/usr/bin/env python
from VMParser import Parser
from VMCodewriter import CodeWriter
from pathlib import Path
import sys
def processDirectory(inputPath):
fileName = str(inputPath.stem)
myWriter = CodeWriter(fileName)
lines = myWriter.initHeader()
for f in inputPath.glob("*.vm"):
lines += proc... | [
"VMParser.Parser",
"VMCodewriter.CodeWriter",
"pathlib.Path.resolve",
"pathlib.Path"
] | [((207, 227), 'VMCodewriter.CodeWriter', 'CodeWriter', (['fileName'], {}), '(fileName)\n', (217, 227), False, 'from VMCodewriter import CodeWriter\n'), ((393, 410), 'VMParser.Parser', 'Parser', (['inputPath'], {}), '(inputPath)\n', (399, 410), False, 'from VMParser import Parser\n'), ((514, 534), 'VMCodewriter.CodeWrit... |
import inspect
from unittest.mock import Mock
from _pytest.monkeypatch import MonkeyPatch
from rasa.core.policies.ted_policy import TEDPolicy
from rasa.engine.training import fingerprinting
from rasa.nlu.classifiers.diet_classifier import DIETClassifier
from rasa.nlu.selectors.response_selector import ResponseSelector... | [
"rasa.core.policies.ted_policy.TEDPolicy.get_default_config",
"unittest.mock.Mock",
"tests.engine.training.test_components.FingerprintableText"
] | [((2113, 2154), 'unittest.mock.Mock', 'Mock', ([], {'return_value': '"""other implementation"""'}), "(return_value='other implementation')\n", (2117, 2154), False, 'from unittest.mock import Mock\n'), ((500, 530), 'rasa.core.policies.ted_policy.TEDPolicy.get_default_config', 'TEDPolicy.get_default_config', ([], {}), '(... |
"""
Command-line driver example for SMIRKY.
"""
import sys
import string
import time
from optparse import OptionParser # For parsing of command line arguments
import smarty
from openforcefield.utils import utils
import os
import math
import copy
import re
import numpy
from numpy import random
def main():
# Cre... | [
"openforcefield.utils.utils.read_molecules",
"optparse.OptionParser",
"smarty.score_utils.create_plot_file",
"smarty.AtomTyper.read_typelist",
"smarty.parse_odds_file",
"smarty.get_data_filename",
"smarty.FragmentSampler",
"time.time"
] | [((1312, 1368), 'optparse.OptionParser', 'OptionParser', ([], {'usage': 'usage_string', 'version': 'version_string'}), '(usage=usage_string, version=version_string)\n', (1324, 1368), False, 'from optparse import OptionParser\n'), ((7633, 7697), 'openforcefield.utils.utils.read_molecules', 'utils.read_molecules', (['opt... |
from collections import defaultdict, deque
from datetime import datetime
import pandas as pd
import random
import numpy as np
import sys
sys.path.append("..") # Adds higher directory to python modules path.
from common import Label_DbFields, Synthetic_Category_Group_Names, Other_Synthetic_Group_Names, MultiLabel_Group_... | [
"pandas.read_csv",
"common.Labels.copy",
"random.seed",
"datetime.datetime.now",
"collections.defaultdict",
"sys.path.append"
] | [((137, 158), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (152, 158), False, 'import sys\n'), ((344, 359), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (355, 359), False, 'import random\n'), ((623, 636), 'common.Labels.copy', 'Labels.copy', ([], {}), '()\n', (634, 636), False, 'from... |
import os
import cv2
import jpype
import shutil
import weasyprint
from bs4 import BeautifulSoup
jpype.startJVM()
from asposecells.api import *
def generatePDF(XLSXPath, OutPath):
workbook = Workbook(XLSXPath)
workbook.save(f"sheet.html", SaveFormat.HTML)
with open(f'./sheet_files/sheet001.htm') as f:
... | [
"cv2.imwrite",
"bs4.BeautifulSoup",
"weasyprint.HTML",
"shutil.rmtree",
"jpype.startJVM",
"cv2.imread",
"os.remove"
] | [((97, 113), 'jpype.startJVM', 'jpype.startJVM', ([], {}), '()\n', (111, 113), False, 'import jpype\n'), ((356, 393), 'bs4.BeautifulSoup', 'BeautifulSoup', (['htmlDoc', '"""html.parser"""'], {}), "(htmlDoc, 'html.parser')\n", (369, 393), False, 'from bs4 import BeautifulSoup\n'), ((941, 971), 'shutil.rmtree', 'shutil.r... |
#-*- coding: utf8 -*-
# *************************************************************************************************
# Python API for EJDB database library http://ejdb.org
# Copyright (C) 2012-2013 Softmotions Ltd.
#
# This file is part of EJDB.
# EJDB is free software; you can redistribute it and/or modify i... | [
"datetime.datetime.utcnow",
"pyejdb.EJDB",
"io.BytesIO",
"pyejdb.bson.BSON_Regex",
"unittest.main"
] | [((6892, 6907), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6905, 6907), False, 'import unittest\n'), ((1734, 1799), 'pyejdb.EJDB', 'pyejdb.EJDB', (['"""testdb"""', '(pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC)'], {}), "('testdb', pyejdb.DEFAULT_OPEN_MODE | pyejdb.JBOTRUNC)\n", (1745, 1799), False, 'import pye... |
from django.urls import path
from . import views
app_name = 'users'
urlpatterns = [
path('<int:pk>/', views.user_profile, name='user_profile'),
path('messages/<int:pk>/', views.PrivateMessageView.as_view(), name='private_message')
] | [
"django.urls.path"
] | [((90, 148), 'django.urls.path', 'path', (['"""<int:pk>/"""', 'views.user_profile'], {'name': '"""user_profile"""'}), "('<int:pk>/', views.user_profile, name='user_profile')\n", (94, 148), False, 'from django.urls import path\n')] |
#!/usr/bin/env python
def main():
"""Main flow control of vkmz
Read input data into feature objects. Results in dictionaries for samples
and features.
Then, make predictions for features. Features without predictions are removed
by default.
Finally, write results.
"""
from vkmz.ar... | [
"vkmz.read.formulas",
"vkmz.predict.predict",
"vkmz.read.tabular",
"vkmz.write.tabular",
"vkmz.write.generateJson",
"vkmz.read.xcmsTabular",
"vkmz.write.html",
"vkmz.write.json_write",
"vkmz.write.metadata",
"vkmz.write.sql"
] | [((1765, 1787), 'vkmz.write.tabular', 'write.tabular', (['samples'], {}), '(samples)\n', (1778, 1787), True, 'import vkmz.write as write\n'), ((1801, 1828), 'vkmz.write.generateJson', 'write.generateJson', (['samples'], {}), '(samples)\n', (1819, 1828), True, 'import vkmz.write as write\n'), ((1879, 1897), 'vkmz.write.... |
# Generated by Django 2.1 on 2018-09-06 02:03
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('phantomapp', '0008_auto_20180904_2102'),
]
operations = [
migrations.CreateModel(
name='Order',
... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((363, 456), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (379, 456), False, 'from django.db import migrations, models\... |
from sphericalquadpy.levelsymmetric.levelsymmetric import Levelsymmetric
import pytest
def test_levelsymmetric():
Q = Levelsymmetric(order=4)
assert Q.name() == "Levelsymmetric Quadrature"
assert Q.getmaximalorder() == 20
with pytest.raises(Exception):
_ = Levelsymmetric(order=-10)
Q =... | [
"sphericalquadpy.levelsymmetric.levelsymmetric.Levelsymmetric",
"pytest.raises"
] | [((124, 147), 'sphericalquadpy.levelsymmetric.levelsymmetric.Levelsymmetric', 'Levelsymmetric', ([], {'order': '(4)'}), '(order=4)\n', (138, 147), False, 'from sphericalquadpy.levelsymmetric.levelsymmetric import Levelsymmetric\n'), ((321, 342), 'sphericalquadpy.levelsymmetric.levelsymmetric.Levelsymmetric', 'Levelsymm... |
from time import sleep
print('-=-' * 15)
print('Iremos calcular o preço da sua viagem (R$)')
print('-=-' * 15)
distancia = float(input('Qual a distância da viagem?\n>'))
print('CALCULANDO...')
sleep(2)
if distancia <= 200:
preco = distancia * 0.50
print(f'O preço da sua viagem vai custar R${preco:.2f}')
else:... | [
"time.sleep"
] | [((194, 202), 'time.sleep', 'sleep', (['(2)'], {}), '(2)\n', (199, 202), False, 'from time import sleep\n')] |
from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns
from .provider import StripeProvider
urlpatterns = default_urlpatterns(StripeProvider)
| [
"allauth.socialaccount.providers.oauth2.urls.default_urlpatterns"
] | [((128, 163), 'allauth.socialaccount.providers.oauth2.urls.default_urlpatterns', 'default_urlpatterns', (['StripeProvider'], {}), '(StripeProvider)\n', (147, 163), False, 'from allauth.socialaccount.providers.oauth2.urls import default_urlpatterns\n')] |
import torch
import torch.nn as nn
import torchvision.models as models
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
from .build import MODEL_REGISTRY
@MODEL_REGISTRY.register()
class CNNRNN(nn.Module):
def __init__(self, cfg):
super().__init__()
input_dim = 512
... | [
"torch.nn.RNN",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torchvision.models.resnet50",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.cat"
] | [((380, 412), 'torchvision.models.resnet50', 'models.resnet50', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (395, 412), True, 'import torchvision.models as models\n'), ((479, 513), 'torch.nn.Linear', 'nn.Linear', (['out_features', 'input_dim'], {}), '(out_features, input_dim)\n', (488, 513), True, 'import to... |
from os import environ as env
import json
import utils
import utils.aws as aws
import utils.handlers as handlers
def put_record_to_logstream(event: utils.LambdaEvent) -> str:
"""Put a record of source Lambda execution in LogWatch Logs."""
log_group_name = env["REPORT_LOG_GROUP_NAME"]
utils.Log.info("Fet... | [
"json.loads",
"utils.Log.info",
"utils.aws.send_event_to_logstream",
"utils.LambdaContext",
"utils.HandledError",
"utils.LambdaEvent"
] | [((301, 362), 'utils.Log.info', 'utils.Log.info', (['"""Fetching requestPayload and responsePayload"""'], {}), "('Fetching requestPayload and responsePayload')\n", (315, 362), False, 'import utils\n'), ((433, 482), 'utils.Log.info', 'utils.Log.info', (['"""Fetching requestPayload content"""'], {}), "('Fetching requestP... |
import os
from bc import Imitator
import numpy as np
from dataset import Example, Dataset
import utils
#from ale_wrapper import ALEInterfaceWrapper
from evaluator import Evaluator
from pdb import set_trace
import matplotlib.pyplot as plt
#try bmh
plt.style.use('bmh')
def smooth(losses, run=10):
new_losses = []
... | [
"numpy.float",
"matplotlib.pyplot.ylabel",
"evaluator.Evaluator",
"matplotlib.pyplot.xlabel",
"os.path.join",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.legend"
] | [((247, 267), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""bmh"""'], {}), "('bmh')\n", (260, 267), True, 'import matplotlib.pyplot as plt\n'), ((619, 639), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Update"""'], {}), "('Update')\n", (629, 639), True, 'import matplotlib.pyplot as plt\n'), ((648, 666), 'mat... |
from IPython import get_ipython
from IPython.display import display
def is_ipynb():
return type(get_ipython()).__module__.startswith('ipykernel.')
| [
"IPython.get_ipython"
] | [((102, 115), 'IPython.get_ipython', 'get_ipython', ([], {}), '()\n', (113, 115), False, 'from IPython import get_ipython\n')] |
"""Strategic conflict detection Subscription query tests:
- add a few Subscriptions spaced in time and footprints
- query with various combinations of arguments
"""
import datetime
from monitoring.monitorlib.infrastructure import default_scope
from monitoring.monitorlib import scd
from monitoring.monitorlib.scd ... | [
"datetime.datetime.utcnow",
"monitoring.monitorlib.infrastructure.default_scope",
"monitoring.monitorlib.scd.latitude_degrees",
"monitoring.monitorlib.scd.make_circle",
"datetime.timedelta"
] | [((2451, 2474), 'monitoring.monitorlib.infrastructure.default_scope', 'default_scope', (['SCOPE_SC'], {}), '(SCOPE_SC)\n', (2464, 2474), False, 'from monitoring.monitorlib.infrastructure import default_scope\n'), ((2744, 2767), 'monitoring.monitorlib.infrastructure.default_scope', 'default_scope', (['SCOPE_SC'], {}), '... |
# Generated by Django 3.0.4 on 2020-03-27 14:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questionnarie', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='questionnaire',
name='email',
... | [
"django.db.migrations.RemoveField",
"django.db.models.IntegerField"
] | [((230, 294), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""questionnaire"""', 'name': '"""email"""'}), "(model_name='questionnaire', name='email')\n", (252, 294), False, 'from django.db import migrations, models\n'), ((446, 497), 'django.db.models.IntegerField', 'models.IntegerF... |
from django.test import TestCase, Client
from django.urls import reverse
from apps.pages.models import Page
class TestPageView(TestCase):
def setUp(self):
self.client = Client()
Page.objects.create(slug="test_slug")
def test_page_GET(self):
url = reverse("page_app:page", args=["test_... | [
"django.urls.reverse",
"apps.pages.models.Page.objects.create",
"django.test.Client"
] | [((184, 192), 'django.test.Client', 'Client', ([], {}), '()\n', (190, 192), False, 'from django.test import TestCase, Client\n'), ((201, 238), 'apps.pages.models.Page.objects.create', 'Page.objects.create', ([], {'slug': '"""test_slug"""'}), "(slug='test_slug')\n", (220, 238), False, 'from apps.pages.models import Page... |
from sequal.ion import Ion
ax = "ax"
by = "by"
cz = "cz"
# calculate non-labile modifications and yield associated transition
# For example "by" would yield a tuple of "b" and "y" transitions.
def fragment_non_labile(sequence, fragment_type):
for i in range(1, sequence.seq_length, 1):
left = Ion(sequence[... | [
"sequal.ion.Ion"
] | [((805, 865), 'sequal.ion.Ion', 'Ion', (['sequence'], {'fragment_number': 'fragment_number', 'ion_type': '"""Y"""'}), "(sequence, fragment_number=fragment_number, ion_type='Y')\n", (808, 865), False, 'from sequal.ion import Ion\n'), ((307, 370), 'sequal.ion.Ion', 'Ion', (['sequence[:i]'], {'fragment_number': 'i', 'ion_... |
"""
order.py
This module contains classes needed for emulating logistics system. In particular, the following
classes are here:
Item
Vehicle
Order
Location
"""
import copy
from typing import List
class Item:
"""A class used to represent an item for logistics system.
Attributes
----------
name : str... | [
"copy.copy",
"doctest.testmod"
] | [((4981, 4998), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (4996, 4998), False, 'import doctest\n'), ((2730, 2746), 'copy.copy', 'copy.copy', (['items'], {}), '(items)\n', (2739, 2746), False, 'import copy\n')] |
#
# See top-level LICENSE.rst file for Copyright information
#
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from collections import OrderedDict
from ..defs import (task_name_sep, task_state_to_int, task_int_to_state)
from ...util import option_list
from ...io import find... | [
"desiutil.log.get_logger",
"collections.OrderedDict",
"numpy.sum",
"glob.glob"
] | [((2223, 2236), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2234, 2236), False, 'from collections import OrderedDict\n'), ((2860, 2885), 'glob.glob', 'glob.glob', (['template_input'], {}), '(template_input)\n', (2869, 2885), False, 'import sys, re, os, glob\n'), ((3726, 3738), 'desiutil.log.get_logger'... |
# Load in our dependencies
# Forking from http://matplotlib.org/xkcd/examples/showcase/xkcd.html
from matplotlib import pyplot
import numpy
"""
Comments on PRs about style
20 | --------\
| |
| |
| |
| |
1 | \--\
0 | -------
------------------... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xkcd",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"matplotlib.pyplot.title",
"numpy.arange"
] | [((499, 512), 'matplotlib.pyplot.xkcd', 'pyplot.xkcd', ([], {}), '()\n', (510, 512), False, 'from matplotlib import pyplot\n'), ((561, 609), 'matplotlib.pyplot.figure', 'pyplot.figure', (['(1)'], {'figsize': '(600 / dpi, 400 / dpi)'}), '(1, figsize=(600 / dpi, 400 / dpi))\n', (574, 609), False, 'from matplotlib import ... |
import yaml
import json
yaml_list = range(5)
yaml_list.append('string1')
yaml_list.append('string2')
yaml_list.append({})
yaml_list[-1]
{}
yaml_list[-1]['critter1'] = 'hedgehog'
yaml_list[-1]['critter2'] = 'bunny'
yaml_list[-1]['dungeon_levels'] = range(5)
yaml_list.append('list_end')
with open("class1_list.yml", "w"... | [
"json.dump",
"yaml.dump"
] | [((432, 455), 'json.dump', 'json.dump', (['yaml_list', 'f'], {}), '(yaml_list, f)\n', (441, 455), False, 'import json\n'), ((338, 384), 'yaml.dump', 'yaml.dump', (['yaml_list'], {'default_flow_style': '(False)'}), '(yaml_list, default_flow_style=False)\n', (347, 384), False, 'import yaml\n')] |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/SpecimenDefinition
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import typing
from pydantic import Field, root_validator
from pydantic.error_wrappers import ErrorWrapper, ValidationError
from... | [
"pydantic.error_wrappers.ErrorWrapper",
"pydantic.error_wrappers.ValidationError",
"pydantic.errors.NoneIsNotAllowedError",
"pydantic.root_validator",
"pydantic.Field",
"pydantic.errors.MissingError"
] | [((792, 831), 'pydantic.Field', 'Field', (['"""SpecimenDefinition"""'], {'const': '(True)'}), "('SpecimenDefinition', const=True)\n", (797, 831), False, 'from pydantic import Field, root_validator\n'), ((894, 1066), 'pydantic.Field', 'Field', (['None'], {'alias': '"""collection"""', 'title': '"""Specimen collection pro... |
import logging
from typing import Dict, List, Tuple, Union
import numpy as np
import torch
import torch.nn.functional as F
from networkx import DiGraph
from torch import Tensor, nn as nn
from torch.autograd.variable import Variable
from binlin.data.ud import index_data
from binlin.model.nn_utils import get_embed_matr... | [
"logging.getLogger",
"torch.nn.functional.leaky_relu",
"binlin.utils.combinatorics.flatten_nested_lists",
"torch.bmm",
"torch.LongTensor",
"torch.sigmoid",
"numpy.asarray",
"torch.from_numpy",
"binlin.model.nn_utils.pad_seq",
"torch.nn.Linear",
"binlin.data.ud.index_data",
"torch.FloatTensor",... | [((552, 577), 'logging.getLogger', 'logging.getLogger', (['"""main"""'], {}), "('main')\n", (569, 577), False, 'import logging\n'), ((1419, 1475), 'torch.nn.Linear', 'nn.Linear', (['self._dim_emb_proj_in', 'self._dim_emb_proj_out'], {}), '(self._dim_emb_proj_in, self._dim_emb_proj_out)\n', (1428, 1475), True, 'from tor... |
from plotter import load_data
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Stampa il dataframe passatogli come istogramma
def plot_coordinata(data: pd.DataFrame, coordinata: str, alpha_value=1.0, title="Grafico 1"):
data = data[[coordinata,'color']]
rosse = data[data['color'] == ... | [
"pandas.concat",
"plotter.load_data",
"matplotlib.pyplot.show"
] | [((1163, 1184), 'plotter.load_data', 'load_data', (['"""data.csv"""'], {}), "('data.csv')\n", (1172, 1184), False, 'from plotter import load_data\n'), ((1552, 1562), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1560, 1562), True, 'import matplotlib.pyplot as plt\n'), ((1220, 1242), 'plotter.load_data', 'loa... |
import pytest
@pytest.mark.order(4)
def test_four():
pass
@pytest.mark.order(3)
def test_three():
pass
| [
"pytest.mark.order"
] | [((17, 37), 'pytest.mark.order', 'pytest.mark.order', (['(4)'], {}), '(4)\n', (34, 37), False, 'import pytest\n'), ((67, 87), 'pytest.mark.order', 'pytest.mark.order', (['(3)'], {}), '(3)\n', (84, 87), False, 'import pytest\n')] |
## This script will define the functions used in the locate lane lines pipeline
## The end of this script will process a video file to locate and plot the lane lines
import pickle
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from moviepy.editor import VideoFileClip
imp... | [
"cv2.rectangle",
"numpy.polyfit",
"numpy.hstack",
"matplotlib.image.imread",
"numpy.array",
"cv2.warpPerspective",
"sys.exit",
"matplotlib.pyplot.imshow",
"numpy.mean",
"numpy.where",
"numpy.delete",
"matplotlib.pyplot.plot",
"cv2.undistort",
"numpy.max",
"cv2.addWeighted",
"numpy.lins... | [((666, 726), 'cv2.undistort', 'cv2.undistort', (['img_RGB_in', 'cam_mtx', 'dist_coef', 'None', 'cam_mtx'], {}), '(img_RGB_in, cam_mtx, dist_coef, None, cam_mtx)\n', (679, 726), False, 'import cv2\n'), ((795, 838), 'matplotlib.image.imread', 'mpimg.imread', (['"""camera_cal/calibration1.jpg"""'], {}), "('camera_cal/cal... |
# coding=utf-8
# Copyright 2022 The Uncertainty Baselines 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 ap... | [
"multiwoz_synth_tmpl.get_config"
] | [((881, 952), 'multiwoz_synth_tmpl.get_config', 'tmpl.get_config', ([], {'shared_bert_embedding': '(True)', 'bert_embedding_type': '"""base"""'}), "(shared_bert_embedding=True, bert_embedding_type='base')\n", (896, 952), True, 'import multiwoz_synth_tmpl as tmpl\n')] |
from typing import List
from wai.json.object import StrictJSONObject
from wai.json.object.property import ArrayProperty, OneOfProperty, BoolProperty
from .field import *
from .logical import *
from ._FilterExpression import FilterExpression
from ._OrderBy import OrderBy
class FilterSpec(StrictJSONObject['FilterSpec... | [
"wai.json.object.property.BoolProperty"
] | [((1136, 1178), 'wai.json.object.property.BoolProperty', 'BoolProperty', ([], {'optional': '(True)', 'default': '(False)'}), '(optional=True, default=False)\n', (1148, 1178), False, 'from wai.json.object.property import ArrayProperty, OneOfProperty, BoolProperty\n')] |
# encoding: utf-8
# flake8: noqa
from sdsstools import get_package_version
NAME = "sdss-basecam"
__version__ = get_package_version(__file__, "sdss-basecam") or "dev"
from .camera import *
from .events import *
from .exceptions import *
from .exposure import *
from .notifier import *
| [
"sdsstools.get_package_version"
] | [((115, 160), 'sdsstools.get_package_version', 'get_package_version', (['__file__', '"""sdss-basecam"""'], {}), "(__file__, 'sdss-basecam')\n", (134, 160), False, 'from sdsstools import get_package_version\n')] |
import math
import random
from typing import Tuple
import cv2
import numpy as np
def np_free_form_mask(
max_vertex: int, max_length: int, max_brush_width: int, max_angle: int, height: int, width: int
) -> np.ndarray:
mask = np.zeros((height, width), np.float32)
num_vertex = random.randint(0, max_vertex)... | [
"numpy.minimum",
"cv2.line",
"math.radians",
"cv2.circle",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"random.random",
"random.randint"
] | [((235, 272), 'numpy.zeros', 'np.zeros', (['(height, width)', 'np.float32'], {}), '((height, width), np.float32)\n', (243, 272), True, 'import numpy as np\n'), ((291, 320), 'random.randint', 'random.randint', (['(0)', 'max_vertex'], {}), '(0, max_vertex)\n', (305, 320), False, 'import random\n'), ((335, 364), 'random.r... |
from django.db import models
from django.db.models import Count, F, Max
from binder.models import BinderModel
class Caretaker(BinderModel):
name = models.TextField()
last_seen = models.DateTimeField(null=True, blank=True)
# We have the ssn for each caretaker. We have to make sure that nobody can access this ssn in... | [
"django.db.models.TextField",
"django.db.models.Count",
"django.db.models.F",
"django.db.models.DateTimeField",
"django.db.models.Max"
] | [((149, 167), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (165, 167), False, 'from django.db import models\n'), ((181, 224), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'null': '(True)', 'blank': '(True)'}), '(null=True, blank=True)\n', (201, 224), False, 'from django.db impo... |
import threading
# Create threads for each SSH connection
def create_threads(list, function):
threads = []
for ip in list:
th = threading.Thread(target = function, args = (ip,))
th.start()
threads.append(th)
for th in threads:
th.join() | [
"threading.Thread"
] | [((147, 192), 'threading.Thread', 'threading.Thread', ([], {'target': 'function', 'args': '(ip,)'}), '(target=function, args=(ip,))\n', (163, 192), False, 'import threading\n')] |
import cv2
from darkflow.net.build import TFNet
import numpy as np
import glob
import matplotlib.pyplot as plt
options = {
'model': 'cfg/yolo-v2.cfg',
'load':8375,
'gpu':0.8,
'threshold':0.1
}
count = 1
tfnet = TFNet(options)
color = [0, 255, 0]
files_path = glob.glob('data_from_imd' + "\\*.jpg")
for file in files_path... | [
"darkflow.net.build.TFNet",
"glob.glob",
"cv2.imread"
] | [((211, 225), 'darkflow.net.build.TFNet', 'TFNet', (['options'], {}), '(options)\n', (216, 225), False, 'from darkflow.net.build import TFNet\n'), ((259, 297), 'glob.glob', 'glob.glob', (["('data_from_imd' + '\\\\*.jpg')"], {}), "('data_from_imd' + '\\\\*.jpg')\n", (268, 297), False, 'import glob\n'), ((388, 422), 'cv2... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class WeiboVMblogsItem(scrapy.Item):
domain = scrapy.Field()
uid = scrapy.Field()
mblog_id = scrapy.Field()
mblog_content = scrapy.Field... | [
"scrapy.Field"
] | [((218, 232), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (230, 232), False, 'import scrapy\n'), ((243, 257), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (255, 257), False, 'import scrapy\n'), ((273, 287), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (285, 287), False, 'import scrapy\n'), ((308, 322), ... |
from django import forms
from app.models import Application, Owner, Questionnaire, Tag, Rule, TagType
from crispy_forms.bootstrap import Field
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Submit, ButtonHolder, Fieldset, Hidden, HTML
class ApplicationForm(forms.ModelForm):
cl... | [
"crispy_forms.bootstrap.Field",
"crispy_forms.helper.FormHelper"
] | [((1453, 1469), 'crispy_forms.helper.FormHelper', 'FormHelper', (['self'], {}), '(self)\n', (1463, 1469), False, 'from crispy_forms.helper import FormHelper\n'), ((1641, 1666), 'crispy_forms.bootstrap.Field', 'Field', (['"""application_name"""'], {}), "('application_name')\n", (1646, 1666), False, 'from crispy_forms.bo... |
# encoding: utf-8
import os
from website import settings
WATERBUTLER_CREDENTIALS = {
'storage': {}
}
WATERBUTLER_SETTINGS = {
'storage': {
'provider': 'filesystem',
'folder': os.path.join(settings.BASE_PATH, 'osfstoragecache'),
}
}
WATERBUTLER_RESOURCE = 'folder'
DISK_SAVING_MODE = se... | [
"os.path.join"
] | [((204, 255), 'os.path.join', 'os.path.join', (['settings.BASE_PATH', '"""osfstoragecache"""'], {}), "(settings.BASE_PATH, 'osfstoragecache')\n", (216, 255), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# Copyright (c) 2015-2019 Analog Devices, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
... | [
"numpy.convolve",
"matplotlib.pyplot.grid",
"numpy.ones",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.axis",
"numpy.max",
"numpy.sum",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"scipy.signal.freqz",
"matplotlib.pyplot.show... | [((3234, 3248), 'numpy.ones', 'np.ones', (['osr50'], {}), '(osr50)\n', (3241, 3248), True, 'import numpy as np\n'), ((3260, 3274), 'numpy.ones', 'np.ones', (['osr60'], {}), '(osr60)\n', (3267, 3274), True, 'import numpy as np\n'), ((3320, 3351), 'numpy.convolve', 'np.convolve', (['sinc1_50', 'sinc1_50'], {}), '(sinc1_5... |
# Generated by Django 3.2 on 2021-06-16 16:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('adminweb', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='profissional',
name='cep',
... | [
"django.db.models.CharField"
] | [((327, 357), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(8)'}), '(max_length=8)\n', (343, 357), False, 'from django.db import migrations, models\n')] |
from .models import Input, Output, InputToOutput, Device
from rest_framework import serializers
from taggit_serializer.serializers import (TagListSerializerField, TaggitSerializer)
from taggit.models import Tag
class DeviceSerializer(serializers.ModelSerializer):
class Meta:
model = Device
fields ... | [
"rest_framework.serializers.SerializerMethodField",
"taggit_serializer.serializers.TagListSerializerField",
"rest_framework.serializers.ReadOnlyField"
] | [((506, 533), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {}), '()\n', (531, 533), False, 'from rest_framework import serializers\n'), ((545, 569), 'taggit_serializer.serializers.TagListSerializerField', 'TagListSerializerField', ([], {}), '()\n', (567, 569), False, 'from taggit_serial... |
"""
"""
import support
support.compileJPythonc("test256a.py", core=1, jar="test256.jar", output="test256.err")
#raise support.TestError("" + `x`)
| [
"support.compileJPythonc"
] | [((26, 118), 'support.compileJPythonc', 'support.compileJPythonc', (['"""test256a.py"""'], {'core': '(1)', 'jar': '"""test256.jar"""', 'output': '"""test256.err"""'}), "('test256a.py', core=1, jar='test256.jar', output=\n 'test256.err')\n", (49, 118), False, 'import support\n')] |
import json
from pathlib import Path
from typing import Any, Dict
from git import Repo
from cruft.exceptions import CruftAlreadyPresent, NoCruftFound
CruftState = Dict[str, Any]
#######################
# Cruft related utils #
#######################
def get_cruft_file(project_dir_path: Path, exists: bool = True)... | [
"cruft.exceptions.CruftAlreadyPresent",
"json.dumps"
] | [((1206, 1283), 'json.dumps', 'json.dumps', (['cruft_state'], {'ensure_ascii': '(False)', 'indent': '(2)', 'separators': "(',', ': ')"}), "(cruft_state, ensure_ascii=False, indent=2, separators=(',', ': '))\n", (1216, 1283), False, 'import json\n'), ((438, 469), 'cruft.exceptions.CruftAlreadyPresent', 'CruftAlreadyPres... |
"""Main entrypoint for the repobee CLI application.
.. module:: main
:synopsis: Main entrypoint for the repobee CLI application.
.. moduleauthor:: <NAME>
"""
import argparse
import contextlib
import io
import logging
import os
import pathlib
import sys
from typing import List, Optional, Union, Mapping
from types... | [
"_repobee.plugin.initialize_default_plugins",
"_repobee.plugin.initialize_dist_plugins",
"repobee_plug.log.exception",
"pathlib.Path",
"_repobee.plugin.initialize_plugins",
"repobee_plug.log.debug",
"_repobee.plugin.register_plugins",
"os.chdir",
"repobee_plug.echo",
"repobee_plug.log.error",
"_... | [((2572, 2597), 'pathlib.Path', 'pathlib.Path', (['config_file'], {}), '(config_file)\n', (2584, 2597), False, 'import pathlib\n'), ((6523, 6569), 'repobee_plug.log.debug', 'plug.log.debug', (['"""Initializing default plugins"""'], {}), "('Initializing default plugins')\n", (6537, 6569), True, 'import repobee_plug as p... |
# Copyright (c) 2014 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
import eslint
from py_vulcanize import strip_js_comments
from catapult_build import parse_html
class JSChecker(object):
def __init__(sel... | [
"catapult_build.parse_html.BeautifulSoup",
"re.match",
"py_vulcanize.strip_js_comments.StripJSComments"
] | [((2617, 2651), 'catapult_build.parse_html.BeautifulSoup', 'parse_html.BeautifulSoup', (['contents'], {}), '(contents)\n', (2641, 2651), False, 'from catapult_build import parse_html\n'), ((2952, 3001), 're.match', 're.match', (['"""^(.*?);"""', 'stripped_contents', 're.DOTALL'], {}), "('^(.*?);', stripped_contents, re... |
import enum
from django.db import models
from care.facility.models import FacilityBaseModel
from care.users.models import User
from django.contrib.postgres.fields import JSONField
class Notification(FacilityBaseModel):
class EventType(enum.Enum):
SYSTEM_GENERATED = 50
CUSTOM_MESSAGE = 100
E... | [
"django.contrib.postgres.fields.JSONField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField"
] | [((1205, 1313), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.SET_NULL', 'null': '(True)', 'related_name': '"""notification_intended_for"""'}), "(User, on_delete=models.SET_NULL, null=True, related_name=\n 'notification_intended_for')\n", (1222, 1313), False, 'from django.db im... |
from selenium import webdriver
from selenium import *
def start():
return webdriver.Chrome(executable_path='./services/chromedriver')
if __name__ == "__main__":
pass
| [
"selenium.webdriver.Chrome"
] | [((79, 138), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': '"""./services/chromedriver"""'}), "(executable_path='./services/chromedriver')\n", (95, 138), False, 'from selenium import webdriver\n')] |
import numpy as np
def calculate_iou(bboxes1, bboxes2):
"""
This calculates the intersection over union of N bounding boxes
in the form N x [left, top, right, bottom], e.g for N=2:
>> bb = [[21,34,45,67], [67,120, 89, 190]]
:param bboxes1: np array: N x 4 ground truth bounding boxes
:param bb... | [
"numpy.clip",
"numpy.maximum",
"numpy.minimum"
] | [((770, 810), 'numpy.maximum', 'np.maximum', (['bboxes1[:, 0]', 'bboxes2[:, 0]'], {}), '(bboxes1[:, 0], bboxes2[:, 0])\n', (780, 810), True, 'import numpy as np\n'), ((834, 874), 'numpy.maximum', 'np.maximum', (['bboxes1[:, 1]', 'bboxes2[:, 1]'], {}), '(bboxes1[:, 1], bboxes2[:, 1])\n', (844, 874), True, 'import numpy ... |
from __future__ import print_function, unicode_literals
import os
from datetime import timedelta
import multiuploader.default_settings as DEFAULTS
from django.conf import settings
from django.core.management.base import BaseCommand
from django.utils.timezone import now
from multiuploader.models import MultiuploaderFi... | [
"django.utils.timezone.now",
"datetime.timedelta",
"os.remove",
"multiuploader.models.MultiuploaderFile.objects.filter"
] | [((725, 789), 'multiuploader.models.MultiuploaderFile.objects.filter', 'MultiuploaderFile.objects.filter', ([], {'upload_date__lt': 'time_threshold'}), '(upload_date__lt=time_threshold)\n', (757, 789), False, 'from multiuploader.models import MultiuploaderFile\n'), ((659, 664), 'django.utils.timezone.now', 'now', ([], ... |
import unittest
from app.models import Source
class testSource(unittest.TestCase):
"""
SourcesTest class to test the behavior of the Sources class
"""
def setUp(self):
"""
Method that runs before each other test runs
"""
self.new_source = Source('abc-news','ABC news','Yo... | [
"unittest.main",
"app.models.Source"
] | [((525, 540), 'unittest.main', 'unittest.main', ([], {}), '()\n', (538, 540), False, 'import unittest\n'), ((288, 412), 'app.models.Source', 'Source', (['"""abc-news"""', '"""ABC news"""', '"""Your trusted source for breaking news"""', '"""https://abcnews.go.com"""', '"""general"""', '"""en"""', '"""us"""'], {}), "('ab... |
import psycopg2
from psycopg2.extensions import ISOLATION_LEVEL_AUTOCOMMIT
import os
import urllib.parse as urlparse
class PostgresBaseManager:
def __init__(self,local):
self.database = 'postgres'
self.user = 'postgres'
self.password = '<PASSWORD>'
self.host = 'localhost'
... | [
"psycopg2.connect"
] | [((1544, 1661), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': 'self.database', 'user': 'self.user', 'password': 'self.password', 'host': 'self.host', 'port': 'self.port'}), '(database=self.database, user=self.user, password=self.\n password, host=self.host, port=self.port)\n', (1560, 1661), False, 'impor... |
#!/usr/bin/env python
import setpath
from bike.testutils import *
from bike.transformer.save import save
from moveToModule import *
class TestMoveClass(BRMTestCase):
def test_movesTheText(self):
src1=trimLines("""
def before(): pass
class TheClass:
pass
def after(): pas... | [
"bike.transformer.save.save"
] | [((704, 710), 'bike.transformer.save.save', 'save', ([], {}), '()\n', (708, 710), False, 'from bike.transformer.save import save\n'), ((1792, 1798), 'bike.transformer.save.save', 'save', ([], {}), '()\n', (1796, 1798), False, 'from bike.transformer.save import save\n'), ((3076, 3082), 'bike.transformer.save.save', 'sav... |
import _ast
import ast
from typing import Dict, Union
import os
from pychecktext import teamcity, teamcity_messages
class CheckTextVisitor(ast.NodeVisitor):
def __init__(self, aliases: Dict[str, str] = {}):
self.literal_calls = []
self.expression_calls = []
self.aliases = aliases
s... | [
"ast.parse",
"ast.get_source_segment",
"pychecktext.teamcity_messages.customMessage",
"os.walk"
] | [((2994, 3014), 'os.walk', 'os.walk', (['folder_path'], {}), '(folder_path)\n', (3001, 3014), False, 'import os\n'), ((3708, 3723), 'ast.parse', 'ast.parse', (['data'], {}), '(data)\n', (3717, 3723), False, 'import ast\n'), ((2546, 2586), 'ast.get_source_segment', 'ast.get_source_segment', (['source', 'call_arg'], {}),... |
import discord
from discord.ext import commands
import os
from .player import Player
from extra.menu import ConfirmSkill
import os
from datetime import datetime
bots_and_commands_channel_id = int(os.getenv('BOTS_AND_COMMANDS_CHANNEL_ID'))
class Agares(Player):
emoji = '<:Agares:839497855621660693>'
def __i... | [
"datetime.datetime.utcfromtimestamp",
"extra.menu.ConfirmSkill",
"os.getenv",
"discord.Color.green",
"discord.ext.commands.command"
] | [((197, 238), 'os.getenv', 'os.getenv', (['"""BOTS_AND_COMMANDS_CHANNEL_ID"""'], {}), "('BOTS_AND_COMMANDS_CHANNEL_ID')\n", (206, 238), False, 'import os\n'), ((709, 741), 'discord.ext.commands.command', 'commands.command', ([], {'aliases': "['ma']"}), "(aliases=['ma'])\n", (725, 741), False, 'from discord.ext import c... |
# -*- coding: utf-8 -*-
#
import pytest
import optimesh
from helpers import download_mesh
@pytest.mark.parametrize(
"options",
[
["--method", "cpt-dp"],
["--method", "cpt-uniform-fp"],
["--method", "cpt-uniform-qn"],
#
["--method", "cvt-uniform-lloyd"],
["--me... | [
"pytest.mark.parametrize",
"optimesh.cli.info",
"helpers.download_mesh",
"optimesh.cli.main"
] | [((95, 504), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""options"""', "[['--method', 'cpt-dp'], ['--method', 'cpt-uniform-fp'], ['--method',\n 'cpt-uniform-qn'], ['--method', 'cvt-uniform-lloyd'], ['--method',\n 'cvt-uniform-lloyd', '--omega', '2.0'], ['--method', 'cvt-uniform-qnb'],\n ['--meth... |
from unittest import TestCase
from bavard_ml_utils.gcp.gcs import GCSClient
from test.utils import DirSpec, FileSpec
class TestGCSClient(TestCase):
test_data_spec = DirSpec(
path="gcs-test",
children=[
FileSpec(path="test-file.txt", content="This is a test."),
FileSpec(pat... | [
"bavard_ml_utils.gcp.gcs.GCSClient",
"test.utils.FileSpec",
"test.utils.DirSpec.from_path"
] | [((639, 650), 'bavard_ml_utils.gcp.gcs.GCSClient', 'GCSClient', ([], {}), '()\n', (648, 650), False, 'from bavard_ml_utils.gcp.gcs import GCSClient\n'), ((1724, 1758), 'test.utils.DirSpec.from_path', 'DirSpec.from_path', (['"""gcs-test-copy"""'], {}), "('gcs-test-copy')\n", (1741, 1758), False, 'from test.utils import ... |
from fim_mission import *
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import torch.optim as optim
from torch.optim import lr_scheduler
import torchvision.transforms as transforms
from torchvision import datasets, models
import matplo... | [
"tensorboardX.SummaryWriter",
"torch.cuda.is_available",
"matplotlib.pyplot.ion",
"warnings.filterwarnings",
"torchvision.models.resnet50"
] | [((484, 493), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (491, 493), True, 'import matplotlib.pyplot as plt\n'), ((514, 547), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (537, 547), False, 'import warnings\n'), ((702, 717), 'tensorboardX.SummaryWriter', 'Summ... |
import subprocess
import socket
import redis
import time
import os
import os.path
import sys
import warnings
import random
REDIS_DEBUGGER = os.environ.get('REDIS_DEBUGGER', None)
REDIS_SHOW_OUTPUT = int(os.environ.get(
'REDIS_VERBOSE', 1 if REDIS_DEBUGGER else 0))
def get_random_port():
while True:
... | [
"redis.StrictRedis.__init__",
"socket.socket",
"random.randrange",
"subprocess.Popen",
"os.environ.get",
"time.sleep",
"os.unlink",
"warnings.warn",
"time.time"
] | [((141, 179), 'os.environ.get', 'os.environ.get', (['"""REDIS_DEBUGGER"""', 'None'], {}), "('REDIS_DEBUGGER', None)\n", (155, 179), False, 'import os\n'), ((204, 263), 'os.environ.get', 'os.environ.get', (['"""REDIS_VERBOSE"""', '(1 if REDIS_DEBUGGER else 0)'], {}), "('REDIS_VERBOSE', 1 if REDIS_DEBUGGER else 0)\n", (2... |
'''Contains DiscoAutoscale class that orchestrates AWS Autoscaling'''
import logging
import random
import boto
import boto.ec2
import boto.ec2.autoscale
import boto.ec2.autoscale.launchconfig
import boto.ec2.autoscale.group
from boto.ec2.autoscale.policy import ScalingPolicy
from boto.exception import BotoServerError
... | [
"boto3.client",
"logging.debug",
"random.randrange",
"boto.ec2.autoscale.launchconfig.LaunchConfiguration",
"boto.ec2.autoscale.Tag",
"boto.ec2.autoscale.AutoScaleConnection",
"logging.info",
"boto.ec2.autoscale.policy.ScalingPolicy"
] | [((3822, 3923), 'boto.ec2.autoscale.launchconfig.LaunchConfiguration', 'boto.ec2.autoscale.launchconfig.LaunchConfiguration', (['*args'], {'connection': 'self.connection'}), '(*args, connection=self.\n connection, **kwargs)\n', (3873, 3923), False, 'import boto\n'), ((11526, 11668), 'boto.ec2.autoscale.policy.Scalin... |
""" RealDolos' funky volafile upload tool"""
# pylint: disable=broad-except
import math
import re
import sys
# pylint: disable=no-name-in-module
try:
from os import posix_fadvise, POSIX_FADV_WILLNEED
except ImportError:
def posix_fadvise(*args, **kw):
"""Mock implementation for systems not supporting... | [
"re.split"
] | [((585, 608), 're.split', 're.split', (['"""(\\\\d+)"""', 'val'], {}), "('(\\\\d+)', val)\n", (593, 608), False, 'import re\n')] |
import os
from os import path, environ
from configparser import ConfigParser
from collections import OrderedDict
class Config(object):
"""
This class will take care of ConfigParser and writing / reading the
configuration.
TODO: What to do when there are more variables to be configured? Should we
... | [
"os.path.exists",
"collections.OrderedDict",
"configparser.ConfigParser",
"os.makedirs",
"os.environ.get",
"os.path.isfile",
"os.path.dirname",
"os.path.expanduser"
] | [((601, 644), 'os.environ.get', 'environ.get', (['"""TMC_CONFIGFILE"""', 'default_path'], {}), "('TMC_CONFIGFILE', default_path)\n", (612, 644), False, 'from os import path, environ\n'), ((1059, 1072), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1070, 1072), False, 'from collections import OrderedDict\... |
import h5py
import numpy as np
from code.model import UNetClassifier
def load_dataset(covid_file_path, normal_file_path):
covid = h5py.File(covid_file_path, 'r')['covid']
normal = h5py.File(normal_file_path, 'r')['normal']
all_images = np.expand_dims(np.concatenate([covid, normal]), axis=3)
all_labe... | [
"numpy.arange",
"numpy.concatenate",
"h5py.File"
] | [((325, 386), 'numpy.concatenate', 'np.concatenate', (['[[1] * covid.shape[0], [0] * normal.shape[0]]'], {}), '([[1] * covid.shape[0], [0] * normal.shape[0]])\n', (339, 386), True, 'import numpy as np\n'), ((137, 168), 'h5py.File', 'h5py.File', (['covid_file_path', '"""r"""'], {}), "(covid_file_path, 'r')\n", (146, 168... |
from app import app
from flask import render_template, flash, redirect, url_for
from app.forms import LoginForm
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html')
@app.route('/contato', methods=['GET','POST'])
def contato():
form = LoginForm()
if form.validate_on_submit... | [
"flask.render_template",
"app.forms.LoginForm",
"flask.flash",
"flask.redirect",
"app.app.route"
] | [((114, 128), 'app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (123, 128), False, 'from app import app\n'), ((130, 149), 'app.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (139, 149), False, 'from app import app\n'), ((206, 252), 'app.app.route', 'app.route', (['"""/contato"""'], {'methods... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"warnings.warn",
"pulumi.log.warn",
"pulumi.ResourceOptions"
] | [((21095, 21131), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""additionalInfo"""'}), "(name='additionalInfo')\n", (21108, 21131), False, 'import pulumi\n'), ((21551, 21604), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""additionalPrimarySecurityGroups"""'}), "(name='additionalPrimarySecurityGroups')\n", (2... |
# MIT License
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | [
"random.shuffle",
"re.compile",
"collections.defaultdict",
"random.random",
"toposort.toposort"
] | [((1288, 1322), 're.compile', 're.compile', (['"""^-?(\\\\d)+(\\\\.\\\\d+)?$"""'], {}), "('^-?(\\\\d)+(\\\\.\\\\d+)?$')\n", (1298, 1322), False, 'import re\n'), ((1340, 1370), 're.compile', 're.compile', (['"""^([A-Z]+_)+\\\\d+$"""'], {}), "('^([A-Z]+_)+\\\\d+$')\n", (1350, 1370), False, 'import re\n'), ((1390, 1411), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import string
from collections import Counter
import numpy as np
import theano
import theano.tensor as T
punctuation = set(string.punctuation)
punctuation.add('\n')
punctuation.add('\t')
punctuation.add(u'’')
punctuation.add(u'‘')
punctuation.add(u'“')
punctuation.add(u'”... | [
"numpy.clip",
"numpy.unique",
"numpy.asarray",
"numpy.max",
"numpy.argsort",
"numpy.percentile"
] | [((1789, 1802), 'numpy.asarray', 'np.asarray', (['Y'], {}), '(Y)\n', (1799, 1802), True, 'import numpy as np\n'), ((1582, 1595), 'numpy.argsort', 'np.argsort', (['v'], {}), '(v)\n', (1592, 1595), True, 'import numpy as np\n'), ((417, 430), 'numpy.asarray', 'np.asarray', (['X'], {}), '(X)\n', (427, 430), True, 'import n... |
import pickle
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal
import pytest
from oddt.scoring.models import classifiers, regressors
@pytest.mark.filterwarnings('ignore:Stochastic Optimizer')
@pytest.mark.parametrize('cls',
[classifiers.svm(probabil... | [
"oddt.scoring.models.regressors.randomforest",
"numpy.testing.assert_array_almost_equal",
"pytest.mark.filterwarnings",
"numpy.ones",
"oddt.scoring.models.regressors.neuralnetwork",
"pickle.dumps",
"numpy.log",
"oddt.scoring.models.classifiers.neuralnetwork",
"oddt.scoring.models.regressors.svm",
... | [((180, 237), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore:Stochastic Optimizer"""'], {}), "('ignore:Stochastic Optimizer')\n", (206, 237), False, 'import pytest\n'), ((559, 577), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (573, 577), True, 'import numpy as np\n'), ((71... |
from google.appengine.ext import ndb
class Collaborator(ndb.Model):
"""
Represents collab relationship at events
Notifications will only be sent if both the
sender and receiver have shared with each other
"""
srcUserId = ndb.StringProperty(required=True)
dstUserId = ndb.StringProperty(req... | [
"google.appengine.ext.ndb.DateTimeProperty",
"google.appengine.ext.ndb.BooleanProperty",
"google.appengine.ext.ndb.StringProperty"
] | [((248, 281), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {'required': '(True)'}), '(required=True)\n', (266, 281), False, 'from google.appengine.ext import ndb\n'), ((298, 331), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {'required': '(True)'}), '(required=True)\n',... |
from graphene import Int
from .decorators import require_authenication
class PrimaryKeyMixin(object):
pk = Int(source='pk')
class LoginRequiredMixin(object):
@classmethod
@require_authenication(info_position=1)
def get_node(cls, info, id):
return super(LoginRequiredMixin, cls).get_node(inf... | [
"graphene.Int"
] | [((114, 130), 'graphene.Int', 'Int', ([], {'source': '"""pk"""'}), "(source='pk')\n", (117, 130), False, 'from graphene import Int\n')] |
#Tests that blocks can't have multiple verification packets for the same transaction.
from typing import Dict, Any
import json
from pytest import raises
from e2e.Libs.Minisketch import Sketch
from e2e.Classes.Transactions.Data import Data
from e2e.Classes.Consensus.VerificationPacket import VerificationPacket
from e... | [
"e2e.Meros.Liver.Liver",
"e2e.Libs.Minisketch.Sketch.hash",
"e2e.Tests.Errors.SuccessError",
"e2e.Classes.Merit.Blockchain.Blockchain",
"e2e.Classes.Merit.Blockchain.Block.fromJSON",
"pytest.raises",
"e2e.Classes.Transactions.Data.Data.fromJSON",
"e2e.Tests.Errors.TestError",
"e2e.Meros.Meros.Messag... | [((649, 661), 'e2e.Classes.Merit.Blockchain.Blockchain', 'Blockchain', ([], {}), '()\n', (659, 661), False, 'from e2e.Classes.Merit.Blockchain import Block, Blockchain\n'), ((811, 841), 'e2e.Classes.Transactions.Data.Data.fromJSON', 'Data.fromJSON', (["vectors['data']"], {}), "(vectors['data'])\n", (824, 841), False, '... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2018年4月17日 @author: encodingl
'''
from django.shortcuts import render
#from dwebsocket.decorators import accept_websocket, require_websocket
from django.http import HttpResponse
import paramiko
from django.contrib.auth.decorators import login_required
... | [
"skaccounts.permission.permission_verify",
"paramiko.AutoAddPolicy",
"django.http.HttpResponse",
"subprocess.Popen",
"django.contrib.auth.decorators.login_required",
"channels.layers.get_channel_layer",
"paramiko.SSHClient",
"asgiref.sync.async_to_sync"
] | [((1162, 1178), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (1176, 1178), False, 'from django.contrib.auth.decorators import login_required\n'), ((1180, 1199), 'skaccounts.permission.permission_verify', 'permission_verify', ([], {}), '()\n', (1197, 1199), False, 'from skaccounts... |
from __future__ import print_function
from django.shortcuts import render
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.contrib.auth import get_user_model
import os
from django.core.mail import send_mail
import nltk
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.st... | [
"django.shortcuts.render",
"django.contrib.auth.get_user_model",
"os.path.exists",
"math.ceil",
"nltk",
"math.floor",
"watson_developer_cloud.SpeechToTextV1",
"nltk.stem.PorterStemmer",
"io.open",
"nltk.tokenize.word_tokenize",
"os.path.dirname",
"os.mkdir",
"json.load",
"os.path.abspath"
... | [((7613, 7629), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (7627, 7629), False, 'from django.contrib.auth import get_user_model\n'), ((1278, 1429), 'watson_developer_cloud.SpeechToTextV1', 'SpeechToTextV1', ([], {'username': '"""80a593b1-5a21-4ea4-adb1-e7218fb5a9fa"""', 'password': '"""<P... |
"""
Test the fits-module by loading a dumped rtfits result and performing
all actions again
"""
import unittest
import numpy as np
import cloudpickle
import matplotlib.pyplot as plt
import copy
import os
class TestDUMPS(unittest.TestCase):
def setUp(self):
self.sig0_dB_path = os.path.dirname(__file__) + ... | [
"cloudpickle.load",
"numpy.allclose",
"numpy.subtract",
"matplotlib.pyplot.close",
"os.path.dirname",
"unittest.main",
"numpy.rad2deg"
] | [((6174, 6189), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6187, 6189), False, 'import unittest\n'), ((521, 543), 'cloudpickle.load', 'cloudpickle.load', (['file'], {}), '(file)\n', (537, 543), False, 'import cloudpickle\n'), ((292, 317), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n... |
from __future__ import annotations
# Standard library
import re
from copy import deepcopy
from dataclasses import dataclass
from typing import Callable, Optional
__all__ = ['NamedEntity', 'NamedEntityList']
@dataclass(frozen=True)
class NamedEntity:
name: str
entity: str
string: str
span: tuple[int... | [
"re.sub",
"dataclasses.dataclass",
"copy.deepcopy"
] | [((213, 235), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (222, 235), False, 'from dataclasses import dataclass\n'), ((916, 930), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (924, 930), False, 'from copy import deepcopy\n'), ((2747, 2785), 're.sub', 're.sub', (['"""... |
from django.utils import timezone
from django.utils.translation import ugettext
from mediane.algorithms.enumeration import get_name_from
from mediane.algorithms.lri.BioConsert import BioConsert
from mediane.algorithms.lri.ExactAlgorithm import ExactAlgorithm
from mediane.algorithms.misc.borda_count import BordaCount
f... | [
"mediane.algorithms.lri.BioConsert.BioConsert",
"mediane.algorithms.misc.borda_count.BordaCount",
"mediane.models.Distance.objects.get",
"mediane.models.Normalization.objects.get",
"django.utils.timezone.now",
"mediane.normalizations.unification.Unification.rankings_to_rankings",
"mediane.median_ranking... | [((1681, 1695), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (1693, 1695), False, 'from django.utils import timezone\n'), ((1103, 1145), 'mediane.normalizations.unification.Unification.rankings_to_rankings', 'Unification.rankings_to_rankings', (['rankings'], {}), '(rankings)\n', (1135, 1145), False, '... |
# Generated by Django 2.2.2 on 2020-05-08 12:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0002_auto_20200508_1115'),
]
operations = [
migrations.AlterField(
model_name='yourorder',
name='phone',
... | [
"django.db.models.CharField"
] | [((338, 380), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'null': '(True)'}), '(max_length=10, null=True)\n', (354, 380), False, 'from django.db import migrations, models\n')] |
"""JSON Schemas."""
import csv
from collections import defaultdict
from datetime import date
from os.path import dirname, join, realpath
from flask import current_app
from marshmallow import Schema, fields
from cd2h_repo_project.modules.records.resource_type import ResourceType
class DataCiteResourceTypeMap(object)... | [
"marshmallow.fields.Method",
"csv.DictReader",
"marshmallow.fields.Nested",
"marshmallow.fields.Str",
"cd2h_repo_project.modules.records.resource_type.ResourceType.get",
"os.path.realpath",
"datetime.date.today"
] | [((1219, 1261), 'marshmallow.fields.Method', 'fields.Method', (['"""get_general_resource_type"""'], {}), "('get_general_resource_type')\n", (1232, 1261), False, 'from marshmallow import Schema, fields\n'), ((1281, 1324), 'marshmallow.fields.Method', 'fields.Method', (['"""get_specific_resource_type"""'], {}), "('get_sp... |
import sys
from copy import deepcopy
mass_file=open('integer_mass_table.txt')
mass_table = {}
for line in mass_file:
aa, mass = line.rstrip().split(' ')
mass_table[int(mass)] = aa
# mass_table[4] = 'X'
# mass_table[5] = 'Z'
def PeptideSequencing(spectral_vector):
spectral_vector = [0] + spectral_vector
... | [
"sys.stdin.read"
] | [((1658, 1674), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1672, 1674), False, 'import sys\n')] |
from django import forms
from django.contrib.auth.forms import UserCreationForm,AuthenticationForm
from django.contrib.auth.models import User
from .models import Profile,Project,Review
class RegForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ('usernam... | [
"django.forms.EmailField",
"django.forms.CharField"
] | [((233, 251), 'django.forms.EmailField', 'forms.EmailField', ([], {}), '()\n', (249, 251), False, 'from django import forms\n'), ((420, 469), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Username"""', 'max_length': '(254)'}), "(label='Username', max_length=254)\n", (435, 469), False, 'from django imp... |
#!/usr/bin/python
#coding = utf-8
import numpy as np
import pandas as pd
import mysql.connector
class mysqlTool():
"""
This is the API to connect with mysql database.
"""
def __init__(self,databaseNameString:str,hostAddress:str,userName:str,passWord:str):
self.targetDB = mysql.connector.connect(
host = hostA... | [
"py2neo.Node",
"sqlalchemy.create_engine",
"numpy.isnan",
"pandas.DataFrame",
"py2neo.Relationship",
"pandas.read_sql"
] | [((946, 1006), 'pandas.DataFrame', 'pd.DataFrame', (['result'], {'columns': 'self.targetCursor.column_names'}), '(result, columns=self.targetCursor.column_names)\n', (958, 1006), True, 'import pandas as pd\n'), ((1689, 1749), 'pandas.DataFrame', 'pd.DataFrame', (['result'], {'columns': 'self.targetCursor.column_names'}... |
"""
NOAA/ESRL/PSD Jython functions
"""
def calcMonAnom(monthly, ltm, normalize=0):
""" Calculate the monthly anomaly from a long term mean.
The number of timesteps in ltm must be 12
"""
from visad import VisADException
monAnom = monthly.clone()
months = len(ltm)
if (not months == 12):
raise VisAD... | [
"visad.util.DataUtility.getSample",
"visad.VisADException",
"visad.DateTime",
"visad.DateTime.getFormatTimeZone"
] | [((1161, 1172), 'visad.DateTime', 'DateTime', (['r'], {}), '(r)\n', (1169, 1172), False, 'from visad import DateTime\n'), ((315, 369), 'visad.VisADException', 'VisADException', (['"""Number of months in ltm must be a 12"""'], {}), "('Number of months in ltm must be a 12')\n", (329, 369), False, 'from visad import VisAD... |
import numpy as np
import random
N = 10
def null(a, rtol=1e-5):
u, s, v = np.linalg.svd(a)
rank = (s > rtol*s[0]).sum()
return rank, v[rank:].T.copy()
def gen_data(N, noisy=False):
lower = -1
upper = 1
dim = 2
X = np.random.rand(dim, N)*(upper-lower)+lower
while True:
Xsa... | [
"numpy.linalg.svd",
"numpy.all",
"numpy.ones",
"numpy.random.rand"
] | [((82, 98), 'numpy.linalg.svd', 'np.linalg.svd', (['a'], {}), '(a)\n', (95, 98), True, 'import numpy as np\n'), ((535, 544), 'numpy.all', 'np.all', (['y'], {}), '(y)\n', (541, 544), True, 'import numpy as np\n'), ((249, 271), 'numpy.random.rand', 'np.random.rand', (['dim', 'N'], {}), '(dim, N)\n', (263, 271), True, 'im... |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
import os
import yaml
from tools.times import timestamp
from config.conf import ELEMENT_PATH, LOCATE_MODE
def inspect_element():
"""审查所有的元素是否正确"""
start_time = timestamp()
for i in os.listdir(ELEMENT_PATH):
_path = os.path.join(ELEMENT_PATH, i)
... | [
"os.listdir",
"os.path.join",
"os.path.isfile",
"yaml.safe_load",
"tools.times.timestamp"
] | [((216, 227), 'tools.times.timestamp', 'timestamp', ([], {}), '()\n', (225, 227), False, 'from tools.times import timestamp\n'), ((241, 265), 'os.listdir', 'os.listdir', (['ELEMENT_PATH'], {}), '(ELEMENT_PATH)\n', (251, 265), False, 'import os\n'), ((1112, 1123), 'tools.times.timestamp', 'timestamp', ([], {}), '()\n', ... |