code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# coding: utf-8
from typing import List, Tuple, Dict
import torch
import logging
import sys
import os
import copy
import json
import collections
import subprocess
from tqdm import tqdm, trange
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from torch.utils.data.distributed impo... | [
"logging.basicConfig",
"logging.getLogger",
"utils.iter_helper.PadCollate",
"collections.namedtuple",
"copy.deepcopy",
"os.listdir",
"subprocess.Popen",
"torch.LongTensor",
"tqdm.tqdm",
"os.path.join",
"torch.utils.data.SequentialSampler",
"torch.utils.data.RandomSampler",
"torch.no_grad",
... | [((697, 859), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/... |
#!/usr/bin/python
# Copyright 2016 Dell 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 appl... | [
"charmhelpers.payload.execd.execd_preinstall",
"charmhelpers.core.hookenv.log",
"charmhelpers.core.hookenv.relation_ids",
"cinder_contexts.DellScContext",
"charmhelpers.core.hookenv.service_name",
"charmhelpers.core.hookenv.Hooks"
] | [((784, 799), 'charmhelpers.core.hookenv.Hooks', 'hookenv.Hooks', ([], {}), '()\n', (797, 799), False, 'from charmhelpers.core import hookenv\n'), ((884, 908), 'charmhelpers.payload.execd.execd_preinstall', 'execd.execd_preinstall', ([], {}), '()\n', (906, 908), False, 'from charmhelpers.payload import execd\n'), ((106... |
from survey import Survey
from question import Question
class Collector:
def __init__(self,phone,name):
self.phone=phone
self.name=name
self.survey_list={}
self.contact_list={}
self.state=0;
self.cur=None
self.cur_question=None
def create_Survey(self,na... | [
"question.Question",
"survey.Survey"
] | [((342, 354), 'survey.Survey', 'Survey', (['name'], {}), '(name)\n', (348, 354), False, 'from survey import Survey\n'), ((641, 651), 'question.Question', 'Question', ([], {}), '()\n', (649, 651), False, 'from question import Question\n')] |
"""
Class for handling options.
"""
import inspect
from typing import Union, Optional
from importlib._bootstrap import module_from_spec
from importlib._bootstrap_external import spec_from_file_location
from pathlib import Path
_path_directives = {'primary', 'secondary', 'default'}
class Figcon:
""" Class for ha... | [
"importlib._bootstrap.module_from_spec",
"pathlib.Path",
"pathlib.Path.cwd",
"pathlib.Path.home",
"inspect.ismodule",
"inspect.isfunction",
"importlib._bootstrap_external.spec_from_file_location"
] | [((3157, 3167), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (3161, 3167), False, 'from pathlib import Path\n'), ((3795, 3833), 'importlib._bootstrap_external.spec_from_file_location', 'spec_from_file_location', (['mod', 'expected'], {}), '(mod, expected)\n', (3818, 3833), False, 'from importlib._bootstrap_exter... |
import pytest
from hypothesis import given, example
import hypothesis.strategies as strat
from vault_anyconfig.vault_anyconfig import VaultAnyConfig
@given(
contents=strat.text(min_size=1, alphabet=strat.characters(blacklist_categories=("C"))),
secret_key=strat.text(min_size=1, alphabet=strat.characters(blac... | [
"vault_anyconfig.vault_anyconfig.VaultAnyConfig._VaultAnyConfig__is_key_value_v2",
"hypothesis.example",
"hypothesis.strategies.characters",
"vault_anyconfig.vault_anyconfig.VaultAnyConfig._VaultAnyConfig__is_key_value_v1"
] | [((349, 392), 'hypothesis.example', 'example', ([], {'contents': '"""aoeu"""', 'secret_key': '"""data"""'}), "(contents='aoeu', secret_key='data')\n", (356, 392), False, 'from hypothesis import given, example\n'), ((394, 441), 'hypothesis.example', 'example', ([], {'contents': '"""aoeu"""', 'secret_key': '"""metadata""... |
"""BrandComparator2.ipynb
Server Link: https://colab.research.google.com/drive/15x-yWFGtF57rOCfi9tqEONlYWeGlkoml
[Colab Notebook with Explanation](https://colab.research.google.com/drive/1dYH5PAausru6lQy1dh5-aGC9S9DXO_bV?usp=sharing)
[Anvil App](https://NPFLBAAEVOXXUYZK.anvil.app/QED54JFBPJMZBQPITDWWVL75)
# Inst... | [
"nltk.download",
"re.compile",
"nest_asyncio.apply",
"twint.storage.panda.clean",
"matplotlib.pyplot.imshow",
"textblob.TextBlob",
"nltk.sentiment.vader.SentimentIntensityAnalyzer",
"nltk.corpus.stopwords.words",
"matplotlib.pyplot.style.use",
"w3lib.html.replace_entities",
"matplotlib.pyplot.ax... | [((611, 633), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (624, 633), False, 'import nltk\n'), ((634, 660), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (647, 660), False, 'import nltk\n'), ((661, 691), 'nltk.download', 'nltk.download', (['"""vader_lexicon"... |
# Copyright (C) 2021-2022 by the FEM on Colab authors
#
# This file is part of FEM on Colab-related actions.
#
# SPDX-License-Identifier: MIT
"""Tests for the open_in_colab_workflow.get_drive_url package."""
import os
import tempfile
import pytest
from open_in_colab_workflow.get_drive_url import get_drive_url
@pyt... | [
"os.path.join",
"pytest.mark.skipif",
"tempfile.NamedTemporaryFile",
"open_in_colab_workflow.get_drive_url.get_drive_url",
"os.path.relpath"
] | [((317, 434), 'pytest.mark.skipif', 'pytest.mark.skipif', (["('RCLONE_CONFIG_COLAB_TOKEN' not in os.environ)"], {'reason': '"""Missing rclone environment variables"""'}), "('RCLONE_CONFIG_COLAB_TOKEN' not in os.environ, reason=\n 'Missing rclone environment variables')\n", (335, 434), False, 'import pytest\n'), ((96... |
# -*- coding: utf-8 -*-
# --------------------------------------------------------------------------
# Copyright Commvault Systems, 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
#
# ... | [
"cvpysdk.exception.SDKException"
] | [((1687, 1718), 'cvpysdk.exception.SDKException', 'SDKException', (['"""Instance"""', '"""101"""'], {}), "('Instance', '101')\n", (1699, 1718), False, 'from cvpysdk.exception import SDKException\n'), ((2558, 2589), 'cvpysdk.exception.SDKException', 'SDKException', (['"""Instance"""', '"""101"""'], {}), "('Instance', '1... |
from concurrent.futures import ThreadPoolExecutor
import queue
class BlockingThreadPoolExecutor(ThreadPoolExecutor):
def __init__(self, max_workers=None, thread_name_prefix=''):
super().__init__(max_workers=max_workers, thread_name_prefix=thread_name_prefix)
self._work_queue = queue.Queue(maxsize=... | [
"queue.Queue"
] | [((300, 332), 'queue.Queue', 'queue.Queue', ([], {'maxsize': 'max_workers'}), '(maxsize=max_workers)\n', (311, 332), False, 'import queue\n')] |
import csv
name = "100_9x9Aya"
win = open("Data/Results-Split/" + name + "_win.txt", 'w+')
loss = open("Data/Results-Split/" + name + "_loss.txt", 'w+')
draw = open("Data/Results-Split/" + name + "_draw.txt", 'w+')
def convert(_input):
rows = ''
i = 0
while i < len(_input)-1:
rows = rows + _input... | [
"csv.reader"
] | [((676, 692), 'csv.reader', 'csv.reader', (['file'], {}), '(file)\n', (686, 692), False, 'import csv\n')] |
# Check http://doc.qt.io/qtcreator/creator-debugging-helpers.html
# for more details or look at qttypes.py, stdtypes.py, boosttypes.py
# for more complex examples.
from dumper import Children, SubItem, UnnamedSubItem, DumperBase
from utils import DisplayFormat, TypeCode
from qttypes import *
import struct
############... | [
"dumper.SubItem",
"dumper.Children",
"struct.pack"
] | [((565, 576), 'dumper.Children', 'Children', (['d'], {}), '(d)\n', (573, 576), False, 'from dumper import Children, SubItem, UnnamedSubItem, DumperBase\n'), ((861, 878), 'dumper.SubItem', 'SubItem', (['d', '"""sum"""'], {}), "(d, 'sum')\n", (868, 878), False, 'from dumper import Children, SubItem, UnnamedSubItem, Dumpe... |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 <NAME> <<EMAIL>>
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.o... | [
"pinutils.findpin",
"pinutils.generate_pins"
] | [((4535, 4564), 'pinutils.generate_pins', 'pinutils.generate_pins', (['(0)', '(31)'], {}), '(0, 31)\n', (4557, 4564), False, 'import pinutils\n'), ((4597, 4632), 'pinutils.findpin', 'pinutils.findpin', (['pins', '"""PD0"""', '(True)'], {}), "(pins, 'PD0', True)\n", (4613, 4632), False, 'import pinutils\n'), ((4658, 469... |
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2015, ARM Limited and contributors.
#
# 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
#
# ... | [
"logging.debug",
"logging.warning",
"logging.info",
"devlib.HwmonInstrument",
"devlib.EnergyProbeInstrument",
"time.time",
"json.dump"
] | [((2924, 3016), 'logging.info', 'logging.info', (['"""%14s - Scanning for HWMON channels, may take some time..."""', '"""EnergyMeter"""'], {}), "('%14s - Scanning for HWMON channels, may take some time...',\n 'EnergyMeter')\n", (2936, 3016), False, 'import logging\n'), ((3035, 3071), 'devlib.HwmonInstrument', 'devli... |
import collections
TestCase = collections.namedtuple('TestCase', "description input_table_name input_commit_statement input_primary_key_fields expected_entries expected_sql")
tests=[
TestCase(
description="Rejected",
input_table_name="ALS2",
input_commit_statement="""ALTER TABLE ALS2 shrink space check"... | [
"collections.namedtuple"
] | [((31, 184), 'collections.namedtuple', 'collections.namedtuple', (['"""TestCase"""', '"""description input_table_name input_commit_statement input_primary_key_fields expected_entries expected_sql"""'], {}), "('TestCase',\n 'description input_table_name input_commit_statement input_primary_key_fields expected_entries... |
from awscfncli2.runner import Boto3Profile
class TestStackSelector(object):
def test_update(self):
s1 = Boto3Profile('foo','bar')
s2 = Boto3Profile('foo', 'baz')
assert s1.region_name == 'bar'
s1.update(s2)
| [
"awscfncli2.runner.Boto3Profile"
] | [((119, 145), 'awscfncli2.runner.Boto3Profile', 'Boto3Profile', (['"""foo"""', '"""bar"""'], {}), "('foo', 'bar')\n", (131, 145), False, 'from awscfncli2.runner import Boto3Profile\n'), ((158, 184), 'awscfncli2.runner.Boto3Profile', 'Boto3Profile', (['"""foo"""', '"""baz"""'], {}), "('foo', 'baz')\n", (170, 184), False... |
import tensorflow as tf
from tensorflow.keras.layers import (
BatchNormalization,
LeakyReLU,
Activation,
Conv1D,
ELU,
Add,
)
from functools import partial
from tensorflow.compat.v1.keras.initializers import he_uniform
def _get_conv_activation_layer(params):
"""
:param params:
:retu... | [
"tensorflow.shape",
"tensorflow.keras.Sequential",
"tensorflow.keras.layers.LeakyReLU",
"tensorflow.compat.v1.keras.initializers.he_uniform",
"tensorflow.keras.layers.Add",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.concat",
"functools.partial",
"tensorflow.keras.layers.Conv1D",
"te... | [((538, 552), 'tensorflow.keras.layers.LeakyReLU', 'LeakyReLU', (['(0.2)'], {}), '(0.2)\n', (547, 552), False, 'from tensorflow.keras.layers import BatchNormalization, LeakyReLU, Activation, Conv1D, ELU, Add\n'), ((659, 680), 'tensorflow.keras.Sequential', 'tf.keras.Sequential', ([], {}), '()\n', (678, 680), True, 'imp... |
# 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
# distributed under th... | [
"tensorflow.contrib.layers.conv2d",
"tensorflow.contrib.layers.flatten",
"tensorflow.contrib.learn.ModelFnOps",
"tensorflow.nn.softmax",
"tensorflow.contrib.layers.linear",
"tensorflow.contrib.learn.RunConfig",
"tensorflow.contrib.metrics.accuracy",
"tensorflow.train.exponential_decay",
"tensorflow.... | [((965, 1000), 'tensorflow.python.platform.tf_logging.set_verbosity', 'logging.set_verbosity', (['logging.INFO'], {}), '(logging.INFO)\n', (986, 1000), True, 'from tensorflow.python.platform import tf_logging as logging\n'), ((1603, 1673), 'tensorflow.contrib.learn.python.learn.datasets.mnist.read_data_sets', 'read_dat... |
#!/usr/bin/env python3
# usage:
# fwhmSweep.py 56530 7 14
# fwhmSweep.py <mjd> <file number first> <file nimber last>
import glob
import pyfits
import sys, os
import numpy as np
from scipy import ndimage
from pylab import *
import scipy
directory="/data/ecam/%s/" % (sys.argv[1])
# if directory exist?
if os.pa... | [
"os.path.exists",
"numpy.sqrt",
"numpy.where",
"scipy.polyfit",
"scipy.array",
"scipy.interpolate.interp1d",
"numpy.array",
"scipy.polyval",
"sys.exit",
"scipy.ndimage.measurements.center_of_mass",
"pyfits.open"
] | [((1653, 1673), 'scipy.array', 'scipy.array', (['fwhmPix'], {}), '(fwhmPix)\n', (1664, 1673), False, 'import scipy\n'), ((1802, 1821), 'scipy.array', 'scipy.array', (['focArr'], {}), '(focArr)\n', (1813, 1821), False, 'import scipy\n'), ((1835, 1871), 'scipy.polyfit', 'scipy.polyfit', (['arrayFoc', 'arrayPix', '(2)'], ... |
from pytest import fixture
from pytest_mock import MockerFixture
from stopwatch import Stopwatch
from .mocks.time import TimeMock
def describe_stopwatch() -> None:
@fixture
def time_mock() -> TimeMock:
return TimeMock()
def describe_start() -> None:
def with_stop(mocker: MockerFixture, ... | [
"stopwatch.Stopwatch"
] | [((437, 465), 'stopwatch.Stopwatch', 'Stopwatch', ([], {'print_report': '(True)'}), '(print_report=True)\n', (446, 465), False, 'from stopwatch import Stopwatch\n'), ((937, 965), 'stopwatch.Stopwatch', 'Stopwatch', ([], {'print_report': '(True)'}), '(print_report=True)\n', (946, 965), False, 'from stopwatch import Stop... |
# -*- coding: utf-8 -*-
__author__ = "MJ (<EMAIL>)"
__license__ = "Apache 2.0"
# scip plugin
from ribbon.client.config.client_config import ClientConfig
from ribbon.eureka.discovery_enabled_server import DiscoveryEnabledServer
from ribbon.loadbalancer.dynamic_server_list_load_balancer import DynamicServerListLoadBala... | [
"ribbon.loadbalancer.dynamic_server_list_load_balancer.DynamicServerListLoadBalancer",
"ribbon.client.config.client_config.ClientConfig",
"tests.eureka.client.discovery.shared.stubs.instance_info"
] | [((697, 728), 'ribbon.loadbalancer.dynamic_server_list_load_balancer.DynamicServerListLoadBalancer', 'DynamicServerListLoadBalancer', ([], {}), '()\n', (726, 728), False, 'from ribbon.loadbalancer.dynamic_server_list_load_balancer import DynamicServerListLoadBalancer\n'), ((912, 926), 'ribbon.client.config.client_confi... |
# Copyright (c) 2014-2017 esotericnonsense (<NAME>)
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/licenses/mit-license.php
from macros import MODES
class ModeHandler(object):
def __init__(self, base_callbacks):
self._mode = None
self.... | [
"macros.MODES.index"
] | [((1597, 1620), 'macros.MODES.index', 'MODES.index', (['self._mode'], {}), '(self._mode)\n', (1608, 1620), False, 'from macros import MODES\n')] |
import argparse
import os
import numpy as np
from torchdistill.datasets.transform import CustomCompose, CustomRandomResize
from torchdistill.datasets.util import load_coco_dataset, build_transform
from torchvision.datasets import ImageFolder, VOCSegmentation
from torchvision.transforms import transforms
from custom.t... | [
"torchvision.transforms.transforms.CenterCrop",
"argparse.ArgumentParser",
"torchdistill.datasets.transform.CustomRandomResize",
"numpy.array",
"custom.transform.BPG",
"torchvision.transforms.transforms.Resize",
"os.path.expanduser"
] | [((376, 477), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""BPG file size for ImageNet and COCO segmentation datasets"""'}), "(description=\n 'BPG file size for ImageNet and COCO segmentation datasets')\n", (399, 477), False, 'import argparse\n'), ((834, 982), 'custom.transform.BPG',... |
import os
filt_path = os.path.abspath(__file__)
father_path = os.path.abspath(os.path.dirname(filt_path) + os.path.sep + ".")
GPU_ID = 0
# psenet相关
pse_long_size = 960 # 图片长边
pse_model_type = "mobilenetv2"
pse_scale = 1
if pse_model_type == "mobilenetv2":
pse_model_path = os.path.join(father_path, "models/psen... | [
"os.path.abspath",
"os.path.dirname",
"os.path.join"
] | [((23, 48), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (38, 48), False, 'import os\n'), ((410, 471), 'os.path.join', 'os.path.join', (['father_path', '"""models/crnn_dw_lstm_vertical.pth"""'], {}), "(father_path, 'models/crnn_dw_lstm_vertical.pth')\n", (422, 471), False, 'import os\n'), (... |
import os
from . import db
from .form import User
from .const import SCP_DIR, DISK_DIR
def delete_admin():
"""
删除管理员账号
:return:
"""
users = User.query.all()
for u in users:
db.session.delete(u)
db.session.commit()
def get_disk_main_dir():
"""
获取网盘主目录
:return:
"""... | [
"os.listdir",
"os.path.isabs",
"os.path.join",
"os.path.isfile",
"os.path.isdir"
] | [((328, 351), 'os.path.isabs', 'os.path.isabs', (['DISK_DIR'], {}), '(DISK_DIR)\n', (341, 351), False, 'import os\n'), ((580, 596), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (590, 596), False, 'import os\n'), ((418, 449), 'os.path.join', 'os.path.join', (['SCP_DIR', 'DISK_DIR'], {}), '(SCP_DIR, DISK_DIR)\... |
import numpy as np
import matplotlib.pyplot as pl
import os
from ipdb import set_trace as stop
os.environ["KERAS_BACKEND"] = "tensorflow"
from keras.optimizers import Adam
from keras.layers import Dense, LSTM, Input, TimeDistributed, Flatten
from keras.models import Model
import tensorflow as tf
import keras.backend.... | [
"keras.optimizers.Adam",
"keras.backend.tensorflow_backend.set_session",
"numpy.random.rand",
"keras.layers.Flatten",
"tensorflow.Session",
"keras.utils.plot_model",
"numpy.array",
"keras.layers.Input",
"numpy.zeros",
"numpy.random.randint",
"keras.models.Model",
"keras.layers.LSTM",
"keras.... | [((481, 497), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (495, 497), True, 'import tensorflow as tf\n'), ((561, 586), 'tensorflow.Session', 'tf.Session', ([], {'config': 'config'}), '(config=config)\n', (571, 586), True, 'import tensorflow as tf\n'), ((595, 619), 'keras.backend.tensorflow_backend.set... |
"""
Utility functions for Electron-Microscopy
"""
import math
def voltage_to_wavelength(voltage):
"""
Convert from electron voltage to wavelength.
:param voltage: float, The electron voltage in kV.
:return: float, The electron wavelength in nm.
"""
return 12.2643247 / math.sqrt(voltage*1e3 + ... | [
"math.sqrt"
] | [((296, 349), 'math.sqrt', 'math.sqrt', (['(voltage * 1000.0 + 0.978466 * voltage ** 2)'], {}), '(voltage * 1000.0 + 0.978466 * voltage ** 2)\n', (305, 349), False, 'import math\n'), ((575, 646), 'math.sqrt', 'math.sqrt', (['(1000000.0 + 4 * 12.2643247 ** 2 * 0.978466 / wavelength ** 2)'], {}), '(1000000.0 + 4 * 12.264... |
#!/usr/bin/env python3
import time
import re
import glob
import os
import platform
import sys
import unicodedata
import urllib.parse
import codecs
import queue
from multiprocessing import Process, Event, Queue
from collections import Counter
baseDir = os.path.dirname(__file__)
sourceDir = os.path.join(baseDir, 'back... | [
"re.compile",
"multiprocessing.Process",
"time.sleep",
"re.search",
"subprocess.Popen",
"platform.system",
"re.finditer",
"multiprocessing.Event",
"os.path.isfile",
"os.path.dirname",
"sys.stdout.isatty",
"multiprocessing.Queue",
"codecs.getincrementaldecoder",
"os.path.join",
"collectio... | [((254, 279), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (269, 279), False, 'import os\n'), ((293, 324), 'os.path.join', 'os.path.join', (['baseDir', '"""backup"""'], {}), "(baseDir, 'backup')\n", (305, 324), False, 'import os\n'), ((5984, 6094), 're.compile', 're.compile', (['"""(?:^|(?<... |
import subprocess
import pytest
from build.platform.python.tests import testlib
PYTHON_VERSIONS = ["2.7", "3.4", "3.5", "3.6"] # 3.7, 3.8 are not runnable
@pytest.mark.parametrize("pyver", PYTHON_VERSIONS)
def test_version_matched(pyver):
testlib.check_python_version(pyver)
@pytest.mark.parametrize("pyver",... | [
"subprocess.check_output",
"pytest.mark.parametrize",
"build.platform.python.tests.testlib.get_python_bin",
"build.platform.python.tests.testlib.check_python_version"
] | [((162, 211), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pyver"""', 'PYTHON_VERSIONS'], {}), "('pyver', PYTHON_VERSIONS)\n", (185, 211), False, 'import pytest\n'), ((288, 337), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""pyver"""', 'PYTHON_VERSIONS'], {}), "('pyver', PYTHON_VERSIONS)\n"... |
from __future__ import print_function
import numpy as np
from scipy import sparse
from scipy.interpolate import griddata
def fast_histogram2d(x, y, bins=10, weights=None, reduce_w=None, NULL=None,
reinterp=None):
"""
Compute the sparse bi-dimensional histogram of two data samples where *x... | [
"numpy.ones",
"numpy.sort",
"numpy.log",
"numpy.asarray",
"numpy.floor",
"numpy.argmax",
"numpy.diff",
"numpy.std",
"numpy.array",
"numpy.zeros",
"numpy.isfinite",
"numpy.vstack",
"numpy.concatenate",
"scipy.sparse.coo_matrix",
"numpy.cumsum",
"numpy.transpose",
"numpy.arange"
] | [((3555, 3600), 'scipy.sparse.coo_matrix', 'sparse.coo_matrix', (['(_w, _xyi)'], {'shape': '(nx, ny)'}), '((_w, _xyi), shape=(nx, ny))\n', (3572, 3600), False, 'from scipy import sparse\n'), ((5274, 5284), 'numpy.sort', 'np.sort', (['t'], {}), '(t)\n', (5281, 5284), True, 'import numpy as np\n'), ((5361, 5416), 'numpy.... |
"""
Holt Winter Anomaly detection Example
In this example we will look into how to create holt winters model and build an anomaly detection model
in less than 4 steps.
"""
if __name__ == '__main__':
from pytsal import anomaly, forecasting
from pytsal.dataset import *
# 1. Load the dataset
ts_... | [
"pytsal.forecasting.setup",
"pytsal.forecasting.load_model",
"pytsal.forecasting.finalize",
"pytsal.anomaly.setup",
"pytsal.forecasting.save_model"
] | [((446, 470), 'pytsal.forecasting.load_model', 'forecasting.load_model', ([], {}), '()\n', (468, 470), False, 'from pytsal import anomaly, forecasting\n'), ((944, 992), 'pytsal.anomaly.setup', 'anomaly.setup', (['ts_with_anomaly', 'model', '"""brutlag"""'], {}), "(ts_with_anomaly, model, 'brutlag')\n", (957, 992), Fals... |
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from django.core.files.storage import default_storage
from django.core.files.base import ContentFile
from django.conf import settings
from .models import ContentImage
import io
import os
import json
from .src.trans_model import Tr... | [
"django.shortcuts.render",
"os.path.abspath",
"time.localtime",
"django.core.files.storage.default_storage.open",
"multiprocessing.dummy.Pool",
"PIL.Image.save"
] | [((2325, 2399), 'django.shortcuts.render', 'render', (['request', '"""artistpainting/basic.html"""', "{'style_img': style_img_url}"], {}), "(request, 'artistpainting/basic.html', {'style_img': style_img_url})\n", (2331, 2399), False, 'from django.shortcuts import render\n'), ((2448, 2496), 'django.shortcuts.render', 'r... |
#
# Unittests for nuskell.dsdcompiler.compiler
#
# Written by <NAME> (<EMAIL>).
#
import unittest
from nuskell.dsdcompiler.objects import clear_memory, NuskellComplex
from nuskell.dsdcompiler.compiler import translate
class Test_Workflow(unittest.TestCase):
def setUp(self):
NuskellComplex.ID = 1
def ... | [
"unittest.main",
"nuskell.dsdcompiler.compiler.translate",
"nuskell.dsdcompiler.objects.clear_memory"
] | [((1147, 1162), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1160, 1162), False, 'import unittest\n'), ((344, 358), 'nuskell.dsdcompiler.objects.clear_memory', 'clear_memory', ([], {}), '()\n', (356, 358), False, 'from nuskell.dsdcompiler.objects import clear_memory, NuskellComplex\n'), ((507, 539), 'nuskell.ds... |
from utils import load_data
from torch.nn.modules.module import Module
from torch.nn.parameter import Parameter
import math
import os
import time
from datetime import datetime
from py.predict import Predictor
from py.predict import ttypes
from thrift.transport import TSocket
from thrift.transport import TTransport
from... | [
"thrift.server.TServer.TThreadedServer",
"py.predict.ttypes.pred",
"utils.load_data",
"torch.LongTensor",
"torch.max",
"os.path.join",
"torch.FloatTensor",
"torch.nn.functional.dropout",
"torch.mm",
"os.path.dirname",
"datetime.datetime.now",
"thrift.transport.TTransport.TBufferedTransportFact... | [((3437, 3462), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (3452, 3462), False, 'import os\n'), ((3605, 3633), 'py.predict.Predictor.Processor', 'Predictor.Processor', (['handler'], {}), '(handler)\n', (3624, 3633), False, 'from py.predict import Predictor\n'), ((3650, 3700), 'thrift.tran... |
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'^register/$', views.register, name='register'),
url(r'^login/$', views.user_login, name='login'),
url(r'^logout/$', views.user_logout, name='logout'),
url(r'^groups/$', views.groups, name='groups'),
url(r'^sitemanager/$', v... | [
"django.conf.urls.url"
] | [((75, 126), 'django.conf.urls.url', 'url', (['"""^register/$"""', 'views.register'], {'name': '"""register"""'}), "('^register/$', views.register, name='register')\n", (78, 126), False, 'from django.conf.urls import url\n'), ((133, 180), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'views.user_login'], {'name': ... |
from flask import Flask
from flask import render_template
from flask import Flask, flash, request, redirect, url_for
from werkzeug.utils import secure_filename
import os
import numpy as np
import tensorflow as tf
import PIL
from tensorflow import keras
#backend instantiation
app = Flask(__name__)
app.config['UPLOAD_F... | [
"flask.render_template",
"tensorflow.keras.preprocessing.image.load_img",
"flask.flash",
"flask.Flask",
"os.path.join",
"numpy.argmax",
"numpy.max",
"flask.redirect",
"tensorflow.keras.models.load_model",
"werkzeug.utils.secure_filename",
"tensorflow.nn.softmax",
"tensorflow.expand_dims",
"o... | [((284, 299), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (289, 299), False, 'from flask import Flask, flash, request, redirect, url_for\n'), ((381, 430), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""ai/fingernail_model"""'], {}), "('ai/fingernail_model')\n", (407, 430), Tru... |
import math
import os.path
from dataclasses import dataclass
from itertools import combinations
@dataclass
class Moon:
x: int
y: int
z: int
dx: int = 0
dy: int = 0
dz: int = 0
def _parse_moons(lines):
moons = []
for line in lines:
parts = line.replace('<', '').replace('>', ''... | [
"itertools.combinations",
"math.gcd"
] | [((1448, 1470), 'itertools.combinations', 'combinations', (['moons', '(2)'], {}), '(moons, 2)\n', (1460, 1470), False, 'from itertools import combinations\n'), ((1676, 1690), 'math.gcd', 'math.gcd', (['a', 'b'], {}), '(a, b)\n', (1684, 1690), False, 'import math\n'), ((1728, 1750), 'itertools.combinations', 'combinatio... |
from django.contrib.sitemaps import Sitemap
from django.shortcuts import reverse
class StaticViewSitemap(Sitemap):
changefreq = "weekly"
priority = 0.5
def items(self):
return ['team_app:index']
def location(self, item):
return reverse(item)
| [
"django.shortcuts.reverse"
] | [((266, 279), 'django.shortcuts.reverse', 'reverse', (['item'], {}), '(item)\n', (273, 279), False, 'from django.shortcuts import reverse\n')] |
import asyncio as aio
import argparse as ap
import sys
import os
from pathlib import Path
from typing import Optional
from .cfg import get_cfg
from .event import ConnectionMode, DaemonEvent
def get_args() -> ap.Namespace:
parser = ap.ArgumentParser(description="Send commands to a wcd instance, through a unix s... | [
"asyncio.open_unix_connection",
"argparse.ArgumentParser"
] | [((240, 333), 'argparse.ArgumentParser', 'ap.ArgumentParser', ([], {'description': '"""Send commands to a wcd instance, through a unix socket."""'}), "(description=\n 'Send commands to a wcd instance, through a unix socket.')\n", (257, 333), True, 'import argparse as ap\n'), ((1071, 1108), 'asyncio.open_unix_connect... |
import pygame
from pygame.locals import *
from paddle import Paddle
from ball import Ball
from inputs import handle_events, handle_input
from constants import SCREEN_WIDTH, SCREEN_HEIGHT, WHITE, RED
ball = None
left_paddle = None
right_paddle = None
pygame.init()
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN... | [
"pygame.display.set_caption",
"pygame.quit",
"pygame.init",
"pygame.display.set_mode",
"pygame.display.flip",
"inputs.handle_events",
"ball.Ball",
"inputs.handle_input",
"pygame.time.Clock",
"pygame.font.Font",
"paddle.Paddle"
] | [((252, 265), 'pygame.init', 'pygame.init', ([], {}), '()\n', (263, 265), False, 'import pygame\n'), ((275, 329), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(SCREEN_WIDTH, SCREEN_HEIGHT)'], {}), '((SCREEN_WIDTH, SCREEN_HEIGHT))\n', (298, 329), False, 'import pygame\n'), ((330, 371), 'pygame.display.set_ca... |
import logging
import logging.config
import logging.handlers
import os
import sys
from oslo_config import cfg
import six
from six import moves
import tvrenamer
from tvrenamer import options
from tvrenamer import services
logging.getLogger().addHandler(logging.NullHandler())
DEFAULT_LIBRARY_LOG_LEVEL = {'stevedore':... | [
"logging.NullHandler",
"logging.getLogger",
"tvrenamer.services.load_service_opts",
"logging.StreamHandler",
"tvrenamer.options.register_opts",
"os.getenv",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"oslo_config.cfg.find_config_files",
"os.path.join",
"oslo_config.cfg.CONF.log... | [((255, 276), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (274, 276), False, 'import logging\n'), ((707, 726), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (724, 726), False, 'import logging\n'), ((1505, 1545), 'six.iteritems', 'six.iteritems', (['DEFAULT_LIBRARY_LOG_LEVEL'], {}), '(D... |
# Generated by Django 3.0.3 on 2020-08-04 22:57
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ressources', '0004_auto_20200731_1630'),
]
operations = [
migrations.AlterModelOptions(
name='meetingtime',
options={'orderi... | [
"django.db.migrations.AlterModelOptions"
] | [((230, 315), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""meetingtime"""', 'options': "{'ordering': ('day',)}"}), "(name='meetingtime', options={'ordering': ('day',)}\n )\n", (258, 315), False, 'from django.db import migrations\n')] |
import discord
from Script.clash_info import Bot
from Script.Const_variables.import_const import Login
intents = discord.Intents.default()
intents.members = True
Clash_info = Bot(intents=intents)
main_bot = 1
if main_bot:
Token = Login["discord"]["token"]
Clash_info.default_prefix = "/"
Clash_info.id = 7... | [
"Script.clash_info.Bot",
"discord.Intents.default"
] | [((115, 140), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (138, 140), False, 'import discord\n'), ((177, 197), 'Script.clash_info.Bot', 'Bot', ([], {'intents': 'intents'}), '(intents=intents)\n', (180, 197), False, 'from Script.clash_info import Bot\n')] |
import torch
import torch.nn.functional as F
from utils_shapley import *
class eval_Syn0():
def __init__(self,c=5, **kwargs):
self.c = c
self.j = None
self.i = None
def init_baseline(self,x=np.ones((1,3)), c = 5,j = None, i = None, fixed_present = True, baseline_value =... | [
"sklearn.metrics.accuracy_score",
"torch.mul",
"torch.sigmoid",
"torch.tensor",
"torch.no_grad",
"xgboost.DMatrix",
"torch.zeros",
"torch.ones"
] | [((23458, 23493), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', (['label', 'pred'], {}), '(label, pred)\n', (23480, 23493), False, 'from sklearn import metrics\n'), ((27986, 28021), 'sklearn.metrics.accuracy_score', 'metrics.accuracy_score', (['label', 'pred'], {}), '(label, pred)\n', (28008, 28021), Fals... |
import urllib.request
import random
import time
import os
from bs4 import BeautifulSoup
chars = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3... | [
"os.path.exists",
"random.choice",
"os.makedirs",
"time.sleep",
"bs4.BeautifulSoup"
] | [((941, 975), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (954, 975), False, 'from bs4 import BeautifulSoup\n'), ((2096, 2117), 'os.path.exists', 'os.path.exists', (['"""img"""'], {}), "('img')\n", (2110, 2117), False, 'import os\n'), ((2123, 2141), 'os.makedirs... |
#!/usr/bin/env python
import os
import sys
import ideal
from setuptools import setup, find_packages
def read_file(name):
return open(os.path.join(os.path.dirname(__file__), name)).read()
readme = read_file('README.rst')
changes = read_file('CHANGES.rst')
install_requires = [
'requests>=1.2... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((585, 628), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "('tests', 'tests.*')"}), "(exclude=('tests', 'tests.*'))\n", (598, 628), False, 'from setuptools import setup, find_packages\n'), ((160, 185), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import... |
import random
value_a = int(input("enter the first number"))
value_b = int(input("enter the second number"))
value_c = int(input("enter the third number"))
print(value_b + value_a + value_c)
list_of_numbers = []
for number in range(100):
list_of_numbers.append(random.randint(1,100)) # inclusive of both values
... | [
"random.randint"
] | [((269, 291), 'random.randint', 'random.randint', (['(1)', '(100)'], {}), '(1, 100)\n', (283, 291), False, 'import random\n')] |
import pygame
# https://stackoverflow.com/questions/28005641
# /how-to-add-a-background-image-into-pygame
class Background:
"""Creates background as image_image file"""
def __init__(self, image_file, location=(0, 0)):
self.image = pygame.image.load(image_file)
self.rect = self.image.get_rect()... | [
"pygame.display.set_caption",
"pygame.init",
"pygame.display.set_mode",
"pygame.time.Clock",
"pygame.image.load"
] | [((541, 597), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(display_width, display_height)'], {}), '((display_width, display_height))\n', (564, 597), False, 'import pygame\n'), ((609, 653), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""Twisted Towers"""'], {}), "('Twisted Towers')\n", (6... |
import pytest
import requests
import pandas_datareader.base as base
class TestBaseReader(object):
def test_requests_not_monkey_patched(self):
assert not hasattr(requests.Session(), 'stor')
def test_valid_retry_count(self):
with pytest.raises(ValueError):
base._BaseReader([], retr... | [
"pandas_datareader.base._DailyBaseReader",
"pytest.raises",
"requests.Session",
"pandas_datareader.base._BaseReader"
] | [((256, 281), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (269, 281), False, 'import pytest\n'), ((295, 336), 'pandas_datareader.base._BaseReader', 'base._BaseReader', (['[]'], {'retry_count': '"""stuff"""'}), "([], retry_count='stuff')\n", (311, 336), True, 'import pandas_datareader.base ... |
from django.test import TestCase
from django.contrib.auth.models import Group
from hs_access_control.models import PrivilegeCodes
from hs_core import hydroshare
from hs_core.testing import MockIRODSTestCaseMixin
from hs_access_control.tests.utilities import global_reset, is_equal_to_as_set
class T09GroupPublic(Moc... | [
"django.contrib.auth.models.Group.objects.get_or_create",
"hs_access_control.tests.utilities.is_equal_to_as_set",
"hs_core.hydroshare.create_resource",
"hs_core.hydroshare.create_account",
"hs_access_control.tests.utilities.global_reset"
] | [((426, 440), 'hs_access_control.tests.utilities.global_reset', 'global_reset', ([], {}), '()\n', (438, 440), False, 'from hs_access_control.tests.utilities import global_reset, is_equal_to_as_set\n'), ((465, 518), 'django.contrib.auth.models.Group.objects.get_or_create', 'Group.objects.get_or_create', ([], {'name': '"... |
import sys
import numpy as np
from PIL import Image
def spec_to_png(in_path, out_path):
specgram = np.load(in_path) # (channels, bins, frames)
specgram = specgram[0]
specgram = np.log2(specgram)
specgram = specgram.sum(1)[:, np.newaxis]
specgram = np.repeat(specgram, 128, axis=1)
smax, smin =... | [
"PIL.Image.fromarray",
"numpy.repeat",
"numpy.flipud",
"numpy.max",
"numpy.min",
"numpy.log2",
"numpy.load"
] | [((105, 121), 'numpy.load', 'np.load', (['in_path'], {}), '(in_path)\n', (112, 121), True, 'import numpy as np\n'), ((192, 209), 'numpy.log2', 'np.log2', (['specgram'], {}), '(specgram)\n', (199, 209), True, 'import numpy as np\n'), ((271, 303), 'numpy.repeat', 'np.repeat', (['specgram', '(128)'], {'axis': '(1)'}), '(s... |
import uuid
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.dialects.postgresql import ARRAY
from api import app, db, bcrypt
from api.models.user import User
from api.models.recipe import Recipe
class Rating(db.Model):
__tablename__ = ... | [
"api.db.ForeignKey",
"uuid.uuid4",
"sqlalchemy.dialects.postgresql.UUID",
"api.db.Column",
"api.db.relationship"
] | [((580, 615), 'api.db.Column', 'db.Column', (['db.Float'], {'nullable': '(False)'}), '(db.Float, nullable=False)\n', (589, 615), False, 'from api import app, db, bcrypt\n'), ((628, 673), 'api.db.relationship', 'db.relationship', (['User'], {'backref': '"""user_ratings"""'}), "(User, backref='user_ratings')\n", (643, 67... |
#Cognitive NPL (Natural Language Processing)
#Copyright 2020 <NAME> MIT License. READ LICENSE.
#Personality Profiling with a Restricted Botzmannm Machine (RBM)
import numpy as np
from random import randint
class RBM:
def __init__(self, num_visible, num_hidden):
self.num_hidden = num_hidden
self.nu... | [
"numpy.insert",
"numpy.sqrt",
"numpy.random.rand",
"numpy.exp",
"numpy.array",
"numpy.dot",
"numpy.sum",
"numpy.random.RandomState"
] | [((3056, 3190), 'numpy.array', 'np.array', (['[[1, 1, 0, 0, 1, 1], [1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1, 0, 1, 1,\n 0], [1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 0]]'], {}), '([[1, 1, 0, 0, 1, 1], [1, 1, 0, 1, 1, 0], [1, 1, 1, 0, 0, 1], [1, 1,\n 0, 1, 1, 0], [1, 1, 0, 0, 1, 0], [1, 1, 1, 0, 1, 0]])\n', (3064, ... |
# DRF
from rest_framework import viewsets
# Models
from product.models.product_entry import ProductEntry
# Serializers
from product.serializers.product_entry_serializer import ProductEntrySerializer
class ProductEntryViewSet(viewsets.ModelViewSet):
queryset = ProductEntry.objects.all()
serializer_class = Pr... | [
"product.models.product_entry.ProductEntry.objects.all"
] | [((268, 294), 'product.models.product_entry.ProductEntry.objects.all', 'ProductEntry.objects.all', ([], {}), '()\n', (292, 294), False, 'from product.models.product_entry import ProductEntry\n')] |
from distutils.command.build import build
from floodsystem.utils import sorted_by_key
from floodsystem.stationdata import build_station_list
from floodsystem.plot import plot_water_levels
import datetime
from floodsystem.stationdata import update_water_levels
from floodsystem.datafetcher import fetch_measure_levels
fr... | [
"Task2C.return_name_and_level",
"floodsystem.plot.plot_water_levels",
"floodsystem.stationdata.build_station_list",
"datetime.timedelta",
"floodsystem.stationdata.update_water_levels"
] | [((395, 415), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (413, 415), False, 'from floodsystem.stationdata import build_station_list\n'), ((858, 903), 'floodsystem.plot.plot_water_levels', 'plot_water_levels', (['station_cam', 'dates', 'levels'], {}), '(station_cam, dates, leve... |
# Copyright 2019 BlueCat Networks (USA) Inc. and its affiliates
#
# 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 b... | [
"apscheduler.executors.pool.ThreadPoolExecutor",
"os.path.join",
"config.logger.info",
"apscheduler.executors.pool.ProcessPoolExecutor",
"os.path.dirname",
"apscheduler.schedulers.background.BackgroundScheduler"
] | [((1135, 1156), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {}), '()\n', (1154, 1156), False, 'from apscheduler.schedulers.background import BackgroundScheduler\n'), ((979, 1001), 'apscheduler.executors.pool.ThreadPoolExecutor', 'ThreadPoolExecutor', (['(20)'], {}), '(20)\n', (9... |
import requests
import selectolax.parser as sp
ALPHA_API_KEY = "<KEY>"
NAME_FILTER = {
ord(" "): "_",
ord("."): "",
ord("("): "",
ord(")"): "",
ord("'"): "",
}
class Stock:
def __init__(self, symbol):
self.symbol = symbol.upper()
def profile(self):
prof = dict()
ur... | [
"selectolax.parser.HTMLParser",
"requests.get"
] | [((403, 420), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (415, 420), False, 'import requests\n'), ((2002, 2019), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2014, 2019), False, 'import requests\n'), ((2875, 2892), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (2887, 2892), Fals... |
from uuid import uuid4
from sqlalchemy.orm import validates
from werkzeug.security import check_password_hash, generate_password_hash
from flaskr_carved_rock.login import login_manager
from flaskr_carved_rock.sqla import sqla
from flask_login import UserMixin
class User(UserMixin, sqla.Model):
id = sqla.Column(s... | [
"flaskr_carved_rock.sqla.sqla.String",
"sqlalchemy.orm.validates",
"uuid.uuid4",
"werkzeug.security.generate_password_hash",
"flaskr_carved_rock.sqla.sqla.Column",
"werkzeug.security.check_password_hash"
] | [((307, 350), 'flaskr_carved_rock.sqla.sqla.Column', 'sqla.Column', (['sqla.Integer'], {'primary_key': '(True)'}), '(sqla.Integer, primary_key=True)\n', (318, 350), False, 'from flaskr_carved_rock.sqla import sqla\n'), ((452, 503), 'flaskr_carved_rock.sqla.sqla.Column', 'sqla.Column', (['sqla.Text'], {'nullable': '(Fal... |
#################################################
### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ###
#################################################
# file to edit: ./bilibili.ipynb
from nbexp_personal import sendEmail
def itemgetter(*args):
g = operator.itemgetter(*args)
def f(*args2):
return dict(... | [
"os.path.exists",
"datetime.datetime.fromtimestamp",
"nbexp_uncurl.parse",
"nbexp_personal.sendEmail",
"email.mime.multipart.MIMEMultipart",
"functools.partial",
"json.load",
"operator.itemgetter",
"json.dump",
"email.mime.text.MIMEText"
] | [((254, 280), 'operator.itemgetter', 'operator.itemgetter', (['*args'], {}), '(*args)\n', (273, 280), False, 'import operator\n'), ((954, 989), 'nbexp_uncurl.parse', 'nbexp_uncurl.parse', (['code'], {'timeout': '(5)'}), '(code, timeout=5)\n', (972, 989), False, 'import nbexp_uncurl\n'), ((1114, 1156), 'datetime.datetim... |
from pyspider.libs.base_handler import *
from my import My
import os
from bs4 import BeautifulSoup
'''广州'''
class Handler(My):
name = "GZ"
@every(minutes=24 * 60)
def on_start(self):
self.crawl('http://www.upo.gov.cn/WebApi/SzskgkApi.aspx?do=list&lb=004&area=all&page=1',
fetch_type='j... | [
"bs4.BeautifulSoup"
] | [((2053, 2096), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\n", (2066, 2096), False, 'from bs4 import BeautifulSoup\n'), ((3090, 3133), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parse... |
import numpy as np
from mandlebrot import mandelbrot
def test_mandelbrot_incorrect_test():
x = np.linspace(-1.5, -2.0, 10)
y = np.linspace(-1.25, 1.25, 10)
output = mandelbrot(x, y, 100, False)
assert np.all(output == 0.0) | [
"numpy.all",
"numpy.linspace",
"mandlebrot.mandelbrot"
] | [((100, 127), 'numpy.linspace', 'np.linspace', (['(-1.5)', '(-2.0)', '(10)'], {}), '(-1.5, -2.0, 10)\n', (111, 127), True, 'import numpy as np\n'), ((136, 164), 'numpy.linspace', 'np.linspace', (['(-1.25)', '(1.25)', '(10)'], {}), '(-1.25, 1.25, 10)\n', (147, 164), True, 'import numpy as np\n'), ((178, 206), 'mandlebro... |
from django.conf.urls import patterns, url
from admins import views
urlpatterns = patterns(
'',
# Control panels
url(r'^admin/overview/$', views.overview, name='admin_overview'),
)
| [
"django.conf.urls.url"
] | [((128, 191), 'django.conf.urls.url', 'url', (['"""^admin/overview/$"""', 'views.overview'], {'name': '"""admin_overview"""'}), "('^admin/overview/$', views.overview, name='admin_overview')\n", (131, 191), False, 'from django.conf.urls import patterns, url\n')] |
def download_tle(outdir='./'):
"""Download the NuSTAR TLE archive.
Parameters
----------
outdir: Optional desired output location. Defaults to the working directory.
Returns
----------
Returns the filename that you've downloaded.
Notes
---------
"""... | [
"wget.download",
"os.path.exists",
"pandas.read_csv",
"os.makedirs",
"datetime.datetime.strptime",
"os.path.isfile",
"os.path.dirname",
"os.remove"
] | [((534, 557), 'os.path.dirname', 'os.path.dirname', (['outdir'], {}), '(outdir)\n', (549, 557), False, 'import os\n'), ((867, 890), 'os.path.isfile', 'os.path.isfile', (['outfile'], {}), '(outfile)\n', (881, 890), False, 'import os\n'), ((929, 960), 'wget.download', 'wget.download', (['url'], {'out': 'outfile'}), '(url... |
import os
from pathlib import Path
from minder_utils.util.util import reformat_path
import yaml
p = Path(os.path.join(os.path.dirname(__file__), 'confidential'))
if not p.exists():
os.mkdir(reformat_path(p))
data_path = os.path.join(os.path.dirname(__file__), 'confidential', 'data_path.txt')
token_path = os.path.... | [
"os.path.dirname",
"minder_utils.util.util.reformat_path"
] | [((239, 264), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (254, 264), False, 'import os\n'), ((325, 350), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (340, 350), False, 'import os\n'), ((413, 438), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
import logging
from collections import Counter, namedtuple
from datetime import date
from typing import Optional, Tuple, Set
from core.logic.debug import log_memory
from logs.logic.validation import clean_and_validate_issn, ValidationError, normalize_isbn
from logs.models import ImportBatch
from nigiri.counter5 import... | [
"logging.getLogger",
"logs.logic.validation.normalize_isbn",
"publications.models.Title.data_type_to_pub_type",
"collections.namedtuple",
"publications.models.PlatformTitle.objects.count",
"core.logic.debug.log_memory",
"logs.logic.validation.clean_and_validate_issn",
"collections.Counter",
"publica... | [((520, 547), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (537, 547), False, 'import logging\n'), ((923, 999), 'collections.namedtuple', 'namedtuple', (['"""TitleRec"""', "('name', 'pub_type', 'issn', 'eissn', 'isbn', 'doi')"], {}), "('TitleRec', ('name', 'pub_type', 'issn', 'eissn', '... |
import datetime
import feedparser
import json
import os
import shutil
import sys
import time
from .common import p, FEEDS_FILE_NAME
from .config import TIMEZONE
def do(target_category=None, log=False):
def getFeedFromRSS(category, urls, show_author=False, log=False):
rslt = {}
for source, url i... | [
"datetime.datetime",
"feedparser.parse",
"time.mktime",
"json.dumps",
"os.path.join",
"os.path.abspath",
"os.path.isfile",
"sys.exit",
"json.load",
"datetime.date.today",
"time.time",
"sys.stdout.write"
] | [((1718, 1749), 'os.path.isfile', 'os.path.isfile', (['FEEDS_FILE_NAME'], {}), '(FEEDS_FILE_NAME)\n', (1732, 1749), False, 'import os\n'), ((1922, 1935), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (1931, 1935), False, 'import json\n'), ((447, 468), 'feedparser.parse', 'feedparser.parse', (['url'], {}), '(url)\n'... |
import math
import numpy as np
"""
This function calculates the roots of the quadratic inequality for the Rh reuse factor.
Parameters:
lx - list of input sizes of the lstms. The size of this list is equal to the number of layers.
lh - list of input sizes of the hidden layers. The size of this ... | [
"numpy.dot",
"math.sqrt"
] | [((815, 829), 'numpy.dot', 'np.dot', (['lh', 'lh'], {}), '(lh, lh)\n', (821, 829), True, 'import numpy as np\n'), ((889, 918), 'math.sqrt', 'math.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '(b ** 2 - 4 * a * c)\n', (898, 918), False, 'import math\n'), ((938, 967), 'math.sqrt', 'math.sqrt', (['(b ** 2 - 4 * a * c)'], {}), '... |
try:
from kfp.components import InputPath
from kfp.components import OutputPath
except ImportError:
def InputPath(c):
return c
def OutputPath(c):
return c
metrics = "Metrics"
def test(
prepro_dir: InputPath(str),
prev_model_dir: InputPath(str),
sent_size_th,
ques_si... | [
"basic.main.main",
"json.dump",
"kfp.components.InputPath",
"shutil.copytree",
"kfp.components.OutputPath",
"tensorflow.app.run"
] | [((748, 773), 'shutil.copytree', 'shutil.copytree', (['src', 'dst'], {}), '(src, dst)\n', (763, 773), False, 'import shutil\n'), ((9516, 9532), 'tensorflow.app.run', 'tf.app.run', (['main'], {}), '(main)\n', (9526, 9532), True, 'import tensorflow as tf\n'), ((239, 253), 'kfp.components.InputPath', 'InputPath', (['str']... |
import os
import time
from collections import deque
import functools
import itertools
from typing import Callable, Iterable
import numpy as np
import yaml
import gym
from box import Box
import torch
# torch.multiprocessing.set_start_method("forkserver")
import torch.nn as nn
from torch.utils.data import IterableData... | [
"yaml.load",
"os.path.join",
"a2c_ppo_acktr.utils.get_device"
] | [((750, 768), 'a2c_ppo_acktr.utils.get_device', 'utils.get_device', ([], {}), '()\n', (766, 768), False, 'from a2c_ppo_acktr import algo, utils\n'), ((971, 1034), 'os.path.join', 'os.path.join', (['config.load_dir', "(config.env_name + '-vaxxed_2.pt')"], {}), "(config.load_dir, config.env_name + '-vaxxed_2.pt')\n", (98... |
# Copyright (c) 2017 The Khronos Group 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 ... | [
"math.ceil",
"math.floor"
] | [((1001, 1018), 'math.floor', 'math.floor', (['(t / 2)'], {}), '(t / 2)\n', (1011, 1018), False, 'import math\n'), ((1020, 1036), 'math.ceil', 'math.ceil', (['(t / 2)'], {}), '(t / 2)\n', (1029, 1036), False, 'import math\n')] |
# Import the SST module
import sst
# In Example0, two components send each other a number of events
# The simulation ends when the components have sent and
# received all expected events. While the eventSize is parameterized,
# it has no effect on simulation time because the components don't limit
# their link bandwi... | [
"sst.Link",
"sst.Component"
] | [((559, 611), 'sst.Component', 'sst.Component', (['"""c0"""', '"""simpleElementExample.example0"""'], {}), "('c0', 'simpleElementExample.example0')\n", (572, 611), False, 'import sst\n'), ((625, 677), 'sst.Component', 'sst.Component', (['"""c1"""', '"""simpleElementExample.example0"""'], {}), "('c1', 'simpleElementExam... |
import sphinx
from pkg_resources import parse_version
sphinx_version = sphinx.__version__
if parse_version(sphinx_version) >= parse_version("1.6"):
from sphinx.util import logging
else:
import logging
logging.basicConfig()
class BaseService:
def __init__(self, *args, **kwargs):
self.log = l... | [
"logging.basicConfig",
"pkg_resources.parse_version",
"logging.getLogger"
] | [((94, 123), 'pkg_resources.parse_version', 'parse_version', (['sphinx_version'], {}), '(sphinx_version)\n', (107, 123), False, 'from pkg_resources import parse_version\n'), ((127, 147), 'pkg_resources.parse_version', 'parse_version', (['"""1.6"""'], {}), "('1.6')\n", (140, 147), False, 'from pkg_resources import parse... |
#System libraries
import tkinter as tk
import sys
sys.path.insert(1, '../common')
import socket
from cli import *
#User libraries
# from motorcommands import *
key_to_direction = {
38: "left",
25: "forward",
40: "right",
39: "back",
65: "stop",
}
numbers = {
19 : 0,
10 : 1,
... | [
"sys.path.insert",
"tkinter.Label",
"tkinter.Tk"
] | [((51, 82), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../common"""'], {}), "(1, '../common')\n", (66, 82), False, 'import sys\n'), ((518, 525), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (523, 525), True, 'import tkinter as tk\n'), ((1184, 1226), 'tkinter.Label', 'tk.Label', ([], {'text': '"""GUI"""', 'width': '... |
import numpy as np
import pytest
from tensorflow.keras import losses as losses_module
from tensorflow.keras import metrics as metrics_module
from scikeras.utils import loss_name, metric_name
class CustomLoss(losses_module.Loss):
pass
class CustomMetric(metrics_module.AUC):
pass
@pytest.mark.parametrize(... | [
"tensorflow.keras.metrics.CategoricalCrossentropy",
"scikeras.utils.metric_name",
"pytest.raises",
"scikeras.utils.loss_name",
"tensorflow.keras.losses.CategoricalCrossentropy"
] | [((728, 742), 'scikeras.utils.loss_name', 'loss_name', (['obj'], {}), '(obj)\n', (737, 742), False, 'from scikeras.utils import loss_name, metric_name\n'), ((512, 551), 'tensorflow.keras.losses.CategoricalCrossentropy', 'losses_module.CategoricalCrossentropy', ([], {}), '()\n', (549, 551), True, 'from tensorflow.keras ... |
from spikeextractors import RecordingExtractor
import numpy as np
import h5py
import ctypes
class BiocamRecordingExtractor(RecordingExtractor):
def __init__(self, recording_file):
RecordingExtractor.__init__(self)
self._recording_file = recording_file
self._rf, self._nFrames, self._sampli... | [
"numpy.abs",
"h5py.File",
"numpy.zeros",
"spikeextractors.RecordingExtractor.__init__",
"numpy.arange"
] | [((2663, 2687), 'h5py.File', 'h5py.File', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (2672, 2687), False, 'import h5py\n'), ((195, 228), 'spikeextractors.RecordingExtractor.__init__', 'RecordingExtractor.__init__', (['self'], {}), '(self)\n', (222, 228), False, 'from spikeextractors import RecordingExtractor\n... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2020-08-17 09:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('commercialoperator', '0085_proposaleventotherdetails_other_comments'),
]
operations... | [
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((455, 753), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('half_day_charge', 'Half day charge'), ('full_day_charge',\n 'Full day charge'), ('2_days_charge', '2 days charge'), (\n '3_or_more_days_charge', '3 or more days charge')]", 'default': '"""full_day_charge"""', 'max_length': '(30)'... |
# autor : colson (<NAME>)
# https://www.github.com/YeongJunKim
from aiy.vision.leds import Leds
from time import sleep
from aiy_log import MyLogger
import logging
class MyLed:
def __init__(self, led=(0x00, 0x00, 0x00)):
self.logger = MyLogger(level=logging.INFO, get="LED")
self.leds = Leds()
... | [
"aiy.vision.leds.Leds.rgb_on",
"aiy.vision.leds.Leds",
"time.sleep",
"aiy_log.MyLogger"
] | [((248, 287), 'aiy_log.MyLogger', 'MyLogger', ([], {'level': 'logging.INFO', 'get': '"""LED"""'}), "(level=logging.INFO, get='LED')\n", (256, 287), False, 'from aiy_log import MyLogger\n'), ((308, 314), 'aiy.vision.leds.Leds', 'Leds', ([], {}), '()\n', (312, 314), False, 'from aiy.vision.leds import Leds\n'), ((808, 81... |
# Core
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
# Third party
from rest_framework import serializers
# Local
from .models import TorrentInfoHash
class TorrentInfoHashSerializer(serializers.Serializer):
info_hash = serializers.CharField()
prev_info_hash = seriali... | [
"rest_framework.serializers.CharField"
] | [((268, 291), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (289, 291), False, 'from rest_framework import serializers\n'), ((313, 336), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (334, 336), False, 'from rest_framework import serializers\n')] |
import gym
import argparse
import tensorflow as tf
from tf_rl.common.memory import HER_replay_buffer
from tf_rl.common.utils import eager_setup, her_sampler, create_log_model_directory, get_alg_name, RunningMeanStd
from tf_rl.common.params import ROBOTICS_ENV_LIST
from tf_rl.common.train import train_HER, train_HER_ray... | [
"tf_rl.common.memory.HER_replay_buffer",
"tf_rl.common.train.train_HER",
"argparse.ArgumentParser",
"tensorflow.random.set_random_seed",
"tf_rl.common.utils.her_sampler",
"tf_rl.common.utils.eager_setup",
"tf_rl.agents.HER.HER_DDPG_debug",
"tensorflow.contrib.summary.create_file_writer",
"tf_rl.comm... | [((471, 484), 'tf_rl.common.utils.eager_setup', 'eager_setup', ([], {}), '()\n', (482, 484), False, 'from tf_rl.common.utils import eager_setup, her_sampler, create_log_model_directory, get_alg_name, RunningMeanStd\n'), ((637, 662), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (660, 662), Fal... |
import collections
import pickle
import random
import h5py
import numpy as np
import tqdm
from nas_201_api import NASBench201API
def is_valid_arch(matrix):
n = matrix.shape[0]
visited = {0}
q = collections.deque([0])
while q:
u = q.popleft()
for v in range(u + 1, n):
if v ... | [
"random.choice",
"pickle.dump",
"collections.deque",
"nas_201_api.NASBench201API",
"random.seed",
"numpy.array"
] | [((488, 502), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (499, 502), False, 'import random\n'), ((509, 561), 'nas_201_api.NASBench201API', 'NASBench201API', (['"""/tmp/NAS-Bench-201-v1_1-096897.pth"""'], {}), "('/tmp/NAS-Bench-201-v1_1-096897.pth')\n", (523, 561), False, 'from nas_201_api import NASBench201A... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############
## Imports ##
#############
import os
import sys ; sys.path.append("/home/developer/workspace/rklearn-lib")
import time
import pickle
import numpy as np
from rklearn.tfoo_v1 import BaseDataGenerator
from rktools.monitors import ProgressBar
##############... | [
"os.path.exists",
"numpy.eye",
"os.path.join",
"rktools.monitors.ProgressBar",
"pickle.load",
"os.path.split",
"numpy.array",
"sys.exc_info",
"numpy.concatenate",
"time.time",
"sys.path.append"
] | [((113, 169), 'sys.path.append', 'sys.path.append', (['"""/home/developer/workspace/rklearn-lib"""'], {}), "('/home/developer/workspace/rklearn-lib')\n", (128, 169), False, 'import sys\n'), ((4090, 4101), 'time.time', 'time.time', ([], {}), '()\n', (4099, 4101), False, 'import time\n'), ((5106, 5117), 'time.time', 'tim... |
__author__ = "<NAME>"
__copyright__ = "MIT Licence 2021, <NAME>"
__credits__ = ["<NAME>"]
__license__ = "MIT"
__version__ = "1.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "1.0"
__update__ = "2021-05-11"
import glob
import os
import os.path
dir_path = os.path.dirname(os.path.realpath(__file__))
pri... | [
"os.path.realpath",
"os.path.join",
"os.remove"
] | [((289, 315), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (305, 315), False, 'import os\n'), ((435, 471), 'os.path.join', 'os.path.join', (['dir_path_ttl1', '"""*.ttl"""'], {}), "(dir_path_ttl1, '*.ttl')\n", (447, 471), False, 'import os\n'), ((497, 509), 'os.remove', 'os.remove', (['f']... |
# -*- encoding=UTF-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
import json
from . import projectsettings as fstsettings
import logging
logger = logging.getLogger('fastsettings_logger')
class Settings(mo... | [
"logging.getLogger",
"django.db.models.TextField",
"django.db.models.IntegerField",
"json.dumps",
"django.db.models.BooleanField",
"django.dispatch.receiver",
"django.db.models.CharField"
] | [((260, 300), 'logging.getLogger', 'logging.getLogger', (['"""fastsettings_logger"""'], {}), "('fastsettings_logger')\n", (277, 300), False, 'import logging\n'), ((1934, 1970), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'Settings'}), '(post_save, sender=Settings)\n', (1942, 1970), False, 'from d... |
# coding: utf8
import json
import os
import time
import random
import socket
import hashlib
try:
lib = __import__('pandas')
globals()['pd'] = lib
except ImportError:
pandas_import_error_msg = \
'''
Este script utiliza la libreria de Python Pandas.
Por favor ejecuta:
$ sudo -H pip install pand... | [
"os.path.exists",
"hashlib.md5",
"os.path.join",
"socket.gethostname",
"os.path.basename",
"os.path.abspath",
"random.random",
"time.time"
] | [((580, 605), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (595, 605), False, 'import os\n'), ((2679, 2722), 'os.path.join', 'os.path.join', (['LOCAL', '"""samples"""', 'config_path'], {}), "(LOCAL, 'samples', config_path)\n", (2691, 2722), False, 'import os\n'), ((4287, 4334), 'os.path.joi... |
"""Add anonymous flags
Revision ID: 4ea0403733dc
Revises: 5<PASSWORD>
Create Date: 2016-12-05 14:04:39.239593
"""
# revision identifiers, used by Alembic.
revision = '4ea0403733dc'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('bundle', sa.Column('is_anony... | [
"sqlalchemy.Boolean",
"alembic.op.drop_column"
] | [((469, 512), 'alembic.op.drop_column', 'op.drop_column', (['"""worksheet"""', '"""is_anonymous"""'], {}), "('worksheet', 'is_anonymous')\n", (483, 512), False, 'from alembic import op\n'), ((517, 557), 'alembic.op.drop_column', 'op.drop_column', (['"""bundle"""', '"""is_anonymous"""'], {}), "('bundle', 'is_anonymous')... |
#!/usr/bin/env python3
import dnsmonitor
import json
import os
from base64 import b64decode
import boto3
import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def decrypt_environment(env=os.environ):
kms = boto3.client("kms")
for item in env.copy().keys():
if item.endswith("_ENC")... | [
"logging.getLogger",
"json.loads",
"boto3.client",
"os.environ.get",
"base64.b64decode",
"os.environ.copy",
"dnsmonitor.DNSMonitor",
"dnsmonitor.DNSMonitor_diff",
"logging.error"
] | [((130, 149), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (147, 149), False, 'import logging\n'), ((233, 252), 'boto3.client', 'boto3.client', (['"""kms"""'], {}), "('kms')\n", (245, 252), False, 'import boto3\n'), ((648, 665), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (663, 665), False, '... |
import dash
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_table
import plotly.express as px
import pandas as pd
import requests
from bs4 import BeautifulSoup
import re
from newspaper import Article
import sys
module_path = './que... | [
"dash_html_components.Button",
"dash_core_components.Textarea",
"dash.dependencies.Input",
"newspaper.Article",
"question_answering_inference_utility.question_answering",
"sys.path.append",
"dash_html_components.Div",
"dash.dependencies.Output",
"dash_html_components.Hr",
"dash.dependencies.State"... | [((373, 401), 'sys.path.append', 'sys.path.append', (['module_path'], {}), '(module_path)\n', (388, 401), False, 'import sys\n'), ((5883, 5924), 'dash.dependencies.Output', 'Output', (['"""output-state-submit"""', '"""children"""'], {}), "('output-state-submit', 'children')\n", (5889, 5924), False, 'from dash.dependenc... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
------------------------------------------... | [
"dataflow.uc.adapter.spark_code_operation_adapter.SparkCodeOperationAdapter",
"dataflow.uc.adapter.tensorflow_code_operation_adapter.TensorFlowCodeOperationAdapter",
"dataflow.uc.adapter.spark_structured_streaming_code_operation_adapter.SparkStructuredStreamingCodeOperationAdapter",
"dataflow.uc.exceptions.co... | [((1918, 1964), 'dataflow.uc.adapter.spark_structured_streaming_code_operation_adapter.SparkStructuredStreamingCodeOperationAdapter', 'SparkStructuredStreamingCodeOperationAdapter', ([], {}), '()\n', (1962, 1964), False, 'from dataflow.uc.adapter.spark_structured_streaming_code_operation_adapter import SparkStructuredS... |
import os
import numpy as np
from tqdm.notebook import tqdm
from deepnote import MusicRepr
from deepnote import DEFAULT_UNIT
from joblib import delayed, Parallel
import torch
from torch.utils.data import random_split, Dataset, DataLoader
def get_dataloaders(dataset,
n_jobs=2,
b... | [
"deepnote.MusicRepr.from_file",
"os.listdir",
"torch.utils.data.random_split",
"deepnote.MusicRepr.merge_tracks",
"joblib.Parallel",
"numpy.array",
"torch.tensor",
"torch.utils.data.DataLoader",
"joblib.delayed",
"numpy.pad",
"tqdm.notebook.tqdm"
] | [((453, 486), 'torch.utils.data.random_split', 'random_split', (['dataset', '[n - v, v]'], {}), '(dataset, [n - v, v])\n', (465, 486), False, 'from torch.utils.data import random_split, Dataset, DataLoader\n'), ((506, 623), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'train_dataset', 'batch_size': 'ba... |
from algorithm_toolkit import Algorithm, AlgorithmChain
from sarpy.visualization import remap
class Main(Algorithm):
def run(self):
cl = self.cl # type: AlgorithmChain.ChainLedger
params = self.params # type: dict
# Add your algorithm code here
ro = params['sarpy_reader']
... | [
"sarpy.visualization.remap.nrl",
"sarpy.visualization.remap.log",
"sarpy.visualization.remap.darker",
"sarpy.visualization.remap.pedf",
"sarpy.visualization.remap.brighter",
"sarpy.visualization.remap.highcontrast",
"sarpy.visualization.remap.linear",
"sarpy.visualization.remap.density"
] | [((1002, 1022), 'sarpy.visualization.remap.density', 'remap.density', (['cdata'], {}), '(cdata)\n', (1015, 1022), False, 'from sarpy.visualization import remap\n'), ((1080, 1101), 'sarpy.visualization.remap.brighter', 'remap.brighter', (['cdata'], {}), '(cdata)\n', (1094, 1101), False, 'from sarpy.visualization import ... |
from datetime import datetime, timedelta
from typing import List, Dict, Any
from zoneinfo import ZoneInfo
from tests.test_types_generator import create_account, create_audit
from src.compliance.iam_compliance import IamCompliance
from src.data.account import Account
from src.data.findings import Findings
EXPECTED_OL... | [
"src.data.findings.Findings",
"src.compliance.iam_compliance.IamCompliance",
"zoneinfo.ZoneInfo",
"datetime.timedelta",
"datetime.datetime.now",
"tests.test_types_generator.create_account"
] | [((372, 387), 'zoneinfo.ZoneInfo', 'ZoneInfo', (['"""UTC"""'], {}), "('UTC')\n", (380, 387), False, 'from zoneinfo import ZoneInfo\n'), ((839, 855), 'tests.test_types_generator.create_account', 'create_account', ([], {}), '()\n', (853, 855), False, 'from tests.test_types_generator import create_account, create_audit\n'... |
import os
from natsort import natsorted
path_to_directory = input("Enter path to directory: ") + "/"
new_name = input("Enter new name for files: ")
try:
i = 0
list_of_files = natsorted(os.listdir(path_to_directory))
for file in list_of_files:
i += 1
extension = file.split(".")[1]
o... | [
"os.listdir"
] | [((195, 224), 'os.listdir', 'os.listdir', (['path_to_directory'], {}), '(path_to_directory)\n', (205, 224), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui/rcv_page.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjec... | [
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QRect"
] | [((394, 423), 'PyQt5.QtWidgets.QPushButton', 'QtWidgets.QPushButton', (['Dialog'], {}), '(Dialog)\n', (415, 423), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((568, 592), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['Dialog'], {}), '(Dialog)\n', (584, 592), False, 'from PyQt5 import QtCore, QtGui, QtWidg... |
import datetime
from django.db import models
from django.utils import timezone
# Create your models here.
class Woeids(models.Model):
country = models.CharField(max_length=200, null=True, blank=True)
name = models.CharField(max_length=200, null=True, blank=True)
woeid = models.IntegerField(default=0, nul... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((151, 206), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'null': '(True)', 'blank': '(True)'}), '(max_length=200, null=True, blank=True)\n', (167, 206), False, 'from django.db import models\n'), ((218, 273), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)... |
# Copyright INRIM (https://www.inrim.eu)
# See LICENSE file for full licensing details.
import copy
from copy import deepcopy
from formiodata.builder import Builder
from formiodata.form import Form
import collections
from . import custom_components
import logging
import uuid
logger = logging.getLogger(__name__)
cla... | [
"logging.getLogger",
"collections.OrderedDict",
"uuid.uuid4",
"copy.deepcopy"
] | [((287, 314), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (304, 314), False, 'import logging\n'), ((1063, 1154), 'collections.OrderedDict', 'collections.OrderedDict', (["{'list_order': 'O', 'check': 'Chk', 'owner_name': 'Operatore'}"], {}), "({'list_order': 'O', 'check': 'Chk', 'owner_... |
from multiprocessing import Pool
def _calc_epa_func(thermostat):
""" Takes an individual thermostat and runs the
calculate_epa_field_savings_metrics method. This method is necessary for
the multiprocessing pool as map / imap need a function to run on.
Parameters
----------
thermostat : thermo... | [
"multiprocessing.Pool"
] | [((1116, 1122), 'multiprocessing.Pool', 'Pool', ([], {}), '()\n', (1120, 1122), False, 'from multiprocessing import Pool\n')] |
import mirtop.libs.logger as mylog
logger = mylog.getLogger(__name__)
def create(reads, database, sample, fn, header):
"""Read https://github.com/miRTop/mirtop/issues/9"""
seen = set()
lines = []
seen_ann = {}
# print >>out_handle, "seq\tname\tfreq\tchrom\tstart\tend\tmism\tadd\tt5\tt3\ts5\ts3\tDB\... | [
"mirtop.libs.logger.getLogger"
] | [((44, 69), 'mirtop.libs.logger.getLogger', 'mylog.getLogger', (['__name__'], {}), '(__name__)\n', (59, 69), True, 'import mirtop.libs.logger as mylog\n')] |
# Generated by Django 3.0.4 on 2020-03-18 15:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('imdb', '0003_remove_cast_is_debut_movie'),
]
operations = [
migrations.AlterField(
model_name='... | [
"django.db.models.ForeignKey"
] | [((375, 472), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""imdb.Director"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='imdb.Director')\n", (392, 472), False, 'from django.db import migrations, models\n... |
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
import dash_daq as daq
import datetime as dt
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble imp... | [
"dash_bootstrap_components.Row",
"dash_core_components.RadioItems",
"datetime.datetime.strptime",
"dash_daq.NumericInput",
"dash.dependencies.Output",
"dash.dependencies.Input",
"dash_core_components.Dropdown",
"dash_core_components.Markdown",
"datetime.date",
"joblib.load",
"dash_html_component... | [((403, 436), 'joblib.load', 'load', (['"""models/price_model.joblib"""'], {}), "('models/price_model.joblib')\n", (407, 436), False, 'from joblib import load\n'), ((453, 493), 'joblib.load', 'load', (['"""models/cancellation_model.joblib"""'], {}), "('models/cancellation_model.joblib')\n", (457, 493), False, 'from job... |
from django.core.management.base import BaseCommand
from wagtail.core.models import Page
from events.models import EventIndexPage, Event
from home.models import HomePage
from pathlib import Path
import json
import os
import sys
json_directory_path = Path("legacy_site_data/old_site_data_events.json")
with open(json_d... | [
"home.models.HomePage.objects.all",
"events.models.EventIndexPage",
"pathlib.Path",
"sys.exc_info",
"json.load"
] | [((252, 302), 'pathlib.Path', 'Path', (['"""legacy_site_data/old_site_data_events.json"""'], {}), "('legacy_site_data/old_site_data_events.json')\n", (256, 302), False, 'from pathlib import Path\n'), ((358, 370), 'json.load', 'json.load', (['f'], {}), '(f)\n', (367, 370), False, 'import json\n'), ((1036, 1123), 'events... |
import json
import urllib.request
import pprint
import webbrowser
URL = "https://mars.jpl.nasa.gov/msl-raw-images/image/images_sol2320.json"
jsonFILE = json.loads(urllib.request.urlopen(URL).read())
#pprint.pprint(jsonFILE)
camera = jsonFILE['images'][0]['cameraModelType']
sol = jsonFILE['images'][0]['sol']
link = j... | [
"webbrowser.open"
] | [((409, 430), 'webbrowser.open', 'webbrowser.open', (['link'], {}), '(link)\n', (424, 430), False, 'import webbrowser\n')] |