code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from htcondor_executor import HTCondorExecutor
import dask
import dask.array as da
import numpy as np
def test_works_as_dask_executor():
with HTCondorExecutor() as pool:
with dask.config.set(pool=pool):
x = da.sum(da.ones(5)) ** 2
y = x.compute()
assert y == 25
| [
"dask.array.ones",
"dask.config.set",
"htcondor_executor.HTCondorExecutor"
] | [((149, 167), 'htcondor_executor.HTCondorExecutor', 'HTCondorExecutor', ([], {}), '()\n', (165, 167), False, 'from htcondor_executor import HTCondorExecutor\n'), ((190, 216), 'dask.config.set', 'dask.config.set', ([], {'pool': 'pool'}), '(pool=pool)\n', (205, 216), False, 'import dask\n'), ((241, 251), 'dask.array.ones... |
import datetime
import matplotlib.pyplot as plt
import matplotlib.ticker as tkr
from infographics import Figure, Infographic
from utils import timex
from covid19 import epid
BASE_IMAGE_FILE = 'src/covid19/assets/lk_map.png'
FONT_FILE = 'src/covid19/assets/Arial.ttf'
POPULATION = 21_800_000
PADDING = 0.12
WINDOW_DAY... | [
"utils.timex.get_date_id",
"matplotlib.pyplot.plot",
"utils.timex.parse_time",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.legend",
"covid19.epid.load_timeseries",
"utils.timex.format_time",
"datetime.datetime.fromtimestamp",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.grid"
] | [((843, 865), 'covid19.epid.load_timeseries', 'epid.load_timeseries', ([], {}), '()\n', (863, 865), False, 'from covid19 import epid\n'), ((952, 986), 'utils.timex.parse_time', 'timex.parse_time', (['date', '"""%Y-%m-%d"""'], {}), "(date, '%Y-%m-%d')\n", (968, 986), False, 'from utils import timex\n'), ((1005, 1031), '... |
import unittest
import pathlib
import os, sys, traceback
import yaml
import pickledb
from os.path import dirname, abspath
from shutil import copyfile
from flashlexiot.backend.thread import BasicPubsubThread, ExpireMessagesThread
from flashlexiot.sdk import FlashlexSDK
def loadConfig(configFile):
cfg = None
wi... | [
"unittest.main",
"yaml.load",
"os.remove",
"pickledb.load",
"os.path.realpath",
"pathlib.Path",
"flashlexiot.sdk.FlashlexSDK"
] | [((3243, 3258), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3256, 3258), False, 'import unittest\n'), ((371, 413), 'yaml.load', 'yaml.load', (['ymlfile'], {'Loader': 'yaml.FullLoader'}), '(ymlfile, Loader=yaml.FullLoader)\n', (380, 413), False, 'import yaml\n'), ((750, 769), 'flashlexiot.sdk.FlashlexSDK', 'Fla... |
"""
Helpers/utils for working with tornado asynchronous stuff
"""
import contextlib
import logging
import sys
import threading
import salt.ext.tornado.concurrent
import salt.ext.tornado.ioloop
log = logging.getLogger(__name__)
@contextlib.contextmanager
def current_ioloop(io_loop):
"""
A context manager t... | [
"threading.Thread",
"logging.getLogger",
"sys.exc_info"
] | [((203, 230), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'import logging\n'), ((3291, 3381), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._target', 'args': '(key, args, kwargs, results, self.io_loop)'}), '(target=self._target, args=(key, args, kwarg... |
import pytest
from dbt.tests.util import run_dbt, get_manifest
my_model_sql = """
select 1 as fun
"""
@pytest.fixture(scope="class")
def models():
return {"my_model.sql": my_model_sql}
def test_basic(project):
# Tests that a project with a single model works
results = run_dbt(["run"])
assert len... | [
"dbt.tests.util.run_dbt",
"pytest.fixture",
"dbt.tests.util.get_manifest"
] | [((109, 138), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (123, 138), False, 'import pytest\n'), ((289, 305), 'dbt.tests.util.run_dbt', 'run_dbt', (["['run']"], {}), "(['run'])\n", (296, 305), False, 'from dbt.tests.util import run_dbt, get_manifest\n'), ((350, 384), 'dbt.te... |
# Fix paths for imports to work in unit tests ----------------
if __name__ == "__main__":
from _fix_paths import fix_paths
fix_paths()
# ------------------------------------------------------------
# Load libraries ---------------------------------------------
import numpy as np
from ssa_sim_v2.polici... | [
"ssa_sim_v2.policies.policy.Policy.STP.__init__",
"_fix_paths.fix_paths",
"ssa_sim_v2.policies.policy.Policy.learn",
"ssa_sim_v2.policies.policy.Policy.__init__",
"ssa_sim_v2.simulator.attribute.AttrSet",
"ssa_sim_v2.simulator.action.ActionSet",
"ssa_sim_v2.policies.policy.Policy.UDP.__init__",
"ssa_s... | [((137, 148), '_fix_paths.fix_paths', 'fix_paths', ([], {}), '()\n', (146, 148), False, 'from _fix_paths import fix_paths\n'), ((9549, 9569), 'ssa_sim_v2.simulator.attribute.AttrSet', 'AttrSet', (['names', 'vals'], {}), '(names, vals)\n', (9556, 9569), False, 'from ssa_sim_v2.simulator.attribute import AttrSet\n'), ((9... |
import torch
from torch_geometric.nn.reshape import Reshape
def test_reshape():
x = torch.randn(10, 4)
op = Reshape(5, 2, 4)
assert op.__repr__() == 'Reshape(5, 2, 4)'
assert op(x).size() == (5, 2, 4)
assert op(x).view(10, 4).tolist() == x.tolist()
| [
"torch_geometric.nn.reshape.Reshape",
"torch.randn"
] | [((90, 108), 'torch.randn', 'torch.randn', (['(10)', '(4)'], {}), '(10, 4)\n', (101, 108), False, 'import torch\n'), ((118, 134), 'torch_geometric.nn.reshape.Reshape', 'Reshape', (['(5)', '(2)', '(4)'], {}), '(5, 2, 4)\n', (125, 134), False, 'from torch_geometric.nn.reshape import Reshape\n')] |
# from distutils.core import setup
from setuptools import setup
import pathlib
current_location = pathlib.Path(__file__).parent
readme = (current_location / "README.md").read_text()
setup(
name = 'chattingtransformer',
packages = ['chattingtransformer'],
version = '1.0.3',
license='Apache 2.0',
d... | [
"pathlib.Path",
"setuptools.setup"
] | [((185, 1268), 'setuptools.setup', 'setup', ([], {'name': '"""chattingtransformer"""', 'packages': "['chattingtransformer']", 'version': '"""1.0.3"""', 'license': '"""Apache 2.0"""', 'description': '"""GPT2 text generation with just two lines of code!"""', 'long_description': 'readme', 'long_description_content_type': ... |
#!/usr/bin/python
# Import library functions we need
import sys
import time
try:
from rpi_ws281x import __version__, PixelStrip, Adafruit_NeoPixel, Color
except ImportError:
from neopixel import Adafruit_NeoPixel as PixelStrip, Color
__version__ = "legacy"
try:
raw_input # Python 2
except Nam... | [
"neopixel.Adafruit_NeoPixel",
"neopixel.Color",
"sys.exit",
"time.sleep"
] | [((2885, 2913), 'time.sleep', 'time.sleep', (['(wait_ms / 1000.0)'], {}), '(wait_ms / 1000.0)\n', (2895, 2913), False, 'import time\n'), ((3492, 3520), 'time.sleep', 'time.sleep', (['(wait_ms / 1000.0)'], {}), '(wait_ms / 1000.0)\n', (3502, 3520), False, 'import time\n'), ((4166, 4194), 'time.sleep', 'time.sleep', (['(... |
#!/usr/bin/env python3
"""A python script to perform watermark embedding/detection
in the wavelet domain."""
# Copyright (C) 2020 by <NAME>
# 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, ... | [
"numpy.sum",
"numpy.ceil",
"numpy.abs",
"pywt.wavedec",
"numpy.floor",
"numpy.zeros",
"scipy.io.wavfile.write",
"scipy.io.wavfile.read",
"pywt.waverec",
"numpy.mean",
"scipy.signal.windows.hann",
"numpy.concatenate",
"numpy.repeat"
] | [((1801, 1831), 'scipy.io.wavfile.read', 'wavfile.read', (['HOST_SIGNAL_FILE'], {}), '(HOST_SIGNAL_FILE)\n', (1813, 1831), False, 'from scipy.io import wavfile\n'), ((2944, 2978), 'numpy.zeros', 'np.zeros', (['(frame_shift * embed_nbit)'], {}), '(frame_shift * embed_nbit)\n', (2952, 2978), True, 'import numpy as np\n')... |
import torch.nn as nn
import spaghettini
from spaghettini import register, quick_register, load, check
quick_register(nn.Linear)
register("relu")(nn.ReLU)
quick_register(nn.Sequential)
print(check())
net = load("assets/pytorch.yaml")
print(net)
| [
"spaghettini.quick_register",
"spaghettini.load",
"spaghettini.check",
"spaghettini.register"
] | [((104, 129), 'spaghettini.quick_register', 'quick_register', (['nn.Linear'], {}), '(nn.Linear)\n', (118, 129), False, 'from spaghettini import register, quick_register, load, check\n'), ((156, 185), 'spaghettini.quick_register', 'quick_register', (['nn.Sequential'], {}), '(nn.Sequential)\n', (170, 185), False, 'from s... |
import argparse
import logging
from flowlib import flow_pb2
from flowlib.flowd_utils import get_flowd_connection
__help__ = 'force health check probe on all workflows (default) or specified workflow ID\'s'
def __refine_args__(parser: argparse.ArgumentParser):
parser.add_argument(
'-o',
'--outp... | [
"flowlib.flowd_utils.get_flowd_connection",
"logging.info",
"flowlib.flow_pb2.ProbeRequest",
"logging.error"
] | [((662, 726), 'flowlib.flowd_utils.get_flowd_connection', 'get_flowd_connection', (['namespace.flowd_host', 'namespace.flowd_port'], {}), '(namespace.flowd_host, namespace.flowd_port)\n', (682, 726), False, 'from flowlib.flowd_utils import get_flowd_connection\n'), ((755, 795), 'flowlib.flow_pb2.ProbeRequest', 'flow_pb... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# tools/targets_from_recon_ng.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, ... | [
"os.path.abspath",
"csv.writer",
"argparse.ArgumentParser",
"csv.DictReader",
"random.shuffle",
"os.path.dirname",
"re.match",
"king_phisher.color.print_status",
"argparse.FileType"
] | [((2372, 2530), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'conflict_handler': '"""resolve"""', 'description': 'PROG_DESCRIPTION', 'epilog': 'PROG_EPILOG', 'formatter_class': 'argparse.RawTextHelpFormatter'}), "(conflict_handler='resolve', description=\n PROG_DESCRIPTION, epilog=PROG_EPILOG, formatt... |
'''latlong.py - simple command line tool to generate a random destination from
starting coordinates
Warning: You might have to swim
'''
import math
import random
import sys
EARTH_RADIUS = 6378.1
MIN_DIST = 1
MAX_DIST = 16 # destination radius in KM
def plot_location(latitude, longitude, bearing, distance... | [
"random.randint",
"math.radians",
"math.sin",
"random.random",
"math.cos",
"math.degrees"
] | [((417, 438), 'math.radians', 'math.radians', (['bearing'], {}), '(bearing)\n', (429, 438), False, 'import math\n'), ((452, 474), 'math.radians', 'math.radians', (['latitude'], {}), '(latitude)\n', (464, 474), False, 'import math\n'), ((486, 509), 'math.radians', 'math.radians', (['longitude'], {}), '(longitude)\n', (4... |
import json
import os
import shutil
import tempfile
import unittest
import ayeaye
PROJECT_TEST_PATH = os.path.dirname(os.path.abspath(__file__))
EXAMPLE_CSV_PATH = os.path.join(PROJECT_TEST_PATH, 'data', 'deadly_creatures.csv')
class FakeModel(ayeaye.Model):
animals = ayeaye.Connect(engine_url=f"csv://{EXAMPLE_... | [
"os.path.abspath",
"json.load",
"os.path.isdir",
"tempfile.mkdtemp",
"ayeaye.Connect",
"shutil.rmtree",
"os.path.join"
] | [((166, 229), 'os.path.join', 'os.path.join', (['PROJECT_TEST_PATH', '"""data"""', '"""deadly_creatures.csv"""'], {}), "(PROJECT_TEST_PATH, 'data', 'deadly_creatures.csv')\n", (178, 229), False, 'import os\n'), ((120, 145), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (135, 145), False, 'im... |
# Copyright 2014 - Rackspace, 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 wri... | [
"solum.common.exception.PlanExists",
"solum.openstack.common.db.sqlalchemy.session.get_session",
"solum.objects.sqlalchemy.models.table_args",
"solum.objects.sqlalchemy.models.model_query",
"sqlalchemy.Column",
"sqlalchemy.String"
] | [((931, 947), 'solum.objects.sqlalchemy.models.table_args', 'sql.table_args', ([], {}), '()\n', (945, 947), True, 'from solum.objects.sqlalchemy import models as sql\n'), ((958, 1033), 'sqlalchemy.Column', 'sqlalchemy.Column', (['sqlalchemy.Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(sqlalchemy.... |
import abc
import os
from smartva.data_prep import Prep
class GrapherPrep(Prep):
__metaclass__ = abc.ABCMeta
def __init__(self, working_dir_path):
super(GrapherPrep, self).__init__(working_dir_path)
self.output_dir_path = os.path.join(self.input_dir_path, 'figures')
def run(self):
... | [
"os.path.join"
] | [((250, 294), 'os.path.join', 'os.path.join', (['self.input_dir_path', '"""figures"""'], {}), "(self.input_dir_path, 'figures')\n", (262, 294), False, 'import os\n')] |
import pytest
from arc import CLI, Context, errors, callback
class CallbackException(Exception):
"""Used to assert that callbacks are actually running"""
def __init__(self, ctx: Context, **kwargs):
self.ctx = ctx
self.kwargs = kwargs
def test_execute(cli: CLI):
@callback.create()
de... | [
"pytest.raises",
"arc.callback.create",
"arc.callback.remove",
"arc.errors.ExecutionError"
] | [((296, 313), 'arc.callback.create', 'callback.create', ([], {}), '()\n', (311, 313), False, 'from arc import CLI, Context, errors, callback\n'), ((588, 605), 'arc.callback.create', 'callback.create', ([], {}), '()\n', (603, 605), False, 'from arc import CLI, Context, errors, callback\n'), ((919, 936), 'arc.callback.cr... |
import os
import json
import copy
import pyblish.api
class IntegrateFtrackInstance(pyblish.api.InstancePlugin):
"""Collect ftrack component data (not integrate yet).
Add ftrack component list to instance.
"""
order = pyblish.api.IntegratorOrder + 0.48
label = "Integrate Ftrack Component"
fam... | [
"copy.deepcopy",
"os.path.exists",
"os.path.join",
"json.dumps"
] | [((4804, 4838), 'copy.deepcopy', 'copy.deepcopy', (['base_component_item'], {}), '(base_component_item)\n', (4817, 4838), False, 'import copy\n'), ((6437, 6471), 'copy.deepcopy', 'copy.deepcopy', (['base_component_item'], {}), '(base_component_item)\n', (6450, 6471), False, 'import copy\n'), ((9289, 9323), 'copy.deepco... |
import process_operations as po
import module_tableau_materials
def process_entry(processor, txt_file, entry, index):
output_list = ["tab_%s %d %s %d %d %d %d %d %d" % entry[0:9]]
output_list.extend(processor.process_block(entry[9], entry[0]))
output_list.append("\r\n")
txt_file.write("".join(output_lis... | [
"process_operations.make_export"
] | [((336, 498), 'process_operations.make_export', 'po.make_export', ([], {'data': 'module_tableau_materials.tableaus', 'data_name': '"""tableau_materials"""', 'tag': '"""tableau"""', 'header_format': "'%d\\r\\n'", 'process_entry': 'process_entry'}), "(data=module_tableau_materials.tableaus, data_name=\n 'tableau_mater... |
# Author: Hologram <<EMAIL>>
#
# Copyright 2016 - Hologram (Konekt, Inc.)
#
# LICENSE: Distributed under the terms of the MIT License
#
# test_Cellular.py - This file implements unit tests for the Cellular class.
import sys
import pytest
sys.path.append(".")
sys.path.append("..")
sys.path.append("../..")
from Hologra... | [
"sys.path.append"
] | [((240, 260), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (255, 260), False, 'import sys\n'), ((261, 282), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (276, 282), False, 'import sys\n'), ((283, 307), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..'... |
# Generated by Django 3.0.6 on 2020-05-27 10:08
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('django_celery_beat', '0012_periodictask_expire_seconds'),
('silviacontrol', '0004_auto_20180915_1228'),
]
o... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((448, 514), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""Schedule reinvigoration"""', 'max_length': '(20)'}), "(default='Schedule reinvigoration', max_length=20)\n", (464, 514), False, 'from django.db import migrations, models\n'), ((649, 811), 'django.db.models.ForeignKey', 'models.ForeignK... |
#!/usr/bin/python
import sys
import json
import requests
import time
import base64
import datetime
baseUrl = 'http://radio.pw-sat.pl'
headers = {'content-type': 'application/json'}
def authenticate(credentials_path):
credentials = loadCredentials(credentials_path)
url = baseUrl+'/api/authenticate'
re... | [
"datetime.datetime.strptime",
"json.load",
"json.dumps"
] | [((955, 967), 'json.load', 'json.load', (['f'], {}), '(f)\n', (964, 967), False, 'import json\n'), ((353, 376), 'json.dumps', 'json.dumps', (['credentials'], {}), '(credentials)\n', (363, 376), False, 'import json\n'), ((797, 816), 'json.dumps', 'json.dumps', (['payload'], {}), '(payload)\n', (807, 816), False, 'import... |
from collections import Counter
class Solution:
def judgeCircle(self, moves: str) -> bool:
counter = Counter(moves)
return counter['U'] == counter['D'] and counter['R'] == counter['L']
| [
"collections.Counter"
] | [((115, 129), 'collections.Counter', 'Counter', (['moves'], {}), '(moves)\n', (122, 129), False, 'from collections import Counter\n')] |
from mutation import AddConnectionMutation,AddNodeMutation,ChangeNodeMutation,ChangeConnectionMutation,ToggleConnectionMutation,ToggleNodeMutation,tests
from gene import ConnectionGene, NodeGene, PseudoGene, tests
from genome import Genome, tests
from phenome import Phenome, tests
from fitness import Fitness, tests
fro... | [
"pressure.Pressure",
"environment.Environment"
] | [((458, 475), 'environment.Environment', 'Environment', (['(1)', '(2)'], {}), '(1, 2)\n', (469, 475), False, 'from environment import Environment, tests\n'), ((486, 575), 'pressure.Pressure', 'Pressure', (['(lambda : True)', '[]', '(lambda x: x)', "['loss']", '(10)', '"""minimize cross entropy loss"""'], {}), "(lambda ... |
import itertools
import json
import os
import tempfile
import pytest
from dagger.dag import DAG
from dagger.input import FromNodeOutput, FromParam
from dagger.output import FromReturnValue
from dagger.runtime.cli.cli import invoke
from dagger.runtime.cli.locations import (
PARTITION_MANIFEST_FILENAME,
store_o... | [
"json.load",
"tempfile.TemporaryDirectory",
"dagger.runtime.cli.cli.invoke",
"os.path.isdir",
"dagger.input.FromNodeOutput",
"pytest.raises",
"dagger.runtime.local.PartitionedOutput",
"dagger.output.FromReturnValue",
"dagger.serializer.AsPickle",
"dagger.task.Task",
"itertools.chain",
"dagger.... | [((6002, 6012), 'dagger.serializer.AsPickle', 'AsPickle', ([], {}), '()\n', (6010, 6012), False, 'from dagger.serializer import AsPickle\n'), ((1053, 1082), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (1080, 1082), False, 'import tempfile\n'), ((1109, 1137), 'os.path.join', 'os.path.... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.core.commands.CliCommandType"
] | [((957, 1107), 'azure.cli.core.commands.CliCommandType', 'CliCommandType', ([], {'operations_tmpl': '"""azure.mgmt.eventgrid.operations#TopicsOperations.{}"""', 'client_factory': 'topics_factory', 'client_arg_name': '"""self"""'}), "(operations_tmpl=\n 'azure.mgmt.eventgrid.operations#TopicsOperations.{}', client_fa... |
from tensorflow.keras.models import clone_model
from tensorflow.keras.layers import Dropout
def dropout_model(model, dropout):
"""
Create a keras function to predict with dropout
Credits to https://github.com/keras-team/keras/issues/8826 and to
sfblake: https://medium.com/hal24k-techblog/how-to-genera... | [
"tensorflow.keras.models.clone_model"
] | [((603, 621), 'tensorflow.keras.models.clone_model', 'clone_model', (['model'], {}), '(model)\n', (614, 621), False, 'from tensorflow.keras.models import clone_model\n')] |
# Copyright 1999-2021 Alibaba Group Holding 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 a... | [
"asyncio.gather",
"importlib.import_module",
"asyncio.Event",
"tempfile.gettempdir",
"functools.reduce",
"time.time",
"os.environ.get",
"collections.defaultdict",
"graphviz.Source",
"asyncio.wait",
"asyncio.to_thread",
"os.path.join",
"logging.getLogger"
] | [((1647, 1674), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1664, 1674), False, 'import logging\n'), ((1716, 1760), 'os.environ.get', 'os.environ.get', (['"""MARS_DUMP_SUBTASK_GRAPH"""', '(0)'], {}), "('MARS_DUMP_SUBTASK_GRAPH', 0)\n", (1730, 1760), False, 'import os\n'), ((3048, 3063... |
#!/usr/bin/env python
"""
<Program Name>
formats.py
<Author>
<NAME>
<NAME> <<EMAIL>>
<Started>
Refactored April 30, 2012. -vladimir.v.diaz
<Copyright>
See LICENSE for licensing information.
<Purpose>
A central location for all format-related checking of TUF objects.
Note: 'formats.py' depends heavily... | [
"tuf.schema.String",
"tuf.schema.Optional",
"tuf.schema.Boolean",
"tuf.schema.DictOf",
"six.iteritems",
"tuf.schema.ListOf",
"doctest.testmod",
"tuf.schema.AnyString",
"tuf.FormatError",
"tuf.schema.Object",
"string.capwords",
"binascii.b2a_base64",
"re.sub",
"tuf.schema.LengthBytes",
"d... | [((2602, 2672), 'tuf.schema.RegularExpression', 'SCHEMA.RegularExpression', (['"""\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z"""'], {}), "('\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z')\n", (2626, 2672), True, 'import tuf.schema as SCHEMA\n'), ((2938, 2973), 'tuf.schema.Integer', 'SCHEMA.Integer',... |
#!/usr/bin/python
# ---------------------------------------------------------------------------
# File: admipex8.py
# Version 12.8.0
# ---------------------------------------------------------------------------
# Licensed Materials - Property of IBM
# 5725-A06 5725-A29 5724-Y48 5724-Y49 5724-Y54 5724-Y55 5655-Y21
# Cop... | [
"cplex.Cplex",
"traceback.print_tb",
"cplex.SparsePair",
"inputdata.read_dat_file",
"sys.exc_info",
"sys.exit"
] | [((2352, 2363), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (2360, 2363), False, 'import sys\n'), ((7241, 7286), 'inputdata.read_dat_file', 'read_dat_file', (["(datadir + '/' + 'facility.dat')"], {}), "(datadir + '/' + 'facility.dat')\n", (7254, 7286), False, 'from inputdata import read_dat_file\n'), ((7402, 7415),... |
import random
from os import path
import hangman_words
from hangman_art import logo
from hangman_art import stages
chosen_word=random.choice(hangman_words.word_list)
print(f'the chosen word is : {chosen_word}\n')
display=[]
print(logo)
for i in range(len(chosen_word)):
display += "_"
print(display)
lives=6
while Tr... | [
"random.choice"
] | [((127, 165), 'random.choice', 'random.choice', (['hangman_words.word_list'], {}), '(hangman_words.word_list)\n', (140, 165), False, 'import random\n')] |
#!/usr/bin/env python
"""Test TermCounts object used in Resnik and Lin similarity calculations."""
from __future__ import print_function
import os
import sys
import timeit
import datetime
from goatools.base import get_godag
from goatools.semantic import TermCounts
from goatools.semantic import get_info_content
from g... | [
"os.path.abspath",
"goatools.semantic.get_info_content",
"timeit.default_timer",
"goatools.anno.gaf_reader.GafReader",
"os.path.exists",
"goatools.test_data.gafs.ASSOCIATIONS.difference",
"goatools.semantic.TermCounts",
"os.path.join",
"goatools.associations.dnld_annotation"
] | [((514, 536), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (534, 536), False, 'import timeit\n'), ((3157, 3189), 'goatools.semantic.get_info_content', 'get_info_content', (['go_id', 'tcntobj'], {}), '(go_id, tcntobj)\n', (3173, 3189), False, 'from goatools.semantic import get_info_content\n'), ((57... |
from __future__ import annotations
import discord
import contextlib
from datetime import datetime, timedelta
from typing import Union, Any, List, Dict, TYPE_CHECKING
from .useful import (
GetEmoji,
GetFormat,
calculate_level_xp,
format_relative,
iso_to_time,
JSON
)
from ..locale_v2 import Valo... | [
"datetime.datetime.utcnow",
"datetime.timedelta",
"contextlib.suppress"
] | [((2666, 2696), 'contextlib.suppress', 'contextlib.suppress', (['Exception'], {}), '(Exception)\n', (2685, 2696), False, 'import contextlib\n'), ((1497, 1514), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1512, 1514), False, 'from datetime import datetime, timedelta\n'), ((1517, 1544), 'datetime.ti... |
from torch import nn, Tensor
class Model(nn.Module):
def __init__(self, input_n: int, output_n: int, hidden_n: int) -> None:
super().__init__()
self.input_shape = (input_n,)
self.output_shape = (output_n,)
self.hidden_n = hidden_n
self.acctivate = nn.Softplus()
... | [
"torch.nn.Softplus",
"torchinfo.summary",
"torch.nn.Linear"
] | [((768, 782), 'torchinfo.summary', 'summary', (['model'], {}), '(model)\n', (775, 782), False, 'from torchinfo import summary\n'), ((297, 310), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), '()\n', (308, 310), False, 'from torch import nn, Tensor\n'), ((331, 364), 'torch.nn.Linear', 'nn.Linear', (['input_n', 'self.hidd... |
from pathlib import Path
from typing import Callable, List, Optional, Union
import torch
from torch import Tensor
from torch_geometric.data import Data, InMemoryDataset
from torch_geometric.utils import stochastic_blockmodel_graph
class StochasticBlockModelDataset(InMemoryDataset):
r"""A synthetic graph dataset... | [
"torch_geometric.utils.stochastic_blockmodel_graph",
"torch.load",
"sklearn.datasets.make_classification",
"pathlib.Path",
"torch_geometric.data.Data",
"torch.arange",
"torch.tensor",
"torch.from_numpy"
] | [((2986, 3021), 'torch.load', 'torch.load', (['self.processed_paths[0]'], {}), '(self.processed_paths[0])\n', (2996, 3021), False, 'import torch\n'), ((3642, 3741), 'torch_geometric.utils.stochastic_blockmodel_graph', 'stochastic_blockmodel_graph', (['self.block_sizes', 'self.edge_probs'], {'directed': '(not self.is_un... |
import jwt
from app.repositories.admin_repo import AdminRepo
from app.repositories.student_repo import StudentRepo
from config import get_env
from functools import wraps
from flask import request, jsonify, make_response
class Auth:
""" This class will house Authentication and Authorization Methods """
""" R... | [
"flask.request.headers.get",
"flask.request.path.find",
"app.repositories.admin_repo.AdminRepo",
"flask.jsonify",
"functools.wraps",
"app.repositories.student_repo.StudentRepo",
"config.get_env",
"jwt.decode"
] | [((3288, 3309), 'config.get_env', 'get_env', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (3295, 3309), False, 'from config import get_env\n'), ((4108, 4147), 'flask.request.headers.get', 'request.headers.get', (['"""X-Location"""', 'None'], {}), "('X-Location', None)\n", (4127, 4147), False, 'from flask import requ... |
# Copyright (c) 2020 Horizon Robotics. 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 applicab... | [
"torch._C._get_default_device",
"torch.get_default_dtype"
] | [((1841, 1871), 'torch._C._get_default_device', 'torch._C._get_default_device', ([], {}), '()\n', (1869, 1871), False, 'import torch\n'), ((1774, 1799), 'torch.get_default_dtype', 'torch.get_default_dtype', ([], {}), '()\n', (1797, 1799), False, 'import torch\n')] |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
import os
import sys
from telemetry.core import platform as platform_module
from telemetry.core import util
from telemetry import decorators
... | [
"telemetry.util.screenshot.TryCaptureScreenShot",
"telemetry.web_perf.timeline_based_page_test.TimelineBasedPageTest",
"logging.warning",
"telemetry.internal.browser.browser_finder.FindBrowser",
"telemetry.core.util.GetSequentialFileName",
"telemetry.decorators.IsEnabled",
"telemetry.page.cache_temperat... | [((1201, 1254), 'telemetry.internal.platform.profiler.profiler_finder.FindProfiler', 'profiler_finder.FindProfiler', (['finder_options.profiler'], {}), '(finder_options.profiler)\n', (1229, 1254), False, 'from telemetry.internal.platform.profiler import profiler_finder\n'), ((3813, 3855), 'telemetry.internal.browser.br... |
import math
def say_hi():
print("Hi")
say_hi()
x = 100
another_variable = 1
print(another_variable + x)
print("I have", x, "DKK")
y = x * 2
# Formatted values
first = "Carlotta"
last = "Porcelli"
name = "First Name: {}, Last Name: {}".format(first, last)
name2 = f"First Name: {first}, Last Name: {last}"
... | [
"math.sqrt"
] | [((814, 827), 'math.sqrt', 'math.sqrt', (['(25)'], {}), '(25)\n', (823, 827), False, 'import math\n')] |
#!/usr/bin/python
import json
import subprocess
import os
os.chdir('../terraform/stage/')
output = subprocess.check_output(['terraform', 'output', '-json'])
j =json.loads(output)
for i in j:
app_ip = j['app_external_ip']['value']
db_ip = j['db_external_ip']['value']
#print(app_ip)
#print(db_ip)
out = {
"_m... | [
"subprocess.check_output",
"os.chdir",
"json.dumps",
"json.loads"
] | [((58, 89), 'os.chdir', 'os.chdir', (['"""../terraform/stage/"""'], {}), "('../terraform/stage/')\n", (66, 89), False, 'import os\n'), ((99, 156), 'subprocess.check_output', 'subprocess.check_output', (["['terraform', 'output', '-json']"], {}), "(['terraform', 'output', '-json'])\n", (122, 156), False, 'import subproce... |
import requests
import json
print('Requesting...')
url = 'https://platform.antares.id:8443/~/antares-cse/antares-id/{}/{}'.format('weather-station', 'station1')
headers = {
'X-M2M-Origin' : 'b4e89ce2436b9d90:202c7b14b849c084',
'Content-Type' : 'application/json;ty=4',
'Accept' : 'application/json',
}
data... | [
"requests.post",
"json.dumps"
] | [((494, 518), 'json.dumps', 'json.dumps', (['dataTemplate'], {}), '(dataTemplate)\n', (504, 518), False, 'import json\n'), ((556, 610), 'requests.post', 'requests.post', (['url'], {'headers': 'headers', 'data': 'dataTemplate'}), '(url, headers=headers, data=dataTemplate)\n', (569, 610), False, 'import requests\n'), ((3... |
import urllib3
import json
TOKEN = ''
AUTHORIZATION = ''
http = urllib3.PoolManager()
def informacoes_basicas_aluno(matricula):
global TOKEN, http
r = http.request(
'GET',
'https://suap.ifrn.edu.br/api/v2/edu/alunos/{}/'.format(matricula),
headers={'Accept': 'application/json',
... | [
"urllib3.PoolManager"
] | [((66, 87), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (85, 87), False, 'import urllib3\n')] |
import vodka
import vodka.app
# make sure the plugin is available
import graphsrv_example.plugins.test_plot
# we dont do anything with the applet other than to make sure it exists
@vodka.app.register("graphsrv_example")
class MyApplication(vodka.app.Application):
pass
| [
"vodka.app.register"
] | [((183, 221), 'vodka.app.register', 'vodka.app.register', (['"""graphsrv_example"""'], {}), "('graphsrv_example')\n", (201, 221), False, 'import vodka\n')] |
import numpy as np
import torch
from torchvision import models
import torch.nn as nn
from nn_ood.data.cifar10 import Cifar10Data
from nn_ood.posteriors import LocalEnsemble, SCOD, Ensemble, Naive, KFAC, Mahalanobis
from nn_ood.distributions import CategoricalLogit
import matplotlib.pyplot as plt
import matplotlib.anima... | [
"torch.nn.AdaptiveAvgPool2d",
"nn_ood.distributions.CategoricalLogit",
"torch.nn.ReLU",
"torch.nn.Sequential",
"numpy.argmax",
"numpy.clip",
"numpy.array",
"densenet.densenet121",
"seaborn.color_palette",
"torch.cuda.is_available",
"matplotlib.pyplot.subplots",
"torch.nn.Flatten"
] | [((11970, 12010), 'seaborn.color_palette', 'sns.color_palette', (['"""crest"""'], {'as_cmap': '(True)'}), "('crest', as_cmap=True)\n", (11987, 12010), True, 'import seaborn as sns\n'), ((783, 817), 'numpy.array', 'np.array', (['[0.4914, 0.4822, 0.4465]'], {}), '([0.4914, 0.4822, 0.4465])\n', (791, 817), True, 'import n... |
import sys
import shutil
import hashlib
import bz2
from shutil import copyfileobj
import os
class Disk:
srcPath = None
destPath = None
def __init__(self):
return
def set_src_path(self, srcpath):
self.srcPath = srcpath
def set_dst_path(self, dstpath):
self.destPath =... | [
"os.remove",
"shutil.copy2",
"bz2.BZ2File",
"hashlib.sha256",
"shutil.copyfileobj"
] | [((1089, 1105), 'hashlib.sha256', 'hashlib.sha256', ([], {}), '()\n', (1103, 1105), False, 'import hashlib\n'), ((380, 421), 'shutil.copy2', 'shutil.copy2', (['self.srcPath', 'self.destPath'], {}), '(self.srcPath, self.destPath)\n', (392, 421), False, 'import shutil\n'), ((601, 615), 'os.remove', 'os.remove', (['dsk'],... |
""" Cisco_IOS_XR_shellutil_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR shellutil package configuration.
This module contains definitions
for the following management objects\:
host\-names\: Container Schema for hostname configuration
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
... | [
"collections.OrderedDict",
"ydk.types.YLeaf"
] | [((1517, 1532), 'collections.OrderedDict', 'OrderedDict', (['[]'], {}), '([])\n', (1528, 1532), False, 'from collections import OrderedDict\n'), ((1596, 1625), 'ydk.types.YLeaf', 'YLeaf', (['YType.str', '"""host-name"""'], {}), "(YType.str, 'host-name')\n", (1601, 1625), False, 'from ydk.types import Entity, EntityPath... |
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed
from wtforms import StringField, PasswordField, SubmitField, BooleanField, validators
from wtforms.validators import DataRequired, Length, Email, EqualTo, ValidationError
from flask_login import current_user
from flaskblog.models imp... | [
"wtforms.validators.Email",
"wtforms.validators.Length",
"wtforms.validators.InputRequired",
"wtforms.BooleanField",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"flask_wtf.file.FileAllowed",
"flaskblog.models.User.query.filter_by",
"wtforms.validators.ValidationError"
] | [((769, 791), 'wtforms.SubmitField', 'SubmitField', (['"""Sign Up"""'], {}), "('Sign Up')\n", (780, 791), False, 'from wtforms import StringField, PasswordField, SubmitField, BooleanField, validators\n'), ((1476, 1503), 'wtforms.BooleanField', 'BooleanField', (['"""Remember Me"""'], {}), "('Remember Me')\n", (1488, 150... |
# Copyright 2013 IBM Corp.
# Copyright 2010 OpenStack Foundation
# 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/LIC... | [
"nova.tests.unit.api.openstack.fakes.wsgi_app_v21",
"nova.tests.unit.api.openstack.fakes.stub_out_networking",
"webob.Request.blank",
"nova.tests.unit.api.openstack.fakes.stub_out_rate_limiting",
"nova.api.openstack.auth.NoAuthMiddlewareV3",
"nova.api.openstack.urlmap.URLMap",
"nova.api.openstack.comput... | [((1060, 1100), 'nova.tests.unit.api.openstack.fakes.stub_out_rate_limiting', 'fakes.stub_out_rate_limiting', (['self.stubs'], {}), '(self.stubs)\n', (1088, 1100), False, 'from nova.tests.unit.api.openstack import fakes\n'), ((1109, 1140), 'nova.tests.unit.api.openstack.fakes.stub_out_networking', 'fakes.stub_out_netwo... |
from bdict import BDict
class Term:
def __init__(self, term=None):
self.term = term
self.times = 0
self.occur = dict()
def jsonfy(self):
d = dict()
d['term'] = self.term
d['times'] = self.times
d['occur'] = self.occur
return d
def unjsonfy(s... | [
"bdict.BDict"
] | [((485, 492), 'bdict.BDict', 'BDict', ([], {}), '()\n', (490, 492), False, 'from bdict import BDict\n')] |
import gym.spaces
import numpy as np
import pytest
from metarl.envs.wrappers import Resize
from tests.fixtures.envs.dummy import DummyDiscrete2DEnv
class TestResize:
def setup_method(self):
self.width = 16
self.height = 16
self.env = DummyDiscrete2DEnv()
self.env_r = Resize(
... | [
"pytest.raises",
"tests.fixtures.envs.dummy.DummyDiscrete2DEnv",
"metarl.envs.wrappers.Resize"
] | [((265, 285), 'tests.fixtures.envs.dummy.DummyDiscrete2DEnv', 'DummyDiscrete2DEnv', ([], {}), '()\n', (283, 285), False, 'from tests.fixtures.envs.dummy import DummyDiscrete2DEnv\n'), ((327, 347), 'tests.fixtures.envs.dummy.DummyDiscrete2DEnv', 'DummyDiscrete2DEnv', ([], {}), '()\n', (345, 347), False, 'from tests.fixt... |
import sys
import os
import gzip
ntfile = sys.argv[1]
rulesfile = sys.argv[2]
outdir = sys.argv[3]
edbfile = sys.argv[4]
# First process the rule files to understand which binary predicates we need
binaryPredicates = {}
unaryPredicates = {}
for line in open(rulesfile, 'rt'):
line = line[:-1]
tkns = line.split... | [
"os.path.exists",
"os.makedirs",
"gzip.open"
] | [((3678, 3700), 'os.path.exists', 'os.path.exists', (['outdir'], {}), '(outdir)\n', (3692, 3700), False, 'import os\n'), ((3706, 3725), 'os.makedirs', 'os.makedirs', (['outdir'], {}), '(outdir)\n', (3717, 3725), False, 'import os\n'), ((3781, 3830), 'gzip.open', 'gzip.open', (["(outdir + '/e_' + key + '.csv.gz')", '"""... |
import pandas as pd
import os
from os import listdir
from os.path import isfile, join
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
from sklearn.linear_model import LinearRegression
from sklearn.pipeline import Pipe... | [
"pandas.DataFrame",
"util.create_datetime",
"os.listdir",
"util.remove_and_save_NaN",
"pandas.read_csv",
"util.join",
"util.remove_duplicate",
"os.path.exists",
"pandas.to_datetime",
"util.read_data",
"os.path.join",
"util.drop_dumb_data"
] | [((1134, 1148), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1146, 1148), True, 'import pandas as pd\n'), ((2428, 2481), 'pandas.read_csv', 'pd.read_csv', (['"""../canarin-first-month.csv"""'], {'skiprows': '(4)'}), "('../canarin-first-month.csv', skiprows=4)\n", (2439, 2481), True, 'import pandas as pd\n'), ... |
# -*- coding: utf-8 -*-
# Copyright 2018 Objectif Libre
#
# 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 ... | [
"cloudkitty.storage_state.StateManager",
"datetime.timedelta",
"oslo_config.cfg.IntOpt",
"six.add_metaclass"
] | [((1056, 1086), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (1073, 1086), False, 'import six\n'), ((780, 957), 'oslo_config.cfg.IntOpt', 'cfg.IntOpt', (['"""retention_period"""'], {'default': '(2400)', 'help': '"""Duration after which data should be cleaned up/aggregated. Duratio... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import pytest
from aiographite.graphite_encoder import GraphiteEncoder
@pytest.mark.parametrize("name", [
'abc_edf',
'abc @edf#',
'abc.@edf#',
'abc_ @ e_df#',
'a.b.c_ @ e_df#',
'a.b.___c d _feg',
'_ . .fda',
'_.',
'汉 字.汉*字',
'%2D%2Ea b... | [
"pytest.mark.parametrize",
"pytest.raises",
"aiographite.graphite_encoder.GraphiteEncoder.decode",
"aiographite.graphite_encoder.GraphiteEncoder.encode"
] | [((117, 361), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name"""', "['abc_edf', 'abc @edf#', 'abc.@edf#', 'abc_ @ e_df#', 'a.b.c_ @ e_df#',\n 'a.b.___c d _feg', '_ . .fda', '_.', '汉 字.汉*字', '%2D%2Ea bcd',\n '_hello world.%2E', 'www.zillow.com.%2Ehello%2D', '', 'a' * 128]"], {}), "('name', ['abc_e... |
# Py3 compat layer
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import absolute_import
import arcpy
import glob
import os
import shutil
import sys
# create a handle to the windows kernel; want to make Win API calls
try:
import ctypes
from ctypes import wintype... | [
"os.remove",
"arcpy.GetInstallInfo",
"os.makedirs",
"shutil.rmtree",
"os.path.basename",
"_winreg.SetValueEx",
"arcpy.AddMessage",
"os.path.exists",
"os.path.dirname",
"os.rmdir",
"arcpy.AddError",
"arcpy.AddWarning",
"shutil.copyfile",
"shutil.copytree",
"os.path.join",
"os.getenv",
... | [((1677, 1699), 'arcpy.GetInstallInfo', 'arcpy.GetInstallInfo', ([], {}), '()\n', (1697, 1699), False, 'import arcpy\n'), ((6762, 6781), 'os.getenv', 'os.getenv', (['"""TMPDIR"""'], {}), "('TMPDIR')\n", (6771, 6781), False, 'import os\n'), ((3677, 3687), 'sys.exit', 'sys.exit', ([], {}), '()\n', (3685, 3687), False, 'i... |
from django.urls import re_path
from . import views
urlpatterns = [
re_path(r"^metadata/$", views.all_metadata),
re_path(r"^metadata/(?P<abbr>[a-zA-Z-]+)/$", views.state_metadata),
re_path(
r"^bills/(?P<abbr>[a-zA-Z-]+)/(?P<session>.+)/"
r"(?P<chamber>upper|lower)/(?P<bill_id>.+)/$",
... | [
"django.urls.re_path"
] | [((73, 115), 'django.urls.re_path', 're_path', (['"""^metadata/$"""', 'views.all_metadata'], {}), "('^metadata/$', views.all_metadata)\n", (80, 115), False, 'from django.urls import re_path\n'), ((122, 187), 'django.urls.re_path', 're_path', (['"""^metadata/(?P<abbr>[a-zA-Z-]+)/$"""', 'views.state_metadata'], {}), "('^... |
"""
Tests for the Sellers API class.
"""
import unittest
import mws
from .utils import CommonRequestTestTools
class SellersTestCase(unittest.TestCase, CommonRequestTestTools):
"""
Test cases for Sellers.
"""
# TODO: Add remaining methods for Sellers
def setUp(self):
self.api = mws.Sellers(... | [
"mws.Sellers"
] | [((308, 431), 'mws.Sellers', 'mws.Sellers', (['self.CREDENTIAL_ACCESS', 'self.CREDENTIAL_SECRET', 'self.CREDENTIAL_ACCOUNT'], {'auth_token': 'self.CREDENTIAL_TOKEN'}), '(self.CREDENTIAL_ACCESS, self.CREDENTIAL_SECRET, self.\n CREDENTIAL_ACCOUNT, auth_token=self.CREDENTIAL_TOKEN)\n', (319, 431), False, 'import mws\n'... |
import json
import requests
import html
import random
import time
from YorForger import dispatcher
from YorForger.modules.disable import DisableAbleCommandHandler
from telegram.ext import CallbackContext, CommandHandler, Filters, run_async, CallbackQueryHandler
from YorForger.modules.helper_funcs.chat_status import ... | [
"telegram.ext.CallbackQueryHandler",
"json.loads",
"telegram.InlineKeyboardButton",
"YorForger.modules.disable.DisableAbleCommandHandler",
"random.choice",
"telegram.InlineKeyboardMarkup",
"YorForger.dispatcher.add_handler",
"requests.get"
] | [((5427, 5496), 'YorForger.modules.disable.DisableAbleCommandHandler', 'DisableAbleCommandHandler', (['"""animequotes"""', 'animequotes'], {'run_async': '(True)'}), "('animequotes', animequotes, run_async=True)\n", (5452, 5496), False, 'from YorForger.modules.disable import DisableAbleCommandHandler\n'), ((5516, 5574),... |
#!/usr/bin/python3
"""Recipe for training speaker embeddings (e.g, xvectors) using the VoxCeleb Dataset.
We employ an encoder followed by a speaker classifier.
To run this recipe, use the following command:
> python train_speaker_embeddings.py {hyperparameter_file}
Using your own hyperparameter file or one of the fol... | [
"speechbrain.nnet.schedulers.update_learning_rate",
"torch.cat",
"os.path.join",
"speechbrain.dataio.dataset.add_dynamic_item",
"speechbrain.utils.distributed.ddp_init_group",
"speechbrain.dataio.dataset.DynamicItemDataset.from_csv",
"random.randint",
"speechbrain.utils.data_pipeline.takes",
"speech... | [((4625, 4754), 'speechbrain.dataio.dataset.DynamicItemDataset.from_csv', 'sb.dataio.dataset.DynamicItemDataset.from_csv', ([], {'csv_path': "hparams['train_annotation']", 'replacements': "{'data_root': data_folder}"}), "(csv_path=hparams[\n 'train_annotation'], replacements={'data_root': data_folder})\n", (4670, 47... |
"""The interface defining class for fit modes."""
from abc import ABC, abstractmethod
import numpy as np
from iminuit import Minuit
class AbstractFitPlugin(ABC):
"""Minuit wrapper to standardize usage with different likelihood function
definitions and parameter transformations.
"""
def __init__(
... | [
"numpy.empty",
"numpy.array",
"iminuit.Minuit"
] | [((865, 895), 'iminuit.Minuit', 'Minuit', (['fcn', 'internal_starters'], {}), '(fcn, internal_starters)\n', (871, 895), False, 'from iminuit import Minuit\n'), ((3147, 3164), 'numpy.empty', 'np.empty', (['n_boxes'], {}), '(n_boxes)\n', (3155, 3164), True, 'import numpy as np\n'), ((3277, 3318), 'numpy.empty', 'np.empty... |
# Copyright 2018 Owkin, 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,... | [
"substra.sdk.utils.extract_files",
"pydantic.root_validator",
"uuid.uuid4",
"substra.sdk.utils.extract_data_sample_files"
] | [((3490, 3523), 'pydantic.root_validator', 'pydantic.root_validator', ([], {'pre': '(True)'}), '(pre=True)\n', (3513, 3523), False, 'import pydantic\n'), ((2428, 2440), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (2438, 2440), False, 'import uuid\n'), ((2210, 2262), 'substra.sdk.utils.extract_files', 'utils.extract_f... |
from sklearn.datasets import fetch_20newsgroups
import torchvision
from sklearn.feature_extraction.text import TfidfVectorizer
from os.path import join
import numpy as np
import pickle
#TODO: Update mnist examples!!!
def dataset_loader(dataset_path=None, dataset='mnist', seed=1):
"""
Loads a dataset and creat... | [
"numpy.random.seed",
"sklearn.feature_extraction.text.TfidfVectorizer",
"numpy.asarray",
"numpy.float32",
"pickle.load",
"numpy.random.permutation",
"numpy.where",
"torchvision.datasets.MNIST",
"sklearn.datasets.fetch_20newsgroups",
"numpy.squeeze",
"os.path.join",
"numpy.concatenate"
] | [((546, 566), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (560, 566), True, 'import numpy as np\n'), ((3462, 3534), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': 'dataset_path', 'download': '(True)', 'train': '(True)'}), '(root=dataset_path, download=True, train=True)\... |
import numpy as np
import pandas as pd
def _to_binary(target):
return (target > target.median()).astype(int)
def generate_test_data(data_size):
df = pd.DataFrame()
np.random.seed(0)
df["A"] = np.random.rand(data_size)
df["B"] = np.random.rand(data_size)
df["C"] = np.random.rand(data_size)
... | [
"pandas.DataFrame",
"numpy.random.rand",
"numpy.random.seed",
"numpy.random.choice"
] | [((161, 175), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (173, 175), True, 'import pandas as pd\n'), ((181, 198), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (195, 198), True, 'import numpy as np\n'), ((213, 238), 'numpy.random.rand', 'np.random.rand', (['data_size'], {}), '(data_size)\n',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""TODO:
-- This module (and admin.py) needs some cleaning up: refactoring
similar to projects.py with ProjectsDB and style of SQLite
usage. Currently only authenticate() has been separated out.
-- Reset password needs to send user an email.
"""
fr... | [
"pysqlite2.dbapi2.connect",
"os.path.abspath",
"uuid.uuid4",
"authdb.create_new_db",
"bcrypt.gensalt",
"random.choice",
"logging.getLogger",
"time.time",
"httperrs.NotAuthorizedError",
"httperrs.ConflictError",
"bcrypt.hashpw"
] | [((761, 790), 'logging.getLogger', 'logging.getLogger', (['"""APP.AUTH"""'], {}), "('APP.AUTH')\n", (778, 790), False, 'import logging\n'), ((1056, 1072), 'bcrypt.gensalt', 'bcrypt.gensalt', ([], {}), '()\n', (1070, 1072), False, 'import bcrypt\n'), ((1086, 1115), 'bcrypt.hashpw', 'bcrypt.hashpw', (['password', 'salt']... |
from recon.core.module import BaseModule
from censys.ipv4 import CensysIPv4
from censys.base import CensysException
class Module(BaseModule):
meta = {
'name': 'Censys hosts by hostname',
'author': '<NAME>',
'version': '1.1',
'description': 'Finds all IPs for a given hostname. Upda... | [
"censys.ipv4.CensysIPv4"
] | [((680, 751), 'censys.ipv4.CensysIPv4', 'CensysIPv4', (['api_id', 'api_secret'], {'timeout': "self._global_options['timeout']"}), "(api_id, api_secret, timeout=self._global_options['timeout'])\n", (690, 751), False, 'from censys.ipv4 import CensysIPv4\n')] |
# -*- coding: utf-8 -*-
"""MedleyDB pitch Dataset Loader
.. admonition:: Dataset Info
:class: dropdown
MedleyDB Pitch is a pitch-tracking subset of the MedleyDB dataset
containing only f0-annotated, monophonic stems.
MedleyDB is a dataset of annotated, royalty-free multitrack recordings.
Medley... | [
"json.load",
"mirdata.core.copy_docs",
"csv.reader",
"mirdata.annotations.F0Data",
"mirdata.jams_utils.jams_converter",
"os.path.exists",
"mirdata.core.docstring_inherit",
"mirdata.core.LargeData",
"numpy.array",
"librosa.load",
"os.path.join"
] | [((1974, 2033), 'mirdata.core.LargeData', 'core.LargeData', (['"""medleydb_pitch_index.json"""', '_load_metadata'], {}), "('medleydb_pitch_index.json', _load_metadata)\n", (1988, 2033), False, 'from mirdata import core\n'), ((5465, 5501), 'mirdata.core.docstring_inherit', 'core.docstring_inherit', (['core.Dataset'], {}... |
"""contain methods to maintain GitHub hooks based on automatic deploy."""
import hashlib
import hmac
import json
import subprocess
from datetime import datetime, timedelta
from functools import wraps
from ipaddress import IPv4Address, IPv6Address, ip_address, ip_network
from os import path
from shutil import copyfile
f... | [
"json.dumps",
"flask.g.log.info",
"os.path.join",
"flask.request.get_json",
"ipaddress.ip_network",
"flask.request.headers.get",
"flask.abort",
"flask.g.log.warning",
"datetime.timedelta",
"requests.get",
"shutil.copyfile",
"datetime.datetime.now",
"subprocess.Popen",
"flask.Blueprint",
... | [((486, 515), 'flask.Blueprint', 'Blueprint', (['"""deploy"""', '__name__'], {}), "('deploy', __name__)\n", (495, 515), False, 'from flask import Blueprint, abort, g, request\n'), ((630, 650), 'datetime.datetime', 'datetime', (['(1970)', '(1)', '(1)'], {}), '(1970, 1, 1)\n', (638, 650), False, 'from datetime import dat... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from config.template_middleware import TemplateResponse
from gaebusiness.business import CommandExecutionException
from tekton import router
from gaecookie.decorator import no_csrf
from aluno_app import facade
from routes.alunos import adm... | [
"tekton.router.to_path",
"config.template_middleware.TemplateResponse",
"aluno_app.facade.save_aluno_cmd"
] | [((504, 545), 'aluno_app.facade.save_aluno_cmd', 'facade.save_aluno_cmd', ([], {}), '(**aluno_properties)\n', (525, 545), False, 'from aluno_app import facade\n'), ((776, 797), 'tekton.router.to_path', 'router.to_path', (['admin'], {}), '(admin)\n', (790, 797), False, 'from tekton import router\n'), ((389, 409), 'tekto... |
from __future__ import division
import torch
import numpy as np
def parse_conv_block(m, weights, offset, initflag):
"""
Initialization of conv layers with batchnorm
Args:
m (Sequential): sequence of layers
weights (numpy.ndarray): pretrained weights data
offset (int): current posi... | [
"numpy.fromfile",
"numpy.zeros",
"numpy.ones",
"numpy.random.normal",
"numpy.sqrt",
"torch.from_numpy"
] | [((3473, 3513), 'numpy.fromfile', 'np.fromfile', (['fp'], {'dtype': 'np.int32', 'count': '(5)'}), '(fp, dtype=np.int32, count=5)\n', (3484, 3513), True, 'import numpy as np\n'), ((3559, 3592), 'numpy.fromfile', 'np.fromfile', (['fp'], {'dtype': 'np.float32'}), '(fp, dtype=np.float32)\n', (3570, 3592), True, 'import num... |
from flask import Flask, request
from structs import *
import json
#import numpy
from basicFuncs import *
app = Flask(__name__)
def create_action(action_type, target):
actionContent = ActionContent(action_type, target.__dict__)
bleh = json.dumps(actionContent.__dict__)
print(bleh)
return bleh
def cr... | [
"flask.Flask",
"json.loads",
"json.dumps"
] | [((114, 129), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (119, 129), False, 'from flask import Flask, request\n'), ((246, 280), 'json.dumps', 'json.dumps', (['actionContent.__dict__'], {}), '(actionContent.__dict__)\n', (256, 280), False, 'import json\n'), ((994, 1028), 'json.dumps', 'json.dumps', (['a... |
from setuptools import setup, find_packages
setup(
name='yabeda',
version='0.1',
description="Yabeda",
long_description="""
A tool that sends deployment notifications from Gitlab CI to Slack.
""",
url="https://github.com/flix-tech/yabeda",
author="Flixtech",
license='MIT',
p... | [
"setuptools.find_packages"
] | [((358, 373), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (371, 373), False, 'from setuptools import setup, find_packages\n')] |
import os
from azul import config, require
from azul.template import emit
expected_component_path = os.path.join(os.path.abspath(config.project_root), 'terraform', config.terraform_component)
actual_component_path = os.path.dirname(os.path.abspath(__file__))
require(os.path.samefile(expected_component_path, actual_co... | [
"os.path.samefile",
"os.path.abspath",
"azul.config.enable_gcp"
] | [((115, 151), 'os.path.abspath', 'os.path.abspath', (['config.project_root'], {}), '(config.project_root)\n', (130, 151), False, 'import os\n'), ((234, 259), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (249, 259), False, 'import os\n'), ((269, 333), 'os.path.samefile', 'os.path.samefile', ... |
# coding: utf8
from __future__ import unicode_literals
import prodigy
from prodigy.components.loaders import JSONL
from prodigy.models.ner import EntityRecognizer
from prodigy.models.matcher import PatternMatcher
from prodigy.components.preprocess import split_sentences
from prodigy.components.sorters import prefer_un... | [
"prodigy.util.combine_models",
"prodigy.components.loaders.JSONL",
"prodigy.models.matcher.PatternMatcher",
"prodigy.components.preprocess.split_sentences",
"spacy.load",
"prodigy.models.ner.EntityRecognizer",
"prodigy.recipe"
] | [((614, 1110), 'prodigy.recipe', 'prodigy.recipe', (['"""ner.teach"""'], {'dataset': "('The dataset to use', 'positional', None, str)", 'spacy_model': "('The base model', 'positional', None, str)", 'source': "('The source data as a JSONL file', 'positional', None, str)", 'label': "('One or more comma-separated labels',... |
import json
from typing import Optional
from ..backend import OpenIDConnectBackend
from .models import SignaturgruppenToken
class SignaturgruppenBackend(OpenIDConnectBackend):
"""
TODO
"""
def __init__(
self,
*args,
authorization_endpoint: str,
token_e... | [
"json.dumps"
] | [((2025, 2047), 'json.dumps', 'json.dumps', (['amr_values'], {}), '(amr_values)\n', (2035, 2047), False, 'import json\n')] |
#!/usr/bin/env python3
import asyncio
import concurrent.futures
import datetime
import hashlib
import json
import time
import re
import os
import secrets
import time
import urllib.request
import urllib.error
from decimal import Decimal
from typing import Tuple
import blspy
from chia.types.blockchain_format.coin imp... | [
"chia.util.bech32m.decode_puzzle_hash",
"chia.types.spend_bundle.SpendBundle",
"blspy.G2Element.from_bytes",
"os.path.exists",
"hashlib.sha256",
"chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle.solution_for_conditions",
"datetime.datetime.now",
"chia.types.coin_spend.CoinSpend",
"chia.walle... | [((1069, 1117), 'chia.wallet.puzzles.load_clvm.load_clvm', 'load_clvm', (['"""p2_delayed_or_preimage.cl"""', '__name__'], {}), "('p2_delayed_or_preimage.cl', __name__)\n", (1078, 1117), False, 'from chia.wallet.puzzles.load_clvm import load_clvm\n'), ((2941, 3014), 're.compile', 're.compile', (['"""xchswap-log-(\\\\d{4... |
# -*- coding: utf-8 -*-
"""
Chat Room Demo for Miniboa.
"""
import logging
from miniboa import TelnetServer
IDLE_TIMEOUT = 300
CLIENT_LIST = []
SERVER_RUN = True
def on_connect(client):
"""
Sample on_connect function.
Handles new connections.
"""
logging.info("Opened connection to {}".format(cli... | [
"logging.info",
"miniboa.TelnetServer",
"logging.basicConfig"
] | [((2306, 2346), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (2325, 2346), False, 'import logging\n'), ((2511, 2617), 'miniboa.TelnetServer', 'TelnetServer', ([], {'port': '(7777)', 'address': '""""""', 'on_connect': 'on_connect', 'on_disconnect': 'on_discon... |
# vim: et:ts=4:sw=4:fenc=utf-8
import json
import os
import time
import math
def get_machine_dependent_params(settings, isa):
if os.path.isfile(settings.machine_dependent_params_file) and not settings.newSU:
with open(settings.machine_dependent_params_file, "r") as params_file:
params = json.... | [
"json.dump",
"json.load",
"PITE.processor_benchmarking.run_experiment_impl",
"os.rename",
"time.clock",
"os.path.isfile"
] | [((2873, 2885), 'time.clock', 'time.clock', ([], {}), '()\n', (2883, 2885), False, 'import time\n'), ((3977, 3989), 'time.clock', 'time.clock', ([], {}), '()\n', (3987, 3989), False, 'import time\n'), ((136, 190), 'os.path.isfile', 'os.path.isfile', (['settings.machine_dependent_params_file'], {}), '(settings.machine_d... |
import pronto
import zipfile
import gzip
import json
import networkx as nx
import time
import re
import MedGenParser
import HpoParser
import HGNCParser
# since this the Phenotype API is in a different folder we need to add it to the python path
import sys
sys.path.insert(0, '../PhenotypeAPI/')
import PhenotypeCorrel... | [
"HGNCParser.get_hgnc_genes_ids",
"json.dump",
"pronto.Ontology",
"zipfile.ZipFile",
"gzip.open",
"re.split",
"PhenotypeCorrelationParser.build_block_index",
"sys.path.insert",
"time.time",
"HpoParser.get_hpo_disease2hpoId_map",
"networkx.Graph",
"MedGenParser.get_medgen_disease2hpo"
] | [((258, 296), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../PhenotypeAPI/"""'], {}), "(0, '../PhenotypeAPI/')\n", (273, 296), False, 'import sys\n'), ((2018, 2029), 'time.time', 'time.time', ([], {}), '()\n', (2027, 2029), False, 'import time\n'), ((2192, 2222), 'pronto.Ontology', 'pronto.Ontology', (['hpo_file... |
import os
import torch
import torch.nn as nn
import logging
import time
from torch.nn.parallel import DistributedDataParallel as DDP
from lib.models.builder import build_model
from lib.models.loss import CrossEntropyLabelSmooth
from lib.models.utils.dbb.dbb_block import DiverseBranchBlock
from lib.dataset.builder impo... | [
"lib.dataset.builder.build_dataloader",
"lib.utils.measure.get_params",
"torch.no_grad",
"lib.utils.args.parse_args",
"os.path.join",
"lib.models.utils.dyrep.DyRep",
"torch.nn.parallel.DistributedDataParallel",
"os.path.dirname",
"lib.utils.measure.get_flops",
"lib.utils.model_ema.ModelEMA",
"li... | [((653, 745), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s %(message)s"""', 'datefmt': '"""%H:%M:%S"""'}), "(format='%(asctime)s %(levelname)s %(message)s', datefmt\n ='%H:%M:%S')\n", (672, 745), False, 'import logging\n'), ((770, 789), 'logging.getLogger', 'logging.get... |
import code
from pprint import pprint
from grouper import models
from grouper.ctl.util import make_session
from grouper.graph import GroupGraph
def shell_command(args):
session = make_session()
graph = GroupGraph.from_db(session)
m = models
pp = pprint
try:
from IPython import embed
... | [
"IPython.embed",
"grouper.graph.GroupGraph.from_db",
"code.interact",
"grouper.ctl.util.make_session"
] | [((186, 200), 'grouper.ctl.util.make_session', 'make_session', ([], {}), '()\n', (198, 200), False, 'from grouper.ctl.util import make_session\n'), ((213, 240), 'grouper.graph.GroupGraph.from_db', 'GroupGraph.from_db', (['session'], {}), '(session)\n', (231, 240), False, 'from grouper.graph import GroupGraph\n'), ((531... |
import sklearn.datasets as dt
import matplotlib.pyplot as plt
import numpy as np
seed = 1
# Create dataset
"""
x_data,y_data = dt.make_classification(n_samples=1000,
n_features=2,
n_repeated=0,
class_se... | [
"sklearn.datasets.make_circles",
"matplotlib.pyplot.show",
"numpy.savetxt",
"numpy.array",
"matplotlib.pyplot.savefig"
] | [((458, 511), 'sklearn.datasets.make_circles', 'dt.make_circles', ([], {'n_samples': '(700)', 'noise': '(0.2)', 'factor': '(0.3)'}), '(n_samples=700, noise=0.2, factor=0.3)\n', (473, 511), True, 'import sklearn.datasets as dt\n'), ((866, 889), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""data.png"""'], {}), "('dat... |
import win32service
import win32serviceutil
import win32api
import win32event
from ssh_cmd_manager import CmdManager
class aservice(win32serviceutil.ServiceFramework):
_svc_name_ = "ssh-shepherd-svc"
_svc_display_name_ = "SSH Shepherd"
_svc_description_ = "SSH tunnel manager for db-shepherd"
... | [
"win32serviceutil.HandleCommandLine",
"servicemanager.LogInfoMsg",
"win32api.SetConsoleCtrlHandler",
"ssh_cmd_manager.CmdManager",
"win32event.SetEvent",
"win32event.WaitForSingleObject",
"win32event.CreateEvent",
"servicemanager.LogMsg",
"win32serviceutil.ServiceFramework.__init__"
] | [((1446, 1495), 'win32api.SetConsoleCtrlHandler', 'win32api.SetConsoleCtrlHandler', (['ctrlHandler', '(True)'], {}), '(ctrlHandler, True)\n', (1476, 1495), False, 'import win32api\n'), ((1502, 1546), 'win32serviceutil.HandleCommandLine', 'win32serviceutil.HandleCommandLine', (['aservice'], {}), '(aservice)\n', (1536, 1... |
import os
import time
from multiprocessing import Pool # 首字母大写
def test(name):
print("[子进程-%s]PID=%d,PPID=%d" % (name, os.getpid(), os.getppid()))
time.sleep(1)
def main():
print("[父进程]PID=%d,PPID=%d" % (os.getpid(), os.getppid()))
p = Pool(5) # 设置最多5个进程(不设置就是CPU核数)
for i in range(10):
... | [
"os.getppid",
"multiprocessing.Pool",
"os.getpid",
"time.sleep"
] | [((158, 171), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (168, 171), False, 'import time\n'), ((257, 264), 'multiprocessing.Pool', 'Pool', (['(5)'], {}), '(5)\n', (261, 264), False, 'from multiprocessing import Pool\n'), ((134, 145), 'os.getpid', 'os.getpid', ([], {}), '()\n', (143, 145), False, 'import os\n')... |
#! /usr/bin/env python
# Copyright 2009 Google Inc. All Rights Reserved.
# Copyright 2014 Altera Corporation. All Rights Reserved.
# Copyright 2014-2018 <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... | [
"os.path.dirname",
"os.path.join",
"setuptools.setup",
"setuptools.find_packages"
] | [((2875, 2890), 'setuptools.setup', 'setup', ([], {}), '(**params)\n', (2880, 2890), False, 'from setuptools import setup, find_packages\n'), ((1051, 1076), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1066, 1076), False, 'import os\n'), ((1089, 1125), 'os.path.join', 'os.path.join', (['BA... |
# A simple script that plots the time and the speedup
# of the parallel OpenMP program as the number of available
# cores increases.
import matplotlib.pyplot as plt
import sys
import numpy as np
import matplotlib
matplotlib.use('Agg')
t_64 = []
t_1024 = []
t_4096 = []
s_64 = []
s_1024 = []
s_4096 = []
fp = open(sys... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.plot",
"matplotlib.use",
"numpy.arange",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((214, 235), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (228, 235), False, 'import matplotlib\n'), ((873, 887), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (885, 887), True, 'import matplotlib.pyplot as plt\n'), ((1083, 1137), 'matplotlib.pyplot.plot', 'plt.plot', (['t_64... |
from django.conf.urls import url, include
from stores import views
from rest_framework.routers import DefaultRouter
from rest_framework.schemas import get_schema_view
from rest_framework.authtoken import views as views_rest
from django.contrib.auth import views as auth_views
from django.conf import settings
from djang... | [
"django.conf.urls.include",
"django.conf.urls.url",
"rest_framework.routers.DefaultRouter",
"rest_framework.schemas.get_schema_view"
] | [((455, 470), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (468, 470), False, 'from rest_framework.routers import DefaultRouter\n'), ((802, 839), 'rest_framework.schemas.get_schema_view', 'get_schema_view', ([], {'title': '"""Pastebin API"""'}), "(title='Pastebin API')\n", (817, 839), Fals... |
from copy import deepcopy
class NodeGroupDelta:
def __init__(self, node_group : 'NodeGroup', sign : int = 1, virtual : bool = False):
self.node_group = node_group.produce_virtual_copy() if (virtual and not node_group.virtual) else node_group
self._sign = sign
def enforce(self):
retu... | [
"copy.deepcopy"
] | [((640, 671), 'copy.deepcopy', 'deepcopy', (['self.node_group', 'memo'], {}), '(self.node_group, memo)\n', (648, 671), False, 'from copy import deepcopy\n')] |
# -*- coding: utf-8 -*-
import numpy as np
def kalman_transit_covariance(S, A, R):
"""
:param S: Current covariance matrix
:param A: Either transition matrix or jacobian matrix
:param R: Current noise covariance matrix
"""
state_size = S.shape[0]
assert S.shape == (state_size, state_size)
... | [
"numpy.dot",
"numpy.abs",
"numpy.eye"
] | [((1093, 1107), 'numpy.dot', 'np.dot', (['S', 'C.T'], {}), '(S, C.T)\n', (1099, 1107), True, 'import numpy as np\n'), ((433, 445), 'numpy.dot', 'np.dot', (['A', 'S'], {}), '(A, S)\n', (439, 445), True, 'import numpy as np\n'), ((1188, 1206), 'numpy.eye', 'np.eye', (['state_size'], {}), '(state_size)\n', (1194, 1206), T... |
# Author: <NAME>
import h5py
import json
import librosa
import numpy as np
import os
import scipy
import time
from pathlib import Path
from PIL import Image
from torchvision.transforms import transforms
from dataloaders.utils import WINDOWS, compute_spectrogram
def run(json_path, hdf5_json_path, audio_path, image_pa... | [
"json.dump",
"h5py.File",
"json.load",
"argparse.ArgumentParser",
"numpy.frombuffer",
"os.path.dirname",
"numpy.dtype",
"os.path.exists",
"time.time",
"dataloaders.utils.compute_spectrogram",
"librosa.load"
] | [((1060, 1086), 'os.path.exists', 'os.path.exists', (['image_path'], {}), '(image_path)\n', (1074, 1086), False, 'import os\n'), ((1310, 1336), 'h5py.File', 'h5py.File', (['image_path', '"""w"""'], {}), "(image_path, 'w')\n", (1319, 1336), False, 'import h5py\n'), ((1463, 1474), 'time.time', 'time.time', ([], {}), '()\... |
from copy import deepcopy
DEVICE0_MAC = "00-11-22-33-44-55"
DEVICE1_MAC = "22-33-44-55-66-77"
BLOCKED_DEVICE1_MAC = "BB-BB-BB-BB-BB-B1"
BLOCKED_DEVICE2_MAC = "BB-BB-BB-BB-BB-B2"
LIMIT_DEVICE1_MAC = "33-33-33-33-33-33"
LIMIT_DEVICE2_MAC = "44-44-44-44-44-44"
ADDED_DEVICE_MAC = "55-55-55-55-55-55"
restructured_info_di... | [
"copy.deepcopy"
] | [((6722, 6756), 'copy.deepcopy', 'deepcopy', (['restructured_info_dicts1'], {}), '(restructured_info_dicts1)\n', (6730, 6756), False, 'from copy import deepcopy\n')] |
import os
import unittest
import ansiblelint
from ansiblelint import RulesCollection
class TestTaskIncludes(unittest.TestCase):
def setUp(self):
rulesdir = os.path.join('lib', 'ansiblelint', 'rules')
self.rules = RulesCollection.create_from_directory(rulesdir)
def test_included_tasks(self):
... | [
"os.path.join",
"ansiblelint.Runner",
"ansiblelint.RulesCollection.create_from_directory"
] | [((171, 214), 'os.path.join', 'os.path.join', (['"""lib"""', '"""ansiblelint"""', '"""rules"""'], {}), "('lib', 'ansiblelint', 'rules')\n", (183, 214), False, 'import os\n'), ((236, 283), 'ansiblelint.RulesCollection.create_from_directory', 'RulesCollection.create_from_directory', (['rulesdir'], {}), '(rulesdir)\n', (2... |
import argparse
import glob
import os
from utils import *
def main(args):
desired_width = args.desired_width
desired_height = args.desired_height
min_percentage = args.min_percentage
max_percentage = args.max_percentage
img_fn_array = []
if args.image:
img_obj = {}
img_obj["img"] = args.image
img_obj["... | [
"os.makedirs",
"argparse.ArgumentParser",
"os.path.exists",
"os.path.isfile",
"glob.iglob"
] | [((1237, 1351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Pre-processing"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Pre-processing', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (1260, 1351), False, 'import argparse\n'), (... |
import graphene
from ....checkout.error_codes import CheckoutErrorCode
from ....checkout.fetch import (
fetch_checkout_info,
fetch_checkout_lines,
update_delivery_method_lists_for_checkout_info,
)
from ....checkout.utils import add_variants_to_checkout, recalculate_checkout_discount
from ....warehouse.rese... | [
"graphene.ID",
"graphene.Field"
] | [((1115, 1175), 'graphene.Field', 'graphene.Field', (['Checkout'], {'description': '"""An updated checkout."""'}), "(Checkout, description='An updated checkout.')\n", (1129, 1175), False, 'import graphene\n'), ((1211, 1286), 'graphene.ID', 'graphene.ID', ([], {'description': '("The checkout\'s ID." + ADDED_IN_34)', 're... |
#!/usr/bin/env python
"""
_LoadFromFilesetWorkflow_
MySQL implementation of Subscription.LoadFromFilesetWorkflow
"""
__all__ = []
from WMCore.Database.DBFormatter import DBFormatter
class LoadFromFilesetWorkflow(DBFormatter):
sql = """SELECT wmbs_subscription.id, fileset, workflow, split_algo,
... | [
"WMCore.Database.DBFormatter.DBFormatter.formatDict"
] | [((794, 830), 'WMCore.Database.DBFormatter.DBFormatter.formatDict', 'DBFormatter.formatDict', (['self', 'result'], {}), '(self, result)\n', (816, 830), False, 'from WMCore.Database.DBFormatter import DBFormatter\n')] |
from django.contrib.gis.db import models
class Property(models.Model):
account = models.ForeignKey(
"accounts.Account",
null=True,
blank=True,
on_delete=models.SET_NULL,
)
cadastre = models.ForeignKey(
"cadastres.Cadastre",
null=True,
blank=True,
... | [
"django.contrib.gis.db.models.FloatField",
"django.contrib.gis.db.models.TextField",
"django.contrib.gis.db.models.ForeignKey"
] | [((87, 179), 'django.contrib.gis.db.models.ForeignKey', 'models.ForeignKey', (['"""accounts.Account"""'], {'null': '(True)', 'blank': '(True)', 'on_delete': 'models.SET_NULL'}), "('accounts.Account', null=True, blank=True, on_delete=\n models.SET_NULL)\n", (104, 179), False, 'from django.contrib.gis.db import models... |
from __future__ import print_function
import pandas as pd
import numpy as np
import os
from collections import OrderedDict
from pria_lifechem.function import *
from prospective_screening_model_names import *
from prospective_screening_metric_names import *
def clean_excel():
dataframe = pd.read_excel('../../outp... | [
"pandas.DataFrame",
"numpy.load",
"pandas.read_csv",
"numpy.zeros",
"os.path.exists",
"pandas.read_excel",
"numpy.min",
"numpy.array",
"collections.OrderedDict",
"numpy.vstack"
] | [((295, 365), 'pandas.read_excel', 'pd.read_excel', (['"""../../output/stage_2_predictions/Keck_LC4_backup.xlsx"""'], {}), "('../../output/stage_2_predictions/Keck_LC4_backup.xlsx')\n", (308, 365), True, 'import pandas as pd\n'), ((556, 622), 'pandas.read_csv', 'pd.read_csv', (['"""../../dataset/fixed_dataset/pria_pros... |
#!/usr/bin/env python
import unittest
from pybeardy.zapper import ZapState
class ZapStateTest(unittest.TestCase):
def test_state(self):
s = ZapState(True, True)
self.assertTrue(s.detect)
self.assertTrue(s.trigger)
if __name__ == '__main__':
unittest.main()
| [
"unittest.main",
"pybeardy.zapper.ZapState"
] | [((278, 293), 'unittest.main', 'unittest.main', ([], {}), '()\n', (291, 293), False, 'import unittest\n'), ((155, 175), 'pybeardy.zapper.ZapState', 'ZapState', (['(True)', '(True)'], {}), '(True, True)\n', (163, 175), False, 'from pybeardy.zapper import ZapState\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
version = '0.3.0'
with open('README.md') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
with open('requirements.txt') as f:
required = f.read().splitlines()
setup(
name='rmageddon',
version=ver... | [
"setuptools.find_packages"
] | [((830, 859), 'setuptools.find_packages', 'find_packages', ([], {'exclude': '"""docs"""'}), "(exclude='docs')\n", (843, 859), False, 'from setuptools import setup, find_packages\n')] |
from flask_apispec import MethodResource
from flask_apispec import use_kwargs, doc
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from webargs import fields
from decorator.catch_exception import catch_exception
from decorator.log_request import log_request
from decorator.verify_admin_ac... | [
"webargs.fields.Int",
"flask_apispec.doc",
"exception.object_not_found.ObjectNotFound"
] | [((555, 754), 'flask_apispec.doc', 'doc', ([], {'tags': "['user']", 'description': '"""Update user group assignment"""', 'responses': "{'200': {}, '422.a': {'description': 'Object not found: group'}, '422.b': {\n 'description': 'Object not found: user'}}"}), "(tags=['user'], description='Update user group assignment... |