code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
'''
ExperimentClass.py: Contains the Experiment Class for reproducing RL Experiments.
Purpose:
- Stores all relevant parameters in experiment directory for easy reproducibility.
- Auto generates plot using chart_utils.
- Can document learning activity.
'''
# Python imports.
from __future__ import print_fu... | [
"json.loads",
"os.makedirs",
"simple_rl.utils.additional_datastructures.TupleEncoder",
"os.path.join",
"simple_rl.utils.chart_utils.make_plots",
"os.getcwd",
"os.path.isdir",
"collections.defaultdict",
"simple_rl.experiments.ExperimentParametersClass.ExperimentParameters",
"json.dump"
] | [((815, 826), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (824, 826), False, 'import os\n'), ((2325, 2353), 'simple_rl.experiments.ExperimentParametersClass.ExperimentParameters', 'ExperimentParameters', (['params'], {}), '(params)\n', (2345, 2353), False, 'from simple_rl.experiments.ExperimentParametersClass import Ex... |
# -*- coding: utf-8 -*-
import datetime
import hashlib
import json
import os
import socket
import subprocess
import tempfile
import urllib2
import shutil
from copy import deepcopy
from decimal import Decimal
from functools import wraps
from tempfile import NamedTemporaryFile
from zipfile import BadZipfile
from django... | [
"olympia.amo.utils.image_size",
"django.core.files.storage.default_storage.exists",
"olympia.addons.models.Addon.objects.filter",
"olympia.amo.celery.task",
"olympia.addons.models.Addon.objects.get",
"copy.deepcopy",
"olympia.versions.models.Version.from_upload",
"django.core.files.storage.default_sto... | [((11863, 11888), 'olympia.amo.celery.task', 'task', ([], {'ignore_result': '(False)'}), '(ignore_result=False)\n', (11867, 11888), False, 'from olympia.amo.celery import task\n'), ((2123, 2153), 'django.core.cache.cache.get', 'cache.get', (['validator.cache_key'], {}), '(validator.cache_key)\n', (2132, 2153), False, '... |
# pipeline.py
#
# An example of setting up a processing pipeline with generators
access_log = "ausdhuash test auhsd aushdua ahduasd auhdu uhasd"
def grep(pattern,lines):
for line in lines:
if pattern in line:
yield line
if __name__ == '__main__':
from follow import follow
# Set up ... | [
"follow.follow"
] | [((377, 395), 'follow.follow', 'follow', (['access_log'], {}), '(access_log)\n', (383, 395), False, 'from follow import follow\n')] |
from app import app
from flask import request
@app.route("/output/endpoint1", methods=["POST"])
def output_endpoint1():
assert request.headers["Content-Type"] == "application/json"
s = request.data.decode("utf-8")
assert s == '{ "user": "bob" }'
return app.response_class(
headers={"date": "DAT... | [
"app.app.response_class",
"flask.request.data.decode",
"app.app.route"
] | [((49, 97), 'app.app.route', 'app.route', (['"""/output/endpoint1"""'], {'methods': "['POST']"}), "('/output/endpoint1', methods=['POST'])\n", (58, 97), False, 'from app import app\n'), ((367, 397), 'app.app.route', 'app.route', (['"""/output/endpoint2"""'], {}), "('/output/endpoint2')\n", (376, 397), False, 'from app ... |
"""
Copyright 2016 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distrib... | [
"os.path.dirname",
"os.path.join"
] | [((689, 714), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (704, 714), False, 'import os, os.path\n'), ((758, 801), 'os.path.join', 'os.path.join', (['BASE_PATH', '"""pipelines"""', 'fname'], {}), "(BASE_PATH, 'pipelines', fname)\n", (770, 801), False, 'import os, os.path\n')] |
# Copyright (c) 2012 Midokura Japan K.K.
#
# 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 l... | [
"nova.api.openstack.compute.servers.ServersController",
"nova.tests.unit.api.openstack.fakes.HTTPRequest.blank",
"nova.tests.unit.api.openstack.fakes.fake_instance_get",
"six.text_type",
"nova.exception.InstanceIsLocked",
"nova.exception.InstanceNotFound",
"mock.patch.object",
"nova.api.openstack.comp... | [((1664, 1707), 'mock.patch.object', 'mock.patch.object', (['compute_api.API', '"""start"""'], {}), "(compute_api.API, 'start')\n", (1681, 1707), False, 'import mock\n'), ((3568, 3610), 'mock.patch.object', 'mock.patch.object', (['compute_api.API', '"""stop"""'], {}), "(compute_api.API, 'stop')\n", (3585, 3610), False,... |
import pandas as pd
import numpy as np
import os
from df_to_sql.write2text import *
def drop_cols(df, col2drop = []):
if len(col2drop) > 0:
cols = df.columns.to_list()
ncols = []
for i in range(len(cols)):
match = 0
for j in range(len(col2drop)):
if ... | [
"pandas.read_sql"
] | [((1912, 1934), 'pandas.read_sql', 'pd.read_sql', (['qry', 'conn'], {}), '(qry, conn)\n', (1923, 1934), True, 'import pandas as pd\n'), ((6082, 6103), 'pandas.read_sql', 'pd.read_sql', (['qr', 'conn'], {}), '(qr, conn)\n', (6093, 6103), True, 'import pandas as pd\n')] |
import sys, os, glob
import argparse
import time
import random
from copy import copy, deepcopy
from termcolor import colored, cprint
import numpy as np
from sklearn.metrics import precision_recall_fscore_support
from sklearn.metrics import roc_auc_score
from sklearn.metrics import precision_recall_curve
import torch
... | [
"torch.nn.ReLU",
"models.cnn.CNNMatchModel",
"msda_src.model_utils.get_critic_class",
"dataset.OAGDomainDataset",
"torch.log_softmax",
"torch.max",
"torch.nn.init.xavier_normal",
"sklearn.metrics.roc_auc_score",
"torch.softmax",
"torch.nn.MSELoss",
"numpy.array",
"msda_src.utils.op.softmax",
... | [((521, 543), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (536, 543), False, 'import sys, os, glob\n'), ((1064, 1097), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1087, 1097), False, 'import warnings\n'), ((1111, 1198), 'argparse.ArgumentPar... |
"""ILI9341 demo (color palette)."""
from time import sleep
from ili9341 import Display, color565
from machine import Pin, SPI
def hsv_to_rgb(h, s, v):
"""
Convert HSV to RGB (based on colorsys.py).
Args:
h (float): Hue 0 to 1.
s (float): Saturation 0 to 1.
v (float... | [
"machine.Pin",
"time.sleep"
] | [((1275, 1283), 'time.sleep', 'sleep', (['(9)'], {}), '(9)\n', (1280, 1283), False, 'from time import sleep\n'), ((974, 981), 'machine.Pin', 'Pin', (['(14)'], {}), '(14)\n', (977, 981), False, 'from machine import Pin, SPI\n'), ((988, 995), 'machine.Pin', 'Pin', (['(13)'], {}), '(13)\n', (991, 995), False, 'from machin... |
# Copyright 2018 The TensorFlow 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... | [
"tensorflow.python.ops.array_ops.size",
"tensorflow.python.platform.tf_logging.warn",
"tensorflow.python.framework.ops.get_default_graph",
"tensorflow.python.ops.math_ops.range",
"tensorflow.python.data.util.nest.flatten"
] | [((5471, 5710), 'tensorflow.python.platform.tf_logging.warn', 'tf_logging.warn', (['"""Could not find a standard reader in the input pipeline(one of TextLineDataset, TFRecordDataset, FixedLengthRecordDataset).So auto-sharding is not done. Please verify correctness of auto-sharding for your input."""'], {}), "(\n 'Co... |
'''
# something wrong with the logging/the way to write as a
'''
import os
import re
import time
import numpy as np
import matplotlib.pyplot as plt
import argparse
# original settings ...
parser = argparse.ArgumentParser()
parser.add_argument('--file_name', type = str, default = 0, help = 'The name of txt log fil... | [
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"os.getcwd",
"matplotlib.pyplot.axis",
"re.findall",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((203, 228), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (226, 228), False, 'import argparse\n'), ((807, 818), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (816, 818), False, 'import os\n'), ((889, 900), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (898, 900), False, 'import os\n'), ((982, 99... |
import logging
from PIL import Image
import os
import torch
from torchvision import transforms
from torch.utils.data import DataLoader, RandomSampler, DistributedSampler, SequentialSampler
from .dataset import CUB, CarsDataset, NABirds, dogs, INat2017, emptyJudge
from .autoaugment import AutoAugImageNetPolicy
logge... | [
"logging.getLogger",
"torch.utils.data.DistributedSampler",
"torch.distributed.barrier",
"torchvision.transforms.CenterCrop",
"torch.utils.data.SequentialSampler",
"torchvision.transforms.RandomHorizontalFlip",
"torch.utils.data.RandomSampler",
"os.path.join",
"torchvision.transforms.RandomCrop",
... | [((324, 351), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (341, 351), False, 'import logging\n'), ((7767, 7897), 'torch.utils.data.DataLoader', 'DataLoader', (['trainset'], {'sampler': 'train_sampler', 'batch_size': 'args.train_batch_size', 'num_workers': '(4)', 'drop_last': '(True)', ... |
"""
Logger is a functional module for writing csv files
A new logging session is started with `logger.start_new_session()`.
With the returned session handle data can be written with `logger.start()`.
The session can be ended with `logger.close_session()`. The file will then be closed.
"""
import csv
import os
import ... | [
"os.path.abspath",
"csv.writer",
"typing.NamedTuple",
"pathlib.Path"
] | [((365, 451), 'typing.NamedTuple', 'typing.NamedTuple', (['"""loghandle"""', "[('file', typing.TextIO), ('writer', csv.writer)]"], {}), "('loghandle', [('file', typing.TextIO), ('writer', csv.\n writer)])\n", (382, 451), False, 'import typing\n'), ((1289, 1321), 'pathlib.Path', 'Path', (["(ROOT_DIR + '/' + directory... |
import unittest
import numpy as np
from .softlearning_env_test import AdapterTestClass
from softlearning.environments.adapters.robosuite_adapter import (
RobosuiteAdapter)
class TestRobosuiteAdapter(unittest.TestCase, AdapterTestClass):
# TODO(hartikainen): This is a terrible way of testing the envs.
# ... | [
"unittest.main",
"numpy.ones",
"softlearning.environments.adapters.robosuite_adapter.RobosuiteAdapter"
] | [((4622, 4637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4635, 4637), False, 'import unittest\n'), ((458, 581), 'softlearning.environments.adapters.robosuite_adapter.RobosuiteAdapter', 'RobosuiteAdapter', (['domain', 'task', '*args'], {'has_renderer': '(False)', 'has_offscreen_renderer': '(False)', 'use_cam... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# @filename:mhandle_content.py
# @author: wheee/qmppz
# @time:20190709
# @description: handle msg, python3
import configparser
import time
import random
import json
import os
import re
import requests
import sys
# sys.path.append("../..")
# import igotolibrary.mhandle_conten... | [
"crawldata.get_name",
"utils.Atask",
"requests.post",
"json.loads",
"requests.Session",
"random.choice",
"utils.fill_cookies",
"utils.MyMemcache",
"utils.get_response",
"utils.parse_grab_seat_cmd",
"crawldata.refresh_school_info",
"re.compile",
"json.dumps",
"utils.SqlAct",
"utils.GBCF",... | [((456, 469), 'utils.Atask', 'utils.Atask', ([], {}), '()\n', (467, 469), False, 'import utils\n'), ((476, 488), 'utils.GBCF', 'utils.GBCF', ([], {}), '()\n', (486, 488), False, 'import utils\n'), ((683, 701), 'requests.Session', 'requests.Session', ([], {}), '()\n', (699, 701), False, 'import requests\n'), ((751, 765)... |
from day5 import parse
from intcode import IntCode
BLACK = 0
WHITE = 1
N = 1j
LEFT, RIGHT = -1j, 1j
def loop_run(program, current_color=BLACK):
heading = N
position = 0
painted_panels = {position: current_color}
intcode = IntCode(program)
while current_color is not None:
input_value = ... | [
"intcode.IntCode",
"day5.parse"
] | [((243, 259), 'intcode.IntCode', 'IntCode', (['program'], {}), '(program)\n', (250, 259), False, 'from intcode import IntCode\n'), ((1779, 1793), 'day5.parse', 'parse', (['program'], {}), '(program)\n', (1784, 1793), False, 'from day5 import parse\n'), ((1846, 1860), 'day5.parse', 'parse', (['program'], {}), '(program)... |
import random
from typing import Any, Dict, List, Optional, Type
from mathy_core.expressions import MathExpression
from mathy_core.problems import get_rand_term_templates, mathy_term_string
from mathy_core.rule import BaseRule
from mathy_core.rules import (
AssociativeSwapRule,
CommutativeSwapRule,
Constan... | [
"mathy_core.util.get_term_ex",
"mathy_core.util.get_terms",
"random.shuffle",
"mathy_core.problems.mathy_term_string",
"mathy_core.rule.BaseRule",
"mathy_core.problems.get_rand_term_templates",
"random.randint"
] | [((2647, 2671), 'mathy_core.util.get_term_ex', 'get_term_ex', (['action_node'], {}), '(action_node)\n', (2658, 2671), False, 'from mathy_core.util import TermEx, get_term_ex, get_terms\n'), ((2694, 2715), 'mathy_core.util.get_terms', 'get_terms', (['expression'], {}), '(expression)\n', (2703, 2715), False, 'from mathy_... |
# -*- coding: utf-8 -*-
"""
Created on Wed May 09 11:41:19 2018
@author: Prodipta
"""
from enum import Enum
import time
import datetime
import pytz
import pandas as pd
class ClockEvents(Enum):
BAR = 0
SESSION_START = 1
SESSION_END = 2
MINUTE_END = 3
BEFORE_TRADING_START_BAR = 4
HEART_BEAT = 5
... | [
"pytz.timezone",
"datetime.time",
"time.sleep",
"datetime.datetime.now",
"pandas.Timestamp",
"time.time"
] | [((1257, 1285), 'pytz.timezone', 'pytz.timezone', (['self.timezone'], {}), '(self.timezone)\n', (1270, 1285), False, 'import pytz\n'), ((1299, 1324), 'datetime.datetime.now', 'datetime.datetime.now', (['tz'], {}), '(tz)\n', (1320, 1324), False, 'import datetime\n'), ((1350, 1380), 'pandas.Timestamp', 'pd.Timestamp', ([... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021
import argparse
import os
import sys
import logging
from enum import Enum
from struct import unpack, pack
from binascii import hexlify
try:
from edl.Library.utils import LogBase, structhelper
except:
from utils import LogBase, structhelper
c... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.makedirs",
"binascii.hexlify",
"os.path.join",
"struct.unpack",
"logging.FileHandler",
"sys.exit",
"os.stat",
"utils.structhelper"
] | [((12099, 12147), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""GPT utils"""'}), "(description='GPT utils')\n", (12122, 12147), False, 'import argparse\n'), ((422, 440), 'utils.structhelper', 'structhelper', (['data'], {}), '(data)\n', (434, 440), False, 'from utils import LogBase, stru... |
# Copyright 21 May 2005 - (c) 2005 <NAME> <<EMAIL>>
# Copyright 2005-2007 <NAME> <<EMAIL>>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from __future__ import absolute_import
import contextlib
import struct
import sys
import t... | [
"threading.Event",
"sys.exit"
] | [((27758, 27769), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (27766, 27769), False, 'import sys\n'), ((27619, 27636), 'threading.Event', 'threading.Event', ([], {}), '()\n', (27634, 27636), False, 'import threading\n')] |
#!/usr/bin/env python3
# _*_ coding:utf-8 _*_
import json
from . import jdbot, chat_id, logger, LOG_DIR, BOT_SET_JSON_FILE_USER, BOT_SET_JSON_FILE, BOT_SET, BOT_DIR
from .utils import load_module
import os
import random
from .bot.update import version, botlog
BOT_UP_LOG = f'{LOG_DIR}/bot/up.log'
BOT_M_DIR = f'{BOT_DI... | [
"json.load",
"os.path.exists",
"json.dump"
] | [((775, 801), 'os.path.exists', 'os.path.exists', (['BOT_UP_LOG'], {}), '(BOT_UP_LOG)\n', (789, 801), False, 'import os\n'), ((1837, 1875), 'os.path.exists', 'os.path.exists', (['BOT_SET_JSON_FILE_USER'], {}), '(BOT_SET_JSON_FILE_USER)\n', (1851, 1875), False, 'import os\n'), ((1813, 1825), 'json.load', 'json.load', ([... |
from typing import Set, Dict, List
from pathlib import Path
from pydantic import BaseModel
from py_irt.io import read_jsonlines
from sklearn.feature_extraction.text import CountVectorizer
class ItemAccuracy(BaseModel):
correct: int = 0
total: int = 0
@property
def accuracy(self):
return self.c... | [
"sklearn.feature_extraction.text.CountVectorizer",
"py_irt.io.read_jsonlines"
] | [((2066, 2091), 'py_irt.io.read_jsonlines', 'read_jsonlines', (['data_path'], {}), '(data_path)\n', (2080, 2091), False, 'from py_irt.io import read_jsonlines\n'), ((2671, 2731), 'sklearn.feature_extraction.text.CountVectorizer', 'CountVectorizer', ([], {'max_df': '(0.5)', 'min_df': '(20)', 'stop_words': '"""english"""... |
import Bio.PDB.Superimposer
from Bio.PDB.Atom import Atom as BioPDBAtom
import numpy as np
import warnings
from Bio.PDB.Atom import PDBConstructionWarning
from classes.PDB import PDB
from classes.Atom import Atom
warnings.simplefilter('ignore', PDBConstructionWarning)
def biopdb_aligned_chain(pdb_fixed, chain_id_fixe... | [
"Bio.PDB.Atom.Atom",
"numpy.matmul",
"warnings.simplefilter",
"numpy.transpose",
"classes.PDB.PDB"
] | [((213, 268), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'PDBConstructionWarning'], {}), "('ignore', PDBConstructionWarning)\n", (234, 268), False, 'import warnings\n'), ((1482, 1515), 'numpy.matmul', 'np.matmul', (['pdb_moving_coords', 'rot'], {}), '(pdb_moving_coords, rot)\n', (1491, 1515), T... |
import base64
from datetime import datetime
import json
import random
import re
from tests.tx_generator.k8s_handler import api_call, aws_api_call
class WalletAPI:
"""
WalletAPI communicates with a [random] miner pod for
information such as a wallet nonce, balance and
submitting transactions
"""
... | [
"re.search",
"json.loads",
"re.compile",
"tests.tx_generator.k8s_handler.api_call",
"base64.b64encode",
"datetime.datetime.now",
"tests.tx_generator.k8s_handler.aws_api_call"
] | [((5213, 5241), 're.search', 're.search', (['id_pat', 'tx_output'], {}), '(id_pat, tx_output)\n', (5222, 5241), False, 'import re\n'), ((5637, 5661), 're.compile', 're.compile', (['"""(?<!\\\\\\\\)\'"""'], {}), '("(?<!\\\\\\\\)\'")\n', (5647, 5661), False, 'import re\n'), ((5709, 5724), 'json.loads', 'json.loads', (['r... |
import uuid
import urllib
import os
import json
from datetime import datetime
from functools import wraps, update_wrapper
import requests
from flask import g, request, abort, make_response, Response
from flask_restplus import Resource, fields
from werkzeug.datastructures import FileStorage
from pyinfraboxutils imp... | [
"flask.request.args.get",
"requests.post",
"pyinfraboxutils.ibrestplus.api.expect",
"flask.g.db.execute_one_dict",
"urllib.quote",
"flask.g.db.execute",
"pyinfraboxutils.ibflask.OK",
"json.dumps",
"functools.wraps",
"pyinfraboxutils.ibrestplus.api.doc",
"flask.abort",
"pyinfraboxutils.ibrestpl... | [((553, 663), 'pyinfraboxutils.ibrestplus.api.namespace', 'api.namespace', (['"""Projects"""'], {'path': '"""/api/v1/projects/<project_id>"""', 'description': '"""Project related operations"""'}), "('Projects', path='/api/v1/projects/<project_id>', description\n ='Project related operations')\n", (566, 663), False, ... |
from typing import Any
import numpy as np
from xgboost import XGBClassifier
from bender.model_trainer.interface import ModelTrainer
from bender.split_strategy.split_strategy import TrainingDataSet
from bender.trained_model.interface import TrainedModel
from bender.trained_model.xgboosted_tree import TrainedXGBoostMod... | [
"bender.trained_model.xgboosted_tree.TrainedXGBoostModel",
"numpy.round",
"xgboost.XGBClassifier"
] | [((1720, 1756), 'xgboost.XGBClassifier', 'XGBClassifier', ([], {}), '(**self.xgboost_parmas)\n', (1733, 1756), False, 'from xgboost import XGBClassifier\n'), ((2163, 2212), 'bender.trained_model.xgboosted_tree.TrainedXGBoostModel', 'TrainedXGBoostModel', (['model', 'data_split.x_features'], {}), '(model, data_split.x_f... |
#-------------------------------------------------------------------------------
# Name: DNS_modules
# Purpose:
#
# Author: <EMAIL>
#
# Created: 05/31/2014
#-------------------------------------------------------------------------------
import os
import sys
import tools
import module_locater
import dns.... | [
"os.path.exists",
"datetime.datetime.now",
"os.makedirs",
"module_locater.module_path"
] | [((358, 386), 'module_locater.module_path', 'module_locater.module_path', ([], {}), '()\n', (384, 386), False, 'import module_locater\n'), ((600, 626), 'os.path.exists', 'os.path.exists', (['resultsdir'], {}), '(resultsdir)\n', (614, 626), False, 'import os\n'), ((632, 655), 'os.makedirs', 'os.makedirs', (['resultsdir'... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"traceback.format_exc",
"concurrent.futures.ThreadPoolExecutor",
"re.match",
"threading.RLock",
"time.sleep",
"queue.Queue",
"time.time"
] | [((1281, 1298), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (1296, 1298), False, 'import threading\n'), ((3990, 4024), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {'max_workers': '(32)'}), '(max_workers=32)\n', (4008, 4024), False, 'from concurrent.futures import ThreadPoolExecutor\n... |
# -*- coding: utf-8 -*-
"""
Defines unit tests for :mod:`colour.colorimetry.lightness` module.
"""
import numpy as np
import unittest
from colour.colorimetry import (lightness_Glasser1958, lightness_Wyszecki1963,
intermediate_lightness_function_CIE1976,
... | [
"numpy.tile",
"numpy.reshape",
"colour.colorimetry.lightness_CIE1976",
"colour.colorimetry.lightness_Glasser1958",
"colour.utilities.domain_range_scale",
"colour.colorimetry.lightness_Fairchild2011",
"colour.colorimetry.lightness_Wyszecki1963",
"numpy.array",
"colour.colorimetry.lightness.lightness"... | [((17391, 17406), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17404, 17406), False, 'import unittest\n'), ((1935, 1959), 'colour.colorimetry.lightness_Glasser1958', 'lightness_Glasser1958', (['Y'], {}), '(Y)\n', (1956, 1959), False, 'from colour.colorimetry import lightness_Glasser1958, lightness_Wyszecki1963,... |
"""
A :class:`~glue.core.subset_group.SubsetGroup` unites a group of
:class:`~glue.core.subset.Subset` instances together with a consistent state,
label, and style.
While subsets are internally associated with particular datasets, it's
confusing for the user to juggle multiple similar or identical
subsets, applied to ... | [
"glue.core.visual.VisualAttributes",
"glue.utils.Pointer",
"glue.core.contracts.contract",
"warnings.warn",
"glue.core.subset.SubsetState"
] | [((1368, 1397), 'glue.utils.Pointer', 'Pointer', (['"""group.subset_state"""'], {}), "('group.subset_state')\n", (1375, 1397), False, 'from glue.utils import Pointer\n'), ((1410, 1432), 'glue.utils.Pointer', 'Pointer', (['"""group.label"""'], {}), "('group.label')\n", (1417, 1432), False, 'from glue.utils import Pointe... |
import random
#Generate a random number to be guessed
number = random.randint(0, 100)
print("Guess a magic number between 0 and 100")
while True:
#Prompt the user to guess the number
guess = eval(input("Enter your guess: "))
if guess == number:
print("Yes, the number is " + str(number))
... | [
"random.randint"
] | [((64, 86), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (78, 86), False, 'import random\n')] |
# XXX depends on internet connectivity, so not run as part of standard tests
from __future__ import absolute_import, division, print_function
def exercise():
from mmtbx.wwpdb import rcsb_web_services
lysozyme = """<KEY>"""
homologs = rcsb_web_services.sequence_search(lysozyme, d_max=2.0)
assert (len(homologs... | [
"mmtbx.wwpdb.rcsb_web_services.chemical_id_search",
"mmtbx.wwpdb.rcsb_web_services.get_ligand_info_for_structures",
"mmtbx.wwpdb.rcsb_web_services.get_high_resolution_for_structures",
"mmtbx.wwpdb.rcsb_web_services.sequence_search"
] | [((243, 297), 'mmtbx.wwpdb.rcsb_web_services.sequence_search', 'rcsb_web_services.sequence_search', (['lysozyme'], {'d_max': '(2.0)'}), '(lysozyme, d_max=2.0)\n', (276, 297), False, 'from mmtbx.wwpdb import rcsb_web_services\n'), ((345, 407), 'mmtbx.wwpdb.rcsb_web_services.chemical_id_search', 'rcsb_web_services.chemic... |
from insertion_sort import insertion_sort
def test_insertion_sort_one():
arr =[4,1,5,6,3]
assert insertion_sort(arr) == [1,3,4,5,6,]
def test_insertion_sort_two():
arr =[20,11,14,17,19]
assert insertion_sort(arr) == [11,14,17,19,20]
def test_insertion_sort_empty():
arr =[]
assert insertion_sor... | [
"insertion_sort.insertion_sort"
] | [((107, 126), 'insertion_sort.insertion_sort', 'insertion_sort', (['arr'], {}), '(arr)\n', (121, 126), False, 'from insertion_sort import insertion_sort\n'), ((211, 230), 'insertion_sort.insertion_sort', 'insertion_sort', (['arr'], {}), '(arr)\n', (225, 230), False, 'from insertion_sort import insertion_sort\n'), ((307... |
from tests import BaseTestCase
from flask import Flask
from nose.tools import assert_equals
class MongoDBURITestCase(BaseTestCase):
"MongoDB URI generation"
def setup(self):
self.app = Flask(__name__)
self.app.config['MONGOALCHEMY_DATABASE'] = 'test'
def should_use_localhost_for_server_an... | [
"flaskext.mongoalchemy._get_mongo_uri",
"flask.Flask"
] | [((203, 218), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (208, 218), False, 'from flask import Flask\n'), ((465, 489), 'flaskext.mongoalchemy._get_mongo_uri', '_get_mongo_uri', (['self.app'], {}), '(self.app)\n', (479, 489), False, 'from flaskext.mongoalchemy import _get_mongo_uri\n'), ((744, 768), 'fl... |
#!/usr/bin/env python3
import sys
import os
from glob import glob
from constants import CHESSBOARDS_DIR, TILES_DIR
OUT_FILE = 'images.html'
def _save_output_html(tile_dirs):
html = '<html lang="en">'
html += '<link rel="stylesheet" href="./web/style.css" />'
for tile_dir in tile_dirs:
img_dir = ... | [
"os.path.join",
"glob.glob"
] | [((1747, 1784), 'os.path.join', 'os.path.join', (['TILES_DIR', 'sub_dir', '"""*"""'], {}), "(TILES_DIR, sub_dir, '*')\n", (1759, 1784), False, 'import os\n'), ((1978, 1998), 'glob.glob', 'glob', (['tiles_base_dir'], {}), '(tiles_base_dir)\n', (1982, 1998), False, 'from glob import glob\n'), ((771, 802), 'os.path.join',... |
#!/usr/bin/env python
"""
Demonstrate how to use major and minor tickers.
The two relevant userland classes are Locators and Formatters.
Locators determine where the ticks are and formatters control the
formatting of ticks.
Minor ticks are off by default (NullLocator and NullFormatter). You
can turn minor ticks on w... | [
"matplotlib.ticker.MultipleLocator",
"matplotlib.ticker.FormatStrFormatter"
] | [((1276, 1295), 'matplotlib.ticker.MultipleLocator', 'MultipleLocator', (['(20)'], {}), '(20)\n', (1291, 1295), False, 'from matplotlib.ticker import MultipleLocator, FormatStrFormatter\n'), ((1313, 1337), 'matplotlib.ticker.FormatStrFormatter', 'FormatStrFormatter', (['"""%d"""'], {}), "('%d')\n", (1331, 1337), False,... |
# -*- coding: utf-8 -*-
"""Module with form and form field definitions."""
from django import forms
from .bibliography.storage import FileType
__all__ = ('BibliographyUploadFileForm', 'BibliographyUploadEntryForm')
class FileTypeField(forms.TypedChoiceField):
"""Form field that provides a choice of a :class:`bi... | [
"django.forms.ChoiceField",
"django.forms.FileField",
"django.forms.Textarea"
] | [((1745, 1777), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'label': '"""Entry"""'}), "(label='Entry')\n", (1762, 1777), False, 'from django import forms\n'), ((1836, 1865), 'django.forms.FileField', 'forms.FileField', ([], {'label': '"""File"""'}), "(label='File')\n", (1851, 1865), False, 'from django impor... |
# Copyright 2019 by <NAME>. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should have been included
# as part of this package.
"""Tests for SearchIO HhsuiteIO parsers."""
import os
import unittest
from Bio.SearchIO import par... | [
"unittest.main",
"Bio.SearchIO.parse",
"os.path.join",
"unittest.TextTestRunner"
] | [((492, 524), 'os.path.join', 'os.path.join', (['TEST_DIR', 'filename'], {}), '(TEST_DIR, filename)\n', (504, 524), False, 'import os\n'), ((21681, 21717), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (21704, 21717), False, 'import unittest\n'), ((21722, 21754), '... |
import sys
import os
# check SBMolGen_PATH setting
if os.getenv('SBMolGen_PATH') == None:
print("THe SBMolGen_PATH has not defined, please set it before use it!")
exit(0)
else:
SBMolGen_PATH=os.getenv('SBMolGen_PATH')
sys.path.append(SBMolGen_PATH+'/utils')
from subprocess import Popen, PIPE
from math i... | [
"add_node_type_zinc.node_to_add",
"random.choice",
"numpy.amax",
"add_node_type_zinc.check_node_type",
"os.getenv",
"load_model.loaded_model",
"add_node_type_zinc.chem_kn_simulation",
"add_node_type_zinc.predict_smile",
"yaml.load",
"make_smile.zinc_data_with_bracket_original",
"add_node_type_zi... | [((54, 80), 'os.getenv', 'os.getenv', (['"""SBMolGen_PATH"""'], {}), "('SBMolGen_PATH')\n", (63, 80), False, 'import os\n'), ((203, 229), 'os.getenv', 'os.getenv', (['"""SBMolGen_PATH"""'], {}), "('SBMolGen_PATH')\n", (212, 229), False, 'import os\n'), ((234, 275), 'sys.path.append', 'sys.path.append', (["(SBMolGen_PAT... |
from argparse import ArgumentParser
import pytorch_lightning as pl
import torch
from torch.nn import functional as F
from pl_bolts.models.gans.basic.components import Discriminator, Generator
class GAN(pl.LightningModule):
"""
Vanilla GAN implementation.
Example::
from pl_bolts.models.gan impo... | [
"pytorch_lightning.Trainer.add_argparse_args",
"argparse.ArgumentParser",
"pl_bolts.callbacks.TensorboardGenerativeModelImageSampler",
"pytorch_lightning.seed_everything",
"torch.nn.functional.binary_cross_entropy",
"torch.zeros",
"pl_bolts.models.gans.basic.components.Discriminator",
"pl_bolts.models... | [((5341, 5365), 'pytorch_lightning.seed_everything', 'pl.seed_everything', (['(1234)'], {}), '(1234)\n', (5359, 5365), True, 'import pytorch_lightning as pl\n'), ((5380, 5396), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (5394, 5396), False, 'from argparse import ArgumentParser\n'), ((5917, 5953), 'p... |
from django.db import models
import uuid
class Alvo(models.Model):
identificador = models.UUIDField(verbose_name='UUID', default=uuid.uuid4, unique=True, primary_key=True)
nome = models.CharField(max_length=30, verbose_name='Nome do Alvo')
latitude = models.DecimalField(max_digits=10, decimal_places=6, v... | [
"django.db.models.DecimalField",
"django.db.models.DateField",
"django.db.models.UUIDField",
"django.db.models.CharField"
] | [((90, 182), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'verbose_name': '"""UUID"""', 'default': 'uuid.uuid4', 'unique': '(True)', 'primary_key': '(True)'}), "(verbose_name='UUID', default=uuid.uuid4, unique=True,\n primary_key=True)\n", (106, 182), False, 'from django.db import models\n'), ((190, 250),... |
import sys
import numpy as np
from matplotlib import pyplot
from matplotlib.animation import FuncAnimation
import matplotlib as mpl
sys.path.append('..')
from submission import SubmissionBase
def displayData(X, example_width=None, figsize=(10, 10)):
"""
Displays 2D data in a nice grid.
Parameters
--... | [
"numpy.mean",
"numpy.ceil",
"matplotlib.pyplot.grid",
"numpy.sqrt",
"matplotlib.animation.FuncAnimation",
"matplotlib.pyplot.gcf",
"numpy.diag",
"numpy.stack",
"matplotlib.pyplot.figure",
"matplotlib.colors.Normalize",
"numpy.std",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"s... | [((133, 154), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (148, 154), False, 'import sys\n'), ((1316, 1376), 'matplotlib.pyplot.subplots', 'pyplot.subplots', (['display_rows', 'display_cols'], {'figsize': 'figsize'}), '(display_rows, display_cols, figsize=figsize)\n', (1331, 1376), False, 'fro... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"os.path.dirname"
] | [((631, 656), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (646, 656), False, 'import os\n')] |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.ops.operations.SoftmaxCrossEntropyWithLogits",
"numpy.ones",
"mindspore.ops.operations.MatMul",
"mindspore.context.set_context",
"mindspore.ops.operations.comm_ops._VirtualDataset",
"mindspore.ops.composite.grad_all",
"mindspore.ops.operations.Gelu",
"mindspore.common.api._executor.compile"... | [((906, 950), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE'}), '(mode=context.GRAPH_MODE)\n', (925, 950), False, 'from mindspore import context\n'), ((2725, 2756), 'mindspore.common.api._executor.compile', '_executor.compile', (['net', 'x', 'y', 'b'], {}), '(net, x, y, b)\n'... |
# -*- coding: utf-8 -*
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import pytest
import requests
import os
from astropy.coordinates import SkyCoord
import astropy.units as u
from astropy.table import Table, Column
from astropy.io.votable import parse
from astroquery import log
from astroquery.c... | [
"astroquery.casda.Casda.filter_out_unreleased",
"astroquery.casda.Casda.stage_data",
"unittest.mock.Mock",
"astropy.table.Table",
"unittest.mock.MagicMock",
"os.path.join",
"astropy.coordinates.SkyCoord",
"astroquery.log.debug",
"os.path.dirname",
"astroquery.casda.Casda",
"pytest.raises",
"as... | [((2245, 2279), 'astroquery.log.debug', 'log.debug', (["('providing ' + filename)"], {}), "('providing ' + filename)\n", (2254, 2279), False, 'from astroquery import log\n'), ((2565, 2593), 'unittest.mock.Mock', 'Mock', ([], {'spec': 'requests.Response'}), '(spec=requests.Response)\n', (2569, 2593), False, 'from unitte... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"logging.getLogger",
"os.set_inheritable",
"psutil.Process",
"time.sleep",
"sys.stdin.fileno",
"subprocess.Popen",
"threading.RLock",
"os.getpid",
"shlex.quote",
"atexit.register",
"os.uname",
"os.getpgid",
"time.monotonic",
"os.killpg",
"signal.signal",
"threading.Event",
"psutil.wa... | [((1185, 1212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1202, 1212), False, 'import logging\n'), ((5475, 5513), 'atexit.register', 'atexit.register', (['GdbDebugger._stop_all'], {}), '(GdbDebugger._stop_all)\n', (5490, 5513), False, 'import atexit\n'), ((2286, 2303), 'threading.RL... |
from flask_marshmallow import Marshmallow
from marshmallow import Schema, post_load
from api.models import Book, Transaction, User
ma = Marshmallow()
class ResponseSchema(Schema):
class Meta:
fields = ('url', )
class BookSchema(ma.SQLAlchemyAutoSchema):
'''
Serializes book from and to DB.
... | [
"api.models.Book",
"flask_marshmallow.Marshmallow",
"api.models.User",
"api.models.Transaction"
] | [((138, 151), 'flask_marshmallow.Marshmallow', 'Marshmallow', ([], {}), '()\n', (149, 151), False, 'from flask_marshmallow import Marshmallow\n'), ((517, 529), 'api.models.Book', 'Book', ([], {}), '(**data)\n', (521, 529), False, 'from api.models import Book, Transaction, User\n'), ((820, 832), 'api.models.User', 'User... |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
"""
Jobclass to execute python scripts and jupyter notebooks
"""
import os
import shutil
from pyiron_base.job.generic im... | [
"os.path.join",
"pyiron_base.generic.datacontainer.DataContainer",
"os.path.basename",
"os.path.abspath",
"pyiron_base.generic.parameters.GenericParameters",
"os.path.relpath"
] | [((9158, 9197), 'pyiron_base.generic.datacontainer.DataContainer', 'DataContainer', ([], {'table_name': '"""custom_dict"""'}), "(table_name='custom_dict')\n", (9171, 9197), False, 'from pyiron_base.generic.datacontainer import DataContainer\n'), ((14228, 14257), 'os.path.basename', 'os.path.basename', (['script_path'],... |
# coding: utf-8
"""
Application Manager API
Application Manager APIs to control Apache Flink jobs # noqa: E501
OpenAPI spec version: 2.0.1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# py... | [
"ververica_api_sdk.api_client.ApiClient",
"six.iteritems"
] | [((2890, 2921), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2903, 2921), False, 'import six\n'), ((7308, 7339), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (7321, 7339), False, 'import six\n'), ((11689, 11720), 'six.iteritems', 'six.it... |
#py3
"""
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example shows characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. With the exce... | [
"sklearn.cluster.SpectralClustering",
"numpy.random.rand",
"sklearn.neighbors.kneighbors_graph",
"sklearn.datasets.make_circles",
"sklearn.cluster.MeanShift",
"matplotlib.patheffects.withStroke",
"sklearn.cluster.DBSCAN",
"sklearn.cluster.AgglomerativeClustering",
"sklearn.datasets.make_blobs",
"r... | [((1303, 1320), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (1317, 1320), True, 'import numpy as np\n'), ((1528, 1594), 'sklearn.datasets.make_circles', 'datasets.make_circles', ([], {'n_samples': 'n_samples', 'factor': '(0.5)', 'noise': '(0.05)'}), '(n_samples=n_samples, factor=0.5, noise=0.05)\n', ... |
import os.path as osp
from .builder import DATASETS
from .custom import CustomDataset
@DATASETS.register_module()
class MaSTr1325(CustomDataset):
"""PascalContext dataset.
In segmentation map annotation for PascalContext, 0 stands for background,
which is included in 60 categories. ``reduce_zero_label``... | [
"os.path.exists"
] | [((934, 958), 'os.path.exists', 'osp.exists', (['self.img_dir'], {}), '(self.img_dir)\n', (944, 958), True, 'import os.path as osp\n')] |
from django.conf import settings
from django.http import HttpResponse
from django.views.decorators.cache import never_cache
from django.contrib.admin.views.decorators import staff_member_required
from django.shortcuts import get_object_or_404, render
from models import Pelicula, ObraTeatro, Evento, Cine, CategoriaEven... | [
"django.shortcuts.render",
"models.LiveEmbedEvent.objects.get",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"models.CategoriaEvento.objects.order_by"
] | [((428, 469), 'models.CategoriaEvento.objects.order_by', 'CategoriaEvento.objects.order_by', (['"""order"""'], {}), "('order')\n", (460, 469), False, 'from models import Pelicula, ObraTeatro, Evento, Cine, CategoriaEvento, LiveEmbedEvent, ArchivedEvent\n'), ((481, 546), 'django.shortcuts.render', 'render', (['request',... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.clip",
"numpy.array",
"collections.namedtuple",
"collections.deque"
] | [((699, 796), 'collections.namedtuple', 'namedtuple', (['"""observation"""', "['time', 'qpos_robot', 'qvel_robot', 'qpos_object', 'qvel_object']"], {}), "('observation', ['time', 'qpos_robot', 'qvel_robot',\n 'qpos_object', 'qvel_object'])\n", (709, 796), False, 'from collections import namedtuple\n'), ((1198, 1246)... |
"""The main engine for CHIRP. Enumerates and runs the relevant plugin coroutines."""
# Standard Python Libraries
import asyncio
import os
from typing import Callable, Dict, Iterable, Iterator, List
# cisagov Libraries
from chirp import load
from chirp.common import CRITICAL, DEBUG, ERROR, OUTPUT_DIR, PLUGINS
from chi... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"os.mkdir",
"chirp.plugins.loader.load",
"chirp.common.CRITICAL",
"asyncio.get_event_loop"
] | [((546, 566), 'chirp.plugins.loader.load', 'loader.load', (['PLUGINS'], {}), '(PLUGINS)\n', (557, 566), False, 'from chirp.plugins import events, loader, network, registry, yara\n'), ((849, 873), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (871, 873), False, 'import asyncio\n'), ((468, 494), '... |
import re
from marrow.schema.testing import ValidationTest
from marrow.schema.validate.base import AlwaysRequired, Instance, Length, falsy, truthy, Concern
from marrow.schema.validate.compound import All, Any, Compound, Iterable, Mapping, Pipe
length = Length(slice(1, 21))
class CompoundSample(Compound):
bar = Al... | [
"marrow.schema.validate.compound.Mapping",
"marrow.schema.validate.compound.Iterable",
"marrow.schema.validate.base.Instance",
"marrow.schema.validate.base.AlwaysRequired"
] | [((318, 334), 'marrow.schema.validate.base.AlwaysRequired', 'AlwaysRequired', ([], {}), '()\n', (332, 334), False, 'from marrow.schema.validate.base import AlwaysRequired, Instance, Length, falsy, truthy, Concern\n'), ((342, 355), 'marrow.schema.validate.base.Instance', 'Instance', (['str'], {}), '(str)\n', (350, 355),... |
import numpy as np
import pandas as pd
from sklearn.base import TransformerMixin, ClassifierMixin
from suricate.preutils import concatixnames, createmultiindex, addsuffix
# THIS SHOULD BE OBSOLETE
class PipeDfClf(ClassifierMixin):
def __init__(self,
transformer,
classifier,
... | [
"suricate.preutils.createmultiindex",
"pandas.Series",
"suricate.preutils.concatixnames",
"sklearn.base.ClassifierMixin.__init__",
"suricate.preutils.addsuffix",
"pandas.DataFrame"
] | [((827, 857), 'sklearn.base.ClassifierMixin.__init__', 'ClassifierMixin.__init__', (['self'], {}), '(self)\n', (851, 857), False, 'from sklearn.base import TransformerMixin, ClassifierMixin\n'), ((1038, 1143), 'suricate.preutils.concatixnames', 'concatixnames', ([], {'ixname': 'self.ixname', 'source_suffix': 'self.sour... |
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 22 02:51:53 2016
@author: utkarsh
"""
# FREQEST - Estimate fingerprint ridge frequency within image block
#
# Function to estimate the fingerprint ridge frequency within a small block
# of a fingerprint image. This function is used by RIDGEFREQ
#
# Usage:
# freqim = ... | [
"numpy.abs",
"numpy.mean",
"numpy.sqrt",
"numpy.ones",
"numpy.double",
"numpy.where",
"numpy.fix",
"numpy.sum",
"numpy.zeros",
"numpy.cos",
"math.atan2",
"numpy.sin",
"numpy.shape"
] | [((1590, 1602), 'numpy.shape', 'np.shape', (['im'], {}), '(im)\n', (1598, 1602), True, 'import numpy as np\n'), ((2738, 2759), 'numpy.sum', 'np.sum', (['rotim'], {'axis': '(0)'}), '(rotim, axis=0)\n', (2744, 2759), True, 'import numpy as np\n'), ((2860, 2883), 'numpy.abs', 'np.abs', (['(dilation - proj)'], {}), '(dilat... |
#!/usr/bin/python
#
# Copyright (c) 2015 CenturyLink
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['previ... | [
"traceback.format_exc",
"ansible.module_utils.basic.AnsibleModule",
"requests.Session",
"json.dumps",
"ansible.module_utils.basic.missing_required_lib",
"distutils.version.LooseVersion"
] | [((17381, 17437), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'supports_check_mode': '(True)'}), '(supports_check_mode=True, **argument_dict)\n', (17394, 17437), False, 'from ansible.module_utils.basic import AnsibleModule, missing_required_lib\n'), ((4862, 4884), 'traceback.format_exc', 'traceba... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from decimal import Decimal
class Migration(migrations.Migration):
dependencies = [
('shopping', '0005_auto_20151125_1001'),
]
operations = [
migrations.AddField(
model_n... | [
"django.db.models.DecimalField",
"decimal.Decimal"
] | [((390, 500), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'null': '(True)', 'verbose_name': '"""shipping cost"""', 'max_digits': '(18)', 'decimal_places': '(10)', 'blank': '(True)'}), "(null=True, verbose_name='shipping cost', max_digits=18,\n decimal_places=10, blank=True)\n", (409, 500), False, '... |
import csv
import os
#field names
field = ['Image', 'Label']
#data rows of csv file
rows = []
#def rows_item(n):
filename = 'data.csv'
# This Python code is for creating a csv file. In this CSV file one column is for the location of the image and other column is for
# the 'label'.
# create two blank array. One f... | [
"csv.writer",
"os.listdir",
"os.path.splitext"
] | [((411, 459), 'os.listdir', 'os.listdir', (['"""Dataset/covid_ctscan/New_Data_CoV2"""'], {}), "('Dataset/covid_ctscan/New_Data_CoV2')\n", (421, 459), False, 'import os\n'), ((547, 570), 'os.listdir', 'os.listdir', (['data_folder'], {}), '(data_folder)\n', (557, 570), False, 'import os\n'), ((1155, 1231), 'csv.writer', ... |
from django.urls import path
from users_app import views
from django.contrib.auth.views import LogoutView
app_name = 'users_app'
urlpatterns = [
path('login/', views.UserLoginView.as_view(), name='login'),
path('logout/', LogoutView.as_view(), name='logout'),
path('register/', views.UserCreateView.as_view... | [
"users_app.views.UserLoginView.as_view",
"django.contrib.auth.views.LogoutView.as_view",
"users_app.views.PasswordResetByUser.as_view",
"users_app.views.UserCreateView.as_view"
] | [((166, 195), 'users_app.views.UserLoginView.as_view', 'views.UserLoginView.as_view', ([], {}), '()\n', (193, 195), False, 'from users_app import views\n'), ((232, 252), 'django.contrib.auth.views.LogoutView.as_view', 'LogoutView.as_view', ([], {}), '()\n', (250, 252), False, 'from django.contrib.auth.views import Logo... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import tensorflow as tf
from tensorflow.keras.layers import Dense, Input
from tensorflow.keras import Model, layers
class Encoder(layers.Layer):
def __init__(self, nLatent, layers, activations, name='encoder'):
super(Encoder, self).__init__(name=name)... | [
"tensorflow.random.normal",
"os.makedirs",
"tensorflow.reduce_sum",
"os.path.join",
"tensorflow.keras.optimizers.Adam",
"tensorflow.GradientTape",
"tensorflow.keras.layers.Dense",
"tensorflow.square",
"tensorflow.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.reduce_mean",
"tensorflow.exp"
] | [((432, 446), 'tensorflow.keras.layers.Dense', 'Dense', (['nLatent'], {}), '(nLatent)\n', (437, 446), False, 'from tensorflow.keras.layers import Dense, Input\n'), ((470, 484), 'tensorflow.keras.layers.Dense', 'Dense', (['nLatent'], {}), '(nLatent)\n', (475, 484), False, 'from tensorflow.keras.layers import Dense, Inpu... |
import numpy as np
import sys
import argparse
from data_util import Dataset
from tqdm import tqdm, trange
import matplotlib.pyplot as plt
class Error(Exception):
pass
class MoreNeighbours(Error):
pass
def nearest_neighbour(train_data, test_data, k=1):
# print(k)
test_data = test_data[None, :, None]
... | [
"sys.exit",
"argparse.ArgumentParser",
"numpy.where",
"numpy.argmax",
"numpy.max",
"numpy.argsort",
"numpy.random.seed",
"numpy.linalg.norm",
"numpy.ravel",
"numpy.bincount",
"tqdm.trange",
"numpy.arange",
"data_util.Dataset"
] | [((333, 379), 'numpy.linalg.norm', 'np.linalg.norm', (['(train_data - test_data)'], {'axis': '(1)'}), '(train_data - test_data, axis=1)\n', (347, 379), True, 'import numpy as np\n'), ((396, 415), 'numpy.ravel', 'np.ravel', (['norm_l2.T'], {}), '(norm_l2.T)\n', (404, 415), True, 'import numpy as np\n'), ((428, 449), 'nu... |
"""Provides LogPipe class to pipe output from subprocess to a log.
Adapted from https://codereview.stackexchange.com/questions/6567"""
import logging
import threading
import os
class LogPipe(threading.Thread):
def __init__(self, logger, level):
"""Setup the object with a logger and a loglevel and start th... | [
"logging.getLogger",
"os.pipe",
"os.fdopen",
"os.close"
] | [((436, 461), 'logging.getLogger', 'logging.getLogger', (['logger'], {}), '(logger)\n', (453, 461), False, 'import logging\n'), ((553, 562), 'os.pipe', 'os.pipe', ([], {}), '()\n', (560, 562), False, 'import os\n'), ((589, 611), 'os.fdopen', 'os.fdopen', (['self.fdRead'], {}), '(self.fdRead)\n', (598, 611), False, 'imp... |
# -*- coding: utf-8 -*-
'''
Control concurrency of steps within state execution using zookeeper
=========================================================================
This module allows you to "wrap" a state's execution with concurrency control.
This is useful to protect against all hosts executing highstate simult... | [
"kazoo.exceptions.CancelledError",
"kazoo.retry.ForceRetryError",
"kazoo.client.KazooClient",
"logging.info"
] | [((4581, 4605), 'kazoo.client.KazooClient', 'KazooClient', ([], {'hosts': 'hosts'}), '(hosts=hosts)\n', (4592, 4605), False, 'from kazoo.client import KazooClient\n'), ((5811, 5857), 'logging.info', 'logging.info', (['"""Acquiring lock with no timeout"""'], {}), "('Acquiring lock with no timeout')\n", (5823, 5857), Fal... |
"""
type-id:
type-specifier-seq abstract-declarator?
defining-type-id:
defining-type-specifier-seq abstract-declarator?
abstract-declarator:
ptr-abstract-declarator
noptr-abstract-declarator? parameters-and-qualifiers trailing-return-type
abstract-pack-declarator
ptr-abstract-declarator:
nopt... | [
"glrp.rule"
] | [((968, 1030), 'glrp.rule', 'glrp.rule', (['"""type-id : type-specifier-seq abstract-declarator?"""'], {}), "('type-id : type-specifier-seq abstract-declarator?')\n", (977, 1030), False, 'import glrp\n'), ((1121, 1206), 'glrp.rule', 'glrp.rule', (['"""defining-type-id : defining-type-specifier-seq abstract-declarator?"... |
from fjord.base.plugin_utils import load_providers
from fjord.redirector import _REDIRECTORS
class RedirectorTestMixin(object):
"""Mixin that loads Redirectors specified with ``redirectors`` attribute"""
redirectors = []
def setUp(self):
_REDIRECTORS[:] = load_providers(self.redirectors)
... | [
"fjord.base.plugin_utils.load_providers"
] | [((279, 311), 'fjord.base.plugin_utils.load_providers', 'load_providers', (['self.redirectors'], {}), '(self.redirectors)\n', (293, 311), False, 'from fjord.base.plugin_utils import load_providers\n')] |
# Author: <NAME>
# Contributors: <NAME>
import numpy as np
import scipy
import torch
class Geometry():
"""Helper class to calculate distances, angles, and dihedrals
with a unified, vectorized framework depending on whether pytorch
or numpy is used.
Parameters
----------
method : 'torch' or '... | [
"numpy.clip",
"numpy.arccos",
"torch.sum",
"numpy.linalg.norm",
"numpy.arange",
"torch.arange",
"numpy.cross",
"torch.eye",
"torch.acos",
"numpy.arctan",
"numpy.tile",
"numpy.eye",
"scipy.spatial.distance.squareform",
"numpy.ones",
"torch.norm",
"numpy.isnan",
"torch.atan",
"torch.... | [((686, 705), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (698, 705), False, 'import torch\n'), ((3751, 3804), 'scipy.spatial.distance.squareform', 'scipy.spatial.distance.squareform', (['pairwise_dist_inds'], {}), '(pairwise_dist_inds)\n', (3784, 3804), False, 'import scipy\n'), ((10447, 10472), ... |
from django.contrib.auth import get_user_model
from django.test.client import RequestFactory
from core.models import Person
import random
import string
def random_user():
user = get_user_model().objects.create_user(
''.join(random.choice(string.lowercase) for _ in range(12)))
person = Person.object... | [
"random.choice",
"django.contrib.auth.get_user_model",
"core.models.Person.objects.create",
"django.test.client.RequestFactory"
] | [((307, 339), 'core.models.Person.objects.create', 'Person.objects.create', ([], {'user': 'user'}), '(user=user)\n', (328, 339), False, 'from core.models import Person\n'), ((498, 514), 'django.test.client.RequestFactory', 'RequestFactory', ([], {}), '()\n', (512, 514), False, 'from django.test.client import RequestFac... |
#!/usr/bin/env python
# coding=utf-8
"""
neoepiscope
Identifies neoepitopes from DNA-seq, VCF, GTF, and Bowtie index.
The MIT License (MIT)
Copyright (c) 2018 <NAME>, <NAME>,
<NAME>, and <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwar... | [
"argparse.ArgumentParser",
"argparse.HelpFormatter",
"os.path.join",
"pickle.load",
"os.path.isfile",
"sys.exit",
"warnings.warn"
] | [((2259, 2309), 'argparse.HelpFormatter', 'argparse.HelpFormatter', (['prog'], {'max_help_position': '(40)'}), '(prog, max_help_position=40)\n', (2281, 2309), False, 'import argparse\n'), ((2391, 2476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '_help_intro', 'formatter_class': 'help_fo... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import os
from setuptools import setup, find_packages
def read(file_name):
return open(os.path.join(os.path.dirname(__file__), file_name)).read()
setup(
name="hb_downloader", # your package name (i.e. for import)
version="0.7.0",
maintainer="<NAME>",
... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((678, 721), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*test*', '*TEST*']"}), "(exclude=['*test*', '*TEST*'])\n", (691, 721), False, 'from setuptools import setup, find_packages\n'), ((153, 178), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (168, 178), False, 'import... |
import ui, console
import os
import math
def save_action(sender):
with open('image_file.png', 'wb') as fp:
fp.write(img.to_png())
console.hud_alert('image saved in the file image_file.png')
def showimage_action(sender):
img.show()
def create_image():
img = None
with ui.ImageContext(5... | [
"console.hud_alert",
"ui.Image",
"ui.ImageContext",
"ui.Path.oval",
"ui.View",
"ui.ImageView",
"ui.ButtonItem",
"ui.set_color"
] | [((887, 918), 'ui.View', 'ui.View', ([], {'frame': '(0, 0, 500, 500)'}), '(frame=(0, 0, 500, 500))\n', (894, 918), False, 'import ui, console\n'), ((926, 962), 'ui.ImageView', 'ui.ImageView', ([], {'frame': '(0, 0, 500, 500)'}), '(frame=(0, 0, 500, 500))\n', (938, 962), False, 'import ui, console\n'), ((1025, 1040), 'u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Author: USER
Email: <EMAIL>
Date: 2/24/2021
Basic patterns for creation of required components.
"""
import ast
import inspect
from enum import Enum
from typing import Type, Any, Union
from fastapi import Form
from fastapi.exceptions import RequestValidationError
from ... | [
"fastapi.Form",
"modelci.utils.misc.isgeneric",
"inspect.signature",
"fastapi.exceptions.RequestValidationError"
] | [((741, 1042), 'fastapi.Form', 'Form', ([], {'default': 'field_info.default', 'alias': 'field_info.alias', 'title': 'field_info.title', 'description': 'field_info.description', 'gt': 'field_info.gt', 'lt': 'field_info.lt', 'le': 'field_info.le', 'min_length': 'field_info.min_length', 'max_length': 'field_info.max_lengt... |
from pathlib import Path
import bpy
from ....library.source1.dmx.sfm.animation_set import AnimationSet
from ....library.source1.dmx.sfm.film_clip import FilmClip
from ....library.source1.dmx.sfm_utils import *
from ....library.shared.content_providers.content_manager import ContentManager
from ...shared.model_containe... | [
"bpy.context.scene.collection.objects.link",
"bpy.data.cameras.new",
"bpy.data.objects.new",
"pathlib.Path"
] | [((902, 916), 'pathlib.Path', 'Path', (['mdl_path'], {}), '(mdl_path)\n', (906, 916), False, 'from pathlib import Path\n'), ((1488, 1530), 'bpy.data.cameras.new', 'bpy.data.cameras.new', ([], {'name': 'dme_camera.name'}), '(name=dme_camera.name)\n', (1508, 1530), False, 'import bpy\n'), ((1548, 1593), 'bpy.data.objects... |
"""
script to ease construction of CSDGM2-style metadata for an GeMS-style geodatabase.
To use,
Run ValidateDatabase to make sure that the database is complete and there are
no missing DMU, Glossary, or DataSources entries
In ArcCatalog, go to Customize>Options>Metadata and set Metadata Style to
... | [
"arcpy.SearchCursor",
"arcpy.GetMessages",
"arcpy.ListTables",
"imp.load_source",
"arcpy.Describe",
"arcpy.ListFeatureClasses",
"arcpy.ListFields",
"arcpy.ListDatasets",
"arcpy.GetInstallInfo",
"sys.exit",
"arcpy.ImportMetadata_conversion",
"arcpy.ExportMetadata_conversion",
"glob.glob"
] | [((25345, 25402), 'arcpy.ExportMetadata_conversion', 'arcpy.ExportMetadata_conversion', (['gdbObj', 'translator', 'fXML'], {}), '(gdbObj, translator, fXML)\n', (25376, 25402), False, 'import arcpy, sys, os.path, copy, imp, glob\n'), ((27478, 27496), 'arcpy.ListTables', 'arcpy.ListTables', ([], {}), '()\n', (27494, 2749... |
#
# pr9_3_2
from audiolazy import lazy_lpc
from scipy.signal import lfilter
from Universal import *
from VAD import VAD
def Ext_frmnt(y, p, thr1, fs):
"""
LPC Formant Detection
:param y: enframe signal ( N x frame number(fn))
:param p: LPC order
:param thr1: threshold
:param fs: sample frequency
:return form... | [
"audiolazy.lazy_lpc.lpc.autocor",
"VAD.VAD"
] | [((470, 496), 'audiolazy.lazy_lpc.lpc.autocor', 'lazy_lpc.lpc.autocor', (['u', 'p'], {}), '(u, p)\n', (490, 496), False, 'from audiolazy import lazy_lpc\n'), ((1651, 1656), 'VAD.VAD', 'VAD', ([], {}), '()\n', (1654, 1656), False, 'from VAD import VAD\n')] |
# -*- coding: utf-8 -*-
from uuid import uuid4
from decimal import Decimal
from zope.interface import implementer
from schematics.exceptions import ValidationError
from schematics.transforms import whitelist, blacklist
from schematics.types import StringType, FloatType, IntType, MD5Type
from schematics.types.compound i... | [
"esculator.npv",
"schematics.types.IntType",
"zope.interface.implementer",
"openprocurement.contracting.core.models.IsoDateTimeType",
"uuid.uuid4",
"schematics.exceptions.ValidationError",
"schematics.types.StringType",
"schematics.transforms.whitelist",
"openprocurement.api.models.DecimalType",
"... | [((1343, 1491), 'schematics.transforms.whitelist', 'whitelist', (['"""title"""', '"""title_en"""', '"""title_ru"""', '"""description"""', '"""description_en"""', '"""description_ru"""', '"""status"""', '"""period"""', '"""items"""', '"""terminationDetails"""'], {}), "('title', 'title_en', 'title_ru', 'description', 'de... |
import numpy as np
import io
import matplotlib.pyplot as plt
import SurfaceTopography.Uniform.GeometryAnalysis as CAA
with io.StringIO(
"""
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0... | [
"SurfaceTopography.Uniform.GeometryAnalysis.outer_perimeter_area",
"io.StringIO",
"numpy.loadtxt",
"SurfaceTopography.Uniform.GeometryAnalysis.inner_perimeter_area",
"matplotlib.pyplot.subplots"
] | [((960, 974), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (972, 974), True, 'import matplotlib.pyplot as plt\n'), ((1027, 1100), 'SurfaceTopography.Uniform.GeometryAnalysis.inner_perimeter_area', 'CAA.inner_perimeter_area', (['contacting_points', '(True)'], {'stencil': 'CAA.nn_stencil'}), '(contacti... |
from ctypes import c_char
from django.contrib.gis.geos.libgeos import (
GEOM_PTR, PREPGEOM_PTR, GEOSFuncFactory,
)
from django.contrib.gis.geos.prototypes.errcheck import check_predicate
# Prepared geometry constructor and destructors.
geos_prepare = GEOSFuncFactory('GEOSPrepare', argtypes=[GEOM_PTR], restype=PRE... | [
"django.contrib.gis.geos.libgeos.GEOSFuncFactory"
] | [((257, 330), 'django.contrib.gis.geos.libgeos.GEOSFuncFactory', 'GEOSFuncFactory', (['"""GEOSPrepare"""'], {'argtypes': '[GEOM_PTR]', 'restype': 'PREPGEOM_PTR'}), "('GEOSPrepare', argtypes=[GEOM_PTR], restype=PREPGEOM_PTR)\n", (272, 330), False, 'from django.contrib.gis.geos.libgeos import GEOM_PTR, PREPGEOM_PTR, GEOS... |
# Copyright (c) OpenMMLab. All rights reserved.
"""
python demo/bottom_up_img_auto_annotation.py \
configs/body/2d_kpt_sview_rgb_img/associative_embedding/crowdpose/higherhrnet_w32_anim_512x512_udp.py \
checkpoints/best_AP_epoch_80.pth \
--img_dir /mnt/d/workspace/anim/screenshots/RAW/rezero \
--out_di... | [
"os.listdir",
"argparse.ArgumentParser",
"pathlib.Path",
"os.path.join",
"shutil.copy",
"mmpose.apis.inference_bottom_up_pose_model",
"warnings.warn",
"json.dump",
"mmpose.datasets.DatasetInfo"
] | [((744, 760), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (758, 760), False, 'from argparse import ArgumentParser\n'), ((1757, 1783), 'os.path.join', 'osp.join', (['args.img_dir', 'fn'], {}), '(args.img_dir, fn)\n', (1765, 1783), True, 'import os.path as osp\n'), ((2253, 2404), 'warnings.warn', 'warn... |
# This file is part of the Etsin service
#
# Copyright 2017-2018 Ministry of Education and Culture, Finland
#
# :author: CSC - IT Center for Science Ltd., Espoo Finland <<EMAIL>>
# :license: MIT
import requests
from requests import HTTPError, ConnectionError, Timeout
import json
from time import sleep
from etsin_find... | [
"etsin_finder_search.reindexing_log.get_logger",
"time.sleep",
"json.loads",
"requests.get"
] | [((370, 390), 'etsin_finder_search.reindexing_log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (380, 390), False, 'from etsin_finder_search.reindexing_log import get_logger\n'), ((3194, 3219), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (3204, 3219), False, 'import json\n... |
# This file is part of sv-witnesses repository: https://github.com/sosy-lab/sv-witnesses
#
# SPDX-FileCopyrightText: 2020 <NAME> <https://www.sosy-lab.org>
#
# SPDX-License-Identifier: Apache-2.0
"""
This module contains a linter that can check witnesses for consistency
with the witness format [1].
[1]: github.com/so... | [
"hashlib.sha256",
"argparse.ArgumentParser",
"re.match",
"lxml.etree.iterparse",
"sys.exit"
] | [((1852, 1877), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1875, 1877), False, 'import argparse\n'), ((40347, 40366), 'sys.exit', 'sys.exit', (['exit_code'], {}), '(exit_code)\n', (40355, 40366), False, 'import sys\n'), ((37821, 37888), 'lxml.etree.iterparse', 'etree.iterparse', (['self.wi... |
import sys
from io import StringIO
from PySide6.QtCore import *
from PySide6.QtGui import *
from PySide6.QtWidgets import *
from modules.settings.settings import SettingsManager
from modules.pseudo_id.pseudo_id import PseudoIDManager
from gms_uploader.modules.models.pandasmodel import PandasModel
from gms_uploader.mo... | [
"csv.DictReader",
"pandas.read_csv",
"gms_uploader.modules.models.sortfilterproxymodel.MultiSortFilterProxyModel",
"gms_uploader.modules.dialogs.dialogs.MsgOKCancel",
"pathlib.Path.home",
"gms_uploader.modules.delegates.delegates.DateAutoCorrectDelegate",
"gms_uploader.modules.upload.uploader.Uploader",... | [((1804, 1833), 'pathlib.Path', 'Path', (['"""config"""', '"""config.yaml"""'], {}), "('config', 'config.yaml')\n", (1808, 1833), False, 'from pathlib import Path\n'), ((1961, 1987), 'modules.settings.settings.SettingsManager', 'SettingsManager', (['self.conf'], {}), '(self.conf)\n', (1976, 1987), False, 'from modules.... |
import logging
from functools import wraps
import pytest
from eth_tester import EthereumTester
from web3 import Web3
from web3.providers.eth_tester import EthereumTesterProvider
from vyper import compile_lll, compiler, optimizer
from vyper.parser.parser import parse_to_lll
from vyper.parser.parser_utils import LLLnod... | [
"logging.getLogger",
"vyper.compiler.utils.build_gas_estimates",
"vyper.compile_lll.compile_to_assembly",
"functools.wraps",
"web3.providers.eth_tester.EthereumTesterProvider",
"pytest.raises",
"eth_tester.EthereumTester",
"vyper.parser.parser_utils.LLLnode.from_list",
"pytest.fixture",
"vyper.par... | [((1673, 1703), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1687, 1703), False, 'import pytest\n'), ((585, 609), 'logging.getLogger', 'logging.getLogger', (['"""evm"""'], {}), "('evm')\n", (602, 609), False, 'import logging\n'), ((1885, 1901), 'eth_tester.EthereumTester',... |
import mock
def test_redis():
from dallinger.db import redis_conn
assert redis_conn.ping()
def test_serialized(db_session):
from dallinger.db import serialized
from dallinger.models import Participant
counts = []
# Define a function which adds a new participant
# with an id based on a... | [
"dallinger.db.queue_message",
"dallinger.db.redis_conn.ping",
"mock.patch"
] | [((84, 101), 'dallinger.db.redis_conn.ping', 'redis_conn.ping', ([], {}), '()\n', (99, 101), False, 'from dallinger.db import redis_conn\n'), ((2006, 2043), 'mock.patch', 'mock.patch', (['"""dallinger.db.redis_conn"""'], {}), "('dallinger.db.redis_conn')\n", (2016, 2043), False, 'import mock\n'), ((2110, 2139), 'dallin... |
# pylint: disable=print-statement,missing-docstring,no-self-use,too-few-public-methods,bare-except,broad-except, useless-object-inheritance
# pylint: disable=using-constant-test,expression-not-assigned, assigning-non-slot, unused-variable,pointless-statement
from __future__ import print_function
import six
class Provid... | [
"six.add_metaclass",
"socket.socket"
] | [((4520, 4561), 'six.add_metaclass', 'six.add_metaclass', (['MetaWithDynamicGetattr'], {}), '(MetaWithDynamicGetattr)\n', (4537, 4561), False, 'import six\n'), ((3731, 3780), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (3744, 3780), False, ... |
import importlib
# import modules
subset = importlib.import_module('.data.01_subset-data-GBP', 'src')
plotwines = importlib.import_module('.visualization.02_visualize-wines', 'src')
country_sub = importlib.import_module('.data.03_country-subset', 'src')
raw_data = 'data/raw/winemag-data-130k-v2.csv'
country = 'Chile... | [
"importlib.import_module"
] | [((44, 102), 'importlib.import_module', 'importlib.import_module', (['""".data.01_subset-data-GBP"""', '"""src"""'], {}), "('.data.01_subset-data-GBP', 'src')\n", (67, 102), False, 'import importlib\n'), ((115, 182), 'importlib.import_module', 'importlib.import_module', (['""".visualization.02_visualize-wines"""', '"""... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | [
"bpy.utils.register_module",
"bpy.utils.unregister_module",
"importlib.reload"
] | [((1265, 1304), 'importlib.reload', 'importlib.reload', (['third_domes_panel_271'], {}), '(third_domes_panel_271)\n', (1281, 1304), False, 'import importlib\n'), ((1386, 1421), 'bpy.utils.register_module', 'bpy.utils.register_module', (['__name__'], {}), '(__name__)\n', (1411, 1421), False, 'import bpy\n'), ((1446, 148... |
from django.contrib import admin
from .models import Idea
@admin.register(Idea)
class IdeaAdmin(admin.ModelAdmin):
list_display = ('id', 'name', 'projected_revenue', 'created', 'modified',)
list_display_links = ('name',)
| [
"django.contrib.admin.register"
] | [((61, 81), 'django.contrib.admin.register', 'admin.register', (['Idea'], {}), '(Idea)\n', (75, 81), False, 'from django.contrib import admin\n')] |
# -- Setup Django --
from os import environ as env
from os.path import dirname, join
from sys import path
path.insert(0, dirname(dirname(__file__)))
path.insert(1, join(dirname(__file__), '_ext'))
env['DJANGO_SETTINGS_MODULE'] = 'MangAdventure.tests.settings'
__import__('django').setup()
# -- Project information --... | [
"os.path.dirname"
] | [((131, 148), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (138, 148), False, 'from os.path import dirname, join\n'), ((171, 188), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (178, 188), False, 'from os.path import dirname, join\n')] |
# -*- encoding: utf-8 -*-
#
#
# Copyright (C) 2002-2011 <NAME> <<EMAIL>>
# Copyright (C) 2002-2011 <NAME> <<EMAIL>>
#
# This file is part of PyX (http://pyx.sourceforge.net/).
#
# PyX is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... | [
"math.cos",
"math.sin",
"bbox.empty",
"unit.topt"
] | [((5088, 5106), 'bbox.empty', 'bboxmodule.empty', ([], {}), '()\n', (5104, 5106), True, 'import bbox as bboxmodule\n'), ((1210, 1223), 'math.cos', 'math.cos', (['phi'], {}), '(phi)\n', (1218, 1223), False, 'import math\n'), ((1257, 1270), 'math.sin', 'math.sin', (['phi'], {}), '(phi)\n', (1265, 1270), False, 'import ma... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-06-18 07:56
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('disturbance', '0005_auto_20180618_1123'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField"
] | [((296, 373), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""proposalapprovergroup"""', 'name': '"""activities"""'}), "(model_name='proposalapprovergroup', name='activities')\n", (318, 373), False, 'from django.db import migrations\n'), ((418, 492), 'django.db.migrations.RemoveFie... |
# Copyright 2019 The TensorFlow 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 applica... | [
"numpy.random.standard_normal",
"numpy.abs",
"tensorflow.keras.optimizers.deserialize",
"tensorflow.random.set_seed",
"tensorflow_addons.optimizers.MovingAverage",
"tensorflow.Variable",
"pytest.mark.with_device",
"tensorflow.keras.optimizers.serialize",
"tensorflow.keras.initializers.Constant",
"... | [((848, 902), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""maybe_run_functions_eagerly"""'], {}), "('maybe_run_functions_eagerly')\n", (871, 902), False, 'import pytest\n'), ((2237, 2291), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""maybe_run_functions_eagerly"""'], {}), "('maybe_run_func... |
# TEST STACK SCRIPT
# <NAME>, July 2020
import stack
# Create Stack object
s = stack.Stack("\nMY COOL ELECTRONICS STACK")
# Add elements to stack
s.push("Raspberry Pi 3")
s.push("Arduino")
s.push("Arduino")
s.push("LED red")
s.push("LED green")
s.push("LED yellow")
s.push("PIC18F2550")
s.push("Resistor")
s.push("Mul... | [
"stack.Stack"
] | [((81, 126), 'stack.Stack', 'stack.Stack', (['"""\nMY COOL ELECTRONICS STACK"""'], {}), '("""\nMY COOL ELECTRONICS STACK""")\n', (92, 126), False, 'import stack\n')] |
# -*- coding: utf-8 -*-
from django.conf.urls.defaults import patterns, url
from django.http import HttpResponseRedirect
from shop.util.decorators import on_method, shop_login_required
class PayOnDeliveryBackend(object):
backend_name = "Pay On Delivery"
url_namespace = "pay-on-delivery"
def __init__(sel... | [
"django.conf.urls.defaults.url",
"shop.util.decorators.on_method"
] | [((490, 520), 'shop.util.decorators.on_method', 'on_method', (['shop_login_required'], {}), '(shop_login_required)\n', (499, 520), False, 'from shop.util.decorators import on_method, shop_login_required\n'), ((1335, 1386), 'django.conf.urls.defaults.url', 'url', (['"""^$"""', 'self.simple_view'], {'name': '"""pay-on-de... |
#
# Copyright 2021 Red Hat Inc.
# SPDX-License-Identifier: Apache-2.0
#
"""Base forecasting module."""
import logging
import operator
from collections import defaultdict
from datetime import datetime
from datetime import timedelta
from decimal import Decimal
from functools import reduce
import numpy as np
import stats... | [
"logging.getLogger",
"statsmodels.sandbox.regression.predstd.wls_prediction_std",
"tenant_schemas.utils.tenant_context",
"api.utils.get_cost_type",
"api.query_filter.QueryFilter",
"api.query_filter.QueryFilterCollection",
"statsmodels.api.add_constant",
"collections.defaultdict",
"django.db.models.Q... | [((1309, 1336), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1326, 1336), False, 'import logging\n'), ((2160, 2172), 'api.utils.DateHelper', 'DateHelper', ([], {}), '()\n', (2170, 2172), False, 'from api.utils import DateHelper\n'), ((3497, 3520), 'api.query_filter.QueryFilterCollectio... |
import time
from brainex.utils.gxe_utils import from_csv
dataset_path = 'genex/experiments/data/ECGFiveDays.csv'
mydb = from_csv(dataset_path, feature_num=0, num_worker=16, use_spark=True, driver_mem=64, max_result_mem=64, _rows_to_consider=400)
mydb.build(st=0.1)
for i in range(20):
print('Running ' + str(i) + ... | [
"time.time",
"brainex.utils.gxe_utils.from_csv"
] | [((122, 251), 'brainex.utils.gxe_utils.from_csv', 'from_csv', (['dataset_path'], {'feature_num': '(0)', 'num_worker': '(16)', 'use_spark': '(True)', 'driver_mem': '(64)', 'max_result_mem': '(64)', '_rows_to_consider': '(400)'}), '(dataset_path, feature_num=0, num_worker=16, use_spark=True,\n driver_mem=64, max_resul... |
#!/usr/bin/env python
# Written against python 3.3.1
# Matasano Problem 4
# Detect single-character XOR
# One of the 60-character strings at:
#
# https://gist.github.com/3132713
# has been encrypted by single-character XOR. Find it. (Your code from
# problem 3 should help.)
from prob3 import tryKey
from pr... | [
"prob3.tryKey"
] | [((17619, 17646), 'prob3.tryKey', 'tryKey', (['cip', 'rawToHexLUT[i]'], {}), '(cip, rawToHexLUT[i])\n', (17625, 17646), False, 'from prob3 import tryKey\n')] |
import os
from pathlib import Path
class Paths:
"""Manages and configures the paths used by WaveRNN, Tacotron, and the data."""
def __init__(self, data_path, voc_id, tts_id):
self.base = Path(__file__).parent.parent.expanduser().resolve()/'outdir'
# Data Paths
self.data = Path(data_pa... | [
"os.makedirs",
"pathlib.Path"
] | [((1519, 1556), 'os.makedirs', 'os.makedirs', (['self.data'], {'exist_ok': '(True)'}), '(self.data, exist_ok=True)\n', (1530, 1556), False, 'import os\n'), ((1565, 1603), 'os.makedirs', 'os.makedirs', (['self.quant'], {'exist_ok': '(True)'}), '(self.quant, exist_ok=True)\n', (1576, 1603), False, 'import os\n'), ((1612,... |
#!/usr/bin/env python
#
import random
import numpy as np
from copy import copy
from bart_utils import empty, Tree, logsumexp, softmax, check_if_zero, get_children_id
#from itertools import izip, count
from itertools import count
class Particle(Tree):
def __init__(self, train_ids=np.arange(0, dtype='int'), param=... | [
"bart_utils.softmax",
"numpy.random.rand",
"random.shuffle",
"numpy.ones",
"bart_utils.get_children_id",
"numpy.log",
"numpy.random.multinomial",
"bart_utils.Tree.__init__",
"numpy.array",
"numpy.sum",
"bart_utils.empty",
"numpy.cumsum",
"copy.copy",
"numpy.arange",
"bart_utils.logsumexp... | [((4471, 4491), 'bart_utils.softmax', 'softmax', (['log_weights'], {}), '(log_weights)\n', (4478, 4491), False, 'from bart_utils import empty, Tree, logsumexp, softmax, check_if_zero, get_children_id\n'), ((4594, 4616), 'bart_utils.logsumexp', 'logsumexp', (['log_weights'], {}), '(log_weights)\n', (4603, 4616), False, ... |