code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
from typing import List, Optional
import pickle
import numpy as np
from utilities import augment_long_text, tokenize, tokenize_long_text, to_chars, align
from config import Config as cf
PAD = 0 # TODO: choose appropriate index for these special chars
UNK = 1
DEFAULT = {'PAD': PAD, 'UNK': UNK}
DEFAULT_C = {''... | [
"os.path.exists",
"pickle.dump",
"os.makedirs",
"pickle.load",
"utilities.align",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.random.uniform",
"utilities.to_chars",
"numpy.save",
"utilities.tokenize",
"utilities.tokenize_long_text",
"numpy.load"
] | [((6131, 6178), 'utilities.to_chars', 'to_chars', (['answer_toks', 'cf.WORD_LEN', 'cf.PAD_CHAR'], {}), '(answer_toks, cf.WORD_LEN, cf.PAD_CHAR)\n', (6139, 6178), False, 'from utilities import augment_long_text, tokenize, tokenize_long_text, to_chars, align\n'), ((7546, 7590), 'utilities.to_chars', 'to_chars', (['questi... |
# -*- coding: utf-8 -*-
from elasticsearch import Elasticsearch
class ElasticAdapter(object):
""" Abstraction in case we will need to add another or change elastic
driver.
"""
def __init__(self, hosts, **es_params):
self.es = Elasticsearch(hosts, **es_params)
| [
"elasticsearch.Elasticsearch"
] | [((258, 291), 'elasticsearch.Elasticsearch', 'Elasticsearch', (['hosts'], {}), '(hosts, **es_params)\n', (271, 291), False, 'from elasticsearch import Elasticsearch\n')] |
from mcfunction.versions.mc_1_14.loot import loot, ParsedLootCommand
from mcfunction.nodes import EntityNode, PositionNode
def test_loot_spawn():
parsed = loot.parse('loot spawn 0 0 0 kill @e')
parsed: ParsedLootCommand
assert parsed.target_type.value == 'spawn'
assert isinstance(parsed.target, Posi... | [
"mcfunction.versions.mc_1_14.loot.loot.parse"
] | [((162, 200), 'mcfunction.versions.mc_1_14.loot.loot.parse', 'loot.parse', (['"""loot spawn 0 0 0 kill @e"""'], {}), "('loot spawn 0 0 0 kill @e')\n", (172, 200), False, 'from mcfunction.versions.mc_1_14.loot import loot, ParsedLootCommand\n'), ((519, 586), 'mcfunction.versions.mc_1_14.loot.loot.parse', 'loot.parse', (... |
import configparser as parser
import random
class config:
# load the configuration file
def __init__(self, config_filename):
self.load_config(config_filename)
def load_config(self, config_filename):
# create a config parser
config = parser.ConfigParser()
config.optionxform ... | [
"random.choice",
"configparser.ConfigParser"
] | [((271, 292), 'configparser.ConfigParser', 'parser.ConfigParser', ([], {}), '()\n', (290, 292), True, 'import configparser as parser\n'), ((1728, 1747), 'random.choice', 'random.choice', (['node'], {}), '(node)\n', (1741, 1747), False, 'import random\n'), ((1791, 1827), 'random.choice', 'random.choice', (['self.current... |
import numpy
from kapteyn import maputils
from matplotlib.pyplot import show, figure
import csv # Read some poitions from file in Comma Separated Values format
# Some initializations
blankcol = "#334455" # Represent undefined values by this color
epsilon = 0.0000000001
figsize = (9,7) ... | [
"matplotlib.pyplot.figure",
"kapteyn.maputils.FITSimage",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((387, 410), 'matplotlib.pyplot.figure', 'figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (393, 410), False, 'from matplotlib.pyplot import show, figure\n'), ((453, 490), 'kapteyn.maputils.FITSimage', 'maputils.FITSimage', (['"""allsky_raw.fits"""'], {}), "('allsky_raw.fits')\n", (471, 490), False, 'from... |
import sys
import gtk
from datetime import datetime
import gobject
from threading import Thread
class uiSignalHelpers(object):
def __init__(self, *args, **kwargs):
super(uiSignalHelpers, self).__init__(*args, **kwargs)
#print 'signal helpers __init__'
def callback(self, *args, **kwargs):
... | [
"gtk.ImageMenuItem",
"gtk.main_quit",
"gtk.MessageDialog",
"gtkwin32.GTKWin32Ext",
"gtk.Menu",
"gtk.gdk.keyval_name",
"gtk.MenuItem"
] | [((726, 849), 'gtk.MessageDialog', 'gtk.MessageDialog', (['widget', '(gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)', 'gtk.MESSAGE_INFO', 'gtk.BUTTONS_OK', 'message'], {}), '(widget, gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,\n gtk.MESSAGE_INFO, gtk.BUTTONS_OK, message)\n', (743, 849), False, 'import gt... |
import sys
import torch.nn as nn
from torchsummary import summary
from torchvision.models import vgg19, resnet50, densenet161, googlenet, inception_v3
from .MyCNN import MyCNN
def VGG19(all=False):
model = vgg19(pretrained=True)
# 把參數凍結
if all is False:
for param in model.parameters():
... | [
"torchvision.models.vgg19",
"torchvision.models.googlenet",
"torchvision.models.densenet161",
"torchvision.models.inception_v3",
"torch.nn.Linear",
"sys.exit",
"torchsummary.summary",
"torchvision.models.resnet50"
] | [((212, 234), 'torchvision.models.vgg19', 'vgg19', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (217, 234), False, 'from torchvision.models import vgg19, resnet50, densenet161, googlenet, inception_v3\n'), ((503, 521), 'torch.nn.Linear', 'nn.Linear', (['(4096)', '(2)'], {}), '(4096, 2)\n', (512, 521), True, '... |
from selenium import webdriver
from fb_auth import auth
from logger import Logger
def main():
# TODO add possibility to login to different FB accounts (use csv file to store them)
# TODO handle all exceptions especially when account was blocked
# TODO save automatic screenshots from time to time
# TOD... | [
"selenium.webdriver.PhantomJS",
"fb_auth.auth",
"logger.Logger"
] | [((396, 404), 'logger.Logger', 'Logger', ([], {}), '()\n', (402, 404), False, 'from logger import Logger\n'), ((453, 541), 'selenium.webdriver.PhantomJS', 'webdriver.PhantomJS', (['"""/home/username/node_modules/phantomjs-prebuilt/bin/phantomjs"""'], {}), "(\n '/home/username/node_modules/phantomjs-prebuilt/bin/phan... |
import uuid
import random
import os
import math
import numpy as np
import simpy
import matplotlib.pyplot as plt
from simulation.ghostdag import block
from simulation.ghostdag.dag import select_ghostdag_k, DAG
from simulation.fakes import FakeDAG
from simulation.channel import Hub, Channel, PlanarTopology
from simulat... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"simulation.ghostdag.dag.DAG",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"simulation.channel.Hub",
"os.path.isdir",
"os.mkdir",
"numpy.random.seed",
"simpy.Environment",
"uuid.uuid1",
"matplotlib.pyplot.show",
"simulation.helpers.print_st... | [((570, 632), 'simulation.ghostdag.dag.DAG', 'DAG', ([], {'k': 'k', 'interval': '(0, 2 ** 64 - 1)', 'genesis_hash': 'genesis_hash'}), '(k=k, interval=(0, 2 ** 64 - 1), genesis_hash=genesis_hash)\n', (573, 632), False, 'from simulation.ghostdag.dag import select_ghostdag_k, DAG\n'), ((846, 899), 'simulation.miner.Miner'... |
from kwmo.controllers.abstract_teambox import *
import time
from kwmo.lib.kwmo_kcd_client import KcdClient
from kwmo.lib.config import get_cached_kcd_external_conf_object
from kfs_lib import *
from kwmo.lib.base import init_session
from kwmo.lib.kwmolib import *
from kwmo.model.user import User
from kwmo.model.kfs_n... | [
"kcd_lib.WorkspaceInvitee",
"select.select",
"kwmo.model.user.User.get_by",
"kwmo.lib.base.init_session",
"simplejson.dumps",
"kwmo.lib.config.get_cached_kcd_external_conf_object",
"kbase.PropStore",
"kwmo.model.chat_request.ChatRequest.get_by",
"kwmo.model.chat_request.ChatRequest.accepted_lately",... | [((2328, 2366), 'kwmo.lib.base.init_session', 'init_session', (['c.workspace'], {'reinit': '(True)'}), '(c.workspace, reinit=True)\n', (2340, 2366), False, 'from kwmo.lib.base import init_session\n'), ((5974, 6004), 'simplejson.dumps', 'simplejson.dumps', (['c.email_info'], {}), '(c.email_info)\n', (5990, 6004), False,... |
import argparse
import os
import cv2
import numpy as np
def gamma_correction(source_path, destination_path, a, b, version):
# Load image into memory
# Algorithm can work correctly with colored and grayscale images
if version == 'colored':
original_image = cv2.imread(source_path)
elif version ... | [
"os.path.exists",
"numpy.rint",
"argparse.ArgumentParser",
"cv2.imread"
] | [((836, 860), 'numpy.rint', 'np.rint', (['processed_image'], {}), '(processed_image)\n', (843, 860), True, 'import numpy as np\n'), ((1040, 1104), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Perform gamma correction."""'}), "(description='Perform gamma correction.')\n", (1063, 1104), ... |
__author__ = '<NAME><<EMAIL>>'
import os
from util import YamlFileMaker
from util import QstatParser
from cfnCluster import ConnectionManager
import sys
workspace = "/shared/workspace/Pipelines/"
#log_dir = "/shared/workspace/data_archive/DNASeq/{}/logs"
log_dir = "/shared/workspace/logs/DNASeq/{}"
## executing WGS ... | [
"util.YamlFileMaker.make_yaml_file",
"cfnCluster.ConnectionManager.list_dir",
"util.QstatParser.get_job_ids",
"util.QstatParser.parse_qstat",
"cfnCluster.ConnectionManager.copy_file",
"cfnCluster.ConnectionManager.execute_command",
"os.remove"
] | [((657, 822), 'util.YamlFileMaker.make_yaml_file', 'YamlFileMaker.make_yaml_file', (['yaml_file', 'project_name', 'analysis_steps', 's3_input_files_address', 'sample_list', 'group_name', 's3_output_files_address', '"""hg19"""', '"""NA"""'], {}), "(yaml_file, project_name, analysis_steps,\n s3_input_files_address, sa... |
from reinvent_scoring.scoring.diversity_filters.curriculum_learning.update_diversity_filter_dto import \
UpdateDiversityFilterDTO
from unittest_reinvent.diversity_filter_tests.test_murcko_scaffold_base import BaseMurckoScaffoldFilter
from unittest_reinvent.diversity_filter_tests.fixtures import tanimoto_scaffold_fi... | [
"unittest_reinvent.diversity_filter_tests.fixtures.tanimoto_scaffold_filter_arrangement",
"reinvent_scoring.scoring.diversity_filters.curriculum_learning.update_diversity_filter_dto.UpdateDiversityFilterDTO"
] | [((583, 642), 'unittest_reinvent.diversity_filter_tests.fixtures.tanimoto_scaffold_filter_arrangement', 'tanimoto_scaffold_filter_arrangement', (['[ASPIRIN]', '[1.0]', '[0]'], {}), '([ASPIRIN], [1.0], [0])\n', (619, 642), False, 'from unittest_reinvent.diversity_filter_tests.fixtures import tanimoto_scaffold_filter_arr... |
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
from .kaitaistruct import __version__ as ks_version, KaitaiStruct, KaitaiStream, BytesIO
import collections
if parse_version(ks_version) < parse_version('0.7'):
raise Excepti... | [
"pkg_resources.parse_version",
"collections.defaultdict"
] | [((253, 278), 'pkg_resources.parse_version', 'parse_version', (['ks_version'], {}), '(ks_version)\n', (266, 278), False, 'from pkg_resources import parse_version\n'), ((281, 301), 'pkg_resources.parse_version', 'parse_version', (['"""0.7"""'], {}), "('0.7')\n", (294, 301), False, 'from pkg_resources import parse_versio... |
from awx.main import signals
class TestCleanupDetachedLabels:
def test_cleanup_detached_labels_on_deleted_parent(self, mocker):
mock_labels = [mocker.MagicMock(), mocker.MagicMock()]
mock_instance = mocker.MagicMock()
mock_instance.labels.all = mocker.MagicMock()
mock_instance.labe... | [
"awx.main.signals.cleanup_detached_labels_on_deleted_parent"
] | [((498, 568), 'awx.main.signals.cleanup_detached_labels_on_deleted_parent', 'signals.cleanup_detached_labels_on_deleted_parent', (['None', 'mock_instance'], {}), '(None, mock_instance)\n', (547, 568), False, 'from awx.main import signals\n')] |
import pandas as pd
import numpy as np
from pathlib import Path
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
class AccidentsData:
def __init__(self):
filename = Path('../data/accidents.csv')
if not filename.exists():
print('\nERROR... | [
"pandas.get_dummies",
"sklearn.preprocessing.MinMaxScaler",
"pandas.read_csv",
"pathlib.Path"
] | [((230, 259), 'pathlib.Path', 'Path', (['"""../data/accidents.csv"""'], {}), "('../data/accidents.csv')\n", (234, 259), False, 'from pathlib import Path\n'), ((401, 422), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (412, 422), True, 'import pandas as pd\n'), ((831, 1141), 'pandas.get_dummies',... |
# -*- coding: utf-8 -*
from typing import Dict
from yacs.config import CfgNode
from .backbone import builder as backbone_builder
from .loss import builder as loss_builder
from .task_head import builder as head_builder
from .task_model import builder as task_builder
def build_model(
task: str,
cfg: C... | [
"yacs.config.CfgNode"
] | [((1234, 1243), 'yacs.config.CfgNode', 'CfgNode', ([], {}), '()\n', (1241, 1243), False, 'from yacs.config import CfgNode\n'), ((1252, 1261), 'yacs.config.CfgNode', 'CfgNode', ([], {}), '()\n', (1259, 1261), False, 'from yacs.config import CfgNode\n')] |
# -*- coding: utf-8 -*-
# Copyright (C) 2010-2014 <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
"logging.getLogger",
"logging.StreamHandler",
"time.sleep",
"sys.exit",
"os.fork",
"os.remove",
"os.path.exists",
"os.kill",
"argparse.ArgumentParser",
"os.umask",
"os.getpid",
"os.close",
"logging.handlers.RotatingFileHandler",
"sys.stderr.write",
"os.setsid",
"signal.signal",
"mult... | [((878, 920), 'logging.getLogger', 'logging.getLogger', (['"""levitas.lib.daemonize"""'], {}), "('levitas.lib.daemonize')\n", (895, 920), False, 'import logging\n'), ((1298, 1327), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (1314, 1327), False, 'import os\n'), ((1500, 1563), 'sys.... |
"""Class implementation for the stop_propagation interface.
"""
from apysc._type.variable_name_interface import VariableNameInterface
class StopPropagationInterface(VariableNameInterface):
def stop_propagation(self) -> None:
"""
Stop event propagation.
"""
import apys... | [
"apysc.append_js_expression"
] | [((618, 664), 'apysc.append_js_expression', 'ap.append_js_expression', ([], {'expression': 'expression'}), '(expression=expression)\n', (641, 664), True, 'import apysc as ap\n')] |
# import json
import uuid
from django.apps import apps
from django.core import serializers
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import render
from django.shortcuts import redirect
from django.conf import settings
from .api_helpers import *
Ep... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"uuid.uuid4",
"django.shortcuts.redirect",
"django.core.serializers.serialize",
"django.apps.apps.get_model"
] | [((328, 365), 'django.apps.apps.get_model', 'apps.get_model', (['"""episodes"""', '"""Episode"""'], {}), "('episodes', 'Episode')\n", (342, 365), False, 'from django.apps import apps\n'), ((388, 440), 'django.apps.apps.get_model', 'apps.get_model', (['"""subscribers"""', '"""SubscriptionRequest"""'], {}), "('subscriber... |
import torch
import torch.nn as nn
from diversebranchblock import DiverseBranchBlock
from acb import ACBlock
from dbb_transforms import transI_fusebn
CONV_BN_IMPL = 'base'
DEPLOY_FLAG = False
class ConvBN(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size,
stride, ... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"resnet.create_Res50",
"torch.nn.Conv2d",
"resnet.create_Res18",
"mobilenet.create_MobileNet",
"dbb_transforms.transI_fusebn",
"torch.nn.Identity"
] | [((1321, 1361), 'dbb_transforms.transI_fusebn', 'transI_fusebn', (['self.conv.weight', 'self.bn'], {}), '(self.conv.weight, self.bn)\n', (1334, 1361), False, 'from dbb_transforms import transI_fusebn\n'), ((1377, 1625), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'self.conv.in_channels', 'out_channels': 'self.... |
from dataclasses import dataclass, field
from typing import Dict
import perde
import pytest
from util import FORMATS, FORMATS_EXCEPT
"""rust
#[derive(Serialize, Debug, new)]
struct Plain {
a: String,
b: String,
c: u64,
}
add!(Plain {"xxx".into(), "yyy".into(), 3});
"""
@pytest.mark.parametrize("m", FORMATS)
d... | [
"util.FORMATS_EXCEPT",
"pytest.mark.parametrize",
"pytest.raises",
"perde.attr",
"dataclasses.field"
] | [((281, 318), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""m"""', 'FORMATS'], {}), "('m', FORMATS)\n", (304, 318), False, 'import pytest\n'), ((640, 677), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""m"""', 'FORMATS'], {}), "('m', FORMATS)\n", (663, 677), False, 'import pytest\n'), ((1330,... |
from nifcloud import session
import sys
# --- define --------
# -- Server -------
SERVER_NAME = "testsv"
# --------------------
# -- PRIVATE NW -------
PRIVATE_NW_NAME = 'test'
PRIVATE_NW_IP = 'static'
# --------------------
# -------------------
# ------ update attribute --------------------
def wait_for_instance... | [
"nifcloud.session.get_session",
"sys._getframe",
"sys.exit"
] | [((2927, 2948), 'nifcloud.session.get_session', 'session.get_session', ([], {}), '()\n', (2946, 2948), False, 'from nifcloud import session\n'), ((2865, 2876), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (2873, 2876), False, 'import sys\n'), ((374, 389), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (387, 389... |
import requests
import pprint
import json
# Suppress ssl verification warning
requests.packages.urllib3.disable_warnings()
s = requests.Session()
s.auth = ("user", "password")
s.verify = False
host = "localhost"
apis = ["https://api.mercedes-benz.com/vehicledata/v2/vehicles", "https://api.mercedes-benz.com/vehicled... | [
"json.loads",
"requests.packages.urllib3.disable_warnings",
"requests.Session"
] | [((80, 124), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (122, 124), False, 'import requests\n'), ((130, 148), 'requests.Session', 'requests.Session', ([], {}), '()\n', (146, 148), False, 'import requests\n'), ((8861, 8878), 'json.loads', 'json.loads', (... |
# -*- coding: utf-8 -*-
import logging
from pathlib import Path
import torch
from torch.utils.data import Dataset
from torch.nn.utils.rnn import pad_sequence
from ..utils.data import read_sentences
logger = logging.getLogger('nmtpytorch')
class TextDataset(Dataset):
r"""A PyTorch dataset for sentences.
A... | [
"logging.getLogger",
"torch.tensor",
"pathlib.Path"
] | [((211, 242), 'logging.getLogger', 'logging.getLogger', (['"""nmtpytorch"""'], {}), "('nmtpytorch')\n", (228, 242), False, 'import logging\n'), ((724, 735), 'pathlib.Path', 'Path', (['fname'], {}), '(fname)\n', (728, 735), False, 'from pathlib import Path\n'), ((1421, 1454), 'torch.tensor', 'torch.tensor', (['b'], {'dt... |
import glob
import nibabel as nib
import pdb
nii_files = glob.glob('./train3d/*.nii')
for nii_file in nii_files:
nii = nib.load(nii_file)
nib.save(nii, nii_file[:-4] + '_0000.nii.gz')
print(nii_file[:-4] + '.nii.gz')
| [
"nibabel.save",
"glob.glob",
"nibabel.load"
] | [((58, 86), 'glob.glob', 'glob.glob', (['"""./train3d/*.nii"""'], {}), "('./train3d/*.nii')\n", (67, 86), False, 'import glob\n'), ((122, 140), 'nibabel.load', 'nib.load', (['nii_file'], {}), '(nii_file)\n', (130, 140), True, 'import nibabel as nib\n'), ((142, 187), 'nibabel.save', 'nib.save', (['nii', "(nii_file[:-4] ... |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | [
"os.path.abspath"
] | [((593, 613), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (608, 613), False, 'import os\n')] |
import os
import json
from github3.pulls import PullFile
from github3.repos.commit import RepoCommit
def load_fixture(filename):
path = os.path.dirname(os.path.abspath(__file__))
filename = os.path.join(path, 'fixtures', filename)
fh = open(filename, 'r')
return fh.read()
def create_pull_files(data)... | [
"json.loads",
"os.path.join",
"github3.repos.commit.RepoCommit",
"os.path.abspath",
"github3.pulls.PullFile"
] | [((200, 240), 'os.path.join', 'os.path.join', (['path', '"""fixtures"""', 'filename'], {}), "(path, 'fixtures', filename)\n", (212, 240), False, 'import os\n'), ((158, 183), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (173, 183), False, 'import os\n'), ((334, 345), 'github3.pulls.PullFile'... |
#
# One-liner implementation of cPickle
#
from pickle import *
from pickle import __doc__, __version__, format_version, compatible_formats
BadPickleGet = KeyError
UnpickleableError = PicklingError
# ____________________________________________________________
# XXX some temporary dark magic to produce pickled dumps ... | [
"pickle.StringIO"
] | [((1125, 1135), 'pickle.StringIO', 'StringIO', ([], {}), '()\n', (1133, 1135), False, 'from pickle import StringIO\n'), ((609, 619), 'pickle.StringIO', 'StringIO', ([], {}), '()\n', (617, 619), False, 'from pickle import StringIO\n')] |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"numpy.mean",
"paddle.distributed.fleet.worker_index",
"paddle.fluid.default_startup_program",
"paddle.fluid.CPUPlace",
"os.environ.get",
"paddle.fluid.default_main_program",
"paddle.fluid.Executor",
"paddle.distributed.fleet.stop_worker",
"paddle.distributed.fleet.init_worker",
"time.time"
] | [((960, 976), 'paddle.fluid.CPUPlace', 'fluid.CPUPlace', ([], {}), '()\n', (974, 976), True, 'import paddle.fluid as fluid\n'), ((996, 1022), 'paddle.fluid.Executor', 'fluid.Executor', (['self.place'], {}), '(self.place)\n', (1010, 1022), True, 'import paddle.fluid as fluid\n'), ((1092, 1111), 'paddle.distributed.fleet... |
#! /mnt/software/unstowable/anaconda/bin/python
import sys
import os
import argparse
import subprocess
def generating_mapping(kraken_report):
kraken_dict = {}
with open (kraken_report, "r") as fp:
for line in fp:
line = line.split("\t")
if line[3] != 'S' and line[3] != '-':
... | [
"subprocess.check_output",
"argparse.ArgumentParser"
] | [((802, 842), 'subprocess.check_output', 'subprocess.check_output', (['cmd'], {'shell': '(True)'}), '(cmd, shell=True)\n', (825, 842), False, 'import subprocess\n'), ((1975, 2016), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""kraken binning"""'], {}), "('kraken binning')\n", (1998, 2016), False, 'import ... |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | [
"json.load",
"robot.running.ArgumentSpec",
"robot.errors.DataError"
] | [((2419, 2433), 'robot.running.ArgumentSpec', 'ArgumentSpec', ([], {}), '()\n', (2431, 2433), False, 'from robot.running import ArgInfo, ArgumentSpec\n'), ((1800, 1850), 'robot.errors.DataError', 'DataError', (['("Spec file \'%s\' does not exist." % path)'], {}), '("Spec file \'%s\' does not exist." % path)\n', (1809, ... |
import os
import random
import shutil
import time
import whisper
from django.conf import settings
from django.test import override_settings
from mock import patch, Mock
from .base import TestCase
from graphite.finders.utils import BaseFinder
from graphite.intervals import Interval, IntervalSet
from graphite.node imp... | [
"graphite.node.BranchNode",
"graphite.util.epoch_to_dt",
"whisper.create",
"mock.patch",
"graphite.render.evaluator.evaluateTarget",
"graphite.storage.write_index",
"random.choice",
"mock.Mock",
"graphite.render.datalib.TimeSeries",
"graphite.storage.Store",
"os.path.join",
"graphite.worker_po... | [((4512, 4555), 'django.test.override_settings', 'override_settings', ([], {'STORE_FAIL_ON_ERROR': '(True)'}), '(STORE_FAIL_ON_ERROR=True)\n', (4529, 4555), False, 'from django.test import override_settings\n'), ((8681, 8751), 'django.test.override_settings', 'override_settings', ([], {'REMOTE_STORE_FORWARD_HEADERS': "... |
#
# Copyright 2002.2.rc1710017 Barcelona Supercomputing Center (www.bsc.es)
#
# 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... | [
"pycompss.api.task.task",
"pycompss.api.api.compss_wait_on"
] | [((1150, 1169), 'pycompss.api.task.task', 'task', ([], {'returns': 'float'}), '(returns=float)\n', (1154, 1169), False, 'from pycompss.api.task import task\n'), ((1559, 1581), 'pycompss.api.api.compss_wait_on', 'compss_wait_on', (['result'], {}), '(result)\n', (1573, 1581), False, 'from pycompss.api.api import compss_w... |
import json
import requests
import dash
import dash_core_components as dcc
import dash_html_components as html
def server_setup(results):
app = dash.Dash(__name__)
app.layout = html.Div(children=[
html.H1(children='NHL 2018/2019 cumulative points stats'),
html.Div(children='''
... | [
"json.loads",
"requests.Session",
"dash_html_components.H1",
"dash.Dash",
"dash_html_components.Div",
"dash_core_components.Graph"
] | [((150, 169), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'import dash\n'), ((1127, 1145), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1143, 1145), False, 'import requests\n'), ((1234, 1254), 'json.loads', 'json.loads', (['raw_data'], {}), '(raw_data)\n', (1244, 1254)... |
#Squeeze example
import sys
sys.path.insert(0,'..')
import pycpdflib
#DLL loading depends on your own platform. These are the author's settings.
if sys.platform.startswith('darwin'):
pycpdflib.loadDLL("/Users/john/repos/python-libcpdf/libpycpdf.so")
elif sys.platform.startswith('linux'):
pycpdflib.loadDLL("../... | [
"sys.path.insert",
"pycpdflib.fromFile",
"sys.platform.startswith",
"pycpdflib.loadDLL",
"pycpdflib.toFileExt",
"pycpdflib.squeezeInMemory"
] | [((28, 52), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (43, 52), False, 'import sys\n'), ((149, 182), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (172, 182), False, 'import sys\n'), ((546, 594), 'pycpdflib.fromFile', 'pycpdflib.fromF... |
import imaplib
import email
from create_orders_from_email import get_email_contents
import time
import sys
with imaplib.IMAP4_SSL(host="imap.gmail.com", port=imaplib.IMAP4_SSL_PORT) as imap_ssl:
resp_code, response = imap_ssl.login(sys.argv[1], sys.argv[2])
while True:
resp_code, mail_count = imap_ssl.... | [
"email.message_from_bytes",
"time.sleep",
"imaplib.IMAP4_SSL"
] | [((113, 182), 'imaplib.IMAP4_SSL', 'imaplib.IMAP4_SSL', ([], {'host': '"""imap.gmail.com"""', 'port': 'imaplib.IMAP4_SSL_PORT'}), "(host='imap.gmail.com', port=imaplib.IMAP4_SSL_PORT)\n", (130, 182), False, 'import imaplib\n'), ((844, 858), 'time.sleep', 'time.sleep', (['(30)'], {}), '(30)\n', (854, 858), False, 'impor... |
import socket
import struct
class Patlite(object):
auto_update = True
OFF = 0
BLINK = 0x20
ON = 0x01
SHORT = 0x08
LONG = 0x10
STATUS_STRING = {
OFF:"Off",BLINK:"Blink",ON:"On",
SHORT:"Short",LONG:"Long"
}
RED = 0
... | [
"struct.unpack",
"struct.pack",
"socket.socket"
] | [((748, 797), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (761, 797), False, 'import socket\n'), ((1770, 1797), 'struct.pack', 'struct.pack', (['"""2B"""', '(87)', 'data'], {}), "('2B', 87, data)\n", (1781, 1797), False, 'import struct\n'),... |
"""Fake server"""
import asyncio
import logging
from typing import Callable, Dict, List, Optional, Tuple, Union
from . import (
AmxDuetRequest,
AmxDuetResponse,
AnswerCodes,
CommandNotRecognised,
CommandPacket,
ResponseException,
ResponsePacket,
read_command,
write_packet
)
_LOGGER... | [
"logging.getLogger",
"asyncio.start_server",
"asyncio.wait",
"asyncio.current_task"
] | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n'), ((1046, 1068), 'asyncio.current_task', 'asyncio.current_task', ([], {}), '()\n', (1066, 1068), False, 'import asyncio\n'), ((3296, 3354), 'asyncio.start_server', 'asyncio.start_server', ([... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"logging.getLogger",
"numpy.ones",
"numpy.asarray",
"numpy.array",
"numpy.zeros",
"numpy.full"
] | [((1026, 1053), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1043, 1053), False, 'import logging\n'), ((8151, 8180), 'numpy.zeros', 'np.zeros', (['num_vars'], {'dtype': 'int'}), '(num_vars, dtype=int)\n', (8159, 8180), True, 'import numpy as np\n'), ((8201, 8242), 'numpy.zeros', 'np.ze... |
from flask import Blueprint, abort, request, jsonify
from prediction_utils import *
prediction_page = Blueprint('prediction_page', __name__)
@prediction_page.route('/map', methods=['GET'])
def get_map_data():
offset = int(request.args['offset'])
country = request.args['country'] if 'country' in request.args e... | [
"flask.Blueprint"
] | [((103, 141), 'flask.Blueprint', 'Blueprint', (['"""prediction_page"""', '__name__'], {}), "('prediction_page', __name__)\n", (112, 141), False, 'from flask import Blueprint, abort, request, jsonify\n')] |
from django.urls import path
from . import views
urlpatterns = [
path("draugiem/login/", views.login, name="draugiem_login"),
path("draugiem/callback/", views.callback, name="draugiem_callback"),
]
| [
"django.urls.path"
] | [((72, 131), 'django.urls.path', 'path', (['"""draugiem/login/"""', 'views.login'], {'name': '"""draugiem_login"""'}), "('draugiem/login/', views.login, name='draugiem_login')\n", (76, 131), False, 'from django.urls import path\n'), ((137, 205), 'django.urls.path', 'path', (['"""draugiem/callback/"""', 'views.callback'... |
from typing import Optional
from ctypes import *
from vcx.common import do_call, create_cb
from vcx.api.connection import Connection
from vcx.api.vcx_stateful import VcxStateful
import json
class DisclosedProof(VcxStateful):
def __init__(self, source_id: str):
VcxStateful.__init__(self, source_id)
... | [
"vcx.common.do_call",
"json.dumps",
"vcx.api.vcx_stateful.VcxStateful.__init__"
] | [((277, 314), 'vcx.api.vcx_stateful.VcxStateful.__init__', 'VcxStateful.__init__', (['self', 'source_id'], {}), '(self, source_id)\n', (297, 314), False, 'from vcx.api.vcx_stateful import VcxStateful\n'), ((1717, 1850), 'vcx.common.do_call', 'do_call', (['"""vcx_disclosed_proof_create_with_msgid"""', 'c_source_id', 'c_... |
import sys
import requests
import json
import argparse
import time
parser = argparse.ArgumentParser(description='Collects monitoring data from Pingdom.')
parser.add_argument('-u', '--pingdom-user-name', help='The Pingdom User Name', required=True)
parser.add_argument('-p', '--pingdom-password', help='The Pingdom Passw... | [
"requests.auth.HTTPBasicAuth",
"argparse.ArgumentParser",
"json.dumps",
"sys.stderr.write",
"sys.exit"
] | [((77, 154), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Collects monitoring data from Pingdom."""'}), "(description='Collects monitoring data from Pingdom.')\n", (100, 154), False, 'import argparse\n'), ((682, 734), 'sys.stderr.write', 'sys.stderr.write', (["('ERROR:|Pingdom| ' + err... |
#!/usr/bin/env python
# -----------------------------------------------------
# Written by <NAME> on 2021/3/28.
# -----------------------------------------------------
import sys
from pycocotools.coco_analyze import COCOAnalyze, my_plot
annFile = sys.argv[1]
coco = COCOAnalyze(annFile)
# get all cats
catNms = 'all'... | [
"pycocotools.coco_analyze.COCOAnalyze",
"pycocotools.coco_analyze.my_plot"
] | [((269, 289), 'pycocotools.coco_analyze.COCOAnalyze', 'COCOAnalyze', (['annFile'], {}), '(annFile)\n', (280, 289), False, 'from pycocotools.coco_analyze import COCOAnalyze, my_plot\n'), ((485, 534), 'pycocotools.coco_analyze.my_plot', 'my_plot', ([], {'data': 'widths', 'label': 'catNms', 'name': '"""widths"""'}), "(dat... |
import logging
from typing import Any, List, Optional
from homeassistant.components.climate.const import (
HVAC_MODE_AUTO,
HVAC_MODE_COOL,
HVAC_MODE_FAN_ONLY,
)
from gehomesdk import ErdAcFanSetting
from ..common import OptionsConverter
_LOGGER = logging.getLogger(__name__)
class AcFanModeOptionsConverte... | [
"logging.getLogger"
] | [((261, 288), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (278, 288), False, 'import logging\n')] |
""" Decision Trees - Supervised learning: 1-Classification*, 2-Regression.
D.T.s are a non-parametric supervised learning method used for classification and regression. The goal is to create a
model that predicts the value of a target variable by learning simple decision rules inferred from the data features.
Some adv... | [
"sklearn.metrics.classification_report",
"sklearn.tree.DecisionTreeClassifier",
"numpy.asarray",
"sklearn.datasets.load_breast_cancer",
"sklearn.cross_validation.train_test_split",
"sklearn.externals.joblib.dump",
"sklearn.metrics.confusion_matrix"
] | [((4019, 4048), 'sklearn.datasets.load_breast_cancer', 'datasets.load_breast_cancer', ([], {}), '()\n', (4046, 4048), False, 'from sklearn import datasets, metrics, tree\n'), ((4099, 4132), 'numpy.asarray', 'np.asarray', (['data'], {'dtype': '"""float32"""'}), "(data, dtype='float32')\n", (4109, 4132), True, 'import nu... |
__author__ = '<NAME>'
__version__ = '2.0'
from flask import Flask
from hackathon.functions import safe_get_config
from flask_restful import Api
from flask_cors import CORS
# flask
app = Flask(__name__)
app.config['SECRET_KEY'] = '*K&ep_me^se(ret_!@#$'
# flask restful
api = Api(app)
# CORS
app.config['CORS_HEADERS']... | [
"flask_restful.Api",
"flask_cors.CORS",
"flask.Flask"
] | [((188, 203), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (193, 203), False, 'from flask import Flask\n'), ((277, 285), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (280, 285), False, 'from flask_restful import Api\n'), ((352, 361), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (356, 361... |
from models import Action, Block, Detect, Discovery, Edge, Node
import renderer
if __name__ == "__main__":
root = Node(label="Reality")
goal = Node(label="Attacker gets data from bucket")
apiCache = Action(
label="Search API Caches",
chain="recon",
cost=0,
time=3,
o... | [
"models.Discovery",
"renderer.loadStyle",
"models.Node",
"renderer.render",
"models.Action"
] | [((119, 140), 'models.Node', 'Node', ([], {'label': '"""Reality"""'}), "(label='Reality')\n", (123, 140), False, 'from models import Action, Block, Detect, Discovery, Edge, Node\n'), ((152, 196), 'models.Node', 'Node', ([], {'label': '"""Attacker gets data from bucket"""'}), "(label='Attacker gets data from bucket')\n"... |
import math
from KratosMultiphysics import *
from KratosMultiphysics.BRepApplication import *
from KratosMultiphysics.IsogeometricApplication import *
###
### This module is a factory to generate typical geometries for isogeometric analysis, e.g. circle, l-shape, ...
###
nurbs_fespace_library = BSplinesFESpaceLibrary... | [
"math.tan",
"math.sqrt",
"math.cos",
"math.exp",
"math.sin"
] | [((791, 835), 'math.sqrt', 'math.sqrt', (['(a[0] ** 2 + a[1] ** 2 + a[2] ** 2)'], {}), '(a[0] ** 2 + a[1] ** 2 + a[2] ** 2)\n', (800, 835), False, 'import math\n'), ((5630, 5646), 'math.cos', 'math.cos', (['dsweep'], {}), '(dsweep)\n', (5638, 5646), False, 'import math\n'), ((1024, 1048), 'math.sqrt', 'math.sqrt', (['(... |
#!/usr/bin/env python
"""
Analyze Imaging Mass Cytometry data
===================================
This tutorial shows how to apply Squidpy to Imaging Mass Cytometry data.
The data used here comes from a recent paper from :cite:`jackson2020single`.
We provide a pre-processed subset of the data, in :class:`anndata.AnnD... | [
"squidpy.gr.spatial_neighbors",
"squidpy.pl.interaction_matrix",
"squidpy.gr.centrality_scores",
"squidpy.gr.nhood_enrichment",
"squidpy.pl.centrality_scores",
"scanpy.pl.spatial",
"squidpy.pl.nhood_enrichment",
"scanpy.logging.print_header",
"squidpy.gr.interaction_matrix",
"squidpy.gr.co_occurre... | [((811, 836), 'scanpy.logging.print_header', 'sc.logging.print_header', ([], {}), '()\n', (834, 836), True, 'import scanpy as sc\n'), ((915, 932), 'squidpy.datasets.imc', 'sq.datasets.imc', ([], {}), '()\n', (930, 932), True, 'import squidpy as sq\n'), ((1116, 1169), 'scanpy.pl.spatial', 'sc.pl.spatial', (['adata'], {'... |
from pymongo import MongoClient
client = MongoClient()
db = client.music_space
def print_collection(collection):
print("/" * 75)
for x in db[collection].find():
print(x)
print("/" * 75)
def save_sales_on_mongo(collection, data):
for i in range(len(data['sales'])):
data['sales'][i]['to... | [
"pymongo.MongoClient"
] | [((42, 55), 'pymongo.MongoClient', 'MongoClient', ([], {}), '()\n', (53, 55), False, 'from pymongo import MongoClient\n')] |
"""
.. todo::
WRITEME
"""
import logging
from theano import function, shared
from pylearn2.optimization import linear_cg as cg
from pylearn2.optimization.feature_sign import feature_sign_search
import numpy as N
import theano.tensor as T
from pylearn2.utils.rng import make_np_rng
logger = logging.getLogger(__nam... | [
"logging.getLogger",
"pylearn2.optimization.feature_sign.feature_sign_search",
"pylearn2.utils.rng.make_np_rng",
"pylearn2.optimization.linear_cg.linear_cg",
"numpy.abs",
"theano.function",
"theano.tensor.sum",
"theano.tensor.vector",
"theano.tensor.sqr",
"numpy.zeros",
"numpy.isnan",
"numpy.i... | [((297, 324), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (314, 324), False, 'import logging\n'), ((647, 697), 'pylearn2.utils.rng.make_np_rng', 'make_np_rng', (['None', '[1, 2, 3]'], {'which_method': '"""randn"""'}), "(None, [1, 2, 3], which_method='randn')\n", (658, 697), False, 'fro... |
import re
import cv2
import json
import base64
import logging
import requests
import numpy as np
from datetime import datetime
import pytz
import gridfs
import pymongo
from pymongo import MongoClient
from pymongo.errors import ServerSelectionTimeoutError as MongoServerSelectionTimeoutError
import image... | [
"gridfs.GridFS",
"pytz.timezone",
"logging.getLogger",
"logging.basicConfig",
"PIL.Image.fromarray",
"skimage.metrics.structural_similarity",
"re.compile",
"datetime.datetime.utcnow",
"re.match",
"requests.get",
"cv2.imdecode",
"pymongo.MongoClient",
"cv2.resize",
"cv2.boundingRect"
] | [((1013, 1232), 're.compile', 're.compile', (['"""^(?:http|ftp)s?://(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\\\\.)+(?:[A-Z]{2,6}\\\\.?|[A-Z0-9-]{2,}\\\\.?)|localhost|\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})(?::\\\\d+)?(?:/?|[/?]\\\\S+)$"""', 're.IGNORECASE'], {}), "(\n '^(?:http|ftp)s?://(?:(?:[A-Z... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import numpy as np
import time
import sys
import functools
import math
import paddle
import paddle.fluid as fluid
import paddle.dataset.flowers as flowers
import models
import reader
import argparse
fr... | [
"paddle.fluid.DataFeeder",
"paddle.dataset.flowers.test",
"paddle.fluid.layers.data",
"paddle.fluid.layers.cross_entropy",
"numpy.array",
"paddle.fluid.Executor",
"paddle.dataset.flowers.train",
"paddle.fluid.layers.piecewise_decay",
"reader.train",
"numpy.mean",
"argparse.ArgumentParser",
"pa... | [((425, 469), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (448, 469), False, 'import argparse\n'), ((480, 530), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (497, 530)... |
from __future__ import print_function
import os
import base64
import cStringIO
import time
import numpy
from PIL import Image
from flask import (Flask, request, render_template, url_for, flash, redirect,
send_file)
from SeamErasure import seam_erasure, obj_reader, util
from SeamErasure.lib import weight_data
... | [
"flask.render_template",
"PIL.Image.fromarray",
"cStringIO.StringIO",
"SeamErasure.obj_reader.parse_obj",
"SeamErasure.lib.weight_data.write_tex_to_file",
"PIL.Image.open",
"flask.Flask",
"SeamErasure.lib.weight_data.read_tex_from_file",
"SeamErasure.seam_erasure.erase_seam",
"numpy.squeeze",
"o... | [((326, 341), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (331, 341), False, 'from flask import Flask, request, render_template, url_for, flash, redirect, send_file\n'), ((1175, 1207), 'flask.render_template', 'render_template', (['"""min-form.html"""'], {}), "('min-form.html')\n", (1190, 1207), False, ... |
import matplotlib, numpy
from . import plot
import markdown
import tabulate
md_extensions = [
'markdown.extensions.tables',
'markdown.extensions.extra'
]
class HTMLElement(object):
tag = None
childtag = None
def __init__(self, content=None, **kwargs):
self.content = []
self.m... | [
"tabulate.tabulate",
"tabulate.Line",
"functools.partial"
] | [((2441, 2484), 'tabulate.tabulate', 'tabulate.tabulate', (['x'], {'tablefmt': 'MyHTMLFormat'}), '(x, tablefmt=MyHTMLFormat)\n', (2458, 2484), False, 'import tabulate\n'), ((3147, 3206), 'tabulate.Line', 'tabulate.Line', (['"""<table class="table table-sm">"""', '""""""', '""""""', '""""""'], {}), '(\'<table class="tab... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Tools for setting up and using the data recorder of a PI device."""
from logging import debug, warning
from time import sleep, time
from pipython.pitools import FrozenClass
# seconds
SERVOTIMES = {
'C-413K011': 0.00003333333,
'C-663.11': 50E-6,
'C-702.00': 100... | [
"logging.warning",
"logging.debug",
"time.sleep",
"time.time"
] | [((8767, 8838), 'logging.debug', 'debug', (['"""Datarecorder.servotime set to %g secs"""', "self.__cfg['servotime']"], {}), "('Datarecorder.servotime set to %g secs', self.__cfg['servotime'])\n", (8772, 8838), False, 'from logging import debug, warning\n'), ((9451, 9518), 'logging.debug', 'debug', (['"""Datarecorder.nu... |
import io
class container(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
__delattr__ = dict.__delitem__
def pack(typ, obj):
stream = io.BytesIO()
typ.pack(stream, obj)
data = stream.getvalue()
stream.close()
return data
def unpack(typ, data):
stream = io.... | [
"io.BytesIO"
] | [((176, 188), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (186, 188), False, 'import io\n'), ((317, 333), 'io.BytesIO', 'io.BytesIO', (['data'], {}), '(data)\n', (327, 333), False, 'import io\n')] |
from flask import Flask, jsonify
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func, desc
import pandas as pd
import numpy as np
import datetime as dt
import sqlalchemy
engine = create_engine("sqlite:///Resources/hawaii.sqlite")
... | [
"sqlalchemy.func.min",
"flask.Flask",
"sqlalchemy.ext.automap.automap_base",
"sqlalchemy.create_engine",
"sqlalchemy.orm.Session",
"sqlalchemy.desc",
"sqlalchemy.func.max",
"sqlalchemy.func.avg",
"pandas.read_sql",
"datetime.timedelta",
"pandas.to_datetime",
"flask.jsonify"
] | [((269, 319), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///Resources/hawaii.sqlite"""'], {}), "('sqlite:///Resources/hawaii.sqlite')\n", (282, 319), False, 'from sqlalchemy import create_engine, func, desc\n'), ((328, 342), 'sqlalchemy.ext.automap.automap_base', 'automap_base', ([], {}), '()\n', (340, 3... |
import torch
import torch.nn as nn
from cogdl.utils import spmm
class GINLayer(nn.Module):
r"""Graph Isomorphism Network layer from paper `"How Powerful are Graph
Neural Networks?" <https://arxiv.org/pdf/1810.00826.pdf>`__.
.. math::
h_i^{(l+1)} = f_\Theta \left((1 + \epsilon) h_i^{l} +
... | [
"torch.FloatTensor",
"cogdl.utils.spmm"
] | [((1076, 1090), 'cogdl.utils.spmm', 'spmm', (['graph', 'x'], {}), '(graph, x)\n', (1080, 1090), False, 'from cogdl.utils import spmm\n'), ((864, 888), 'torch.FloatTensor', 'torch.FloatTensor', (['[eps]'], {}), '([eps])\n', (881, 888), False, 'import torch\n'), ((944, 968), 'torch.FloatTensor', 'torch.FloatTensor', (['[... |
# Copyright 2018 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | [
"tensorflow.device",
"tensorflow.nn.tanh",
"utils.PytorchInitializer",
"tensorflow.GradientTape",
"numpy.array",
"tensorflow.concat",
"numpy.zeros",
"tensorflow.constant",
"tensorflow.stop_gradient",
"numpy.expand_dims",
"tensorflow.add_n",
"tensorflow.train.AdamOptimizer"
] | [((3624, 3668), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', ([], {'learning_rate': '(0.0001)'}), '(learning_rate=0.0001)\n', (3646, 3668), True, 'import tensorflow as tf\n'), ((3977, 4020), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', ([], {'learning_rate': '(0.001)'}), '(learning_rate=0.... |
import json
import falcon
import time
import uuid
import requests
from apps.database import init_db, db_session
from apps.models import Account
from apps.restaccount.logging import logging
logger = logging.getLogger(__name__)
from decouple import config
ES_HOST = config('EVENTSTORE_HOST', default='eventstore')
ES_PO... | [
"apps.restaccount.logging.logging.getLogger",
"falcon.HTTPBadRequest",
"decouple.config",
"apps.database.db_session.close",
"uuid.uuid1",
"apps.models.Account.query.get",
"apps.database.db_session.query",
"apps.database.init_db"
] | [((199, 226), 'apps.restaccount.logging.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (216, 226), False, 'from apps.restaccount.logging import logging\n'), ((267, 314), 'decouple.config', 'config', (['"""EVENTSTORE_HOST"""'], {'default': '"""eventstore"""'}), "('EVENTSTORE_HOST', default=... |
# -*- coding: utf-8 -*-
# @Author : Skye
# @Time : 2018/1/8 20:38
# @desc : python 3 , 答题闯关辅助,截屏 ,OCR 识别,百度搜索
import io
import urllib.parse
import webbrowser
import requests
import base64
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
import os
def pull_screenshot():
os.system('a... | [
"requests.post",
"PIL.Image.open",
"base64.b64encode",
"io.BytesIO",
"webbrowser.open",
"requests.get",
"os.system"
] | [((443, 473), 'PIL.Image.open', 'Image.open', (['"""./screenshot.png"""'], {}), "('./screenshot.png')\n", (453, 473), False, 'from PIL import Image\n'), ((1143, 1155), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (1153, 1155), False, 'import io\n'), ((1244, 1272), 'base64.b64encode', 'base64.b64encode', (['image_data'... |
from __future__ import print_function
import os
import re
def openFile(f, m='r'):
if (os.path.exists(f)):
return open(f, m)
else:
return open('../' + f, m)
demo_test = ' '.join(openFile('mockito_test/demo_test.py').readlines())
demo_test = demo_test.split('#DELIMINATOR')[1]
readme_before = ''.join(... | [
"os.path.exists",
"re.compile"
] | [((90, 107), 'os.path.exists', 'os.path.exists', (['f'], {}), '(f)\n', (104, 107), False, 'import os\n'), ((390, 420), 're.compile', 're.compile', (["(token + '.*')", 're.S'], {}), "(token + '.*', re.S)\n", (400, 420), False, 'import re\n')] |
from flask import Flask
from flask import render_template
from flask import request,session, redirect, url_for, escape,send_from_directory
import requests
import json
app = Flask(__name__, static_url_path='')
def predictor(tavg, model, degree):
if degree == 3:
y = model['coef'][0][3]*(tavg**3) + \
... | [
"flask.render_template",
"flask.request.args.get",
"flask.Flask",
"requests.get",
"webbrowser.open_new_tab"
] | [((174, 209), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""'}), "(__name__, static_url_path='')\n", (179, 209), False, 'from flask import Flask\n'), ((4780, 4829), 'webbrowser.open_new_tab', 'webbrowser.open_new_tab', (['"""http://localhost:5000/"""'], {}), "('http://localhost:5000/')\n", (4803, 48... |
# Generated by Django 3.2 on 2021-05-01 14:42
from django.db import migrations, models
import easy_thumbnails.fields
import embed_video.fields
class Migration(migrations.Migration):
dependencies = [
('events', '0001_initial'),
]
operations = [
migrations.AddField(
model_name... | [
"django.db.models.IntegerField"
] | [((377, 419), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (396, 419), False, 'from django.db import migrations, models\n')] |
import numpy as np
from scipy.io import loadmat
import os
import logging
from scipy.signal import butter, filtfilt
def mat2npy(mat_chanmap_dir):
mat_chanmap = loadmat(mat_chanmap_dir)
x = mat_chanmap['xcoords']
y = mat_chanmap['ycoords']
npy_chanmap = np.hstack([x,y])
#np.save('chanmap.npy', n... | [
"logging.getLogger",
"numpy.mean",
"numpy.savez",
"os.listdir",
"numpy.abs",
"numpy.hstack",
"scipy.signal.filtfilt",
"numpy.where",
"scipy.io.loadmat",
"os.path.join",
"scipy.signal.butter",
"numpy.zeros",
"numpy.load",
"numpy.divide"
] | [((164, 188), 'scipy.io.loadmat', 'loadmat', (['mat_chanmap_dir'], {}), '(mat_chanmap_dir)\n', (171, 188), False, 'from scipy.io import loadmat\n'), ((274, 291), 'numpy.hstack', 'np.hstack', (['[x, y]'], {}), '([x, y])\n', (283, 291), True, 'import numpy as np\n'), ((495, 524), 'os.listdir', 'os.listdir', (['filtered_l... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import contextlib
import torch
import torch.nn.functional as F
from typing import List, Tuple, Dict, Optional
from transformers imp... | [
"transformers.BertForMaskedLM.from_pretrained",
"fairseq.models.register_model_architecture",
"fairseq.models.register_model",
"fairseq.utils.sequence_mask",
"contextlib.ExitStack",
"copy.deepcopy",
"torch.nn.functional.pad",
"torch.no_grad"
] | [((2208, 2238), 'fairseq.models.register_model', 'register_model', (['"""w2v_cif_bert"""'], {}), "('w2v_cif_bert')\n", (2222, 2238), False, 'from fairseq.models import BaseFairseqModel, register_model, register_model_architecture\n'), ((8831, 8890), 'fairseq.models.register_model_architecture', 'register_model_architec... |
# Copyright (c) 2020 NVIDIA Corporation. All rights reserved.
# This work is licensed under the NVIDIA Source Code License - Non-commercial. Full
# text can be found in LICENSE.md
import sys
import cv2
import time
from .sdf_utils import *
import _init_paths
from fcn.config import cfg
from layers.sdf_matching_loss impo... | [
"time.time",
"layers.sdf_matching_loss.SDFLoss"
] | [((3634, 3643), 'layers.sdf_matching_loss.SDFLoss', 'SDFLoss', ([], {}), '()\n', (3641, 3643), False, 'from layers.sdf_matching_loss import SDFLoss\n'), ((7331, 7342), 'time.time', 'time.time', ([], {}), '()\n', (7340, 7342), False, 'import time\n'), ((7989, 8000), 'time.time', 'time.time', ([], {}), '()\n', (7998, 800... |
from pymunk.vec2d import Vec2d
from src.utils import AngleHelper
import pymunk
class Map:
def __init__(self):
self.crossings = []
self.streets = []
self.STREET_WIDTH = 50
self.SIDEWALK_WIDTH = 60
self.sidewalk_crossings = []
self.sidewalks = []
self.distance... | [
"pymunk.vec2d.Vec2d",
"pymunk.Body"
] | [((801, 842), 'pymunk.Body', 'pymunk.Body', ([], {'body_type': 'pymunk.Body.STATIC'}), '(body_type=pymunk.Body.STATIC)\n', (812, 842), False, 'import pymunk\n'), ((1869, 1908), 'pymunk.vec2d.Vec2d', 'Vec2d', (['self.sidewalk_crossings[edge[1]]'], {}), '(self.sidewalk_crossings[edge[1]])\n', (1874, 1908), False, 'from p... |
import pyautogui
pyautogui.moveTo(2317, 425, duration=1)
| [
"pyautogui.moveTo"
] | [((18, 57), 'pyautogui.moveTo', 'pyautogui.moveTo', (['(2317)', '(425)'], {'duration': '(1)'}), '(2317, 425, duration=1)\n', (34, 57), False, 'import pyautogui\n')] |
import unittest
import paddle
import neural_renderer_paddle as nr
class TestLighting(unittest.TestCase):
def test_case1(self):
"""Test whether it is executable."""
faces = paddle.randn([64, 16, 3, 3], dtype=paddle.float32)
textures = paddle.randn([64, 16, 8, 8, 8, 3], dtype=paddle.fl... | [
"unittest.main",
"paddle.randn",
"neural_renderer_paddle.lighting"
] | [((396, 411), 'unittest.main', 'unittest.main', ([], {}), '()\n', (409, 411), False, 'import unittest\n'), ((200, 250), 'paddle.randn', 'paddle.randn', (['[64, 16, 3, 3]'], {'dtype': 'paddle.float32'}), '([64, 16, 3, 3], dtype=paddle.float32)\n', (212, 250), False, 'import paddle\n'), ((270, 326), 'paddle.randn', 'padd... |
"""
Citing from jasper from Nvidia
"""
import torch
import torch.nn as nn
import torch.functional as F
class SubBlock(nn.Module):
def __init__(self, dropout):
super(SubBlock, self).__init__()
self.conv = nn.Conv1d(in_channels=256, out_channels=256,
kernel_size=11... | [
"torch.nn.BatchNorm1d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Conv1d"
] | [((231, 316), 'torch.nn.Conv1d', 'nn.Conv1d', ([], {'in_channels': '(256)', 'out_channels': '(256)', 'kernel_size': '(11)', 'stride': '(1)', 'padding': '(5)'}), '(in_channels=256, out_channels=256, kernel_size=11, stride=1,\n padding=5)\n', (240, 316), True, 'import torch.nn as nn\n'), ((369, 401), 'torch.nn.BatchNo... |
import pandas as pd
# Load the original csv
df = pd.read_csv('data/carto.csv')
# Group by name of borough
# The output is a list of tuples with ('name of borough', dataframe of that borough)
grouped = list(df.groupby('location_name'))
for x in grouped:
# Get the name of the borough
name_of_borough = x[0]
... | [
"pandas.read_csv"
] | [((50, 79), 'pandas.read_csv', 'pd.read_csv', (['"""data/carto.csv"""'], {}), "('data/carto.csv')\n", (61, 79), True, 'import pandas as pd\n')] |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"torch.ones_like",
"torch.optim.lr_scheduler.StepLR",
"os.path.dirname",
"pytorch_lightning.Trainer",
"torch.nn.Linear",
"torch.randn"
] | [((694, 719), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (709, 719), False, 'import os\n'), ((2463, 2554), 'pytorch_lightning.Trainer', 'pl.Trainer', ([], {'default_root_dir': 'dir_path', 'checkpoint_callback': '(True)', 'max_epochs': 'max_epochs'}), '(default_root_dir=dir_path, checkpoin... |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def calculadora(request):
context = {
'titulo' : "Ingrese los numeros",
}
return render(request,'operaciones/formulario.html',context)
def resultado(request):
a=request.POST['numeroa']
b=req... | [
"django.shortcuts.render"
] | [((202, 257), 'django.shortcuts.render', 'render', (['request', '"""operaciones/formulario.html"""', 'context'], {}), "(request, 'operaciones/formulario.html', context)\n", (208, 257), False, 'from django.shortcuts import render\n'), ((837, 892), 'django.shortcuts.render', 'render', (['request', '"""operaciones/resulta... |
import deeplabcut as dlc
import os
from fcutils.file_io.utils import listdir
# from fcutils.video.utils import trim_clip
config_file = 'D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion\\dlc\\locomotion-Federico\\config.yaml'
dlc.train_network(config_file)
# fld = 'D:\\Dropbox (UCL - SWC)\\Rotation_vte\\Locomotion... | [
"deeplabcut.train_network"
] | [((230, 260), 'deeplabcut.train_network', 'dlc.train_network', (['config_file'], {}), '(config_file)\n', (247, 260), True, 'import deeplabcut as dlc\n')] |
import pytest
from dnaio import Sequence
from cutadapt.adapters import Adapter, Match, Where, LinkedAdapter
def test_issue_52():
adapter = Adapter(
sequence='GAACTCCAGTCACNNNNN',
where=Where.BACK,
remove='suffix',
max_error_rate=0.12,
min_overlap=5,
read_wildcards=... | [
"cutadapt.adapters.Adapter",
"cutadapt.adapters.Match",
"pytest.mark.parametrize",
"dnaio.Sequence",
"cutadapt.adapters.LinkedAdapter"
] | [((5733, 5795), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""where"""', '[Where.PREFIX, Where.SUFFIX]'], {}), "('where', [Where.PREFIX, Where.SUFFIX])\n", (5756, 5795), False, 'import pytest\n'), ((146, 309), 'cutadapt.adapters.Adapter', 'Adapter', ([], {'sequence': '"""GAACTCCAGTCACNNNNN"""', 'where': '... |
#!/bin/python3
import os
#
# Complete the 'solve' function below.
#
# The function is expected to return an INTEGER_ARRAY.
# The function accepts following parameters:
# 1. 2D_INTEGER_ARRAY tree
# 2. 2D_INTEGER_ARRAY queries
#
def solve(tree, queries):
# Write your code here
from bisect import bisect_righ... | [
"bisect.bisect_right"
] | [((1244, 1272), 'bisect.bisect_right', 'bisect_right', (['weights', 'right'], {}), '(weights, right)\n', (1256, 1272), False, 'from bisect import bisect_right\n'), ((1299, 1330), 'bisect.bisect_right', 'bisect_right', (['weights', '(left - 1)'], {}), '(weights, left - 1)\n', (1311, 1330), False, 'from bisect import bis... |
#!usr/bin/python2.7
# coding=utf-8
#######################################################
# Name : Multi BF (MBF) <cookie method> #
# File : search_name.py #
# Author : DulLah #
# Github : https://github.com/dz-id #
# Fa... | [
"os.listdir",
"json.dumps",
"bs4.BeautifulSoup",
"datetime.datetime.now",
"sys.stdout.flush",
"os.remove"
] | [((2249, 2267), 'os.listdir', 'os.listdir', (['"""dump"""'], {}), "('dump')\n", (2259, 2267), False, 'import os, re, sys, json\n'), ((2382, 2396), 'json.dumps', 'json.dumps', (['id'], {}), '(id)\n', (2392, 2396), False, 'import os, re, sys, json\n'), ((1203, 1234), 'bs4.BeautifulSoup', 'parser', (['response', '"""html.... |
#
# Copyright (c) 2021 Idiap Research Institute, https://www.idiap.ch/
# Written by <NAME> <<EMAIL>>
#
""" Computes the proportion of novel bigrams in the summary. """
import numpy as np
import pandas as pd
from interface import Evaluation
from eval_utils import preprocess_article, preprocess_summary
class NovelBi... | [
"numpy.mean",
"eval_utils.preprocess_summary",
"eval_utils.preprocess_article",
"argparse.ArgumentParser"
] | [((2008, 2108), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Computes the proportion of novel bigrams in the summary."""'}), "(description=\n 'Computes the proportion of novel bigrams in the summary.')\n", (2031, 2108), False, 'import argparse\n'), ((869, 896), 'eval_utils.preproces... |
import argparse
import channel_access.common as ca
import channel_access.client as cac
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Read process values')
parser.add_argument('pvs', metavar='PV', type=str, nargs='+',
help='list of process values')
args ... | [
"channel_access.client.Client",
"argparse.ArgumentParser"
] | [((131, 189), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Read process values"""'}), "(description='Read process values')\n", (154, 189), False, 'import argparse\n'), ((352, 364), 'channel_access.client.Client', 'cac.Client', ([], {}), '()\n', (362, 364), True, 'import channel_access.... |
from scipy.special import factorial
from itertools import count
import numpy as np
from tmps.utils import pauli, fock
def get_boson_boson_dim(alpha, cutoff_coh):
"""
Find the cutoff for the local dimension (identical everywhere) from the chosen accuracy alpha for the impurity
coherent state.
"... | [
"tmps.utils.fock.a_dag",
"numpy.abs",
"scipy.special.factorial",
"numpy.array",
"tmps.utils.fock.n",
"tmps.utils.fock.a",
"itertools.count"
] | [((462, 482), 'itertools.count', 'count', (['cutoff_dim', '(1)'], {}), '(cutoff_dim, 1)\n', (467, 482), False, 'from itertools import count\n'), ((1654, 1676), 'tmps.utils.fock.n', 'fock.n', (['bath_local_dim'], {}), '(bath_local_dim)\n', (1660, 1676), False, 'from tmps.utils import pauli, fock\n'), ((3352, 3374), 'tmp... |
#!/usr/bin/env python
import os
import time
class Logbook(object):
def __init__(self):
"""
Class initialization
"""
self._id = time.strftime("%d%m%Y_%H%M%S", time.gmtime()) #id of the log, it's the timestamp
self._trial = 0
self._pinv = 0.0
self._rinv = 0.0... | [
"os.path.isfile",
"time.gmtime"
] | [((2227, 2251), 'os.path.isfile', 'os.path.isfile', (['filePath'], {}), '(filePath)\n', (2241, 2251), False, 'import os\n'), ((197, 210), 'time.gmtime', 'time.gmtime', ([], {}), '()\n', (208, 210), False, 'import time\n')] |
from sys import stderr
from study.models import Result, ActiveTranslation
def update_score(learner, result, verified=False):
"""
Update the score after a phrase has been judged.
:param result: Result.CORRECT, Result.CLOSE or Result.INCORRECT
:return: Result instance
"""
if result == Result.CORRECT:
base =... | [
"study.models.Result"
] | [((1576, 1690), 'study.models.Result', 'Result', ([], {'learner': 'learner', 'asked': 'learner.study_hidden', 'known': 'learner.study_shown', 'result': 'result', 'verified': '(False)'}), '(learner=learner, asked=learner.study_hidden, known=learner.\n study_shown, result=result, verified=False)\n', (1582, 1690), Fals... |
#!/usr/bin/env python
"""
.. codeauthor:: <NAME> <<EMAIL>>
"""
import sys
from readmemaker import ReadmeMaker
PROJECT_NAME = "tabledata"
OUTPUT_DIR = ".."
def main():
maker = ReadmeMaker(
PROJECT_NAME,
OUTPUT_DIR,
is_make_toc=True,
project_url=f"https://github.com/thombashi/{P... | [
"readmemaker.ReadmeMaker"
] | [((186, 306), 'readmemaker.ReadmeMaker', 'ReadmeMaker', (['PROJECT_NAME', 'OUTPUT_DIR'], {'is_make_toc': '(True)', 'project_url': 'f"""https://github.com/thombashi/{PROJECT_NAME}"""'}), "(PROJECT_NAME, OUTPUT_DIR, is_make_toc=True, project_url=\n f'https://github.com/thombashi/{PROJECT_NAME}')\n", (197, 306), False,... |
#! /usr/bin/env python
from expired_cert_finder.plugins.raw import RawParser
from expired_cert_finder.plugins.yaml import YamlParser
from expired_cert_finder.allowed_certs import AllowedCerts
rawParser = RawParser
yamlParser = YamlParser
# handle dynamic loading.
def scan_file_for_certificate(path, expired_only, d... | [
"expired_cert_finder.allowed_certs.AllowedCerts.instance"
] | [((372, 395), 'expired_cert_finder.allowed_certs.AllowedCerts.instance', 'AllowedCerts.instance', ([], {}), '()\n', (393, 395), False, 'from expired_cert_finder.allowed_certs import AllowedCerts\n')] |
import unittest
from mock import Mock
from foundations_spec.helpers.spec import Spec
from foundations_spec.helpers import let, let_mock, set_up
class TestLazyBucket(Spec):
@let
def lazy_bucket(self):
from foundations_contrib.lazy_bucket import LazyBucket
return LazyBucket(self.bucket_constru... | [
"foundations_contrib.lazy_bucket.LazyBucket",
"foundations_spec.helpers.let_mock"
] | [((446, 456), 'foundations_spec.helpers.let_mock', 'let_mock', ([], {}), '()\n', (454, 456), False, 'from foundations_spec.helpers import let, let_mock, set_up\n'), ((470, 480), 'foundations_spec.helpers.let_mock', 'let_mock', ([], {}), '()\n', (478, 480), False, 'from foundations_spec.helpers import let, let_mock, set... |
# Python Standard Libraries
import warnings
# grAdapt
# from .base import Equidistributed
from .MaximalMinDistance import MaximalMinDistance
class Mitchell(MaximalMinDistance):
"""
[Mitchell et al., 1991],
Spectrally optimal sampling for distribution ray tracing
"""
def __init__(self, m=3):
... | [
"warnings.warn"
] | [((446, 694), 'warnings.warn', 'warnings.warn', (['"""Mitchell\' best candidate has a time complexity of O(n^3) and memory issues when dealing with higher sample numbers. Use MaximalMinDistance instead which is an improved version with linear time complexity."""', 'ResourceWarning'], {}), '(\n "Mitchell\' best candi... |
import numpy as np
class Material:
"""send color as list of 3 floats in range of 0-1"""
def __init__(self, color, reflection=0, transparency=0, emission=np.array((0, 0, 0)), refraction_ind=1):
self.color = np.array(color)
self.emission = emission # only for light sources
self.reflect... | [
"numpy.array"
] | [((164, 183), 'numpy.array', 'np.array', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (172, 183), True, 'import numpy as np\n'), ((225, 240), 'numpy.array', 'np.array', (['color'], {}), '(color)\n', (233, 240), True, 'import numpy as np\n')] |
import pandas as pd
from torch.utils.data import DataLoader
import multiprocessing as mp
import argparse
from DataSet import Dataset
import torch
import torch.nn as nn
from os import path
import Infer
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
cpu = torch.device('cpu')
parser = argparse.A... | [
"Models.AR_Net.ar_nt",
"os.path.exists",
"torch.nn.ReLU",
"Models.Transformer.trnsfrmr_nt",
"Infer.evaluate",
"argparse.ArgumentParser",
"torch.load",
"multiprocessing.cpu_count",
"torch.tensor",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"Models.CNN_LSTM.cnn_lstm",
"Models.LSTM.lstm_a",... | [((280, 299), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (292, 299), False, 'import torch\n'), ((310, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (333, 335), False, 'import argparse\n'), ((1734, 1748), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n'... |
#!/usr/bin/env python3
import re
import sys
import io
import os
import traceback
class TextPreprocessorError(Exception):
def __init__(self, file_id, line, msg):
super().__init__(f"{file_id}:{line}: {msg}")
def debug_print(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def preprocess(
... | [
"parser.parse_args",
"argparse.ArgumentParser",
"os.path.realpath",
"parser.add_argument",
"parser.parse_exec",
"traceback.print_exc"
] | [((430, 475), 'parser.parse_exec', 'parser.parse_exec', (['file', 'definitions', 'file_id'], {}), '(file, definitions, file_id)\n', (447, 475), False, 'import parser\n'), ((539, 595), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Text preprocessor"""'}), "(description='Text preprocessor... |
from datetime import datetime, timezone
from io import StringIO
from unittest import mock
import freezegun
import pytest
from django.conf import settings
from django.core.management import call_command
from django.utils import timezone
from model_bakery import baker
from supportal.app.common.enums import CanvassResul... | [
"datetime.datetime",
"model_bakery.baker.make",
"django.core.management.call_command",
"supportal.app.models.EmailSend.objects.filter",
"supportal.app.models.EmailSend.objects.create",
"io.StringIO",
"datetime.datetime.now",
"supportal.app.models.EmailSend.objects.get",
"supportal.app.models.EmailSe... | [((379, 425), 'datetime.datetime', 'datetime', (['(2019)', '(10)', '(26)', '(1)'], {'tzinfo': 'timezone.utc'}), '(2019, 10, 26, 1, tzinfo=timezone.utc)\n', (387, 425), False, 'from datetime import datetime, timezone\n'), ((447, 490), 'datetime.datetime', 'datetime', (['(2019)', '(10)', '(26)'], {'tzinfo': 'timezone.utc... |
import gym
from gym import error, spaces, utils
from gym.utils import seeding
from eplus.envs import pyEp
import socket
from eplus.envs.socket_builder import socket_builder
import numpy as np
import os
class DataCenterEnv(gym.Env):
def __init__(self, config):
#timestep=12, days=1, eplus_path=None,
... | [
"eplus.envs.pyEp.ep_process",
"numpy.clip",
"eplus.envs.socket_builder.socket_builder",
"os.path.dirname",
"numpy.array"
] | [((425, 450), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (440, 450), False, 'import os\n'), ((6761, 6822), 'numpy.array', 'np.array', (['[self.outputs[1], self.outputs[2], self.outputs[4]]'], {}), '([self.outputs[1], self.outputs[2], self.outputs[4]])\n', (6769, 6822), True, 'import numpy... |
"""
Copyright (c) 2018 Jet Propulsion Laboratory,
California Institute of Technology. All rights reserved
"""
import json
from msfbe.webmodel import BaseHandler, service_handler
import requests
import psycopg2
class CountiesColumns:
COUNTY_ID = 0
NAME = 1
AREA = 2
PERIMETER = 3
CACOA = 4
CACO... | [
"json.dumps",
"msfbe.webmodel.BaseHandler.__init__"
] | [((486, 509), 'json.dumps', 'json.dumps', (['self.result'], {}), '(self.result)\n', (496, 509), False, 'import json\n'), ((712, 738), 'msfbe.webmodel.BaseHandler.__init__', 'BaseHandler.__init__', (['self'], {}), '(self)\n', (732, 738), False, 'from msfbe.webmodel import BaseHandler, service_handler\n')] |
import time
def tic():
#Homemade version of matlab tic and toc functions
global startTime_for_tictoc
startTime_for_tictoc = time.time()
def toc():
if 'startTime_for_tictoc' in globals():
print("Elapsed time is " + str(time.time() - startTime_for_tictoc) + " seconds.")
else:
print... | [
"time.time"
] | [((138, 149), 'time.time', 'time.time', ([], {}), '()\n', (147, 149), False, 'import time\n'), ((246, 257), 'time.time', 'time.time', ([], {}), '()\n', (255, 257), False, 'import time\n')] |
'''
* This Software is under the MIT License
* Refer to LICENSE or https://opensource.org/licenses/MIT for more information
* Written by ©<NAME> 2020
'''
from skimage import img_as_float
from skimage import io, color, morphology
import matplotlib.pyplot as plt
def get_skeleton_and_thin(input_image):
image = img_as... | [
"matplotlib.pyplot.imsave",
"skimage.morphology.thin",
"skimage.io.imread",
"matplotlib.pyplot.subplots",
"skimage.morphology.skeletonize"
] | [((466, 502), 'skimage.morphology.skeletonize', 'morphology.skeletonize', (['image_binary'], {}), '(image_binary)\n', (488, 502), False, 'from skimage import io, color, morphology\n'), ((515, 544), 'skimage.morphology.thin', 'morphology.thin', (['image_binary'], {}), '(image_binary)\n', (530, 544), False, 'from skimage... |
from csv import DictReader
from xml.etree import ElementTree as ET
def csv2html_robust(txt, header=True, attr=None):
# Use DictReader because, despite what the docs say, reader() doesn't
# return an object with .fieldnames
# (DictReader expects an iterable that returns lines, so split on \n)
reader = D... | [
"xml.etree.ElementTree.tostring",
"xml.etree.ElementTree.SubElement"
] | [((1072, 1105), 'xml.etree.ElementTree.tostring', 'ET.tostring', (['table'], {'method': '"""html"""'}), "(table, method='html')\n", (1083, 1105), True, 'from xml.etree import ElementTree as ET\n'), ((647, 676), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['thead_tr', '"""TD"""'], {}), "(thead_tr, 'TD')\n", (6... |
# -*- coding: utf-8 -*-
from naomi import testutils
from . import snr_vad
class TestSNR_VADPlugin(testutils.Test_VADPlugin):
def setUp(self):
super(TestSNR_VADPlugin, self).setUp()
self.plugin = testutils.get_plugin_instance(
snr_vad.SNRPlugin,
self._test_input
)
... | [
"naomi.testutils.get_plugin_instance"
] | [((218, 284), 'naomi.testutils.get_plugin_instance', 'testutils.get_plugin_instance', (['snr_vad.SNRPlugin', 'self._test_input'], {}), '(snr_vad.SNRPlugin, self._test_input)\n', (247, 284), False, 'from naomi import testutils\n')] |