code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
try:
from MicropythonGitDeploy.HTTPClient import HTTPClient
from MicropythonGitDeploy.GitHubClient import GitHubClient
from MicropythonGitDeploy.LoPyFileSaver import LoPyFileSaver
except:
#this to make sure it works with main.py in this library for testing
from HTTPClient import HTTPClient
from ... | [
"machine.reset",
"HTTPClient.HTTPClient",
"GitHubClient.GitHubClient"
] | [((726, 783), 'HTTPClient.HTTPClient', 'HTTPClient', (['"""api.github.com"""', 'secrets.basicAuthentication'], {}), "('api.github.com', secrets.basicAuthentication)\n", (736, 783), False, 'from HTTPClient import HTTPClient\n'), ((801, 846), 'GitHubClient.GitHubClient', 'GitHubClient', (['c', 'self.username', 'self.repo... |
import mlbriefcase
import pytest
import os
import json
import logging
@pytest.fixture
def test_subdir():
# change to tests/ subdir so we can resolve the yaml
os.chdir(os.path.dirname(os.path.abspath(__file__)))
@pytest.mark.skipif(os.environ.get('myserviceprincipal2') is None,
reason='Env... | [
"mlbriefcase.Briefcase",
"os.environ.get",
"os.path.abspath"
] | [((509, 532), 'mlbriefcase.Briefcase', 'mlbriefcase.Briefcase', ([], {}), '()\n', (530, 532), False, 'import mlbriefcase\n'), ((241, 278), 'os.environ.get', 'os.environ.get', (['"""myserviceprincipal2"""'], {}), "('myserviceprincipal2')\n", (255, 278), False, 'import os\n'), ((192, 217), 'os.path.abspath', 'os.path.abs... |
import os
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
version = '1.13.dev0'
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
class PyTest(TestCommand):
user_options = [('pytest-args=', 'a', "Arguments to... | [
"setuptools.setup",
"os.path.dirname",
"pytest.main",
"setuptools.command.test.test.finalize_options",
"os.path.join",
"setuptools.command.test.test.initialize_options",
"sys.exit"
] | [((713, 1670), 'setuptools.setup', 'setup', ([], {'name': '"""pylogctx"""', 'version': 'version', 'description': '"""Adding context to log records"""', 'long_description': 'README', 'classifiers': "['Intended Audience :: Developers', 'Programming Language :: Python',\n 'Programming Language :: Python :: 2',\n 'Pr... |
import pprint
from django.conf import settings
from django.contrib.auth import get_user_model
from devilry.devilry_account.models import UserName, UserEmail
from devilry.devilry_import_v2database import modelimporter
class UserImporter(modelimporter.ModelImporter):
def get_model_class(self):
return get_... | [
"devilry.devilry_account.models.UserEmail",
"pprint.pformat",
"django.contrib.auth.get_user_model",
"devilry.devilry_account.models.UserName"
] | [((316, 332), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (330, 332), False, 'from django.contrib.auth import get_user_model\n'), ((476, 531), 'devilry.devilry_account.models.UserName', 'UserName', ([], {'user': 'user', 'username': 'username', 'is_primary': '(True)'}), '(user=user, usernam... |
"""
Module entry
Usage:
$ python -m tableconverter <args>
"""
import tableconverter
if __name__ == "__main__":
tableconverter.main()
| [
"tableconverter.main"
] | [((122, 143), 'tableconverter.main', 'tableconverter.main', ([], {}), '()\n', (141, 143), False, 'import tableconverter\n')] |
import random
import socket
max_PrimLength = 1000000000000
def egcd(a, b):
if a == 0:
return (b, 0, 1)
else:
g, y, x = egcd(b % a, a)
return (g, x - (b // a) * y, y)
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
'''
checks if a number is a pr... | [
"random.randint"
] | [((998, 1020), 'random.randint', 'random.randint', (['(1)', 'phi'], {}), '(1, phi)\n', (1012, 1020), False, 'import random\n'), ((627, 660), 'random.randint', 'random.randint', (['(0)', 'max_PrimLength'], {}), '(0, max_PrimLength)\n', (641, 660), False, 'import random\n'), ((1074, 1096), 'random.randint', 'random.randi... |
from .base import BaseResource
import simplejson
class WorkerResource(BaseResource):
isLeaf = True
def __init__(self, workerserver):
self.workerserver = workerserver
BaseResource.__init__(self)
def render(self, request):
request.setHeader('Content-type', 'text/javascri... | [
"simplejson.dumps"
] | [((556, 578), 'simplejson.dumps', 'simplejson.dumps', (['data'], {}), '(data)\n', (572, 578), False, 'import simplejson\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from tvm import te
def schedule_branch(attrs, output, prefix):
cfg, s = attrs.auto_config, attrs.scheduler
th_vals = [attrs.get_extent(x) for x in output.op.axis]
# Normal Schedule Plan
blocks = [te.thread_axis('blockIdx.x'), te.thread_... | [
"tvm.te.thread_axis"
] | [((280, 308), 'tvm.te.thread_axis', 'te.thread_axis', (['"""blockIdx.x"""'], {}), "('blockIdx.x')\n", (294, 308), False, 'from tvm import te\n'), ((310, 338), 'tvm.te.thread_axis', 'te.thread_axis', (['"""blockIdx.y"""'], {}), "('blockIdx.y')\n", (324, 338), False, 'from tvm import te\n'), ((340, 368), 'tvm.te.thread_a... |
# -*- coding:utf-8 -*-
# &Author AnFany
# 自适应优化绘制决策树程序
# 绘制决策图主要包括四部分
# 1,确定每一个节点展示的内容(内部节点展示,节点名称,类别比例,分类特征,本节点的结果, 叶子节点没有分类特征的内容)
# 2,确定每一个节点的位置(垂直方向平均分配,水平方向按照这一层的节点个数平均分配)
# 3,确定节点之间的连线
# 4,展示连线的内容(分类规则以及分分割值)
# 5,内部节点,子节点以不用的颜色展示,对给出图例
# 根据所有节点的数据集、所有节点的结果、所有节点的规则、剪枝后代表着树的节点关系绘制树
from pylab im... | [
"matplotlib.pyplot.subplots",
"AnFany_DT_Classify.DT",
"matplotlib.pyplot.show"
] | [((4903, 4937), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(huab, huab)'}), '(figsize=(huab, huab))\n', (4915, 4937), True, 'import matplotlib.pyplot as plt\n'), ((6781, 6791), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (6789, 6791), True, 'import matplotlib.pyplot as plt\n'), ((6878, ... |
def voto(vote):
"""
=================================================================
:year: = coleta o data do pc
=================================================================
:idade: = calcula a idade com base na data do pc e comando(vote)
Ex: voto(2000)
idade = year - 2... | [
"datetime.date.today"
] | [((673, 685), 'datetime.date.today', 'date.today', ([], {}), '()\n', (683, 685), False, 'from datetime import date\n')] |
# coding=utf-8
"""Parser for ClassScript"""
from typing import cast
import os
from modelscript.base.grammars import (
ASTNodeSourceIssue)
from modelscript.base.issues import (
Levels)
from modelscript.base.exceptions import (
UnexpectedCase)
from modelscript.metamodels.classes import (
ClassModel,
... | [
"modelscript.metamodels.classes.associations.PlainAssociation",
"modelscript.scripts.textblocks.parser.astTextBlockToTextBlock",
"typing.cast",
"modelscript.metamodels.classes.Package",
"os.path.realpath",
"modelscript.metamodels.classes.types.DataType",
"modelscript.metamodels.classes.invariants.OCLInv... | [((23998, 24040), 'modelscript.metamodels.classes.METAMODEL.registerSource', 'METAMODEL.registerSource', (['ClassModelSource'], {}), '(ClassModelSource)\n', (24022, 24040), False, 'from modelscript.metamodels.classes import ClassModel, Package, METAMODEL\n'), ((2603, 2631), 'typing.cast', 'cast', (['ClassModel', 'self.... |
import torch
from models import C51Model
from .base_agent import BaseAgent
class C51(BaseAgent):
def __init__(self, **configs):
super(C51, self).__init__(**configs)
self.n_atoms = self.configs["n_atoms"]
self.v_min = self.configs["v_min"]
self.v_max = self.configs["v_max"]
... | [
"torch.argmax",
"models.C51Model",
"torch.linspace",
"torch.no_grad",
"torch.log"
] | [((1864, 1879), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1877, 1879), False, 'import torch\n'), ((2115, 2149), 'torch.argmax', 'torch.argmax', (['next_qvalues'], {'dim': '(-1)'}), '(next_qvalues, dim=-1)\n', (2127, 2149), False, 'import torch\n'), ((333, 385), 'torch.linspace', 'torch.linspace', (['self.v_m... |
# ===============
# DPjudge package
# ===============
import os
os.sys.path[:0] = [os.path.dirname(os.path.abspath(os.sys.argv[0])) + '/..']
import host
from Game import Game, Power, Mail, Status
try: host.packageDir
except: host.packageDir = __path__[0]
try: host.dpjudgeDir
except: host.dpjudgeDir ... | [
"os.path.abspath",
"telnetlib.Telnet"
] | [((109, 140), 'os.path.abspath', 'os.path.abspath', (['os.sys.argv[0]'], {}), '(os.sys.argv[0])\n', (124, 140), False, 'import os\n'), ((1030, 1064), 'telnetlib.Telnet', 'telnetlib.Telnet', (['*host.ntpService'], {}), '(*host.ntpService)\n', (1046, 1064), False, 'import telnetlib, time\n')] |
#!/usr/bin/env python3
from adventlib import readchunks
from pathlib import Path
fields = {
'byr',
'iyr',
'eyr',
'hgt',
'hcl',
'ecl',
'pid',
}
def main():
valid = 0
with Path('input', '4').open() as f:
for chunk in readchunks(f):
p = {}
for l in chu... | [
"adventlib.readchunks",
"pathlib.Path"
] | [((262, 275), 'adventlib.readchunks', 'readchunks', (['f'], {}), '(f)\n', (272, 275), False, 'from adventlib import readchunks\n'), ((209, 227), 'pathlib.Path', 'Path', (['"""input"""', '"""4"""'], {}), "('input', '4')\n", (213, 227), False, 'from pathlib import Path\n')] |
from typing import List
from fastapi import HTTPException
from starlette.status import (
HTTP_403_FORBIDDEN
)
from app.models.user import UserRole
def check_permission(roles: List[UserRole], required_role_value: str):
return next((True for role in roles if role.value == required_role_value), False)
def check... | [
"fastapi.HTTPException"
] | [((490, 602), 'fastapi.HTTPException', 'HTTPException', ([], {'status_code': 'HTTP_403_FORBIDDEN', 'detail': '"""The user doesn\'t have permission to use this method"""'}), '(status_code=HTTP_403_FORBIDDEN, detail=\n "The user doesn\'t have permission to use this method")\n', (503, 602), False, 'from fastapi import ... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
from telemetry.testing import test_page_test_results
from telemetry.timeline import slice as slice_module
from telemetry.timeline import mod... | [
"telemetry.timeline.model.TimelineModel",
"telemetry.web_perf.metrics.v8_execution.V8ExecutionMetric",
"telemetry.testing.test_page_test_results.TestPageTestResults",
"telemetry.timeline.slice.Slice"
] | [((1468, 1496), 'telemetry.timeline.model.TimelineModel', 'model_module.TimelineModel', ([], {}), '()\n', (1494, 1496), True, 'from telemetry.timeline import model as model_module\n'), ((1872, 1904), 'telemetry.web_perf.metrics.v8_execution.V8ExecutionMetric', 'v8_execution.V8ExecutionMetric', ([], {}), '()\n', (1902, ... |
import inquirer
from splitcli.ux import text
# Logging
def print_logo():
print(text.split_logo())
def error_message(message):
print(text.colored(message,"red"))
def info_message(message):
print(text.colored(message,"split_blue_light"))
def success_message(message):
print(text.colored(message,"spli... | [
"splitcli.ux.text.split_logo",
"inquirer.Text",
"inquirer.Checkbox",
"inquirer.prompt",
"splitcli.ux.text.colored",
"splitcli.ux.text.inquirer_theme",
"inquirer.Password"
] | [((879, 918), 'inquirer.prompt', 'inquirer.prompt', (['questions'], {'theme': 'theme'}), '(questions, theme=theme)\n', (894, 918), False, 'import inquirer\n'), ((1052, 1091), 'inquirer.prompt', 'inquirer.prompt', (['questions'], {'theme': 'theme'}), '(questions, theme=theme)\n', (1067, 1091), False, 'import inquirer\n'... |
import os
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from flask_login import LoginManager
app = Flask(__name__)
app.config.from_object('src.default_settings')
if 'LOCAL_SETTINGS' in os.environ:
app.config.from_envvar('LOCAL_SETTINGS')
db = SQLAlchemy(app)
login_manager = LoginManager()
logi... | [
"flask_sqlalchemy.SQLAlchemy",
"flask_login.LoginManager",
"flask.Flask"
] | [((119, 134), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from flask import Flask\n'), ((268, 283), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (278, 283), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((301, 315), 'flask_login.LoginManager', 'LoginM... |
import json
import logging
from flask import Flask, jsonify, request
# import requests
from flask_cors import CORS
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm.attributes import QueryableAttribute
# AUTH CHANGES
# - 1. add module imports
# - 2. ensure firebase user.token is transfered from client in h... | [
"google.auth.transport.requests.Request",
"flask.request.headers.get",
"flask_cors.CORS",
"flask.Flask",
"json.dumps",
"flask_sqlalchemy.SQLAlchemy"
] | [((545, 560), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (550, 560), False, 'from flask import Flask, jsonify, request\n'), ((561, 570), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (565, 570), False, 'from flask_cors import CORS\n'), ((807, 822), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([... |
import numpy as np
import re
def extract(filename1,filename2):
input_file = open(filename1)
output_file = open(filename2)
data = input_file.readlines()
out_data = output_file.readlines()
"""
Number of training data records
"""
ntrain = int(data[0].split()[0])
traindata = data[1... | [
"numpy.array",
"re.sub"
] | [((770, 788), 'numpy.array', 'np.array', (['features'], {}), '(features)\n', (778, 788), True, 'import numpy as np\n'), ((819, 835), 'numpy.array', 'np.array', (['labels'], {}), '(labels)\n', (827, 835), True, 'import numpy as np\n'), ((1115, 1138), 'numpy.array', 'np.array', (['test_features'], {}), '(test_features)\n... |
from statue.command import Command
from tests.constants import COMMAND1
def test_simple_command_init():
command = Command(name=COMMAND1)
assert command.name == COMMAND1
assert command.args == []
def test_command_init_with_args():
args = ["a", "b", "c", "D"]
command = Command(name=COMMAND1, args=... | [
"statue.command.Command"
] | [((120, 142), 'statue.command.Command', 'Command', ([], {'name': 'COMMAND1'}), '(name=COMMAND1)\n', (127, 142), False, 'from statue.command import Command\n'), ((292, 325), 'statue.command.Command', 'Command', ([], {'name': 'COMMAND1', 'args': 'args'}), '(name=COMMAND1, args=args)\n', (299, 325), False, 'from statue.co... |
import json
import pickle
import numpy as np
__locations = None
__model = None
__data_columns = None
def get_estimated_price(location,sqft,bhk,bath):
try:
loc_index = __data_columns.index(location.lower())
except:
loc_index=-1
X=np.zeros(len(__data_columns))
X[0]=sqft
X[1]= bath
... | [
"pickle.load",
"json.load"
] | [((880, 894), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (891, 894), False, 'import pickle\n'), ((700, 712), 'json.load', 'json.load', (['f'], {}), '(f)\n', (709, 712), False, 'import json\n')] |
from __future__ import absolute_import, unicode_literals
import os
from celery import Celery
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'projects.settings')
app = Celery('projects')
app.config_from_object('django.conf:settings', namespace='CELERY')
app.autodiscover_tasks()
# celery -A <module> worker -l i... | [
"celery.Celery",
"os.environ.setdefault"
] | [((98, 166), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""projects.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'projects.settings')\n", (119, 166), False, 'import os\n'), ((174, 192), 'celery.Celery', 'Celery', (['"""projects"""'], {}), "('projects')\n", (180, 192), False,... |
import cv2
import numpy as np
import copy
import imgaug.augmenters as iaa
from . import pallete_aug as pa
def pallete_augmentation(img, img_data, config):
if config.pallete:
csv_path = img_data['csvpath']
#Exception none value.
if csv_path is None or '':
print("CSV path is {}".f... | [
"imgaug.augmenters.SomeOf",
"imgaug.augmenters.KMeansColorQuantization",
"numpy.random.randint",
"imgaug.augmenters.LogContrast",
"imgaug.augmenters.AllChannelsHistogramEqualization",
"imgaug.augmenters.GammaContrast",
"numpy.transpose",
"numpy.random.choice",
"copy.deepcopy",
"imgaug.augmenters.L... | [((1351, 1374), 'copy.deepcopy', 'copy.deepcopy', (['img_data'], {}), '(img_data)\n', (1364, 1374), False, 'import copy\n'), ((1403, 1439), 'cv2.imread', 'cv2.imread', (["img_data_aug['filepath']"], {}), "(img_data_aug['filepath'])\n", (1413, 1439), False, 'import cv2\n'), ((4948, 4998), 'imgaug.augmenters.SomeOf', 'ia... |
# Copyright 2020 TalentedSoft ( Author: <NAME> )
import os
import soundfile
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
from tensorflow_asr.configs.config import Config
from scripts.visual import load_signal
sample_rate=16000
config_dir = "scripts/augment/config_augment.yml"
file_path="/work/kaldi/egs/XSP/TensorFlo... | [
"os.makedirs",
"tensorflow_asr.configs.config.Config",
"scripts.visual.load_signal",
"os.path.exists",
"soundfile.write"
] | [((468, 501), 'tensorflow_asr.configs.config.Config', 'Config', (['config_dir'], {'learning': '(True)'}), '(config_dir, learning=True)\n', (474, 501), False, 'from tensorflow_asr.configs.config import Config\n'), ((400, 427), 'os.path.exists', 'os.path.exists', (['output_path'], {}), '(output_path)\n', (414, 427), Fals... |
# encoding: utf-8
import time
import torch
import random
import torchvision
from collections import OrderedDict
# from engine.logger import get_logger
# logger = logging.getLogger()
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.o... | [
"random.uniform",
"torch.load",
"torchvision.transforms.functional.pad",
"time.time",
"torchvision.transforms.RandomResizedCrop.get_params",
"torchvision.transforms.functional.crop",
"collections.OrderedDict",
"torchvision.transforms.Resize"
] | [((660, 671), 'time.time', 'time.time', ([], {}), '()\n', (669, 671), False, 'import time\n'), ((944, 955), 'time.time', 'time.time', ([], {}), '()\n', (953, 955), False, 'import time\n'), ((1330, 1341), 'time.time', 'time.time', ([], {}), '()\n', (1339, 1341), False, 'import time\n'), ((779, 801), 'torch.load', 'torch... |
from rackio_AI import RackioAI, Preprocessing
from rackio import Rackio
app = Rackio()
RackioAI(app)
preprocess1 = Preprocessing(name='Preprocess1', description='preprocess for data', problem_type='regression')
preprocess2 = Preprocessing(name='Preprocess2', description='preprocess for data', problem_type='classifi... | [
"rackio_AI.RackioAI.summary",
"rackio_AI.RackioAI",
"rackio.Rackio",
"rackio_AI.RackioAI.append_preprocessing_model",
"rackio_AI.Preprocessing"
] | [((79, 87), 'rackio.Rackio', 'Rackio', ([], {}), '()\n', (85, 87), False, 'from rackio import Rackio\n'), ((89, 102), 'rackio_AI.RackioAI', 'RackioAI', (['app'], {}), '(app)\n', (97, 102), False, 'from rackio_AI import RackioAI, Preprocessing\n'), ((118, 217), 'rackio_AI.Preprocessing', 'Preprocessing', ([], {'name': '... |
from datetime import timedelta
import os
from ._backend import Backend
from ..utils import condense_ids
class GridEngineBackend(Backend):
def __init__(self):
super().__init__()
self.name = 'gridengine'
self.task_id_var = r'$SGE_TASK_ID'
def generate_tasklist(self, commands):
i... | [
"os.path.join",
"datetime.timedelta"
] | [((3045, 3104), 'os.path.join', 'os.path.join', (['log_dir', '"""\\\\$JOB_NAME_\\\\$JOB_ID_\\\\$TASK_ID.o"""'], {}), "(log_dir, '\\\\$JOB_NAME_\\\\$JOB_ID_\\\\$TASK_ID.o')\n", (3057, 3104), False, 'import os\n'), ((3176, 3235), 'os.path.join', 'os.path.join', (['log_dir', '"""\\\\$JOB_NAME_\\\\$JOB_ID_\\\\$TASK_ID.e"""... |
import random
from flask import Flask, render_template
from werkzeug.local import LocalStack, LocalProxy
from ext import db
from users import User
app = Flask(__name__)
app.config.from_object('config')
db.init_app(app)
_user_stack = LocalStack()
def get_current_user():
top = _user_stack.top
if top is None... | [
"ext.db.create_all",
"users.User.query.all",
"ext.db.session.add_all",
"users.User",
"flask.Flask",
"random.choice",
"ext.db.session.remove",
"ext.db.session.commit",
"werkzeug.local.LocalStack",
"werkzeug.local.LocalProxy",
"flask.render_template",
"ext.db.session.rollback",
"ext.db.init_ap... | [((156, 171), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'from flask import Flask, render_template\n'), ((205, 221), 'ext.db.init_app', 'db.init_app', (['app'], {}), '(app)\n', (216, 221), False, 'from ext import db\n'), ((237, 249), 'werkzeug.local.LocalStack', 'LocalStack', ([], {}... |
'''
Main function for get global500
Author: Sunic
For: Champagne
'''
import openpyxl
from get_data_global500 import get_data_global500
from get_industry_cat import get_industry_cat
from write_excel import write_excel
def main():
root_url = 'https://www.caifuzhongwen.com/fortune500/paiming/global500/2021_... | [
"get_industry_cat.get_industry_cat",
"get_data_global500.get_data_global500",
"write_excel.write_excel"
] | [((417, 443), 'get_industry_cat.get_industry_cat', 'get_industry_cat', (['root_url'], {}), '(root_url)\n', (433, 443), False, 'from get_industry_cat import get_industry_cat\n'), ((465, 493), 'get_data_global500.get_data_global500', 'get_data_global500', (['root_url'], {}), '(root_url)\n', (483, 493), False, 'from get_d... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self, drop=0.025, norm='bn', num_groups=4):
"""
Input Param -->
. norm:- (normalization technique to be used)
'bn': Batch Normalization
'gn'... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.GroupNorm",
"torch.nn.functional.log_softmax",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d"
] | [((1407, 1425), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)', '(2)'], {}), '(2, 2)\n', (1419, 1425), True, 'import torch.nn as nn\n'), ((3346, 3370), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['x'], {'dim': '(-1)'}), '(x, dim=-1)\n', (3359, 3370), True, 'import torch.nn.functional as F\n'), ((867, 954), 'to... |
from django.forms import model_to_dict
from rest_framework.decorators import api_view
from rest_framework.utils import json
from .models import User, History,Match,Book
from django.http import JsonResponse
@api_view(['GET'])
def index_match(request): # WORKS
if "user" in request.session:
history = History... | [
"rest_framework.decorators.api_view",
"django.forms.model_to_dict",
"django.http.JsonResponse"
] | [((209, 226), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (217, 226), False, 'from rest_framework.decorators import api_view\n'), ((1677, 1694), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1685, 1694), False, 'from rest_framework.decorator... |
#
# Jasy - Web Tooling Framework
# Copyright 2010-2012 Zynga Inc.
# Copyright 2013-2014 <NAME>
#
"""This module is used to pass a single session instance around to different modules."""
import jasy.core.Session as Session
__all__ = ("session")
session = Session.Session()
session.__doc__ = """Auto initialized sessio... | [
"jasy.core.Session.Session"
] | [((258, 275), 'jasy.core.Session.Session', 'Session.Session', ([], {}), '()\n', (273, 275), True, 'import jasy.core.Session as Session\n')] |
#!/usr/bin/env python
#from distutils.core import setup
from setuptools import setup
import subprocess
import os
import platform
import re
def get_pi_version():
pi_versions = {
"0002" : "Model B Revision 1.0",
"0003" : "Model B Revision 1.0",
"0004" : "Model B Revision 2.0",
"0005" : "Model B Revision 2.0", ... | [
"subprocess.Popen",
"setuptools.setup",
"os.uname",
"platform.platform",
"os.geteuid",
"re.search"
] | [((818, 903), 're.search', 're.search', (['"""^Hardware\\\\s+:\\\\s+(\\\\w+)$"""', 'info'], {'flags': '(re.MULTILINE | re.IGNORECASE)'}), "('^Hardware\\\\s+:\\\\s+(\\\\w+)$', info, flags=re.MULTILINE | re.IGNORECASE\n )\n", (827, 903), False, 'import re\n'), ((902, 987), 're.search', 're.search', (['"""^Revision\\\\... |
#
# Copyright 2019 Delphix
#
# 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, so... | [
"tests.MOCK_PROGRAM.type",
"pytest.raises",
"tests.invoke",
"drgn.Object"
] | [((1393, 1425), 'tests.invoke', 'invoke', (['MOCK_PROGRAM', 'objs', 'line'], {}), '(MOCK_PROGRAM, objs, line)\n', (1399, 1425), False, 'from tests import invoke, MOCK_PROGRAM\n'), ((1829, 1861), 'tests.invoke', 'invoke', (['MOCK_PROGRAM', 'objs', 'line'], {}), '(MOCK_PROGRAM, objs, line)\n', (1835, 1861), False, 'from ... |
from .. import config, toolchain, utility
from six.moves import cStringIO as StringIO
from .utility import handle_program_errors, unrst
import argparse, os, pydoc, sys
PROGRAM_NAME = 'sprite-make'
__all__ = ['main']
__doc__ = '''\
Executes the toolchain to compile Curry code.
This program uses timestamps and prerequ... | [
"six.moves.cStringIO",
"argparse.ArgumentParser",
"pydoc.getpager",
"sys.stderr.write",
"sys.exit"
] | [((3531, 3607), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'program_name', 'description': '"""Make ICurry files."""'}), "(prog=program_name, description='Make ICurry files.')\n", (3554, 3607), False, 'import argparse, os, pydoc, sys\n'), ((5215, 5225), 'six.moves.cStringIO', 'StringIO', ([], {}... |
#https://www.hackerrank.com/challenges/interchange-two-numbers
import fileinput
#Input
a, b = fileinput.input()
#Solve
a, b = (b, a)
#Output
print(a)
print(b) | [
"fileinput.input"
] | [((95, 112), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (110, 112), False, 'import fileinput\n')] |
# -*- coding: utf-8 -*-
import transaction
import sqlalchemy as sa
from pyjobsweb.lib.time import base_time
from pyjobsweb.model import DeclarativeBase, DBSession
from pyjobsweb.model.elasticsearch_model.company import Company \
as CompanyElastic
class Company(DeclarativeBase):
__tablename__ = 'companies'
... | [
"transaction.commit",
"sqlalchemy.DateTime",
"sqlalchemy.func.now",
"sqlalchemy.func.current_timestamp",
"pyjobsweb.lib.time.base_time",
"transaction.begin",
"pyjobsweb.model.DBSession.query",
"sqlalchemy.Text",
"sqlalchemy.Column",
"sqlalchemy.String"
] | [((1137, 1188), 'sqlalchemy.Column', 'sa.Column', (['sa.Boolean'], {'nullable': '(False)', 'default': '(True)'}), '(sa.Boolean, nullable=False, default=True)\n', (1146, 1188), True, 'import sqlalchemy as sa\n'), ((1340, 1388), 'sqlalchemy.Column', 'sa.Column', (['sa.Float'], {'nullable': '(False)', 'default': '(0.0)'})... |
import numpy as np
from colearning.game import Player
class BasePlayer(Player):
"""docstring for BasePlayer"""
#----Fields
team = None
individual_id = None
def initialize_player(self, team, individual_id):
""" Setup the player's external attributes """
self.team = team
se... | [
"numpy.zeros"
] | [((649, 660), 'numpy.zeros', 'np.zeros', (['(5)'], {}), '(5)\n', (657, 660), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
"""Test mspray.apps.main.tasks module.
"""
from unittest.mock import patch
from mspray.apps.main.models import Mobilisation, SensitizationVisit, SprayDay
from mspray.apps.main.tasks import (
fetch_mobilisation,
fetch_sensitization_visits,
link_spraypoint_with_osm,
run_tasks_afte... | [
"mspray.apps.main.tasks.fetch_sensitization_visits",
"mspray.apps.main.models.SensitizationVisit.objects.count",
"mspray.apps.main.tests.test_base.TestBase.setUp",
"mspray.celery.app.conf.update",
"mspray.apps.main.models.SprayDay.objects.get",
"mspray.apps.main.models.Mobilisation.objects.count",
"unit... | [((4666, 4711), 'unittest.mock.patch', 'patch', (['"""mspray.apps.main.tasks.fetch_osm_xml"""'], {}), "('mspray.apps.main.tasks.fetch_osm_xml')\n", (4671, 4711), False, 'from unittest.mock import patch\n'), ((5142, 5187), 'unittest.mock.patch', 'patch', (['"""mspray.apps.main.tasks.user_distance"""'], {}), "('mspray.ap... |
#!/usr/bin/python3
import click
from math import log, pi
def BoilingTime(m, t0, t1, e, r=2 / 3):
"""returns the boiling time [s] for the egg
m: mass [g]
t0: egg temperature at time 0
t1: target egg temperature
e: elevation [m]
r: fraction of yolk compared to egg mass
A... | [
"math.log",
"click.option",
"click.command"
] | [((1331, 1346), 'click.command', 'click.command', ([], {}), '()\n', (1344, 1346), False, 'import click\n'), ((1348, 1414), 'click.option', 'click.option', (['"""-m"""', '"""--mass"""', '"""m"""'], {'default': '(70)', 'help': '"""Egg mass [g]"""'}), "('-m', '--mass', 'm', default=70, help='Egg mass [g]')\n", (1360, 1414... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# =============================================================================
# Ural LRUTrie Unit Tests
# =============================================================================
from ural.lru import LRUTrie, NormalizedLRUTrie
class TestNormalizedLRUTrie(object):
... | [
"ural.lru.LRUTrie",
"ural.lru.NormalizedLRUTrie"
] | [((363, 372), 'ural.lru.LRUTrie', 'LRUTrie', ([], {}), '()\n', (370, 372), False, 'from ural.lru import LRUTrie, NormalizedLRUTrie\n'), ((1152, 1171), 'ural.lru.NormalizedLRUTrie', 'NormalizedLRUTrie', ([], {}), '()\n', (1169, 1171), False, 'from ural.lru import LRUTrie, NormalizedLRUTrie\n'), ((2055, 2064), 'ural.lru.... |
import pickle
import logging
import numpy as np
import torch
import models
import utils
logger = logging.getLogger()
class BaseExperiment():
def __init__(self, args):
self.save_dir = args.save_dir
self.burn_in_steps = args.burn_in_steps
self.eval_freq = args.eval_freq
self.cpu =... | [
"pickle.dump",
"utils.DataLoader",
"utils.DataSampler",
"torch.load",
"utils.add_log",
"numpy.random.permutation",
"utils.get_dataset",
"utils.IndexBatchSampler",
"logging.getLogger"
] | [((100, 119), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (117, 119), False, 'import logging\n'), ((780, 811), 'utils.get_dataset', 'utils.get_dataset', (['args.dataset'], {}), '(args.dataset)\n', (797, 811), False, 'import utils\n'), ((1031, 1091), 'utils.DataSampler', 'utils.DataSampler', (['self.trai... |
import sys
import logging
import itertools
import operator
from cyvcf2 import VCF, Writer
from collections import defaultdict
import collections
import gc
import math
from sys import getsizeof, stderr
import numpy as np
from difflib import SequenceMatcher
#reads a VCF file and extracts the haplotype information, bo... | [
"cyvcf2.VCF"
] | [((1401, 1425), 'cyvcf2.VCF', 'VCF', (['ref_file'], {'lazy': '(True)'}), '(ref_file, lazy=True)\n', (1404, 1425), False, 'from cyvcf2 import VCF, Writer\n')] |
import numpy as np
import cv2
import logging
from .utils.localization import LocResult
class CppLocalization:
def __init__(self, db_ids, local_db, global_descriptors, images, points):
import _hloc_cpp
self.hloc = _hloc_cpp.HLoc()
id_to_idx = {}
old_to_new_kpt = {}
for idx... | [
"_hloc_cpp.HLoc",
"logging.info",
"numpy.where",
"numpy.array",
"numpy.eye"
] | [((236, 252), '_hloc_cpp.HLoc', '_hloc_cpp.HLoc', ([], {}), '()\n', (250, 252), False, 'import _hloc_cpp\n'), ((1628, 1680), 'logging.info', 'logging.info', (['"""Localizing image %s"""', 'query_info.name'], {}), "('Localizing image %s', query_info.name)\n", (1640, 1680), False, 'import logging\n'), ((2124, 2133), 'num... |
import scipy.optimize as so
import numpy as np
import scipy as sp
import scipy.io as sio
import os
import sys
import matplotlib.pyplot as plt
localSize = 200
diagAdd = 0
maxIte = localSize
if len(sys.argv) > 1:
localSize = sys.argv[1]
if len(sys.argv) > 2:
diagAdd = sys.argv[2]
if len(sys.argv) > 3:
maxIt... | [
"matplotlib.pyplot.loglog",
"scipy.optimize.minimize",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.genfromtxt",
"os.system",
"scipy.io.mmread",
"scipy.optimize.Bounds",
"numpy.linalg.norm",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.xlabel",
... | [((572, 600), 'scipy.io.mmread', 'sio.mmread', (['"""Amat_TCMAT.mtx"""'], {}), "('Amat_TCMAT.mtx')\n", (582, 600), True, 'import scipy.io as sio\n'), ((1039, 1056), 'scipy.optimize.Bounds', 'so.Bounds', (['lb', 'ub'], {}), '(lb, ub)\n', (1048, 1056), True, 'import scipy.optimize as so\n'), ((1063, 1142), 'scipy.optimiz... |
"""
dev settings
"""
import os
def set_env(var, val):
"""
Set a default for an environment variable. Allows for override of
production settings while still giving preference to existing
environment variables.
"""
os.environ.setdefault(var, val)
set_env('SECRET_KEY', '<KEY>')
set_env('DB_NAM... | [
"os.environ.setdefault"
] | [((240, 271), 'os.environ.setdefault', 'os.environ.setdefault', (['var', 'val'], {}), '(var, val)\n', (261, 271), False, 'import os\n')] |
import plistlib
import sys
import os
import time
import Downloader
import subprocess
# Python-aware urllib stuff
if sys.version_info >= (3, 0):
from urllib.request import urlopen
else:
from urllib2 import urlopen
class WebDriver:
def __init__(self):
self.dl = Downloader.Downloader()
if os.... | [
"os.mkdir",
"subprocess.Popen",
"os.getcwd",
"plistlib.readPlist",
"os.path.realpath",
"os.path.exists",
"os.system",
"time.sleep",
"plistlib.readPlistFromString",
"Downloader.Downloader",
"os.chdir",
"plistlib.loads"
] | [((282, 305), 'Downloader.Downloader', 'Downloader.Downloader', ([], {}), '()\n', (303, 305), False, 'import Downloader\n'), ((317, 381), 'os.path.exists', 'os.path.exists', (['"""/System/Library/Extensions/NVDAStartupWeb.kext"""'], {}), "('/System/Library/Extensions/NVDAStartupWeb.kext')\n", (331, 381), False, 'import... |
import pytest
import numpy as np
from scipy.ndimage import gaussian_filter1d
import astropy.units as u
from astropy.utils.data import download_file
from astropy.tests.helper import assert_quantity_allclose
from ..io import EchelleSpectrum, Template, Spectrum
from ..ccf import cross_corr
lkca4_id = "1x3nIg1P5tYFQqJrw... | [
"numpy.trapz",
"numpy.random.seed",
"numpy.ones_like",
"numpy.roll",
"numpy.median",
"astropy.tests.helper.assert_quantity_allclose",
"numpy.arange",
"astropy.units.doppler_optical",
"astropy.utils.data.download_file",
"pytest.mark.parametrize"
] | [((681, 738), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,"""', '[lkca4_url, proxima_url]'], {}), "('url,', [lkca4_url, proxima_url])\n", (704, 738), False, 'import pytest\n'), ((1198, 1255), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,"""', '[lkca4_url, proxima_url]'], {}), "('u... |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from profiles_api import serializers
from rest_framework import viewsets
from profiles_api import models
from rest_framework.authentication import TokenAuthentication
from profiles_api import permissi... | [
"rest_framework.response.Response",
"profiles_api.models.UserProfile.objects.all"
] | [((3502, 3534), 'profiles_api.models.UserProfile.objects.all', 'models.UserProfile.objects.all', ([], {}), '()\n', (3532, 3534), False, 'from profiles_api import models\n'), ((947, 1004), 'rest_framework.response.Response', 'Response', (["{'message': 'Hello!', 'an_apiview': an_apiview}"], {}), "({'message': 'Hello!', '... |
import numpy as np
import scipy.linalg as la
import seaborn as sns
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from plot_utils import *
nburnin = 500
nsample = 1000
niter = nburnin + nsample
##################
### 1-D Normal ###
##################... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"seaborn.kdeplot",
"numpy.sum",
"numpy.zeros",
"scipy.stats.multivariate_normal",
"scipy.linalg.inv",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.array",
"numpy.random.normal",
"numpy.random.rand",
"numpy.eye",
"numpy.cov",
"numpy.roun... | [((322, 342), 'numpy.random.seed', 'np.random.seed', (['(2019)'], {}), '(2019)\n', (336, 342), True, 'import numpy as np\n'), ((379, 431), 'numpy.random.normal', 'np.random.normal', (['sample_mean', 'sample_sig2'], {'size': '(100)'}), '(sample_mean, sample_sig2, size=100)\n', (395, 431), True, 'import numpy as np\n'), ... |
# coding: utf-8
# ## Pothole Detection
# #### Load important libraries
# In[1]:
import cv2
import numpy as np
import pygame
import time
import smtplib
import sys
from matplotlib import pyplot as plt
# In[2]:
file_name = 'pothole.jpg'
#file name can be passed as an commandline argument.
if sys.argv[1] != None... | [
"matplotlib.pyplot.title",
"cv2.GaussianBlur",
"cv2.approxPolyDP",
"cv2.arcLength",
"cv2.medianBlur",
"numpy.ones",
"cv2.isContourConvex",
"cv2.startWindowThread",
"cv2.rectangle",
"cv2.erode",
"cv2.imshow",
"cv2.contourArea",
"cv2.dilate",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"... | [((426, 449), 'cv2.startWindowThread', 'cv2.startWindowThread', ([], {}), '()\n', (447, 449), False, 'import cv2\n'), ((1707, 1728), 'cv2.imread', 'cv2.imread', (['file_name'], {}), '(file_name)\n', (1717, 1728), False, 'import cv2\n'), ((1835, 1861), 'matplotlib.pyplot.title', 'plt.title', (['"""Pothole Image"""'], {}... |
'''
Coin Flip Streaks
Write a program to find out how often a streak of six heads or a streak of six tails comes up in a randomly generated list of heads and tails. Your program breaks up the experiment into two parts: the first part generates a list of randomly selected 'heads' and 'tails' values, and the second part ... | [
"random.randint"
] | [((1042, 1055), 'random.randint', 'randint', (['(0)', '(1)'], {}), '(0, 1)\n', (1049, 1055), False, 'from random import randint\n')] |
import pytest
import tensorflow as tf
from deepctr.estimator import FNNEstimator
from deepctr.models import FNN
from ..utils import check_model, get_test_data, SAMPLE_SIZE, get_test_data_estimator, check_estimator, \
Estimator_TEST_TF1
@pytest.mark.parametrize(
'sparse_feature_num,dense_feature_num',
[(1... | [
"pytest.mark.parametrize",
"deepctr.estimator.FNNEstimator",
"deepctr.models.FNN"
] | [((244, 329), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sparse_feature_num,dense_feature_num"""', '[(1, 1), (3, 3)]'], {}), "('sparse_feature_num,dense_feature_num', [(1, 1), (3,\n 3)])\n", (267, 329), False, 'import pytest\n'), ((1301, 1374), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (... |
import numpy as np
import pandas as pd
from pathlib import Path
def process_forecasts(df):
df.loc[df.type == 'quantile', 'quantile'] = 'q' + df.loc[df.type == 'quantile', 'quantile'].astype(str)
df.loc[df.type == 'mean', 'quantile'] = 'mean'
df = df.pivot(index = ['location', 'age_group', 'forecast_date'... | [
"pandas.DataFrame",
"pandas.read_csv",
"pathlib.Path",
"pandas.to_datetime",
"pandas.Timedelta",
"pandas.concat"
] | [((1295, 1320), 'pathlib.Path', 'Path', (['"""../data-processed"""'], {}), "('../data-processed')\n", (1299, 1320), False, 'from pathlib import Path\n'), ((1456, 1495), 'pathlib.Path', 'Path', (['"""../data-processed_retrospective"""'], {}), "('../data-processed_retrospective')\n", (1460, 1495), False, 'from pathlib im... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 5 22:36:16 2017
@author: root
"""
import nltk
import numpy as np
import tflearn
import tensorflow as tf
import random
# restore all of our data structures
import pickle
from nltk.stem.lancaster import LancasterStemmer
stemmer = LancasterStemmer()... | [
"json.load",
"tflearn.fully_connected",
"tensorflow.reset_default_graph",
"random.choice",
"tflearn.regression",
"nltk.stem.lancaster.LancasterStemmer",
"tflearn.DNN",
"numpy.array",
"nltk.word_tokenize"
] | [((302, 320), 'nltk.stem.lancaster.LancasterStemmer', 'LancasterStemmer', ([], {}), '()\n', (318, 320), False, 'from nltk.stem.lancaster import LancasterStemmer\n'), ((697, 721), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (719, 721), True, 'import tensorflow as tf\n'), ((807, 838), 't... |
# Generated by Django 3.0.3 on 2020-09-29 12:42
import apps.fyle.models
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workspaces', '0002... | [
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.OneToOneField",
"django.db.models.AutoField"
] | [((764, 827), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'help_text': '"""Report verified at"""', 'null': '(True)'}), "(help_text='Report verified at', null=True)\n", (784, 827), False, 'from django.db import migrations, models\n'), ((957, 1027), 'django.db.models.CharField', 'models.CharField', ([... |
# Copyright (c) 2019 Cable Television Laboratories, 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 ... | [
"trans_sec.p4runtime_lib.tofino.TofinoSwitchConnection",
"trans_sec.p4runtime_lib.helper.P4InfoHelper",
"logging.getLogger"
] | [((741, 773), 'logging.getLogger', 'getLogger', (['"""abstract_controller"""'], {}), "('abstract_controller')\n", (750, 773), False, 'from logging import getLogger\n'), ((2136, 2167), 'trans_sec.p4runtime_lib.helper.P4InfoHelper', 'helper.P4InfoHelper', (['p4info_txt'], {}), '(p4info_txt)\n', (2155, 2167), False, 'from... |
from __future__ import print_function, unicode_literals
from aspen import json
from gratipay.testing import Harness
class Tests(Harness):
def setUp(self):
Harness.setUp(self)
self.make_participant('alice', claimed_time='now')
def hit_privacy(self, method='GET', expected_code=200, **kw):
... | [
"aspen.json.loads",
"gratipay.testing.Harness.setUp"
] | [((170, 189), 'gratipay.testing.Harness.setUp', 'Harness.setUp', (['self'], {}), '(self)\n', (183, 189), False, 'from gratipay.testing import Harness\n'), ((630, 655), 'aspen.json.loads', 'json.loads', (['response.body'], {}), '(response.body)\n', (640, 655), False, 'from aspen import json\n'), ((920, 945), 'aspen.json... |
from keras.preprocessing.sequence import pad_sequences
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
import torch
import numpy as np
TORCH_INT_TYPE = torch.int16
NP_INT_TYPE = np.int16
def create_data_loaders(load_train, labels_train, load_test, labels_test, pad_len, batch_... | [
"torch.utils.data.DataLoader",
"keras.preprocessing.sequence.pad_sequences",
"torch.utils.data.SequentialSampler",
"torch.utils.data.RandomSampler"
] | [((539, 564), 'torch.utils.data.RandomSampler', 'RandomSampler', (['train_data'], {}), '(train_data)\n', (552, 564), False, 'from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler\n'), ((588, 656), 'torch.utils.data.DataLoader', 'DataLoader', (['train_data'], {'sampler': 'train_sampler... |
"""
N-dimensional grids.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "3-clause BSD"
import numpy as np
class Grid(object):
"""
N-dimensional grid.
Parameters
----------
shape : tuple
Number of grid points in each dimension.
center : ... | [
"numpy.zeros_like",
"numpy.asarray",
"numpy.zeros",
"numpy.indices",
"numpy.rint",
"numpy.array",
"numpy.atleast_2d"
] | [((639, 667), 'numpy.zeros', 'np.zeros', (['shape'], {'dtype': 'dtype'}), '(shape, dtype=dtype)\n', (647, 667), True, 'import numpy as np\n'), ((3600, 3656), 'numpy.zeros', 'np.zeros', (['(self.grid.shape + (self.grid.ndim,))'], {'dtype': 'int'}), '(self.grid.shape + (self.grid.ndim,), dtype=int)\n', (3608, 3656), True... |
from homely._test.system import HOMELY, TempRepo, getsystemfn
from homely._test import contents
def test_lineinfile_knows_about_ownership(HOME, tmpdir):
system = getsystemfn(HOME)
# put the 'AAA' line into my file1.txt
f1 = HOME + '/file1.txt'
contents(f1, 'AAA\n')
# create a fake repo and add i... | [
"homely._test.system.HOMELY",
"homely._test.system.getsystemfn",
"homely._test.system.TempRepo",
"homely._test.contents"
] | [((168, 185), 'homely._test.system.getsystemfn', 'getsystemfn', (['HOME'], {}), '(HOME)\n', (179, 185), False, 'from homely._test.system import HOMELY, TempRepo, getsystemfn\n'), ((263, 284), 'homely._test.contents', 'contents', (['f1', '"""AAA\n"""'], {}), "(f1, 'AAA\\n')\n", (271, 284), False, 'from homely._test impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# tests/parser.py
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of co... | [
"unittest.main",
"math.isnan",
"decimal.Decimal",
"rule_engine.engine.Context",
"datetime.datetime",
"rule_engine.parser.Parser",
"itertools.product"
] | [((1858, 1873), 'rule_engine.parser.Parser', 'parser.Parser', ([], {}), '()\n', (1871, 1873), True, 'import rule_engine.parser as parser\n'), ((1885, 1901), 'rule_engine.engine.Context', 'engine.Context', ([], {}), '()\n', (1899, 1901), True, 'import rule_engine.engine as engine\n'), ((16464, 16479), 'unittest.main', '... |
#!/usr/bin/env python3
# This script is dedicated to the public domain under the terms of the CC0 license.
import os
import sys
import re
from typing import Dict, Optional, List
from lxml import etree
## This is a material profile validator that works with the lxml library.
#
# This version is currently unused o... | [
"os.path.abspath",
"os.path.realpath",
"os.walk",
"lxml.etree.XMLSchema",
"lxml.etree.parse",
"os.path.join",
"sys.exit",
"re.compile"
] | [((6811, 6829), 'sys.exit', 'sys.exit', (['ret_code'], {}), '(ret_code)\n', (6819, 6829), False, 'import sys\n'), ((705, 734), 're.compile', 're.compile', (['"""<GUID>.*</GUID>"""'], {}), "('<GUID>.*</GUID>')\n", (715, 734), False, 'import re\n'), ((1125, 1141), 'os.walk', 'os.walk', (['dirpath'], {}), '(dirpath)\n', (... |
import FWCore.ParameterSet.Config as cms
process = cms.Process("SKIM")
process.configurationMetadata = cms.untracked.PSet(
version = cms.untracked.string('$Revision: 1.4 $'),
name = cms.untracked.string('$Source: /cvs/CMSSW/CMSSW/DPGAnalysis/Skims/python/EGPDSkim_cfg.py,v $'),
annotation = cms.untracked.s... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.int32",
"Configuration.StandardSequences.RawToDigi_Data_cff.gtEvmDigis.clone",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.vuint32",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.Parameter... | [((52, 71), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""SKIM"""'], {}), "('SKIM')\n", (63, 71), True, 'import FWCore.ParameterSet.Config as cms\n'), ((794, 856), 'FWCore.ParameterSet.Config.untracked.vstring', 'cms.untracked.vstring', (['"""keep *"""', '"""drop *_MEtoEDMConverter_*_*"""'], {}), "('keep *... |
from django.apps import AppConfig
class CmanagerConfig(AppConfig):
name = 'apps.cmanager'
verbose_name = 'Convention Manager'
def ready(self):
from apps.cmanager import signals
import algoliasearch_django as algoliasearch
from .indexes import AwardIndex
from .indexes impor... | [
"algoliasearch_django.register"
] | [((436, 477), 'algoliasearch_django.register', 'algoliasearch.register', (['Award', 'AwardIndex'], {}), '(Award, AwardIndex)\n', (458, 477), True, 'import algoliasearch_django as algoliasearch\n'), ((486, 537), 'algoliasearch_django.register', 'algoliasearch.register', (['Convention', 'ConventionIndex'], {}), '(Convent... |
from __future__ import annotations
from css_parser import CSSOM
from html_parser import DOMNode
import re
from css_properties import *
INHERITABLE_PROPERTIES = [COLOR, BACKGROUND_COLOR, BORDER_COLOR, FONT_SIZE, FONT_STYLE, FONT_WEIGHT]
def parse_style(styles: dict):
parsed_styles = {}
def update_style(prope... | [
"re.match"
] | [((711, 735), 're.match', 're.match', (['pattern', 'value'], {}), '(pattern, value)\n', (719, 735), False, 'import re\n')] |
import pandas as pd
def load_training_data(training_file):
training_file_df = pd.read_csv(training_file, encoding='utf-8')
training_file_df = training_file_df.sample(frac=1, replace=False)
training_file_df = training_file_df[pd.notnull(training_file_df["sentence"])]
training_file_df["class_id"] = trai... | [
"pandas.read_csv",
"pandas.notnull"
] | [((84, 128), 'pandas.read_csv', 'pd.read_csv', (['training_file'], {'encoding': '"""utf-8"""'}), "(training_file, encoding='utf-8')\n", (95, 128), True, 'import pandas as pd\n'), ((455, 501), 'pandas.read_csv', 'pd.read_csv', (['validation_file'], {'encoding': '"""UTF-8"""'}), "(validation_file, encoding='UTF-8')\n", (... |
# File: mxtoolbox_connector.py
#
# Copyright (c) 2016-2022 Splunk 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 b... | [
"pudb.set_trace",
"phantom.app.is_fail",
"simplejson.dumps",
"ipaddress.ip_address",
"phantom.app.ActionResult",
"simplejson.loads",
"sys.exit"
] | [((8213, 8229), 'pudb.set_trace', 'pudb.set_trace', ([], {}), '()\n', (8227, 8229), False, 'import pudb\n'), ((8571, 8582), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (8579, 8582), False, 'import sys\n'), ((4625, 4639), 'phantom.app.ActionResult', 'ActionResult', ([], {}), '()\n', (4637, 4639), False, 'from phanto... |
import socket
def findWaitingTime(processes, n, wt):
wt[0] = 0
for i in range(1, n):
wt[i] = processes[i - 1][1] + wt[i - 1]
def findTurnAroundTime(processes, n, wt, tat):
for i in range(n):
tat[i] = processes[i][1] + wt[i]
def findavgTime(processes, n):
wt = [0] * n
tat = [0] * n
findWaitingT... | [
"socket.socket"
] | [((1457, 1506), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (1470, 1506), False, 'import socket\n')] |
from part1 import (
gamma_board,
gamma_busy_fields,
gamma_delete,
gamma_free_fields,
gamma_golden_move,
gamma_golden_possible,
gamma_move,
gamma_new,
)
"""
scenario: test_random_actions
uuid: 788796976
"""
"""
random actions, total chaos
"""
board = gamma_new(3, 5, 4, 5)
assert board is... | [
"part1.gamma_new",
"part1.gamma_busy_fields",
"part1.gamma_golden_possible",
"part1.gamma_move",
"part1.gamma_board",
"part1.gamma_free_fields",
"part1.gamma_delete"
] | [((283, 304), 'part1.gamma_new', 'gamma_new', (['(3)', '(5)', '(4)', '(5)'], {}), '(3, 5, 4, 5)\n', (292, 304), False, 'from part1 import gamma_board, gamma_busy_fields, gamma_delete, gamma_free_fields, gamma_golden_move, gamma_golden_possible, gamma_move, gamma_new\n'), ((391, 409), 'part1.gamma_board', 'gamma_board',... |
"""
Modify header or status in response
"""
from sanic import Sanic, response
app = Sanic("Example")
@app.route("/")
def handle_request(request):
return response.json(
{"message": "Hello world!"},
headers={"X-Served-By": "sanic"},
status=200,
)
@app.route("/unauthorized")
def hand... | [
"sanic.response.json",
"sanic.Sanic"
] | [((87, 103), 'sanic.Sanic', 'Sanic', (['"""Example"""'], {}), "('Example')\n", (92, 103), False, 'from sanic import Sanic, response\n'), ((162, 254), 'sanic.response.json', 'response.json', (["{'message': 'Hello world!'}"], {'headers': "{'X-Served-By': 'sanic'}", 'status': '(200)'}), "({'message': 'Hello world!'}, head... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth.models import User
from django.urls import path, include
from rest_framework import serializers, viewsets
from rest_framework.routers import DefaultRouter
# from upload.views import imag... | [
"rest_framework.routers.DefaultRouter",
"django.urls.path",
"django.urls.include",
"django.conf.urls.static.static",
"django.contrib.auth.models.User.objects.all"
] | [((858, 873), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (871, 873), False, 'from rest_framework.routers import DefaultRouter\n'), ((734, 752), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (750, 752), False, 'from django.contrib.auth.models import ... |
"""Provides functions for finding an optimal two-dimensional reconstruction filter.
The reconstruction filter can be used to reconstruct an unknown one-dimensional signal (eg. signal envelope) from a known two-dimensional signal, such as multi-frequency neural spikes.
Can also be used to perform two-dimensional imputa... | [
"torch.no_grad",
"torch.nn.functional.conv1d"
] | [((1658, 1674), 'torch.nn.functional.conv1d', 'F.conv1d', (['spk', 'h'], {}), '(spk, h)\n', (1666, 1674), True, 'import torch.nn.functional as F\n'), ((2027, 2042), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2040, 2042), False, 'import torch\n')] |
#!/usr/bin/env python3.4
#
# Copyright 2016 - Google
#
# 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... | [
"acts.test_utils.tel.tel_voice_utils.phone_idle_iwlan",
"acts.test_utils.tel.tel_voice_utils.phone_idle_csfb",
"acts.test_utils.tel.tel_test_utils.wait_for_cell_data_connection",
"acts.test_utils.tel.tel_test_utils.hangup_call",
"acts.test_utils.tel.TelephonyBaseTest.TelephonyBaseTest.__init__",
"acts.tes... | [((5942, 5987), 'acts.test_utils.tel.TelephonyBaseTest.TelephonyBaseTest.__init__', 'TelephonyBaseTest.__init__', (['self', 'controllers'], {}), '(self, controllers)\n', (5968, 5987), False, 'from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest\n'), ((12627, 12673), 'acts.utils.load_config', 'load_config... |
from threading import Thread
import socket, os, errno
from time import sleep
from express.request import Request
from express.response import Response
import keyboard
class ServerSocketThread(Thread):
socket: socket or None = None
def __init__(self, app, host: str, port: int, timeout: int or floa... | [
"threading.Thread",
"keyboard.is_pressed",
"socket.socket"
] | [((880, 929), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (893, 929), False, 'import socket, os, errno\n'), ((637, 666), 'keyboard.is_pressed', 'keyboard.is_pressed', (['"""ctrl+c"""'], {}), "('ctrl+c')\n", (656, 666), False, 'import keyboa... |
from sympy import Matrix
from lab5.Network import Network
from lab5.MinCostFlow import MinCostFlow, get_flow_cost
paths = Matrix([[0, 1, 0, 0, 0, 0, 0],
[0, 0, 1, 3, 2, 0, 0],
[3, 0, 0, 3, 0, 4, 0],
[4, 0, 0, 0, 0, -1, 6],
[0, 0, 0, 5, 0, 0, 1],
... | [
"lab5.Network.Network",
"lab5.MinCostFlowWithContraint.get_flow_cost",
"sympy.Matrix",
"lab5.MinCostFlowWithContraint.MinCostFlow"
] | [((123, 302), 'sympy.Matrix', 'Matrix', (['[[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 3, 2, 0, 0], [3, 0, 0, 3, 0, 4, 0], [4, 0,\n 0, 0, 0, -1, 6], [0, 0, 0, 5, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0,\n 0, 0, 2, 0]]'], {}), '([[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 3, 2, 0, 0], [3, 0, 0, 3, 0, 4, 0],\n [4, 0, 0, 0, 0, -1,... |
import tempfile
import pytest
from invoke import context
from noos_inv import helm, utils
@pytest.fixture
def ctx():
return context.Context(config=helm.CONFIG)
@pytest.fixture
def chart():
with tempfile.TemporaryDirectory() as dir_name:
yield dir_name
class TestHelmLogin:
@pytest.mark.parame... | [
"noos_inv.helm.install",
"tempfile.TemporaryDirectory",
"invoke.context.Context",
"noos_inv.helm.login",
"noos_inv.helm.lint",
"noos_inv.helm.push",
"pytest.raises",
"pytest.mark.parametrize"
] | [((132, 167), 'invoke.context.Context', 'context.Context', ([], {'config': 'helm.CONFIG'}), '(config=helm.CONFIG)\n', (147, 167), False, 'from invoke import context\n'), ((302, 445), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,user,token"""', "[(None, None, None), ('http://hostname/', None, None), (... |
#!/usr/bin/env python
import unittest
import json
import yaml
import os
from pymongo import MongoClient
from requests import put, get
from lib import salt
def checkAccess(oid, password='', host=''):
data = {"oid": oid, "key": password}
return get('http://' + host + ':5000/api/protected', data=data)
class Te... | [
"unittest.main",
"yaml.load",
"lib.salt.addUser",
"requests.get"
] | [((253, 309), 'requests.get', 'get', (["('http://' + host + ':5000/api/protected')"], {'data': 'data'}), "('http://' + host + ':5000/api/protected', data=data)\n", (256, 309), False, 'from requests import put, get\n'), ((1243, 1258), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1256, 1258), False, 'import unitt... |
import cv2
import os
import numpy as np
ROOT_PATH = 'G:\\MachineLearning\\unbalance\\core_500'
image_path = os.path.join(ROOT_PATH, 'Image') # 原图像保存位置
annotation_path = os.path.join(ROOT_PATH, 'Annotation') # 原目标框保存位置
image_save_path = os.path.join(ROOT_PATH, 'Image_new') # 原目标框保存位置
annotation_save_path = os.path.j... | [
"os.mkdir",
"cv2.getRotationMatrix2D",
"cv2.waitKey",
"cv2.imwrite",
"os.path.isdir",
"numpy.zeros",
"cv2.imread",
"cv2.warpAffine",
"cv2.rectangle",
"cv2.flip",
"cv2.imshow",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((109, 141), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""Image"""'], {}), "(ROOT_PATH, 'Image')\n", (121, 141), False, 'import os\n'), ((171, 208), 'os.path.join', 'os.path.join', (['ROOT_PATH', '"""Annotation"""'], {}), "(ROOT_PATH, 'Annotation')\n", (183, 208), False, 'import os\n'), ((239, 275), 'os.path.joi... |
import base64
import os
from dash.dependencies import Input, Output, State
import dash_core_components as dcc
import dash_html_components as html
import dash_bio
from dash_bio.utils import geneExpressionReader
DATAPATH = os.path.join(".", "tests", "dashbio_demos", "sample_data", "clustergram_")
colorPalette = [
'... | [
"dash_html_components.H3",
"dash_html_components.Br",
"dash_core_components.Slider",
"dash_html_components.Div",
"dash_html_components.Button",
"dash.dependencies.State",
"base64.b64decode",
"dash_core_components.Input",
"dash.dependencies.Input",
"dash_bio.Clustergram",
"dash_core_components.Dr... | [((222, 296), 'os.path.join', 'os.path.join', (['"""."""', '"""tests"""', '"""dashbio_demos"""', '"""sample_data"""', '"""clustergram_"""'], {}), "('.', 'tests', 'dashbio_demos', 'sample_data', 'clustergram_')\n", (234, 296), False, 'import os\n'), ((10753, 10788), 'dash.dependencies.Output', 'Output', (['"""data-meta-... |
import asyncio
import json
from unittest.mock import patch
import aiohttp
import async_timeout
import pytest
import peony
import peony.stream
from peony import exceptions
from peony.stream import (DISCONNECTION, DISCONNECTION_TIMEOUT,
ENHANCE_YOUR_CALM, ENHANCE_YOUR_CALM_TIMEOUT, EOF,
... | [
"unittest.mock.patch.object",
"asyncio.sleep",
"json.dumps",
"aiohttp.ClientSession",
"peony.client.BasePeonyClient",
"pytest.raises",
"async_timeout.timeout",
"asyncio.wait",
"peony.stream.StreamResponse"
] | [((842, 865), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (863, 865), False, 'import aiohttp\n'), ((888, 946), 'peony.client.BasePeonyClient', 'peony.client.BasePeonyClient', (['""""""', '""""""'], {'session': 'self.session'}), "('', '', session=self.session)\n", (916, 946), False, 'import peony... |
import json
from gevent import monkey
monkey.patch_all()
from flask import Flask, app, render_template
from werkzeug.debug import DebuggedApplication
from geventwebsocket import WebSocketServer, WebSocketApplication, Resource
flask_app = Flask(__name__)
flask_app.debug = True
class ChatApplication(WebSocketApplic... | [
"json.loads",
"flask.Flask",
"gevent.monkey.patch_all",
"json.dumps",
"flask.render_template",
"werkzeug.debug.DebuggedApplication"
] | [((39, 57), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (55, 57), False, 'from gevent import monkey\n'), ((242, 257), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (247, 257), False, 'from flask import Flask, app, render_template\n'), ((1516, 1545), 'flask.render_template', 'render_te... |
from nginxpla.module_config import ModuleConfig
from nginxpla.utils import generate_table
from crawlerdetect import CrawlerDetect
from functools import lru_cache
from nginxpla.module.simple import SimpleModule
class CrawlerModule(SimpleModule):
def handle_record(self, record):
if self.is_needed is False:
... | [
"functools.lru_cache",
"crawlerdetect.CrawlerDetect"
] | [((785, 810), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(102400)'}), '(maxsize=102400)\n', (794, 810), False, 'from functools import lru_cache\n'), ((1048, 1063), 'crawlerdetect.CrawlerDetect', 'CrawlerDetect', ([], {}), '()\n', (1061, 1063), False, 'from crawlerdetect import CrawlerDetect\n')] |
# -*- coding: utf-8 -*-
# RSScrawler
# Projekt von https://github.com/rix1337
import datetime
import hashlib
import json
import re
from bs4 import BeautifulSoup
from rsscrawler.common import add_decrypt
from rsscrawler.common import check_hoster
from rsscrawler.common import check_valid_release
from rsscrawler.commo... | [
"rsscrawler.db.RssDb",
"json.loads",
"rsscrawler.notifiers.notify",
"rsscrawler.fakefeed.sf_releases_to_feedparser_dict",
"rsscrawler.db.ListDb",
"rsscrawler.url.get_url_headers",
"rsscrawler.common.add_decrypt",
"re.match",
"rsscrawler.url.get_url",
"re.findall",
"datetime.timedelta",
"bs4.Be... | [((896, 935), 'rsscrawler.config.RssConfig', 'RssConfig', (['"""Hostnames"""', 'self.configfile'], {}), "('Hostnames', self.configfile)\n", (905, 935), False, 'from rsscrawler.config import RssConfig\n'), ((1002, 1049), 'rsscrawler.config.RssConfig', 'RssConfig', (['self._INTERNAL_NAME', 'self.configfile'], {}), '(self... |
import tensorflow as tf
import numpy as np
import logging
from global_utils import *
import time
import json
from tensorflow.python.layers import core as layers_core
from parametrs import *
global data1, data2, vocab, dict_rev, data1_validation, data2_validation, test1, test2
def load_data(parameterClass, length=Non... | [
"tensorflow.contrib.seq2seq.LuongAttention",
"tensorflow.trainable_variables",
"numpy.empty",
"numpy.ones",
"json.dumps",
"tensorflow.global_variables",
"tensorflow.Variable",
"numpy.mean",
"tensorflow.contrib.seq2seq.BasicDecoder",
"tensorflow.reduce_max",
"tensorflow.clip_by_global_norm",
"j... | [((531, 542), 'time.time', 'time.time', ([], {}), '()\n', (540, 542), False, 'import time\n'), ((3225, 3298), 'tensorflow.placeholder', 'tf.placeholder', ([], {'shape': '(None, None)', 'dtype': 'tf.int32', 'name': '"""encoder_inputs"""'}), "(shape=(None, None), dtype=tf.int32, name='encoder_inputs')\n", (3239, 3298), T... |
from nagare import presentation, wsgi, component
from .vdom_renderer import VDomRenderer
from .root_component import RootComponent
class Nagare_vdom(object):
def __init__(self):
self.counter = component.Component(Counter())
class Counter(object):
def __init__(self):
... | [
"nagare.presentation.render_for"
] | [((445, 481), 'nagare.presentation.render_for', 'presentation.render_for', (['Nagare_vdom'], {}), '(Nagare_vdom)\n', (468, 481), False, 'from nagare import presentation, wsgi, component\n'), ((2893, 2925), 'nagare.presentation.render_for', 'presentation.render_for', (['Counter'], {}), '(Counter)\n', (2916, 2925), False... |
"""Platform for sensor integration."""
from __future__ import annotations
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity, SensorStateClass
from hom... | [
"datetime.timedelta",
"logging.getLogger"
] | [((833, 860), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (850, 860), False, 'import logging\n'), ((889, 918), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': '(1)'}), '(minutes=1)\n', (907, 918), False, 'import datetime\n')] |
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api, _
from odoo.exceptions import UserError, ValidationError
import stdnum.ar
import logging
_logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = 'res.partner'
l10n_ar_va... | [
"odoo.fields.Selection",
"odoo.fields.Many2one",
"odoo.api.constrains",
"odoo.api.depends",
"odoo.fields.Char",
"odoo.fields.Many2many",
"odoo._",
"logging.getLogger"
] | [((213, 240), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (230, 240), False, 'import logging\n'), ((324, 481), 'odoo.fields.Char', 'fields.Char', ([], {'compute': '"""_compute_l10n_ar_vat"""', 'string': '"""VAT"""', 'help': '"""Computed field that returns VAT or nothing if this one is ... |
from lineinfile import AtEOF
line = "gnusto=cleesh"
args = {"inserter": AtEOF()}
options = ["--eof"]
| [
"lineinfile.AtEOF"
] | [((73, 80), 'lineinfile.AtEOF', 'AtEOF', ([], {}), '()\n', (78, 80), False, 'from lineinfile import AtEOF\n')] |
# Some part borrowed from official tutorial https://github.com/pytorch/examples/blob/master/imagenet/main.py
from __future__ import print_function
from __future__ import absolute_import
import os
import numpy as np
import argparse
import importlib
import time
import logging
import warnings
from collections import Orde... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.isdir",
"torch.manual_seed",
"losses.SupConLoss",
"os.walk",
"os.path.exists",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"models.SupResNet",
"torch.cuda.manual_seed_all",
"models.SSLRes... | [((650, 703), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""SSD evaluation"""'}), "(description='SSD evaluation')\n", (673, 703), False, 'import argparse\n'), ((2631, 2676), 'os.path.join', 'os.path.join', (['args.results_dir', 'args.exp_name'], {}), '(args.results_dir, args.exp_name)\n... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-02-24 23:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('members', '0017_auto_20170225_0026'),
]
operations = [
migrations.AlterField(... | [
"django.db.models.DateField"
] | [((410, 508), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'default': 'None', 'null': '(True)', 'verbose_name': '"""End date of this factor"""'}), "(blank=True, default=None, null=True, verbose_name=\n 'End date of this factor')\n", (426, 508), False, 'from django.db import migrations, ... |
import json
import logging
from datetime import datetime, time, timedelta
from typing import List, Optional
import pytz
from .activity import Activity, Insight
from .enums import LitterBoxCommand, LitterBoxStatus
from .exceptions import InvalidCommandException, LitterRobotException
from .session import Session
from .... | [
"json.dumps",
"datetime.datetime.strptime",
"datetime.timedelta",
"datetime.datetime.fromtimestamp",
"logging.getLogger"
] | [((407, 434), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (424, 434), False, 'import logging\n'), ((833, 870), 'datetime.timedelta', 'timedelta', ([], {'hours': 'SLEEP_DURATION_HOURS'}), '(hours=SLEEP_DURATION_HOURS)\n', (842, 870), False, 'from datetime import datetime, time, timedelt... |
# pylint: disable=protected-access
from abc import ABC, abstractmethod
import argparse
from collections import OrderedDict
import csv
import errno
import json
import os
from pathlib import PurePath
import sqlite3
import sys
import attr
from attr import attrib, attrs
import lz4.block
def arg(*args, **kwargs):
"""... | [
"json.load",
"attr.attrib",
"argparse.ArgumentParser",
"attr.asdict",
"json.dumps",
"attr.fields",
"os.strerror",
"pathlib.PurePath",
"csv.DictWriter"
] | [((1259, 1284), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1282, 1284), False, 'import argparse\n'), ((5612, 5620), 'attr.attrib', 'attrib', ([], {}), '()\n', (5618, 5620), False, 'from attr import attrib, attrs\n'), ((4567, 4608), 'csv.DictWriter', 'csv.DictWriter', (['stream'], {'fieldna... |
import os
import sys
import numpy as np
from skimage import io
from skimage.morphology import binary_closing, disk
# code for preprocessing ground truth masks
def create_processed_folders(ids):
for pathar in ids:
if not os.path.exists(pathar[0] + "/masks_processed"):
os.makedirs(patha... | [
"os.makedirs",
"os.walk",
"os.path.exists",
"skimage.morphology.disk",
"skimage.io.imsave",
"skimage.io.imread"
] | [((468, 487), 'os.walk', 'os.walk', (['train_path'], {}), '(train_path)\n', (475, 487), False, 'import os\n'), ((690, 732), 'skimage.io.imread', 'io.imread', (["(path[0] + '/masks/' + mask_file)"], {}), "(path[0] + '/masks/' + mask_file)\n", (699, 732), False, 'from skimage import io\n'), ((835, 894), 'skimage.io.imsav... |
"""
pytorch (0.3.1) miss some transforms, will be removed after official support.
"""
import torch
import numpy as np
from PIL import Image
import torchvision.transforms.functional as F
import torch.nn.functional as Func
import random
imagenet_pca = {
'eigval': np.asarray([0.2175, 0.0188, 0.0045]),
'eigvec': ... | [
"torchvision.transforms.functional.to_tensor",
"numpy.random.randn",
"numpy.asarray",
"numpy.clip",
"torch.squeeze",
"numpy.dot",
"numpy.add",
"torch.nn.functional.interpolate",
"torchvision.transforms.functional.normalize"
] | [((268, 304), 'numpy.asarray', 'np.asarray', (['[0.2175, 0.0188, 0.0045]'], {}), '([0.2175, 0.0188, 0.0045])\n', (278, 304), True, 'import numpy as np\n'), ((320, 419), 'numpy.asarray', 'np.asarray', (['[[-0.5675, 0.7192, 0.4009], [-0.5808, -0.0045, -0.814], [-0.5836, -0.6948, \n 0.4203]]'], {}), '([[-0.5675, 0.7192... |
# coding: utf-8
"""
Gate API v4
Welcome to Gate.io API APIv4 provides spot, margin and futures trading operations. There are public APIs to retrieve the real-time market statistics, and private APIs which needs authentication to trade on user's behalf. # noqa: E501
Contact: <EMAIL>
Generated by: ht... | [
"six.iteritems",
"gate_api.configuration.Configuration"
] | [((36687, 36720), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (36700, 36720), False, 'import six\n'), ((5325, 5340), 'gate_api.configuration.Configuration', 'Configuration', ([], {}), '()\n', (5338, 5340), False, 'from gate_api.configuration import Configuration\n')] |
"""empty message
Revision ID: d<PASSWORD>
Revises: <PASSWORD>
Create Date: 2020-02-06 15:15:58.466396
"""
# revision identifiers, used by Alembic.
revision = '<PASSWORD>'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pleas... | [
"alembic.op.drop_column",
"sqlalchemy.Boolean"
] | [((561, 619), 'alembic.op.drop_column', 'op.drop_column', (['"""reference_request"""', '"""reference_submitted"""'], {}), "('reference_request', 'reference_submitted')\n", (575, 619), False, 'from alembic import op\n'), ((406, 418), 'sqlalchemy.Boolean', 'sa.Boolean', ([], {}), '()\n', (416, 418), True, 'import sqlalch... |
#--- Exercício 1 - Funções - 1
#--- Escreva uma função que imprima um cabeçalho
#--- O cabeçalho deve ser escrito usando a multiplicação de carácter
#--- O cabeçalho deve conter o nome de uma empresa, que será uma variável
#--- Realize a chamada da função na ultima linha do seu programa
from Funções import empresa
x =... | [
"Funções.empresa"
] | [((321, 337), 'Funções.empresa', 'empresa', (['empresa'], {}), '(empresa)\n', (328, 337), False, 'from Funções import empresa\n')] |
# -*- coding: utf-8 -*-
"""
Colored text tool for RNN visualization
"""
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import numpy as np
class ColoredText(object):
"""
text: a sequence of characters
vals: a float vector, (-1 , 1), The same length as text
width: image width
... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"numpy.random.randn",
"matplotlib.pyplot.close",
"matplotlib.cm.bwr",
"matplotlib.pyplot.figure",
"numpy.linspace",
"itertools.product",
"numpy.vstack"
] | [((3643, 3713), 'itertools.product', 'product', (['[10, 113, 375, 819]', '[540, 1080]', '[10, 14, 18]', '[True, False]'], {}), '([10, 113, 375, 819], [540, 1080], [10, 14, 18], [True, False])\n', (3650, 3713), False, 'from itertools import product\n'), ((1974, 1989), 'matplotlib.cm.bwr', 'cm.bwr', (['subvals'], {}), '(... |