code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import unittest
from resthelper.utils import build_restful_url
class TestBuildUrl(unittest.TestCase):
def test_is_restful_https_url(self):
url = build_restful_url('https://jenkins1.tttech.com',
'testuser', '/rest/1.0/request')
self.assertEqual(url,
'htt... | [
"unittest.main",
"resthelper.utils.build_restful_url"
] | [((672, 687), 'unittest.main', 'unittest.main', ([], {}), '()\n', (685, 687), False, 'import unittest\n'), ((160, 245), 'resthelper.utils.build_restful_url', 'build_restful_url', (['"""https://jenkins1.tttech.com"""', '"""testuser"""', '"""/rest/1.0/request"""'], {}), "('https://jenkins1.tttech.com', 'testuser',\n '... |
""" python-rq based backend
This backend will send your messages asynchronously with python-rq.
Before using this backend, make sure that django-rq is installed and
configured.
Usage
-----
In settings.py
SENDSMS_BACKEND = 'sendsms.backends.rq.SmsBackend'
RQ_SENDSMS_BACKEND = 'actual.backend.to.use.SmsBack... | [
"sendsms.api.get_connection",
"django.core.exceptions.ImproperlyConfigured"
] | [((641, 687), 'django.core.exceptions.ImproperlyConfigured', 'ImproperlyConfigured', (['"""Set RQ_SENDSMS_BACKEND"""'], {}), "('Set RQ_SENDSMS_BACKEND')\n", (661, 687), False, 'from django.core.exceptions import ImproperlyConfigured\n'), ((741, 775), 'sendsms.api.get_connection', 'get_connection', (['RQ_SENDSMS_BACKEND... |
import json
import sys
def compatible_loads(json_data):
"""
Function json.loads in python 3.0 - 3.5 can't handle bytes, so this function handle it.
:param json_data:
:return: unicode (str if it's python 3)
"""
if isinstance(json_data, bytes) and (3, 0) <= sys.version_info < (3, 6):
... | [
"json.loads"
] | [((378, 399), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (388, 399), False, 'import json\n')] |
import sys,time
def sprint(str):
for c in str + '\n':
sys.stdout.write(c)
sys.stdout.flush()
time.sleep(3./90)
from colorama import Fore, Back, Style
sprint (Fore.RED + "แแแแแ แฏแแแ. tool-แ แจแแฅแแแแแแ แแแแแ แงแแคแแแแ-DaduVoke-แแก แแแแ @2021")
import socket
import _thread
im... | [
"socket.gethostbyname",
"socket.getservbyport",
"socket.socket",
"time.sleep",
"sys.stdout.flush",
"_thread.start_new_thread",
"sys.stdout.write"
] | [((75, 94), 'sys.stdout.write', 'sys.stdout.write', (['c'], {}), '(c)\n', (91, 94), False, 'import sys, time\n'), ((103, 121), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (119, 121), False, 'import sys, time\n'), ((130, 150), 'time.sleep', 'time.sleep', (['(3.0 / 90)'], {}), '(3.0 / 90)\n', (140, 150), Fa... |
#################################################################################
# The Institute for the Design of Advanced Energy Systems Integrated Platform
# Framework (IDAES IP) was produced under the DOE Institute for the
# Design of Advanced Energy Systems (IDAES), and is copyright (c) 2018-2021
# by the softwar... | [
"copy.deepcopy",
"numpy.cross",
"math.sqrt",
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((1104, 1111), 'math.sqrt', 'sqrt', (['(3)'], {}), '(3)\n', (1108, 1111), False, 'from math import sqrt\n'), ((6940, 7002), 'copy.deepcopy', 'deepcopy', (['self._NthNeighbors[layer - 1][self._typeDict[PType]]'], {}), '(self._NthNeighbors[layer - 1][self._typeDict[PType]])\n', (6948, 7002), False, 'from copy import dee... |
from util.infinity import INFINITY
from tc_python.arule import ARule
from t_core.rollbacker import Rollbacker
from t_core.resolver import Resolver
class XRule(ARule):
'''
Applies the transformation on one match with roll-back capability.
'''
def __init__(self, LHS, RHS, max_iterations=... | [
"t_core.resolver.Resolver",
"t_core.rollbacker.Rollbacker"
] | [((823, 879), 't_core.rollbacker.Rollbacker', 'Rollbacker', ([], {'condition': 'LHS', 'max_iterations': 'max_iterations'}), '(condition=LHS, max_iterations=max_iterations)\n', (833, 879), False, 'from t_core.rollbacker import Rollbacker\n'), ((3988, 4083), 't_core.resolver.Resolver', 'Resolver', ([], {'external_matches... |
from bs4 import BeautifulSoup
import requests
import re
def retrieveText():
print("Parsing text from online target")
url = "https://www.whitehouse.gov/the-press-office/2017/10/16/remarks-president-trump-and-senate-majority-leader-mitch-mcconnell-joint"
response = requests.get(url)
soup = BeautifulSoup(... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((277, 294), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (289, 294), False, 'import requests\n'), ((306, 345), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.content', '"""lxml"""'], {}), "(response.content, 'lxml')\n", (319, 345), False, 'from bs4 import BeautifulSoup\n')] |
"""
Django settings for city-infrastructure-platform project.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
"""
import os
import environ
import sentry_sdk
from djan... | [
"os.path.exists",
"environ.Path",
"sentry_sdk.integrations.django.DjangoIntegration",
"django.utils.translation.gettext_lazy",
"django.core.exceptions.ImproperlyConfigured",
"environ.Env"
] | [((987, 2068), 'environ.Env', 'environ.Env', ([], {'DEBUG': '(bool, False)', 'TIER': "(str, 'dev')", 'SECRET_KEY': "(str, '')", 'VAR_ROOT': '(str, default_var_root)', 'ALLOWED_HOSTS': '(list, [])', 'TRUST_X_FORWARDED_HOST': '(bool, False)', 'DATABASE_URL': "(str, 'postgis:///city-infrastructure-platform')", 'CACHE_URL'... |
# !/usr/bin/python
# -*- coding: utf-8 -*-
# @time : 2021/7/25 19:30
# @author : Mo
# @function: predict model, ้ขๆตๆจกๅ-ๅค็ฑปๅ็ฑป
# ้้
linux
import platform
import json
import sys
import os
path_root = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
path_sys = os.path.join(path_root, "pytorch_nlu", "pyto... | [
"os.path.dirname",
"os.path.join",
"tcPredict.TextClassificationPredict"
] | [((276, 344), 'os.path.join', 'os.path.join', (['path_root', '"""pytorch_nlu"""', '"""pytorch_textclassification"""'], {}), "(path_root, 'pytorch_nlu', 'pytorch_textclassification')\n", (288, 344), False, 'import os\n'), ((566, 604), 'tcPredict.TextClassificationPredict', 'TextClassificationPredict', (['path_config'], ... |
import unittest
from stringsheet.parser import create_spreadsheet_values
from stringsheet.parser import create_language_sheet_values
from stringsheet.parser import parse_resources
class BaseTestCase(unittest.TestCase):
def setUp(self):
self.resources = parse_resources('test-resources/res')
class Create... | [
"unittest.main",
"stringsheet.parser.create_spreadsheet_values",
"stringsheet.parser.parse_resources",
"stringsheet.parser.create_language_sheet_values"
] | [((5629, 5644), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5642, 5644), False, 'import unittest\n'), ((268, 305), 'stringsheet.parser.parse_resources', 'parse_resources', (['"""test-resources/res"""'], {}), "('test-resources/res')\n", (283, 305), False, 'from stringsheet.parser import parse_resources\n'), ((4... |
import os, sys
import numpy as np
from sedflow import obs as Obs
from sedflow import train as Train
from provabgs import infer as Infer
from provabgs import models as Models
####################################################
# input
####################################################
sample = sys.argv[1]
itrain... | [
"provabgs.models.NMF",
"sedflow.train.mag2flux",
"provabgs.infer.nsaMCMC",
"provabgs.infer.LogUniformPrior",
"provabgs.infer.UniformPrior",
"sedflow.obs.load_nsa_data",
"os.path.join",
"sedflow.train.sigma_mag2flux",
"os.path.isfile",
"provabgs.infer.FlatDirichletPrior",
"numpy.isfinite",
"os.... | [((689, 722), 'sedflow.obs.load_nsa_data', 'Obs.load_nsa_data', ([], {'test_set': '(False)'}), '(test_set=False)\n', (706, 722), True, 'from sedflow import obs as Obs\n'), ((732, 798), 'numpy.load', 'np.load', (['"""/scratch/network/chhahn/sedflow/nsa_fail/fail.igals.npy"""'], {}), "('/scratch/network/chhahn/sedflow/ns... |
import json
import time
import re
from .keyvalue_provider import KeyValueProvider
from .gcloud_artifact_store import GCloudArtifactStore
from .util import timeit
class GSProvider(KeyValueProvider):
def __init__(self, config, blocking_auth=True, verbose=10, store=None):
self.config = config
self.b... | [
"re.sub",
"json.dumps",
"time.sleep"
] | [((2686, 2708), 'time.sleep', 'time.sleep', (['sleep_time'], {}), '(sleep_time)\n', (2696, 2708), False, 'import time\n'), ((958, 982), 're.sub', 're.sub', (["('^' + key)", '""""""', 'p'], {}), "('^' + key, '', p)\n", (964, 982), False, 'import re\n'), ((1370, 1402), 're.sub', 're.sub', (["('^' + key)", '""""""', 'blob... |
import logging
from urllib.parse import unquote, urlparse
from pathlib import PurePosixPath
import requests
from requests.exceptions import ReadTimeout, ConnectionError, HTTPError
from django.core.management.base import BaseCommand
from django.core.files.base import ContentFile
from places.models import Place, Image
... | [
"logging.basicConfig",
"django.core.files.base.ContentFile",
"urllib.parse.urlparse",
"requests.get",
"logging.exception",
"places.models.Image.objects.get_or_create",
"logging.info",
"places.models.Place.objects.get_or_create"
] | [((321, 396), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(format='%(levelname)s:%(message)s', level=logging.INFO)\n", (340, 396), False, 'import logging\n'), ((670, 687), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (682, 687... |
# -*- coding: utf-8 -*-
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"gslib.utils.translation_helper.AclTranslation.JsonFromMessage",
"gslib.wildcard_iterator.StorageUrlFromString",
"gslib.exception.CommandException",
"six.ensure_str",
"gslib.utils.text_util.print_to_fd",
"gslib.storage_url.GenerationFromUrlAndString"
] | [((3413, 3465), 'gslib.utils.text_util.print_to_fd', 'text_util.print_to_fd', (['bucket_listing_ref.url_string'], {}), '(bucket_listing_ref.url_string)\n', (3434, 3465), False, 'from gslib.utils import text_util\n'), ((4177, 4200), 'gslib.utils.text_util.print_to_fd', 'text_util.print_to_fd', ([], {}), '()\n', (4198, 4... |
import os
from tqdm import tqdm
import cv2
import numpy as np
#pre process test data:
path = "raw_test_data/"
list_width = []
list_height = []
list_image = []
def pre_process():
print("analyze images")
for Files in tqdm(os.listdir(path)):
if "jpg" in Files:
#print(Files)
img = ... | [
"cv2.imwrite",
"os.listdir",
"cv2.copyMakeBorder",
"numpy.max",
"cv2.imread"
] | [((539, 557), 'numpy.max', 'np.max', (['list_width'], {}), '(list_width)\n', (545, 557), True, 'import numpy as np\n'), ((575, 594), 'numpy.max', 'np.max', (['list_height'], {}), '(list_height)\n', (581, 594), True, 'import numpy as np\n'), ((230, 246), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (240, 246)... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.train.ClusterSpec",
"tensorflow.device",
"numpy.median",
"tensorflow.train.Server",
"tensorflow.Variable",
"tensorflow.Session",
"tensorflow.test.main",
"tensorflow.global_variables_initializer",
"tensorflow.variable_axis_size_partitioner",
"tensorflow.train.replica_device_setter",
"... | [((1362, 1396), 'tensorflow.train.ClusterSpec', 'tf.train.ClusterSpec', (['cluster_dict'], {}), '(cluster_dict)\n', (1382, 1396), True, 'import tensorflow as tf\n'), ((4919, 4933), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (4931, 4933), True, 'import tensorflow as tf\n'), ((1085, 1114), 'portpicker.pick... |
import functools
import glob
import itertools
import logging
import os
from progressbar import progressbar
import re
import requests
from typing import List
class ValueSingleDispatch:
def __init__(self):
self._handlers = dict()
def register(self, key):
def decorator(fn: callable):
... | [
"itertools.islice",
"logging.debug",
"os.makedirs",
"os.path.join",
"logging.warning",
"requests.get",
"os.path.basename",
"logging.info",
"glob.glob"
] | [((862, 880), 'glob.glob', 'glob.glob', (['pattern'], {}), '(pattern)\n', (871, 880), False, 'import glob\n'), ((1860, 1961), 'logging.debug', 'logging.debug', (['"""util.download_by_pattern(): pattern = %s, extentions = %s"""', 'url_regex', 'extentions'], {}), "('util.download_by_pattern(): pattern = %s, extentions = ... |
import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def read_dataset_from_npy(path):
""" Read dataset from .npy file
"""
data = np.load(path, allow_pickle=True)
return data[()]['X'], data[()]['y'], data[()]['train_idx'], data[()]['test_idx']
def read_dataset... | [
"sklearn.preprocessing.LabelEncoder",
"numpy.unique",
"os.path.join",
"numpy.array",
"numpy.zeros",
"numpy.isnan",
"numpy.concatenate",
"numpy.load",
"numpy.random.shuffle"
] | [((185, 217), 'numpy.load', 'np.load', (['path'], {'allow_pickle': '(True)'}), '(path, allow_pickle=True)\n', (192, 217), True, 'import numpy as np\n'), ((423, 463), 'os.path.join', 'os.path.join', (['ucr_root_dir', 'dataset_name'], {}), '(ucr_root_dir, dataset_name)\n', (435, 463), False, 'import os\n'), ((783, 816), ... |
from aiopylimit import AIOPyRateLimit
from aiopylimit import AIOPyRateLimitException
import asynctest
import asyncio
class TestPyLimit(asynctest.TestCase):
async def test_exception(self):
limit = AIOPyRateLimit(10, 10)
await self.assertAsyncRaises(AIOPyRateLimitException,
... | [
"aiopylimit.AIOPyRateLimit",
"aiopylimit.AIOPyRateLimit.init",
"asyncio.sleep"
] | [((210, 232), 'aiopylimit.AIOPyRateLimit', 'AIOPyRateLimit', (['(10)', '(10)'], {}), '(10, 10)\n', (224, 232), False, 'from aiopylimit import AIOPyRateLimit\n'), ((409, 500), 'aiopylimit.AIOPyRateLimit.init', 'AIOPyRateLimit.init', ([], {'redis_host': '"""localhost"""', 'redis_port': '(6379)', 'force_new_connection': '... |
# coding: utf-8
import sys
import shutil
import requests
import wx
from pathlib import Path
from urllib.parse import urljoin, urlsplit
from tempfile import TemporaryFile
from zipfile import ZipFile
from bookworm import typehints as t
from bookworm import app
from bookworm.http_tools import RemoteJsonResource, HttpReso... | [
"bookworm.ocr_engines.tesseract_ocr_engine.TesseractOcrEngine.check",
"zipfile.ZipFile",
"wx.GetApp",
"bookworm.logger.logger.getChild",
"bookworm.ocr_engines.tesseract_ocr_engine.get_tesseract_path",
"bookworm.ocr_engines.tesseract_ocr_engine.TesseractOcrEngine.get_tesseract_version",
"requests.get",
... | [((473, 498), 'bookworm.logger.logger.getChild', 'logger.getChild', (['__name__'], {}), '(__name__)\n', (488, 498), False, 'from bookworm.logger import logger\n'), ((3422, 3442), 'bookworm.ocr_engines.tesseract_ocr_engine.get_tesseract_path', 'get_tesseract_path', ([], {}), '()\n', (3440, 3442), False, 'from bookworm.o... |
from django.db import models
# Create your models here.
class CommonFieldsMixin(models.Model):
"""Add created_at and updated_at fields."""
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True, null=True)
class Meta:
"""Define metadata options.... | [
"django.db.models.DateTimeField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((164, 203), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (184, 203), False, 'from django.db import models\n'), ((221, 267), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)', 'null': '(True)'}), '(auto_now=True,... |
# seq2seq LSTM (no-convolutional model) for time series prediction
import numpy as np
import torch
import torchvision
import torch.utils.data as data
import torchvision.transforms as transforms
import pandas as pd
import h5py
import os
import sys
import json
import time
import pdb
from jma_timeseries_dataset import... | [
"os.path.exists",
"time.ctime",
"torch.load",
"os.path.join",
"torch.optim.lr_scheduler.StepLR",
"torch.nn.MSELoss",
"os.mkdir",
"torch.utils.data.DataLoader",
"time.time",
"opts_ts.parse_opts"
] | [((999, 1011), 'opts_ts.parse_opts', 'parse_opts', ([], {}), '()\n', (1009, 1011), False, 'from opts_ts import parse_opts\n'), ((1406, 1417), 'time.time', 'time.time', ([], {}), '()\n', (1415, 1417), False, 'import time\n'), ((8428, 8439), 'time.time', 'time.time', ([], {}), '()\n', (8437, 8439), False, 'import time\n'... |
import inspect
import sys
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Union, Type, Optional, Dict, Any
from pydantic import BaseModel
from onemsdk.exceptions import NodeTagMismatchException, ONEmSDKException
from .node import Node
__all__ = ['Tag', 'HeaderTag', 'FooterTag', 'Br... | [
"onemsdk.exceptions.NodeTagMismatchException",
"inspect.isclass",
"inspect.getmembers",
"onemsdk.exceptions.ONEmSDKException"
] | [((13146, 13187), 'inspect.getmembers', 'inspect.getmembers', (['sys.modules[__name__]'], {}), '(sys.modules[__name__])\n', (13164, 13187), False, 'import inspect\n'), ((13196, 13216), 'inspect.isclass', 'inspect.isclass', (['obj'], {}), '(obj)\n', (13211, 13216), False, 'import inspect\n'), ((859, 952), 'onemsdk.excep... |
import json
import hashlib
import logging
import os
import threading
import time
import datetime
import itertools
import peewee
from passlib.apps import custom_app_context as pwd_context
from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase
from flask.ext.login import UserMixin, Anonymo... | [
"playhouse.postgres_ext.ArrayField",
"redash.utils.slugify",
"passlib.apps.custom_app_context.verify",
"datetime.timedelta",
"logging.info",
"redash.redis_connection.get",
"redash.utils.gen_query_hash",
"peewee.SQL",
"threading.Lock",
"json.dumps",
"peewee.TextField",
"passlib.apps.custom_app_... | [((2232, 2278), 'playhouse.postgres_ext.DateTimeTZField', 'DateTimeTZField', ([], {'default': 'datetime.datetime.now'}), '(default=datetime.datetime.now)\n', (2247, 2278), False, 'from playhouse.postgres_ext import ArrayField, DateTimeTZField, PostgresqlExtDatabase\n'), ((2296, 2342), 'playhouse.postgres_ext.DateTimeTZ... |
#!/usr/bin/env python3
import ipaddress
import random
import unittest
import ipgroup
class TestGroupIPs(unittest.TestCase):
def setUp(self):
pass
def test_group(self):
IPs = ["127.0.0.1",
"127.0.1.1",
"127.1.1.1",
"127.1.0.1",
"127... | [
"ipgroup.totalAddresses",
"ipgroup.IPv6Group",
"ipaddress.IPv6Network",
"ipgroup.IPv4Group",
"unittest.main",
"ipaddress.IPv4Network",
"random.randint"
] | [((6556, 6571), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6569, 6571), False, 'import unittest\n'), ((559, 585), 'ipgroup.IPv4Group', 'ipgroup.IPv4Group', (['IPs', '(16)'], {}), '(IPs, 16)\n', (576, 585), False, 'import ipgroup\n'), ((1178, 1204), 'ipgroup.IPv4Group', 'ipgroup.IPv4Group', (['IPs', '(24)'], {... |
# Copyright (c) 2016 Mirantis, 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 w... | [
"neutron.api.v2.resource_helper.build_plural_mappings",
"neutron_fwaas._i18n._",
"six.add_metaclass",
"debtcollector.moves.moved_class",
"neutron.api.v2.resource_helper.build_resource_info",
"oslo_config.cfg.CONF.register_opts"
] | [((1084, 1169), 'debtcollector.moves.moved_class', 'moves.moved_class', (['f_exc.FirewallGroupNotFound', '"""FirewallGroupNotFound"""', '__name__'], {}), "(f_exc.FirewallGroupNotFound, 'FirewallGroupNotFound',\n __name__)\n", (1101, 1169), False, 'from debtcollector import moves\n'), ((1192, 1267), 'debtcollector.mo... |
from ctypes import c_uint32, c_void_p, string_at
from rotypes.idldsl import define_winrt_com_method, GUID
from rotypes.inspectable import IInspectable, IUnknown
@GUID('905a0fef-bc53-11df-8c49-001e4fc686da')
class IBufferByteAccess(IUnknown):
pass
@GUID('905A0FE0-BC53-11DF-8C49-001E4FC686DA')
class IBuffer(IIns... | [
"rotypes.idldsl.define_winrt_com_method",
"rotypes.idldsl.GUID"
] | [((165, 209), 'rotypes.idldsl.GUID', 'GUID', (['"""905a0fef-bc53-11df-8c49-001e4fc686da"""'], {}), "('905a0fef-bc53-11df-8c49-001e4fc686da')\n", (169, 209), False, 'from rotypes.idldsl import define_winrt_com_method, GUID\n'), ((257, 301), 'rotypes.idldsl.GUID', 'GUID', (['"""905A0FE0-BC53-11DF-8C49-001E4FC686DA"""'], ... |
# -*- coding: utf-8 -*-
""" Playground documentation.
Module defining Playground Base Class
"""
import os
from abc import ABC
import yaml
import pymunk
from .utils import PositionAreaSampler
from .utils.definitions import SPACE_DAMPING, CollisionTypes, SceneElementTypes
# pylint: disable=unused-argument
# pylint:... | [
"pymunk.PinJoint",
"os.path.join",
"yaml.load",
"os.getcwd",
"pymunk.Space",
"os.path.dirname",
"pymunk.Vec2d",
"pymunk.SimpleMotor"
] | [((2781, 2795), 'pymunk.Space', 'pymunk.Space', ([], {}), '()\n', (2793, 2795), False, 'import pymunk\n'), ((2820, 2842), 'pymunk.Vec2d', 'pymunk.Vec2d', (['(0.0)', '(0.0)'], {}), '(0.0, 0.0)\n', (2832, 2842), False, 'import pymunk\n'), ((2523, 2567), 'yaml.load', 'yaml.load', (['yaml_file'], {'Loader': 'yaml.SafeLoade... |
import csv
import json
import pickle
import logging
import re
import pandas
import gzip
import os
import numpy as np
from random import randint, random
from tqdm import tqdm
from retriever.dense_retriever import DenseRetriever
from models.tokenization import tokenize
from typing import Union, List
class InputExampl... | [
"json.loads",
"retriever.dense_retriever.DenseRetriever",
"logging.info",
"tqdm.tqdm.write"
] | [((7515, 7554), 'logging.info', 'logging.info', (['"""Loading MSM passages..."""'], {}), "('Loading MSM passages...')\n", (7527, 7554), False, 'import logging\n'), ((7735, 7772), 'logging.info', 'logging.info', (['"""Building ANN index..."""'], {}), "('Building ANN index...')\n", (7747, 7772), False, 'import logging\n'... |
"""
PyTorch Profiler With TensorBoard
====================================
This tutorial demonstrates how to use TensorBoard plugin with PyTorch Profiler
to detect performance bottlenecks of the model.
Introduction
------------
PyTorch 1.8 includes an updated profiler API capable of
recording the CPU side operations ... | [
"torch.profiler.tensorboard_trace_handler",
"torch.nn.CrossEntropyLoss",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"torch.profiler.schedule",
"torch.device"
] | [((1888, 1955), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['train_set'], {'batch_size': '(32)', 'shuffle': '(True)'}), '(train_set, batch_size=32, shuffle=True)\n', (1915, 1955), False, 'import torch\n'), ((2157, 2179), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (2169, ... |
import typing as t
from gradient_boosting_model.config.core import config
import numpy as np
import pandas as pd
from marshmallow import fields, Schema, ValidationError
class HouseDataInputSchema(Schema):
Alley = fields.Str(allow_none=True)
BedroomAbvGr = fields.Integer()
BldgType = fields.Str()
Bsm... | [
"marshmallow.fields.Integer",
"marshmallow.fields.Float",
"marshmallow.fields.Str"
] | [((221, 248), 'marshmallow.fields.Str', 'fields.Str', ([], {'allow_none': '(True)'}), '(allow_none=True)\n', (231, 248), False, 'from marshmallow import fields, Schema, ValidationError\n'), ((268, 284), 'marshmallow.fields.Integer', 'fields.Integer', ([], {}), '()\n', (282, 284), False, 'from marshmallow import fields,... |
import os
from rlbot.agents.base_agent import BOT_CONFIG_AGENT_HEADER
from rlbot.agents.base_dotnet_agent import BaseDotNetAgent
from rlbot.parsing.custom_config import ConfigHeader, ConfigObject
class DotNetBot(BaseDotNetAgent):
def get_port_file_path(self):
# Look for a port.cfg file in the same direct... | [
"os.path.dirname",
"os.getcwd"
] | [((399, 410), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (408, 410), False, 'import os\n'), ((412, 437), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (427, 437), False, 'import os\n')] |
import torch
import pdb
from torch.autograd import gradcheck
import fused_conv_bias_relu
class ConvBiasReLU_(torch.autograd.Function):
@staticmethod
@torch.cuda.amp.custom_fwd(cast_inputs=torch.half)
def forward(ctx, x, weight, bias, padding, stride):
outputs = fused_conv_bias_relu.forward([x, wei... | [
"torch.cuda.amp.custom_fwd",
"fused_conv_bias_relu.backward_no_relu",
"fused_conv_bias_relu.forward_mask",
"fused_conv_bias_relu.forward",
"fused_conv_bias_relu.forward_no_relu",
"fused_conv_bias_relu.backward"
] | [((160, 209), 'torch.cuda.amp.custom_fwd', 'torch.cuda.amp.custom_fwd', ([], {'cast_inputs': 'torch.half'}), '(cast_inputs=torch.half)\n', (185, 209), False, 'import torch\n'), ((889, 938), 'torch.cuda.amp.custom_fwd', 'torch.cuda.amp.custom_fwd', ([], {'cast_inputs': 'torch.half'}), '(cast_inputs=torch.half)\n', (914,... |
from jogo import desenha_jogo
from random import randint
import sys
def input_cria_usuario():
usuario = dict()
usuario['nome'] = input('Informe o seu nome: ')
usuario['pontos'] = 0
usuario['desafiado'] = False
return usuario
def comeco(j1, j2):
j1 = 1
j2 = 2
n= randint(j1,j2)
... | [
"random.randint"
] | [((305, 320), 'random.randint', 'randint', (['j1', 'j2'], {}), '(j1, j2)\n', (312, 320), False, 'from random import randint\n')] |
import numpy as np
def denormalize(x, x_min, x_max):
if x_max is None:
_range = 1
else:
_range = (x_max - x_min)
return x * _range + x_min
def normalize(x, x_min=None, x_max=None, return_bounds=False, estimate_bounds_if_none=True):
# if the bounds should be estimated if none do it... | [
"numpy.mean",
"numpy.ones",
"numpy.std",
"numpy.max",
"numpy.zeros",
"numpy.min"
] | [((1035, 1053), 'numpy.mean', 'np.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (1042, 1053), True, 'import numpy as np\n'), ((1064, 1081), 'numpy.std', 'np.std', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (1070, 1081), True, 'import numpy as np\n'), ((396, 413), 'numpy.min', 'np.min', (['x'], {'axis': '(0)'}), '(x... |
"""Check new
Revision ID: 92235b77ea53
Revises: 381fdb66ec27
Create Date: 2017-10-14 02:38:51.007307
"""
# revision identifiers, used by Alembic.
revision = '92235b77ea53'
down_revision = '381fdb66ec27'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic - pl... | [
"alembic.op.f",
"alembic.op.create_index",
"alembic.op.drop_index"
] | [((341, 440), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_ActiveTranslationMessages_category"""'], {'table_name': '"""ActiveTranslationMessages"""'}), "('ix_ActiveTranslationMessages_category', table_name=\n 'ActiveTranslationMessages')\n", (354, 440), False, 'from alembic import op\n'), ((440, 539), 'alembic... |
import glob
import os
import sys
from tempfile import TemporaryDirectory
import netCDF4
import numpy as np
import numpy.ma as ma
from all_products_fun import Check
from lidar_fun import LidarFun
from cloudnetpy import concat_lib
from cloudnetpy.instruments import ceilo2nc
SCRIPT_PATH = os.path.dirname(os.path.realpa... | [
"tempfile.TemporaryDirectory",
"numpy.ma.max",
"lidar_fun.LidarFun.__dict__.items",
"netCDF4.Dataset",
"numpy.ma.min",
"numpy.diff",
"os.path.realpath",
"cloudnetpy.instruments.ceilo2nc",
"lidar_fun.LidarFun",
"sys.path.append",
"cloudnetpy.concat_lib.concatenate_files",
"glob.glob"
] | [((334, 362), 'sys.path.append', 'sys.path.append', (['SCRIPT_PATH'], {}), '(SCRIPT_PATH)\n', (349, 362), False, 'import sys\n'), ((372, 415), 'glob.glob', 'glob.glob', (['f"""{SCRIPT_PATH}/data/cl61d/*.nc"""'], {}), "(f'{SCRIPT_PATH}/data/cl61d/*.nc')\n", (381, 415), False, 'import glob\n'), ((306, 332), 'os.path.real... |
import click
import requests
from bs4 import BeautifulSoup
from modules.Word.managers.DictionaryManager import DictionaryManager
import re
@click.command()
@click.option('--url', help='URL to fetch from')
@click.pass_context
def search(ctx, url):
dictionary_manager: DictionaryManager = ctx.obj[DictionaryManager]
... | [
"click.option",
"re.sub",
"click.command",
"requests.get"
] | [((142, 157), 'click.command', 'click.command', ([], {}), '()\n', (155, 157), False, 'import click\n'), ((159, 206), 'click.option', 'click.option', (['"""--url"""'], {'help': '"""URL to fetch from"""'}), "('--url', help='URL to fetch from')\n", (171, 206), False, 'import click\n'), ((345, 362), 'requests.get', 'reques... |
# -*- coding: utf-8 -*-
import matplotlib as mpl
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from cell2cell.clustering import compute_linkage
from cell2cell.preprocessing.manipulate_dataframes import check_symmetry
from cell2cell.plotting.aesthetics import map_col... | [
"matplotlib.pyplot.savefig",
"numpy.ones",
"cell2cell.preprocessing.manipulate_dataframes.check_symmetry",
"seaborn.clustermap",
"cell2cell.clustering.compute_linkage",
"matplotlib.pyplot.close",
"numpy.zeros",
"cell2cell.plotting.aesthetics.map_colors_to_metadata",
"matplotlib.transforms.ScaledTran... | [((4765, 4783), 'cell2cell.preprocessing.manipulate_dataframes.check_symmetry', 'check_symmetry', (['df'], {}), '(df)\n', (4779, 4783), False, 'from cell2cell.preprocessing.manipulate_dataframes import check_symmetry\n'), ((12729, 12860), 'seaborn.clustermap', 'sns.clustermap', (['df'], {'col_linkage': 'linkage', 'row_... |
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. 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 requir... | [
"textwrap.dedent",
"googlecloudsdk.api_lib.spanner.backup_operations.BuildDatabaseFilter",
"googlecloudsdk.calliope.exceptions.InvalidArgumentException",
"googlecloudsdk.api_lib.spanner.database_operations.ListDatabaseOperations",
"googlecloudsdk.api_lib.spanner.instance_operations.List",
"googlecloudsdk.... | [((5270, 5334), 'googlecloudsdk.calliope.base.ReleaseTracks', 'base.ReleaseTracks', (['base.ReleaseTrack.GA', 'base.ReleaseTrack.BETA'], {}), '(base.ReleaseTrack.GA, base.ReleaseTrack.BETA)\n', (5288, 5334), False, 'from googlecloudsdk.calliope import base\n'), ((7332, 7375), 'googlecloudsdk.calliope.base.ReleaseTracks... |
# coding=utf-8
# This script is finished following HF's datasets' template:
# https://github.com/huggingface/datasets/blob/master/templates/new_dataset_script.py
# More examples as references to write a customized dataset can be found here:
# https://github.com/huggingface/datasets/tree/master/datasets
from __future__... | [
"datasets.SplitGenerator",
"json.loads",
"datasets.Value"
] | [((1268, 1359), 'datasets.SplitGenerator', 'datasets.SplitGenerator', ([], {'name': 'datasets.Split.TRAIN', 'gen_kwargs': "{'filepath': train_path}"}), "(name=datasets.Split.TRAIN, gen_kwargs={'filepath':\n train_path})\n", (1291, 1359), False, 'import datasets\n'), ((1369, 1464), 'datasets.SplitGenerator', 'dataset... |
import itertools
from typing import Sequence, Iterator
# Source: https://github.com/Cog-Creators/Red-DiscordBot/blob/V3/develop/redbot/core/utils/chat_formatting.py
def error(text: str) -> str:
"""Get text prefixed with an error emoji.
Returns
-------
str
The new message.
"""
return "... | [
"itertools.zip_longest"
] | [((3243, 3274), 'itertools.zip_longest', 'itertools.zip_longest', (['*columns'], {}), '(*columns)\n', (3264, 3274), False, 'import itertools\n')] |
# @date 2018-12-28
# @author <NAME>, All rights reserved without prejudices.
# @license Copyright (c) 2018 Dream Overflow
# Strategy trade for margin with multiples positions.
from __future__ import annotations
from typing import TYPE_CHECKING, Optional, Tuple
if TYPE_CHECKING:
from trader.trader import Trader
... | [
"logging.getLogger",
"trader.order.Order"
] | [((631, 677), 'logging.getLogger', 'logging.getLogger', (['"""siis.strategy.margintrade"""'], {}), "('siis.strategy.margintrade')\n", (648, 677), False, 'import logging\n'), ((2655, 2690), 'trader.order.Order', 'Order', (['trader', 'instrument.market_id'], {}), '(trader, instrument.market_id)\n', (2660, 2690), False, '... |
"""Install exception handler for process crash."""
from selfdrive.swaglog import cloudlog
from selfdrive.version import version
import sentry_sdk
from sentry_sdk.integrations.threading import ThreadingIntegration
def capture_exception(*args, **kwargs) -> None:
cloudlog.error("crash", exc_info=kwargs.get('exc_info',... | [
"sentry_sdk.flush",
"sentry_sdk.integrations.threading.ThreadingIntegration",
"sentry_sdk.set_user",
"selfdrive.swaglog.cloudlog.exception",
"sentry_sdk.set_tag",
"sentry_sdk.capture_exception"
] | [((562, 589), 'sentry_sdk.set_user', 'sentry_sdk.set_user', (['kwargs'], {}), '(kwargs)\n', (581, 589), False, 'import sentry_sdk\n'), ((337, 382), 'sentry_sdk.capture_exception', 'sentry_sdk.capture_exception', (['*args'], {}), '(*args, **kwargs)\n', (365, 382), False, 'import sentry_sdk\n'), ((387, 405), 'sentry_sdk.... |
import math
import visualization.panda.world as wd
import modeling.geometric_model as gm
import modeling.collision_model as cm
import grasping.planning.antipodal as gpa
import robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper as yg
base = wd.World(cam_pos=[1, 1, 1],w=960,
h=540, lookat_pos=[0... | [
"modeling.collision_model.CollisionModel",
"grasping.planning.antipodal.write_pickle_file",
"math.radians",
"modeling.geometric_model.gen_frame",
"robot_sim.end_effectors.grippers.yumi_gripper.yumi_gripper.YumiGripper",
"visualization.panda.world.World"
] | [((249, 312), 'visualization.panda.world.World', 'wd.World', ([], {'cam_pos': '[1, 1, 1]', 'w': '(960)', 'h': '(540)', 'lookat_pos': '[0, 0, 0]'}), '(cam_pos=[1, 1, 1], w=960, h=540, lookat_pos=[0, 0, 0])\n', (257, 312), True, 'import visualization.panda.world as wd\n'), ((383, 423), 'modeling.collision_model.Collision... |
# Copyright 2012 OpenStack Foundation
#
# 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... | [
"itertools.chain",
"keystone.i18n._",
"keystone.common.cache.create_region",
"keystone.common.cache.get_memoization_decorator",
"keystone.common.manager.load_driver",
"copy.deepcopy",
"oslo_log.log.getLogger",
"keystone.notifications.role_assignment",
"keystone.exception.UnexpectedError",
"keyston... | [((996, 1019), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1009, 1019), False, 'from oslo_log import log\n'), ((1153, 1198), 'keystone.common.cache.get_memoization_decorator', 'cache.get_memoization_decorator', ([], {'group': '"""role"""'}), "(group='role')\n", (1184, 1198), False, '... |
"""
sources.chicago
===============
Reads a CSV file in the format (as of April 2017) of data available from:
- https://catalog.data.gov/dataset/crimes-one-year-prior-to-present-e171f
- https://catalog.data.gov/dataset/crimes-2001-to-present-398a4
The default data is loaded from a file "chicago.csv" which should be ... | [
"geopandas.GeoDataFrame.from_features",
"geopandas.read_file",
"datetime.datetime.strptime",
"os.path.join",
"shapely.geometry.Point",
"csv.reader"
] | [((1287, 1326), 'os.path.join', '_path.join', (['_datadir', '_default_filename'], {}), '(_datadir, _default_filename)\n', (1297, 1326), True, 'import os.path as _path\n'), ((1372, 1435), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_string', '"""%m/%d/%Y %I:%M:%S %p"""'], {}), "(date_string, '%m/%... |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | [
"logging.getLogger",
"logging.basicConfig",
"packagedcode.models.Package.from_package_data",
"pathlib.Path",
"os.environ.get",
"io.open",
"packagedcode.models.PackageData",
"packagedcode.models.FileReference",
"packageurl.PackageURL.from_string",
"packagedcode.models.Party"
] | [((596, 643), 'os.environ.get', 'os.environ.get', (['"""SCANCODE_DEBUG_PACKAGE"""', '(False)'], {}), "('SCANCODE_DEBUG_PACKAGE', False)\n", (610, 643), False, 'import os\n'), ((740, 767), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (757, 767), False, 'import logging\n'), ((772, 810), '... |
# -*- coding: utf-8 -*-
#django
from django.contrib import admin
from django.db import transaction
#python
import csv
from decimal import Decimal
#gazepattern
from .models import Experiment, ExperimentPoint, Image, ImageRectangle, ExperimentPointCSV, ExperimentFunction
@transaction.atomic
def procesar(modeladmin, req... | [
"django.contrib.admin.site.register",
"csv.reader",
"decimal.Decimal"
] | [((2026, 2090), 'django.contrib.admin.site.register', 'admin.site.register', (['ExperimentPointCSV', 'ExperimentPointCSVAdmin'], {}), '(ExperimentPointCSV, ExperimentPointCSVAdmin)\n', (2045, 2090), False, 'from django.contrib import admin\n'), ((2091, 2149), 'django.contrib.admin.site.register', 'admin.site.register',... |
from random import randint
menor = 100
linha = 0
maior = 0
m = []
for i in range(10):
m.append([])
for j in range(10):
m[i].append(randint(1,99))
for i in range(10):
for j in range(10):
print(f'{m[i][j]:2}',end=' ')
print()
for i in range(10):
for j in range(10):
if m[i][j... | [
"random.randint"
] | [((148, 162), 'random.randint', 'randint', (['(1)', '(99)'], {}), '(1, 99)\n', (155, 162), False, 'from random import randint\n')] |
from mock import patch
import pytest
from pontoon.base.models import User
from pontoon.pretranslation.pretranslate import get_translations
from pontoon.test.factories import (
EntityFactory,
TranslationMemoryFactory,
)
@patch("pontoon.pretranslation.pretranslate.get_google_translate_data")
@pytest.mark.djan... | [
"mock.patch",
"pontoon.base.models.User.objects.get",
"pontoon.test.factories.TranslationMemoryFactory.create",
"pontoon.pretranslation.pretranslate.get_translations",
"pontoon.test.factories.EntityFactory"
] | [((232, 302), 'mock.patch', 'patch', (['"""pontoon.pretranslation.pretranslate.get_google_translate_data"""'], {}), "('pontoon.pretranslation.pretranslate.get_google_translate_data')\n", (237, 302), False, 'from mock import patch\n'), ((1329, 1362), 'pontoon.base.models.User.objects.get', 'User.objects.get', ([], {'ema... |
# -*- encoding: utf-8 -*-
"""Utility functions for computing combinations of dimensions and hierarchy
levels"""
from __future__ import absolute_import
import re
import os.path
import json
from collections import OrderedDict
from .errors import ModelInconsistencyError, ArgumentError, ConfigurationError
from . impor... | [
"json.load",
"re.sub"
] | [((5075, 5118), 're.sub', 're.sub', (['"""(.)([A-Z][a-z]+)"""', '"""\\\\1 \\\\2"""', 'name'], {}), "('(.)([A-Z][a-z]+)', '\\\\1 \\\\2', name)\n", (5081, 5118), False, 'import re\n'), ((5129, 5171), 're.sub', 're.sub', (['"""([a-z0-9])([A-Z])"""', '"""\\\\1 \\\\2"""', 's1'], {}), "('([a-z0-9])([A-Z])', '\\\\1 \\\\2', s1... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from modules import Conv, ResBlock
class Wavenet_Student(nn.Module):
def __init__(self, num_blocks_student=[1, 1, 1, 1, 1, 1], num_layers=10,
front_channels=32, residual_channels=64, gate_channels=128, skip_channels=64,
... | [
"torch.nn.ReLU",
"torch.nn.ModuleList",
"modules.ResBlock",
"torch.exp",
"modules.Conv",
"torch.nn.functional.pad"
] | [((569, 584), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (582, 584), True, 'import torch.nn as nn\n'), ((2892, 2907), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2905, 2907), True, 'import torch.nn as nn\n'), ((2939, 2954), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2952, 2... |
try:
from gevent import monkey
monkey.patch_all()
except ImportError:
# fine if no gevent is available
pass
import base64
import logging
from unittest.mock import Mock
from flask.app import Flask
from flask_testing import TestCase
from openbrokerapi.api import BrokerCredentials
from openbrokerapi.log... | [
"unittest.mock.Mock",
"gevent.monkey.patch_all",
"openbrokerapi.log_util.basic_config",
"base64.b64encode",
"openbrokerapi.api.BrokerCredentials",
"flask.app.Flask"
] | [((39, 57), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (55, 57), False, 'from gevent import monkey\n'), ((542, 557), 'flask.app.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (547, 557), False, 'from flask.app import Flask\n'), ((580, 586), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (58... |
#! /usr/bin/env python
from __future__ import print_function
import pandas as pd
import numpy as np
import argparse
def generate_csv(start_index, fname):
cols = [
str('A' + str(i)) for i in range(start_index, NUM_COLS + start_index)
]
data = []
for i in range(NUM_ROWS):
vals = (np.ra... | [
"pandas.DataFrame",
"numpy.random.choice",
"argparse.ArgumentParser",
"sys.exit"
] | [((413, 450), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'data', 'columns': 'cols'}), '(data=data, columns=cols)\n', (425, 450), True, 'import pandas as pd\n'), ((540, 616), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate sample tables to test joins."""'}), "(description='... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.get",
"pulumi.Alias",
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.ResourceOptions.merge"
] | [((4505, 4543), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""openShiftVersion"""'}), "(name='openShiftVersion')\n", (4518, 4543), False, 'import pulumi\n'), ((4909, 4948), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""resourceGroupName"""'}), "(name='resourceGroupName')\n", (4922, 4948), False, 'import pul... |
#!/usr/bin/env python
import psycopg2
import time
from ..models import User
class StorageManager:
def __init__(self):
self.conn = None
self._connect()
self._create_table()
def _connect(self):
while True:
try:
self.conn = psycopg2.connect(
... | [
"psycopg2.connect",
"time.sleep"
] | [((293, 390), 'psycopg2.connect', 'psycopg2.connect', ([], {'host': '"""storage"""', 'database': '"""app_storage"""', 'user': '"""admin"""', 'password': '"""<PASSWORD>"""'}), "(host='storage', database='app_storage', user='admin',\n password='<PASSWORD>')\n", (309, 390), False, 'import psycopg2\n'), ((608, 621), 'ti... |
from django.db import models
from .media import Water
from .media import Electricity
from .media import Gas
from .media import WasteWater
from .media import Telecommunication
from .generic import Attachment
from .generic import Photo
from .generic import Location as EstateLocation
from cigeo.models import GenericNote ... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey"
] | [((413, 477), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""ScientificPark"""'], {'on_delete': 'models.CASCADE'}), "('ScientificPark', on_delete=models.CASCADE)\n", (433, 477), False, 'from django.db import models\n'), ((595, 659), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""Scient... |
from rest_framework.generics import ListAPIView
from rest_framework.permissions import IsAdminUser
from goods.models import SPU, SPUSpecification
from meiduo_admin.serializers.spus import SPUSimpleSerializer, SPUSpecSerializer
class SPUSimpleView(ListAPIView):
permission_classes = [IsAdminUser]
queryset = S... | [
"goods.models.SPU.objects.all",
"goods.models.SPUSpecification.objects.filter"
] | [((319, 336), 'goods.models.SPU.objects.all', 'SPU.objects.all', ([], {}), '()\n', (334, 336), False, 'from goods.models import SPU, SPUSpecification\n'), ((617, 659), 'goods.models.SPUSpecification.objects.filter', 'SPUSpecification.objects.filter', ([], {'spu_id': 'pk'}), '(spu_id=pk)\n', (648, 659), False, 'from goo... |
import tkinter as tk
from tkinter.messagebox import showerror
from constants.frames import MAIN_FRAME_NAME
from util import add_new_quantity
class AddQuantityFrame(tk.Frame):
def __init__(self, root, controller):
tk.Frame.__init__(self, root)
self.controller = controller
self.main_label... | [
"tkinter.messagebox.showerror",
"tkinter.Frame.__init__",
"tkinter.Entry",
"util.add_new_quantity",
"tkinter.Button",
"tkinter.Label"
] | [((229, 258), 'tkinter.Frame.__init__', 'tk.Frame.__init__', (['self', 'root'], {}), '(self, root)\n', (246, 258), True, 'import tkinter as tk\n'), ((323, 397), 'tkinter.Label', 'tk.Label', (['self'], {'text': '"""ะะพะฑะฐะฒะปะตะฝะธะต ะฝะพะฒะพะน ะฒะตะปะธัะธะฝั"""', 'font': '"""Helvetica 30 bold"""'}), "(self, text='ะะพะฑะฐะฒะปะตะฝะธะต ะฝะพะฒะพะน ะฒะตะปะธัะธะฝ... |
from setuptools import setup
import versioneer
setup(name='gym_pysc2',
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
install_requires=['gym'] # And any other dependencies foo needs
) | [
"versioneer.get_cmdclass",
"versioneer.get_version"
] | [((86, 110), 'versioneer.get_version', 'versioneer.get_version', ([], {}), '()\n', (108, 110), False, 'import versioneer\n'), ((127, 152), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (150, 152), False, 'import versioneer\n')] |
"""
Neighborhood Components Analysis (NCA)
Ported to Python from https://github.com/vomjom/nca
"""
from __future__ import absolute_import
import numpy as np
from six.moves import xrange
from sklearn.utils.validation import check_X_y
from .base_metric import BaseMetricLearner
EPS = np.finfo(float).eps
class NCA(Bas... | [
"numpy.zeros",
"six.moves.xrange",
"numpy.einsum",
"numpy.finfo",
"sklearn.utils.validation.check_X_y"
] | [((285, 300), 'numpy.finfo', 'np.finfo', (['float'], {}), '(float)\n', (293, 300), True, 'import numpy as np\n'), ((660, 675), 'sklearn.utils.validation.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (669, 675), False, 'from sklearn.utils.validation import check_X_y\n'), ((817, 840), 'numpy.zeros', 'np.zeros', ... |
import os
import youtube_dl
os.system("setup.bat")
playlist = input("Paste the Youtube Playlist URL Here.")
track = 1
print("""THIS TOOL WILL ATTEMPT TO DOWNLOAD THE FIRST 1000 SONGS IN THE QUEUE.\n
PLEASE DO NOT INTERRUPT THE TOOL.
YOU MAY CLOSE THE TOOL WHEN IT DISPLAYS "DONE!".
ALL... | [
"os.system"
] | [((30, 52), 'os.system', 'os.system', (['"""setup.bat"""'], {}), "('setup.bat')\n", (39, 52), False, 'import os\n'), ((640, 667), 'os.system', 'os.system', (['"""Downloader.bat"""'], {}), "('Downloader.bat')\n", (649, 667), False, 'import os\n')] |
# coding: utf-8
"""
manage.py
~~~~~~~~~
"""
import os
import sys
import shutil
import platform
from app import app
from gen import Gen
from flask_script import Manager
"""็ผ็ ่ฎพ็ฝฎ"""
if (platform.python_version().split('.')[0] == '2'):
# reload(sys) is evil :)
reload(sys)
sys.setdefaultencoding('utf... | [
"sys.setdefaultencoding",
"flask_script.Manager",
"os.getcwd",
"shutil.copytree",
"os.chdir",
"gen.Gen",
"os.path.isdir",
"os.popen",
"shutil.rmtree",
"platform.python_version"
] | [((417, 429), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (424, 429), False, 'from flask_script import Manager\n'), ((293, 324), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf-8"""'], {}), "('utf-8')\n", (315, 324), False, 'import sys\n'), ((1380, 1414), 'os.path.isdir', 'os.path.isdir',... |
from typing import Any
import torch
import torch.nn as nn
from cvmodels.segmentation import unet, deeplab as dl
def output(model: nn.Module, input_batch: torch.Tensor) -> Any:
model.eval()
with torch.no_grad():
return model(input_batch)
def numel(m: torch.nn.Module, only_trainable: bool = True) -> ... | [
"cvmodels.segmentation.unet.UNet",
"cvmodels.segmentation.deeplab.DeepLabV3Plus",
"torch.no_grad",
"cvmodels.segmentation.deeplab.DeepLabV3",
"torch.rand"
] | [((686, 722), 'cvmodels.segmentation.unet.UNet', 'unet.UNet', ([], {'bilinear': '(False)', 'outputs': '(1)'}), '(bilinear=False, outputs=1)\n', (695, 722), False, 'from cvmodels.segmentation import unet, deeplab as dl\n'), ((983, 1018), 'cvmodels.segmentation.unet.UNet', 'unet.UNet', ([], {'bilinear': '(True)', 'output... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
from aif360.datasets import BinaryLabelDataset
from aif360.metrics import ClassificationMetric
def test_generalized_entropy_inde... | [
"numpy.log",
"numpy.array",
"numpy.sum",
"pandas.DataFrame",
"aif360.datasets.BinaryLabelDataset",
"aif360.metrics.ClassificationMetric"
] | [((336, 431), 'numpy.array', 'np.array', (['[[0, 1], [0, 0], [1, 0], [1, 1], [1, 0], [1, 0], [2, 1], [2, 0], [2, 1], [2, 1]\n ]'], {}), '([[0, 1], [0, 0], [1, 0], [1, 1], [1, 0], [1, 0], [2, 1], [2, 0], [\n 2, 1], [2, 1]])\n', (344, 431), True, 'import numpy as np\n'), ((698, 743), 'pandas.DataFrame', 'pd.DataFra... |
import openmoc
import openmoc.log as log
import openmoc.plotter as plotter
import openmoc.materialize as materialize
log.set_log_level('NORMAL')
###############################################################################
########################### Creating Materials ############################
#############... | [
"openmoc.Universe",
"openmoc.Lattice",
"openmoc.materialize.load_from_hdf5",
"openmoc.Cell",
"openmoc.log.set_log_level",
"openmoc.Geometry",
"openmoc.XPlane",
"openmoc.log.py_printf",
"openmoc.ZPlane",
"openmoc.YPlane"
] | [((118, 145), 'openmoc.log.set_log_level', 'log.set_log_level', (['"""NORMAL"""'], {}), "('NORMAL')\n", (135, 145), True, 'import openmoc.log as log\n'), ((388, 452), 'openmoc.log.py_printf', 'log.py_printf', (['"""NORMAL"""', '"""Importing materials data from HDF5..."""'], {}), "('NORMAL', 'Importing materials data fr... |
# Copyright 2020 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"google.ads.google_ads.util.convert_upper_case_to_snake_case",
"pep562.Pep562",
"importlib.import_module",
"google.ads.google_ads.util.convert_snake_case_to_upper_case"
] | [((22297, 22313), 'pep562.Pep562', 'Pep562', (['__name__'], {}), '(__name__)\n', (22303, 22313), False, 'from pep562 import Pep562\n'), ((20614, 20656), 'google.ads.google_ads.util.convert_snake_case_to_upper_case', 'util.convert_snake_case_to_upper_case', (['key'], {}), '(key)\n', (20651, 20656), False, 'from google.a... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = '''
Crawl comment from nicovideo.jp
Usage:
crawl_comments.py --url <url> --mail <mail> --pass <pass> [--sqlite <sqlite>] [--csv <csv>]
Options:
--url <url>
--mail <mail>
--pass <pass>
--sqlite <sqlite> (optional) path of comment DB [d... | [
"nicocrawler.nicocrawler.NicoCrawler",
"docopt.docopt"
] | [((590, 605), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (596, 605), False, 'from docopt import docopt\n'), ((790, 825), 'nicocrawler.nicocrawler.NicoCrawler', 'NicoCrawler', (['login_mail', 'login_pass'], {}), '(login_mail, login_pass)\n', (801, 825), False, 'from nicocrawler.nicocrawler import NicoC... |
# Functions to do the greedy similarity maximisation for article:node assignments
# All code is original
import random
def computeSimSum(G, similarityMatrix, asgn):
""" Compute the total similarity sum for the current node:article assignment """
S = sum([similarityMatrix[asgn[j], asgn[i]]
for j in ra... | [
"random.shuffle"
] | [((663, 687), 'random.shuffle', 'random.shuffle', (['init_ids'], {}), '(init_ids)\n', (677, 687), False, 'import random\n')] |
import sys
import numpy as np
import shutil
import time
import itertools as it
import collections
import ctypes as ct
import os
import copy
sys.path.append(os.path.dirname(__file__))
from ThreadStoppable import ThreadStoppable
class Idq801(object):
def __init__(
self,
deviceId=-1,
timesta... | [
"ctypes.c_int32",
"numpy.iinfo",
"time.sleep",
"numpy.array",
"copy.deepcopy",
"ctypes.CDLL",
"ThreadStoppable.ThreadStoppable",
"os.path.exists",
"numpy.searchsorted",
"numpy.where",
"numpy.max",
"os.path.isdir",
"os.mkdir",
"numpy.vstack",
"numpy.min",
"numpy.frombuffer",
"numpy.ab... | [((157, 182), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (172, 182), False, 'import os\n'), ((2118, 2129), 'time.time', 'time.time', ([], {}), '()\n', (2127, 2129), False, 'import time\n'), ((3264, 3276), 'ctypes.c_int32', 'ct.c_int32', ([], {}), '()\n', (3274, 3276), True, 'import ctypes... |
# This program reads a file representing web server logs in common log format and streams them into a PubSub topic
# with lag characteristics as determined by command-line arguments
import argparse
from google.cloud import pubsub_v1
import time
from datetime import datetime, timezone
import random
from anytree... | [
"random.uniform",
"random.choice",
"json.loads",
"argparse.ArgumentParser",
"multiprocessing.Process",
"json.dumps",
"time.sleep",
"datetime.datetime.now",
"google.cloud.pubsub_v1.PublisherClient",
"random.random",
"anytree.importer.DictImporter"
] | [((412, 476), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['__file__'], {'description': '"""event_generator"""'}), "(__file__, description='event_generator')\n", (435, 476), False, 'import argparse\n'), ((3758, 3798), 'random.uniform', 'random.uniform', (['(0)', '(max_lag_millis / 1000)'], {}), '(0, max_lag_... |
"""Database setup"""
# Third party library
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
# initialization of the database and migration
database = SQLAlchemy()
migrate = Migrate()
| [
"flask_sqlalchemy.SQLAlchemy",
"flask_migrate.Migrate"
] | [((177, 189), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (187, 189), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((200, 209), 'flask_migrate.Migrate', 'Migrate', ([], {}), '()\n', (207, 209), False, 'from flask_migrate import Migrate\n')] |
# Copyright 2018, The TensorFlow Federated 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 applicable law o... | [
"tensorflow.Graph",
"tensorflow_federated.python.common_libs.py_typecheck.check_type",
"tensorflow_federated.python.core.tf_computation",
"tensorflow_federated.python.common_libs.py_typecheck.check_callable",
"tensorflow_federated.python.tensorflow_libs.tensor_utils.check_nested_equal",
"tensorflow.io.gfi... | [((1678, 1747), 'tensorflow_federated.python.common_libs.py_typecheck.check_type', 'py_typecheck.check_type', (['client_ids_to_files', 'collections.abc.Mapping'], {}), '(client_ids_to_files, collections.abc.Mapping)\n', (1701, 1747), False, 'from tensorflow_federated.python.common_libs import py_typecheck\n'), ((1856, ... |
from django.contrib import admin
from blog.models import Post, Comment
# Register your models here.
admin.site.register(Post)
admin.site.register(Comment)
| [
"django.contrib.admin.site.register"
] | [((105, 130), 'django.contrib.admin.site.register', 'admin.site.register', (['Post'], {}), '(Post)\n', (124, 130), False, 'from django.contrib import admin\n'), ((132, 160), 'django.contrib.admin.site.register', 'admin.site.register', (['Comment'], {}), '(Comment)\n', (151, 160), False, 'from django.contrib import admi... |
# imports
from telegram.ext import (
CommandHandler,
MessageHandler,
Filters,
ConversationHandler,
)
from handler_functions.start import start
from handler_functions.bio import bio
from handler_functions.gender import gender
from handler_functions.photo import photo, skip_photo
from handler_functions.lo... | [
"telegram.ext.MessageHandler",
"telegram.ext.Filters.regex",
"telegram.ext.CommandHandler"
] | [((612, 642), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""start"""', 'start'], {}), "('start', start)\n", (626, 642), False, 'from telegram.ext import CommandHandler, MessageHandler, Filters, ConversationHandler\n'), ((1073, 1105), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""cancel"""', 'cancel'],... |
from ocean_lib.models.data_token import DataToken
from ocean_lib.models.dtfactory import DTFactory
from ocean_lib.ocean.util import to_base_18
def test1(network, alice_wallet, dtfactory_address):
dtfactory = DTFactory(dtfactory_address)
dt_address = dtfactory.createToken('foo_blob', 'DT1', 'DT1', to_base_18(... | [
"ocean_lib.ocean.util.to_base_18",
"ocean_lib.models.dtfactory.DTFactory"
] | [((214, 242), 'ocean_lib.models.dtfactory.DTFactory', 'DTFactory', (['dtfactory_address'], {}), '(dtfactory_address)\n', (223, 242), False, 'from ocean_lib.models.dtfactory import DTFactory\n'), ((309, 325), 'ocean_lib.ocean.util.to_base_18', 'to_base_18', (['(1000)'], {}), '(1000)\n', (319, 325), False, 'from ocean_li... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2018"
__credits__ = ["<NAME>"]
__license__ = "Apache"
__version__ = "v1.0.0"
__maintainer__ = "<NAME>"
__email = "<EMAIL>"
__status__ = "Development"
from data_model.load_data import create_connection, select_all_tasks
fro... | [
"tools.data_frames.dframe_t_db",
"data_model.load_data.create_connection",
"data_model.load_data.select_all_tasks"
] | [((468, 495), 'data_model.load_data.create_connection', 'create_connection', (['database'], {}), '(database)\n', (485, 495), False, 'from data_model.load_data import create_connection, select_all_tasks\n'), ((617, 640), 'tools.data_frames.dframe_t_db', 'dframe_t_db', (['rows', 'name'], {}), '(rows, name)\n', (628, 640)... |
import numpy as np
import matplotlib.pyplot as plt
TOTAL = 200
STEP = 0.25
EPS = 0.1
INITIAL_THETA = [9, 14]
def func(x):
return 0.2 * x + 3
def generate_sample(total=TOTAL):
x = 0
while x < total * STEP:
yield func(x) + np.random.uniform(-1, 1) * np.random.uniform(2, 8)
x += STEP
def... | [
"numpy.abs",
"numpy.linalg.pinv",
"time.clock",
"matplotlib.pyplot.plot",
"numpy.empty",
"numpy.random.uniform",
"numpy.arange"
] | [((2136, 2168), 'numpy.arange', 'np.arange', (['(0)', '(TOTAL * STEP)', 'STEP'], {}), '(0, TOTAL * STEP, STEP)\n', (2145, 2168), True, 'import numpy as np\n'), ((2319, 2339), 'numpy.empty', 'np.empty', (['(TOTAL, 2)'], {}), '((TOTAL, 2))\n', (2327, 2339), True, 'import numpy as np\n'), ((2460, 2472), 'time.clock', 'tim... |
import castle
from typing import Tuple
def select_player_types() -> Tuple[castle.PlayerType, castle.PlayerType]:
player1, player2 = None, None
while True:
print(f'1) Play a person')
print(f'2) Play the computer')
print(f'3) Play the computer against itself')
choice_str = input... | [
"castle.Piece",
"castle.Game",
"castle.FenGameConstructor"
] | [((1694, 1723), 'castle.Game', 'castle.Game', (['player1', 'player2'], {}), '(player1, player2)\n', (1705, 1723), False, 'import castle\n'), ((1781, 1842), 'castle.Game', 'castle.Game', (['castle.PlayerType.HUMAN', 'castle.PlayerType.HUMAN'], {}), '(castle.PlayerType.HUMAN, castle.PlayerType.HUMAN)\n', (1792, 1842), Fa... |
import random
import numpy as np
import itertools
import re
from collections import defaultdict
import os
def get_tags(s, open_delim='<', close_delim='/>'):
"""Iterator to spit out the xml style disfluency tags in a given string.
Keyword arguments:
s -- input string
"""
while True:
# Sear... | [
"itertools.chain",
"os.listdir",
"random.shuffle",
"numpy.asarray",
"random.seed",
"numpy.load",
"collections.defaultdict",
"re.findall",
"numpy.matrix",
"re.search"
] | [((3680, 3697), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3691, 3697), False, 'from collections import defaultdict\n'), ((12142, 12159), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (12153, 12159), False, 'from collections import defaultdict\n'), ((16551, 16568), 'c... |
# Copyright (C) 2015 UCSC Computational Genomics Lab
#
# 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 o... | [
"pickle.load",
"pickle.dump",
"re.compile"
] | [((12664, 12695), 're.compile', 're.compile', (['"""^[a-zA-Z0-9._-]+$"""'], {}), "('^[a-zA-Z0-9._-]+$')\n", (12674, 12695), False, 'import re\n'), ((2822, 2887), 'pickle.dump', 'cPickle.dump', (['self.__config', 'fileHandle', 'cPickle.HIGHEST_PROTOCOL'], {}), '(self.__config, fileHandle, cPickle.HIGHEST_PROTOCOL)\n', (... |
from datetime import date
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.express as px
from dash.dependencies import Input, Output
test_data = pd.read_csv("data/world_data.csv")
today = date.today()
external... | [
"dash_html_components.Ul",
"dash_html_components.Hr",
"pandas.read_csv",
"plotly.express.bar",
"dash_core_components.Link",
"dash.dependencies.Output",
"dash_core_components.Location",
"dash_html_components.H1",
"dash_html_components.Span",
"dash.dependencies.Input",
"dash_html_components.Div",
... | [((254, 288), 'pandas.read_csv', 'pd.read_csv', (['"""data/world_data.csv"""'], {}), "('data/world_data.csv')\n", (265, 288), True, 'import pandas as pd\n'), ((298, 310), 'datetime.date.today', 'date.today', ([], {}), '()\n', (308, 310), False, 'from datetime import date\n'), ((365, 427), 'dash.Dash', 'dash.Dash', (['_... |
from collections import OrderedDict
import skimage.io as io
from config import get_config
config = get_config()
class LRUCache:
def __init__(self, capacity: int):
self._ordered_dict = OrderedDict()
self._capacity = capacity
def get(self, key):
self._move_to_end_if_exist(key)
... | [
"config.get_config",
"collections.OrderedDict",
"skimage.io.imread"
] | [((102, 114), 'config.get_config', 'get_config', ([], {}), '()\n', (112, 114), False, 'from config import get_config\n'), ((201, 214), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (212, 214), False, 'from collections import OrderedDict\n'), ((912, 927), 'skimage.io.imread', 'io.imread', (['path'], {}), '... |
import logging
import time
from qupy.framing.slip import Slip
from qupy.interface.serial import SerialPort
from qupy.interface.errors import InterfaceTimeoutError, InterfaceIOError, InterfaceError
from qupy.comm.client import CommClient
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
s = Se... | [
"logging.basicConfig",
"qupy.comm.client.CommClient",
"time.sleep",
"qupy.interface.serial.SerialPort",
"qupy.framing.slip.Slip"
] | [((240, 280), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (259, 280), False, 'import logging\n'), ((318, 330), 'qupy.interface.serial.SerialPort', 'SerialPort', ([], {}), '()\n', (328, 330), False, 'from qupy.interface.serial import SerialPort\n'), ((339, 3... |
import requests
from bs4 import BeautifulSoup
import json
import re
# Range of Roll Number - User Input
start_roll = int(input("Starting Roll Number: "))
end_roll = int(input("Ending Roll Number: "))
# Semester - User Input
sem = int(input("Which Semester[1-8]: "))
# Verbosity
verbose = int(input("Verbo... | [
"bs4.BeautifulSoup",
"re.findall",
"json.loads",
"requests.Session"
] | [((830, 848), 'requests.Session', 'requests.Session', ([], {}), '()\n', (846, 848), False, 'import requests\n'), ((997, 1033), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""html.parser"""'], {}), "(r.text, 'html.parser')\n", (1010, 1033), False, 'from bs4 import BeautifulSoup\n'), ((1530, 1571), 'bs4.BeautifulS... |
from dataclasses import dataclass
import json
import re
@dataclass
class KeyMapper(dict):
"""
Example:
km = KeyMapper({'messages': {'message1': 'Hello World!'}}})
print(km['messages.message1'])
Variables:
__delimiter__ is set to dot-notation by default, unless specified otherwise.
... | [
"json.dumps",
"re.search"
] | [((3028, 3074), 'json.dumps', 'json.dumps', (['self'], {'indent': '(4)', 'ensure_ascii': '(False)'}), '(self, indent=4, ensure_ascii=False)\n', (3038, 3074), False, 'import json\n'), ((2959, 3008), 'json.dumps', 'json.dumps', (['args[0]'], {'indent': '(4)', 'ensure_ascii': '(False)'}), '(args[0], indent=4, ensure_ascii... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Kay management script.
:Copyright: (c) 2009 Accense Technology, Inc. All rights reserved.
:license: BSD, see LICENSE for more details.
"""
import sys
import os
import logging
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
import kay
kay.setup_en... | [
"sys.argv.append",
"os.path.dirname",
"kay.setup_env",
"werkzeug.script.run"
] | [((308, 341), 'kay.setup_env', 'kay.setup_env', ([], {'manage_py_env': '(True)'}), '(manage_py_env=True)\n', (321, 341), False, 'import kay\n'), ((516, 528), 'werkzeug.script.run', 'script.run', ([], {}), '()\n', (526, 528), False, 'from werkzeug import script\n'), ((486, 511), 'sys.argv.append', 'sys.argv.append', (['... |
#!/usr/bin/python
# Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
"""This entry point runs all script tests."""
import logging.config
import unittest
if ... | [
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((402, 423), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (421, 423), False, 'import unittest\n'), ((682, 707), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (705, 707), False, 'import unittest\n')] |
from __future__ import print_function, division, absolute_import
import copy
import numpy as np
import skimage.draw
import skimage.measure
from .. import imgaug as ia
from .utils import normalize_shape, project_coords
# TODO functions: square(), to_aspect_ratio(), contains_point()
class BoundingBox(object):
""... | [
"numpy.clip",
"numpy.copy",
"numpy.uint8",
"numpy.allclose",
"copy.deepcopy",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"numpy.min",
"numpy.finfo",
"copy.copy",
"imgaug.augmentables.kps.Keypoint",
"numpy.round"
] | [((1845, 1879), 'numpy.empty', 'np.empty', (['(2, 2)'], {'dtype': 'np.float32'}), '((2, 2), dtype=np.float32)\n', (1853, 1879), True, 'import numpy as np\n'), ((14585, 14617), 'numpy.clip', 'np.clip', (['self.x1', '(0)', '(width - eps)'], {}), '(self.x1, 0, width - eps)\n', (14592, 14617), True, 'import numpy as np\n')... |
import tensorflow as tf
def _smooth_l1_loss(y_true, y_pred):
t = tf.abs(y_pred - y_true)
return tf.where(t < 1, 0.5 * t ** 2, t - 0.5)
def MultiBoxLoss(num_class=2, neg_pos_ratio=3):
"""multi-box loss"""
def multi_box_loss(y_true, y_pred):
num_batch = tf.shape(y_true)[0]
num_prior = ... | [
"tensorflow.equal",
"tensorflow.maximum",
"tensorflow.shape",
"tensorflow.logical_or",
"tensorflow.boolean_mask",
"tensorflow.argsort",
"tensorflow.where",
"tensorflow.keras.losses.sparse_categorical_crossentropy",
"tensorflow.reshape",
"tensorflow.reduce_mean",
"tensorflow.cast",
"tensorflow.... | [((71, 94), 'tensorflow.abs', 'tf.abs', (['(y_pred - y_true)'], {}), '(y_pred - y_true)\n', (77, 94), True, 'import tensorflow as tf\n'), ((106, 144), 'tensorflow.where', 'tf.where', (['(t < 1)', '(0.5 * t ** 2)', '(t - 0.5)'], {}), '(t < 1, 0.5 * t ** 2, t - 0.5)\n', (114, 144), True, 'import tensorflow as tf\n'), ((3... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-10-24 16:07
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('awardapp', '0003_auto_20191024_1606'),
]
operations = [
migrations.AlterField... | [
"django.db.models.TextField"
] | [((399, 431), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(130)'}), '(max_length=130)\n', (415, 431), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"prestoadmin.coordinator.Coordinator",
"mock.patch",
"prestoadmin.coordinator.Coordinator.validate"
] | [((6360, 6411), 'mock.patch', 'patch', (['"""prestoadmin.node.config.write_conf_to_file"""'], {}), "('prestoadmin.node.config.write_conf_to_file')\n", (6365, 6411), False, 'from mock import patch\n'), ((6417, 6458), 'mock.patch', 'patch', (['"""prestoadmin.node.get_presto_conf"""'], {}), "('prestoadmin.node.get_presto_... |
import pygame, sys, random, time
from pygame.locals import *
class Missile:
def __init__(self, screen, x):
# Store the data. Initialize: y to 591 and exploded to False.
self.screen = screen
self.x = x
self.y = 591
self.exploded = False
def move(self):
# ... | [
"sys.exit",
"pygame.init",
"pygame.draw.line",
"pygame.event.get",
"pygame.Color",
"pygame.display.set_mode",
"pygame.time.Clock",
"pygame.key.get_pressed",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.font.Font",
"pygame.display.update",
"pygame.Rect"
] | [((4760, 4773), 'pygame.init', 'pygame.init', ([], {}), '()\n', (4771, 4773), False, 'import pygame, sys, random, time\n'), ((4786, 4805), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (4803, 4805), False, 'import pygame, sys, random, time\n'), ((4810, 4855), 'pygame.display.set_caption', 'pygame.display.... |
from guniflask.config import settings
from guniflask.web import blueprint, get_route
@blueprint
class ConfigController:
def __init__(self):
pass
@get_route('/settings/<name>')
def get_setting(self, name):
return {name: settings[name]}
| [
"guniflask.web.get_route"
] | [((165, 194), 'guniflask.web.get_route', 'get_route', (['"""/settings/<name>"""'], {}), "('/settings/<name>')\n", (174, 194), False, 'from guniflask.web import blueprint, get_route\n')] |
import sys,os
sys.path.append('/home/zongdaoming/cv/multi-organ/multi-organ-ijcai')
from lib.losses.BaseClass import _AbstractDiceLoss
from lib.losses.basic import *
class DiceLoss(_AbstractDiceLoss):
"""Computes Dice Loss according to https://arxiv.org/abs/1606.04797.
For multi-class segmentation `weight` pa... | [
"sys.path.append"
] | [((14, 83), 'sys.path.append', 'sys.path.append', (['"""/home/zongdaoming/cv/multi-organ/multi-organ-ijcai"""'], {}), "('/home/zongdaoming/cv/multi-organ/multi-organ-ijcai')\n", (29, 83), False, 'import sys, os\n')] |
import datetime
from threading import Thread
from time import sleep
import DBC.dbcreate as dbc
class Tracker(Thread):
max_idle_time = 720 # minutes
default_sleep = 3600 # secs
def track(self):
dbcl = dbc.DBClient()
# print(dbcl.getlasttime())
print("Tracker activated")
... | [
"DBC.dbcreate.DBClient",
"datetime.datetime.now",
"time.sleep"
] | [((225, 239), 'DBC.dbcreate.DBClient', 'dbc.DBClient', ([], {}), '()\n', (237, 239), True, 'import DBC.dbcreate as dbc\n'), ((2140, 2165), 'time.sleep', 'sleep', (['self.default_sleep'], {}), '(self.default_sleep)\n', (2145, 2165), False, 'from time import sleep\n'), ((378, 401), 'datetime.datetime.now', 'datetime.date... |
# Copyright 2016 Google LLC 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 applicable law or ag... | [
"mock.Mock",
"google.cloud.spanner_v1.types.Transaction",
"mock.create_autospec",
"datetime.timedelta",
"google.cloud.spanner_v1._helpers._make_value_pb",
"google.cloud.spanner_v1.proto.transaction_pb2.TransactionSelector",
"google.cloud.spanner_v1.proto.result_set_pb2.ResultSetMetadata",
"google.clou... | [((1385, 1417), 'google.cloud.spanner_v1.snapshot._restart_on_unavailable', '_restart_on_unavailable', (['restart'], {}), '(restart)\n', (1408, 1417), False, 'from google.cloud.spanner_v1.snapshot import _restart_on_unavailable\n'), ((1485, 1570), 'mock.Mock', 'mock.Mock', ([], {'value': 'value', 'resume_token': 'resum... |
from typing import Callable, Tuple
import numpy as np
def posterior_factory(y: np.ndarray, sigma_y: float, sigma_theta: float) -> Tuple[Callable]:
"""The banana distribution is a distribution that exhibits a characteristic
banana-shaped ridge that resembles the posterior that can emerge from
models that ... | [
"numpy.random.normal",
"numpy.sqrt",
"numpy.hstack",
"numpy.square",
"numpy.sum",
"numpy.array"
] | [((1187, 1205), 'numpy.square', 'np.square', (['sigma_y'], {}), '(sigma_y)\n', (1196, 1205), True, 'import numpy as np\n'), ((1227, 1249), 'numpy.square', 'np.square', (['sigma_theta'], {}), '(sigma_theta)\n', (1236, 1249), True, 'import numpy as np\n'), ((2141, 2154), 'numpy.sum', 'np.sum', (['(y - p)'], {}), '(y - p)... |
import pytest
from thefuck.rules.pacman_invalid_option import get_new_command
from thefuck.rules.pacman_invalid_option import match
from thefuck.types import Command
good_output = """community/shared_meataxe 1.0-3
A set of programs for working with matrix representations over finite fields
"""
bad_output = "erro... | [
"pytest.mark.parametrize"
] | [((345, 390), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""option"""', '"""SURQFDVT"""'], {}), "('option', 'SURQFDVT')\n", (368, 390), False, 'import pytest\n'), ((512, 556), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""option"""', '"""azxcbnm"""'], {}), "('option', 'azxcbnm')\n", (535, 55... |