code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
from envparse import env
from telegram import Message, ReplyKeyboardMarkup, ReplyKeyboardRemove, Update
from telegram.ext import CommandHandler, MessageHandler, Updater
from telegram.ext.filters import BaseFilter, Filters
from . import celery as tasks
from .helpers import get_file, get_subject, reply
f... | [
"logging.basicConfig",
"envparse.env.read_envfile",
"telegram.ReplyKeyboardRemove",
"envparse.env",
"telegram.ReplyKeyboardMarkup",
"telegram.ext.CommandHandler",
"telegram.ext.filters.Filters.regex"
] | [((379, 397), 'envparse.env.read_envfile', 'env.read_envfile', ([], {}), '()\n', (395, 397), False, 'from envparse import env\n'), ((398, 506), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""'}), "(level=logging.DEBUG, f... |
from trex.emu.api import *
import argparse
import get_args
class Prof1():
def __init__(self):
self.mac = Mac('00:00:00:70:00:01')
self.def_ns_plugs = {'ipv6' : {'dmac':self.mac.V()}}
self.def_c_plugs = None
def create_profile(self, ns_size, clients_size):
ns_list = []
... | [
"get_args.get_args"
] | [((1341, 1369), 'get_args.get_args', 'get_args.get_args', (['tuneables'], {}), '(tuneables)\n', (1358, 1369), False, 'import get_args\n')] |
import numpy as np
from .wavelength import wave_log10
def center2edge(x):
x = np.asarray(x)
dx = np.diff(x)
return np.hstack((x[0] - .5 * dx[0], x[:-1] + .5 * dx, x[-1] + .5 * dx[-1]))
def rebin(wave, flux=None, flux_err=None, mask=None, wave_new=None):
""" Rebin spectrum to a new wavelength grid
... | [
"numpy.zeros_like",
"numpy.ones_like",
"numpy.sum",
"numpy.asarray",
"numpy.floor",
"numpy.ones",
"numpy.isnan",
"numpy.hstack",
"numpy.any",
"numpy.diff",
"numpy.array",
"numpy.arange",
"numpy.sqrt"
] | [((85, 98), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (95, 98), True, 'import numpy as np\n'), ((108, 118), 'numpy.diff', 'np.diff', (['x'], {}), '(x)\n', (115, 118), True, 'import numpy as np\n'), ((130, 202), 'numpy.hstack', 'np.hstack', (['(x[0] - 0.5 * dx[0], x[:-1] + 0.5 * dx, x[-1] + 0.5 * dx[-1])'], {... |
from typing import TYPE_CHECKING, List
if TYPE_CHECKING:
from Platforms.Discord.main_discord import PhaazebotDiscord
from Platforms.Web.main_web import PhaazebotWeb
import json
import discord
from aiohttp.web import Response
from Utils.Classes.discordregulardisabledchannel import DiscordRegularDisabledChannel
from U... | [
"Utils.Classes.webrequestcontent.WebRequestContent",
"Platforms.Web.Processing.Api.errors.apiMissingData",
"Platforms.Web.Processing.Api.errors.apiMissingAuthorisation",
"Platforms.Web.utils.authDiscordWebUser",
"Platforms.Discord.db.getDiscordServerRegularDisabledChannels"
] | [((977, 1006), 'Utils.Classes.webrequestcontent.WebRequestContent', 'WebRequestContent', (['WebRequest'], {}), '(WebRequest)\n', (994, 1006), False, 'from Utils.Classes.webrequestcontent import WebRequestContent\n'), ((1698, 1733), 'Platforms.Web.utils.authDiscordWebUser', 'authDiscordWebUser', (['cls', 'WebRequest'], ... |
# Copyright Contributors to the Pyro-Cov project.
# SPDX-License-Identifier: Apache-2.0
import logging
from collections import defaultdict, namedtuple
import numpy as np
import torch
logger = logging.getLogger(__name__)
_SubClade = namedtuple("_SubClade", ("clade", "name"))
class Phylogeny:
"""
Tensor dat... | [
"torch.ones_like",
"torch.eye",
"torch.zeros_like",
"torch.empty",
"torch.randn",
"logging.getLogger",
"collections.defaultdict",
"collections.namedtuple",
"torch.arange",
"torch.rand",
"torch.zeros",
"torch.min",
"torch.tensor"
] | [((195, 222), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (212, 222), False, 'import logging\n'), ((236, 278), 'collections.namedtuple', 'namedtuple', (['"""_SubClade"""', "('clade', 'name')"], {}), "('_SubClade', ('clade', 'name'))\n", (246, 278), False, 'from collections import defau... |
#!/usr/bin/env python
#
# Copyright 2020 Google LLC
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
skslc = sys.argv[1]
lang = sys.argv[2]
settings = sys.argv[3]
inputs = sys.argv[4:]
def makeEmptyFile(path):
try:
... | [
"os.mkdir",
"os.path.isdir",
"subprocess.check_output",
"os.path.splitext",
"os.path.split",
"os.path.join",
"sys.exit"
] | [((889, 957), 'sys.exit', 'sys.exit', (["('### Expected --settings or --nosettings, got ' + settings)"], {}), "('### Expected --settings or --nosettings, got ' + settings)\n", (897, 957), False, 'import sys\n'), ((997, 1020), 'os.path.splitext', 'os.path.splitext', (['input'], {}), '(input)\n', (1013, 1020), False, 'im... |
import os
import pyautogui as him2
import pyttsx3
import pywhatkit as him
import speech_recognition as him1
import wikipedia
import webbrowser
import smtplib
import datetime
import folium
import cv2
import pytube
from pytube import YouTube
import numpy as np
engine = pyttsx3.init('sapi5')
voi... | [
"webbrowser.open",
"os.path.join",
"smtplib.SMTP",
"pyttsx3.init",
"speech_recognition.Microphone",
"pywhatkit.sendwhatmsg",
"wikipedia.summary",
"folium.Map",
"datetime.datetime.now",
"os.listdir",
"speech_recognition.Recognizer"
] | [((294, 315), 'pyttsx3.init', 'pyttsx3.init', (['"""sapi5"""'], {}), "('sapi5')\n", (306, 315), False, 'import pyttsx3\n'), ((942, 959), 'speech_recognition.Recognizer', 'him1.Recognizer', ([], {}), '()\n', (957, 959), True, 'import speech_recognition as him1\n'), ((1664, 1699), 'smtplib.SMTP', 'smtplib.SMTP', (['"""sm... |
from datetime import datetime
from decimal import Decimal
from dateutil import tz
from yarl import URL
from gateway.schema.customfeedinfo import CustomFeedInfo
from gateway.schema.dynamodb_feedinfo_schema import DynamoDbFeedInfoSchema
from gateway.schema.dynamodb_site_schema import DynamoDbSiteSchema
from gateway.sch... | [
"datetime.datetime",
"gateway.schema.dynamodb_feedinfo_schema.DynamoDbFeedInfoSchema",
"gateway.schema.dynamodb_site_schema.DynamoDbSiteSchema",
"dateutil.tz.tzutc",
"gateway.schema.dynamodb_sitepath_schema.DynamoDbSitePathSchema",
"yarl.URL"
] | [((1714, 1738), 'gateway.schema.dynamodb_feedinfo_schema.DynamoDbFeedInfoSchema', 'DynamoDbFeedInfoSchema', ([], {}), '()\n', (1736, 1738), False, 'from gateway.schema.dynamodb_feedinfo_schema import DynamoDbFeedInfoSchema\n'), ((2297, 2321), 'gateway.schema.dynamodb_feedinfo_schema.DynamoDbFeedInfoSchema', 'DynamoDbFe... |
import re
import typing as T
from collections import Counter
from contextlib import contextmanager
from itertools import cycle
from pathlib import Path
from tempfile import TemporaryDirectory
from threading import Lock, Thread
from unittest import mock
import pytest
import yaml
from sqlalchemy import MetaData, create_... | [
"cumulusci.tasks.bulkdata.snowfakery.SnowfakeryWorkingDirectory",
"pathlib.Path",
"yaml.safe_load",
"pytest.mark.skip",
"unittest.mock.patch.object",
"tempfile.TemporaryDirectory",
"cumulusci.tasks.bulkdata.snowfakery.RunningTotals",
"threading.Lock",
"pytest.raises",
"collections.Counter",
"pyt... | [((6883, 6899), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (6897, 6899), False, 'import pytest\n'), ((9069, 9085), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (9083, 9085), False, 'import pytest\n'), ((2707, 2713), 'threading.Lock', 'Lock', ([], {}), '()\n', (2711, 2713), False, 'from threading imp... |
# #Modular python server/client framework for Night Owl##
# #IMPORTS
import json
import server
# #Classes
json_job_template={
"job": {
"id": {},
"created": {},
"completedby": {},
"all_done": {}
},
"module": {
"steno": {
"bpf": {}
},
"pulledpork": {
"newrules": {}
}
... | [
"json.load"
] | [((1020, 1035), 'json.load', 'json.load', (['file'], {}), '(file)\n', (1029, 1035), False, 'import json\n')] |
import sys
import argparse
from xitorch.debug.modes import enable_debug
def parse_args():
# parse the argument
parser = argparse.ArgumentParser("Run python script by enabling xitorch debug mode")
parser.add_argument("scriptfile", type=str, help="Path to the script to run")
parser.add_argument("args", t... | [
"argparse.ArgumentParser",
"xitorch.debug.modes.enable_debug"
] | [((129, 204), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Run python script by enabling xitorch debug mode"""'], {}), "('Run python script by enabling xitorch debug mode')\n", (152, 204), False, 'import argparse\n'), ((706, 720), 'xitorch.debug.modes.enable_debug', 'enable_debug', ([], {}), '()\n', (718... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='prettytable-extras',
version='0.1.0',
packages=find_packages(),
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'License :: OSI Appro... | [
"setuptools.find_packages"
] | [((165, 180), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (178, 180), False, 'from setuptools import setup, find_packages\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"azure.cli.command_modules.backup.custom_common.show_recovery_point",
"azure.mgmt.recoveryservicesbackup.models.AzureWorkloadSAPHanaPointInTimeRestoreRequest",
"azure.mgmt.recoveryservicesbackup.models.ProtectionIntentResource",
"azure.cli.command_modules.backup._client_factory.protectable_containers_cf",
"... | [((1598, 1618), 'knack.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (1608, 1618), False, 'from knack.log import get_logger\n'), ((3060, 3172), 'azure.cli.command_modules.backup.custom_help.get_filter_string', 'cust_help.get_filter_string', (["{'backupManagementType': backup_management_type, 'workl... |
"""
tests.helpers.test_init
~~~~~~~~~~~~~~~~~~~~~~~
Tests component helpers.
"""
# pylint: disable=protected-access,too-many-public-methods
import unittest
from homeassistant import helpers
from tests.common import get_test_home_assistant
class TestHelpers(unittest.TestCase):
""" Tests homeassistant.helpers mo... | [
"homeassistant.helpers.extract_domain_configs",
"tests.common.get_test_home_assistant"
] | [((441, 466), 'tests.common.get_test_home_assistant', 'get_test_home_assistant', ([], {}), '()\n', (464, 466), False, 'from tests.common import get_test_home_assistant\n'), ((904, 950), 'homeassistant.helpers.extract_domain_configs', 'helpers.extract_domain_configs', (['config', '"""zone"""'], {}), "(config, 'zone')\n"... |
"""Single slice vgg with normalised scale.
"""
import functools
import lasagne as nn
import numpy as np
import theano
import theano.tensor as T
import data_loader
import deep_learning_layers
import image_transform
import layers
import preprocess
import postprocess
import objectives
import theano_print... | [
"functools.partial",
"objectives.KaggleObjective",
"lasagne.layers.ConcatLayer",
"lasagne.layers.InputLayer",
"lasagne.regularization.regularize_layer_params_weighted",
"layers.MuSigmaErfLayer",
"layers.IncreaseCertaintyLayer",
"lasagne.layers.ReshapeLayer",
"lasagne.init.Constant",
"layers.Weight... | [((1971, 2021), 'functools.partial', 'functools.partial', (['preprocess_train'], {'augment': '(False)'}), '(preprocess_train, augment=False)\n', (1988, 2021), False, 'import functools\n'), ((2365, 2439), 'functools.partial', 'functools.partial', (['data_loader.generate_validation_batch'], {'set': '"""validation"""'}), ... |
import torch
import torch.nn as nn
import pdb
class ActionClassification(nn.Module):
def __init__(self, feature_size, num_classes, opts):
super(ActionClassification, self).__init__()
self.opts = opts
self.attention_flow_stream = StreamModule(feature_size, num_classes)
self.attention_rgb_stream = Str... | [
"torch.nn.functional.binary_cross_entropy",
"torch.nn.ReLU",
"torch.stack",
"torch.cat",
"torch.nn.MultiLabelSoftMarginLoss",
"torch.abs",
"torch.nn.Linear",
"torch.sum",
"torch.nn.Sigmoid"
] | [((753, 782), 'torch.nn.MultiLabelSoftMarginLoss', 'nn.MultiLabelSoftMarginLoss', ([], {}), '()\n', (780, 782), True, 'import torch.nn as nn\n'), ((4098, 4124), 'torch.sum', 'torch.sum', (['new_features', '(1)'], {}), '(new_features, 1)\n', (4107, 4124), False, 'import torch\n'), ((4434, 4462), 'torch.nn.Linear', 'nn.L... |
import tensorflow as tf
class TtestSelectionTest(tf.test.TestCase):
def testTtestCorrectScore(self):
raise NotImplementedError
if __name__ == '__main__':
tf.test.main()
| [
"tensorflow.test.main"
] | [((175, 189), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (187, 189), True, 'import tensorflow as tf\n')] |
import math
import numpy as np
import openmdao.api as om
from wisdem.commonse.akima import Akima
from wisdem.commonse.csystem import DirectionVector
from wisdem.commonse.utilities import cosd, sind # , linspace_with_deriv, interp_with_deriv, hstack, vstack
from wisdem.commonse.environment import LogWind, PowerWind, L... | [
"numpy.abs",
"wisdem.commonse.environment.PowerWind",
"numpy.arange",
"numpy.interp",
"openmdao.api.Group",
"numpy.zeros_like",
"math.log",
"numpy.log10",
"openmdao.api.Problem",
"matplotlib.pyplot.show",
"numpy.ones_like",
"wisdem.commonse.environment.LinearWaves",
"wisdem.commonse.csystem.... | [((986, 1001), 'numpy.log10', 'np.log10', (['Re_pt'], {}), '(Re_pt)\n', (994, 1001), True, 'import numpy as np\n'), ((1375, 1392), 'numpy.zeros_like', 'np.zeros_like', (['Re'], {}), '(Re)\n', (1388, 1392), True, 'import numpy as np\n'), ((1407, 1424), 'numpy.zeros_like', 'np.zeros_like', (['Re'], {}), '(Re)\n', (1420, ... |
import re
import collections
import string
# copy from https://github.com/wenhuchen/HybridQA/blob/master/evaluate_script.py
def normalize_answer(s):
"""Lower text and remove punctuation, articles and extra whitespace."""
def remove_articles(text):
regex = re.compile(r"\b(a|an|the)\b", re.... | [
"collections.Counter",
"re.sub",
"re.compile"
] | [((287, 329), 're.compile', 're.compile', (['"""\\\\b(a|an|the)\\\\b"""', 're.UNICODE'], {}), "('\\\\b(a|an|the)\\\\b', re.UNICODE)\n", (297, 329), False, 'import re\n'), ((345, 369), 're.sub', 're.sub', (['regex', '""" """', 'text'], {}), "(regex, ' ', text)\n", (351, 369), False, 'import re\n'), ((1034, 1064), 'colle... |
import os
def write_mol_file(material, simulation_path):
"""Writes .mol file for structural information."""
s = material.structure
file_name = os.path.join(simulation_path, "{}.mol".format(material.uuid))
with open(file_name, "w") as mol_file:
mol_file.write(
" Molecule_name: ... | [
"os.path.join"
] | [((1993, 2054), 'os.path.join', 'os.path.join', (['simulation_path', '"""force_field_mixing_rules.def"""'], {}), "(simulation_path, 'force_field_mixing_rules.def')\n", (2005, 2054), False, 'import os\n'), ((3539, 3588), 'os.path.join', 'os.path.join', (['simulation_path', '"""pseudo_atoms.def"""'], {}), "(simulation_pa... |
#!/usr/bin/env python
"""
A module for embedding videos into the VGG-16 feature space.
Info:
type: eta.core.types.Module
version: 0.1.0
Copyright 2017-2021, Voxel51, Inc.
voxel51.com
"""
# pragma pylint: disable=redefined-builtin
# pragma pylint: disable=unused-wildcard-import
# pragma pylint: disable=wildcar... | [
"eta.core.features.CachingVideoFeaturizerConfig.builder",
"eta.core.module.setup",
"eta.core.utils.get_class_name",
"eta.core.features.ImageFeaturizerConfig.builder",
"logging.getLogger"
] | [((829, 856), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (846, 856), False, 'import logging\n'), ((4290, 4351), 'eta.core.module.setup', 'etam.setup', (['config'], {'pipeline_config_path': 'pipeline_config_path'}), '(config, pipeline_config_path=pipeline_config_path)\n', (4300, 4351),... |
import sys
import numpy as np
import os
import random
import time
import pygame
import math
from constants import *
from chromosome import Chromosome
from bird import Bird
from selection import *
from pillar import Pillar
from pygame.locals import *
# ata = np.zeros((580,600,2))
# y: [-280,300]
# x: [600,0]
"""Agent... | [
"numpy.load",
"numpy.zeros"
] | [((606, 629), 'numpy.zeros', 'np.zeros', (['(2, 118, 600)'], {}), '((2, 118, 600))\n', (614, 629), True, 'import numpy as np\n'), ((707, 727), 'numpy.zeros', 'np.zeros', (['(580, 600)'], {}), '((580, 600))\n', (715, 727), True, 'import numpy as np\n'), ((1619, 1659), 'numpy.load', 'np.load', (["('flappyQData//' + name ... |
import fastai
from fastai import URLs
from fastai.datasets import untar_data
from fastai.tabular.data import TabularList
from fastai_ext.model import tabular_learner, dae_learner
from fastai.tabular.transform import FillMissing, Normalize, Categorify
from sklearn.model_selection import KFold
import pandas as pd
import ... | [
"fastai_ext.hyperparameter.record_experiment",
"fastai.datasets.untar_data",
"fastai_ext.plot_utils.plot_over_epochs",
"pandas.read_csv",
"fastai_ext.model.dae_learner",
"fastai_ext.hyperparameter.get_config_df",
"fastai.tabular.data.TabularList.from_df",
"sklearn.model_selection.KFold",
"fastai_ext... | [((817, 846), 'fastai.datasets.untar_data', 'untar_data', (['URLs.ADULT_SAMPLE'], {}), '(URLs.ADULT_SAMPLE)\n', (827, 846), False, 'from fastai.datasets import untar_data\n'), ((852, 883), 'pandas.read_csv', 'pd.read_csv', (["(path / 'adult.csv')"], {}), "(path / 'adult.csv')\n", (863, 883), True, 'import pandas as pd\... |
# LIBTBX_PRE_DISPATCHER_INCLUDE_SH export PHENIX_GUI_ENVIRONMENT=1
import json
import math
import os
import sys
import matplotlib
import iotbx.phil
from cctbx import crystal, miller
from cctbx.array_family import flex
from scitbx import matrix
import dials.util
help_message = """
Calculates a stereographic projec... | [
"scitbx.math.gcd_int_simple",
"matplotlib.cm.get_cmap",
"cctbx.array_family.flex.miller_index",
"json.dumps",
"math.copysign",
"scitbx.matrix.identity",
"matplotlib.pyplot.figure",
"matplotlib.pylab.gca",
"cctbx.array_family.flex.double",
"cctbx.array_family.flex.min",
"cctbx.array_family.flex.p... | [((3436, 3454), 'cctbx.array_family.flex.vec2_double', 'flex.vec2_double', ([], {}), '()\n', (3452, 3454), False, 'from cctbx.array_family import flex\n'), ((4661, 4771), 'dials.util.options.OptionParser', 'OptionParser', ([], {'usage': 'usage', 'phil': 'phil_scope', 'read_experiments': '(True)', 'check_format': '(Fals... |
import re
import sys
COUNT_RE = re.compile(r'^Total number of states checked is ([0-9]+)\.')
START_RE = re.compile(r'^== ([0-9]+) ==$')
END_RE = re.compile(r'^\[\[== End ([0-9]+) ==\]\]$')
class DealResult(object):
"""a deal result"""
IMP = 0
SOLVED = 1
INTRACT = 2
def __init__(self, idx, lines... | [
"re.compile"
] | [((33, 93), 're.compile', 're.compile', (['"""^Total number of states checked is ([0-9]+)\\\\."""'], {}), "('^Total number of states checked is ([0-9]+)\\\\.')\n", (43, 93), False, 'import re\n'), ((105, 135), 're.compile', 're.compile', (['"""^== ([0-9]+) ==$"""'], {}), "('^== ([0-9]+) ==$')\n", (115, 135), False, 'im... |
#!/pxrpythonsubst
#
# Copyright 2018 Pixar
#
# Licensed under the Apache License, Version 2.0 (the "Apache License")
# with the following modification; you may not use this file except in
# compliance with the Apache License and the following modification to it:
# Section 6. Trademarks. is deleted and replaced with:
#
... | [
"pxr.Usdviewq.qt.QtWidgets.QApplication.processEvents"
] | [((1941, 1979), 'pxr.Usdviewq.qt.QtWidgets.QApplication.processEvents', 'QtWidgets.QApplication.processEvents', ([], {}), '()\n', (1977, 1979), False, 'from pxr.Usdviewq.qt import QtWidgets\n')] |
import unittest
from nose.tools import (
raises,
assert_equal,
assert_true,
assert_false,
assert_count_equal,
)
from parliament import UnknownPrefixException, UnknownActionException
from parliament.statement import expand_action
class TestActionExpansion(unittest.TestCase):
"""Test class for ... | [
"parliament.statement.expand_action",
"nose.tools.assert_count_equal"
] | [((421, 457), 'parliament.statement.expand_action', 'expand_action', (['"""s3:listallmybuckets"""'], {}), "('s3:listallmybuckets')\n", (434, 457), False, 'from parliament.statement import expand_action\n'), ((466, 557), 'nose.tools.assert_count_equal', 'assert_count_equal', (['expanded_actions', "[{'service': 's3', 'ac... |
"""
Check the coverage of tests for Stan functions. If determines which functions
are covered from
- names of the test-*.R
- functions listed in tets.yaml: since some models test multiple functions, especially the ones that test the extractor functions.
"""
import sys
import os
from os import path
import re
import f... | [
"re.match",
"fnmatch.fnmatch",
"os.path.join",
"os.listdir"
] | [((464, 483), 'os.listdir', 'os.listdir', (['testdir'], {}), '(testdir)\n', (474, 483), False, 'import os\n'), ((496, 530), 'fnmatch.fnmatch', 'fnmatch.fnmatch', (['fname', '"""test-*.R"""'], {}), "(fname, 'test-*.R')\n", (511, 530), False, 'import fnmatch\n'), ((554, 579), 'os.path.join', 'path.join', (['testdir', 'fn... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from lib.models.tools.module_helper import ModuleHelper
from lib.utils.tools.logger import Logger as Log
class ProjectionHead(nn.Module):
def __init__(self, dim_in, proj_dim=256, proj='convmlp', bn_type='torchsyncbn'):
super(ProjectionHead... | [
"torch.nn.Conv2d",
"lib.models.tools.module_helper.ModuleHelper.BNReLU"
] | [((444, 486), 'torch.nn.Conv2d', 'nn.Conv2d', (['dim_in', 'proj_dim'], {'kernel_size': '(1)'}), '(dim_in, proj_dim, kernel_size=1)\n', (453, 486), True, 'import torch.nn as nn\n'), ((574, 614), 'torch.nn.Conv2d', 'nn.Conv2d', (['dim_in', 'dim_in'], {'kernel_size': '(1)'}), '(dim_in, dim_in, kernel_size=1)\n', (583, 614... |
from PyQt5 import QtWidgets
from appGUI.preferences.cncjob.CNCJobAdvOptPrefGroupUI import CNCJobAdvOptPrefGroupUI
from appGUI.preferences.cncjob.CNCJobOptPrefGroupUI import CNCJobOptPrefGroupUI
from appGUI.preferences.cncjob.CNCJobGenPrefGroupUI import CNCJobGenPrefGroupUI
from appGUI.preferences.cncjob.CNCJobEditorPr... | [
"appGUI.preferences.cncjob.CNCJobOptPrefGroupUI.CNCJobOptPrefGroupUI",
"PyQt5.QtWidgets.QHBoxLayout",
"appGUI.preferences.cncjob.CNCJobEditorPrefGroupUI.CNCJobEditorPrefGroupUI",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QWidget.__init__",
"appGUI.preferences.cncjob.CNCJobGenPrefGroupUI.CNCJobGenPre... | [((465, 512), 'PyQt5.QtWidgets.QWidget.__init__', 'QtWidgets.QWidget.__init__', (['self'], {'parent': 'parent'}), '(self, parent=parent)\n', (491, 512), False, 'from PyQt5 import QtWidgets\n'), ((535, 558), 'PyQt5.QtWidgets.QHBoxLayout', 'QtWidgets.QHBoxLayout', ([], {}), '()\n', (556, 558), False, 'from PyQt5 import Q... |
from typing import List
import torch
from beamforming.mvdr import PSD, MVDR
from parameterized import parameterized, param
from torch.autograd import gradcheck, gradgradcheck
from torchaudio_unittest.common_utils import (
TestBaseMixin,
get_whitenoise,
get_spectrogram,
skipIfRocm,
)
class AutogradTe... | [
"torch.autograd.gradcheck",
"torchaudio_unittest.common_utils.get_whitenoise",
"beamforming.mvdr.MVDR",
"parameterized.param",
"parameterized.parameterized.expand",
"beamforming.mvdr.PSD",
"torch.autograd.gradgradcheck",
"torchaudio_unittest.common_utils.get_spectrogram",
"torch.rand",
"torch.is_t... | [((1434, 1473), 'parameterized.parameterized.expand', 'parameterized.expand', (['[[True], [False]]'], {}), '([[True], [False]])\n', (1454, 1473), False, 'from parameterized import parameterized, param\n'), ((1084, 1113), 'torch.autograd.gradcheck', 'gradcheck', (['transform', 'inputs_'], {}), '(transform, inputs_)\n', ... |
import numpy as np
from deepspeaker.audio_ds import read_mfcc
from deepspeaker.batcher import sample_from_mfcc
from deepspeaker.constants import SAMPLE_RATE, NUM_FRAMES, WIN_LENGTH
from deepspeaker.conv_models import DeepSpeakerModel
import tensorflow as tf
def build_model(ckpt_path):
model = DeepSpeakerModel()
... | [
"deepspeaker.audio_ds.read_mfcc",
"tensorflow.config.experimental.set_visible_devices",
"tensorflow.device",
"numpy.expand_dims",
"deepspeaker.conv_models.DeepSpeakerModel",
"tensorflow.config.experimental.list_physical_devices"
] | [((299, 317), 'deepspeaker.conv_models.DeepSpeakerModel', 'DeepSpeakerModel', ([], {}), '()\n', (315, 317), False, 'from deepspeaker.conv_models import DeepSpeakerModel\n'), ((501, 533), 'deepspeaker.audio_ds.read_mfcc', 'read_mfcc', (['audio', 'sr', 'win_length'], {}), '(audio, sr, win_length)\n', (510, 533), False, '... |
import numpy as np
import scipy.stats as st
import cv2
import time
import os
import glob
def gauss_kernel(size=21, sigma=3, inchannels=3, outchannels=3):
interval = (2 * sigma + 1.0) / size
x = np.linspace(-sigma-interval/2,sigma+interval/2,size+1)
ker1d = np.diff(st.norm.cdf(x))
kernel_raw = np.sqrt(n... | [
"cv2.line",
"cv2.circle",
"numpy.minimum",
"numpy.outer",
"numpy.zeros",
"numpy.expand_dims",
"numpy.transpose",
"os.path.getctime",
"scipy.stats.norm.cdf",
"cv2.imread",
"numpy.random.randint",
"numpy.array",
"numpy.tile",
"numpy.linspace",
"glob.glob",
"numpy.cos",
"numpy.sin"
] | [((203, 269), 'numpy.linspace', 'np.linspace', (['(-sigma - interval / 2)', '(sigma + interval / 2)', '(size + 1)'], {}), '(-sigma - interval / 2, sigma + interval / 2, size + 1)\n', (214, 269), True, 'import numpy as np\n'), ((403, 437), 'numpy.array', 'np.array', (['kernel'], {'dtype': 'np.float32'}), '(kernel, dtype... |
"""Support for SimpliSafe locks."""
import logging
from simplipy.errors import SimplipyError
from simplipy.lock import LockStates
from simplipy.websocket import EVENT_LOCK_LOCKED, EVENT_LOCK_UNLOCKED
from homeassistant.components.lock import LockDevice
from homeassistant.core import callback
from . import SimpliSafe... | [
"logging.getLogger"
] | [((377, 404), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (394, 404), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2020-11-30 12:13
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('time_based', '0038_timebasedactivity_preparation'),
]
operations = [
migra... | [
"django.db.models.DurationField",
"django.db.migrations.RenameField"
] | [((315, 408), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""timecontribution"""', 'old_name': '"""end"""', 'new_name': '"""old_end"""'}), "(model_name='timecontribution', old_name='end',\n new_name='old_end')\n", (337, 408), False, 'from django.db import migrations, models\n')... |
# GenerateSpectraPages.py
import argparse
import os
import time
from astropy.coordinates import SkyCoord
from astropy.io import ascii, votable
from astropy.io.votable import parse_single_table, from_table, writeto
from astropy.table import Column, Table
import astropy.units as u
import numpy as np
def parseargs():
... | [
"astropy.io.votable.writeto",
"astropy.io.ascii.read",
"argparse.ArgumentParser",
"astropy.table.Table",
"os.path.dirname",
"os.path.exists",
"time.time",
"astropy.io.votable.from_table",
"astropy.table.Column",
"astropy.coordinates.SkyCoord",
"time.localtime",
"numpy.in1d"
] | [((437, 584), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""Produce preview pages for a set of spectra"""'}), "(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description=\n 'Produce preview pages for a set o... |
import base64
import os
import sys
import threading
from collections import defaultdict
from functools import partial
from io import BytesIO
from mimetypes import guess_extension
from typing import Any
import numpy as np
import six
from PIL import Image
from ...debugging.log import LoggerRoot
from ..frameworks import... | [
"tensorflow.python.framework.constant_op.constant",
"base64.b64decode",
"collections.defaultdict",
"numpy.histogram",
"numpy.arange",
"numpy.interp",
"google.protobuf.json_format.MessageToDict",
"numpy.atleast_2d",
"tensorflow.py_function",
"numpy.zeros_like",
"tensorflow.python.ops.summary_ops_... | [((9151, 9168), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (9166, 9168), False, 'import threading\n'), ((2812, 2844), 'numpy.random.shuffle', 'np.random.shuffle', (['cur_idx_below'], {}), '(cur_idx_below)\n', (2829, 2844), True, 'import numpy as np\n'), ((5990, 6017), 'numpy.append', 'np.append', (['hist_i... |
import pandas as pd
import hoki.hrdiagrams
import hoki.cmd
import hoki.load as load
from hoki.constants import BPASS_TIME_BINS
import warnings
from hoki.utils.exceptions import HokiFatalError, HokiUserWarning, HokiFormatError, HokiFormatWarning, HokiDeprecationWarning
from hoki.utils.hoki_object import HokiObject
from ... | [
"numpy.sum",
"hoki.utils.exceptions.HokiDeprecationWarning",
"numpy.isnan",
"hoki.utils.hoki_dialogue.HokiDialogue",
"hoki.utils.exceptions.HokiFormatError",
"numpy.array",
"hoki.load.model_output",
"warnings.warn",
"numpy.round",
"hoki.load.unpickle"
] | [((412, 426), 'hoki.utils.hoki_dialogue.HokiDialogue', 'HokiDialogue', ([], {}), '()\n', (424, 426), False, 'from hoki.utils.hoki_dialogue import HokiDialogue\n'), ((792, 827), 'hoki.utils.exceptions.HokiDeprecationWarning', 'HokiDeprecationWarning', (['deprecation'], {}), '(deprecation)\n', (814, 827), False, 'from ho... |
import os
import logging
import torch
import shutil
def allocate_tensors():
"""
init data tensors
:return: data tensors
"""
tensors = dict()
tensors['support_data'] = torch.FloatTensor()
tensors['support_label'] = torch.LongTensor()
tensors['query_data'] = torch.FloatTensor()
tenso... | [
"torch.eq",
"torch.ones",
"torch.eye",
"torch.stack",
"os.makedirs",
"torch.LongTensor",
"logging.StreamHandler",
"torch.FloatTensor",
"torch.cat",
"os.path.exists",
"torch.zeros",
"os.path.join",
"torch.tensor"
] | [((193, 212), 'torch.FloatTensor', 'torch.FloatTensor', ([], {}), '()\n', (210, 212), False, 'import torch\n'), ((244, 262), 'torch.LongTensor', 'torch.LongTensor', ([], {}), '()\n', (260, 262), False, 'import torch\n'), ((291, 310), 'torch.FloatTensor', 'torch.FloatTensor', ([], {}), '()\n', (308, 310), False, 'import... |
#!/usr/bin/env python
import json
from pathlib import Path
from divorce_predictor.data import DataLoader
from divorce_predictor.experiment import Experiment
if __name__ == "__main__":
print("Begin train.py")
project_root = Path(__file__).parent.parent
dataset_path = project_root / "ml" / "input" / "data"... | [
"divorce_predictor.data.DataLoader",
"divorce_predictor.experiment.Experiment",
"pathlib.Path"
] | [((552, 612), 'divorce_predictor.data.DataLoader', 'DataLoader', ([], {'dataset_path': 'dataset_path', 'target_column': '"""Class"""'}), "(dataset_path=dataset_path, target_column='Class')\n", (562, 612), False, 'from divorce_predictor.data import DataLoader\n'), ((669, 702), 'divorce_predictor.experiment.Experiment', ... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"airflow.utils.module_loading.as_importable_string",
"importlib.util.spec_from_loader",
"inspect.isclass",
"types.ModuleType",
"airflow.utils.file.find_path_from_directory",
"airflow.stats.Stats.timer",
"os.path.isfile",
"importlib.machinery.SourceFileLoader",
"os.path.relpath",
"airflow.utils.ent... | [((1453, 1480), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1470, 1480), False, 'import logging\n'), ((6529, 6570), 'airflow.utils.entry_points.entry_points_with_dist', 'entry_points_with_dist', (['"""airflow.plugins"""'], {}), "('airflow.plugins')\n", (6551, 6570), False, 'from airfl... |
from detectron2.engine import default_argument_parser
from liuy.implementation.CoCoSegModel import CoCoSegModel
from liuy.implementation.RandomSampler import CoCoRandomSampler
import numpy as np
import random
from liuy.utils.reg_dataset import register_coco_instances_from_selected_image_files
from liuy.utils.local_conf... | [
"liuy.utils.reg_dataset.register_coco_instances_from_selected_image_files",
"copy.deepcopy",
"numpy.ceil",
"random.sample",
"detectron2.engine.default_argument_parser",
"liuy.implementation.CoCoSegModel.CoCoSegModel",
"liuy.implementation.RandomSampler.CoCoRandomSampler"
] | [((878, 919), 'random.sample', 'random.sample', (['whole_image_id', 'seed_batch'], {}), '(whole_image_id, seed_batch)\n', (891, 919), False, 'import random\n'), ((970, 1182), 'liuy.utils.reg_dataset.register_coco_instances_from_selected_image_files', 'register_coco_instances_from_selected_image_files', ([], {'name': '"... |
"""
Copyright (c) 2020 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WI... | [
"rl.memory.SequentialMemory",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.layers.Dense",
"rl.agents.DDPGAgent",
"rl.policy.BoltzmannQPolicy",
"tensorflow.keras.Model",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.optimizers.Adam",
"tensorflow.keras.layers.Input",
"tensorflo... | [((1531, 1543), 'tensorflow.keras.Sequential', 'Sequential', ([], {}), '()\n', (1541, 1543), False, 'from tensorflow.keras import Sequential\n'), ((1829, 1875), 'rl.memory.SequentialMemory', 'SequentialMemory', ([], {'limit': '(10240)', 'window_length': '(1)'}), '(limit=10240, window_length=1)\n', (1845, 1875), False, ... |
""" A procedural map generator in Python, based on ARENA (Bhojan et. al. 2014) and <NAME>. """
import argparse
from map import Map
parser = argparse.ArgumentParser()
parser.add_argument("width", help="The width of the output. Required", type=int)
parser.add_argument("height", help="The height of the output. Require... | [
"argparse.ArgumentParser",
"map.Map"
] | [((143, 168), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (166, 168), False, 'import argparse\n'), ((370, 398), 'map.Map', 'Map', (['args.width', 'args.height'], {}), '(args.width, args.height)\n', (373, 398), False, 'from map import Map\n')] |
import time
import math
import numpy as np
import torch
from torch import nn, optim
import torch.nn.functional as F
import sys
import os
import random
sys.path.append("../")
# os.environ["CUDA_VISIBLE_DEVICES"] = '0,1,2,3'
# device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
device = 'cpu'
print(dev... | [
"sys.path.append",
"torch.nn.Parameter",
"math.exp",
"random.shuffle",
"torch.nn.CrossEntropyLoss",
"torch.cat",
"time.time",
"torch.nn.init.normal_",
"torch.cuda.is_available",
"torch.zeros",
"torch.matmul",
"torch.tensor"
] | [((151, 173), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (166, 173), False, 'import sys\n'), ((887, 949), 'torch.zeros', 'torch.zeros', (['x.shape[0]', 'n_class'], {'dtype': 'dtype', 'device': 'x.device'}), '(x.shape[0], n_class, dtype=dtype, device=x.device)\n', (898, 949), False, 'import ... |
from datetime import date, datetime, time, timezone
from typing import Generator, List, Optional, Tuple
import pandas as pd
from pandas import Timestamp
def get_current_time(tzinfo=timezone.utc):
"""Get current time."""
return datetime.utcnow().replace(tzinfo=tzinfo)
def parse_datetime(value: str, unit: st... | [
"pandas.date_range",
"datetime.date",
"datetime.date.fromisoformat",
"datetime.datetime.utcnow",
"pandas.to_datetime",
"datetime.time.fromisoformat",
"pandas.Timedelta",
"datetime.datetime.combine"
] | [((4070, 4089), 'pandas.Timedelta', 'pd.Timedelta', (['value'], {}), '(value)\n', (4082, 4089), True, 'import pandas as pd\n'), ((681, 700), 'pandas.Timedelta', 'pd.Timedelta', (['value'], {}), '(value)\n', (693, 700), True, 'import pandas as pd\n'), ((1098, 1116), 'pandas.Timedelta', 'pd.Timedelta', (['"""1d"""'], {})... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from yandex.cloud.cdn.v1 import origin_pb2 as yandex_dot_cloud_dot_cdn_dot_v1_dot_origin__pb2
from yandex.cloud.cdn.v1 import origin_service_pb2 as yandex_dot_cl... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.unary_unary"
] | [((5978, 6076), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""yandex.cloud.cdn.v1.OriginService"""', 'rpc_method_handlers'], {}), "('yandex.cloud.cdn.v1.OriginService',\n rpc_method_handlers)\n", (6014, 6076), False, 'import grpc\n'), ((4171, 4436), 'grpc.unary_unary_rpc_metho... |
import os
class Config:
'''
General config
'''
NEWS_BASE_URL = 'https://newsapi.org/v2/everything?q={}&apiKey={}'
NEWS_API_KEY = os.environ.get('NEWS_API_KEY') #<KEY>
SECRET_KEY = os.environ.get('SECRET_KEY')
class ProdConfig(Config):
pass
class DevConfig(Config):
DEBUG = True
confi... | [
"os.environ.get"
] | [((151, 181), 'os.environ.get', 'os.environ.get', (['"""NEWS_API_KEY"""'], {}), "('NEWS_API_KEY')\n", (165, 181), False, 'import os\n'), ((206, 234), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (220, 234), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'main_test.ui'
#
# Created by: PyQt5 UI code generator 5.7.1
#
# WARNING! All changes made in this file will be lost!
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
import icons_rc
from xldigest.widgets.main_ui import Ui_MainXldiges... | [
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QDesktopWidget",
"PyQt5.QtCore.QSize",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QToolBar"
] | [((1594, 1626), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1616, 1626), False, 'from PyQt5 import QtWidgets, QtGui, QtCore\n'), ((621, 668), 'PyQt5.QtWidgets.QToolBar', 'QtWidgets.QToolBar', (['"""Main Toolbar"""'], {'parent': 'self'}), "('Main Toolbar', parent=self)\... |
from copy import copy
import cloudpickle
from sortedcontainers import SortedDict, SortedSet
from adaptive.learner.base_learner import BaseLearner
class _IgnoreFirstArgument:
"""Remove the first argument from the call signature.
The SequenceLearner's function receives a tuple ``(index, point)``
but the ... | [
"sortedcontainers.SortedDict",
"cloudpickle.loads",
"copy.copy",
"cloudpickle.dumps"
] | [((1961, 1975), 'copy.copy', 'copy', (['sequence'], {}), '(sequence)\n', (1965, 1975), False, 'from copy import copy\n'), ((1996, 2008), 'sortedcontainers.SortedDict', 'SortedDict', ([], {}), '()\n', (2006, 2008), False, 'from sortedcontainers import SortedDict, SortedSet\n'), ((4287, 4314), 'cloudpickle.loads', 'cloud... |
import pytest
import json
@pytest.fixture
def post_body_share_user():
return json.dumps({
'data': {
'type': 'ShareUser',
'attributes': {
'username': 'TestUser'
}
}
})
@pytest.fixture(params=[
'/api/v2/user/',
'/api/v2/users/',
])
de... | [
"pytest.fixture",
"json.dumps"
] | [((248, 306), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['/api/v2/user/', '/api/v2/users/']"}), "(params=['/api/v2/user/', '/api/v2/users/'])\n", (262, 306), False, 'import pytest\n'), ((83, 170), 'json.dumps', 'json.dumps', (["{'data': {'type': 'ShareUser', 'attributes': {'username': 'TestUser'}}}"], {}), "... |
import math
a = int(input())
area = 2 * math.sqrt(3) * math.pow(a, 2)
volume = math.pow(a, 3) * math.sqrt(2) / 3
print(round(area, 2), round(volume, 2))
| [
"math.sqrt",
"math.pow"
] | [((57, 71), 'math.pow', 'math.pow', (['a', '(2)'], {}), '(a, 2)\n', (65, 71), False, 'import math\n'), ((42, 54), 'math.sqrt', 'math.sqrt', (['(3)'], {}), '(3)\n', (51, 54), False, 'import math\n'), ((81, 95), 'math.pow', 'math.pow', (['a', '(3)'], {}), '(a, 3)\n', (89, 95), False, 'import math\n'), ((98, 110), 'math.s... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.platform.test.main",
"tensorflow.python.autograph.operators.data_structures.new_list",
"tensorflow.python.ops.list_ops.tensor_list_stack",
"tensorflow.python.autograph.operators.data_structures.ListPopOpts",
"tensorflow.python.ops.list_ops.tensor_list_from_tensor",
"tensorflow.python.op... | [((7390, 7401), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (7399, 7401), False, 'from tensorflow.python.platform import test\n'), ((1312, 1338), 'tensorflow.python.autograph.operators.data_structures.new_list', 'data_structures.new_list', ([], {}), '()\n', (1336, 1338), False, 'from tensorfl... |
import pytest
import numpy as np
import torch
from pycox.models.utils import pad_col, make_subgrid, cumsum_reverse
@pytest.mark.parametrize('val', [0, 1, 5])
def test_pad_col_start(val):
x = torch.ones((2, 3))
x_pad = pad_col(x, val, where='start')
pad = torch.ones(2, 1) * val
assert (x_pad == torch.ca... | [
"numpy.random.uniform",
"torch.ones",
"pycox.models.utils.make_subgrid",
"numpy.abs",
"torch.manual_seed",
"torch.randn",
"torch.cat",
"numpy.sort",
"pytest.raises",
"numpy.linspace",
"pytest.mark.parametrize",
"pycox.models.utils.pad_col",
"pycox.models.utils.cumsum_reverse"
] | [((117, 158), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""val"""', '[0, 1, 5]'], {}), "('val', [0, 1, 5])\n", (140, 158), False, 'import pytest\n'), ((348, 389), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""val"""', '[0, 1, 5]'], {}), "('val', [0, 1, 5])\n", (371, 389), False, 'import pyt... |
# Created byMartin.cz
# Copyright (c) <NAME>. All rights reserved.
# import modules
import wx
import core
from .. import events
from .. import mwx
from .. ids import *
from .list_ctrl import AuthorsList
from .top_bar import AuthorsTopBar
from .bottom_bar import AuthorsBottomBar
from .edit_dlg import AuthorsEditDlg
... | [
"wx.Dialog.__init__",
"wx.Menu",
"core.Query",
"wx.BoxSizer",
"wx.Yield"
] | [((527, 656), 'wx.Dialog.__init__', 'wx.Dialog.__init__', (['self', 'parent', '(-1)'], {'size': '(470, 400)', 'title': '"""Authors List"""', 'style': '(wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)'}), "(self, parent, -1, size=(470, 400), title='Authors List',\n style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)\n", (5... |
#
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
#
# 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 ag... | [
"dask.delayed",
"dask_cudf.from_cudf",
"numpy.datetime64",
"bdb_tools.utils.run_query",
"bdb_tools.utils.gpubdb_argparser",
"bdb_tools.cluster_startup.attach_to_cluster",
"bdb_tools.utils.benchmark",
"bdb_tools.readers.build_reader",
"dask_cudf.concat"
] | [((1004, 1129), 'bdb_tools.readers.build_reader', 'build_reader', ([], {'data_format': "config['file_format']", 'basepath': "config['data_dir']", 'split_row_groups': "config['split_row_groups']"}), "(data_format=config['file_format'], basepath=config['data_dir'],\n split_row_groups=config['split_row_groups'])\n", (1... |
import json
from abc import ABC, abstractmethod
class State(ABC):
def __init__(self, state_name: str, state_type: str):
"""
Abstract class to describe the base for Steps.
:param state_name: step's symbolic name.
:param state_type: step's type.
"""
self._name: str =... | [
"json.dumps"
] | [((6895, 6918), 'json.dumps', 'json.dumps', (['state_input'], {}), '(state_input)\n', (6905, 6918), False, 'import json\n')] |
# Copyright (c) 2017 <NAME>.
# Cura is released under the terms of the LGPLv3 or higher.
from collections import defaultdict
import threading
from typing import Any, Dict, Optional
from PyQt5.QtCore import pyqtProperty
from UM.Application import Application
from UM.Decorators import override
from UM.MimeTypeDatabas... | [
"UM.MimeTypeDatabase.MimeType",
"UM.MimeTypeDatabase.MimeTypeDatabase.addMimeType",
"UM.Logger.Logger.log",
"UM.Application.Application.getInstance",
"collections.defaultdict",
"UM.Decorators.override",
"PyQt5.QtCore.pyqtProperty",
"UM.Settings.Interfaces.PropertyEvaluationContext",
"threading.curre... | [((7074, 7179), 'UM.MimeTypeDatabase.MimeType', 'MimeType', ([], {'name': '"""application/x-cura-globalstack"""', 'comment': '"""Cura Global Stack"""', 'suffixes': "['global.cfg']"}), "(name='application/x-cura-globalstack', comment='Cura Global Stack',\n suffixes=['global.cfg'])\n", (7082, 7179), False, 'from UM.Mi... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.ops.summary_op_util.summary_scope",
"uuid.uuid4",
"tensorflow.python.eager.context.in_eager_mode",
"tensorflow.python.eager.context.device",
"tensorflow.python.framework.constant_op.constant",
"tensorflow.python.ops.state_ops.assign",
"tensorflow.python.ops.resource_variable_ops.Eager... | [((1568, 1628), 'tensorflow.python.ops.summary_op_util.summary_scope', 'summary_op_util.summary_scope', (['name', 'family'], {'values': '[tensor]'}), '(name, family, values=[tensor])\n', (1597, 1628), False, 'from tensorflow.python.ops import summary_op_util\n'), ((3281, 3304), 'tensorflow.python.eager.context.in_eager... |
from web3 import Web3
import json
w3 = Web3(Web3.HTTPProvider("HTTP://127.0.0.1:8545"))
with open('../conf/contract/build/ERC721Metadata.abi', 'r') as myfile:
abi = myfile.read()
with open('../conf/contract/build/ERC721Metadata.bin', 'r') as myfile:
binfile = myfile.read()
account = w3.eth.accounts[0]
PDSContrac... | [
"web3.Web3.HTTPProvider"
] | [((45, 87), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['"""HTTP://127.0.0.1:8545"""'], {}), "('HTTP://127.0.0.1:8545')\n", (62, 87), False, 'from web3 import Web3\n')] |
# Copyright (C) 2016 <NAME>. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# ========================================... | [
"tensorflow.app.flags.DEFINE_float",
"tensorflow.clip_by_value",
"skimage.transform.SimilarityTransform",
"cv2.remap",
"cv2.warpAffine",
"tensorflow.image.resize_bilinear",
"tensorflow.image.decode_png",
"numpy.arange",
"tensorflow.split",
"tensorflow.app.flags.DEFINE_integer",
"tensorflow.nn.mo... | [((1574, 1663), 'tensorflow.app.flags.DEFINE_integer', 'tf.app.flags.DEFINE_integer', (['"""image_size"""', '(299)', '"""Provide square images of this size."""'], {}), "('image_size', 299,\n 'Provide square images of this size.')\n", (1601, 1663), True, 'import tensorflow as tf\n'), ((1692, 1806), 'tensorflow.app.fl... |
"""
Module for evaluation of machine learning models.
"""
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, r2_score
from scipy.stats import spearmanr
def print_metrics(y_true, y_pred):
print("================================================")
print("Spearman's co... | [
"sklearn.metrics.r2_score",
"scipy.stats.spearmanr"
] | [((492, 516), 'sklearn.metrics.r2_score', 'r2_score', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (500, 516), False, 'from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, r2_score\n'), ((344, 369), 'scipy.stats.spearmanr', 'spearmanr', (['y_true', 'y_pred'], {}), '(y_true, y_pred)\n', (353, 369... |
from django.conf.urls import path
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
path('',views.home,name='home'),
path('image/', views.image_upload,name='upload'),
path('profile/', views.profile_info,name='profile'),
path('edit/',vie... | [
"django.conf.urls.static.static",
"django.conf.urls.path"
] | [((156, 189), 'django.conf.urls.path', 'path', (['""""""', 'views.home'], {'name': '"""home"""'}), "('', views.home, name='home')\n", (160, 189), False, 'from django.conf.urls import path\n'), ((193, 242), 'django.conf.urls.path', 'path', (['"""image/"""', 'views.image_upload'], {'name': '"""upload"""'}), "('image/', v... |
import os
from typing import Tuple
from werkzeug.utils import secure_filename
from flask import Flask, flash, request, redirect, url_for, render_template, session
from ms_package.startup import DATA_DIR
from ms_package.reader import Reader
from ms_package.peptide_prediction import PeptideSearch
from ms_package.protei... | [
"flask.flash",
"os.makedirs",
"flask.redirect",
"flask.request.files.getlist",
"ms_package.peptide_prediction.PeptideSearch",
"flask.Flask",
"werkzeug.utils.secure_filename",
"os.environ.get",
"ms_package.protein_prediction.ProteinSearch",
"flask.url_for",
"flask.render_template",
"os.path.joi... | [((372, 405), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""uploads"""'], {}), "(DATA_DIR, 'uploads')\n", (384, 405), False, 'import os\n'), ((461, 476), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (466, 476), False, 'from flask import Flask, flash, request, redirect, url_for, render_template, sessi... |
# Copyright (c) 2016, Universal Robots A/S,
# All rights reserved.
# 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, this list of conditio... | [
"struct.pack",
"struct.unpack_from"
] | [((1741, 1771), 'struct.unpack_from', 'struct.unpack_from', (['""">HB"""', 'buf'], {}), "('>HB', buf)\n", (1759, 1771), False, 'import struct\n'), ((2008, 2040), 'struct.unpack_from', 'struct.unpack_from', (['""">IIII"""', 'buf'], {}), "('>IIII', buf)\n", (2026, 2040), False, 'import struct\n'), ((6290, 6315), 'struct.... |
import sys
from collections import defaultdict
sys.path.insert(0, '../10')
from knot_hash import knot_hash_str
BIT_COUNT = {
'0': 0, # 0000
'1': 1, # 0001
'2': 1, # 0010
'3': 2, # 0011
'4': 1, # 0100
'5': 2, # 0101
'6': 2, # 0110
'7': 3, # 0111
'8': 1, # 1000
'9': 2, ... | [
"collections.defaultdict",
"knot_hash.knot_hash_str",
"sys.path.insert"
] | [((48, 75), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../10"""'], {}), "(0, '../10')\n", (63, 75), False, 'import sys\n'), ((833, 851), 'knot_hash.knot_hash_str', 'knot_hash_str', (['key'], {}), '(key)\n', (846, 851), False, 'from knot_hash import knot_hash_str\n'), ((1198, 1221), 'collections.defaultdict', 'd... |
# Copyright (c) 2016-2017 Adobe Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modif... | [
"logging.StreamHandler",
"logging.getLogger",
"six.StringIO"
] | [((1842, 1852), 'six.StringIO', 'StringIO', ([], {}), '()\n', (1850, 1852), False, 'from six import StringIO\n'), ((1867, 1896), 'logging.StreamHandler', 'logging.StreamHandler', (['stream'], {}), '(stream)\n', (1888, 1896), False, 'import logging\n'), ((1910, 1942), 'logging.getLogger', 'logging.getLogger', (['"""test... |
from clinter.rules import BaseRule, BaseTest, RuleExecutionError
from clinter.NodeParenter import NodeParenter
from pycparser.c_ast import Node, BinaryOp, UnaryOp, ID, StructRef
from ConditionAnalzer import ConditionAnalyzer
class RuleBrokenNullCheck(BaseRule):
def __init__(self, reporter=None):
BaseRule... | [
"clinter.rules.BaseRule.__init__",
"ConditionAnalzer.ConditionAnalyzer",
"clinter.NodeParenter.NodeParenter.get_instance"
] | [((312, 355), 'clinter.rules.BaseRule.__init__', 'BaseRule.__init__', (['self', '"""static"""', 'reporter'], {}), "(self, 'static', reporter)\n", (329, 355), False, 'from clinter.rules import BaseRule, BaseTest, RuleExecutionError\n'), ((3560, 3588), 'ConditionAnalzer.ConditionAnalyzer', 'ConditionAnalyzer', (['node.co... |
from tbraille import tbraille
def test_rendering():
# test with default raster font
expected_result = '⢠⡄⠀⠀⠀⠀⠀⠀⠀⢠⡄\n⢹⡏⣁⣾⠽⠆⠺⢯⣅⢹⡏⣁\n⠀⠉⠁⠈⠉⠁⠉⠉⠁⠀⠉⠁\n\n⣰⣆⡀⢀⣀⠀⢀⣀⡀⣰⣆⡀\n⠸⣇⡤⢿⣚⡃⣙⣳⡦⠸⣇⡤' # noqa
result = tbraille(fontname=None, size=None, text='test\ntest')
print(result)
assert result == expected_result
| [
"tbraille.tbraille"
] | [((205, 258), 'tbraille.tbraille', 'tbraille', ([], {'fontname': 'None', 'size': 'None', 'text': '"""test\ntest"""'}), "(fontname=None, size=None, text='test\\ntest')\n", (213, 258), False, 'from tbraille import tbraille\n')] |
# (C) Copyright 1996- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernment... | [
"pyaviso.authentication.auth.Auth.get_auth",
"pyaviso.event_listeners.event_listener_factory.EventListenerFactory",
"json.load",
"pytest.fixture",
"os.environ.get",
"pyaviso.user_config.UserConfig",
"pyaviso.engine.engine_factory.EngineFactory"
] | [((626, 642), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (640, 642), False, 'import pytest\n'), ((803, 819), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (817, 819), False, 'import pytest\n'), ((733, 786), 'pyaviso.user_config.UserConfig', 'user_config.UserConfig', ([], {'conf_path': '"""tests/confi... |
#!/usr/bin/env python
"""
This script takes a FASTA file generated by QIIME's split_libraries_fastq.py
(with original FASTQ reads generated by the ART read simulator) and creates
an OTU map using the sequence IDs storing the read identifier and the parent
reference sequence.
"""
# -------------------------------------... | [
"skbio.parse.sequences.parse_fasta",
"re.split"
] | [((1055, 1076), 'skbio.parse.sequences.parse_fasta', 'parse_fasta', (['fasta_fp'], {}), '(fasta_fp)\n', (1066, 1076), False, 'from skbio.parse.sequences import parse_fasta\n'), ((1099, 1119), 're.split', 're.split', (['""" """', 'label'], {}), "(' ', label)\n", (1107, 1119), False, 'import re\n'), ((1144, 1166), 're.sp... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
ChatViewSet,
ChatMessageViewSet,
ChatMembersViewSet,
)
router = DefaultRouter()
router.register('', ChatViewSet, basename='chat')
router.register(r'(?P<chat_pk>\w+)/messages', ChatMessageViewSet, ba... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((186, 201), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (199, 201), False, 'from rest_framework.routers import DefaultRouter\n'), ((453, 473), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (460, 473), False, 'from django.urls import path, include\n')] |
# coding: utf-8
import json
import os
import boto3
import pandas as pd
def main():
price_list = []
pricing = boto3.client('pricing', region_name='us-east-1')
paginator = pricing.get_paginator('get_products')
response_iterator = paginator.paginate(
ServiceCode='AmazonEC2',
Filters = [
... | [
"pandas.DataFrame",
"pandas.Series",
"boto3.client",
"json.loads"
] | [((120, 168), 'boto3.client', 'boto3.client', (['"""pricing"""'], {'region_name': '"""us-east-1"""'}), "('pricing', region_name='us-east-1')\n", (132, 168), False, 'import boto3\n'), ((892, 906), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (904, 906), True, 'import pandas as pd\n'), ((1488, 1509), 'pandas.Ser... |
from PyQt5.QtWidgets import QTreeView, QHeaderView, QStyledItemDelegate, QStyleOptionViewItem
from PyQt5.QtGui import QStandardItemModel, QStandardItem, QImage
from PyQt5.QtCore import Qt
class StandardImageItem(QStandardItem):
path_visible = './icons/visibility/visible.png'
path_invisible = './icons/visibili... | [
"PyQt5.QtGui.QStandardItem",
"PyQt5.QtGui.QStandardItemModel",
"PyQt5.QtGui.QImage"
] | [((1244, 1264), 'PyQt5.QtGui.QStandardItemModel', 'QStandardItemModel', ([], {}), '()\n', (1262, 1264), False, 'from PyQt5.QtGui import QStandardItemModel, QStandardItem, QImage\n'), ((563, 588), 'PyQt5.QtGui.QImage', 'QImage', (['self.path_visible'], {}), '(self.path_visible)\n', (569, 588), False, 'from PyQt5.QtGui i... |
# Copyright 2022 Sony Semiconductors Israel, Inc. 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 b... | [
"unittest.main",
"keras.Input",
"model_compression_toolkit.core.tpc_models.keras_tp_models.keras_default.generate_keras_default_tpc",
"keras.Model",
"model_compression_toolkit.core.common.quantization.quantization_analyzer.analyzer_graph",
"model_compression_toolkit.core.common.mixed_precision.bit_width_s... | [((2331, 2397), 'numpy.random.normal', 'np.random.normal', ([], {'size': '[kernel, kernel, in_channels, out_channels]'}), '(size=[kernel, kernel, in_channels, out_channels])\n', (2347, 2397), True, 'import numpy as np\n'), ((2635, 2675), 'keras.Input', 'Input', ([], {'shape': '(16, 16, num_conv_channels)'}), '(shape=(1... |
from bluebottle.bluebottle_drf2.permissions import IsAuthorOrReadOnly
from bluebottle.bluebottle_drf2.views import RetrieveUpdateDeleteAPIView
from bluebottle.bluebottle_utils.utils import get_client_ip
from apps.projects.permissions import IsProjectOwnerOrReadOnly
from apps.tasks.models import Task, TaskMember, TaskFi... | [
"django.db.models.query_utils.Q",
"bluebottle.bluebottle_utils.utils.get_client_ip",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model"
] | [((3166, 3205), 'django.contrib.contenttypes.models.ContentType.objects.get_for_model', 'ContentType.objects.get_for_model', (['Task'], {}), '(Task)\n', (3199, 3205), False, 'from django.contrib.contenttypes.models import ContentType\n'), ((3675, 3714), 'django.contrib.contenttypes.models.ContentType.objects.get_for_mo... |
import os
import queue
from multiprocessing import Process, cpu_count
def search(paths, query_q, result_q):
lines = []
for path in paths:
lines.extend(l.strip() for l in open(path))
query = query_q.get()
while query:
result_q.put_([l for l in lines if query in l])
print(result_... | [
"queue.Queue",
"os.path.isfile",
"multiprocessing.Process",
"os.listdir",
"multiprocessing.cpu_count"
] | [((401, 412), 'multiprocessing.cpu_count', 'cpu_count', ([], {}), '()\n', (410, 412), False, 'from multiprocessing import Process, cpu_count\n'), ((618, 641), 'queue.Queue', 'queue.Queue', ([], {'maxsize': '(10)'}), '(maxsize=10)\n', (629, 641), False, 'import queue\n'), ((553, 576), 'queue.Queue', 'queue.Queue', ([], ... |
'''
kivybooth
=========
A photobooth application, intended to consist of a touch screen, a libgphoto2
compatible camera, and a printer connected via USB.
See README.md for details.
'''
import log, logging
# Libraries
from time import time
from kivy.app import App
from kivy.properties import NumericProperty, Strin... | [
"kivy.properties.ListProperty",
"kivy.properties.BooleanProperty",
"kivy.properties.StringProperty",
"camera.Camera",
"time.time",
"screens.load",
"kivy.clock.Clock.schedule_interval",
"kivy.properties.NumericProperty",
"logging.getLogger"
] | [((602, 630), 'logging.getLogger', 'logging.getLogger', (['"""kb.main"""'], {}), "('kb.main')\n", (619, 630), False, 'import log, logging\n'), ((671, 690), 'kivy.properties.NumericProperty', 'NumericProperty', (['(-1)'], {}), '(-1)\n', (686, 690), False, 'from kivy.properties import NumericProperty, StringProperty, Boo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Ver... | [
"subprocess.Popen",
"mock.mock.patch",
"ambari_commons.shell.changeUid",
"only_for_platform.not_for_platform",
"time.sleep",
"ambari_commons.shell.kill_process_with_children",
"os.getuid",
"ambari_commons.shell.shellRunner"
] | [((1250, 1284), 'only_for_platform.not_for_platform', 'not_for_platform', (['PLATFORM_WINDOWS'], {}), '(PLATFORM_WINDOWS)\n', (1266, 1284), False, 'from only_for_platform import not_for_platform, PLATFORM_WINDOWS\n'), ((1326, 1344), 'mock.mock.patch', 'patch', (['"""os.setuid"""'], {}), "('os.setuid')\n", (1331, 1344),... |
import numpy as np
import copy
from pommerman import constants
from pommerman import utility
STEP_COUNT_POS = 0
DONE_POS = 1
AMMO_POS = 0
BLAST_STRENGTH_POS = 1
CAN_KICK_POS = 2
ALIVE_POS = 3
ROW_POS = 4
COL_POS = 5
class EnvSimulator:
@staticmethod
def get_initial_game_data(obs, my_id, max_steps=1000):
... | [
"copy.deepcopy",
"numpy.zeros",
"numpy.ones",
"numpy.where",
"pommerman.constants.InvalidAction",
"pommerman.constants.Action",
"pommerman.utility.position_in_items",
"numpy.vstack"
] | [((1538, 1595), 'numpy.vstack', 'np.vstack', (['[game_data, game_info, player1row, player2row]'], {}), '([game_data, game_info, player1row, player2row])\n', (1547, 1595), True, 'import numpy as np\n'), ((14201, 14309), 'pommerman.utility.position_in_items', 'utility.position_in_items', (['game_data', '(next_row, next_c... |
#!/usr/bin/env python3
# 测试http请求
import requests
import urllib
import httplib2
from yvhai.demo.base import YHDemo
headers = {
'User-Agent': ''
}
class HttpRequester(YHDemo):
@staticmethod
def get(url, params):
res1 = HttpRequester.get_by_r(url, params)
res2 = HttpRequester.get_by_urll... | [
"httplib2.Http",
"urllib.parse.urlencode",
"urllib.request.urlopen",
"requests.get"
] | [((514, 546), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (526, 546), False, 'import requests\n'), ((737, 767), 'urllib.parse.urlencode', 'urllib.parse.urlencode', (['params'], {}), '(params)\n', (759, 767), False, 'import urllib\n'), ((783, 827), 'urllib.request.urlopen',... |
#!/usr/bin/env python
import sys
import django
from django.conf import settings
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"bread",
]
settings.configure(
DEBUG=True,
USE_TZ=True,
USE_I18N=True,
DATABASES={"default": {"ENGINE": "dj... | [
"django.conf.settings.configure",
"django.setup",
"django.core.management.execute_from_command_line"
] | [((208, 426), 'django.conf.settings.configure', 'settings.configure', ([], {'DEBUG': '(True)', 'USE_TZ': '(True)', 'USE_I18N': '(True)', 'DATABASES': "{'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:'}}", 'MIDDLEWARE_CLASSES': '()', 'SITE_ID': '(1)', 'INSTALLED_APPS': 'INSTALLED_APPS'}), "(DEBUG=T... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 16:33:05 2018
@author: lhe39759
"""
import keras
import os
import PIL
import numpy as np
import tensorflow as tf
import sys
sys.path.append(r'C:\Users\lhe39759\Documents\GitHub/')
from SliceOPy import NetSlice, DataSlice
from model.losses import bce_dice_loss, bce_dic... | [
"sys.path.append",
"numpy.pad",
"keras.layers.MaxPooling2D",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"PIL.Image.open",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Conv2D",
"SliceOPy.NetSlice",
"SliceOPy.DataSlice",
"os.listdir"
] | [((176, 234), 'sys.path.append', 'sys.path.append', (['"""C:\\\\Users\\\\lhe39759\\\\Documents\\\\GitHub/"""'], {}), "('C:\\\\Users\\\\lhe39759\\\\Documents\\\\GitHub/')\n", (191, 234), False, 'import sys\n'), ((3161, 3268), 'SliceOPy.DataSlice', 'DataSlice', ([], {'Features': 'features', 'Labels': 'labels', 'Shuffle':... |
import sklearn, re, nltk, base64, json, urllib2, os
import numpy as np
import cPickle as pickle
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.feature_extraction.text import CountVectorizer
import os
MIN_RESULTS = 30 # Minimum number of results needed for valid user input
BASE_SEARCH_URL = 'h... | [
"os.getenv",
"sklearn.feature_extraction.text.CountVectorizer",
"numpy.multiply",
"json.loads",
"sklearn.feature_extraction.text.TfidfVectorizer",
"urllib2.Request",
"nltk.data.path.append",
"cPickle.load",
"nltk.word_tokenize",
"numpy.argsort",
"os.path.isfile",
"base64.b64encode",
"re.sub"... | [((451, 486), 'nltk.data.path.append', 'nltk.data.path.append', (['"""nltk_data/"""'], {}), "('nltk_data/')\n", (472, 486), False, 'import sklearn, re, nltk, base64, json, urllib2, os\n'), ((607, 634), 'os.path.isfile', 'os.path.isfile', (['"""config.py"""'], {}), "('config.py')\n", (621, 634), False, 'import os\n'), (... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.deletion import CASCADE
from django.db.models.signals import post_save
from django.dispatch import receiver
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=CASCADE, null=True, blank=True)
sup... | [
"django.db.models.ForeignKey",
"django.db.models.OneToOneField",
"django.dispatch.receiver",
"django.db.models.BooleanField"
] | [((244, 312), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'CASCADE', 'null': '(True)', 'blank': '(True)'}), '(User, on_delete=CASCADE, null=True, blank=True)\n', (264, 312), False, 'from django.db import models\n'), ((330, 428), 'django.db.models.ForeignKey', 'models.ForeignKey', ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
# Copyright 2020 ANYbotics AG
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code mus... | [
"PySide2.QtWidgets.QFileDialog.getOpenFileName",
"PySide2.QtGui.QColor",
"PySide2.QtWidgets.QMessageBox",
"PySide2.QtWidgets.QActionGroup",
"PySide2.QtWidgets.QPushButton",
"PySide2.QtWidgets.QMenu",
"PySide2.QtWidgets.QFormLayout",
"PySide2.QtWidgets.QHBoxLayout",
"PySide2.QtCore.Slot",
"os.path.... | [((1772, 1914), 'collections.namedtuple', 'collections.namedtuple', (['"""UserPlot"""', "['title', 'x', 'y1', 'y1d', 'y2', 'y2d', 'grid1', 'grid2', 'style',\n 'style2', 'graph_labels', 'extra']"], {}), "('UserPlot', ['title', 'x', 'y1', 'y1d', 'y2', 'y2d',\n 'grid1', 'grid2', 'style', 'style2', 'graph_labels', 'e... |
"""
GSMA data import unit tests.
Copyright (c) 2018 Qualcomm Technologies, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the
limitations in the disclaimer below) provided that the following conditions are met:
* Redistribu... | [
"_importer_params.GSMADataParams",
"zipfile.ZipFile",
"_helpers.expect_failure",
"_helpers.logger_stream_contents",
"os.path.dirname",
"_helpers.expect_success",
"click.testing.CliRunner",
"os.path.split",
"os.path.join"
] | [((3289, 3326), 'os.path.join', 'path.join', (['here', '"""unittest_data/gsma"""'], {}), "(here, 'unittest_data/gsma')\n", (3298, 3326), False, 'from os import path\n'), ((3435, 3485), 'os.path.join', 'path.join', (['data_dir', 'valid_csv_gsma_data_file_name'], {}), '(data_dir, valid_csv_gsma_data_file_name)\n', (3444,... |
from os.path import exists
from sys import argv
from GTFSProcessor import Routes
EXACT_ARGS_NUM = 3
USAGE_STR = '''Usage:
routes_at_stop.py [database-Path] [stop_id]'''
if __name__ == '__main__':
if len(argv) != EXACT_ARGS_NUM:
print(... | [
"GTFSProcessor.Routes.get_route_long_name",
"GTFSProcessor.Routes.get_latest_service_for_stop_on_trip",
"GTFSProcessor.Routes.get_stop_name",
"GTFSProcessor.Routes.get_route_short_name",
"os.path.exists",
"GTFSProcessor.Routes.get_earliest_service_for_stop_on_trip",
"GTFSProcessor.Routes.check_if_stop_e... | [((617, 662), 'GTFSProcessor.Routes.check_if_stop_exists', 'Routes.check_if_stop_exists', (['argv[1]', 'argv[2]'], {}), '(argv[1], argv[2])\n', (644, 662), False, 'from GTFSProcessor import Routes\n'), ((528, 543), 'os.path.exists', 'exists', (['argv[1]'], {}), '(argv[1])\n', (534, 543), False, 'from os.path import exi... |
import streamlit as st
import plotly.express as px
import math
from datetime import datetime
from pyspark.sql import types
schema = types.StructType([
types.StructField('id', types.IntegerType()),
types.StructField('reputation', types.IntegerType()),
types.StructField('display_name', types.StringType()),
... | [
"math.isnan",
"streamlit.text_input",
"streamlit.plotly_chart",
"streamlit.dataframe",
"pyspark.sql.types.StringType",
"streamlit.header",
"streamlit.expander",
"streamlit.write",
"plotly.express.density_heatmap",
"datetime.datetime.strptime",
"pyspark.sql.types.TimestampType",
"pyspark.sql.ty... | [((845, 878), 'streamlit.header', 'st.header', (['"""Will the user answer"""'], {}), "('Will the user answer')\n", (854, 878), True, 'import streamlit as st\n'), ((1019, 1059), 'streamlit.text_input', 'st.text_input', (['"""Please enter reputation"""'], {}), "('Please enter reputation')\n", (1032, 1059), True, 'import ... |
"""
Data feeding function for train and test.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import tensorflow as tf
# from src.data_utils import Dataset
from data_utils import Dataset
def input_fn(training, params):
"""
Simple input... | [
"os.path.abspath",
"tensorflow.compat.v1.add_to_collection",
"tensorflow.compat.v1.data.get_output_shapes",
"tensorflow.compat.v1.data.get_output_types",
"os.path.join"
] | [((3387, 3481), 'tensorflow.compat.v1.add_to_collection', 'tf.compat.v1.add_to_collection', (['tf.compat.v1.GraphKeys.TABLE_INITIALIZERS', 'dataset_init_op'], {}), '(tf.compat.v1.GraphKeys.TABLE_INITIALIZERS,\n dataset_init_op)\n', (3417, 3481), True, 'import tensorflow as tf\n'), ((1221, 1246), 'os.path.abspath', '... |
import re
import inspect
from werkzeug.wrappers import Response as BaseResponse
from flask.views import View as FlaskView
from ..utils import json
from flask import request, current_app, session
from werkzeug.datastructures import Headers
from ..core.exc import ImproperlyConfigured
from ..http import exc, status, Paylo... | [
"inspect.ismethod",
"inspect.getfullargspec",
"flask.request.method.lower",
"flask.current_app._get_current_object",
"inspect.isfunction",
"flask.session._get_current_object",
"inspect.getmembers"
] | [((967, 1020), 'inspect.getmembers', 'inspect.getmembers', (['cls'], {'predicate': 'inspect.isfunction'}), '(cls, predicate=inspect.isfunction)\n', (985, 1020), False, 'import inspect\n'), ((1298, 1324), 'inspect.isfunction', 'inspect.isfunction', (['method'], {}), '(method)\n', (1316, 1324), False, 'import inspect\n')... |
# -*- coding:utf-8 -*-
"""
股票技术指标接口
Created on 2018/05/26
@author: <NAME>
@group : **
@contact: <EMAIL>
"""
def ma(data, n=10, val_name="close"):
import numpy as np
'''
移动平均线 Moving Average
Parameters
------
data:pandas.DataFrame
通过 get_h_data 取得的股票数据
n:int
... | [
"matplotlib.pyplot.title",
"numpy.sum",
"matplotlib.pyplot.figure",
"numpy.isclose",
"matplotlib.pyplot.tight_layout",
"numpy.true_divide",
"numpy.std",
"numpy.append",
"matplotlib.pyplot.xticks",
"numpy.average",
"matplotlib.pyplot.show",
"numpy.asarray",
"matplotlib.pyplot.legend",
"matp... | [((685, 699), 'numpy.asarray', 'np.asarray', (['MA'], {}), '(MA)\n', (695, 699), True, 'import numpy as np\n'), ((1257, 1271), 'numpy.asarray', 'np.asarray', (['MD'], {}), '(MD)\n', (1267, 1271), True, 'import numpy as np\n'), ((2290, 2305), 'numpy.asarray', 'np.asarray', (['EMA'], {}), '(EMA)\n', (2300, 2305), True, '... |
import mxnet as mx
import mxnet.ndarray as nd
import mxnet.gluon as gluon
import gluonnlp
from mxnet.io import NDArrayIter
from tqdm import tqdm
import json
import argparse
import pandas as pd
import os
import sys
import numpy as np
from gensim.corpora import Dictionary
from sklearn.metrics import recall_score, confus... | [
"mxnet.ndarray.array",
"argparse.ArgumentParser",
"os.walk",
"mxnet.gluon.nn.Dropout",
"numpy.mean",
"os.path.join",
"sys.path.append",
"json.loads",
"gensim.corpora.Dictionary.load",
"mxnet.io.NDArrayIter",
"mxnet.gpu",
"tqdm.tqdm",
"mxnet.gluon.rnn.LSTM",
"register_experiment.Register",
... | [((368, 377), 'mxnet.cpu', 'mx.cpu', (['(0)'], {}), '(0)\n', (374, 377), True, 'import mxnet as mx\n'), ((450, 508), 'mxnet.ndarray.ones', 'nd.ones', (['(num_lines, SEQ_LENGTH)'], {'dtype': '"""float32"""', 'ctx': 'ctx'}), "((num_lines, SEQ_LENGTH), dtype='float32', ctx=ctx)\n", (457, 508), True, 'import mxnet.ndarray ... |
# coding: utf-8
# In[1]:
import matplotlib.pyplot as plt
get_ipython().magic('matplotlib inline')
import tensorflow as tf
import numpy as np
import pandas as pd
import time
from numpy import genfromtxt
from scipy import stats
# In[2]:
start_time = time.time()
# In[3]:
def read_data(file_name):
df = pd.rea... | [
"pandas.read_csv",
"numpy.empty",
"tensorflow.reshape",
"tensorflow.matmul",
"scipy.stats.describe",
"tensorflow.one_hot",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.placeholder",
"tensorflow.cast",
"numpy.append",
"tensorflow.equal",
"matplotlib.pyplot.show",
"tensorflow... | [((255, 266), 'time.time', 'time.time', ([], {}), '()\n', (264, 266), False, 'import time\n'), ((1126, 1158), 'numpy.empty', 'np.empty', ([], {'shape': '[1]', 'dtype': 'float'}), '(shape=[1], dtype=float)\n', (1134, 1158), True, 'import numpy as np\n'), ((1178, 1227), 'tensorflow.placeholder', 'tf.placeholder', (['tf.f... |
from typing import Tuple
import numpy as np
import pandas as pd
import torch
from sklearn.model_selection import train_test_split
from torch.utils.data import Dataset
def split_tabular_normal_only_train(
df: pd.DataFrame,
y_label: str = "label",
train_ratio: float = 0.7,
val_ratio: float = 0.7,
s... | [
"sklearn.model_selection.train_test_split",
"pandas.concat",
"torch.tensor"
] | [((1184, 1249), 'sklearn.model_selection.train_test_split', 'train_test_split', (['normal'], {'train_size': 'train_ratio', 'shuffle': 'shuffle'}), '(normal, train_size=train_ratio, shuffle=shuffle)\n', (1200, 1249), False, 'from sklearn.model_selection import train_test_split\n'), ((1294, 1361), 'sklearn.model_selectio... |
from flask import Flask, request, redirect, url_for, render_template
from ghost_jukebox import app, basic_auth, common, conf
from ghost_jukebox.models import info, card
import math
import os
from PIL import Image, ImageDraw, ImageFont
"""
Cards
Cards are the backbone of the Ghost Jukebox. They are the analog of Re... | [
"PIL.Image.new",
"flask.request.form.get",
"ghost_jukebox.app.route",
"ghost_jukebox.models.card.get_largest_code",
"ghost_jukebox.models.card.get_all_sorted",
"flask.url_for",
"ghost_jukebox.common.random_string",
"os.path.join",
"flask.request.args.get",
"ghost_jukebox.common.save_file",
"ghos... | [((2979, 3004), 'ghost_jukebox.app.route', 'app.route', (['"""/s//QR<code>"""'], {}), "('/s//QR<code>')\n", (2988, 3004), False, 'from ghost_jukebox import app, basic_auth, common, conf\n'), ((3736, 3766), 'ghost_jukebox.app.route', 'app.route', (['"""/s//play/QR<code>"""'], {}), "('/s//play/QR<code>')\n", (3745, 3766)... |
from __future__ import division
from itertools import combinations
from collections import Counter
class Omega(object):
def __init__(self, comms1, comms2):
self.nodes1 = self.get_node_assignment(comms1)
self.nodes2 = self.get_node_assignment(comms2)
self.nodes = list(set().union([node for... | [
"itertools.combinations"
] | [((1576, 1603), 'itertools.combinations', 'combinations', (['self.nodes', '(2)'], {}), '(self.nodes, 2)\n', (1588, 1603), False, 'from itertools import combinations\n'), ((1853, 1880), 'itertools.combinations', 'combinations', (['self.nodes', '(2)'], {}), '(self.nodes, 2)\n', (1865, 1880), False, 'from itertools import... |
import os
import sys
sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '../..'))
from utils.general_class import ModelPlugin
from utils.ortools_op import SolveMaxMatching
from utils.visual_op import matrix_image2big_image
from utils.writer_op import write_pkl, write_gif
from utils.tqdm_op import... | [
"tensorflow.trainable_variables",
"tensorflow.get_collection",
"tensorflow.reset_default_graph",
"utils.eval_op.DisentanglemetricFactorMask",
"os.path.dirname",
"tensorflow.set_random_seed",
"tfops.transform_op.apply_tf_op_multi_output",
"tensorflow.placeholder",
"tensorflow.losses.get_regularizatio... | [((1050, 1074), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (1072, 1074), True, 'import tensorflow as tf\n'), ((1083, 1118), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['self.args.rseed'], {}), '(self.args.rseed)\n', (1101, 1118), True, 'import tensorflow as tf\n'), ((1142, 1... |
import unittest
from scrapy.item import Item, Field
import six
class ItemTest(unittest.TestCase):
def assertSortedEqual(self, first, second, msg=None):
return self.assertEqual(sorted(first), sorted(second), msg)
def test_simple(self):
class TestItem(Item):
name = Field()
... | [
"unittest.main",
"scrapy.item.Field"
] | [((4239, 4254), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4252, 4254), False, 'import unittest\n'), ((305, 312), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (310, 312), False, 'from scrapy.item import Item, Field\n'), ((485, 492), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (490, 492), False, 'from s... |
# emacs: -*- mode: python-mode; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the NiBabel package for the
# copyright and license terms.
#
### ### ### #... | [
"os.path.splitext"
] | [((1786, 1803), 'os.path.splitext', 'splitext', (['fileish'], {}), '(fileish)\n', (1794, 1803), False, 'from os.path import splitext\n')] |