code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# userid: berkj
# Email: <EMAIL>
# Assignment Number: assignment1
# Honor statement: I pledge on my honor that I have neither given nor
# received unauthorized aid on this assignment.
# Exercise 6:
# datadotworld module has been imported as dw
import datadotworld as dw
## Complete the SQL query to select state, the ... | [
"datadotworld.query"
] | [((959, 1037), 'datadotworld.query', 'dw.query', (['"""https://data.world/agriculture/national-farmers-markets"""', 'sql_query'], {}), "('https://data.world/agriculture/national-farmers-markets', sql_query)\n", (967, 1037), True, 'import datadotworld as dw\n')] |
"""
In this file we run ours models one by one
"""
# Imports
import random
from random import shuffle
import numpy as np
import os
import scipy.sparse as sp
import torch
from tqdm import tqdm
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data im... | [
"logging.getLogger",
"numpy.uint8",
"torch.max",
"torch.nn.functional.sigmoid",
"numpy.array",
"torch.cuda.is_available",
"os.path.exists",
"numpy.mean",
"models.PretrainedDensenetRELU",
"torch.mean",
"numpy.random.seed",
"dataloader.get_study_level_data",
"torch.save",
"torch.nn.functiona... | [((1081, 1098), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1092, 1098), False, 'import random\n'), ((1100, 1120), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1114, 1120), True, 'import numpy as np\n'), ((1122, 1145), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(see... |
import os, torch
user_id = os.getcwd().split('/')[2]
# user_id = os.getcwd().split('\')[2]
class Hparams():
# speaker name
speaker = 'KSS1'
# Audio Pre-processing
origin_sample_rate = 44100
sample_rate = 24000
trim_top_db = 35
n_fft = sample_rate // 20
hop_length =... | [
"torch.cuda.is_available",
"os.path.join",
"os.getcwd"
] | [((1122, 1142), 'os.path.join', 'os.path.join', (['"""data"""'], {}), "('data')\n", (1134, 1142), False, 'import os, torch\n'), ((1164, 1195), 'os.path.join', 'os.path.join', (['data_dir', '"""texts"""'], {}), "(data_dir, 'texts')\n", (1176, 1195), False, 'import os, torch\n'), ((1216, 1246), 'os.path.join', 'os.path.j... |
import traceback
from functools import wraps
import logging
logger = logging.getLogger(__name__)
class BackendException(Exception):
"""Base class for exceptions raised by API methods
Makes easier to handle exceptions in webapp
"""
def __init__(self, message, status_code=500, payload=None):
... | [
"logging.getLogger",
"traceback.format_exc",
"functools.wraps"
] | [((71, 98), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (88, 98), False, 'import logging\n'), ((618, 640), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (638, 640), False, 'import traceback\n'), ((884, 894), 'functools.wraps', 'wraps', (['fun'], {}), '(fun)\n', (889... |
import argparse
import multiprocessing
import os
import sys
from configparser import ConfigParser
from configparser import ExtendedInterpolation
from pathlib import Path
from typing import Any
from typing import AnyStr
from maps_generator.utils.md5 import md5_ext
from maps_generator.utils.system import total_virtual_m... | [
"maps_generator.utils.md5.md5_ext",
"argparse.ArgumentParser",
"pathlib.Path.home",
"os.path.join",
"maps_generator.utils.system.total_virtual_memory",
"multiprocessing.cpu_count",
"os.path.abspath",
"configparser.ExtendedInterpolation"
] | [((336, 375), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (359, 375), False, 'import argparse\n'), ((2156, 2183), 'maps_generator.utils.md5.md5_ext', 'md5_ext', (['DEFAULT_PLANET_URL'], {}), '(DEFAULT_PLANET_URL)\n', (2163, 2183), False, 'from maps_generato... |
'''
Authors: <NAME>
Contact: <EMAIL>
'''
import logging, time
import math
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from py4j.java_gateway import (JavaGateway, GatewayParameters)
from subprocess import call, Popen, PIPE
import random
from py4j.tests.java_gateway_test import ... | [
"logging.getLogger",
"numpy.ones_like",
"py4j.tests.java_gateway_test.gateway.new_array",
"py4j.java_gateway.GatewayParameters",
"numpy.abs",
"numpy.ones",
"numpy.asarray",
"gym.spaces.Discrete",
"time.sleep",
"gym.spaces.Box",
"numpy.array",
"numpy.zeros",
"numpy.random.randint",
"numpy.f... | [((367, 394), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (384, 394), False, 'import logging, time\n'), ((1818, 1870), 'numpy.frombuffer', 'np.frombuffer', (['javaByte1DAry'], {'dtype': 'np.intc', 'count': '(2)'}), '(javaByte1DAry, dtype=np.intc, count=2)\n', (1831, 1870), True, 'impor... |
# main.py - Push executables and run them on an Android device -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt... | [
"adb.commands.execute_on_device"
] | [((2220, 2276), 'adb.commands.execute_on_device', 'execute_on_device', (['executable_path', 'executable_arguments'], {}), '(executable_path, executable_arguments)\n', (2237, 2276), False, 'from adb.commands import execute_on_device\n')] |
from DB.database import Base
from sqlalchemy import Column, Integer, String, Float
from sqlalchemy.orm import relationship
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
password = Column(String)
# TODO... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.Column"
] | [((181, 226), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=True)\n', (187, 226), False, 'from sqlalchemy import Column, Integer, String, Float\n'), ((239, 278), 'sqlalchemy.Column', 'Column', (['String'], {'unique': '(True)', 'index': '(T... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: v2/scan.proto
import sys
_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((445, 471), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (469, 471), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((857, 1143), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""scan_id"""', 'full_n... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2019-01-10 18:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("hosts", "0003_challengehostteam_team_url")]
operations = [
migrations.AlterField(
... | [
"django.db.models.CharField"
] | [((406, 463), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'default': '""""""', 'max_length': '(1000)'}), "(blank=True, default='', max_length=1000)\n", (422, 463), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/python
import requests
import redis
import json
import time
redis_db = redis.StrictRedis(host="localhost", port=6379, db=0)
def get_token(api_key):
global redis_db
token = redis_db.get(f'get_token{api_key}')
if token is None or token == '':
print("Getting token from auth.dfuse.io")
... | [
"json.loads",
"requests.post",
"time.time",
"redis.StrictRedis"
] | [((85, 137), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': '"""localhost"""', 'port': '(6379)', 'db': '(0)'}), "(host='localhost', port=6379, db=0)\n", (102, 137), False, 'import redis\n'), ((647, 664), 'json.loads', 'json.loads', (['token'], {}), '(token)\n', (657, 664), False, 'import json\n'), ((338, 426),... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@file : chinese_bert.py
@author: zijun
@contact : <EMAIL>
@date : 2021/7/5 11:22
@version: 1.0
@desc :
"""
import argparse
from datasets.bert_dataset import BertDataset
from models.modeling_glycebert import GlyceBertModel
def sentence_hidden():
# init args
... | [
"models.modeling_glycebert.GlyceBertModel.from_pretrained",
"datasets.bert_dataset.BertDataset",
"argparse.ArgumentParser"
] | [((331, 389), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chinese Bert Hidden"""'}), "(description='Chinese Bert Hidden')\n", (354, 389), False, 'import argparse\n'), ((644, 675), 'datasets.bert_dataset.BertDataset', 'BertDataset', (['args.pretrain_path'], {}), '(args.pretrain_path)\n... |
import threading
import pytest
import os
import time
import json
from time import sleep
from pymilvus import connections
from chaos.checker import (CreateChecker, InsertFlushChecker,
SearchChecker, QueryChecker, IndexChecker, Op)
from common.cus_resource_opts import CustomResourceOperations... | [
"utils.util_log.test_log.error",
"chaos.chaos_commons.gen_experiment_config",
"time.sleep",
"chaos.checker.InsertFlushChecker",
"pytest.fixture",
"pymilvus.connections.add_connection",
"chaos.checker.IndexChecker",
"os.path.exists",
"chaos.chaos_commons.reconnect",
"pymilvus.connections.get_connec... | [((1844, 1878), 'utils.util_common.findkeys', 'findkeys', (['chaos_config', '"""selector"""'], {}), "(chaos_config, 'selector')\n", (1852, 1878), False, 'from utils.util_common import findkeys\n'), ((1913, 1959), 'utils.util_log.test_log.info', 'log.info', (['f"""chaos target selector: {selector}"""'], {}), "(f'chaos t... |
from aoc.day18 import part1, part2
#
# --- Part One ---
#
def test_part1():
assert part1.result(None) == None
#
# --- Part Two ---
#
def test_part2():
assert part2.result(None) == None
| [
"aoc.day18.part2.result",
"aoc.day18.part1.result"
] | [((89, 107), 'aoc.day18.part1.result', 'part1.result', (['None'], {}), '(None)\n', (101, 107), False, 'from aoc.day18 import part1, part2\n'), ((170, 188), 'aoc.day18.part2.result', 'part2.result', (['None'], {}), '(None)\n', (182, 188), False, 'from aoc.day18 import part1, part2\n')] |
import sys
sys.path.append('./util')
sys.path.append('./model')
import torch
import torch.nn as nn
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.nn.functional as F
from torchvision import transforms
import numpy as np
import argparse
import os
import time
import gc
import tensorflow as t... | [
"tensorflow.Summary.Value",
"loss.NSS",
"sys.path.append",
"numpy.mean",
"evaluation.cal_auc_score",
"argparse.ArgumentParser",
"loss.KLD",
"sam.SAM",
"numpy.random.seed",
"evaluation.add_center_bias",
"evaluation.cal_cc_score",
"torchvision.transforms.ToTensor",
"numpy.maximum",
"evaluati... | [((11, 36), 'sys.path.append', 'sys.path.append', (['"""./util"""'], {}), "('./util')\n", (26, 36), False, 'import sys\n'), ((37, 63), 'sys.path.append', 'sys.path.append', (['"""./model"""'], {}), "('./model')\n", (52, 63), False, 'import sys\n'), ((573, 642), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([],... |
import pickle
import pytest
import numpy as np
import scipy.sparse as sp
import joblib
from sklearn.utils._testing import assert_array_equal
from sklearn.utils._testing import assert_almost_equal
from sklearn.utils._testing import assert_array_almost_equal
from sklearn.utils._testing import assert_raises_regexp
from ... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"sklearn.preprocessing.LabelEncoder",
"sklearn.linear_model._sgd_fast.Huber",
"sklearn.linear_model.SGDRegressor",
"pickle.dumps",
"sklearn.utils.fixes.parse_version",
"sklearn.utils._testing.assert_array_equal",
"numpy.log",
"numpy.argsort",
"nump... | [((2703, 2767), 'numpy.array', 'np.array', (['[[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]]'], {}), '([[-2, -1], [-1, -1], [-1, -2], [1, 1], [1, 2], [2, 1]])\n', (2711, 2767), True, 'import numpy as np\n'), ((2795, 2831), 'numpy.array', 'np.array', (['[[-1, -1], [2, 2], [3, 2]]'], {}), '([[-1, -1], [2, 2], [3,... |
import pytest
import os
import warnings
from fixtures import COMPRESSION_NAMES
import zipfile
from compress_pickle import (
dump,
dumps,
load,
loads,
get_compression_read_mode,
get_compression_write_mode,
)
@pytest.mark.usefixtures("wrong_compressions")
def test_dump_fails_on_unhandled_compres... | [
"compress_pickle.dumps",
"compress_pickle.load",
"warnings.catch_warnings",
"pytest.raises",
"pytest.mark.usefixtures",
"compress_pickle.dump",
"compress_pickle.loads",
"warnings.simplefilter",
"os.path.basename",
"os.remove"
] | [((234, 279), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""wrong_compressions"""'], {}), "('wrong_compressions')\n", (257, 279), False, 'import pytest\n'), ((538, 583), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""wrong_compressions"""'], {}), "('wrong_compressions')\n", (561, 583), False,... |
from flextensor.scheduler import schedule
from flextensor.task import register_task
from flextensor.utils import RpcInfo
# from flextensor.ppa_model import measure_latency
from flextensor.intrinsic import register_intrin
def gen_micro_schedule(task, target, model_func=None):
register_task(task, override=True)
... | [
"flextensor.utils.RpcInfo",
"flextensor.scheduler.schedule",
"flextensor.task.register_task"
] | [((281, 315), 'flextensor.task.register_task', 'register_task', (['task'], {'override': '(True)'}), '(task, override=True)\n', (294, 315), False, 'from flextensor.task import register_task\n'), ((376, 395), 'flextensor.utils.RpcInfo', 'RpcInfo', (['None', 'None'], {}), '(None, None)\n', (383, 395), False, 'from flexten... |
# Import from the future for Python 2 and 3 compatability!
from __future__ import print_function, absolute_import, unicode_literals
import sys
import argparse
import os
import glob
import batchphoto
def main():
# parser
parser = argparse.ArgumentParser(description='batchphoto')
ARG = parser.add_argumen... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.mkdir",
"sys.exit",
"os.path.abspath",
"glob.glob"
] | [((242, 291), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""batchphoto"""'}), "(description='batchphoto')\n", (265, 291), False, 'import argparse\n'), ((2136, 2146), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2144, 2146), False, 'import sys\n'), ((1122, 1139), 'glob.glob', 'glob.glob', ... |
import inspect
import os
import matplotlib.pyplot as plt
import numpy as np
from tqdm import tqdm
from Config import Config
from NIM import benchmarks
from PIL import Image
classes = inspect.getmembers(benchmarks, inspect.isclass)
step = 0
ignore_benchmarks_name = ["Benchmark", "Eggholder", "Griewank", "Schwefel"]
u... | [
"numpy.dstack",
"PIL.Image.open",
"inspect.getmembers",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.gca",
"tqdm.tqdm",
"matplotlib.pyplot.clf",
"numpy.log",
"os.path.join",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.figure",
"numpy.apply_along_axis",
"numpy.meshgrid",
"numpy.arange",... | [((186, 233), 'inspect.getmembers', 'inspect.getmembers', (['benchmarks', 'inspect.isclass'], {}), '(benchmarks, inspect.isclass)\n', (204, 233), False, 'import inspect\n'), ((491, 504), 'tqdm.tqdm', 'tqdm', (['classes'], {}), '(classes)\n', (495, 504), False, 'from tqdm import tqdm\n'), ((928, 969), 'numpy.arange', 'n... |
"""Fetch last versions from webserver."""
from datetime import timedelta
import logging
import random
import secrets
from typing import Dict, List, Optional
from .addons.addon import Addon
from .const import ATTR_PORTS, ATTR_SESSION, FILE_HASSIO_INGRESS
from .coresys import CoreSys, CoreSysAttributes
from .utils impor... | [
"logging.getLogger",
"secrets.token_hex",
"datetime.timedelta",
"random.randint"
] | [((488, 515), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'import logging\n'), ((3101, 3122), 'secrets.token_hex', 'secrets.token_hex', (['(64)'], {}), '(64)\n', (3118, 3122), False, 'import secrets\n'), ((3150, 3171), 'datetime.timedelta', 'timedelta', ([], {'minute... |
from sexpr import Grammar, Sexpr, load, register
def setup_function():
Grammar.registered_tags = {}
grammar = load('''
root:
exp1
rules:
exp:
- exp1
- exp2
exp1:
[ false ]
exp2:
[ exp3 ]
exp3:
[ exp4 ]
... | [
"sexpr.Grammar.register",
"sexpr.register",
"sexpr.load"
] | [((118, 374), 'sexpr.load', 'load', (['"""\n root:\n exp1\n rules:\n exp:\n - exp1\n - exp2\n exp1:\n [ false ]\n exp2:\n [ exp3 ]\n exp3:\n [ exp4 ]\n exp4:\n [ True, False ]\n"""'], {}), '(\n """\n ... |
import pytest
from pytest import approx
from barril import units
@pytest.fixture
def db():
db = units.UnitDatabase.GetSingleton()
yield db
def testTransmissibility(db):
converted = db.Convert("transmissibility", "cp.m3/day/bar", "cp.bbl/day/psi", 1.0)
assert approx(converted) == 0.433667315
def t... | [
"pytest.approx",
"barril.units.Scalar",
"barril.units.UnitDatabase.GetSingleton"
] | [((103, 136), 'barril.units.UnitDatabase.GetSingleton', 'units.UnitDatabase.GetSingleton', ([], {}), '()\n', (134, 136), False, 'from barril import units\n'), ((6616, 6646), 'pytest.approx', 'approx', (['gpermol_to_kgpermol', '(1)'], {}), '(gpermol_to_kgpermol, 1)\n', (6622, 6646), False, 'from pytest import approx\n')... |
# To use a consistent encoding
from codecs import open
from os import path
from setuptools import setup
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='pytunes-reporter',
version='0.2.3',
descriptio... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((249, 1158), 'setuptools.setup', 'setup', ([], {'name': '"""pytunes-reporter"""', 'version': '"""0.2.3"""', 'description': '"""Library to interact with iTunes Reporter API"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/x-rst"""', 'url': '"""https://github.com/gifbitjapan/pytune... |
#!/usr/bin/env python3.6
# -*- coding: utf8 -*-
'''
ELQuent.link
RegEx cleaner for links
<NAME>
github.com/MateuszDabrowski
linkedin.com/in/mateusz-dabrowski-marketing/
'''
# Python imports
import os
import re
import sys
import pyperclip
from colorama import Fore, Style, init
# ELQuent imports
import utils.api.api ... | [
"utils.api.api.eloqua_create_email",
"re.compile",
"os.path.join",
"utils.api.api.eloqua_update_email",
"utils.api.api.eloqua_asset_get",
"os.path.dirname",
"pyperclip.copy",
"utils.api.api.eloqua_asset_name",
"pyperclip.paste",
"utils.api.api.get_asset_id",
"colorama.init"
] | [((350, 370), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (354, 370), False, 'from colorama import Fore, Style, init\n'), ((1923, 1948), 'utils.api.api.get_asset_id', 'api.get_asset_id', (['"""email"""'], {}), "('email')\n", (1939, 1948), True, 'import utils.api.api as api\n'), ((4974,... |
import json
import logging
import os
import pytest
import threading
import time
from ocs_ci.framework import config
from ocs_ci.ocs import constants, ocp
from ocs_ci.ocs.resources import pod
from ocs_ci.utility.prometheus import PrometheusAPI
from tests import helpers
logger = logging.getLogger(__name__)
def measu... | [
"logging.getLogger",
"ocs_ci.ocs.resources.pod.get_ceph_tools_pod",
"os.path.exists",
"tests.helpers.create_unique_resource_name",
"json.dump",
"os.access",
"os.path.join",
"time.sleep",
"tests.helpers.create_dummy_osd",
"os.path.isfile",
"os.path.dirname",
"ocs_ci.framework.config.ENV_DATA.ge... | [((281, 308), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (298, 308), False, 'import logging\n'), ((5474, 5512), 'ocs_ci.framework.config.ENV_DATA.get', 'config.ENV_DATA.get', (['"""measurement_dir"""'], {}), "('measurement_dir')\n", (5493, 5512), False, 'from ocs_ci.framework import c... |
# -*- coding: utf-8 -*-
"""
批量生成日志
1. 每小时写3000个文件,每个文件增加100条记录,每个文件 100 * 24 => 2400 条记录
2. 文件名:202002120001 => 202002123000
"""
import os
import time
import random
import datetime
import shutil
file_nums = 100
log_nums = 100
path = os.path.dirname(os.path.abspath(__file__)) + "/logs"
log = " DEBUG [publisher] ... | [
"os.path.exists",
"os.listdir",
"random.shuffle",
"time.sleep",
"datetime.datetime.now",
"os.path.isdir",
"os.mkdir",
"shutil.rmtree",
"os.path.abspath",
"datetime.timedelta",
"time.time"
] | [((380, 391), 'time.time', 'time.time', ([], {}), '()\n', (389, 391), False, 'import time\n'), ((500, 516), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (510, 516), False, 'import os\n'), ((984, 1005), 'random.shuffle', 'random.shuffle', (['files'], {}), '(files)\n', (998, 1005), False, 'import random\n'), (... |
import factory
from examples.pg.db import model
class PostFactory(factory.Factory):
class Meta:
model = model.Post
title = factory.Faker("catch_phrase")
subtitle = factory.Faker("bs")
tagline = factory.Faker("bs")
body = factory.Faker("paragraph")
| [
"factory.Faker"
] | [((143, 172), 'factory.Faker', 'factory.Faker', (['"""catch_phrase"""'], {}), "('catch_phrase')\n", (156, 172), False, 'import factory\n'), ((188, 207), 'factory.Faker', 'factory.Faker', (['"""bs"""'], {}), "('bs')\n", (201, 207), False, 'import factory\n'), ((222, 241), 'factory.Faker', 'factory.Faker', (['"""bs"""'],... |
import pytest
@pytest.fixture(autouse=True)
def _autouse_resp_mocker(resp_mocker, version_api):
pass
| [
"pytest.fixture"
] | [((17, 45), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (31, 45), False, 'import pytest\n')] |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | [
"qiskit.pulse.GaussianSquare",
"numpy.isclose",
"numpy.sqrt",
"numpy.floor",
"qiskit.exceptions.QiskitError",
"qiskit_experiments.library.characterization.analysis.CrossResonanceHamiltonianAnalysis",
"qiskit.pulse.ControlChannel",
"qiskit.pulse.build",
"qiskit.pulse.DriveChannel",
"qiskit.QuantumC... | [((10037, 10054), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(2)'], {}), '(2)\n', (10051, 10054), False, 'from qiskit import pulse, circuit, QuantumCircuit\n'), ((16319, 16336), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(2)'], {}), '(2)\n', (16333, 16336), False, 'from qiskit import pulse, circuit, QuantumCircui... |
# -*- coding: utf-8 -*-
#
from __future__ import print_function
import math
import os
import re
import shutil
import subprocess
import tempfile
import imagehash
import matplotlib
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from PIL import Image
import matplotlib2tikz
class Phash(object):
d... | [
"matplotlib.pyplot.imshow",
"re.search",
"subprocess.check_output",
"PIL.Image.open",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.show",
"matplotlib.image.imread",
"math.sqrt",
"matplotlib.pyplot.close",
"os.path.dirname",
"matplotlib.pyplot.figure",
"os.path.abspath",
"matplotlib2tikz.s... | [((4323, 4341), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (4339, 4341), False, 'import tempfile\n'), ((4377, 4419), 'matplotlib.pyplot.savefig', 'plt.savefig', (['filename'], {'bbox_inches': '"""tight"""'}), "(filename, bbox_inches='tight')\n", (4388, 4419), True, 'import matplotlib.pyplot as plt\n'), (... |
# RosettesAndPolygons.py
import turtle
t = turtle.Pen()
turtle.bgcolor("black")
t.speed(40) # Set turtle drawing speed
colors=['deep sky blue', 'orange red', 'purple', 'yellow', 'cyan', 'green',
'deep pink', 'navy', 'lavender', 'aquamarine', 'pink', 'gold']
sides = int(turtle.numinput("Numbe... | [
"turtle.bgcolor",
"turtle.Pen",
"turtle.exitonclick",
"turtle.numinput"
] | [((47, 59), 'turtle.Pen', 'turtle.Pen', ([], {}), '()\n', (57, 59), False, 'import turtle\n'), ((61, 84), 'turtle.bgcolor', 'turtle.bgcolor', (['"""black"""'], {}), "('black')\n", (75, 84), False, 'import turtle\n'), ((922, 942), 'turtle.exitonclick', 'turtle.exitonclick', ([], {}), '()\n', (940, 942), False, 'import t... |
"""
Simulate a simple board game.
There are 2 players.
Each player takes turn rolling a die and moving that number of spaces.
The first person to space 100 wins.
"""
import random
def run_game():
scores = [0, 0]
while True:
for i, score in enumerate(scores):
player_num = i + 1
... | [
"random.randint"
] | [((328, 348), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (342, 348), False, 'import random\n')] |
#
# Copyright (c) 2018 Intel 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 agreed to... | [
"logging.getLogger",
"distiller.group_threshold_mask",
"torch.topk",
"distiller.volume",
"distiller.sparsity",
"distiller.find_module_by_fq_name",
"distiller.sparsity_3D",
"numpy.argsort",
"distiller.sparsity_ch",
"functools.partial",
"distiller.sparsity_blocks",
"torch.zeros",
"numpy.random... | [((734, 753), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (751, 753), False, 'import logging\n'), ((3289, 3313), 'functools.partial', 'partial', (['torch.norm'], {'p': '(1)'}), '(torch.norm, p=1)\n', (3296, 3313), False, 'from functools import partial\n'), ((3329, 3353), 'functools.partial', 'partial', ... |
"""Three points method for robot relocalization"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from compas.geometry import Frame
from compas.geometry import Transformation
from compas_mobile_robot_reloc.utils import TYPE_CHECKING
if TYPE_CHECKING:
... | [
"compas.geometry.Transformation.from_frame_to_frame",
"compas.geometry.Frame.worldXY",
"compas.geometry.Frame.from_points"
] | [((475, 498), 'compas.geometry.Frame.from_points', 'Frame.from_points', (['*pts'], {}), '(*pts)\n', (492, 498), False, 'from compas.geometry import Frame\n'), ((1226, 1300), 'compas.geometry.Transformation.from_frame_to_frame', 'Transformation.from_frame_to_frame', (['recorded_frame_rcs', 'recorded_frame_wcs'], {}), '(... |
import torch
import numpy as np
from typing import Union, Optional
from ..base import Flow
from .ic_helper import (
dist_deriv,
angle_deriv,
torsion_deriv,
det3x3,
init_xyz2ics,
init_ics2xyz,
ic2xyz_deriv,
)
from .pca import WhitenFlow
__all__ = [
"RelativeInternalCoordinateTransforma... | [
"numpy.union1d",
"numpy.sort",
"numpy.log",
"torch.stack",
"numpy.isin",
"numpy.any",
"numpy.argsort",
"numpy.sum",
"numpy.array",
"numpy.concatenate",
"torch.empty",
"torch.cat"
] | [((1966, 1980), 'numpy.sort', 'np.sort', (['fixed'], {}), '(fixed)\n', (1973, 1980), True, 'import numpy as np\n'), ((3117, 3138), 'numpy.concatenate', 'np.concatenate', (['atoms'], {}), '(atoms)\n', (3131, 3138), True, 'import numpy as np\n'), ((3156, 3178), 'numpy.argsort', 'np.argsort', (['index2atom'], {}), '(index... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
from datetime import datetime
from itertools import chain
import click
from elasticsearch import Elasticsearch, helpers
from elasticsearch.exceptions import NotFoundError
from pkg_resources import iter_entry_points
from click_conf import conf
from click_stream... | [
"logging.getLogger",
"click_stream.Stream",
"click.group",
"click.option",
"elasticsearch.Elasticsearch",
"pkg_resources.iter_entry_points",
"click_conf.conf",
"click.File",
"elasticsearch.helpers.bulk",
"time.sleep",
"datetime.datetime.now",
"logging.FileHandler",
"click.progressbar"
] | [((458, 492), 'logging.getLogger', 'logging.getLogger', (['"""elasticsearch"""'], {}), "('elasticsearch')\n", (475, 492), False, 'import logging\n'), ((2269, 2372), 'click.group', 'click.group', ([], {'invoke_without_command': '(True)', 'context_settings': "{'help_option_names': ['-h', '--help']}"}), "(invoke_without_c... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
from fairseq.data import data_utils
from . import BaseWrapperDataset
class TruncateDataset(BaseWrapperDataset... | [
"fairseq.data.data_utils.numpy_seed",
"numpy.minimum",
"numpy.random.randint"
] | [((907, 961), 'numpy.minimum', 'np.minimum', (['self.dataset.sizes', 'self.truncation_length'], {}), '(self.dataset.sizes, self.truncation_length)\n', (917, 961), True, 'import numpy as np\n'), ((1486, 1537), 'fairseq.data.data_utils.numpy_seed', 'data_utils.numpy_seed', (['self.seed', 'self.epoch', 'index'], {}), '(se... |
import torch
def fgsm(model_fn, x, eps, loss_fn=None, clip_min=-1, clip_max=1, y=None, targeted=False):
x = x.clone().detach().to(torch.float).requires_grad_(True)
if y is None:
_, y = torch.max(model_fn(x), 1)
if loss_fn is None:
loss_fn = torch.nn.CrossEntropyLoss()
loss = loss_fn(m... | [
"torch.sign",
"torch.nn.CrossEntropyLoss",
"torch.clamp"
] | [((272, 299), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (297, 299), False, 'import torch\n'), ((430, 448), 'torch.sign', 'torch.sign', (['x.grad'], {}), '(x.grad)\n', (440, 448), False, 'import torch\n'), ((551, 589), 'torch.clamp', 'torch.clamp', (['adv_x', 'clip_min', 'clip_max'], {}... |
from fastapi import APIRouter
from api_v1.endpoints.utils import connect_kafka
router = APIRouter()
@router.get("/")
async def root():
return {"message": "it's working!"}
@router.get("/{pkg_manager}/{product}/deps/{timestamp}")
def rebuild_dependency_net(pkg_manager: str, product: str, timestamp: int):
"""... | [
"fastapi.APIRouter",
"api_v1.endpoints.utils.connect_kafka"
] | [((89, 100), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (98, 100), False, 'from fastapi import APIRouter\n'), ((613, 628), 'api_v1.endpoints.utils.connect_kafka', 'connect_kafka', ([], {}), '()\n', (626, 628), False, 'from api_v1.endpoints.utils import connect_kafka\n')] |
from typing import Any
from typing import Dict
from typing import Generic
from typing import List
from typing import Optional
from typing import Tuple
from typing import Type
from typing import TypeVar
import attr
from xsdata.exceptions import XmlContextError
from xsdata.formats.dataclass.compat import ClassType
from ... | [
"attr.fields",
"xsdata.exceptions.XmlContextError",
"attr.ib",
"typing.TypeVar"
] | [((381, 407), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': 'object'}), "('T', bound=object)\n", (388, 407), False, 'from typing import TypeVar\n'), ((806, 827), 'attr.ib', 'attr.ib', ([], {'default': 'None'}), '(default=None)\n', (813, 827), False, 'import attr\n'), ((854, 875), 'attr.ib', 'attr.ib', ([], {'def... |
# Back propogate box features to input points.
# author: ynie
# date: March, 2020
# cite: PointNet++
from models.registers import MODULES
import torch
from torch import nn
from external.pointnet2_ops_lib.pointnet2_ops.pointnet2_modules import STN_Group
from models.iscnet.modules.layers import ResnetPointnet
from model... | [
"models.iscnet.modules.layers.ResnetPointnet",
"torch.cat",
"models.iscnet.modules.pointseg.PointSeg",
"torch.zeros_like",
"external.pointnet2_ops_lib.pointnet2_ops.pointnet2_modules.STN_Group",
"models.iscnet.modules.pointseg.get_loss",
"torch.argmax"
] | [((891, 961), 'external.pointnet2_ops_lib.pointnet2_ops.pointnet2_modules.STN_Group', 'STN_Group', ([], {'radius': '(1.0)', 'nsample': '(1024)', 'use_xyz': '(False)', 'normalize_xyz': '(True)'}), '(radius=1.0, nsample=1024, use_xyz=False, normalize_xyz=True)\n', (900, 961), False, 'from external.pointnet2_ops_lib.point... |
# coding=utf-8
# Copyright 2019 The Mesh TensorFlow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"mesh_tensorflow.experimental.unet.PostProcessor",
"numpy.prod",
"mesh_tensorflow.anonymize",
"mesh_tensorflow.utils.outside_all_rewrites",
"mesh_tensorflow.experimental.unet.get_input_mtf_shapes",
"mesh_tensorflow.Mesh",
"tensorflow.compat.v1.train.Scaffold.default_local_init_op",
"numpy.array",
"t... | [((1462, 1518), 'tensorflow.python.platform.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""use_tpu"""', '(True)', '"""Use TPU or GPU."""'], {}), "('use_tpu', True, 'Use TPU or GPU.')\n", (1482, 1518), False, 'from tensorflow.python.platform import flags\n'), ((1519, 1568), 'tensorflow.python.platform.flags.DEFINE... |
"""Module containing the authentication API of the v1 API."""
from typing import Dict
from flask.helpers import url_for
from flask.views import MethodView
from dataclasses import dataclass
from flask_jwt_extended import (
create_access_token,
create_refresh_token,
current_user,
)
from .root import API_V1
... | [
"flask.helpers.url_for",
"flask_jwt_extended.create_access_token",
"flask_jwt_extended.create_refresh_token"
] | [((3385, 3423), 'flask_jwt_extended.create_access_token', 'create_access_token', ([], {'identity': 'identity'}), '(identity=identity)\n', (3404, 3423), False, 'from flask_jwt_extended import create_access_token, create_refresh_token, current_user\n'), ((3455, 3494), 'flask_jwt_extended.create_refresh_token', 'create_re... |
import tensorflow as tf
from sklearn.preprocessing import MinMaxScaler
from sklearn.model_selection import train_test_split
import math
import numpy as np
class DataGenerator:
def __init__(self, config, features, labels):
self.config = config
self.features_train, self.features_test, self.labels_tr... | [
"sklearn.model_selection.train_test_split",
"numpy.array",
"sklearn.preprocessing.MinMaxScaler"
] | [((344, 431), 'sklearn.model_selection.train_test_split', 'train_test_split', (['features', 'labels'], {'test_size': 'self.config.test_size', 'shuffle': '(False)'}), '(features, labels, test_size=self.config.test_size, shuffle\n =False)\n', (360, 431), False, 'from sklearn.model_selection import train_test_split\n')... |
"""
Preview helper functions
"""
import os
import pathlib
from unittest import TestCase
from unittest.mock import patch
import pyarrow.parquet as pq
from py_w3c.validators.html.validator import HTMLValidator
from t4_lambda_shared.preview import (
extract_excel,
extract_fcs,
extract_parquet,
get_bytes,... | [
"t4_lambda_shared.preview.extract_parquet",
"t4_lambda_shared.preview.extract_excel",
"pathlib.Path",
"os.path.join",
"t4_lambda_shared.preview.extract_fcs",
"py_w3c.validators.html.validator.HTMLValidator",
"pyarrow.parquet.ParquetFile",
"unittest.mock.patch",
"t4_lambda_shared.preview.get_bytes"
] | [((398, 420), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (410, 420), False, 'import pathlib\n'), ((3728, 3743), 'py_w3c.validators.html.validator.HTMLValidator', 'HTMLValidator', ([], {}), '()\n', (3741, 3743), False, 'from py_w3c.validators.html.validator import HTMLValidator\n'), ((1215, 1269... |
import numpy as np
from src.maths import rotationMatrix
R = rotationMatrix(0, 0, 0)
R1 = rotationMatrix(0, 0, np.pi / 2)
R2 = rotationMatrix(0, 0, np.pi)
R3 = rotationMatrix(0, 0, 3 * np.pi / 2)
R4 = rotationMatrix(0, 0, 2 * np.pi)
R5 = rotationMatrix(0, np.pi / 2, 0)
R6 = rotationMatrix(0, np.pi, 0)
R7 = rotationM... | [
"src.maths.rotationMatrix",
"numpy.eye",
"numpy.abs",
"numpy.linalg.det",
"numpy.array",
"numpy.linalg.inv"
] | [((62, 85), 'src.maths.rotationMatrix', 'rotationMatrix', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (76, 85), False, 'from src.maths import rotationMatrix\n'), ((92, 123), 'src.maths.rotationMatrix', 'rotationMatrix', (['(0)', '(0)', '(np.pi / 2)'], {}), '(0, 0, np.pi / 2)\n', (106, 123), False, 'from src.maths impor... |
#!/usr/bin/env python3
from collections import OrderedDict
import re
import sys
try:
filename = sys.argv[1]
if '.' not in sys.argv[2]:
raise ValueError
except:
print('Usage: python3 {} filename (entity_id [attribute...])...'.format(sys.argv[0]))
sys.exit(1)
attrs = {}
entity_id = None
for ar... | [
"collections.OrderedDict",
"sys.exit",
"re.compile"
] | [((572, 672), 're.compile', 're.compile', (['"""([0-9-]+ [0-9:]+).*homeassistant_(start|started|stop|final_write|close)\\\\[.*"""'], {}), "(\n '([0-9-]+ [0-9:]+).*homeassistant_(start|started|stop|final_write|close)\\\\[.*'\n )\n", (582, 672), False, 'import re\n'), ((686, 739), 're.compile', 're.compile', (['"""... |
import asyncio
import math
import struct
import websockets
class SerialCommunicator(object):
def __init__(self, driverId):
self.driverId = driverId
self.rev_polys = []
self.available_structs = []
def handleMessage(self, msg):
print("handling message")
converted_msg = ... | [
"websockets.connect",
"struct.iter_unpack",
"math.floor"
] | [((340, 368), 'struct.iter_unpack', 'struct.iter_unpack', (['"""i"""', 'msg'], {}), "('i', msg)\n", (358, 368), False, 'import struct\n'), ((2893, 2915), 'math.floor', 'math.floor', (['(id / 10000)'], {}), '(id / 10000)\n', (2903, 2915), False, 'import math\n'), ((4009, 4032), 'websockets.connect', 'websockets.connect'... |
import argparse
import datetime
import fractions
import heapq
import inspect
import itertools
import logging
import os
import re
import sys
import time
# naming conventions:
# C, D clauses
# F, G formulas
# a, b terms or any values
# c character
# e exception
# f function
# i, j indexes
# m dict (... | [
"logging.getLogger",
"sys.setrecursionlimit",
"logging.StreamHandler",
"argparse.ArgumentParser",
"os.getenv",
"re.match",
"os.path.splitext",
"os.path.join",
"fractions.Fraction",
"os.path.isfile",
"heapq.heappop",
"os.path.basename",
"heapq.heappush",
"heapq.heapify",
"time.time",
"o... | [((530, 557), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(2000)'], {}), '(2000)\n', (551, 557), False, 'import sys\n'), ((957, 976), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (974, 976), False, 'import logging\n'), ((45006, 45031), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {... |
#################################################################################
#Script to calculate an input percentile for precipitation totals as a function of
#space, smooth window-to-window variability in percentile threshold via Fourier
#harmonics, and saves the result in netCDF4 format. Loads .npy files saved ... | [
"numpy.nanpercentile",
"numpy.array",
"numpy.sin",
"datetime.datetime.today",
"numpy.nanmin",
"datetime.timedelta",
"numpy.arange",
"datetime.datetime",
"numpy.mean",
"argparse.ArgumentParser",
"numpy.where",
"netCDF4.Dataset",
"numpy.diff",
"numpy.nanmax",
"netCDF4.date2num",
"numpy.i... | [((8394, 8419), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (8417, 8419), False, 'import argparse\n'), ((8801, 8845), 'datetime.datetime', 'datetime.datetime', ([], {'month': '(1)', 'day': '(1)', 'year': '(1915)'}), '(month=1, day=1, year=1915)\n', (8818, 8845), False, 'import datetime\n'), ... |
# coding=utf-8
import unittest
import ee
from .. import tools
ee.Initialize()
class TestImages(unittest.TestCase):
def setUp(self):
self.l8SR = ee.Image("LANDSAT/LC8_SR/LC82310772014043")
self.p_l8SR_cloud = ee.Geometry.Point([-65.8109, -25.0185])
self.p_l8SR_no_cloud = ee.Geometry.Point(... | [
"ee.Image",
"ee.Geometry.Point",
"ee.Initialize",
"ee.Image.constant"
] | [((62, 77), 'ee.Initialize', 'ee.Initialize', ([], {}), '()\n', (75, 77), False, 'import ee\n'), ((158, 201), 'ee.Image', 'ee.Image', (['"""LANDSAT/LC8_SR/LC82310772014043"""'], {}), "('LANDSAT/LC8_SR/LC82310772014043')\n", (166, 201), False, 'import ee\n'), ((231, 270), 'ee.Geometry.Point', 'ee.Geometry.Point', (['[-6... |
"""This module provides a class for managing a BIG-IP."""
# coding=utf-8
#
# Copyright (c) 2017-2021 F5 Networks, 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... | [
"logging.getLogger",
"f5_cccl.exceptions.F5CcclCacheRefreshError",
"requests.packages.urllib3.disable_warnings",
"copy.copy",
"time.time"
] | [((1828, 1894), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', (['InsecureRequestWarning'], {}), '(InsecureRequestWarning)\n', (1870, 1894), False, 'import requests\n'), ((1905, 1932), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1922, 1932)... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class PostCategory(models.Model):
name = models.CharField(max_length=100)
def __str__(self):
return self.name
class Post(models.Model):
title = models.CharField(max_length=100)
category = models.... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((140, 172), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (156, 172), False, 'from django.db import models\n'), ((265, 297), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (281, 297), False, 'from django.d... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2014, <NAME>, <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: rollbar_deployment
author: ... | [
"traceback.format_exc",
"ansible.module_utils.urls.fetch_url",
"ansible.module_utils.six.moves.urllib.parse.urlencode",
"ansible.module_utils._text.to_native"
] | [((3492, 3509), 'ansible.module_utils.six.moves.urllib.parse.urlencode', 'urlencode', (['params'], {}), '(params)\n', (3501, 3509), False, 'from ansible.module_utils.six.moves.urllib.parse import urlencode\n'), ((3535, 3583), 'ansible.module_utils.urls.fetch_url', 'fetch_url', (['module', 'url'], {'data': 'data', 'meth... |
# Copyright 2018-2021 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | [
"streamlit.delta_generator.DeltaGenerator",
"streamlit.logger.update_formatter",
"re.compile",
"streamlit.report_thread.get_report_ctx",
"urllib.parse.parse_qs",
"streamlit.caching.suppress_cached_st_function_warning",
"sys.exc_info",
"streamlit.config.on_config_parsed",
"streamlit.code_util.get_met... | [((1649, 1675), 'streamlit.logger.get_logger', '_logger.get_logger', (['"""root"""'], {}), "('root')\n", (1667, 1675), True, 'from streamlit import logger as _logger\n'), ((3631, 3677), 'streamlit.config.on_config_parsed', '_config.on_config_parsed', (['_update_logger', '(True)'], {}), '(_update_logger, True)\n', (3655... |
import sys
import os
import yaml
import argparse
import numpy as np
import pandas as pd
import csv
import random
import stat
import glob
import subprocess
from statistics import mean
from pprint import pprint, pformat
import geopandas
from shapely.geometry import Point
from math import sin, cos, atan2, sqrt, pi
from ... | [
"pandas.read_csv",
"numpy.hstack",
"math.sqrt",
"numpy.column_stack",
"math.cos",
"numpy.array",
"sys.exit",
"pymoo.factory.get_crossover",
"pymoo.factory.get_reference_directions",
"datetime.timedelta",
"os.path.exists",
"qcg.pilotjob.api.manager.LocalManager",
"argparse.ArgumentParser",
... | [((866, 891), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (881, 891), False, 'import os\n'), ((22500, 22516), 'time.monotonic', 'time.monotonic', ([], {}), '()\n', (22514, 22516), False, 'import time\n'), ((22584, 22609), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\... |
# coding:utf-8
#!/usr/bin/python
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
#
# ------------------------------------------------------------------------... | [
"maya.api.OpenMaya.MFnDependencyNode",
"maya.api.OpenMaya.MMessage.removeCallback",
"azpy.env_bool.env_bool",
"maya.api.OpenMaya.MObject"
] | [((2420, 2455), 'azpy.env_bool.env_bool', 'env_bool', (['ENVAR_DCCSI_GDEBUG', '(False)'], {}), '(ENVAR_DCCSI_GDEBUG, False)\n', (2428, 2455), False, 'from azpy.env_bool import env_bool\n'), ((2474, 2511), 'azpy.env_bool.env_bool', 'env_bool', (['ENVAR_DCCSI_DEV_MODE', '(False)'], {}), '(ENVAR_DCCSI_DEV_MODE, False)\n',... |
import os
import shutil
import subprocess
import tempfile
from contextlib import contextmanager
from packaging import version
from pathlib import Path
@contextmanager
def working_directory(path):
prev_cwd = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(prev_cw... | [
"tempfile.TemporaryDirectory",
"pathlib.Path",
"subprocess.run",
"os.utime",
"os.getcwd",
"os.chdir",
"os.mkdir",
"packaging.version.parse"
] | [((224, 235), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (233, 235), False, 'import os\n'), ((241, 255), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (249, 255), False, 'import os\n'), ((1779, 1807), 'pathlib.Path', 'Path', (['pyenv_path', '"""versions"""'], {}), "(pyenv_path, 'versions')\n", (1783, 1807), Fals... |
# Copyright 2014
# The Cloudscaling Group, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"logging.getLogger",
"select.select",
"tempest.cloudscaling.base.TestCasePreparationError",
"testtools.content.text_content",
"tempest.lib.decorators.attr",
"tempest.lib.common.utils.linux.remote_client.RemoteClient"
] | [((6154, 6187), 'tempest.lib.decorators.attr', 'decorators.attr', ([], {'type': '"""benchmark"""'}), "(type='benchmark')\n", (6169, 6187), False, 'from tempest.lib import decorators\n'), ((7032, 7065), 'tempest.lib.decorators.attr', 'decorators.attr', ([], {'type': '"""benchmark"""'}), "(type='benchmark')\n", (7047, 70... |
import os
import sys
from importlib import import_module
class Imports():
def import_selflib(self,module_Name):
module = import_module(module_Name)
return module
def import_multilib(self,*module_Names):
"""
::Params
... | [
"importlib.import_module"
] | [((146, 172), 'importlib.import_module', 'import_module', (['module_Name'], {}), '(module_Name)\n', (159, 172), False, 'from importlib import import_module\n'), ((802, 821), 'importlib.import_module', 'import_module', (['mods'], {}), '(mods)\n', (815, 821), False, 'from importlib import import_module\n')] |
from enum import Enum
import itertools
import json
import warnings
from ._util import cheap_repr, for_json
class CardClass(Enum):
normal = 1
split = 2
flip = 3
double_faced = 4
BFM = 5
def for_json(self):
return self.name
class MultipartDB:
... | [
"json.load",
"warnings.warn"
] | [((516, 533), 'json.load', 'json.load', (['infile'], {}), '(infile)\n', (525, 533), False, 'import json\n'), ((1029, 1146), 'warnings.warn', 'warnings.warn', (["('%s: name appears more than once in multipart file; subsequent appearance ignored'\n % (name,))"], {}), "(\n '%s: name appears more than once in multip... |
# 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 use ... | [
"libcloud.common.types.InvalidCredsError"
] | [((4819, 4859), 'libcloud.common.types.InvalidCredsError', 'InvalidCredsError', (["error['ERRORMESSAGE']"], {}), "(error['ERRORMESSAGE'])\n", (4836, 4859), False, 'from libcloud.common.types import InvalidCredsError\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 12 20:10:00 2020
@author: thorius
"""
import os
import sys
from queue import Queue
import numpy as np
import logging
import pyaudio
import time
from tflite_runtime.interpreter import Interpreter
import collections
from scipy import signal
class S... | [
"logging.getLogger",
"tflite_runtime.interpreter.Interpreter",
"os.path.join",
"numpy.argmax",
"logging.info",
"time.sleep",
"numpy.append",
"numpy.array",
"numpy.zeros",
"scipy.signal.resample",
"collections.Counter",
"numpy.expand_dims",
"numpy.frombuffer",
"queue.Queue",
"pyaudio.PyAu... | [((739, 758), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (756, 758), False, 'import logging\n'), ((1966, 1973), 'queue.Queue', 'Queue', ([], {}), '()\n', (1971, 1973), False, 'from queue import Queue\n'), ((2056, 2098), 'numpy.zeros', 'np.zeros', (['self.feed_samples'], {'dtype': '"""int16"""'}), "(sel... |
# Generated by Django 3.0.3 on 2021-05-02 12:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('bolsa', '0002_auto_20201027_0152'),
]
operations = [
migrations.RemoveField(
model_name='person',
name='function',
)... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((225, 285), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""person"""', 'name': '"""function"""'}), "(model_name='person', name='function')\n", (247, 285), False, 'from django.db import migrations\n'), ((330, 393), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([]... |
import cv2
import numpy as np
from numpy.linalg import norm
import sys
import os
import json
SZ = 20 #训练图片长宽
MAX_WIDTH = 1000 #原始图片最大宽度
Min_Area = 2000 #车牌区域允许最大面积
PROVINCE_START = 1000
#读取图片文件
def imreadex(filename):
return cv2.imdecode(np.fromfile(filename, dtype=np.uint8), cv2.IMREAD_COLOR)
def point_l... | [
"numpy.fromfile",
"numpy.sqrt",
"numpy.hstack",
"numpy.int32",
"numpy.array",
"numpy.linalg.norm",
"os.walk",
"os.path.exists",
"numpy.mean",
"cv2.threshold",
"cv2.contourArea",
"cv2.minAreaRect",
"cv2.addWeighted",
"numpy.min",
"cv2.warpAffine",
"numpy.ones",
"cv2.boxPoints",
"cv2... | [((1113, 1129), 'cv2.moments', 'cv2.moments', (['img'], {}), '(img)\n', (1124, 1129), False, 'import cv2\n'), ((1210, 1262), 'numpy.float32', 'np.float32', (['[[1, skew, -0.5 * SZ * skew], [0, 1, 0]]'], {}), '([[1, skew, -0.5 * SZ * skew], [0, 1, 0]])\n', (1220, 1262), True, 'import numpy as np\n'), ((1266, 1345), 'cv2... |
import torch
from lib.models import network
from lib.utils.model import custom_load
from pytorch_prototyping.pytorch_prototyping import *
from collections import OrderedDict
class RenderNet(torch.nn.Module):
def __init__(self, cfg):
super(RenderNet, self).__init__()
self.cfg = cfg
# text... | [
"lib.models.network.AlignModule",
"torch.stack",
"lib.models.network.RenderingModule",
"lib.utils.model.custom_load",
"lib.models.network.Rasterizer",
"lib.models.network.TextureMapper",
"torch.clamp"
] | [((361, 624), 'lib.models.network.TextureMapper', 'network.TextureMapper', ([], {'texture_size': 'cfg.MODEL.TEX_MAPPER.NUM_SIZE', 'texture_num_ch': 'cfg.MODEL.TEX_MAPPER.NUM_CHANNELS', 'texture_merge': 'cfg.MODEL.TEX_MAPPER.MERGE_TEX', 'mipmap_level': 'cfg.MODEL.TEX_MAPPER.MIPMAP_LEVEL', 'apply_sh': 'cfg.MODEL.TEX_MAPP... |
from glob import glob
from setuptools import setup
dict_files = glob("dict/*.dict")
setup(
packages=["kodespel"],
data_files=[('share/kodespel', dict_files)],
)
| [
"setuptools.setup",
"glob.glob"
] | [((65, 84), 'glob.glob', 'glob', (['"""dict/*.dict"""'], {}), "('dict/*.dict')\n", (69, 84), False, 'from glob import glob\n'), ((86, 159), 'setuptools.setup', 'setup', ([], {'packages': "['kodespel']", 'data_files': "[('share/kodespel', dict_files)]"}), "(packages=['kodespel'], data_files=[('share/kodespel', dict_file... |
from pathlib import Path
import re
from setuptools import setup
here = Path(__file__).parent
def find_version(path):
content = path.read_text(encoding="utf-8")
match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", content, re.M)
if match:
return match.group(1)
raise RuntimeError("Unable to... | [
"re.search",
"pathlib.Path"
] | [((72, 86), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (76, 86), False, 'from pathlib import Path\n'), ((179, 247), 're.search', 're.search', (['"""^__version__ = [\'\\\\"]([^\'\\\\"]*)[\'\\\\"]"""', 'content', 're.M'], {}), '(\'^__version__ = [\\\'\\\\"]([^\\\'\\\\"]*)[\\\'\\\\"]\', content, re.M)\n',... |
# -*- coding: utf-8 -*-
"""
Tests of the neo.core.irregularlysampledsignal.IrregularySampledSignal class
"""
import unittest
import os
import pickle
import warnings
from copy import deepcopy
import numpy as np
import quantities as pq
from numpy.testing import assert_array_equal
from neo.core.dataobject import Array... | [
"neo.test.tools.assert_same_array_annotations",
"neo.test.tools.assert_neo_object_is_compliant",
"neo.core.irregularlysampledsignal.IrregularlySampledSignal",
"neo.test.tools.assert_same_sub_schema",
"numpy.array",
"copy.deepcopy",
"unittest.main",
"numpy.arange",
"os.remove",
"neo.test.generate_d... | [((43190, 43243), 'unittest.skipUnless', 'unittest.skipUnless', (['HAVE_IPYTHON', '"""requires IPython"""'], {}), "(HAVE_IPYTHON, 'requires IPython')\n", (43209, 43243), False, 'import unittest\n'), ((47527, 47542), 'unittest.main', 'unittest.main', ([], {}), '()\n', (47540, 47542), False, 'import unittest\n'), ((1129,... |
"""General validation functions"""
from __future__ import absolute_import, division, print_function
import logging
import types
import inspect
from pbcommand.models import (FileTypes, TaskTypes, SymbolTypes, ResourceTypes, FileType)
from pbsmrtpipe.exceptions import (MalformedMetaTaskError, MalformedPipelineError)
... | [
"logging.getLogger",
"pbsmrtpipe.exceptions.MalformedMetaTaskError",
"pbsmrtpipe.constants.RX_VERSION.match",
"pbcommand.models.ResourceTypes.ALL",
"pbsmrtpipe.constants.RX_CHUNK_KEY.match",
"inspect.getargspec",
"pbsmrtpipe.constants.RX_TASK_ID.match"
] | [((398, 425), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (415, 425), False, 'import logging\n'), ((4450, 4474), 'inspect.getargspec', 'inspect.getargspec', (['func'], {}), '(func)\n', (4468, 4474), False, 'import inspect\n'), ((9649, 9668), 'pbsmrtpipe.constants.RX_VERSION.match', 'RX... |
# Copyright 2019 Xanadu Quantum Technologies Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agre... | [
"strawberryfields.Program",
"numpy.allclose",
"strawberryfields.ops.MeasureFock",
"strawberryfields.ops.GraphEmbed",
"strawberryfields.ops.LossChannel",
"numpy.random.seed",
"strawberryfields.ops.MeasureThreshold",
"strawberryfields.LocalEngine"
] | [((5616, 5633), 'strawberryfields.Program', 'sf.Program', (['nodes'], {}), '(nodes)\n', (5626, 5633), True, 'import strawberryfields as sf\n'), ((5644, 5678), 'strawberryfields.LocalEngine', 'sf.LocalEngine', ([], {'backend': '"""gaussian"""'}), "(backend='gaussian')\n", (5658, 5678), True, 'import strawberryfields as ... |
#!/usr/bin/env python
#
# Author: <NAME>
# License: BSD 2-clause
# Last Change: Thu Jul 29, 2021 at 03:51 PM +0200
import uproot
import sys
import os
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)))
from argparse import ArgumentParser
from pyTuplingUtils.utils import extract_uid
from pyTuplingUtils.cu... | [
"cutflow_gen.div_with_confint",
"cutflow_output_yml_gen.yaml_gen",
"argparse.ArgumentParser",
"os.path.realpath",
"uproot.open",
"pyTuplingUtils.cutflow.CutflowRule",
"pyTuplingUtils.cutflow.CutflowGen"
] | [((4076, 4109), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': 'descr'}), '(description=descr)\n', (4090, 4109), False, 'from argparse import ArgumentParser\n'), ((187, 213), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (203, 213), False, 'import os\n'), ((1854, 1886), ... |
from __future__ import division
import json
import tempfile
import unittest
import tttrlib
import numpy as np
print("Test: ", __file__)
settings = json.load(open(file="./test/settings.json"))
test_files = settings["test_files"]
class Tests(unittest.TestCase):
@unittest.expectedFailure
def test_reading(sel... | [
"tttrlib.TTTR",
"tempfile.mkstemp",
"numpy.allclose",
"tttrlib.TTTRHeader"
] | [((436, 454), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {}), '()\n', (452, 454), False, 'import tempfile\n'), ((964, 995), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'suffix': '""".spc"""'}), "(suffix='.spc')\n", (980, 995), False, 'import tempfile\n'), ((1060, 1093), 'tttrlib.TTTR', 'tttrlib.TTTR', (['filename',... |
# Copyright 2014, VIXL authors
# 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 conditions and the ... | [
"util.abort",
"util.getstatusoutput",
"re.compile"
] | [((1732, 1761), 'util.getstatusoutput', 'util.getstatusoutput', (['command'], {}), '(command)\n', (1752, 1761), False, 'import util\n'), ((1940, 1977), 'util.getstatusoutput', 'util.getstatusoutput', (['"""git status -s"""'], {}), "('git status -s')\n", (1960, 1977), False, 'import util\n'), ((2058, 2111), 're.compile'... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"traceback.format_exc",
"json.loads",
"kubernetes.config.load_incluster_config",
"kubernetes.watch.Watch",
"kubernetes.client.CoreV1Api",
"json.dumps",
"os.environ.get",
"time.sleep",
"re.search"
] | [((742, 789), 'os.environ.get', 'os.environ.get', (['"""NAMESPACE_TO_WATCH"""', '"""default"""'], {}), "('NAMESPACE_TO_WATCH', 'default')\n", (756, 789), False, 'import os\n'), ((792, 833), 'kubernetes.config.load_incluster_config', 'kubernetes.config.load_incluster_config', ([], {}), '()\n', (831, 833), False, 'import... |
#!/usr/bin/python
"""
vehicleDetection.py: version 0.1.0
History:
2017/01/29: coding style phase1:
reformat to python-guide.org code style
http://docs.python-guide.org/en/latest/writing/style/
which uses PEP 8 as a base: http://pep8.org/.
2017/01/23: Initial version converted to a class
"""
import matplot... | [
"os.path.exists",
"numpy.histogram",
"numpy.copy",
"matplotlib.pyplot.savefig",
"cv2.resize",
"os.makedirs",
"sklearn.externals.joblib.load",
"matplotlib.pyplot.Subplot",
"numpy.concatenate",
"cv2.cvtColor",
"p5lib.roadGrid.RoadGrid",
"skimage.feature.hog",
"time.gmtime",
"numpy.poly1d",
... | [((2488, 2544), 'numpy.histogram', 'np.histogram', (['img[:, :, 0]'], {'bins': 'nbins', 'range': 'bins_range'}), '(img[:, :, 0], bins=nbins, range=bins_range)\n', (2500, 2544), True, 'import numpy as np\n'), ((2582, 2638), 'numpy.histogram', 'np.histogram', (['img[:, :, 1]'], {'bins': 'nbins', 'range': 'bins_range'}), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import telebot
import requests
from decouple import config
API_TOKEN = config('API_TOKEN')
bot = telebot.TeleBot(API_TOKEN)
users_files = {}
@bot.message_handler(content_types=['video'])
def handle_video(message):
"""Add sent video to user's video... | [
"decouple.config",
"telebot.TeleBot",
"subprocess.call"
] | [((138, 157), 'decouple.config', 'config', (['"""API_TOKEN"""'], {}), "('API_TOKEN')\n", (144, 157), False, 'from decouple import config\n'), ((164, 190), 'telebot.TeleBot', 'telebot.TeleBot', (['API_TOKEN'], {}), '(API_TOKEN)\n', (179, 190), False, 'import telebot\n'), ((1316, 1408), 'subprocess.call', 'subprocess.cal... |
"""migrate workbench state enum
Revision ID: cfd1c43b5d33
Revises: c8a7073deebb
Create Date: 2020-11-17 16:42:32.511722+00:00
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cfd1c43b5d33'
down_revision = 'c8a7073deebb'
branch_labels = None
depends_on = None
... | [
"sqlalchemy.DDL"
] | [((359, 538), 'sqlalchemy.DDL', 'sa.DDL', (['"""\nUPDATE projects\n SET workbench = (regexp_replace(workbench::text, \'"FAILURE"\', \'"FAILED"\'))::json\n WHERE workbench::text LIKE \'%%FAILURE%%\'\n """'], {}), '(\n """\nUPDATE projects\n SET workbench = (regexp_replace(workbench::text, \'"FAILURE"\... |
#!/usr/bin/env python3.7
# Copyright 2019, Gurobi Optimization, LLC
# This example formulates and solves the following simple model
# with PWL constraints:
#
# maximize
# sum c[j] * x[j]
# subject to
# sum A[i,j] * x[j] <= 0, for i = 0, ..., m-1
# sum y[j] <= 3
# y[j] = pwl(x[j]), ... | [
"gurobipy.Model"
] | [((1316, 1334), 'gurobipy.Model', 'gp.Model', (['"""gc_pwl"""'], {}), "('gc_pwl')\n", (1324, 1334), True, 'import gurobipy as gp\n')] |
import codecs
import os
import utils
train_parameters = {
"data_dir": ".", # 训练数据存储地址
"num_epochs": 10000,
"train_batch_size": 64,
"infer_img": 'img.jpg',
"mean_rgb": [85, 96, 102], # 常用图片的三通道均值,通常来说需要先对训练数据做统计,此处仅取中间值
"input_size": [3, 224, 224],
"class_dim": -1, # 分类数... | [
"codecs.open",
"os.path.join"
] | [((1953, 2027), 'os.path.join', 'os.path.join', (["train_parameters['data_dir']", "train_parameters['label_file']"], {}), "(train_parameters['data_dir'], train_parameters['label_file'])\n", (1965, 2027), False, 'import os\n'), ((2381, 2460), 'os.path.join', 'os.path.join', (["train_parameters['data_dir']", "train_param... |
from mongo.data.base import mongo_database
database = mongo_database()
def mongo_collection(collection):
return database[collection]
def mongo_collections():
return database.list_collection_names()
| [
"mongo.data.base.mongo_database"
] | [((55, 71), 'mongo.data.base.mongo_database', 'mongo_database', ([], {}), '()\n', (69, 71), False, 'from mongo.data.base import mongo_database\n')] |
import sys
import copy
import numpy as np
from pyrigidbody3d import geometry
from pyrigidbody3d import rigidbody
from pyrigidbody3d import world
# real-time updates are a bit choppy
import meshcat
import meshcat.geometry as g
import meshcat.transformations as tf
import math
import time
import numpy as np
SIMULATI... | [
"meshcat.geometry.MeshLambertMaterial",
"meshcat.Visualizer",
"pyrigidbody3d.geometry.Sphere",
"meshcat.animation.Animation",
"meshcat.geometry.Sphere",
"numpy.array",
"meshcat.transformations.rotation_matrix",
"meshcat.geometry.MeshPhongMaterial",
"pyrigidbody3d.geometry.Plane",
"pyrigidbody3d.wo... | [((404, 438), 'pyrigidbody3d.world.World', 'world.World', (['NUM_SOLVER_ITERATIONS'], {}), '(NUM_SOLVER_ITERATIONS)\n', (415, 438), False, 'from pyrigidbody3d import world\n'), ((463, 490), 'numpy.array', 'np.array', (['[0.0, -2.0, -9.8]'], {}), '([0.0, -2.0, -9.8])\n', (471, 490), True, 'import numpy as np\n'), ((549,... |
"""Provide pre-made queries on top of the recorder component."""
from __future__ import annotations
from collections.abc import Iterable
from datetime import datetime as dt, timedelta
from http import HTTPStatus
import logging
import time
from typing import cast
from aiohttp import web
from sqlalchemy import not_, or... | [
"logging.getLogger",
"homeassistant.util.dt.utcnow",
"voluptuous.Any",
"homeassistant.helpers.deprecation.deprecated_function",
"homeassistant.components.recorder.history.get_significant_states",
"datetime.timedelta",
"voluptuous.Optional",
"time.perf_counter",
"homeassistant.helpers.deprecation.dep... | [((1205, 1232), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1222, 1232), False, 'import logging\n'), ((1556, 1648), 'homeassistant.helpers.deprecation.deprecated_function', 'deprecated_function', (['"""homeassistant.components.recorder.history.get_significant_states"""'], {}), "(\n ... |
from unittest.mock import MagicMock, patch
from django.core.cache import cache
from django.test import override_settings
from django.urls import reverse
from django.utils import timezone
from django.utils.timezone import timedelta
from axes.conf import settings
from axes.handlers.proxy import AxesProxyHandler
from ax... | [
"axes.helpers.get_client_str",
"axes.models.AccessAttempt.objects.get",
"axes.handlers.proxy.AxesProxyHandler.user_logged_in",
"django.utils.timezone.timedelta",
"axes.handlers.proxy.AxesProxyHandler.post_delete_access_attempt",
"axes.handlers.proxy.AxesProxyHandler.reset_logs",
"django.urls.reverse",
... | [((441, 505), 'django.test.override_settings', 'override_settings', ([], {'AXES_HANDLER': '"""axes.handlers.base.AxesHandler"""'}), "(AXES_HANDLER='axes.handlers.base.AxesHandler')\n", (458, 505), False, 'from django.test import override_settings\n'), ((5457, 5533), 'django.test.override_settings', 'override_settings',... |
# 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... | [
"numpy.isscalar",
"numpy.logical_and",
"numpy.size",
"numpy.logical_not",
"numpy.max",
"numpy.array",
"numpy.zeros",
"tensorboard.utils.command_parser._parse_slices",
"tensorboard.build_with_tf.use_tf",
"numpy.isnan",
"binascii.b2a_qp",
"numpy.min",
"tensorboard.util.encode_png",
"numpy.ex... | [((943, 965), 'tensorboard.build_with_tf.use_tf', 'build_with_tf.use_tf', ([], {}), '()\n', (963, 965), False, 'from tensorboard import build_with_tf, util\n'), ((1713, 1744), 'tensorboard.utils.command_parser._parse_slices', 'command_parser._parse_slices', (['s'], {}), '(s)\n', (1741, 1744), False, 'from tensorboard.u... |
from lib2to3.pgen2.tokenize import StopTokenizing
from floodsystem.stationdata import build_station_list, update_water_levels
from floodsystem.flood import stations_level_over_threshold
from floodsystem.datafetcher import fetch_measure_levels
from floodsystem.plot import plot_water_levels
import datetime
import matplot... | [
"floodsystem.plot.plot_water_levels",
"floodsystem.utils.sorted_by_key",
"floodsystem.stationdata.build_station_list",
"datetime.timedelta",
"floodsystem.stationdata.update_water_levels"
] | [((403, 423), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (421, 423), False, 'from floodsystem.stationdata import build_station_list, update_water_levels\n'), ((428, 457), 'floodsystem.stationdata.update_water_levels', 'update_water_levels', (['stations'], {}), '(stations)\n', ... |
from openerp import fields,models
class Session(models.Model):
_name = 'openacademy.session'
name = fields.Char(required=True)
start_date = fields.Date()
duration = fields.Float(digits=(6, 2), help="Duration in days")
seats = fields.Integer(string="Number of seats")
instructor_id = fields.Man... | [
"openerp.fields.Integer",
"openerp.fields.Many2one",
"openerp.fields.Char",
"openerp.fields.Many2many",
"openerp.fields.Date",
"openerp.fields.Float"
] | [((111, 137), 'openerp.fields.Char', 'fields.Char', ([], {'required': '(True)'}), '(required=True)\n', (122, 137), False, 'from openerp import fields, models\n'), ((155, 168), 'openerp.fields.Date', 'fields.Date', ([], {}), '()\n', (166, 168), False, 'from openerp import fields, models\n'), ((184, 236), 'openerp.fields... |
# Generated by Django 2.2.4 on 2019-11-14 00:24
import common.models
from django.db import migrations, models
import push_notifications.validation
class Migration(migrations.Migration):
dependencies = [
('push_notifications', '0002_auto_20191112_2120'),
]
operations = [
migrations.AddFi... | [
"django.db.models.DateTimeField"
] | [((422, 457), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (442, 457), False, 'from django.db import migrations, models\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"aliyunsdkdms_enterprise.endpoint.endpoint_data.getEndpointMap",
"aliyunsdkdms_enterprise.endpoint.endpoint_data.getEndpointRegional",
"aliyunsdkcore.request.RpcRequest.__init__"
] | [((961, 1056), 'aliyunsdkcore.request.RpcRequest.__init__', 'RpcRequest.__init__', (['self', '"""dms-enterprise"""', '"""2018-11-01"""', '"""ListInstances"""', '"""dmsenterprise"""'], {}), "(self, 'dms-enterprise', '2018-11-01', 'ListInstances',\n 'dmsenterprise')\n", (980, 1056), False, 'from aliyunsdkcore.request ... |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url, include
from siva.utils import make_url_list
from maestros.views import *
__author__ = 'julian'
#lista_urls=('terceros','personal','actividades','unidades','parametrosanalisis','catalogoequipos','tipostemperaturas','zonas','tiposmedidasactuacion','ti... | [
"django.conf.urls.url",
"django.conf.urls.patterns",
"siva.utils.make_url_list"
] | [((816, 834), 'django.conf.urls.patterns', 'patterns', (['""""""', '*tup'], {}), "('', *tup)\n", (824, 834), False, 'from django.conf.urls import patterns, url, include\n'), ((764, 801), 'siva.utils.make_url_list', 'make_url_list', (['lista_urls', '"""maestros"""'], {}), "(lista_urls, 'maestros')\n", (777, 801), False,... |
#!/usr/bin/env python
"""
<Program Name>
common.py
<Author>
<NAME> <<EMAIL>>
<Started>
Feb 6, 2018
<Copyright>
See LICENSE for licensing information.
<Purpose>
Common code for in-toto unittests, import like so:
`import tests.common`
Tests importing this module, should be run from the project root, e.... | [
"os.path.realpath",
"inspect.getmodule",
"mock.patch.object",
"os.path.basename"
] | [((2231, 2258), 'os.path.basename', 'os.path.basename', (['file_path'], {}), '(file_path)\n', (2247, 2258), False, 'import os\n'), ((789, 815), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (805, 815), False, 'import os\n'), ((2163, 2200), 'inspect.getmodule', 'inspect.getmodule', (['self.... |
import cv2
import os
SRC_PATH = './UChile_db_pascal_v0/Images'
DST_PATH = './UChile_db_pascal_v0/New'
images = os.listdir(SRC_PATH)
#print(images)
img0 = cv2.imread(SRC_PATH+'/'+images[0])
print('Shape: {}'.format(img0.shape))
h,w,channels = img0.shape
if w > h:
new_w, new_h = 640, 480
else:
new_w, new_h = 480... | [
"cv2.imwrite",
"cv2.resize",
"os.listdir",
"cv2.imread"
] | [((114, 134), 'os.listdir', 'os.listdir', (['SRC_PATH'], {}), '(SRC_PATH)\n', (124, 134), False, 'import os\n'), ((158, 196), 'cv2.imread', 'cv2.imread', (["(SRC_PATH + '/' + images[0])"], {}), "(SRC_PATH + '/' + images[0])\n", (168, 196), False, 'import cv2\n'), ((334, 366), 'cv2.resize', 'cv2.resize', (['img0', '(new... |
# -*- coding: utf-8 -*-
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import binascii
import collections
import datetim... | [
"cryptography.x509.DeltaCRLIndicator",
"ipaddress.IPv6Network",
"cryptography.x509.CRLReason",
"cryptography.x509.ExtendedKeyUsage",
"cryptography.utils.read_only_property",
"cryptography.hazmat.primitives.hashes.SHA512",
"cryptography.x509.UniformResourceIdentifier",
"cryptography.x509.UserNotice",
... | [((1536, 1580), 'cryptography.utils.register_interface', 'utils.register_interface', (['x509.ExtensionType'], {}), '(x509.ExtensionType)\n', (1560, 1580), False, 'from cryptography import utils, x509\n'), ((1657, 1699), 'cryptography.utils.register_interface', 'utils.register_interface', (['x509.GeneralName'], {}), '(x... |
import json
import django
from django.apps import apps
from django.conf import settings
try:
from django.core.urlresolvers import reverse
except ImportError:
# TODO: swap this over when Django 2+ becomes more prevalent
from django.urls import reverse
from django.forms.widgets import Select, SelectMultiple... | [
"json.dumps",
"smart_selects.utils.sort_results",
"django.forms.widgets.Media",
"django.utils.html.escape",
"django.utils.safestring.mark_safe",
"django.urls.reverse",
"smart_selects.utils.unicode_sorter"
] | [((1493, 1505), 'django.forms.widgets.Media', 'Media', ([], {'js': 'js'}), '(js=js)\n', (1498, 1505), False, 'from django.forms.widgets import Select, SelectMultiple, Media\n'), ((2774, 2786), 'django.forms.widgets.Media', 'Media', ([], {'js': 'js'}), '(js=js)\n', (2779, 2786), False, 'from django.forms.widgets import ... |
import salabim as sim
def do_animation():
waiting_clients.animate(x=800, y=200)
for i, server in enumerate(servers):
server.atwork.animate(x=900, y=200 + i * 50)
sim.Animate(text='Server', x0=900, y0=200 - 50, anchor='n')
sim.Animate(text='<-- Waiting line', x0=900 - 145, y0=200 - 50, anchor=... | [
"salabim.Animate",
"salabim.State",
"salabim.Environment",
"salabim.Queue",
"salabim.Exponential"
] | [((1184, 1201), 'salabim.Environment', 'sim.Environment', ([], {}), '()\n', (1199, 1201), True, 'import salabim as sim\n'), ((1221, 1249), 'salabim.Queue', 'sim.Queue', (['"""waiting_clients"""'], {}), "('waiting_clients')\n", (1230, 1249), True, 'import salabim as sim\n'), ((1263, 1286), 'salabim.State', 'sim.State', ... |
# -*- coding: utf-8 -*-
from datetime import datetime
from time import sleep
import pytest
from mock import Mock
import beer_garden.metrics as metrics
@pytest.fixture
def prometheus_mocks(monkeypatch):
# TODO - Test http api latency
# monkeypatch.setattr(metrics, "http_api_latency_total", Mock())
monkey... | [
"beer_garden.metrics.initialize_counts",
"beer_garden.metrics.queued_request_gauge.labels.assert_called_once_with",
"datetime.datetime.utcnow",
"mock.Mock",
"beer_garden.metrics.request_counter_total.labels.assert_called_once_with",
"beer_garden.metrics.request_started",
"time.sleep",
"pytest.mark.par... | [((682, 729), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""wait"""', '[0, 0.1, 0.25]'], {}), "('wait', [0, 0.1, 0.25])\n", (705, 729), False, 'import pytest\n'), ((914, 1034), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""status,queued,in_progress"""', "[('CREATED', 1, 0), ('IN_PROGRESS', 0... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import signal
import threading
import torch
import torch.nn as nn
from torch.nn.parallel import DistributedDataParal... | [
"logging.getLogger",
"torch.distributed.algorithms.ddp_comm_hooks.register_ddp_comm_hook",
"fairseq.distributed.ModuleProxyWrapper"
] | [((494, 521), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (511, 521), False, 'import logging\n'), ((1728, 1761), 'fairseq.distributed.ModuleProxyWrapper', 'ModuleProxyWrapper', (['wrapped_model'], {}), '(wrapped_model)\n', (1746, 1761), False, 'from fairseq.distributed import Distribut... |
# JOKENPO COM SPOCK E LARGATO
cores = {'branco': '\033[30m', # pegando todas as cores pra não ter trabalho depois
'vermelho': '\033[31m',
'verde': '\033[32m',
'amarelo': '\033[33m',
'azul': '\033[34m',
'roxo': '\033[35m',
'azulmarinho': '\033[36m',
'cinza':... | [
"random.randint",
"time.sleep"
] | [((2026, 2039), 'random.randint', 'randint', (['(1)', '(5)'], {}), '(1, 5)\n', (2033, 2039), False, 'from random import randint\n'), ((2307, 2317), 'time.sleep', 'sleep', (['(0.7)'], {}), '(0.7)\n', (2312, 2317), False, 'from time import sleep\n'), ((2338, 2348), 'time.sleep', 'sleep', (['(0.7)'], {}), '(0.7)\n', (2343... |
"""Sarsa"""
import numpy as np
from RL_brain import SarsaLambda
from environment import TestEnv
np.set_printoptions(precision=2, suppress=True)
env = TestEnv(10)
print("Observation_space{}\nAction_space{}".
format(env.observation_space, env.action_space))
RL = SarsaLambda(range(env.action_space.n), reward_deca... | [
"environment.TestEnv",
"numpy.set_printoptions"
] | [((97, 144), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)', 'suppress': '(True)'}), '(precision=2, suppress=True)\n', (116, 144), True, 'import numpy as np\n'), ((152, 163), 'environment.TestEnv', 'TestEnv', (['(10)'], {}), '(10)\n', (159, 163), False, 'from environment import TestEnv\n')] |