code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from bluedot import MockBlueDot, BlueDotSwipe, BlueDotRotation
from time import sleep
from threading import Event, Thread
def test_default_values():
mbd = MockBlueDot()
assert mbd.device == "hci0"
assert mbd.port == 1
assert mbd.running
assert mbd.print_messages
assert mbd.double_press_time ==... | [
"threading.Thread",
"bluedot.MockBlueDot",
"bluedot.BlueDotRotation",
"time.sleep",
"threading.Event",
"bluedot.BlueDotSwipe"
] | [((160, 173), 'bluedot.MockBlueDot', 'MockBlueDot', ([], {}), '()\n', (171, 173), False, 'from bluedot import MockBlueDot, BlueDotSwipe, BlueDotRotation\n'), ((677, 763), 'bluedot.MockBlueDot', 'MockBlueDot', ([], {'device': '"""hci1"""', 'port': '(2)', 'auto_start_server': '(False)', 'print_messages': '(False)'}), "(d... |
"""Data Provider module for providing data blocks made from similar stocks over a set time period, but separated.
This data provider is not intended to be used outside of this module, instead, upon import, this module will create an
instance of a SplitBlockProvider and register it with the global DataProviderRegist... | [
"data_providing_module.configurable_registry.config_registry.register_configurable",
"stock_data_analysis_module.data_processing_module.stock_cluster_data_manager.StockClusterDataManager",
"datetime.datetime.now",
"datetime.timedelta",
"data_providing_module.data_provider_registry.registry.register_provider... | [((2646, 2711), 'data_providing_module.configurable_registry.config_registry.register_configurable', 'configurable_registry.config_registry.register_configurable', (['self'], {}), '(self)\n', (2705, 2711), False, 'from data_providing_module import configurable_registry\n'), ((3265, 3310), 'general_utils.config.config_u... |
import sys
import time
def create_versioned_files(src_filename, filenames):
timestamp = int(time.time())
with open(src_filename, encoding='utf-8') as html_file:
html_file_content = html_file.read()
for filename in filenames:
usages_count = html_file_content.count(filename)
... | [
"time.time"
] | [((98, 109), 'time.time', 'time.time', ([], {}), '()\n', (107, 109), False, 'import time\n')] |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="bgflow",
version="0.1",
description="Boltzmann Generators in PyTorch",
author="<NAME>, <NAME>, <NAME>, <NAME>",
author_email="<EMAIL>",
url="https://www.mi.fu-berlin.de/en/math/groups/comp-mol-bio/index.html",
p... | [
"setuptools.find_packages"
] | [((328, 343), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (341, 343), False, 'from setuptools import setup, find_packages\n')] |
from __future__ import print_function, division
import matplotlib.pyplot as plt
import math
from sklearn.metrics import auc
import numpy as np
import cv2
import os, sys
int_ = lambda x: int(round(x))
def IoU( r1, r2 ):
x11, y11, w1, h1 = r1
x21, y21, w2, h2 = r2
x12 = x11 + w1; y12 = y11 + h1
x22 = x... | [
"matplotlib.pyplot.show",
"numpy.sum",
"cv2.filter2D",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.plot",
"math.ceil",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.max",
"numpy.array",
"numpy.linspace",
"matplotlib.pyplot.grid"
] | [((777, 792), 'numpy.ones', 'np.ones', (['(h, w)'], {}), '((h, w))\n', (784, 792), True, 'import numpy as np\n'), ((807, 829), 'cv2.filter2D', 'cv2.filter2D', (['x', '(-1)', 'k'], {}), '(x, -1, k)\n', (819, 829), False, 'import cv2\n'), ((1921, 1947), 'numpy.mean', 'np.mean', (['success_rate[:-1]'], {}), '(success_rate... |
#
# Compare lithium-ion battery models with and without particle size distibution
#
import numpy as np
import pybamm
pybamm.set_logging_level("INFO")
# load models
models = [
pybamm.lithium_ion.DFN(name="standard DFN"),
pybamm.lithium_ion.DFN(name="particle DFN"),
]
# load parameter values
params = [models[0... | [
"pybamm.set_logging_level",
"pybamm.Simulation",
"numpy.linspace",
"pybamm.QuickPlot",
"pybamm.lithium_ion.DFN"
] | [((118, 150), 'pybamm.set_logging_level', 'pybamm.set_logging_level', (['"""INFO"""'], {}), "('INFO')\n", (142, 150), False, 'import pybamm\n'), ((730, 755), 'numpy.linspace', 'np.linspace', (['(0)', '(3600)', '(100)'], {}), '(0, 3600, 100)\n', (741, 755), True, 'import numpy as np\n'), ((1327, 1384), 'pybamm.QuickPlot... |
from django.shortcuts import render
from django.core.mail import send_mail
from django.conf import settings
# from .forms import contactForms
# Create your views here.
def contact(request):
context = locals()
template = 'contact.html'
return render(request,template,context)
'''def contact(request):
title = 'Conta... | [
"django.shortcuts.render"
] | [((246, 280), 'django.shortcuts.render', 'render', (['request', 'template', 'context'], {}), '(request, template, context)\n', (252, 280), False, 'from django.shortcuts import render\n')] |
#!/usr/bin/env python
"""
Use this node to perform indoor zone location using the metraTec IPS tracking system. Prerequisites for using this node
is a running receiver-node that handles communication with the receiver and thus with the beacons in the vicinity.
Also, make sure that you have defined your zones correctly ... | [
"rospy.Subscriber",
"geometry_msgs.msg.PolygonStamped",
"indoor_positioning.msg.StringStamped",
"rospkg.RosPack",
"rospy.Publisher",
"rospy.Rate",
"rospy.get_param",
"rospy.is_shutdown",
"geometry_msgs.msg.Point32",
"rospy.init_node",
"indoor_positioning.positioning.Positioning",
"rospy.has_pa... | [((5949, 5996), 'rospy.init_node', 'rospy.init_node', (['"""positioning"""'], {'anonymous': '(False)'}), "('positioning', anonymous=False)\n", (5964, 5996), False, 'import rospy\n'), ((1824, 1890), 'rospy.Subscriber', 'rospy.Subscriber', (['"""ips/receiver/raw"""', 'StringStamped', 'self.callback'], {}), "('ips/receive... |
from flask import Flask
from flask import jsonify
from flask import request
from flask_cors import CORS
from raven.contrib.flask import Sentry
from orion.context import Context
from orion.handlers import handler_classes
def init_app(app):
"""
Statefully initialize the Flask application. This involves creatin... | [
"raven.contrib.flask.Sentry",
"orion.context.Context",
"flask.Flask",
"flask.jsonify",
"flask.request.get_json"
] | [((538, 550), 'orion.context.Context', 'Context', (['app'], {}), '(app)\n', (545, 550), False, 'from orion.context import Context\n'), ((1915, 1929), 'flask.Flask', 'Flask', (['"""orion"""'], {}), "('orion')\n", (1920, 1929), False, 'from flask import Flask\n'), ((720, 742), 'raven.contrib.flask.Sentry', 'Sentry', ([],... |
"""
A simple message queue for TAPPs using Redis.
"""
import json
import time
from sqlalchemy_models import create_session_engine, setup_database, util, exchange as em, user as um, wallet as wm
from tapp_config import setup_redis, get_config, setup_logging
def subscription_handler(channel, client, mykey=None, auth=Fa... | [
"sqlalchemy_models.util.create_user",
"sqlalchemy_models.setup_database",
"json.loads",
"tapp_config.setup_redis",
"json.dumps",
"time.sleep",
"sqlalchemy_models.create_session_engine"
] | [((2302, 2315), 'tapp_config.setup_redis', 'setup_redis', ([], {}), '()\n', (2313, 2315), False, 'from tapp_config import setup_redis, get_config, setup_logging\n'), ((2602, 2615), 'tapp_config.setup_redis', 'setup_redis', ([], {}), '()\n', (2613, 2615), False, 'from tapp_config import setup_redis, get_config, setup_lo... |
from typing import Optional
import graphene
from django.core.exceptions import ValidationError
from ....giftcard.utils import order_has_gift_card_lines
from ....order import FulfillmentLineData
from ....order import models as order_models
from ....order.error_codes import OrderErrorCode
from ....order.fetch import Or... | [
"graphene.Node.to_global_id",
"django.core.exceptions.ValidationError"
] | [((2374, 2415), 'graphene.Node.to_global_id', 'graphene.Node.to_global_id', (['type', 'line_id'], {}), '(type, line_id)\n', (2400, 2415), False, 'import graphene\n'), ((3181, 3212), 'django.core.exceptions.ValidationError', 'ValidationError', (['msg'], {'code': 'code'}), '(msg, code=code)\n', (3196, 3212), False, 'from... |
from typing import Callable, Generator, Generic, Optional, TypeVar
from mlprogram import logging
from mlprogram.synthesizers.synthesizer import Result, Synthesizer
logger = logging.Logger(__name__)
Input = TypeVar("Input")
Output = TypeVar("Output")
class FilteredSynthesizer(Synthesizer[Input, Output], Generic[Inp... | [
"typing.TypeVar",
"mlprogram.logging.Logger"
] | [((175, 199), 'mlprogram.logging.Logger', 'logging.Logger', (['__name__'], {}), '(__name__)\n', (189, 199), False, 'from mlprogram import logging\n'), ((209, 225), 'typing.TypeVar', 'TypeVar', (['"""Input"""'], {}), "('Input')\n", (216, 225), False, 'from typing import Callable, Generator, Generic, Optional, TypeVar\n'... |
import os
import sys
import logging
import traceback
from logging import Logger
from types import TracebackType
from typing import Union, Tuple, Optional
from .argparser import LogArgParser
from .handlers import CustomTimedRotatingFileHandler
class Log:
"""Initiates a logging object to record processes and errors... | [
"os.path.expanduser",
"sys.gettrace",
"sys.__excepthook__",
"os.makedirs",
"logging.StreamHandler",
"os.path.exists",
"traceback.format_tb",
"logging.Formatter",
"logging.getLevelName",
"sys.exc_info",
"os.path.join",
"logging.getLogger"
] | [((4344, 4417), 'os.path.join', 'os.path.join', (['home_dir', '(log_dir if log_dir is not None else self.log_name)'], {}), '(home_dir, log_dir if log_dir is not None else self.log_name)\n', (4356, 4417), False, 'import os\n'), ((4629, 4669), 'os.path.join', 'os.path.join', (['log_dir', 'self.log_filename'], {}), '(log_... |
from __future__ import absolute_import
from itertools import product, combinations
from git.objects import Blob
from collections import defaultdict
from kenja.historage import *
from kenja.shingles import calculate_similarity
def get_extends(commit, org_file_name, classes):
classes_path = '/[CN]/'.join(classes)
... | [
"collections.defaultdict",
"kenja.shingles.calculate_similarity"
] | [((3627, 3644), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3638, 3644), False, 'from collections import defaultdict\n'), ((3667, 3684), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (3678, 3684), False, 'from collections import defaultdict\n'), ((5572, 5612), 'kenja.s... |
#!/usr/bin/env python
"""Tests for `blast2xl` package."""
from os.path import abspath
from pathlib import Path
from click.testing import CliRunner
from blast2xl import cli
def test_command_line_interface():
"""Test the CLI."""
runner = CliRunner()
help_result = runner.invoke(cli.main, ['--help'])
... | [
"click.testing.CliRunner",
"os.path.abspath",
"pathlib.Path"
] | [((250, 261), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (259, 261), False, 'from click.testing import CliRunner\n'), ((562, 593), 'os.path.abspath', 'abspath', (['"""tests/data/blast_tsv"""'], {}), "('tests/data/blast_tsv')\n", (569, 593), False, 'from os.path import abspath\n'), ((610, 638), 'os.path.a... |
import requests
import json
__SERVER_HOST__ = "http://127.0.0.1:5057"
__CLIENT_SECRET__ = 1234567890
__SERVER_SECRET__ = 1234567890
__SERVER_START_API__ = "/api/start"
__SERVER_STOP_API__ = "/api/stop"
__SERVER_PARAMETERS_API__ = "/api/parameters"
__SERVER_ALLPARAME... | [
"requests.post",
"json.loads",
"requests.get",
"json.dumps"
] | [((1516, 1576), 'requests.get', 'requests.get', (['apipath'], {'verify': '(False)', 'headers': 'default_headers'}), '(apipath, verify=False, headers=default_headers)\n', (1528, 1576), False, 'import requests\n'), ((1598, 1626), 'json.loads', 'json.loads', (['response.content'], {}), '(response.content)\n', (1608, 1626)... |
# Copyright (c) 2015, <NAME>
# All rights reserved.
import os
import re
def get(osx_version):
dev_dir = re.sub(r'\.', '_', osx_version)
dev_dir = 'OSX_{}_DEVELOPER_DIR'.format(dev_dir)
return os.getenv(dev_dir)
| [
"re.sub",
"os.getenv"
] | [((108, 139), 're.sub', 're.sub', (['"""\\\\."""', '"""_"""', 'osx_version'], {}), "('\\\\.', '_', osx_version)\n", (114, 139), False, 'import re\n'), ((200, 218), 'os.getenv', 'os.getenv', (['dev_dir'], {}), '(dev_dir)\n', (209, 218), False, 'import os\n')] |
"""config/config
Default corpus configs.
"""
import sys
import os
import inspect
from pathlib import Path
from kleis import kleis_data
ACLRDTEC = "acl-rd-tec-2.0"
SEMEVAL2017 = "semeval2017-task10"
KPEXTDATA_PATH = str(Path(inspect.getfile(kleis_data)).parent)
# Check for default paths for corpus
DEFAULT_CORPUS_P... | [
"inspect.getfile",
"pathlib.Path",
"os.path.expanduser"
] | [((359, 402), 'pathlib.Path', 'Path', (["('./kleis_data/' + DEFAULT_CORPUS_PATH)"], {}), "('./kleis_data/' + DEFAULT_CORPUS_PATH)\n", (363, 402), False, 'from pathlib import Path\n'), ((566, 623), 'os.path.expanduser', 'os.path.expanduser', (["('~/kleis_data/' + DEFAULT_CORPUS_PATH)"], {}), "('~/kleis_data/' + DEFAULT_... |
from scipy.misc import imread
from tqdm import tqdm
import numpy as np
import os
import random
import warnings
class SetList(object):
'''A class to hold lists of inputs for a network'''
def __init__(self, source='', target=None):
'''Constructs a new SetList.
Args:
source (str): T... | [
"tqdm.tqdm",
"os.path.isdir",
"random.shuffle",
"os.walk",
"os.path.exists",
"numpy.mean",
"os.path.splitext",
"warnings.warn",
"scipy.misc.imread"
] | [((1365, 1391), 'os.path.isdir', 'os.path.isdir', (['self.source'], {}), '(self.source)\n', (1378, 1391), False, 'import os\n'), ((2331, 2356), 'random.shuffle', 'random.shuffle', (['self.list'], {}), '(self.list)\n', (2345, 2356), False, 'import random\n'), ((3380, 3390), 'tqdm.tqdm', 'tqdm', (['self'], {}), '(self)\n... |
from Source import ModelsIO as MIO
import numpy as np
from h5py import File
def E_fit(_cube: np.ndarray((10, 13, 21, 128, 128), '>f4'),
data: np.ndarray((128, 128), '>f4'),
seg: np.ndarray((128, 128), '>f4'),
noise: np.ndarray((128, 128), '>f4')) -> np.ndarray((10, 13, 21), '>f4'):
... | [
"h5py.File",
"Source.ModelsIO.fits.ImageHDU",
"numpy.sum",
"Source.ModelsIO.ModelsCube",
"numpy.median",
"numpy.einsum",
"numpy.float",
"numpy.zeros",
"Source.ModelsIO.fits.open",
"numpy.argmin",
"numpy.swapaxes",
"numpy.ndarray",
"numpy.sqrt"
] | [((282, 313), 'numpy.ndarray', 'np.ndarray', (['(10, 13, 21)', '""">f4"""'], {}), "((10, 13, 21), '>f4')\n", (292, 313), True, 'import numpy as np\n'), ((335, 376), 'numpy.ndarray', 'np.ndarray', (['(10, 13, 21, 128, 128)', '""">f4"""'], {}), "((10, 13, 21, 128, 128), '>f4')\n", (345, 376), True, 'import numpy as np\n'... |
import os
import pandas as pd
from tqdm import tqdm
import pipelines.p1_orca_by_stop as p1
from utils import constants, data_utils
NAME = 'p2_aggregate_orca'
WRITE_DIR = os.path.join(constants.PIPELINE_OUTPUTS_DIR, NAME)
def load_input():
path = os.path.join(constants.PIPELINE_OUTPUTS_DIR, f'{p1.NAME}.csv')
... | [
"pandas.DataFrame",
"os.mkdir",
"tqdm.tqdm",
"tqdm.tqdm.write",
"pandas.read_csv",
"os.path.exists",
"utils.data_utils.parse_collection",
"os.path.join"
] | [((174, 224), 'os.path.join', 'os.path.join', (['constants.PIPELINE_OUTPUTS_DIR', 'NAME'], {}), '(constants.PIPELINE_OUTPUTS_DIR, NAME)\n', (186, 224), False, 'import os\n'), ((256, 318), 'os.path.join', 'os.path.join', (['constants.PIPELINE_OUTPUTS_DIR', 'f"""{p1.NAME}.csv"""'], {}), "(constants.PIPELINE_OUTPUTS_DIR, ... |
import nltk
import os
import torch
import torch.utils.data as data
import numpy as np
import json
from .vocabulary import Vocabulary
from pycocotools.coco import COCO
from PIL import Image
from tqdm import tqdm
class CoCoDataset(data.Dataset):
def __init__(self, transform, mode, batch_size, vocab_threshold, voca... | [
"pycocotools.coco.COCO",
"torch.Tensor",
"numpy.array",
"numpy.random.choice",
"os.path.join"
] | [((2802, 2840), 'numpy.random.choice', 'np.random.choice', (['self.caption_lengths'], {}), '(self.caption_lengths)\n', (2818, 2840), True, 'import numpy as np\n'), ((776, 798), 'pycocotools.coco.COCO', 'COCO', (['annotations_file'], {}), '(annotations_file)\n', (780, 798), False, 'from pycocotools.coco import COCO\n'),... |
import os
import json
from six import iteritems
import h5py
import numpy as np
from tqdm import tqdm
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from vdgnn.dataset.readers import DenseAnnotationsReader, ImageFeaturesHdfReader
TRAIN_VAL_SPLIT = {'0.9': 80000, '1.0': 123287}
clas... | [
"h5py.File",
"json.load",
"torch.stack",
"os.path.exists",
"vdgnn.dataset.readers.DenseAnnotationsReader",
"torch.zeros",
"vdgnn.dataset.readers.ImageFeaturesHdfReader",
"torch.Tensor",
"numpy.array",
"torch.max",
"torch.Size",
"torch.nn.functional.normalize",
"six.iteritems",
"os.path.joi... | [((2280, 2323), 'os.path.join', 'os.path.join', (['args.dataroot', 'input_img_path'], {}), '(args.dataroot, input_img_path)\n', (2292, 2323), False, 'import os\n'), ((2350, 2398), 'os.path.join', 'os.path.join', (['args.dataroot', 'args.visdial_params'], {}), '(args.dataroot, args.visdial_params)\n', (2362, 2398), Fals... |
import random
from config import *
from wall import *
apple = pygame.image.load('../snakepro/assets/ronald.boadana_apple.png')
apple_pos = ((random.randint(32, 726) // 32 * 32), (random.randint(64, 576) // 32 * 32))
def apple_randomness_movement():
apple_x = (random.randint(32, 726) // 32 * 32)
apple_y = (r... | [
"random.randint"
] | [((143, 166), 'random.randint', 'random.randint', (['(32)', '(726)'], {}), '(32, 726)\n', (157, 166), False, 'import random\n'), ((181, 204), 'random.randint', 'random.randint', (['(64)', '(576)'], {}), '(64, 576)\n', (195, 204), False, 'import random\n'), ((268, 291), 'random.randint', 'random.randint', (['(32)', '(72... |
from random import choices
n1=str(input('Digite o nome do primeiro aluno:'))
n2=str(input('Digite o nome do segundo aluno:'))
n3=str(input('Digite o nome do terceiro aluno:'))
n4=str(input('Digite o nome do quarto aluno'))
lista=[n1, n2, n3, n4]
e=choices(lista)
print('O aluno escolhido foi {}'.format(e))
| [
"random.choices"
] | [((249, 263), 'random.choices', 'choices', (['lista'], {}), '(lista)\n', (256, 263), False, 'from random import choices\n')] |
from model.resnext import model1_val4
model1_val4.train()
| [
"model.resnext.model1_val4.train"
] | [((38, 57), 'model.resnext.model1_val4.train', 'model1_val4.train', ([], {}), '()\n', (55, 57), False, 'from model.resnext import model1_val4\n')] |
from libsaas import http, parsers
from libsaas.services import base
from . import resource, flags
class CommentsBase(resource.UserVoiceTextResource):
path = 'comments'
def wrap_object(self, name):
return {'comment': {'text': name}}
class Comments(CommentsBase):
def create(self, obj):
... | [
"libsaas.services.base.MethodNotSupported",
"libsaas.services.base.resource"
] | [((405, 448), 'libsaas.services.base.resource', 'base.resource', (['flags.SuggestionCommentFlags'], {}), '(flags.SuggestionCommentFlags)\n', (418, 448), False, 'from libsaas.services import base\n'), ((327, 352), 'libsaas.services.base.MethodNotSupported', 'base.MethodNotSupported', ([], {}), '()\n', (350, 352), False,... |
from pyrogram import Client, Filters, Emoji
import random
import time
app = Client("session",bot_token="<KEY>",api_id=605563,api_hash="7f2c2d12880400b88764b9b304e14e0b")
@app.on_message(Filters.command('bowl'))
def ran(client, message):
b = client.get_chat_member(message.chat.id,message.from_user.id)
cli... | [
"pyrogram.Client",
"random.choice",
"pyrogram.Filters.command",
"time.sleep"
] | [((79, 180), 'pyrogram.Client', 'Client', (['"""session"""'], {'bot_token': '"""<KEY>"""', 'api_id': '(605563)', 'api_hash': '"""7f2c2d12880400b88764b9b304e14e0b"""'}), "('session', bot_token='<KEY>', api_id=605563, api_hash=\n '7f2c2d12880400b88764b9b304e14e0b')\n", (85, 180), False, 'from pyrogram import Client, F... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2017-05-09 15:47
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sale', '0001_initial'),
]
operations = [
migrations.AddField(
mod... | [
"django.db.models.CharField"
] | [((391, 477), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(1)', 'max_length': '(128)', 'verbose_name': '"""Sale operation number"""'}), "(default=1, max_length=128, verbose_name=\n 'Sale operation number')\n", (407, 477), False, 'from django.db import migrations, models\n')] |
import matplotlib
matplotlib.use('TkAgg') # noqa
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.cm as cm
import matplotlib.colors as mcolors
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
import cmocean
im... | [
"numpy.abs",
"oggm.cfg.initialize",
"relic.preprocessing.GLCDICT.keys",
"relic.postprocessing.get_ensemble_length",
"collections.defaultdict",
"matplotlib.pyplot.figure",
"mpl_toolkits.axes_grid1.inset_locator.inset_axes",
"numpy.arange",
"oggm.utils.ncDataset",
"numpy.isclose",
"relic.preproces... | [((19, 42), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (33, 42), False, 'import matplotlib\n'), ((923, 958), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(3)'], {'figsize': '[20, 7]'}), '(1, 3, figsize=[20, 7])\n', (935, 958), True, 'import matplotlib.pyplot as plt\n'), ((5423,... |
import os
import sys
from typing import List, Set, Tuple
import unittest
sys.path.append(os.path.join('..', 'filmatyk'))
import containers
import database
import filmweb
class DatabaseDifference():
"""Represents a difference between two DBs.
Can be constructed using the "compute" @staticmethod, which can be use... | [
"unittest.main",
"os.path.exists",
"database.Database.restoreFromString",
"unittest.skip",
"database.Database",
"os.path.join",
"os.scandir"
] | [((90, 120), 'os.path.join', 'os.path.join', (['""".."""', '"""filmatyk"""'], {}), "('..', 'filmatyk')\n", (102, 120), False, 'import os\n'), ((11925, 11979), 'unittest.skip', 'unittest.skip', (['"""Relevant feature not implemented yet."""'], {}), "('Relevant feature not implemented yet.')\n", (11938, 11979), False, 'i... |
from django.contrib import admin
from .models import Company, DPEF, Sentence, ActivitySector
admin.site.register(Company)
admin.site.register(DPEF)
admin.site.register(Sentence)
admin.site.register(ActivitySector)
| [
"django.contrib.admin.site.register"
] | [((95, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['Company'], {}), '(Company)\n', (114, 123), False, 'from django.contrib import admin\n'), ((124, 149), 'django.contrib.admin.site.register', 'admin.site.register', (['DPEF'], {}), '(DPEF)\n', (143, 149), False, 'from django.contrib import admin... |
"""tests"""
import pytest
from shapely.geometry import Point, Polygon, LineString
from pyiem import wellknowntext
def test_parsecoordinate_lists():
"""Parse!"""
with pytest.raises(ValueError):
wellknowntext.parse_coordinate_lists(" ")
def test_unknown():
"""Test an emptry string."""
with p... | [
"pyiem.wellknowntext.convert_well_known_text",
"shapely.geometry.Point",
"shapely.geometry.Polygon",
"pyiem.wellknowntext.parse_coordinate_lists",
"shapely.geometry.LineString",
"pytest.raises"
] | [((499, 541), 'pyiem.wellknowntext.convert_well_known_text', 'wellknowntext.convert_well_known_text', (['wkt'], {}), '(wkt)\n', (536, 541), False, 'from pyiem import wellknowntext\n'), ((750, 792), 'pyiem.wellknowntext.convert_well_known_text', 'wellknowntext.convert_well_known_text', (['wkt'], {}), '(wkt)\n', (787, 79... |
from sklearn.preprocessing import OrdinalEncoder
from typing import List
import pandas as pd
import numpy as np
from ._base_transform import BaseTransform
##############################################################################
class CategoricalEncoder(BaseTransform):
""" Categorical encoder
Parameter... | [
"sklearn.preprocessing.OrdinalEncoder"
] | [((521, 593), 'sklearn.preprocessing.OrdinalEncoder', 'OrdinalEncoder', ([], {'handle_unknown': '"""use_encoded_value"""', 'unknown_value': 'np.nan'}), "(handle_unknown='use_encoded_value', unknown_value=np.nan)\n", (535, 593), False, 'from sklearn.preprocessing import OrdinalEncoder\n')] |
"""
Makes Puddleworld tasks.
Tasks are (gridworld, text instruction) -> goal coordinate.
Credit: tasks are taken from: https://github.com/JannerM/spatial-reasoning
"""
from puddleworldPrimitives import *
from utilities import *
from task import *
from type import *
OBJECT_NAMES = ["NULL", "puddle", "star", "circle", ... | [
"json.load"
] | [((587, 599), 'json.load', 'json.load', (['f'], {}), '(f)\n', (596, 599), False, 'import json\n')] |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from . import common
def main(debug=False):
name = ['I', 'A', 'S', 'C']
suffix = ['', '', '', '']
df0 = []
for n, s in zip(name, suffix):
prec = pd.read_csv(f'results/logk_prec_{n}{s}.csv')
p... | [
"seaborn.heatmap",
"matplotlib.pyplot.get_cmap",
"pandas.read_csv",
"numpy.where",
"numpy.log10",
"pandas.concat"
] | [((690, 712), 'pandas.concat', 'pd.concat', (['df0'], {'axis': '(1)'}), '(df0, axis=1)\n', (699, 712), True, 'import pandas as pd\n'), ((266, 310), 'pandas.read_csv', 'pd.read_csv', (['f"""results/logk_prec_{n}{s}.csv"""'], {}), "(f'results/logk_prec_{n}{s}.csv')\n", (277, 310), True, 'import pandas as pd\n'), ((384, 4... |
"""Tests for loading and saving pickled files."""
from pytype import file_utils
from pytype.tests import test_base
class PickleTest(test_base.TargetPython3BasicTest):
"""Tests for loading and saving pickled files."""
def testContainer(self):
pickled = self.Infer("""
import collections, json
def ... | [
"pytype.file_utils.Tempdir"
] | [((528, 548), 'pytype.file_utils.Tempdir', 'file_utils.Tempdir', ([], {}), '()\n', (546, 548), False, 'from pytype import file_utils\n')] |
import argparse
from datetime import datetime
import torch
import torch.nn.functional as F
from torch.utils.tensorboard import SummaryWriter
import numpy as np
from torch_model import SizedGenerator
import os
from tqdm import trange
from torchvision.utils import save_image, make_grid
import params as P
from utils impo... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"torch.randn",
"utils.psnr",
"torch.no_grad",
"torch.ones",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.Linear",
"datetime.datetime.now",
"utils.load_trained_generator",
"tqdm.trange",
"torch... | [((568, 602), 'os.makedirs', 'os.makedirs', (['logdir'], {'exist_ok': '(True)'}), '(logdir, exist_ok=True)\n', (579, 602), False, 'import os\n'), ((678, 699), 'torch.utils.tensorboard.SummaryWriter', 'SummaryWriter', (['logdir'], {}), '(logdir)\n', (691, 699), False, 'from torch.utils.tensorboard import SummaryWriter\n... |
# -*- coding: utf-8 -*-
# @Time : 2021/11/13 1:47 下午
# @Author : xujunpeng
from app import app
from confluent_kafka import Producer
KafkaProducer = Producer({'bootstrap.servers': app.config["KAFKA_SERVERS"]})
| [
"confluent_kafka.Producer"
] | [((154, 214), 'confluent_kafka.Producer', 'Producer', (["{'bootstrap.servers': app.config['KAFKA_SERVERS']}"], {}), "({'bootstrap.servers': app.config['KAFKA_SERVERS']})\n", (162, 214), False, 'from confluent_kafka import Producer\n')] |
import django.core.validators
from django.db import migrations, models
def clear_gen8(apps, schema_editor):
Update = apps.get_model("pokemongo", "Update")
Update.objects.update(badge_pokedex_entries_gen8=None)
class Migration(migrations.Migration):
dependencies = [
("pokemongo", "0032_remove_tr... | [
"django.db.migrations.RunPython",
"django.db.migrations.RenameField"
] | [((382, 531), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""update"""', 'old_name': '"""badge_photobombadge_rocket_grunts_defeated"""', 'new_name': '"""badge_rocket_grunts_defeated"""'}), "(model_name='update', old_name=\n 'badge_photobombadge_rocket_grunts_defeated', new_name... |
__author__ = 'rcj1492'
__created__ = '2016.11'
__license__ = 'MIT'
from labpack.platforms.apscheduler import apschedulerClient
if __name__ == '__main__':
from labpack.records.settings import load_settings
system_config = load_settings('../../cred/system.yaml')
scheduler_url = 'http://%s:%s' % (sy... | [
"time.sleep",
"time.time",
"labpack.records.settings.load_settings",
"labpack.platforms.apscheduler.apschedulerClient"
] | [((239, 278), 'labpack.records.settings.load_settings', 'load_settings', (['"""../../cred/system.yaml"""'], {}), "('../../cred/system.yaml')\n", (252, 278), False, 'from labpack.records.settings import load_settings\n'), ((418, 450), 'labpack.platforms.apscheduler.apschedulerClient', 'apschedulerClient', (['scheduler_u... |
from sqlalchemy import sql
from sqlalchemy.orm import joinedload, subqueryload
from sqlalchemy.inspection import inspect
from mbdata.utils.models import get_entity_type_model, get_link_model, ENTITY_TYPES
from mbdata.models import (
Area,
Artist,
Label,
Link,
LinkAreaArea,
LinkType,
Place,
... | [
"mbdata.models.LinkAreaArea.entity0_id.label",
"sqlalchemy.sql.literal",
"sqlalchemy.inspection.inspect",
"sqlalchemy.orm.subqueryload",
"sqlalchemy.orm.joinedload",
"mbdata.models.LinkAreaArea.entity1_id.label",
"mbdata.utils.models.get_entity_type_model",
"mbdata.utils.models.get_link_model",
"mbd... | [((9108, 9142), 'mbdata.utils.models.get_entity_type_model', 'get_entity_type_model', (['target_type'], {}), '(target_type)\n', (9129, 9142), False, 'from mbdata.utils.models import get_entity_type_model, get_link_model, ENTITY_TYPES\n'), ((9155, 9197), 'mbdata.utils.models.get_link_model', 'get_link_model', (['source_... |
import torch
import numpy as np
import os
import sys
from shark_runner import shark_inference
class ResNest50(torch.nn.Module):
def __init__(self):
super().__init__()
self.model = torch.hub.load(
"zhanghang1989/ResNeSt", "resnest50", pretrained=True
)
self.train(False)
... | [
"torch.hub.load",
"torch.randn"
] | [((402, 429), 'torch.randn', 'torch.randn', (['(1)', '(3)', '(224)', '(224)'], {}), '(1, 3, 224, 224)\n', (413, 429), False, 'import torch\n'), ((202, 271), 'torch.hub.load', 'torch.hub.load', (['"""zhanghang1989/ResNeSt"""', '"""resnest50"""'], {'pretrained': '(True)'}), "('zhanghang1989/ResNeSt', 'resnest50', pretrai... |
# -*- coding: utf-8 -*-
import pathlib as _pl
import pandas as _pd
import s3fs as _s3fs
# import urllib as _urllib
# import html2text as _html2text
import psutil as _psutil
import numpy as _np
# import xarray as _xr
def readme():
url = 'https://docs.opendata.aws/noaa-goes16/cics-readme.html'
# html = _urllib.r... | [
"pandas.DataFrame",
"pandas.date_range",
"psutil.disk_usage",
"pathlib.Path",
"s3fs.S3FileSystem",
"pandas.to_datetime",
"pandas.to_timedelta",
"numpy.all"
] | [((502, 531), 's3fs.S3FileSystem', '_s3fs.S3FileSystem', ([], {'anon': '(True)'}), '(anon=True)\n', (520, 531), True, 'import s3fs as _s3fs\n'), ((542, 557), 'pandas.DataFrame', '_pd.DataFrame', ([], {}), '()\n', (555, 557), True, 'import pandas as _pd\n'), ((865, 890), 'numpy.all', '_np.all', (['(df[16] == df[17])'], ... |
"""
CanvasItem module contains classes related to canvas items.
"""
from __future__ import annotations
# standard libraries
import collections
import concurrent.futures
import contextlib
import copy
import datetime
import enum
import functools
import imageio
import logging
import operator
import sys
import threadi... | [
"nion.utils.Geometry.fit_to_aspect_ratio",
"typing.cast",
"nion.utils.Geometry.IntPoint",
"weakref.ref",
"nion.utils.Geometry.FloatPoint",
"nion.utils.Geometry.IntRect",
"numpy.zeros_like",
"traceback.print_exc",
"threading.Condition",
"nion.ui.UserInterface.MenuItemState",
"threading.Event",
... | [((137650, 137714), 'collections.namedtuple', 'collections.namedtuple', (['"""PositionLength"""', "['position', 'length']"], {}), "('PositionLength', ['position', 'length'])\n", (137672, 137714), False, 'import collections\n'), ((215555, 215580), 'imageio.imread', 'imageio.imread', (['b', 'format'], {}), '(b, format)\n... |
from aoc_wim.aoc2019 import q12
test10 = """\
<x=-1, y=0, z=2>
<x=2, y=-10, z=-7>
<x=4, y=-8, z=8>
<x=3, y=5, z=-1>"""
test100 = """\
<x=-8, y=-10, z=0>
<x=5, y=5, z=10>
<x=2, y=-7, z=3>
<x=9, y=-8, z=-3>"""
def test_total_energy_after_10_steps():
assert q12.simulate(test10, n=10) == 179
def test_total_energ... | [
"aoc_wim.aoc2019.q12.simulate"
] | [((264, 290), 'aoc_wim.aoc2019.q12.simulate', 'q12.simulate', (['test10'], {'n': '(10)'}), '(test10, n=10)\n', (276, 290), False, 'from aoc_wim.aoc2019 import q12\n'), ((352, 380), 'aoc_wim.aoc2019.q12.simulate', 'q12.simulate', (['test100'], {'n': '(100)'}), '(test100, n=100)\n', (364, 380), False, 'from aoc_wim.aoc20... |
import requests
import smtplib
import time
from bs4 import BeautifulSoup
URL = 'https://www.amazon.de/PowerColor-Radeon-5700-8192MB-PCI/dp/B07WT15P2P/ref=sr_1_8?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&keywords=PowerColor+Radeon+RX+5700+Red+Dragon+8GB&qid=1582975984&sr=8-8#customerReviews'
def send_mail():
serv... | [
"requests.get",
"time.sleep",
"smtplib.SMTP",
"bs4.BeautifulSoup"
] | [((325, 360), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (337, 360), False, 'import smtplib\n'), ((1130, 1164), 'requests.get', 'requests.get', (['URL'], {'headers': 'headers'}), '(URL, headers=headers)\n', (1142, 1164), False, 'import requests\n'), ((1176, 121... |
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.decomposition import PCA, IncrementalPCA
from sklearn.linear_model import LogisticRegression
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
from sklearn.gri... | [
"sklearn.cross_validation.train_test_split",
"sklearn.feature_extraction.text.CountVectorizer",
"warnings.filterwarnings",
"sklearn.decomposition.IncrementalPCA",
"sklearn.metrics.classification_report",
"time.time",
"sklearn.linear_model.LogisticRegression",
"sklearn.neural_network.MLPClassifier",
... | [((533, 566), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (556, 566), False, 'import warnings\n'), ((1367, 1414), 'sklearn.decomposition.IncrementalPCA', 'IncrementalPCA', ([], {'n_components': '(50)', 'batch_size': '(100)'}), '(n_components=50, batch_size=100)\n', (138... |
# String pattern matches used in Functional Owl
# The following productions are taken from ShExJ.py from the ShExJSG project
from typing import Union, Any
from funowl.terminals.Patterns import String, Pattern
class HEX(String):
pattern = Pattern(r'[0-9]|[A-F]|[a-f]')
python_type = Union[int, str]
class UC... | [
"funowl.terminals.Patterns.Pattern"
] | [((246, 274), 'funowl.terminals.Patterns.Pattern', 'Pattern', (['"""[0-9]|[A-F]|[a-f]"""'], {}), "('[0-9]|[A-F]|[a-f]')\n", (253, 274), False, 'from funowl.terminals.Patterns import String, Pattern\n'), ((656, 912), 'funowl.terminals.Patterns.Pattern', 'Pattern', (['"""[A-Z]|[a-z]|[\\\\u00C0-\\\\u00D6]|[\\\\u00D8-\\\\u... |
import pcapkit
import json
from pymongofunct import insert_data
def pcaptojson(file) -> dict:
return(pcapkit.extract(fin=file, nofile=True, format='json', auto=False,
engine='deafult', extension=False, layer='Transport', tcp=True, ip=True,strict=True, store=False))
def pcapparse(obj) -> dict:
ma... | [
"pymongofunct.insert_data",
"pcapkit.extract"
] | [((106, 279), 'pcapkit.extract', 'pcapkit.extract', ([], {'fin': 'file', 'nofile': '(True)', 'format': '"""json"""', 'auto': '(False)', 'engine': '"""deafult"""', 'extension': '(False)', 'layer': '"""Transport"""', 'tcp': '(True)', 'ip': '(True)', 'strict': '(True)', 'store': '(False)'}), "(fin=file, nofile=True, forma... |
import torch
import numpy as np
from torchwi.utils.ctensor import ca2rt, rt2ca
class FreqL2Loss(torch.autograd.Function):
@staticmethod
def forward(ctx, frd, true):
# resid: (nrhs, 2*nx) 2 for real and imaginary
resid = frd - true
resid_c = rt2ca(resid)
l2 = np.real(0.5*np.sum(... | [
"numpy.conjugate",
"torchwi.utils.ctensor.rt2ca",
"torch.tensor"
] | [((275, 287), 'torchwi.utils.ctensor.rt2ca', 'rt2ca', (['resid'], {}), '(resid)\n', (280, 287), False, 'from torchwi.utils.ctensor import ca2rt, rt2ca\n'), ((404, 420), 'torch.tensor', 'torch.tensor', (['l2'], {}), '(l2)\n', (416, 420), False, 'import torch\n'), ((551, 563), 'torchwi.utils.ctensor.rt2ca', 'rt2ca', (['r... |
from asyncio import sleep, wait, get_event_loop, ensure_future
async def work(t):
await sleep(t)
print('time {}'.format(t))
return t
def on_done(t):
print(t.result())
async def main():
# 协程
coroutines = []
for i in range(2):
c = work(i)
print(type(c))
coroutines.ap... | [
"asyncio.ensure_future",
"asyncio.get_event_loop",
"asyncio.sleep",
"asyncio.wait"
] | [((569, 585), 'asyncio.get_event_loop', 'get_event_loop', ([], {}), '()\n', (583, 585), False, 'from asyncio import sleep, wait, get_event_loop, ensure_future\n'), ((93, 101), 'asyncio.sleep', 'sleep', (['t'], {}), '(t)\n', (98, 101), False, 'from asyncio import sleep, wait, get_event_loop, ensure_future\n'), ((338, 35... |
import csv
from datetime import datetime
aday,bday=[],[]
today = datetime.today().strftime('%m/%d')
with open('data.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if today in row['Birthday']:
bday.append([row['Name'], row['E-Mail'],row['Birthday']])
if today in row[... | [
"csv.DictReader",
"datetime.datetime.today"
] | [((158, 181), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {}), '(csvfile)\n', (172, 181), False, 'import csv\n'), ((66, 82), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (80, 82), False, 'from datetime import datetime\n')] |
import pytest
from pytest_lazyfixture import lazy_fixture
# Fixtures must be visible for lazy_fixture() calls.
from .fixtures import * # noqa
@pytest.fixture(
params=(
lazy_fixture('random_building_block'),
lazy_fixture('random_topology_graph'),
lazy_fixture('similar_building_block'),
... | [
"pytest_lazyfixture.lazy_fixture"
] | [((184, 221), 'pytest_lazyfixture.lazy_fixture', 'lazy_fixture', (['"""random_building_block"""'], {}), "('random_building_block')\n", (196, 221), False, 'from pytest_lazyfixture import lazy_fixture\n'), ((231, 268), 'pytest_lazyfixture.lazy_fixture', 'lazy_fixture', (['"""random_topology_graph"""'], {}), "('random_top... |
import unittest
import sys
import os
import logging
from dotenv import load_dotenv
# load env-vars from .env file if there is one
basedir = os.path.abspath(os.path.dirname(__file__))
test_env = os.path.join(basedir, '.env')
if os.path.isfile(test_env):
load_dotenv(dotenv_path=os.path.join(basedir, '.env'), verbose... | [
"unittest.TextTestRunner",
"logging.basicConfig",
"unittest.TestSuite",
"os.path.dirname",
"logging.Formatter",
"os.path.isfile",
"unittest.TestLoader",
"os.path.join",
"sys.exit"
] | [((195, 224), 'os.path.join', 'os.path.join', (['basedir', '""".env"""'], {}), "(basedir, '.env')\n", (207, 224), False, 'import os\n'), ((228, 252), 'os.path.isfile', 'os.path.isfile', (['test_env'], {}), '(test_env)\n', (242, 252), False, 'import os\n'), ((476, 516), 'logging.basicConfig', 'logging.basicConfig', ([],... |
# -*- coding: utf-8 -*-
"""Encapsulates functions which handle credentials.
"""
from blrequests.data_definitions import Credentials
import subprocess
import configparser
import os.path
CONFIG_FILE = ".blrequestsrc"
CONFIG_FILE_EXISTS = os.path.exists(CONFIG_FILE)
def fetch_credentials() -> Credentials:
"""Produ... | [
"subprocess.run",
"configparser.ConfigParser"
] | [((993, 1020), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1018, 1020), False, 'import configparser\n'), ((742, 809), 'subprocess.run', 'subprocess.run', (["['pass', parameter]"], {'capture_output': '(True)', 'text': '(True)'}), "(['pass', parameter], capture_output=True, text=True)\n",... |
# coding: utf-8
import redis
from models.singleton import Singleton
from common.config import *
class DataManager:
__metaclass__ = Singleton
redis_instance = None # redis实例
def __init__(self):
self.redis_instance = redis.StrictRedis(REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PASSWORD)
def sa... | [
"redis.StrictRedis"
] | [((241, 308), 'redis.StrictRedis', 'redis.StrictRedis', (['REDIS_HOST', 'REDIS_PORT', 'REDIS_DB', 'REDIS_PASSWORD'], {}), '(REDIS_HOST, REDIS_PORT, REDIS_DB, REDIS_PASSWORD)\n', (258, 308), False, 'import redis\n')] |
""" Preprocess the ISBI data set.
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2015, JHU/APL"
__license__ = "Apache 2.0"
import argparse, os.path
import numpy as np
from scipy.stats.mstats import mquantiles
import scipy.io
import emlib
def get_args():
"""Command line parameters for the 'deploy' proc... | [
"numpy.size",
"numpy.sum",
"argparse.ArgumentParser",
"emlib.load_cube",
"numpy.concatenate"
] | [((462, 487), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (485, 487), False, 'import argparse, os.path\n'), ((1935, 1979), 'emlib.load_cube', 'emlib.load_cube', (['args.dataFileName', 'np.uint8'], {}), '(args.dataFileName, np.uint8)\n', (1950, 1979), False, 'import emlib\n'), ((1988, 2034), ... |
import yaml
def get(filename='config/config.yaml'):
with open(filename, 'r') as stream:
data = yaml.safe_load(stream)
return data
if __name__ == '__main__':
print(get())
| [
"yaml.safe_load"
] | [((109, 131), 'yaml.safe_load', 'yaml.safe_load', (['stream'], {}), '(stream)\n', (123, 131), False, 'import yaml\n')] |
import numpy
import math
#from .. import utilities
class phase_space(object):
"""Phase space class.
"""
def __init__(self, xs, tau=1, m=2, eps=.001):
self.tau, self.m, self.eps = tau, m, eps
N = int(len(xs)-m*tau+tau)
self.matrix = numpy.empty([N,m],dtype=float)
fo... | [
"numpy.full",
"numpy.sum",
"numpy.empty",
"numpy.zeros",
"numpy.transpose",
"numpy.linalg.norm",
"math.log"
] | [((2196, 2217), 'numpy.full', 'numpy.full', (['[N, N]', '(0)'], {}), '([N, N], 0)\n', (2206, 2217), False, 'import numpy\n'), ((3346, 3373), 'numpy.zeros', 'numpy.zeros', (['N'], {'dtype': 'float'}), '(N, dtype=float)\n', (3357, 3373), False, 'import numpy\n'), ((5302, 5315), 'numpy.sum', 'numpy.sum', (['AA'], {}), '(A... |
import traceback
class CallStructureException(Exception):
pass
def must_be_called_from(method):
for frame in traceback.extract_stack():
if frame.name == method.__name__ and frame.filename == method.__globals__['__file__']:
return
raise CallStructureException("Method called incorrect... | [
"traceback.extract_stack"
] | [((121, 146), 'traceback.extract_stack', 'traceback.extract_stack', ([], {}), '()\n', (144, 146), False, 'import traceback\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('competition', '0005_alter_club_facebook_youtube_position'),
]
operations = [
migrations.AddField(
model_name='di... | [
"django.db.models.CharField",
"django.db.models.URLField"
] | [((385, 494), 'django.db.models.URLField', 'models.URLField', ([], {'help_text': '"""Here be dragons! Enter at own risk!"""', 'max_length': '(1024)', 'null': '(True)', 'blank': '(True)'}), "(help_text='Here be dragons! Enter at own risk!', max_length\n =1024, null=True, blank=True)\n", (400, 494), False, 'from djang... |
import math
import pcsg
from exampleimg import runtime
from exampleimg import conf
def _setAttributes2D (attributes):
return attributes.override ({
'camera.view': (0, 0, 0, 0, 0, 0, 8)
})
def _setAttributes (attributes):
return attributes.override ({
'camera.view': (0, 0, 0, 70, 0, 3... | [
"pcsg.shape.Square",
"exampleimg.conf.getMaterial",
"pcsg.solid.LinearExtrude"
] | [((446, 495), 'pcsg.solid.LinearExtrude', 'pcsg.solid.LinearExtrude', ([], {'height': '(1)', 'children': 'item'}), '(height=1, children=item)\n', (470, 495), False, 'import pcsg\n'), ((6891, 6918), 'pcsg.shape.Square', 'pcsg.shape.Square', ([], {'size': '(0.5)'}), '(size=0.5)\n', (6908, 6918), False, 'import pcsg\n'), ... |
import socket
HOST, PORT = '127.0.0.1', 8000
clientMessage = 'Hello!'
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client:
client.connect((HOST, PORT))
client.sendall(clientMessage.encode())
serverMessage = str(client.recv(1024), encoding='utf-8')
print('Server:', serverMessage)
| [
"socket.socket"
] | [((77, 126), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (90, 126), False, 'import socket\n')] |
'''
Horoscope Attributes of the Occult Bot
'''
# Imports
import requests, json
# Variables
# Emojis
aries_emoji = '\N{ARIES}'
taurus_emoji = '\N{TAURUS}'
gemini_emoji = '\N{GEMINI}'
cancer_emoji = '\N{CANCER}'
leo_emoji = '\N{LEO}'
virgo_emoji = '\N{VIRGO}'
libra_emoji = '\N{LIBRA}'
scorpio_emoji = '\N{SCORPIUS}'
sa... | [
"json.loads",
"requests.get"
] | [((1364, 1422), 'requests.get', 'requests.get', (['"""https://ohmanda.com/api/horoscope/aquarius"""'], {}), "('https://ohmanda.com/api/horoscope/aquarius')\n", (1376, 1422), False, 'import requests, json\n'), ((1443, 1468), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (1453, 1468), False, '... |
import sqlite3
import unittest
from collections import namedtuple
from datetime import datetime
from dwgenerator.dbobjects import Schema, Table, Column, create_typed_table, Hub, Link, Satellite, MetaDataError, MetaDataWarning
from dwgenerator.mappings import TableMappings, ColumnMappings, Mappings
from dwgenerator.tem... | [
"datetime.datetime.fromisoformat",
"sqlite3.connect",
"collections.namedtuple",
"dwgenerator.dbobjects.Column",
"dwgenerator.templates.Templates"
] | [((360, 461), 'collections.namedtuple', 'namedtuple', (['"""TableMapping"""', '"""source_schema source_table source_filter target_schema target_table"""'], {}), "('TableMapping',\n 'source_schema source_table source_filter target_schema target_table')\n", (370, 461), False, 'from collections import namedtuple\n'), (... |
#coding: utf-8
from __future__ import unicode_literals
import sys
import webtest
from webtest.debugapp import debug_app
from webob import Request
from webob.response import gzip_app_iter
from webtest.compat import PY3
from tests.compat import unittest
import webbrowser
def links_app(environ, start_response):
... | [
"tests.compat.unittest.skipIf",
"webob.response.gzip_app_iter",
"webtest.TestApp",
"webob.Request"
] | [((327, 343), 'webob.Request', 'Request', (['environ'], {}), '(environ)\n', (334, 343), False, 'from webob import Request\n'), ((9481, 9546), 'tests.compat.unittest.skipIf', 'unittest.skipIf', (["('PyPy' in sys.version)", '"""skip lxml tests on pypy"""'], {}), "('PyPy' in sys.version, 'skip lxml tests on pypy')\n", (94... |
import numpy as np
from pyqmc.energy import energy
from pyqmc.accumulators import LinearTransform
def test_transform():
""" Just prints things out;
TODO: figure out a thing to test.
"""
from pyscf import gto, scf
import pyqmc
r = 1.54 / 0.529177
mol = gto.M(
atom="H 0. 0. 0.; H 0... | [
"pyqmc.slater_jastrow",
"pyqmc.accumulators.LinearTransform",
"pyscf.gto.M",
"pyscf.scf.RHF",
"pyqmc.EnergyAccumulator",
"pyqmc.initial_guess"
] | [((284, 381), 'pyscf.gto.M', 'gto.M', ([], {'atom': "('H 0. 0. 0.; H 0. 0. %g' % r)", 'ecp': '"""bfd"""', 'basis': '"""bfd_vtz"""', 'unit': '"""bohr"""', 'verbose': '(1)'}), "(atom='H 0. 0. 0.; H 0. 0. %g' % r, ecp='bfd', basis='bfd_vtz', unit=\n 'bohr', verbose=1)\n", (289, 381), False, 'from pyscf import gto, scf\... |
"""ProbsMeasurer's module."""
import numpy as np
from mlscratch.tensor import Tensor
from .measurer import Measurer
class ProbsMeasurer(Measurer[float]):
"""Computes how many samples were evaluated correctly by
getting the most probable label/index in the probability array."""
def measure(
se... | [
"numpy.sum",
"numpy.argmax"
] | [((459, 485), 'numpy.argmax', 'np.argmax', (['result'], {'axis': '(-1)'}), '(result, axis=-1)\n', (468, 485), True, 'import numpy as np\n'), ((517, 545), 'numpy.argmax', 'np.argmax', (['expected'], {'axis': '(-1)'}), '(expected, axis=-1)\n', (526, 545), True, 'import numpy as np\n'), ((564, 614), 'numpy.sum', 'np.sum',... |
from rest_framework import permissions, renderers, viewsets
from cbe.physical_object.models import Structure, Vehicle, Device, Owner
from cbe.physical_object.serializers import StructureSerializer, VehicleSerializer, DeviceSerializer
class StructureViewSet(viewsets.ModelViewSet):
queryset = Structure.objects.all... | [
"cbe.physical_object.models.Vehicle.objects.all",
"cbe.physical_object.models.Structure.objects.all",
"cbe.physical_object.models.Device.objects.all"
] | [((299, 322), 'cbe.physical_object.models.Structure.objects.all', 'Structure.objects.all', ([], {}), '()\n', (320, 322), False, 'from cbe.physical_object.models import Structure, Vehicle, Device, Owner\n'), ((496, 517), 'cbe.physical_object.models.Vehicle.objects.all', 'Vehicle.objects.all', ([], {}), '()\n', (515, 517... |
from django.db import models
from rest_framework import serializers
from django.contrib import auth
from django.core.validators import MaxValueValidator, MinValueValidator
from datetime import datetime
class Message(models.Model):
subject = models.CharField(max_length=200)
body = models.TextField()
class Mes... | [
"django.db.models.TextField",
"django.contrib.auth.models.User.objects.get",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.core.validators.MinValueValidator",
"django.db.models.IntegerField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField",
"django.core.valid... | [((247, 279), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (263, 279), False, 'from django.db import models\n'), ((291, 309), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (307, 309), False, 'from django.db import models\n'), ((807, 851), '... |
import os
import re
import sys
from subprocess import check_output
def check_install_name(name):
"""Verify that the install_name is correct on mac"""
libname = "lib" + name + ".dylib"
path = os.path.join(sys.prefix, "lib", libname)
otool = check_output(["otool", "-L", path]).decode("utf8")
self_li... | [
"subprocess.check_output",
"os.path.join",
"re.match"
] | [((205, 245), 'os.path.join', 'os.path.join', (['sys.prefix', '"""lib"""', 'libname'], {}), "(sys.prefix, 'lib', libname)\n", (217, 245), False, 'import os\n'), ((456, 483), 're.match', 're.match', (['pat', 'install_name'], {}), '(pat, install_name)\n', (464, 483), False, 'import re\n'), ((258, 293), 'subprocess.check_... |
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.optimizers import SGD
def createModel(totalPlayers):
cp =[]
for i in range(totalPlayers):
model = Sequential()
model.add(Dense(input_dim=3,units=7))
model.add(Activation("sigmoid"))
model.... | [
"keras.models.Sequential",
"keras.layers.Dense",
"keras.optimizers.SGD",
"keras.layers.Activation"
] | [((206, 218), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (216, 218), False, 'from keras.models import Sequential\n'), ((396, 450), 'keras.optimizers.SGD', 'SGD', ([], {'lr': '(0.01)', 'decay': '(1e-06)', 'momentum': '(0.9)', 'nesterov': '(True)'}), '(lr=0.01, decay=1e-06, momentum=0.9, nesterov=True)\n'... |
import os
from db import Controller
db_path = os.path.join( __file__, "..", "RenderManager.db" )
Controller.init(db_path)
# Create Job
job = Controller.create_job(
r"J:\UCG\Episodes\Scenes\EP100\SH002.00A\UCG_EP100_SH002.00A_CMP.nk",
"WRITE_IMG",
r"J:\UCG\UCG_Nuke10.bat",
"renderN... | [
"db.Controller.Job.select",
"db.Controller.init",
"os.path.join"
] | [((47, 95), 'os.path.join', 'os.path.join', (['__file__', '""".."""', '"""RenderManager.db"""'], {}), "(__file__, '..', 'RenderManager.db')\n", (59, 95), False, 'import os\n'), ((98, 122), 'db.Controller.init', 'Controller.init', (['db_path'], {}), '(db_path)\n', (113, 122), False, 'from db import Controller\n'), ((399... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 根据传入的文件夹地址遍历下面的js文件,生成统一导出的index.js,需要注意的是重名的模块
# 获取目录下文件
import os
file_name_list = []
file_rel_path_dict = {}
def handle_dir(path):
if os.path.isdir(path):
dir_files = os.listdir(path)
for dir_file in dir_files:
handle_dir(os.path.j... | [
"os.path.abspath",
"os.path.basename",
"os.path.isdir",
"os.getcwd",
"os.path.join",
"os.listdir"
] | [((1143, 1168), 'os.path.abspath', 'os.path.abspath', (['dir_path'], {}), '(dir_path)\n', (1158, 1168), False, 'import os\n'), ((1172, 1195), 'os.path.isdir', 'os.path.isdir', (['dir_path'], {}), '(dir_path)\n', (1185, 1195), False, 'import os\n'), ((195, 214), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\... |
from django.contrib import admin
from .models import URL
admin.site.register(URL)
| [
"django.contrib.admin.site.register"
] | [((58, 82), 'django.contrib.admin.site.register', 'admin.site.register', (['URL'], {}), '(URL)\n', (77, 82), False, 'from django.contrib import admin\n')] |
from django.db import models
from django.contrib.auth.models import User
class Customer(models.Model):
user = models.OneToOneField(User,null=True,blank=True,on_delete=models.CASCADE)
name= models.CharField(max_length=200,null=True)
email = models.CharField(max_length=200)
def __str__(self):
... | [
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((115, 190), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'null': '(True)', 'blank': '(True)', 'on_delete': 'models.CASCADE'}), '(User, null=True, blank=True, on_delete=models.CASCADE)\n', (135, 190), False, 'from django.db import models\n'), ((198, 241), 'django.db.models.CharField', 'models.... |
from math import pi as PI
import torch
class Spherical(object):
r"""Saves the globally normalized three-dimensional spatial relation of
linked nodes as spherical coordinates (mapped to the fixed interval
:math:`[0, 1]`) in its edge attributes.
Args:
cat (bool, optional): Concat pseudo-coordi... | [
"torch.norm",
"torch.atan2",
"torch.acos",
"torch.stack"
] | [((1193, 1222), 'torch.norm', 'torch.norm', (['cart'], {'p': '(2)', 'dim': '(-1)'}), '(cart, p=2, dim=-1)\n', (1203, 1222), False, 'import torch\n'), ((1430, 1467), 'torch.stack', 'torch.stack', (['[rho, theta, phi]'], {'dim': '(1)'}), '([rho, theta, phi], dim=1)\n', (1441, 1467), False, 'import torch\n'), ((1269, 1308... |
import unittest
from ArmaProcess import ArmaProcess
import time
class ArmaProcessTestCase(unittest.TestCase):
def testGenSamples(self):
params = [3.75162180e-04, 1.70361201e+00, -7.30441228e-01, -6.22795336e-01, 3.05330848e-01]
fps = 100
ap = ArmaProcess(pa... | [
"ArmaProcess.ArmaProcess",
"time.sleep"
] | [((306, 359), 'ArmaProcess.ArmaProcess', 'ArmaProcess', (['params[0]', 'params[1:3]', 'params[3:5]', 'fps'], {}), '(params[0], params[1:3], params[3:5], fps)\n', (317, 359), False, 'from ArmaProcess import ArmaProcess\n'), ((480, 496), 'time.sleep', 'time.sleep', (['(0.04)'], {}), '(0.04)\n', (490, 496), False, 'import... |
# -*- coding: utf-8 -*-
from unittest import TestCase
import pandas
from pandas.testing import assert_frame_equal
from tstoolbox import tstoolbox, tsutils
class TestRead(TestCase):
def setUp(self):
dr = pandas.date_range("2000-01-01", periods=2, freq="D")
ts = pandas.Series([4.5, 4.6], index=d... | [
"pandas.DataFrame",
"pandas.testing.assert_frame_equal",
"pandas.date_range",
"tstoolbox.tstoolbox.read",
"tstoolbox.tsutils.memory_optimize",
"pandas.Series"
] | [((220, 272), 'pandas.date_range', 'pandas.date_range', (['"""2000-01-01"""'], {'periods': '(2)', 'freq': '"""D"""'}), "('2000-01-01', periods=2, freq='D')\n", (237, 272), False, 'import pandas\n'), ((287, 322), 'pandas.Series', 'pandas.Series', (['[4.5, 4.6]'], {'index': 'dr'}), '([4.5, 4.6], index=dr)\n', (300, 322),... |
"""Widgets Helper Library.
A library of `ipywidgets` wrappers for notebook based reports and voila dashboards.
The library includes both python code and html/css/js elements that can be found in the
`./widgets` folder.
"""
import os
from jinja2 import Template
def stylesheet():
"""Load a default CSS stylesheet f... | [
"os.path.abspath"
] | [((385, 410), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (400, 410), False, 'import os\n'), ((1034, 1059), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (1049, 1059), False, 'import os\n')] |
import pandas as pd
import numpy as np
class Stats(object):
'''
Produces stats given a schedule
'''
def __init__(self, games, agg_method, date_col, h_col, a_col, outcome_col, seg_vars = []):
self.games = games
self.agg_method = agg_method
self.date_col = date_col
self.h_... | [
"pandas.DataFrame",
"numpy.corrcoef",
"pandas.to_datetime",
"numpy.sum"
] | [((1583, 1605), 'numpy.sum', 'np.sum', (['h_games[h_col]'], {}), '(h_games[h_col])\n', (1589, 1605), True, 'import numpy as np\n'), ((1622, 1644), 'numpy.sum', 'np.sum', (['a_games[a_col]'], {}), '(a_games[a_col])\n', (1628, 1644), True, 'import numpy as np\n'), ((2182, 2196), 'pandas.DataFrame', 'pd.DataFrame', ([], {... |
import math
from pydub import AudioSegment, silence
from pydub.utils import mediainfo
from dearpygui.core import *
import os
import csv
import re
import shutil
from google.cloud import storage
from google.cloud import speech_v1p1beta1 as speech
import config_helper
import time
import silence_cut
def ... | [
"os.mkdir",
"re.split",
"os.makedirs",
"google.cloud.storage.Client.from_service_account_json",
"google.cloud.speech_v1p1beta1.SpeechClient.from_service_account_json",
"csv.reader",
"os.path.basename",
"math.ceil",
"os.path.exists",
"os.system",
"google.cloud.speech_v1p1beta1.RecognitionAudio",
... | [((1751, 1789), 'os.path.join', 'os.path.join', (['self.project_dir', '"""wavs"""'], {}), "(self.project_dir, 'wavs')\n", (1763, 1789), False, 'import os\n'), ((19002, 19100), 'google.cloud.storage.Client.from_service_account_json', 'storage.Client.from_service_account_json', ([], {'json_credentials_path': 'google_clou... |
# Copyright 2016 Ifwe 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 writing, so... | [
"tagopsdb.database.create_dbconn_string",
"unittest2.skip"
] | [((855, 892), 'unittest2.skip', 'unittest2.skip', (['"""not currently valid"""'], {}), "('not currently valid')\n", (869, 892), False, 'import unittest2\n'), ((1086, 1148), 'tagopsdb.database.create_dbconn_string', 'create_dbconn_string', (['self.db_user', 'self.db_password'], {}), '(self.db_user, self.db_password, **p... |
'''
Based on:
Gravity Turn Maneuver with direct multiple shooting using CVodes
(c) <NAME>
https://mintoc.de/index.php/Gravity_Turn_Maneuver_(Casadi)
https://github.com/zegkljan/kos-stuff/tree/master/non-kos-tools/gturn
----------------------------------------------------------------
'''
import sys
from pathlib ... | [
"pandas.DataFrame",
"casadi.nlpsol",
"casadi.SX.sym",
"casadi.exp",
"casadi.integrator",
"casadi.cos",
"casadi.sin",
"rocket_input.read_rocket_config",
"casadi.vertcat",
"pathlib.Path",
"numpy.array",
"casadi.MX.sym",
"numpy.linspace"
] | [((1656, 1684), 'casadi.SX.sym', 'cs.SX.sym', (['"""[m, v, q, h, d]"""'], {}), "('[m, v, q, h, d]')\n", (1665, 1684), True, 'import casadi as cs\n'), ((1710, 1724), 'casadi.SX.sym', 'cs.SX.sym', (['"""u"""'], {}), "('u')\n", (1719, 1724), True, 'import casadi as cs\n'), ((1753, 1767), 'casadi.SX.sym', 'cs.SX.sym', (['"... |
__import__("pkg_resources").declare_namespace(__name__)
from contextlib import contextmanager
from .minimal_packages import MinimalPackagesWorkaround, MinimalPackagesMixin
from .windows import WindowsWorkaround, is_windows
from .virtualenv import VirtualenvWorkaround
from .egg import Scripts
class AbsoluteExecutable... | [
"pkg_resources.Environment"
] | [((3403, 3440), 'pkg_resources.Environment', 'pkg_resources.Environment', (['[location]'], {}), '([location])\n', (3428, 3440), False, 'import pkg_resources\n')] |
# https://github.com/tensorflow/examples/blob/master/community/en/transformer_chatbot.ipynb
import tensorflow as tf
# assert tf.__version__.startswith('2')
tf.random.set_seed(1234)
import tensorflow_datasets as tfds
import os
import re
import numpy as np
import matplotlib.pyplot as plt
import pickle
from functions i... | [
"tensorflow.random.set_seed",
"tensorflow.argmax",
"tensorflow.concat",
"pickle.load",
"tensorflow.keras.optimizers.Adam",
"tensorflow.equal",
"tensorflow.squeeze",
"tensorflow.expand_dims"
] | [((157, 181), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(1234)'], {}), '(1234)\n', (175, 181), True, 'import tensorflow as tf\n'), ((425, 444), 'pickle.load', 'pickle.load', (['handle'], {}), '(handle)\n', (436, 444), False, 'import pickle\n'), ((861, 891), 'tensorflow.expand_dims', 'tf.expand_dims', (['ST... |
#!/usr/bin/env python
# coding: utf-8
# # Visualizing Naive Bayes
#
# In this lab, we will cover an essential part of data analysis that has not been included in the lecture videos. As we stated in the previous module, data visualization gives insight into the expected performance of any model.
#
# In the following... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylim",
"pandas.read_csv",
"utils.confidence_ellipse",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((1860, 1898), 'pandas.read_csv', 'pd.read_csv', (['"""data/bayes_features.csv"""'], {}), "('data/bayes_features.csv')\n", (1871, 1898), True, 'import pandas as pd\n'), ((2092, 2120), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(8, 8)'}), '(figsize=(8, 8))\n', (2104, 2120), True, 'import matplotlib... |
import sys
import csv
import json
def main(data_csv, outfile='out.json'):
with open(data_csv, 'r', encoding='utf-8-sig') as datafile:
reader = csv.DictReader(datafile)
output = {
'parks': [dict(row) for row in reader],
}
with open(outfile, 'w') as out:
json.... | [
"json.dump",
"csv.DictReader"
] | [((157, 181), 'csv.DictReader', 'csv.DictReader', (['datafile'], {}), '(datafile)\n', (171, 181), False, 'import csv\n'), ((315, 337), 'json.dump', 'json.dump', (['output', 'out'], {}), '(output, out)\n', (324, 337), False, 'import json\n')] |
# Recognise Faces using some classification algorithm - like Logistic, KNN, SVM etc.
# 1. load the training data (numpy arrays of all the persons)
# x- values are stored in the numpy arrays
# y-values we need to assign for each person
# 2. Read a video stream using opencv
# 3. extract faces out of it
# 4. use... | [
"cv2.resize",
"numpy.load",
"cv2.putText",
"numpy.argmax",
"cv2.waitKey",
"numpy.unique",
"cv2.imshow",
"numpy.ones",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.imread",
"numpy.array",
"os.path.splitext",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows",
"datetime.datetime.now",
"os.l... | [((2298, 2317), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (2314, 2317), False, 'import cv2\n'), ((2354, 2410), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_alt.xml"""'], {}), "('haarcascade_frontalface_alt.xml')\n", (2375, 2410), False, 'import cv2\n'), ((2635, 2... |
import pint
from . import resources
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 `importlib_resources`.
import importlib_resources as pkg_resources
# Load the file stream for the units file
unit_file = pkg_resources.open_text(resources, "unit_def.txt")
#... | [
"importlib_resources.open_text",
"pint.UnitRegistry"
] | [((267, 317), 'importlib_resources.open_text', 'pkg_resources.open_text', (['resources', '"""unit_def.txt"""'], {}), "(resources, 'unit_def.txt')\n", (290, 317), True, 'import importlib_resources as pkg_resources\n'), ((355, 374), 'pint.UnitRegistry', 'pint.UnitRegistry', ([], {}), '()\n', (372, 374), False, 'import pi... |
from django.test import TestCase
from corehq.apps.accounting.models import SoftwarePlanEdition
from corehq.apps.accounting.tests.utils import DomainSubscriptionMixin
from corehq.apps.accounting.utils import clear_plan_version_cache
from corehq.apps.domain.models import Domain
from corehq.messaging.smsbackends.test.mod... | [
"corehq.apps.sms.api.send_sms_to_verified_number",
"corehq.apps.sms.tests.util.setup_default_sms_test_backend",
"corehq.apps.sms.tests.util.delete_domain_phone_numbers",
"corehq.apps.sms.models.PhoneBlacklist.objects.get",
"corehq.apps.sms.messages.get_message",
"corehq.apps.sms.models.SQLMobileBackendMap... | [((990, 1013), 'corehq.apps.domain.models.Domain', 'Domain', ([], {'name': 'cls.domain'}), '(name=cls.domain)\n', (996, 1013), False, 'from corehq.apps.domain.models import Domain\n'), ((1221, 1253), 'corehq.apps.sms.tests.util.setup_default_sms_test_backend', 'setup_default_sms_test_backend', ([], {}), '()\n', (1251, ... |
import torch
from torch import Tensor
from torchir.utils import identity_grid
def bending_energy_3d(
coord_grid: Tensor, vector_dim: int = -1, dvf_input: bool = False
) -> Tensor:
"""Calculates bending energy penalty for a 3D coordinate grid.
For further details regarding this regularization please read... | [
"torch.mean",
"torchir.utils.identity_grid",
"torch.diff"
] | [((1114, 1143), 'torch.diff', 'torch.diff', (['coord_grid'], {'dim': '(1)'}), '(coord_grid, dim=1)\n', (1124, 1143), False, 'import torch\n'), ((1154, 1183), 'torch.diff', 'torch.diff', (['coord_grid'], {'dim': '(2)'}), '(coord_grid, dim=2)\n', (1164, 1183), False, 'import torch\n'), ((1194, 1223), 'torch.diff', 'torch... |
#!/usr/bin/env python3
# 600C_palindrom.py - Codeforces.com/problemset/problem/600/C by Sergey 2015
import unittest
import sys
###############################################################################
# Palindrom Class (Main Program)
##############################################################################... | [
"unittest.main",
"random.randint",
"timeit.default_timer",
"sys.setrecursionlimit",
"sys.stdin.readline"
] | [((3352, 3381), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(100000)'], {}), '(100000)\n', (3373, 3381), False, 'import sys\n'), ((2984, 3006), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (3004, 3006), False, 'import timeit\n'), ((3050, 3072), 'timeit.default_timer', 'timeit.default_timer... |
import os
"""Script used to define constants"""
PRIVATE_KEY = os.getenv(
'VESICASH_PRIVATE_KEY',
'<KEY>'
)
HEADERS = {'V-Private-Key': PRIVATE_KEY}
api_url = ''
mode = os.getenv('VESICASH_MODE')
if(mode == 'sandbox'):
API_URL = 'https://sandbox.api.vesicash.com/v1/'
else:
API_URL = 'https://api.vesic... | [
"os.getenv"
] | [((64, 106), 'os.getenv', 'os.getenv', (['"""VESICASH_PRIVATE_KEY"""', '"""<KEY>"""'], {}), "('VESICASH_PRIVATE_KEY', '<KEY>')\n", (73, 106), False, 'import os\n'), ((178, 204), 'os.getenv', 'os.getenv', (['"""VESICASH_MODE"""'], {}), "('VESICASH_MODE')\n", (187, 204), False, 'import os\n')] |
import telebot
from settings import TOKEN
from telebot import types
import random
bot = telebot.TeleBot(TOKEN)
file = open('affirmations.txt', 'r', encoding='UTF-8')
affirmations = file.read().split('\n')
file.close()
@bot.message_handler(content_types=['text'])
def get_text_messages(message):
username = messag... | [
"telebot.types.InlineKeyboardButton",
"telebot.TeleBot",
"random.choice",
"telebot.types.InlineKeyboardMarkup"
] | [((89, 111), 'telebot.TeleBot', 'telebot.TeleBot', (['TOKEN'], {}), '(TOKEN)\n', (104, 111), False, 'import telebot\n'), ((917, 945), 'telebot.types.InlineKeyboardMarkup', 'types.InlineKeyboardMarkup', ([], {}), '()\n', (943, 945), False, 'from telebot import types\n'), ((972, 1069), 'telebot.types.InlineKeyboardButton... |
# -*- coding: UTF-8 -*-
# -----------------------------------------------------------------------------
#
# P A G E B O T
#
# Copyright (c) 2016+ <NAME> + <NAME>
# www.pagebot.io
# Licensed under MIT conditions
#
# Supporting DrawBot, www.drawbot.com
# Supporting Flat, xxyxyz.org/flat
# --------... | [
"doctest.testmod"
] | [((665, 682), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (680, 682), False, 'import doctest\n')] |
from django.forms import Select
from django.utils import translation
from django.utils.translation import ugettext as _
from directory_components import forms, fields
from directory_constants import choices
class SearchForm(forms.Form):
term = fields.CharField(
max_length=255,
required=False,
... | [
"django.utils.translation.ugettext",
"django.utils.translation.get_language",
"django.forms.Select",
"directory_components.fields.CharField"
] | [((252, 300), 'directory_components.fields.CharField', 'fields.CharField', ([], {'max_length': '(255)', 'required': '(False)'}), '(max_length=255, required=False)\n', (268, 300), False, 'from directory_components import forms, fields\n'), ((595, 621), 'django.utils.translation.get_language', 'translation.get_language',... |
r"""Generation of C code dealing with the Mathieu group Mat24
Generating the ``mmgroup.mat24`` extension
..........................................
Function ``mat24_make_c_code()`` generates C code for basic computations
in the Golay code, its cocode, and the Mathieu group Mat24. It also
generates code for computati... | [
"sys.path.append",
"mmgroup.generate_c.TableGenerator",
"mmgroup.dev.mat24.mat24_ref.Mat24.str_basis",
"os.path.split",
"os.path.join"
] | [((3316, 3345), 'sys.path.append', 'sys.path.append', (['REAL_SRC_DIR'], {}), '(REAL_SRC_DIR)\n', (3331, 3345), False, 'import sys\n'), ((5515, 5550), 'os.path.join', 'os.path.join', (['DEV_DIR', '"""generators"""'], {}), "(DEV_DIR, 'generators')\n", (5527, 5550), False, 'import os\n'), ((4594, 4624), 'os.path.join', '... |
from __future__ import unicode_literals
import json
from werkzeug.exceptions import BadRequest
class RedshiftClientError(BadRequest):
def __init__(self, code, message):
super(RedshiftClientError, self).__init__()
self.description = json.dumps({
"Error": {
"Code": code,... | [
"json.dumps"
] | [((255, 387), 'json.dumps', 'json.dumps', (["{'Error': {'Code': code, 'Message': message, 'Type': 'Sender'}, 'RequestId':\n '6876f774-7273-11e4-85dc-39e55ca848d1'}"], {}), "({'Error': {'Code': code, 'Message': message, 'Type': 'Sender'},\n 'RequestId': '6876f774-7273-11e4-85dc-39e55ca848d1'})\n", (265, 387), Fals... |