code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: UTF-8 -*-
#
# Tencent is pleased to support the open source community by making QTA available.
# Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
# Licensed under the BSD 3-Clause License (the "License"); you may not use this
# file except in compliance with the License. You may... | [
"qt4a.androiddriver.adb.LocalADBBackend",
"shlex.split",
"mock.Mock",
"unittest.main",
"qt4a.androiddriver.adb.ADB"
] | [((953, 974), 'shlex.split', 'shlex.split', (['cmd_line'], {}), '(cmd_line)\n', (964, 974), False, 'import shlex\n'), ((25743, 25758), 'unittest.main', 'unittest.main', ([], {}), '()\n', (25756, 25758), False, 'import unittest\n'), ((23099, 23140), 'mock.Mock', 'mock.Mock', ([], {'side_effect': 'mock_run_shell_cmd'}), ... |
# check_url.py - checks if url matches one of the compatible sources
# compatible sources: ncode.syosetu.com
import re
def input_url_source_check(input_url):
sources_regex = {'syosetu': '((http:\/\/|https:\/\/)?(ncode.syosetu.com\/n))(\d{4}[a-z]{2}\/?)$'}
for key in sources_regex:
regex = re.compile... | [
"re.match",
"re.compile"
] | [((310, 340), 're.compile', 're.compile', (['sources_regex[key]'], {}), '(sources_regex[key])\n', (320, 340), False, 'import re\n'), ((352, 378), 're.match', 're.match', (['regex', 'input_url'], {}), '(regex, input_url)\n', (360, 378), False, 'import re\n')] |
import os
import sys
import torch
import numpy as np
from tqdm import tqdm
from skorch import NeuralNetClassifier
from skorch.callbacks import EarlyStopping, ProgressBar, Checkpoint
from skorch.helper import predefined_split
from skorch.dataset import Dataset
sys.path.append(os.path.join(sys.path[0], '..'))
from PROMI... | [
"os.path.exists",
"os.makedirs",
"PROMID.dataset.PROMIDDataset",
"skorch.helper.predefined_split",
"os.path.join",
"torch.cuda.is_available",
"skorch.callbacks.ProgressBar",
"PROMID.callbacks.AppendToDataset",
"skorch.callbacks.Checkpoint",
"torch.FloatTensor"
] | [((844, 939), 'PROMID.dataset.PROMIDDataset', 'PROMIDDataset', ([], {'file': '"""data/human_nonTATA_5000.fa"""', 'tss_loc': '(5000)', 'binary': '(False)', 'save_df': '(False)'}), "(file='data/human_nonTATA_5000.fa', tss_loc=5000, binary=False,\n save_df=False)\n", (857, 939), False, 'from PROMID.dataset import PROMI... |
"""
Testlldb Python SBFrame APIs IsInlined() and GetFunctionName().
"""
from __future__ import print_function
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class InlinedFrameAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__... | [
"lldbsuite.test.lldbutil.print_stacktraces",
"lldbsuite.test.lldbutil.get_stopped_thread"
] | [((1780, 1835), 'lldbsuite.test.lldbutil.print_stacktraces', 'lldbutil.print_stacktraces', (['process'], {'string_buffer': '(True)'}), '(process, string_buffer=True)\n', (1806, 1835), True, 'import lldbsuite.test.lldbutil as lldbutil\n'), ((2308, 2372), 'lldbsuite.test.lldbutil.get_stopped_thread', 'lldbutil.get_stoppe... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import argparse
import os
from typing import Any, Dict
import yaml
from normalization.destination_type import DestinationType
from normalization.transform_catalog.catalog_processor import CatalogProcessor
class TransformCatalog:
"""
To run this trans... | [
"normalization.destination_type.DestinationType.from_string",
"normalization.transform_catalog.catalog_processor.CatalogProcessor",
"argparse.ArgumentParser",
"yaml.dump",
"os.path.join",
"yaml.load",
"yaml.safe_load",
"os.path.basename"
] | [((811, 850), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)'}), '(add_help=False)\n', (834, 850), False, 'import argparse\n'), ((1992, 2052), 'normalization.destination_type.DestinationType.from_string', 'DestinationType.from_string', (["self.config['integration_type']"], {}), "(self.... |
#!/usr/bin/env python3
import yaml
from tuw_trinamic_controller.exception.invalid_file_exception import InvalidFileException
from tuw_trinamic_controller.exception.invalid_path_exception import InvalidPathException
class ConfigFileReader:
"""
config file reader
"""
@staticmethod
def open_config... | [
"tuw_trinamic_controller.exception.invalid_path_exception.InvalidPathException",
"yaml.load",
"tuw_trinamic_controller.exception.invalid_file_exception.InvalidFileException"
] | [((867, 920), 'yaml.load', 'yaml.load', ([], {'stream': 'config_file', 'Loader': 'yaml.FullLoader'}), '(stream=config_file, Loader=yaml.FullLoader)\n', (876, 920), False, 'import yaml\n'), ((584, 606), 'tuw_trinamic_controller.exception.invalid_path_exception.InvalidPathException', 'InvalidPathException', ([], {}), '()... |
import numpy as np
import plotext as plt
from typing import List
from rich.jupyter import JupyterMixin
from rich.ansi import AnsiDecoder
from rich.console import Group as RenderGroup
from rich.layout import Layout
from rich.panel import Panel
def plot_race(gender: str, length: int, names: List[str], lap_times: np.ar... | [
"plotext.subplot",
"plotext.plotsize",
"rich.panel.Panel",
"plotext.plot",
"plotext.build",
"plotext.ylim",
"plotext.subplots",
"plotext.title",
"rich.ansi.AnsiDecoder",
"numpy.cumsum",
"plotext.xlim"
] | [((1131, 1149), 'plotext.subplots', 'plt.subplots', (['(2)', '(1)'], {}), '(2, 1)\n', (1143, 1149), True, 'import plotext as plt\n'), ((1168, 1196), 'numpy.cumsum', 'np.cumsum', (['lap_times'], {'axis': '(1)'}), '(lap_times, axis=1)\n', (1177, 1196), True, 'import numpy as np\n'), ((1261, 1278), 'plotext.subplot', 'plt... |
# Authors: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
from mne_connectivity.io import read_connectivity
import numpy as np
import pytest
from numpy.testing import (assert_allclose, assert_array_equal,
asser... | [
"numpy.ravel_multi_index",
"numpy.array",
"numpy.random.RandomState",
"numpy.testing.assert_array_less",
"numpy.mean",
"numpy.testing.assert_allclose",
"numpy.triu",
"numpy.abs",
"numpy.eye",
"numpy.triu_indices",
"mne_connectivity.envelope.envelope_correlation",
"numpy.corrcoef",
"mne_conne... | [((6280, 6359), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""ndim, generator"""', '[(2, False), (3, False), (3, True)]'], {}), "('ndim, generator', [(2, False), (3, False), (3, True)])\n", (6303, 6359), False, 'import pytest\n'), ((716, 746), 'numpy.zeros', 'np.zeros', (['(n_labels, n_labels)'], {}), '((... |
# -*- coding: utf-8 -*-
"""Main module."""
import os
import pandas as pd
from os import listdir, makedirs
from os.path import isfile, join, exists
from . import polib, Translator, json
from . import SUPPORTED_LANGUAGES, __version__
from collections import defaultdict
from copy import deepcopy
from datetime import date... | [
"os.path.exists",
"os.listdir",
"os.getenv",
"pandas.read_csv",
"os.makedirs",
"os.path.join",
"os.path.isfile",
"collections.defaultdict",
"os.mkdir",
"copy.deepcopy",
"pandas.DataFrame",
"os.path.expanduser"
] | [((2373, 2404), 'os.getenv', 'os.getenv', (['"""POTRANSLATOR_SHORT"""'], {}), "('POTRANSLATOR_SHORT')\n", (2382, 2404), False, 'import os\n'), ((2693, 2730), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.potranslator"""'], {}), "('~/.potranslator')\n", (2711, 2730), False, 'import os\n'), ((2895, 2909), 'pandas.... |
import gym
from gym import error, spaces, utils
from gym.utils import seeding
import numpy as np
import random
class TenArmedBanditGaussianRewardEnv(gym.Env):
metadata = {'render.modes': ['human']}
def __init__(self, seed=42):
self._seed(seed)
self.num_bandits = 10
# each reward distri... | [
"numpy.random.normal",
"random.uniform",
"gym.spaces.Discrete",
"gym.utils.seeding.np_random"
] | [((503, 536), 'gym.spaces.Discrete', 'spaces.Discrete', (['self.num_bandits'], {}), '(self.num_bandits)\n', (518, 536), False, 'from gym import error, spaces, utils\n'), ((570, 588), 'gym.spaces.Discrete', 'spaces.Discrete', (['(1)'], {}), '(1)\n', (585, 588), False, 'from gym import error, spaces, utils\n'), ((653, 67... |
from typing import TypedDict
from pytest import fixture
from apollo.elections import models as el_models
from apollo.elections.models import Answer
from apollo.users.models import User
@fixture
def decrypt_mock(mocker, answer: Answer):
mock = mocker.patch("apollo.elections.crypto.decrypt")
mock.return_value ... | [
"typing.TypedDict"
] | [((365, 435), 'typing.TypedDict', 'TypedDict', (['"""VotePostData"""', "{'answer_ciphertext': str, 'question': int}"], {}), "('VotePostData', {'answer_ciphertext': str, 'question': int})\n", (374, 435), False, 'from typing import TypedDict\n')] |
from src.resize_for_train import getTrainImg
DATA_SET = "datasets/lfw_trans"
OUT_DIR = "datasets/lfw_resize_for_train_128"
MARGIN_FILE = "datasets/lfw_resize_margin_128.txt"
IMAGE_SIZE = 128
getTrainImg(DATA_SET, IMAGE_SIZE, OUT_DIR, MARGIN_FILE) | [
"src.resize_for_train.getTrainImg"
] | [((194, 249), 'src.resize_for_train.getTrainImg', 'getTrainImg', (['DATA_SET', 'IMAGE_SIZE', 'OUT_DIR', 'MARGIN_FILE'], {}), '(DATA_SET, IMAGE_SIZE, OUT_DIR, MARGIN_FILE)\n', (205, 249), False, 'from src.resize_for_train import getTrainImg\n')] |
import h5py as hdf
from functions import *
from sklearn.cluster import DBSCAN
from astLib import vec_astCalc
from astLib import astCoords
from numpy.lib import recfunctions as rfns
from calc_cluster_props import *
import pylab as pyl
# load RA/DEC/z data
f = hdf.File('../data/truth/Aardvark_v1.0c_truth_des_rotated.86... | [
"pylab.where",
"numpy.lib.recfunctions.stack_arrays",
"pylab.column_stack",
"pylab.mean",
"astLib.vec_astCalc.dm",
"sklearn.cluster.DBSCAN",
"pylab.intersect1d",
"pylab.array",
"h5py.File",
"pylab.zeros_like",
"pylab.append",
"pylab.in1d"
] | [((261, 332), 'h5py.File', 'hdf.File', (['"""../data/truth/Aardvark_v1.0c_truth_des_rotated.86.hdf5"""', '"""r"""'], {}), "('../data/truth/Aardvark_v1.0c_truth_des_rotated.86.hdf5', 'r')\n", (269, 332), True, 'import h5py as hdf\n'), ((405, 473), 'h5py.File', 'hdf.File', (['"""../data/halos/Aardvark_v1.0_halos_r1_rotat... |
"""
Call MWEP
python call_mwep.py --path_config_json=<path_config_json> --verbose=<verbose>
Usage:
call_mwep.py --path_config_json=<path_config_json>\
--verbose=<verbose>
Options:
--path_config_json=<path_config_json> e.g., ../config/v0.json
--verbose=<verbose> 0 nothing, 1 descriptive stats, 2 debuggin... | [
"os.path.exists",
"os.path.join",
"shutil.copy",
"docopt.docopt",
"os.remove"
] | [((535, 550), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (541, 550), False, 'from docopt import docopt\n'), ((778, 835), 'os.path.join', 'os.path.join', (['mwep_folder', '"""config"""', '"""mwep_settings.json"""'], {}), "(mwep_folder, 'config', 'mwep_settings.json')\n", (790, 835), False, 'import os\n... |
"""
Contains utility functions for dates and times
"""
import datetime
import logging
import time
from bluebird.settings import Settings
_LOGGER = logging.getLogger(__name__)
DEFAULT_LIFETIME = datetime.timedelta(seconds=10)
def before(date_time):
"""
Check if the given time has passed (i.e. before now())... | [
"logging.getLogger",
"datetime.datetime.utcnow",
"time.sleep",
"datetime.timedelta",
"time.time"
] | [((150, 177), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (167, 177), False, 'import logging\n'), ((198, 228), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': '(10)'}), '(seconds=10)\n', (216, 228), False, 'import datetime\n'), ((555, 581), 'datetime.datetime.utcnow', 'dat... |
import requests
from notion.clients import NotionAPI
from notion.adapters import adapter
# this secret key only for mock testing
# should not be concern about that
secret = "secret_vRRyjBas5iKPicOw2tO0d1baCUObmRLo7Oe7B1aRZA2"
version = "2021-05-13"
def test_adapter():
headers = {
"Authorization": f"Bear... | [
"notion.adapters.adapter",
"notion.clients.NotionAPI"
] | [((388, 443), 'notion.adapters.adapter', 'adapter', (['"""https://api.notion.com/v1/databases"""', 'headers'], {}), "('https://api.notion.com/v1/databases', headers)\n", (395, 443), False, 'from notion.adapters import adapter\n'), ((520, 546), 'notion.clients.NotionAPI', 'NotionAPI', (['secret', 'version'], {}), '(secr... |
import re
from typing import Set
from lxml import etree
class ArticleXml:
def __init__(self, data_xml: str):
self.raw_data = data_xml
self.tree = etree.fromstring(data_xml) # catch exception
def title(self) -> str:
title = self.tree.find('.//front/article-meta/title-group/article-ti... | [
"lxml.etree.canonicalize",
"lxml.etree.fromstring",
"re.sub",
"re.findall",
"re.search"
] | [((169, 195), 'lxml.etree.fromstring', 'etree.fromstring', (['data_xml'], {}), '(data_xml)\n', (185, 195), False, 'from lxml import etree\n'), ((795, 831), 're.sub', 're.sub', (['"""<[^<]+>"""', '""""""', 'self.raw_data'], {}), "('<[^<]+>', '', self.raw_data)\n", (801, 831), False, 'import re\n'), ((1059, 1113), 're.fi... |
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer
from toontown.battle import DistributedBattleBldg
class DistributedCogdoBattleBldg(DistributedBattleBldg.DistributedBattleBldg):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogdoBattleBldg')
def _... | [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"toontown.battle.DistributedBattleBldg.DistributedBattleBldg.__init__"
] | [((236, 309), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""DistributedCogdoBattleBldg"""'], {}), "('DistributedCogdoBattleBldg')\n", (279, 309), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((347, 409), 'toontown.battle.Distri... |
import pytest
from asgiref.sync import sync_to_async
from channels.testing import WebsocketCommunicator
from realtime_api.testing import AuthWebsocketCommunicator, create_user
from realtime_api.utils import get_group_user_key, close_user_channels
from .consumers import GroupTestConsumer
def test_group_does_not_exis... | [
"asgiref.sync.sync_to_async",
"realtime_api.utils.get_group_user_key",
"realtime_api.testing.AuthWebsocketCommunicator",
"channels.testing.WebsocketCommunicator",
"realtime_api.utils.close_user_channels",
"realtime_api.testing.create_user"
] | [((1069, 1114), 'channels.testing.WebsocketCommunicator', 'WebsocketCommunicator', (['GroupTestConsumer', '"""/"""'], {}), "(GroupTestConsumer, '/')\n", (1090, 1114), False, 'from channels.testing import WebsocketCommunicator\n'), ((2141, 2186), 'channels.testing.WebsocketCommunicator', 'WebsocketCommunicator', (['Grou... |
import numpy as np
import time
class PacketModel(object):
"""Convert data to packets"""
def __init__(self, data, rowsPerPacket):
"""
# Arguments
data: 4-D tensor to be packetized
rowsPerPacket: number of rows of the feature map to be considered as one packet
... | [
"numpy.zeros",
"numpy.reshape",
"numpy.concatenate"
] | [((1036, 1123), 'numpy.zeros', 'np.zeros', (['(self.dataShape[0], self.numZeros, self.dataShape[2], self.dataShape[3])'], {}), '((self.dataShape[0], self.numZeros, self.dataShape[2], self.\n dataShape[3]))\n', (1044, 1123), True, 'import numpy as np\n'), ((1143, 1180), 'numpy.concatenate', 'np.concatenate', (['(data... |
from flask import Blueprint
notification_blueprint = Blueprint('notifications', __name__)
from application.notifications import routes | [
"flask.Blueprint"
] | [((55, 91), 'flask.Blueprint', 'Blueprint', (['"""notifications"""', '__name__'], {}), "('notifications', __name__)\n", (64, 91), False, 'from flask import Blueprint\n')] |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
# 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/LICEN... | [
"networking_vsphere.common.model.NetworkConfig",
"networking_vsphere.common.model.VirtualNic",
"networking_vsphere.common.model.VirtualMachine",
"networking_vsphere.common.model.VirtualSwitch",
"networking_vsphere.common.model.Network",
"networking_vsphere.common.model.Vlan",
"networking_vsphere.common.... | [((959, 1005), 'networking_vsphere.common.model.ResourceEntity', 'model.ResourceEntity', ([], {'key': '"""key1"""', 'uuid': '"""uuid1"""'}), "(key='key1', uuid='uuid1')\n", (979, 1005), False, 'from networking_vsphere.common import model\n'), ((1291, 1312), 'networking_vsphere.common.model.Host', 'model.Host', (['name'... |
from datetime import date, timedelta, datetime, time
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.db import models
from django.db import connections
from django.utils import timezone
from .models import Period, StatisticByDate, StatisticByDateAndObject
clas... | [
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"datetime.time",
"django.db.models.Count",
"django.utils.timezone.get_current_timezone",
"datetime.timedelta",
"django.utils.timezone.is_aware",
"django.utils.timezone.make_naive",
"datetime.date.today",
"django.utils.timezone.g... | [((6505, 6538), 'django.db.models.Count', 'models.Count', (['"""pk"""'], {'distinct': '(True)'}), "('pk', distinct=True)\n", (6517, 6538), False, 'from django.db import models\n'), ((6628, 6661), 'django.db.models.Count', 'models.Count', (['"""pk"""'], {'distinct': '(True)'}), "('pk', distinct=True)\n", (6640, 6661), F... |
#!/usr/bin/env/python
"""
gen_dates.py -- generate dates for inclusion in VIVO
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2016 (c) <NAME>"
__license__ = "New BSD License"
__version__ = "0.01"
from datetime import datetime
from dateutil.relativedelta import relativedelta
out_file = open('dates.txt', "w... | [
"datetime.datetime",
"dateutil.relativedelta.relativedelta"
] | [((608, 634), 'datetime.datetime', 'datetime', (['start_year', '(1)', '(1)'], {}), '(start_year, 1, 1)\n', (616, 634), False, 'from datetime import datetime\n'), ((646, 672), 'datetime.datetime', 'datetime', (['end_year', '(12)', '(31)'], {}), '(end_year, 12, 31)\n', (654, 672), False, 'from datetime import datetime\n'... |
import discord
from discord.ext import commands,tasks
import time
import json
with open('./setting.json', mode='r',encoding='utf8') as jfile:
jdata = json.load(jfile)
intents = discord.Intents.all()
bot=commands.Bot(command_prefix=".",intents=intents)
@bot.event
async def on_ready():
print('We have logged in... | [
"discord.Game",
"discord.ext.commands.Bot",
"discord.Intents.all",
"time.sleep",
"json.load",
"discord.Embed"
] | [((183, 204), 'discord.Intents.all', 'discord.Intents.all', ([], {}), '()\n', (202, 204), False, 'import discord\n'), ((209, 258), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""."""', 'intents': 'intents'}), "(command_prefix='.', intents=intents)\n", (221, 258), False, 'from discord.ext import... |
#set matplotlib backend so figures can be saved in the background
import matplotlib
matplotlib.use("Agg")
#import the necessary packages
from sklearn.preprocessing import LabelBinarizer
from sklearn.metrics import classification_report
from utilities.nn.conv.minivggnet import MiniVGGNet
from keras.callbacks import Lea... | [
"sklearn.preprocessing.LabelBinarizer",
"keras.callbacks.LearningRateScheduler",
"matplotlib.pyplot.savefig",
"keras.datasets.cifar10.load_data",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"numpy.floor",
"matplotlib.pyplot.style.use",
"m... | [((84, 105), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (98, 105), False, 'import matplotlib\n'), ((1208, 1227), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (1225, 1227), False, 'from keras.datasets import cifar10\n'), ((1350, 1366), 'sklearn.preprocessing.Label... |
import sqlite3
import json
from unittest import result
from colorama import Cursor
#from django.db import connection
#define connection and cursor
connection = sqlite3.connect('songs.db')
Cursor = connection.cursor()
#creating song table for spotify songs
command2 = """CREATE TABLE IF NOT EXISTS
youtube(name TEX... | [
"colorama.Cursor.execute",
"colorama.Cursor.fetchall",
"sqlite3.connect"
] | [((164, 191), 'sqlite3.connect', 'sqlite3.connect', (['"""songs.db"""'], {}), "('songs.db')\n", (179, 191), False, 'import sqlite3\n'), ((327, 351), 'colorama.Cursor.execute', 'Cursor.execute', (['command2'], {}), '(command2)\n', (341, 351), False, 'from colorama import Cursor\n'), ((462, 501), 'colorama.Cursor.execute... |
import os
import pytest
from ruamel.yaml import YAML
_TEST_DIR = os.path.dirname(__file__)
# Fixtures in pytest work with reused outer names, so shut up pylint here.
# pylint:disable=redefined-outer-name
@pytest.fixture
def test_file_path():
def loader(*path):
return os.path.join(_TEST_DIR, "data", *pa... | [
"os.path.dirname",
"os.path.join",
"ruamel.yaml.YAML"
] | [((67, 92), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (82, 92), False, 'import os\n'), ((285, 323), 'os.path.join', 'os.path.join', (['_TEST_DIR', '"""data"""', '*path'], {}), "(_TEST_DIR, 'data', *path)\n", (297, 323), False, 'import os\n'), ((608, 638), 'os.path.join', 'os.path.join', ... |
"""
SBR+ Doppler Setup
------------------
This example shows how you can use PyAEDT to create a Multipart Scenario in SBR+ and setup a doppler Analysis.
"""
###############################################################################
# Launch AEDT in Graphical Mode
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This examples la... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"pyaedt.examples.download_multiparts",
"tempfile.gettempdir",
"pyaedt.Hfss",
"pyaedt.generate_unique_name"
] | [((577, 607), 'pyaedt.examples.download_multiparts', 'examples.download_multiparts', ([], {}), '()\n', (605, 607), False, 'from pyaedt import examples, generate_unique_name\n'), ((784, 805), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (803, 805), False, 'import tempfile\n'), ((980, 1120), 'pyaedt.Hf... |
import base64
import binascii
import hashlib
import hmac
import os
from urllib.parse import parse_qs, urlparse
from Crypto.Hash import SHA
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
from django.conf import settings
class Transaction:
"""A Paybox System transaction, from your server ... | [
"urllib.parse.urlparse",
"base64.b64decode",
"urllib.parse.parse_qs",
"os.path.dirname",
"Crypto.Signature.PKCS1_v1_5.new",
"binascii.unhexlify"
] | [((4556, 4587), 'binascii.unhexlify', 'binascii.unhexlify', (['self.SECRET'], {}), '(self.SECRET)\n', (4574, 4587), False, 'import binascii\n'), ((7487, 7509), 'urllib.parse.urlparse', 'urlparse', (['response_url'], {}), '(response_url)\n', (7495, 7509), False, 'from urllib.parse import parse_qs, urlparse\n'), ((7581, ... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ai_pics', '0002_aiattachment_file_no'),
]
operations = [
migrations.AddField(
model_name='aipics',
name='is_valid',
field=models.NullBooleanField(),
... | [
"django.db.models.NullBooleanField"
] | [((289, 314), 'django.db.models.NullBooleanField', 'models.NullBooleanField', ([], {}), '()\n', (312, 314), False, 'from django.db import migrations, models\n')] |
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import fenics as fe
import time
from Core.HSolver import *
from Core.InvFun import *
from Core.AddNoise import *
plt.close()
# load the measuring data
# [sol_all, theta_all, kappa_all, qStrT]
dAR = np.load('/home/jjx323/Proj... | [
"fenics.Constant",
"fenics.interpolate",
"fenics.Point",
"matplotlib.pyplot.savefig",
"fenics.inner",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.colorbar",
"fenics.FunctionSpace",
"numpy.max",
"matplotlib.pyplot.close",
"fenics.grad",
"matplotlib.pyplot.figure",
"fenics.Expression",
"fen... | [((209, 220), 'matplotlib.pyplot.close', 'plt.close', ([], {}), '()\n', (218, 220), True, 'import matplotlib.pyplot as plt\n'), ((294, 346), 'numpy.load', 'np.load', (['"""/home/jjx323/Projects/ISP/Data/dataRc.npy"""'], {}), "('/home/jjx323/Projects/ISP/Data/dataRc.npy')\n", (301, 346), True, 'import numpy as np\n'), (... |
from torchpf import show_stat
from torchpf import cal_Flops, cal_MAdd, cal_Memory, cal_params
import torch
import torch.nn as nn
import torch.nn.functional as F
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 10, kernel_size=5)
self.conv2 = ... | [
"torchpf.cal_Flops",
"torch.nn.Dropout2d",
"torch.nn.functional.dropout",
"torchpf.show_stat",
"torch.nn.Conv2d",
"torchpf.cal_params",
"torch.nn.Linear",
"torch.nn.functional.log_softmax",
"torchpf.cal_MAdd",
"torchpf.cal_Memory"
] | [((872, 900), 'torchpf.show_stat', 'show_stat', (['model', 'input_size'], {}), '(model, input_size)\n', (881, 900), False, 'from torchpf import show_stat\n'), ((267, 298), 'torch.nn.Conv2d', 'nn.Conv2d', (['(3)', '(10)'], {'kernel_size': '(5)'}), '(3, 10, kernel_size=5)\n', (276, 298), True, 'import torch.nn as nn\n'),... |
from sagemaker.estimator import Estimator
import sagemaker
import argparse
import os
import json
import boto3
from sagemaker.tuner import ParameterRange, CategoricalParameter, ContinuousParameter, HyperparameterTuner
base_dir = "/opt/ml/processing"
base_dir_evaluation = f"{base_dir}/evaluation"
base_dir_jobinfo = f"{... | [
"sagemaker.estimator.Estimator",
"boto3.client",
"sagemaker.get_execution_role",
"sagemaker.tuner.HyperparameterTuner",
"os.makedirs",
"argparse.ArgumentParser",
"sagemaker.tuner.CategoricalParameter",
"json.dumps",
"sagemaker.session.Session",
"sagemaker.tuner.ContinuousParameter"
] | [((2312, 2339), 'sagemaker.session.Session', 'sagemaker.session.Session', ([], {}), '()\n', (2337, 2339), False, 'import sagemaker\n'), ((2351, 2381), 'sagemaker.get_execution_role', 'sagemaker.get_execution_role', ([], {}), '()\n', (2379, 2381), False, 'import sagemaker\n'), ((2398, 2423), 'boto3.client', 'boto3.clien... |
from torch.optim.lr_scheduler import StepLR
def lr_scheduler(optimizer, step_size, gamma):
"""Create LR scheduler.
Args:
optimizer: Model optimizer.
step_size: Frequency for changing learning rate.
gamma: Factor for changing learning rate.
Returns:
StepLR: Learning ra... | [
"torch.optim.lr_scheduler.StepLR"
] | [((354, 405), 'torch.optim.lr_scheduler.StepLR', 'StepLR', (['optimizer'], {'step_size': 'step_size', 'gamma': 'gamma'}), '(optimizer, step_size=step_size, gamma=gamma)\n', (360, 405), False, 'from torch.optim.lr_scheduler import StepLR\n')] |
"""The :mod:`search` module defines algorithms to search for Push programs."""
from abc import ABC, abstractmethod
from typing import Union, Tuple, Optional
import numpy as np
import math
from functools import partial
from multiprocessing import Pool, Manager
from pyshgp.push.program import ProgramSignature
from pysh... | [
"pyshgp.gp.genome.GenomeSimplifier",
"pyshgp.gp.variation.get_variation_operator",
"numpy.random.random",
"pyshgp.utils.instantiate_using",
"pyshgp.gp.population.Population",
"functools.partial",
"multiprocessing.Pool",
"multiprocessing.Manager",
"pyshgp.utils.DiscreteProbDistrib",
"numpy.isinf",
... | [((13319, 13350), 'pyshgp.utils.instantiate_using', 'instantiate_using', (['_cls', 'kwargs'], {}), '(_cls, kwargs)\n', (13336, 13350), False, 'from pyshgp.utils import instantiate_using\n'), ((1005, 1014), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (1012, 1014), False, 'from multiprocessing import Pool, Ma... |
# Generated by Django 2.0.5 on 2018-09-18 21:36
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('footballseason', '0004_g... | [
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((475, 554), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add':... |
import sys
import decida.Data
import scipy.interpolate
import pickle
def check(predict, meas, abs_tol=0.1):
if not (abs(predict-meas) <= abs_tol):
print(f'Expected {predict} but got {meas}')
# read out arguments
word_size = int(sys.argv[4])
# read simulation result
data = decida.Data.Data()
data.read_nut... | [
"pickle.load"
] | [((532, 546), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (543, 546), False, 'import pickle\n')] |
"""High level add faults function."""
import logging
log = logging.getLogger(__name__)
import os
import numpy as np
import resqpy.crs as rqc
import resqpy.grid as grr
import resqpy.lines as rql
import resqpy.model as rq
import resqpy.olio.grid_functions as gf
import resqpy.olio.simple_lines as sl
import resqpy.olio... | [
"logging.getLogger",
"resqpy.model.Model",
"resqpy.olio.simple_lines.nearest_pillars",
"resqpy.olio.vector_utilities.unit_vector",
"numpy.array",
"resqpy.olio.xml_et.citation_title_for_node",
"resqpy.derived_model._common._write_grid",
"resqpy.derived_model._common._prepare_simple_inheritance",
"os.... | [((61, 88), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (78, 88), False, 'import logging\n'), ((5177, 5232), 'resqpy.derived_model._common._establish_model_and_source_grid', '_establish_model_and_source_grid', (['epc_file', 'source_grid'], {}), '(epc_file, source_grid)\n', (5209, 5232)... |
import time
from heapq import heappush, heappop
class Entry:
def __init__(self, key, value, obj=None) -> None:
super().__init__()
self.key = key
self.value = value
self.obj = obj
self.disabled = False
class PriorityQueueSet:
def __init__(self,
tie_b... | [
"heapq.heappop",
"heapq.heappush",
"time.time"
] | [((4926, 4937), 'time.time', 'time.time', ([], {}), '()\n', (4935, 4937), False, 'import time\n'), ((1617, 1628), 'time.time', 'time.time', ([], {}), '()\n', (1626, 1628), False, 'import time\n'), ((3636, 3652), 'heapq.heappop', 'heappop', (['self.pq'], {}), '(self.pq)\n', (3643, 3652), False, 'from heapq import heappu... |
# Title: 진법 변환 2
# Link: https://www.acmicpc.net/problem/11005
import sys
import string
sys.setrecursionlimit(10 ** 6)
read_list_int = lambda: list(map(int, sys.stdin.readline().strip().split(' ')))
nums = [str(i) for i in range(10)] + list(string.ascii_uppercase)
def solution(n: int, b: int):
ans = []
d ... | [
"sys.stdin.readline",
"sys.setrecursionlimit"
] | [((90, 120), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (111, 120), False, 'import sys\n'), ((160, 180), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (178, 180), False, 'import sys\n')] |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may ... | [
"numpy.array",
"ocw.dataset.Dataset",
"ocw.dataset_processor.spatial_regrid",
"unittest.main",
"datetime.timedelta",
"os.remove",
"datetime.datetime",
"ocw.data_source.local.load_file",
"numpy.meshgrid",
"ocw.dataset_processor.safe_subset",
"numpy.testing.assert_array_equal",
"ocw.dataset_proc... | [((1003, 1046), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.CRITICAL'}), '(level=logging.CRITICAL)\n', (1022, 1046), False, 'import logging\n'), ((15929, 16043), 'ocw.dataset.Dataset', 'ds.Dataset', (['lats', 'lons', 'times', 'values'], {'variable': '"""test variable name"""', 'units': '"""tes... |
import json
from unittest.mock import Mock, patch
import pytest
from error.stampifier_error import BadRequestError
from summarization.web_entity_detection import ImageDescriptionRetriever
def mocked_requests_post(*args, **kwargs):
json_data = json.loads(kwargs["data"])
label = ""
entity = ""
has_cap... | [
"summarization.web_entity_detection.ImageDescriptionRetriever",
"json.loads",
"unittest.mock.Mock",
"json.dumps",
"pytest.raises",
"unittest.mock.patch"
] | [((3363, 3459), 'unittest.mock.patch', 'patch', (['"""summarization.web_entity_detection.requests.post"""'], {'side_effect': 'mocked_requests_post'}), "('summarization.web_entity_detection.requests.post', side_effect=\n mocked_requests_post)\n", (3368, 3459), False, 'from unittest.mock import Mock, patch\n'), ((5130... |
# Generated by Django 3.1.5 on 2021-01-23 06:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('website', '0057_auto_20210122_2049'),
]
operations = [
migrations.AddField(
model_name='exam',
name='m... | [
"django.db.models.DurationField"
] | [((355, 398), 'django.db.models.DurationField', 'models.DurationField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (375, 398), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
###############################################################################
#
# GetTimestamp
# Returns the current date and time, expressed as seconds or milliseconds since January 1, 1970 (epoch time).
#
# Python versions 2.6, 2.7, 3.x
#
# Copyright 2014, Temboo Inc.
#
# Licensed under the... | [
"json.loads"
] | [((6204, 6219), 'json.loads', 'json.loads', (['str'], {}), '(str)\n', (6214, 6219), False, 'import json\n')] |
from bs4 import BeautifulSoup
import sys
import time
from random import randint
import re
import requests
import pandas as pd
from psycopg2.extras import execute_batch
import traceback
import queue
from datetime import datetime
from BaseScraper import BaseScraper
class LetterboxScraper(BaseScraper):
def scrape(... | [
"datetime.datetime.strptime",
"psycopg2.extras.execute_batch",
"time.perf_counter",
"requests.get",
"time.sleep",
"bs4.BeautifulSoup",
"sys.exc_info",
"traceback.print_tb",
"pandas.DataFrame",
"re.sub",
"datetime.datetime.split",
"random.randint",
"pandas.to_datetime",
"re.search"
] | [((762, 781), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (779, 781), False, 'import time\n'), ((8506, 8525), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (8523, 8525), False, 'import time\n'), ((18282, 18442), 'pandas.DataFrame', 'pd.DataFrame', (["{'movie_id': movie_id, 'review_text': r... |
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description: use bert corrector chinese char error
"""
import sys
sys.path.append('../..')
import torch
import operator
from pycorrector.bert import config
from pycorrector.bert.bert_masked_lm import MASK_ID, InputFeatures
from pycorrector.detector import Detector,... | [
"pycorrector.bert.bert_masked_lm.InputFeatures",
"pycorrector.utils.text_utils.is_chinese_string",
"pytorch_pretrained_bert.BertForMaskedLM.from_pretrained",
"pytorch_pretrained_bert.tokenization.BertTokenizer",
"torch.tensor",
"time.time",
"operator.itemgetter",
"sys.path.append",
"torch.argmax"
] | [((120, 144), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (135, 144), False, 'import sys\n'), ((1135, 1146), 'time.time', 'time.time', ([], {}), '()\n', (1144, 1146), False, 'import time\n'), ((1296, 1332), 'pytorch_pretrained_bert.tokenization.BertTokenizer', 'BertTokenizer', (['self.be... |
#!/usr/bin/env python3
"""
Generate syscall tables from the Linux source. Used to generate
manticore/platforms/linux_syscalls.py.
This fetches the tables from kernel.org.
Usage:
./extract_syscalls.py [--linux_version linux_version] linux_syscalls.py
"""
import argparse
import os
import re
import subprocess
im... | [
"re.search",
"argparse.ArgumentParser",
"subprocess.Popen",
"sys.stderr.write",
"sys.exit",
"os.fdopen",
"tempfile.mkstemp",
"urllib.request.urlopen",
"os.remove"
] | [((1436, 1448), 'urllib.request.urlopen', 'urlopen', (['url'], {}), '(url)\n', (1443, 1448), False, 'from urllib.request import urlopen\n'), ((1886, 1948), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate syscall tables"""'}), "(description='Generate syscall tables')\n", (1909, 19... |
import os
serenityff_C6 = os.path.dirname(__file__) + "/C6/"
serenityff_C12 = os.path.dirname(__file__) + "/C12/"
| [
"os.path.dirname"
] | [((26, 51), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (41, 51), False, 'import os\n'), ((78, 103), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (93, 103), False, 'import os\n')] |
import uuid
from django.core.exceptions import ValidationError
from django.test import TestCase
from app.models import Uuid
class UuidTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.uuid_value = uuid.uuid4()
Uuid.objects.create(uuid=cls.uuid_value)
def test_uuid(self):
... | [
"app.models.Uuid.objects.get",
"app.models.Uuid.objects.create",
"uuid.uuid4"
] | [((225, 237), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (235, 237), False, 'import uuid\n'), ((246, 286), 'app.models.Uuid.objects.create', 'Uuid.objects.create', ([], {'uuid': 'cls.uuid_value'}), '(uuid=cls.uuid_value)\n', (265, 286), False, 'from app.models import Uuid\n'), ((333, 371), 'app.models.Uuid.objects.g... |
__author__ = '<NAME> <<EMAIL>>'
__date__ = ' 16 December 2017'
__copyright__ = 'Copyright (c) 2017 <NAME>'
import dg
import pandas as pd
from copy import deepcopy
from dg.utils import bar
from dg import persistence
from dg.config import Config
from dg.enums import Mode, Dataset
def train_model(model, train_set, eva... | [
"dg.enums.Dataset.for_eval",
"dg.utils.bar",
"dg.persistence.save",
"dg.persistence.Database",
"dg.config.Config",
"dg.Config",
"copy.deepcopy",
"dg.persistence.load"
] | [((1464, 1472), 'dg.config.Config', 'Config', ([], {}), '()\n', (1470, 1472), False, 'from dg.config import Config\n'), ((1576, 1594), 'dg.utils.bar', 'bar', ([], {'silent': 'silent'}), '(silent=silent)\n', (1579, 1594), False, 'from dg.utils import bar\n'), ((3011, 3019), 'dg.config.Config', 'Config', ([], {}), '()\n'... |
import youtube_dl, spotipy, os, requests, threading, queue
from spotipy.oauth2 import SpotifyOAuth
from mutagen.mp3 import MP3
from mutagen.id3 import ID3, APIC, TIT2, TPE1, TALB, TRCK
from mutagen.id3 import ID3NoHeaderError
from youtube_dl.utils import DownloadError
from requests.exceptions import HTTPError
number_o... | [
"os.path.exists",
"mutagen.id3.TRCK",
"mutagen.id3.TALB",
"mutagen.id3.ID3",
"os.rename",
"requests.get",
"os.getcwd",
"youtube_dl.YoutubeDL",
"os.path.isfile",
"os.chdir",
"mutagen.mp3.MP3",
"mutagen.id3.TPE1",
"os.mkdir",
"threading.Thread",
"queue.Queue",
"mutagen.id3.TIT2",
"os.r... | [((343, 354), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (352, 354), False, 'import youtube_dl, spotipy, os, requests, threading, queue\n'), ((359, 372), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (370, 372), False, 'import youtube_dl, spotipy, os, requests, threading, queue\n'), ((1015, 1049), 'youtube_dl.Youtub... |
import sys
import unittest
class PySC2Tests(unittest.TestCase):
def test_pysc2_shards_dqn(self):
sys.argv = ['',
'--task', 'abp.examples.pysc2.collect_shards.dqn',
'--folder', 'test/tasks/pysc2_collect_shards_dqn']
from abp.trainer.task_runner import main
mai... | [
"abp.trainer.task_runner.main"
] | [((317, 323), 'abp.trainer.task_runner.main', 'main', ([], {}), '()\n', (321, 323), False, 'from abp.trainer.task_runner import main\n'), ((577, 583), 'abp.trainer.task_runner.main', 'main', ([], {}), '()\n', (581, 583), False, 'from abp.trainer.task_runner import main\n')] |
import sys
import os
this_path = os.path.dirname(os.path.realpath(__file__))
root_path = os.path.abspath(os.path.join(this_path, os.pardir))
sys.path.append(root_path)
from flask import Flask, render_template, request, redirect
import models.vggpt2.interactive as vggpt2_it
import models.baseline.vqa.cyanogenoid.inter... | [
"flask.render_template",
"os.path.exists",
"os.listdir",
"flask.request.files.getlist",
"www.utils.image.cache_session_images",
"flask.Flask",
"os.path.join",
"www.utils.image.load_relative_image",
"flask.request.form.get",
"os.path.realpath",
"www.utils.image.k_rand_images",
"flask.redirect",... | [((142, 168), 'sys.path.append', 'sys.path.append', (['root_path'], {}), '(root_path)\n', (157, 168), False, 'import sys\n'), ((405, 420), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (410, 420), False, 'from flask import Flask, render_template, request, redirect\n'), ((50, 76), 'os.path.realpath', 'os.p... |
from mitmproxy.web import master
from . import mastertest
class TestWebMaster(mastertest.MasterTest):
def mkmaster(self, **options):
o = master.Options(**options)
return master.WebMaster(None, o)
def test_basic(self):
m = self.mkmaster()
for i in (1, 2, 3):
self.du... | [
"mitmproxy.web.master.Options",
"mitmproxy.web.master.WebMaster"
] | [((151, 176), 'mitmproxy.web.master.Options', 'master.Options', ([], {}), '(**options)\n', (165, 176), False, 'from mitmproxy.web import master\n'), ((192, 217), 'mitmproxy.web.master.WebMaster', 'master.WebMaster', (['None', 'o'], {}), '(None, o)\n', (208, 217), False, 'from mitmproxy.web import master\n')] |
import tensorflow as tf
import flask
from flask import request
import base64
import cv2
import numpy as np
from PIL import Image
from io import BytesIO
import transform
# print('Downloading CUM...')
# url = 'https://face-off-ai.s3.amazonaws.com/CUMv6.h5'
# r = requests.get(url)
# with open('CUMv6.h5', 'wb') as mod:
#... | [
"flask.Flask",
"transform.transformIndividual",
"flask.request.get_json",
"tensorflow.keras.models.load_model",
"cv2.cvtColor",
"numpy.expand_dims",
"flask.jsonify"
] | [((570, 591), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (581, 591), False, 'import flask\n'), ((747, 785), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['"""CUMv6.h5"""'], {}), "('CUMv6.h5')\n", (773, 785), True, 'import tensorflow as tf\n'), ((926, 944), 'flask.request.g... |
#! /usr/bin/env python2
# -*- coding: utf-8 -*-
import sf
class LowLevelDrawable(sf.Drawable):
def render(self, target, renderer):
renderer.begin(sf.Renderer.TRIANGLE_STRIP)
renderer.add_vertex(200, 100, sf.Color.BLACK)
renderer.add_vertex(200, 300, sf.Color.RED)
renderer.add_vert... | [
"sf.VideoMode"
] | [((454, 476), 'sf.VideoMode', 'sf.VideoMode', (['(640)', '(480)'], {}), '(640, 480)\n', (466, 476), False, 'import sf\n')] |
import sys
import logging
import argparse
import json
from blocksec2go import CardError
def main(argv=None):
if argv == None:
argv = sys.argv
prog = sys.argv[0]
args = sys.argv[1:]
parser = argparse.ArgumentParser(
prog=prog,
description='Command line interface for Infineon\'s... | [
"blocksec2go.cli.disable_pin.add_subcommand",
"blocksec2go.cli.encrypted_keyimport.add_subcommand",
"blocksec2go.cli.generate_signature.add_subcommand",
"argparse.ArgumentParser",
"blocksec2go.cli.get_card_info.add_subcommand",
"blocksec2go.cli.list_readers.add_subcommand",
"blocksec2go.cli.change_pin.a... | [((217, 350), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'prog', 'description': '"""Command line interface for Infineon\'s Blockchain Security 2Go starter kit"""'}), '(prog=prog, description=\n "Command line interface for Infineon\'s Blockchain Security 2Go starter kit"\n )\n', (240, 350)... |
# Requires install from: https://github.com/IanHarvey/bluepy
# Runs on python 3.5
from bluepy.btle import *
import time
import configparser
config = configparser.ConfigParser()
config.read('config.ini')
knee_mac = config['MAC']['knee']
ankle_mac = config['MAC']['ankle']
start_time = time.time()
data = []
data2 = []
... | [
"time.time",
"configparser.ConfigParser"
] | [((150, 177), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (175, 177), False, 'import configparser\n'), ((286, 297), 'time.time', 'time.time', ([], {}), '()\n', (295, 297), False, 'import time\n')] |
from setuptools import setup, find_packages
setup(
name='keyrings.alt',
version='3.1.1',
author='<NAME>',
author_email="<EMAIL>",
url='https://github.com/jaraco/keyrings.alt',
license='MIT',
description='Alternate keyring implementations',
packages=['keyrings.alt']
)
| [
"setuptools.setup"
] | [((45, 275), 'setuptools.setup', 'setup', ([], {'name': '"""keyrings.alt"""', 'version': '"""3.1.1"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/jaraco/keyrings.alt"""', 'license': '"""MIT"""', 'description': '"""Alternate keyring implementations"""', 'packages': "['keyri... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sept 10 09:35:13 2016
@author: <NAME>
"""
import multiprocessing
from modules import acq_stage_script5, fill_stage_array_script3, read_buffers_stage_script5, go_scan_galvos, disp_results_script2
def go_stage_scan_func_mp(motor_stageXY, min_val_volt_list, max_val... | [
"modules.acq_stage_script5.acq_data_stage",
"modules.disp_results_script2.disp_results",
"traceback.print_exc",
"multiprocessing.Queue",
"multiprocessing.Pipe",
"modules.fill_stage_array_script3.fill_disp_array",
"modules.read_buffers_stage_script5.read_buffers_stage"
] | [((1887, 1910), 'multiprocessing.Queue', 'multiprocessing.Queue', ([], {}), '()\n', (1908, 1910), False, 'import multiprocessing\n'), ((2073, 2100), 'multiprocessing.Pipe', 'multiprocessing.Pipe', (['(False)'], {}), '(False)\n', (2093, 2100), False, 'import multiprocessing\n'), ((2251, 2278), 'multiprocessing.Pipe', 'm... |
import copy
from math import floor
from tkinter import (HORIZONTAL, Canvas, N, PhotoImage, S, IntVar, StringVar, Tk,
Toplevel, X, colorchooser, messagebox)
from tkinter.ttk import (Button, Entry, Frame, Label, Separator, Radiobutton)
from models import *
from controllers import dijkstra
def mou... | [
"tkinter.IntVar",
"tkinter.messagebox.showerror",
"tkinter.ttk.Button",
"tkinter.ttk.Entry",
"tkinter.colorchooser.Chooser",
"math.floor",
"tkinter.ttk.Label",
"controllers.dijkstra",
"tkinter.ttk.Separator",
"tkinter.StringVar",
"tkinter.Canvas",
"tkinter.PhotoImage",
"copy.copy"
] | [((1698, 1706), 'tkinter.IntVar', 'IntVar', ([], {}), '()\n', (1704, 1706), False, 'from tkinter import HORIZONTAL, Canvas, N, PhotoImage, S, IntVar, StringVar, Tk, Toplevel, X, colorchooser, messagebox\n'), ((1734, 1742), 'tkinter.IntVar', 'IntVar', ([], {}), '()\n', (1740, 1742), False, 'from tkinter import HORIZONTA... |
from pliers.extractors import (GoogleVisionAPIFaceExtractor,
GoogleVisionAPILabelExtractor,
GoogleVisionAPIPropertyExtractor,
GoogleVisionAPISafeSearchExtractor)
from pliers.extractors.google import GoogleVisionAPIExtractor
fro... | [
"pliers.extractors.GoogleVisionAPIFaceExtractor",
"pliers.extractors.GoogleVisionAPIPropertyExtractor",
"pliers.extractors.google.GoogleVisionAPIExtractor",
"numpy.isfinite",
"pliers.stimuli.ImageStim",
"pytest.mark.skipif",
"pliers.extractors.GoogleVisionAPILabelExtractor",
"pliers.extractors.GoogleV... | [((465, 537), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""\'GOOGLE_APPLICATION_CREDENTIALS\' not in os.environ"""'], {}), '("\'GOOGLE_APPLICATION_CREDENTIALS\' not in os.environ")\n', (483, 537), False, 'import pytest\n'), ((738, 810), 'pytest.mark.skipif', 'pytest.mark.skipif', (['"""\'GOOGLE_APPLICATION_CREDENT... |
#!/usr/bin/python
import tkinter
from tkinter import messagebox
import os
import time
import subprocess
#### GUI FUNCTIONS
def EXIT():
exit()
def POWER():
os.system("sudo systemctl poweroff &")
exit()
def REBOOT():
os.system("sudo systemctl reboot &")
exit()
def SUSPEND():
os.system("sudo syst... | [
"tkinter.Menu",
"os.getuid",
"os.environ.get",
"tkinter.Button",
"tkinter.Tk",
"tkinter.Label",
"tkinter.Menubutton",
"os.system"
] | [((1368, 1380), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (1378, 1380), False, 'import tkinter\n'), ((1471, 1581), 'tkinter.Button', 'tkinter.Button', (['top'], {'text': '"""POWER OFF"""', 'bg': '"""#dc322f"""', 'fg': '"""white"""', 'activebackground': '"""#cC221F"""', 'command': 'POWER'}), "(top, text='POWER OFF',... |
"""
Test creating a Model and generating the SQL to create its table.
"""
from postDB import Model, Column, types
class User(Model):
id = Column(types.Integer(big=True), primary_key=True)
username = Column(types.String)
email = Column(types.String, unique=True)
if __name__ == "__main__":
print(User... | [
"postDB.Column",
"postDB.types.Integer"
] | [((210, 230), 'postDB.Column', 'Column', (['types.String'], {}), '(types.String)\n', (216, 230), False, 'from postDB import Model, Column, types\n'), ((243, 276), 'postDB.Column', 'Column', (['types.String'], {'unique': '(True)'}), '(types.String, unique=True)\n', (249, 276), False, 'from postDB import Model, Column, t... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'tracklayouttreewidget.ui'
#
# Created: Tue Jun 23 21:01:09 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8... | [
"PyQt4.QtGui.QApplication.translate",
"PyQt4.QtCore.QMetaObject.connectSlotsByName",
"PyQt4.QtGui.QVBoxLayout"
] | [((496, 560), 'PyQt4.QtGui.QApplication.translate', 'QtGui.QApplication.translate', (['context', 'text', 'disambig', '_encoding'], {}), '(context, text, disambig, _encoding)\n', (524, 560), False, 'from PyQt4 import QtCore, QtGui\n'), ((1093, 1132), 'PyQt4.QtGui.QVBoxLayout', 'QtGui.QVBoxLayout', (['trackLayouttreWidge... |
from unittest import mock
import uuid
import pytest
from pylon.aws import s3
@pytest.fixture
def s3MessageStore():
return s3.MessageStore('s3://test-bucket/test.prefix/')
def test_MessageStore_checkInPayload(monkeypatch, s3MessageStore, testMessage_inline):
mockPutObject = mock.MagicMock()
monkeypatch... | [
"unittest.mock.MagicMock",
"pylon.aws.s3.MessageStore",
"pylon.aws.s3.MessageStore.checkOutPayload"
] | [((130, 178), 'pylon.aws.s3.MessageStore', 's3.MessageStore', (['"""s3://test-bucket/test.prefix/"""'], {}), "('s3://test-bucket/test.prefix/')\n", (145, 178), False, 'from pylon.aws import s3\n'), ((288, 304), 'unittest.mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (302, 304), False, 'from unittest import mock\... |
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by <NAME>, Virginia Tech Intellectual
# Properties, Inc., University of Heidelberg, and University of
# of Connecticut School of Medicine.
# All rights reserved.
# Copyright (C) 2010 - 2016 by <NAME>, Virginia Tech Intellectual
# Properties, Inc., University of Heidelb... | [
"COPASI.CCommonName.escape",
"COPASI.CRootContainer.addDatamodel",
"COPASI.CCommonName.unescape",
"unittest.TextTestRunner"
] | [((855, 891), 'COPASI.CRootContainer.addDatamodel', 'COPASI.CRootContainer.addDatamodel', ([], {}), '()\n', (889, 891), False, 'import COPASI\n'), ((1843, 1871), 'COPASI.CCommonName.escape', 'COPASI.CCommonName.escape', (['a'], {}), '(a)\n', (1868, 1871), False, 'import COPASI\n'), ((2013, 2043), 'COPASI.CCommonName.un... |
# coding=utf-8
import pika
import json
import time
print('SLEEPING!')
time.sleep(15)
print('SLEEP DONE')
print('MAKING A CONNECTION!')
connection = pika.BlockingConnection(pika.ConnectionParameters(host='rabbit1'))
print('CONNECTION MADE')
channel = connection.channel()
print('CHANNEL MADE!!')
channel.queue_decl... | [
"pika.BasicProperties",
"pika.ConnectionParameters",
"json.dumps",
"time.sleep"
] | [((74, 88), 'time.sleep', 'time.sleep', (['(15)'], {}), '(15)\n', (84, 88), False, 'import time\n'), ((177, 218), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""rabbit1"""'}), "(host='rabbit1')\n", (202, 218), False, 'import pika\n'), ((1225, 1238), 'time.sleep', 'time.sleep', (['(4)'], {})... |
# -*- coding: utf-8 -*-
from copy import deepcopy
from django.test import TestCase
from ralph.assets.tests.factories import ServiceEnvironmentFactory
from ralph.data_center.models import VIP, VIPProtocol
from ralph.data_center.subscribers import (
handle_create_vip_event,
handle_delete_vip_event,
validat... | [
"ralph.data_center.models.VIP.objects.all",
"ralph.data_center.subscribers.handle_delete_vip_event",
"ralph.networks.tests.factories.IPAddressFactory",
"ralph.data_center.subscribers.handle_create_vip_event",
"ralph.data_center.models.VIP.objects.count",
"ralph.networks.models.networks.IPAddress.objects.c... | [((995, 1015), 'copy.deepcopy', 'deepcopy', (['EVENT_DATA'], {}), '(EVENT_DATA)\n', (1003, 1015), False, 'from copy import deepcopy\n'), ((1100, 1134), 'ralph.data_center.subscribers.validate_vip_event_data', 'validate_vip_event_data', (['self.data'], {}), '(self.data)\n', (1123, 1134), False, 'from ralph.data_center.s... |
import wx
import sys
from documents.text import TextDocument
from . import goto, preferences
from repeating_timer import RepeatingTimer
from documents.pdf import PdfDocument
from documents.word import DocxDocument
from documents.epub import EpubDocument
from documents.markdown import MarkdownDocument
from documents.htm... | [
"documents.word.DocxDocument",
"documents.powerpoint.PptxDocument",
"wx.MessageBox",
"repeating_timer.RepeatingTimer",
"sys.exit",
"wx.AcceleratorTable",
"documents.html.HtmlDocument",
"wx.Frame.__init__",
"wx.Panel",
"utils.plural",
"wx.StaticText",
"wx.TextCtrl",
"os.path.isfile",
"docum... | [((688, 722), 'repeating_timer.RepeatingTimer', 'RepeatingTimer', (['(1.0)', 'self.on_timer'], {}), '(1.0, self.on_timer)\n', (702, 722), False, 'from repeating_timer import RepeatingTimer\n'), ((725, 825), 'wx.Frame.__init__', 'wx.Frame.__init__', (['self', 'None'], {'title': 'f"""{self.app.name} V{self.app.version}""... |
# coding=utf-8
import argparse
import os
import time
from math import ceil
import caffe
import cv2
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument('--caffe_prototxt_path', default="model/RFB-320/RFB-320.prototxt", type=str, help='caffe_prototxt_path')
parser.add_argument('--caffe_model_path'... | [
"numpy.clip",
"cv2.rectangle",
"cv2.imshow",
"numpy.argsort",
"numpy.array",
"cv2.destroyAllWindows",
"caffe.set_mode_cpu",
"os.path.exists",
"os.listdir",
"numpy.reshape",
"argparse.ArgumentParser",
"numpy.exp",
"numpy.concatenate",
"numpy.maximum",
"cv2.waitKey",
"cv2.cvtColor",
"c... | [((129, 154), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (152, 154), False, 'import argparse\n'), ((990, 1015), 'numpy.array', 'np.array', (['[127, 127, 127]'], {}), '([127, 127, 127])\n', (998, 1015), True, 'import numpy as np\n'), ((906, 926), 'caffe.set_mode_cpu', 'caffe.set_mode_cpu', (... |
from django.http.response import JsonResponse
from django.shortcuts import render, redirect, reverse, get_object_or_404, HttpResponse
from django.conf import settings
from django.contrib import messages
from django.views.decorators.http import require_POST
from django.contrib.auth.decorators import login_required
from... | [
"stripe.PaymentIntent.create",
"django.shortcuts.render",
"django.shortcuts.HttpResponse",
"django.contrib.messages.error",
"django.contrib.messages.warning",
"django.shortcuts.get_object_or_404",
"profiles.forms.UserProfileForm",
"profiles.models.UserProfile.objects.get",
"django.contrib.messages.s... | [((1209, 1250), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Program'], {'pk': 'program_id'}), '(Program, pk=program_id)\n', (1226, 1250), False, 'from django.shortcuts import render, redirect, reverse, get_object_or_404, HttpResponse\n'), ((1372, 1460), 'stripe.PaymentIntent.create', 'stripe.PaymentIn... |
from aws_cdk import core
import stacks
app = core.App()
stacks.Production(app, "Production", env=core.Environment(account="473883619336", region="eu-central-1"))
stacks.Testing(app, "Testing", env=core.Environment(account="473883619336", region="eu-central-1"))
app.synth()
| [
"aws_cdk.core.Environment",
"aws_cdk.core.App"
] | [((47, 57), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (55, 57), False, 'from aws_cdk import core\n'), ((100, 163), 'aws_cdk.core.Environment', 'core.Environment', ([], {'account': '"""473883619336"""', 'region': '"""eu-central-1"""'}), "(account='473883619336', region='eu-central-1')\n", (116, 163), False, 'fro... |
from collections import defaultdict
def part_1():
with open('input') as f:
return sum(map(int, f.read().split()))
def part_2():
with open('input') as f:
data = f.read().splitlines()
d = defaultdict(int)
d[0] = 1
result = 0
while True:
for line in data:
v... | [
"collections.defaultdict"
] | [((219, 235), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (230, 235), False, 'from collections import defaultdict\n')] |
# Name: <NAME>
# Date: 2 March 2020
# Program: biot_helix.py
import numpy as np
import matplotlib.pyplot as plt
import time as time
from matplotlib.patches import Circle
def biot(Rvec, wire, I):
mu_4pi = 10
dB = np.zeros((len(wire), 3))
R = Rvec - wire
Rsqr = np.sum( R**2, axis = 1 )
d... | [
"numpy.roll",
"numpy.cross",
"numpy.column_stack",
"numpy.sum",
"numpy.linspace",
"matplotlib.pyplot.figure",
"numpy.zeros",
"numpy.array",
"numpy.concatenate",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid",
"time.time",
"matplotlib.patches.Circle",
"numpy.arange"
] | [((1150, 1180), 'numpy.arange', 'np.arange', (['(-L / 2)', '(L / 2)', 'segL'], {}), '(-L / 2, L / 2, segL)\n', (1159, 1180), True, 'import numpy as np\n'), ((1410, 1454), 'numpy.column_stack', 'np.column_stack', (['(helix_x, helix_y, helix_z)'], {}), '((helix_x, helix_y, helix_z))\n', (1425, 1454), True, 'import numpy ... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | [
"zope.publisher.browser.TestRequest",
"unittest.makeSuite",
"zope.app.pagetemplate.tests.testpackage.content.Content",
"zope.component.provideAdapter",
"zope.traversing.testing.setUp"
] | [((1162, 1169), 'zope.traversing.testing.setUp', 'setUp', ([], {}), '()\n', (1167, 1169), False, 'from zope.traversing.testing import setUp\n'), ((1174, 1249), 'zope.component.provideAdapter', 'provideAdapter', (['ContainerTraversable', '(ISimpleReadContainer,)', 'ITraversable'], {}), '(ContainerTraversable, (ISimpleRe... |
from sys import exit
import pygame
import MathStuff as MATH
import GUICreator
StaticButton = GUICreator.StaticButton
DynamicButton = GUICreator.DynamicButton
StaticTextButton = GUICreator.StaticTextButton
DynamicTextButton = GUICreator.DynamicTextButton
class MathStuffGUI:
"""Create a GUI for my calculators."""... | [
"pygame.init",
"MathStuff.median_",
"sys.exit",
"MathStuff.lcf_",
"MathStuff.mode_",
"MathStuff.get_factors_",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.display.Info",
"pygame.mouse.get_pos",
"MathStuff.gcf_",
"MathStuff.extrapolate_",
"MathStuff.range_",
"MathStuff.root_",... | [((390, 403), 'pygame.init', 'pygame.init', ([], {}), '()\n', (401, 403), False, 'import pygame\n'), ((430, 449), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (447, 449), False, 'import pygame\n'), ((529, 550), 'pygame.display.Info', 'pygame.display.Info', ([], {}), '()\n', (548, 550), False, 'import pyg... |
from pathlib import Path
import pickle
import logging
class FileCacher(object):
def __init__(self, dir_path: Path):
self.dir_path = dir_path
def __str__(self):
string = "FileCacher["
string += str(self.dir_path.resolve())
string += "]"
return string
def object_to_... | [
"pickle.dump",
"pickle.load",
"logging.info"
] | [((358, 406), 'logging.info', 'logging.info', (['f"""Stored in cache. Id: {filename}"""'], {}), "(f'Stored in cache. Id: {filename}')\n", (370, 406), False, 'import logging\n'), ((577, 619), 'logging.info', 'logging.info', (['f"""Cache hit. Id: {filename}"""'], {}), "(f'Cache hit. Id: {filename}')\n", (589, 619), False... |
import xadmin
from .models import Customer, Inventory, Rental, Payment, Staff, Store
xadmin.site.register(Customer)
xadmin.site.register(Inventory)
xadmin.site.register(Rental)
xadmin.site.register(Payment)
xadmin.site.register(Staff)
xadmin.site.register(Store)
| [
"xadmin.site.register"
] | [((89, 119), 'xadmin.site.register', 'xadmin.site.register', (['Customer'], {}), '(Customer)\n', (109, 119), False, 'import xadmin\n'), ((120, 151), 'xadmin.site.register', 'xadmin.site.register', (['Inventory'], {}), '(Inventory)\n', (140, 151), False, 'import xadmin\n'), ((152, 180), 'xadmin.site.register', 'xadmin.s... |
import torch.nn as nn
import torch.nn.functional as F
import torch
from utils.conv_block import ConvBlock
from utils.common import pairwise_distances, split_support_query_set
device = 'cuda' if torch.cuda.is_available() else 'cpu'
class Classifier(nn.Module):
def __init__(self, in_channel):
super().__in... | [
"utils.common.pairwise_distances",
"torch.nn.functional.softmax",
"torch.nn.CrossEntropyLoss",
"torch.rand",
"torch.nn.init.constant_",
"torch.nn.LSTM",
"torch.nn.LSTMCell",
"utils.conv_block.ConvBlock",
"torch.nn.init.kaiming_uniform_",
"torch.mm",
"torch.cuda.is_available",
"torch.arange",
... | [((196, 221), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (219, 221), False, 'import torch\n'), ((5531, 5558), 'torch.rand', 'torch.rand', (['(30, 3, 84, 84)'], {}), '((30, 3, 84, 84))\n', (5541, 5558), False, 'import torch\n'), ((5701, 5720), 'torch.cat', 'torch.cat', (['(y1, y2)'], {}), '(... |
############ PISTA ##################
########################################
class Pista:
__iniciales = False
def __init__(self,**kwargs):
self._nombre = kwargs.get("nombre", "Untitled")
self._favorita = kwargs.get("favorita", False)
self._duracion = kwargs.get("duracion", 0.0)... | [
"datetime.datetime.now",
"platform.system",
"os.system"
] | [((2267, 2290), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2288, 2290), False, 'import datetime\n'), ((2390, 2413), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (2411, 2413), False, 'import datetime\n'), ((2826, 2843), 'platform.system', 'platform.system', ([], {}), '()\... |
from django.http import JsonResponse, Http404
from django.shortcuts import redirect
def parse_ip_address(request):
ipaddress = request.META.get("HTTP_X_REAL_IP") \
or request.META.get("HTTP_X_FORWARDED_FOR") \
or request.environ.get("REMOTE_ADDR") or ""
if "," in ipaddress: # multiple ips in... | [
"django.http.JsonResponse"
] | [((870, 916), 'django.http.JsonResponse', 'JsonResponse', ([], {'data': 'results', 'status': 'status_code'}), '(data=results, status=status_code)\n', (882, 916), False, 'from django.http import JsonResponse, Http404\n')] |
import csv
import shutil
from mock import patch
from django.core.management import call_command
from django.test import TestCase
from dmd.models import AMP, AMPP, VMP, VMPP
from dmd.management.commands.import_dmd import get_common_name
from frontend.models import ImportLog, Presentation, NCSOConcession
from openpres... | [
"openprescribing.utils.mkdir_p",
"frontend.models.Presentation.objects.create",
"frontend.models.ImportLog.objects.create",
"dmd.models.AMPP.objects.get",
"frontend.models.NCSOConcession.objects.create",
"dmd.models.VMPP.objects.get",
"mock.patch",
"csv.reader",
"django.core.management.call_command"... | [((934, 1051), 'shutil.copytree', 'shutil.copytree', (['"""dmd/tests/data/dmd/1"""', '"""pipeline/test-data/data/dmd/2019_07_01/nhsbsa_dmd_7.4.0_20190701000001"""'], {}), "('dmd/tests/data/dmd/1',\n 'pipeline/test-data/data/dmd/2019_07_01/nhsbsa_dmd_7.4.0_20190701000001')\n", (949, 1051), False, 'import shutil\n'), ... |
"""
NetBet odds scraper
"""
import datetime
import http.client
import re
import urllib
import urllib.error
import urllib.request
import fake_useragent
from bs4 import BeautifulSoup
import sportsbetting as sb
from sportsbetting.auxiliary_functions import truncate_datetime
def parse_netbet(url):
"""
Retourn... | [
"datetime.datetime",
"sportsbetting.auxiliary_functions.truncate_datetime",
"datetime.datetime.strptime",
"urllib.request.Request",
"bs4.BeautifulSoup",
"re.finditer",
"datetime.datetime.today",
"urllib.request.urlopen",
"fake_useragent.UserAgent"
] | [((1781, 1806), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (1804, 1806), False, 'import datetime\n'), ((1819, 1872), 'datetime.datetime', 'datetime.datetime', (['today.year', 'today.month', 'today.day'], {}), '(today.year, today.month, today.day)\n', (1836, 1872), False, 'import datetime\n'... |
from chainer import functions as F
from scipy import special
import numpy as np
from scipy import ndimage
def log_beta_distribution(x, a, b):
eps = 1e-5
lnp = ((a - 1) * F.log(x + eps)
+ (b - 1) * F.log(1 - x + eps)
- float(special.beta(a, b)))
return lnp
def make_laplacian_of_gau... | [
"chainer.functions.log",
"scipy.special.beta",
"numpy.exp",
"numpy.zeros",
"scipy.ndimage.rotate",
"numpy.arange"
] | [((403, 423), 'numpy.zeros', 'np.zeros', (['[101, 101]'], {}), '([101, 101])\n', (411, 423), True, 'import numpy as np\n'), ((432, 450), 'numpy.arange', 'np.arange', (['(-50)', '(51)'], {}), '(-50, 51)\n', (441, 450), True, 'import numpy as np\n'), ((579, 627), 'scipy.ndimage.rotate', 'ndimage.rotate', (['f', 'angle'],... |
#!/usr/bin/python3.4
# -*-coding:Utf-8 -*
'''module to manage Rendering Options'''
import xml.etree.ElementTree as xmlMod
import os
class Options:
'''class to manage Rendering Options'''
RGBA_AVAILABLE = ['IRIS', 'PNG', 'JPEG2000', 'TARGA', 'DPX', 'OPEN_EXR_MULTILAYER', 'OPEN_EXR', 'HDR' ]
def __init__(self, xm... | [
"bpy.data.worlds.values"
] | [((4494, 4518), 'bpy.data.worlds.values', 'bpy.data.worlds.values', ([], {}), '()\n', (4516, 4518), False, 'import bpy\n')] |
import json
from collections import defaultdict, deque
from threading import Lock
class DEPQ:
def __init__(self, iterable=None, maxlen=None):
self.data = deque()
self.items = defaultdict(int)
self._maxlen = maxlen
self.lock = Lock()
if iterable is not None:
s... | [
"threading.Lock",
"json.loads",
"collections.deque",
"collections.defaultdict"
] | [((170, 177), 'collections.deque', 'deque', ([], {}), '()\n', (175, 177), False, 'from collections import defaultdict, deque\n'), ((199, 215), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (210, 215), False, 'from collections import defaultdict, deque\n'), ((266, 272), 'threading.Lock', 'Lock', ([... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from baselines.chac.utils import Base, hidden_init
class Critic(Base):
def __init__(self, env, level, n_levels, time_scale, device,
lr=0.001, gamma=0.98, hidden_size=64):
super(Critic, self).__init_... | [
"baselines.chac.utils.hidden_init",
"torch.tensor",
"torch.nn.MSELoss",
"torch.nn.Linear",
"torch.cat"
] | [((941, 1002), 'torch.nn.Linear', 'nn.Linear', (['(env.state_dim + action_dim + goal_dim)', 'hidden_size'], {}), '(env.state_dim + action_dim + goal_dim, hidden_size)\n', (950, 1002), True, 'import torch.nn as nn\n'), ((1022, 1057), 'torch.nn.Linear', 'nn.Linear', (['hidden_size', 'hidden_size'], {}), '(hidden_size, hi... |
'''Tools for extracting timezone information from GPS data.
'''
from logging import getLogger
import pytz
import datetime
from timezonefinder import TimezoneFinder
from ..constants.time import HOUR_S
logger = getLogger(__name__)
def get_timezone(latitude, longitude, try_closest = True):
'''
Get timezone fr... | [
"logging.getLogger",
"pytz.timezone",
"datetime.datetime.fromtimestamp",
"timezonefinder.TimezoneFinder"
] | [((212, 231), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'from logging import getLogger\n'), ((669, 685), 'timezonefinder.TimezoneFinder', 'TimezoneFinder', ([], {}), '()\n', (683, 685), False, 'from timezonefinder import TimezoneFinder\n'), ((1431, 1490), 'datetime.datetim... |
# Copyright 2018 gRPC 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 or agreed to in writing... | [
"logging.basicConfig",
"logging.getLogger",
"sys.stderr.getvalue",
"six.moves.reload_module",
"functools.wraps",
"six.StringIO",
"unittest.main"
] | [((796, 814), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (811, 814), False, 'import functools\n'), ((1063, 1081), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (1078, 1081), False, 'import functools\n'), ((2215, 2241), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbos... |
# 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
from... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((4464, 4509), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""applyOnlyAtCronInterval"""'}), "(name='applyOnlyAtCronInterval')\n", (4477, 4509), False, 'import pulumi\n'), ((4852, 4889), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""associationName"""'}), "(name='associationName')\n", (4865, 4889), False, '... |
import os
import re
import base64
import webbrowser
import time
import tempfile
import numpy as np
import matplotlib
from numpy.testing import assert_warns, assert_no_warnings
try:
from lxml import etree
LXML_INSTALLED = True
except ImportError:
LXML_INSTALLED = False
from nilearn.plotting import js_plott... | [
"nilearn.datasets.fetch_surf_fsaverage",
"time.sleep",
"numpy.arange",
"os.remove",
"numpy.testing.assert_warns",
"lxml.etree.HTMLParser",
"nilearn.surface.load_surf_mesh",
"nilearn.plotting.js_plotting_utils.to_color_strings",
"nilearn.plotting.js_plotting_utils.get_html_template",
"nilearn.plott... | [((577, 602), 're.sub', 're.sub', (['"""\\\\s+"""', '""" """', 'text'], {}), "('\\\\s+', ' ', text)\n", (583, 602), False, 'import re\n'), ((639, 704), 'nilearn.plotting.js_plotting_utils.get_html_template', 'js_plotting_utils.get_html_template', (['"""surface_plot_template.html"""'], {}), "('surface_plot_template.html... |
from parser import Parser
class CodeWriter:
def __init__(self, path):
self.parser = Parser(path)
# just perform the logic of the recommended setFileName constructor here
ind1 = path.find('/')
ind2 = path.find('.')
self.writefile = path[:ind1] + "/" + path[ind1+1:ind2]
... | [
"parser.Parser"
] | [((99, 111), 'parser.Parser', 'Parser', (['path'], {}), '(path)\n', (105, 111), False, 'from parser import Parser\n')] |
import filecmp
import os
import pathlib
import pytest
from lib import _rewrite
from _exceptions import NoSolutionError
import main
def confirm(output):
compare_to = "modified_file.py"
try:
assert filecmp.cmp(output, compare_to)
except AssertionError as e:
with open(compare_to) as f:
... | [
"pathlib.Path",
"main.main",
"os.path.isdir",
"pytest.raises",
"os.mkdir",
"filecmp.cmp"
] | [((1433, 1449), 'main.main', 'main.main', (['*args'], {}), '(*args)\n', (1442, 1449), False, 'import main\n'), ((214, 245), 'filecmp.cmp', 'filecmp.cmp', (['output', 'compare_to'], {}), '(output, compare_to)\n', (225, 245), False, 'import filecmp\n'), ((1561, 1587), 'pytest.raises', 'pytest.raises', (['SyntaxError'], {... |
from django.shortcuts import render
from third_app.forms import FormName
# Create your views here.
def index(request):
return render(request, 'third_app/index.html')
def form_name_view(request):
if request.method == 'POST':
form = FormName(request.POST)
if (form.is_valid()):
prin... | [
"django.shortcuts.render",
"third_app.forms.FormName"
] | [((132, 171), 'django.shortcuts.render', 'render', (['request', '"""third_app/index.html"""'], {}), "(request, 'third_app/index.html')\n", (138, 171), False, 'from django.shortcuts import render\n'), ((413, 472), 'django.shortcuts.render', 'render', (['request', '"""third_app/form_page.html"""', "{'form': form}"], {}),... |
import random
import numpy as np
def read_data(pairs_file):
with open(pairs_file, 'r') as file:
tcrs = set()
peps = set()
all_pairs = []
for line in file:
tcr, pep, cd = line.strip().split('\t')
# print(tcr, pep)
# Proper tcr and peptides
... | [
"random.choice",
"random.shuffle",
"numpy.random.binomial"
] | [((2380, 2401), 'random.shuffle', 'random.shuffle', (['train'], {}), '(train)\n', (2394, 2401), False, 'import random\n'), ((2437, 2457), 'random.shuffle', 'random.shuffle', (['test'], {}), '(test)\n', (2451, 2457), False, 'import random\n'), ((777, 803), 'numpy.random.binomial', 'np.random.binomial', (['(1)', '(0.8)']... |
import unittest
import six
import pynetbox
if six.PY3:
from unittest.mock import patch
else:
from mock import patch
host = "http://localhost:8000"
def_kwargs = {
"token": "<PASSWORD>",
}
class AppCustomChoicesTestCase(unittest.TestCase):
@patch(
"pynetbox.core.query.Request.get",
... | [
"pynetbox.api",
"mock.patch"
] | [((262, 402), 'mock.patch', 'patch', (['"""pynetbox.core.query.Request.get"""'], {'return_value': "{'Testfield1': {'TF1_1': 1, 'TF1_2': 2}, 'Testfield2': {'TF2_1': 3, 'TF2_2': 4}\n }"}), "('pynetbox.core.query.Request.get', return_value={'Testfield1': {\n 'TF1_1': 1, 'TF1_2': 2}, 'Testfield2': {'TF2_1': 3, 'TF2_2... |
from collections import deque
class BinarySearchTree:
class GraphNode:
def __init__(self, data):
self.data = data
self.left = None
self.right = None
def __str__(self):
return f"Data:{self.data}"
def __init__(self):
self.root_node = None
... | [
"collections.deque"
] | [((5417, 5424), 'collections.deque', 'deque', ([], {}), '()\n', (5422, 5424), False, 'from collections import deque\n')] |
"""
Tests functions in the spiketools module
"""
import numpy as np
import pyret.spiketools as spk
def test_binspikes():
# assert the proper indices are returned
spike_times = [1.0, 2.0, 2.5, 3.0]
dt = 0.01
bin_edges = np.arange(0, 3, dt)
bspk = spk.binspikes(spike_times, bin_edges)
assert np... | [
"numpy.hstack",
"pyret.spiketools.estfr",
"numpy.argsort",
"numpy.array",
"numpy.gradient",
"numpy.arange",
"numpy.where",
"numpy.diff",
"numpy.exp",
"numpy.linspace",
"numpy.random.seed",
"numpy.abs",
"numpy.allclose",
"numpy.ones",
"pyret.spiketools.binspikes",
"pyret.spiketools.dete... | [((238, 257), 'numpy.arange', 'np.arange', (['(0)', '(3)', 'dt'], {}), '(0, 3, dt)\n', (247, 257), True, 'import numpy as np\n'), ((269, 306), 'pyret.spiketools.binspikes', 'spk.binspikes', (['spike_times', 'bin_edges'], {}), '(spike_times, bin_edges)\n', (282, 306), True, 'import pyret.spiketools as spk\n'), ((702, 71... |