code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
from django.core.management.base import BaseCommand
from SecuriTree.models import Door, Area, AccessRule
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('json_file', type=str)
def handle(self, *args, **options):
with open(options['json_file']) as f... | [
"SecuriTree.models.Area.objects.get_or_create",
"SecuriTree.models.AccessRule.objects.get_or_create",
"SecuriTree.models.Door.objects.get_or_create",
"json.load",
"SecuriTree.models.Door.objects.get"
] | [((346, 358), 'json.load', 'json.load', (['f'], {}), '(f)\n', (355, 358), False, 'import json\n'), ((792, 848), 'SecuriTree.models.Area.objects.get_or_create', 'Area.objects.get_or_create', ([], {'pk': "data['pk']", 'defaults': 'data'}), "(pk=data['pk'], defaults=data)\n", (818, 848), False, 'from SecuriTree.models imp... |
from pstraw import Straw
from dataclasses import dataclass
from datetime import datetime
import os
case_dir = os.path.dirname(os.path.abspath(__file__))
# 实例化straw对象
db = Straw(
DB_DRIVER='mysql', # 必须输入
DB_DATABASE='straw_test', # 必须输入
DB_USER='root', # 必须输入3306, # mysql默认值:3306 , postgres默认值:5432
DB_... | [
"os.path.abspath",
"os.path.join"
] | [((127, 152), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (142, 152), False, 'import os\n'), ((459, 486), 'os.path.join', 'os.path.join', (['case_dir', '"""."""'], {}), "(case_dir, '.')\n", (471, 486), False, 'import os\n')] |
# Generated by Django 2.2.4 on 2019-08-11 17:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('alarms_project', '0002_auto_20190811_1841'),
]
operations = [
migrations.AlterField(
model_name='alarm',
name='time'... | [
"django.db.models.DateTimeField"
] | [((340, 362), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (360, 362), False, 'from django.db import migrations, models\n')] |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class HardSwishOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsHardSwishOptions(cls, buf, offset):
n = flatb... | [
"flatbuffers.compat.import_numpy",
"flatbuffers.table.Table",
"flatbuffers.encode.Get",
"flatbuffers.util.BufferHasIdentifier"
] | [((159, 173), 'flatbuffers.compat.import_numpy', 'import_numpy', ([], {}), '()\n', (171, 173), False, 'from flatbuffers.compat import import_numpy\n'), ((315, 378), 'flatbuffers.encode.Get', 'flatbuffers.encode.Get', (['flatbuffers.packer.uoffset', 'buf', 'offset'], {}), '(flatbuffers.packer.uoffset, buf, offset)\n', (... |
"""
module containing functions to use ffprobe to parse video frame info
"""
from __future__ import print_function
import subprocess
import cStringIO
class base_frame(object):
"""
Base Frame from FFProbe
[FRAME]
media_type=video
stream_index=0
key_frame=0
pkt_pts=11745667
pkt_pts_time=... | [
"subprocess.Popen",
"cStringIO.StringIO"
] | [((4861, 4934), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n', (4877, 4934), False, 'import subprocess\n'), ((5056, 5079), 'cStringIO.StringIO', 'cStringIO.StringIO', (['out'], {}), '(out)\... |
import uuid
import pytest
from pydantic import BaseModel
from daemon.models import DaemonID
VALID_JTYPES = ['jflow', 'jdeployment', 'jpod', 'jworkspace', 'jnetwork']
def test_jtype_only():
for jtype in VALID_JTYPES:
d = DaemonID(jtype)
assert d.jtype == jtype
assert uuid.UUID(d.jid)
de... | [
"uuid.UUID",
"pytest.raises",
"daemon.models.DaemonID",
"uuid.uuid4"
] | [((352, 364), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (362, 364), False, 'import uuid\n'), ((582, 594), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (592, 594), False, 'import uuid\n'), ((918, 930), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (928, 930), False, 'import uuid\n'), ((236, 251), 'daemon.models.Dae... |
from django.urls import path, include
from . import views
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('accounts', views.AccountViewSet)
router.register('parents', views.ParentAccountViewSet)
router.register('contacts', views.ContactViewSet)
router.register('opportunities... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((118, 133), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (131, 133), False, 'from rest_framework.routers import DefaultRouter\n'), ((435, 455), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (442, 455), False, 'from django.urls import path, include\n')] |
import json
from django.contrib.auth.models import User
from django.urls import reverse
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase
from profiles.api import serializers
from . import models
class RegistrationTestCase(APITestCase):
... | [
"json.loads",
"profiles.api.serializers.ProfileStatusSerializer",
"django.urls.reverse",
"django.contrib.auth.models.User.objects.create_user",
"rest_framework.authtoken.models.Token.objects.create"
] | [((696, 719), 'django.urls.reverse', 'reverse', (['"""profile-list"""'], {}), "('profile-list')\n", (703, 719), False, 'from django.urls import reverse\n'), ((2704, 2726), 'django.urls.reverse', 'reverse', (['"""status-list"""'], {}), "('status-list')\n", (2711, 2726), False, 'from django.urls import reverse\n'), ((762... |
#!/usr/bin/env python3
# %%
import logging
import itertools
def part1(data):
orders = [(int(d) for d in line.split('x')) for line in data.splitlines()
if line.strip()]
total = 0
for l, w, h in orders:
area = (2 * l * w) + (2 * w * h) + (2 * h * l)
slack = min(a * b for a, b ... | [
"logging.basicConfig",
"itertools.combinations",
"argparse.ArgumentParser"
] | [((985, 1044), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""AoC 2015-02 Solution"""'}), "(description='AoC 2015-02 Solution')\n", (1008, 1044), False, 'import argparse\n'), ((1739, 1779), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DE... |
from typing import Dict
from lightbus.exceptions import (
UnknownApi,
InvalidApiRegistryEntry,
EventNotFound,
MisconfiguredApiOptions,
InvalidApiEventConfiguration,
)
__all__ = ["Api", "Event"]
class ApiRegistry:
def __init__(self):
self._apis: Dict[str, Api] = dict()
def add(s... | [
"lightbus.exceptions.InvalidApiRegistryEntry",
"lightbus.exceptions.MisconfiguredApiOptions"
] | [((390, 671), 'lightbus.exceptions.InvalidApiRegistryEntry', 'InvalidApiRegistryEntry', (['"""An attempt was made to add a type to the API registry. This is probably because you are trying to add the API class, rather than an instance of the API class.\n\nUse bus.client.register_api(MyApi()), rather than bus.client.reg... |
from django import forms
from base.models import Developer
class RegistrationForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput())
password2 = forms.CharField(widget=forms.PasswordInput())
class Meta:
model = Developer
fields = 'username', 'password', '<PASSWORD... | [
"django.forms.PasswordInput"
] | [((141, 162), 'django.forms.PasswordInput', 'forms.PasswordInput', ([], {}), '()\n', (160, 162), False, 'from django import forms\n'), ((203, 224), 'django.forms.PasswordInput', 'forms.PasswordInput', ([], {}), '()\n', (222, 224), False, 'from django import forms\n')] |
import logging
from aioscrapy.utils.reqser import request_to_dict, request_from_dict
from .serializ import PickleCompat
logger = logging.getLogger(__name__)
_to_str = lambda x: x if isinstance(x, str) else str(x)
class Base(object):
"""Per-spider base queue class"""
def __init__(self, serve... | [
"logging.getLogger",
"aioscrapy.utils.reqser.request_to_dict",
"aioscrapy.utils.reqser.request_from_dict"
] | [((138, 165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'import logging\n'), ((1499, 1536), 'aioscrapy.utils.reqser.request_to_dict', 'request_to_dict', (['request', 'self.spider'], {}), '(request, self.spider)\n', (1514, 1536), False, 'from aioscrapy.utils.reqser ... |
#!/usr/bin/python
import serial
import sys
import time
def main():
while True:
ser = serial.Serial('/dev/ttyACM0', 9600, timeout=5000)
last_time = time.time()
while True:
tag = ser.readline().strip()
new_time = time.time()
print('%s %s'%(tag, new_time - ... | [
"serial.Serial",
"time.time"
] | [((99, 148), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""', '(9600)'], {'timeout': '(5000)'}), "('/dev/ttyACM0', 9600, timeout=5000)\n", (112, 148), False, 'import serial\n'), ((169, 180), 'time.time', 'time.time', ([], {}), '()\n', (178, 180), False, 'import time\n'), ((265, 276), 'time.time', 'time.time', ... |
#!/usr/bin/env python3
#
# Copyright 2017 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Unittests for output archive plugin."""
import copy
import glob
import logging
import os
import resource
import shutil
import... | [
"tarfile.open",
"copy.deepcopy",
"cros.factory.instalog.datatypes.Event",
"resource.getrusage",
"os.close",
"psutil.Process",
"os.path.join",
"time.sleep",
"cros.factory.instalog.plugin_sandbox.PluginSandbox",
"cros.factory.instalog.log_utils.GetStreamHandler",
"tempfile.mkdtemp",
"cros.factor... | [((4088, 4103), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4101, 4103), False, 'import unittest\n'), ((650, 668), 'cros.factory.instalog.testing.MockCore', 'testing.MockCore', ([], {}), '()\n', (666, 668), False, 'from cros.factory.instalog import testing\n'), ((729, 780), 'tempfile.mkdtemp', 'tempfile.mkdtem... |
import json
import datetime as dt
import platform
from ..pydata_lib import test_glob # example of relative import
def print_machine_stats():
try:
from ..pydata_lib import test_glob
except RuntimeError:
print('relative import failed')
print(dt.datetime.now())
print(platform.version())
... | [
"platform.version",
"platform.uname",
"datetime.datetime.now",
"platform.system",
"platform.processor",
"platform.machine"
] | [((271, 288), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (286, 288), True, 'import datetime as dt\n'), ((300, 318), 'platform.version', 'platform.version', ([], {}), '()\n', (316, 318), False, 'import platform\n'), ((330, 346), 'platform.uname', 'platform.uname', ([], {}), '()\n', (344, 346), False, ... |
import itertools
from unittest.mock import patch
import pytest
from pandas_addons.register import DEFAULT_PANDAS_OBJECTS, accessors, register
class TestRegister:
def test_should_return_input_function(self):
def accessor():
pass
assert accessor == register()(accessor)
@patch.dic... | [
"itertools.combinations",
"pandas_addons.register.register",
"unittest.mock.patch.dict"
] | [((311, 348), 'unittest.mock.patch.dict', 'patch.dict', (['accessors', '{}'], {'clear': '(True)'}), '(accessors, {}, clear=True)\n', (321, 348), False, 'from unittest.mock import patch\n'), ((577, 614), 'unittest.mock.patch.dict', 'patch.dict', (['accessors', '{}'], {'clear': '(True)'}), '(accessors, {}, clear=True)\n'... |
import os
DATA_URL_ROOT = 'http://www.earthsystemmodeling.org/download/data'
# If fname doesn't exist, retrieve it from the remote server via http.
def cache_data_file(fname, DATA_URL_ROOT=DATA_URL_ROOT):
import sys
if sys.version_info[0] >= 3:
from urllib.request import urlopen, URLError
else:
... | [
"os.path.exists",
"urllib2.urlopen",
"shutil.copyfileobj",
"os.path.join",
"os.path.basename",
"os.mkdir"
] | [((1360, 1392), 'os.path.join', 'os.path.join', (['"""examples"""', '"""data"""'], {}), "('examples', 'data')\n", (1372, 1392), False, 'import os\n'), ((433, 454), 'os.path.exists', 'os.path.exists', (['fname'], {}), '(fname)\n', (447, 454), False, 'import os\n'), ((1404, 1427), 'os.path.exists', 'os.path.exists', (['d... |
import pyEX as p
from datetime import timedelta
from functools import lru_cache
from .utils import last_month, last_close
from .fetch import fetch, \
fetchStats as backfillStats, \
fetchPeers as backfillPeers, \
fetchNews as backfillNews, \
fet... | [
"functools.lru_cache",
"datetime.timedelta"
] | [((1309, 1324), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (1318, 1324), False, 'from functools import lru_cache\n'), ((1439, 1456), 'datetime.timedelta', 'timedelta', ([], {'days': '(1)'}), '(days=1)\n', (1448, 1456), False, 'from datetime import timedelta\n')] |
from __future__ import absolute_import, unicode_literals
import sys
import functools
import json
import click
from polyswarm.formatters import base
def is_grouped(fn):
@functools.wraps(fn)
def wrapper(self, text):
return self._depth*'\t'+fn(self, text)
return wrapper
class TextOutput(base.Bas... | [
"json.dumps",
"click.style",
"functools.wraps"
] | [((177, 196), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (192, 196), False, 'import functools\n'), ((14924, 14953), 'click.style', 'click.style', (['text'], {'fg': '"""white"""'}), "(text, fg='white')\n", (14935, 14953), False, 'import click\n'), ((15015, 15045), 'click.style', 'click.style', (['text... |
# Generated by Django 2.2 on 2020-11-19 20:46
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('paper', '0069_remove_paper_sift_risk_score'),
]
operations = [
migrations.AddField(
model_name='paper',
name='is_remov... | [
"django.db.models.BooleanField"
] | [((351, 446), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Hides the paper because it is not allowed."""'}), "(default=False, help_text=\n 'Hides the paper because it is not allowed.')\n", (370, 446), False, 'from django.db import migrations, models\n')] |
import pickle
from multiprocessing.pool import ThreadPool as Pool
import utils
with open('file.pkl', 'rb') as file:
myvar = pickle.load(file)
print(len(myvar["GLOBAL_absolute_download_url"]))
def download(absolute_download_url, downloaded_file_path, auth, headers, verify_peer_certificate, proxies):
try:
... | [
"multiprocessing.pool.ThreadPool",
"pickle.load",
"utils.http_download_binary_file"
] | [((130, 147), 'pickle.load', 'pickle.load', (['file'], {}), '(file)\n', (141, 147), False, 'import pickle\n'), ((660, 680), 'multiprocessing.pool.ThreadPool', 'Pool', ([], {'processes': '(1000)'}), '(processes=1000)\n', (664, 680), True, 'from multiprocessing.pool import ThreadPool as Pool\n'), ((328, 457), 'utils.http... |
import markdown2
import re
import os
from os.path import splitext
link_patterns = [(re.compile(
r'((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+(:[0-9]+)?|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)'), r'\1')]
head = "<!DOC... | [
"os.listdir",
"os.path.splitext",
"re.compile"
] | [((518, 546), 'os.listdir', 'os.listdir', (["(f'./' + md_input)"], {}), "(f'./' + md_input)\n", (528, 546), False, 'import os\n'), ((86, 332), 're.compile', 're.compile', (['"""((([A-Za-z]{3,9}:(?:\\\\/\\\\/)?)(?:[\\\\-;:&=\\\\+\\\\$,\\\\w]+@)?[A-Za-z0-9\\\\.\\\\-]+(:[0-9]+)?|(?:www\\\\.|[\\\\-;:&=\\\\+\\\\$,\\\\w]+@)[... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.autograd as autograd
import torch.optim as optim
import pre_process as pp
inputs, outputs = pp.get_data()
class Model(nn.Module):
def __init__(self):
super(Model, self).__init__()
self.layer1 = nn.Linear(6, 6)
... | [
"torch.cuda.FloatTensor",
"torch.load",
"torch.nn.MSELoss",
"torch.nn.Linear",
"pre_process.get_data"
] | [((175, 188), 'pre_process.get_data', 'pp.get_data', ([], {}), '()\n', (186, 188), True, 'import pre_process as pp\n'), ((1275, 1287), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1285, 1287), True, 'import torch.nn as nn\n'), ((1169, 1199), 'torch.cuda.FloatTensor', 'torch.cuda.FloatTensor', (['inputs'], {}), ... |
from models import MobiNetV3
from models.Core import Config
import os
from glob import glob
config = Config()
model = MobiNetV3.FastModel(config)
config.WEIGHTS_FILE = "weights/MobiNetV3/weight-0.73.h5"
if __name__ == "__main__":
#model.test_image("FastDetector/datasets/10_rosbag/images/1565608339175915704.jpg")
... | [
"models.Core.Config",
"models.MobiNetV3.FastModel",
"glob.glob"
] | [((101, 109), 'models.Core.Config', 'Config', ([], {}), '()\n', (107, 109), False, 'from models.Core import Config\n'), ((118, 145), 'models.MobiNetV3.FastModel', 'MobiNetV3.FastModel', (['config'], {}), '(config)\n', (137, 145), False, 'from models import MobiNetV3\n'), ((342, 394), 'glob.glob', 'glob', (['"""FastDete... |
#!/usr/bin/env python
from wand.image import Image
from wand.drawing import Drawing
from wand.color import Color
# http://www.imagemagick.org/Usage/draw/#colorspace
# original imagemagick command:
# convert -size 81x81 xc:black -fill white -draw 'circle 40,40 40,3' \
# circle_raw.png
#
# convert -size 81x81 ... | [
"wand.image.Image",
"wand.drawing.Drawing",
"wand.color.Color"
] | [((580, 594), 'wand.color.Color', 'Color', (['"""black"""'], {}), "('black')\n", (585, 594), False, 'from wand.color import Color\n'), ((601, 645), 'wand.image.Image', 'Image', ([], {'width': 'w', 'height': 'h', 'background': 'bgcolor'}), '(width=w, height=h, background=bgcolor)\n', (606, 645), False, 'from wand.image ... |
import unittest
from src.lambda_ackermann_recursive import ackermann
import test.ackermann.basetests_ackermann as BT
def call_function(a: int, b: int) -> int:
return ackermann(a, b)
class Test_ValidInput(unittest.TestCase, BT.ValidInput):
def base_function(self, a, b):
return call_function(a, b)
c... | [
"unittest.main",
"src.lambda_ackermann_recursive.ackermann"
] | [((172, 187), 'src.lambda_ackermann_recursive.ackermann', 'ackermann', (['a', 'b'], {}), '(a, b)\n', (181, 187), False, 'from src.lambda_ackermann_recursive import ackermann\n'), ((730, 745), 'unittest.main', 'unittest.main', ([], {}), '()\n', (743, 745), False, 'import unittest\n')] |
'''
objective :-
------------
detect and classify shapes and their location in an image with low latency and high accuracy.
it must account for false positives and empty images.
modules used :-
---------------
1 - open cv for image processing tasks.
2 - easyocr for text-recognition tasks.
3 - threading for running tex... | [
"cv2.cv2.getRotationMatrix2D",
"cv2.cv2.warpAffine",
"cv2.cv2.imread",
"time.perf_counter",
"AlphanumericCharacterDetection.recogniser.Recognize",
"numpy.array"
] | [((2094, 2143), 'cv2.cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (2117, 2143), False, 'from cv2 import cv2\n'), ((2154, 2228), 'cv2.cv2.warpAffine', 'cv2.warpAffine', (['image', 'rot_mat', 'image.shape[1::-1]'], {'flags': 'cv2.INTER_LINE... |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.conf import settings
from haystack.indexes import Indexable
from opps.containers.search_indexes import ContainerIndex
from .models import Post, Album, Link
migration_date = getattr(settings, 'MIGRATION_DATE', None)
if migration_date:
m_date = ... | [
"datetime.datetime.strptime"
] | [((320, 365), 'datetime.datetime.strptime', 'datetime.strptime', (['migration_date', '"""%Y-%m-%d"""'], {}), "(migration_date, '%Y-%m-%d')\n", (337, 365), False, 'from datetime import datetime\n')] |
from gbe.forms import ParticipantForm
from django.forms import (
ChoiceField,
MultipleChoiceField,
)
from gbe_forms_text import (
how_heard_options,
participant_labels,
)
from gbetext import (
act_casting_label,
states_options,
)
from scheduler.idd import get_occurrences
from gbe.models import S... | [
"gbe.forms.ParticipantForm",
"django.forms.ChoiceField",
"gbe.views.act_display_functions.get_act_casting",
"gbe.models.Show.objects.filter",
"django.forms.MultipleChoiceField"
] | [((466, 659), 'gbe.forms.ParticipantForm', 'ParticipantForm', ([], {'instance': 'profile', 'initial': "{'email': profile.user_object.email, 'first_name': profile.user_object.\n first_name, 'last_name': profile.user_object.last_name}", 'prefix': 'prefix'}), "(instance=profile, initial={'email': profile.user_object.\n... |
from __future__ import annotations
import typing
from ctc import spec
from ctc.protocols import balancer_utils
from .. import analytics_spec
async def async_compute_buybacks(
blocks: list[int], verbose: bool = False
) -> analytics_spec.MetricGroup:
return {
'name': 'Buybacks',
'metrics': {... | [
"ctc.protocols.balancer_utils.async_get_pool_swaps"
] | [((662, 761), 'ctc.protocols.balancer_utils.async_get_pool_swaps', 'balancer_utils.async_get_pool_swaps', ([], {'pool_address': '"""0xc1382fe6e17bcdbc3d35f73f5317fbf261ebeecd"""'}), "(pool_address=\n '0xc1382fe6e17bcdbc3d35f73f5317fbf261ebeecd')\n", (697, 761), False, 'from ctc.protocols import balancer_utils\n')] |
from django.contrib import admin
from cameras.models import Camera
# Register your models here.
admin.site.register(Camera)
| [
"django.contrib.admin.site.register"
] | [((97, 124), 'django.contrib.admin.site.register', 'admin.site.register', (['Camera'], {}), '(Camera)\n', (116, 124), False, 'from django.contrib import admin\n')] |
"""This module provides Python bindings for the Discovery API of DGILib."""
from ctypes import byref, create_string_buffer
from pydgilib.dgilib_config import GET_STRING_SIZE
from pydgilib.dgilib_exceptions import DeviceReturnError
class DGILibDiscovery(object):
"""Python bindings for DGILib Discovery.
DGIL... | [
"ctypes.byref",
"pydgilib.dgilib_exceptions.DeviceReturnError",
"ctypes.create_string_buffer"
] | [((4280, 4317), 'ctypes.create_string_buffer', 'create_string_buffer', (['GET_STRING_SIZE'], {}), '(GET_STRING_SIZE)\n', (4300, 4317), False, 'from ctypes import byref, create_string_buffer\n'), ((5424, 5461), 'ctypes.create_string_buffer', 'create_string_buffer', (['GET_STRING_SIZE'], {}), '(GET_STRING_SIZE)\n', (5444... |
import math
def primdist(x):
return max([abs(xj - math.floor(xj + 0.5)) for xj in x])
| [
"math.floor"
] | [((53, 73), 'math.floor', 'math.floor', (['(xj + 0.5)'], {}), '(xj + 0.5)\n', (63, 73), False, 'import math\n')] |
"""
Custom added maze tasks with dense rewards and progressively farther goals
For creating expert demonstrations
"""
from typing import Dict, List, Type, Tuple
import numpy as np
from mujoco_maze.custom_maze_task import (
GoalRewardLargeUMaze,
GoalRewardRoom3x5,
GoalRewardRoom3x10,
)
from mujoco_maze.t... | [
"mujoco_maze.task_common.euc_dist",
"mujoco_maze.task_common.RewardThresholdList",
"numpy.argmax",
"numpy.sum",
"numpy.array"
] | [((4318, 4357), 'mujoco_maze.task_common.RewardThresholdList', 'RewardThresholdList', (['[-70]', '[-70]', 'None'], {}), '([-70], [-70], None)\n', (4337, 4357), False, 'from mujoco_maze.task_common import MazeGoal, MazeTask, GREEN, euc_dist, RewardThresholdList\n'), ((4397, 4455), 'mujoco_maze.task_common.RewardThreshol... |
#!/usr/bin/env python3
import argparse
import json
import logging
import socket
import socketserver
import time
from collections import deque
from queue import Queue
from threading import Thread
import Ice
logger = logging.getLogger(__name__)
def retrieve_server_state():
try:
import mice3 as mice
... | [
"logging.getLogger",
"logging.basicConfig",
"collections.deque",
"logging.debug",
"argparse.ArgumentParser",
"json.dumps",
"time.sleep",
"threading.Thread",
"queue.Queue",
"logging.info"
] | [((219, 246), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (236, 246), False, 'import logging\n'), ((2448, 2473), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2471, 2473), False, 'import argparse\n'), ((3056, 3154), 'logging.basicConfig', 'logging.basicConfig... |
import cv2
import numpy as np
img1 = cv2.imread('3D-Matplotlib.png')
img2 = cv2.imread('mainlogo.png')
# THREE DIFFERENT WAYS OF ADDING TWO PICTURE
#1
#add = img1+ img2
#2
#img = cv2.add(img1,img2) # USING BUILT IN FUNCTION OF CV2 TO ADD TWO IMAGES
#3
#weighted_add = cv2.addWeighted(img1, 0.6, img2,... | [
"cv2.threshold",
"cv2.bitwise_and",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.bitwise_not",
"cv2.imread",
"cv2.add"
] | [((41, 72), 'cv2.imread', 'cv2.imread', (['"""3D-Matplotlib.png"""'], {}), "('3D-Matplotlib.png')\n", (51, 72), False, 'import cv2\n'), ((81, 107), 'cv2.imread', 'cv2.imread', (['"""mainlogo.png"""'], {}), "('mainlogo.png')\n", (91, 107), False, 'import cv2\n'), ((505, 543), 'cv2.cvtColor', 'cv2.cvtColor', (['img2', 'c... |
from typing import Optional, Dict, List, Any
from itertools import product
from paper.experiments.global_variables import TRAINING_DATASET_FRACTIONS
########################################################################################################################
# 3. APP.G.2 (Variants: Cool-down epochs)
######... | [
"itertools.product"
] | [((868, 932), 'itertools.product', 'product', (["['II', 'III', 'IV']", 'TRAINING_DATASET_FRACTIONS', '[5, 9]'], {}), "(['II', 'III', 'IV'], TRAINING_DATASET_FRACTIONS, [5, 9])\n", (875, 932), False, 'from itertools import product\n')] |
from rest_framework import exceptions
from rest_framework import status
from rest_framework.response import Response
from django.core.exceptions import PermissionDenied as DjangoPermissionDenied
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from django.http impor... | [
"django.utils.encoding.force_text",
"rest_framework.response.Response",
"django.utils.translation.ugettext_lazy"
] | [((445, 466), 'django.utils.translation.ugettext_lazy', '_', (['"""Unexpected error"""'], {}), "('Unexpected error')\n", (446, 466), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((723, 738), 'django.utils.translation.ugettext_lazy', '_', (['"""Not found."""'], {}), "('Not found.')\n", (724, 738),... |
"""Tests for qnaplxdunpriv.py
"""
# pylint: disable=missing-function-docstring
import grp
import os
import pathlib
import pwd
import re
import subprocess
import pytest
from qnaplxdunpriv import FileAclError, set_uids, unset_uids
import qnaplxdunpriv
_TEST_UID = 10000
_TEST_FILE = 'file'
_OWNER_GROUP_RE = re.compil... | [
"re.compile",
"subprocess.run",
"qnaplxdunpriv.main",
"qnaplxdunpriv.CONTAINER_DEFAULT.lstrip",
"pytest.fail",
"pytest.mark.parametrize",
"qnaplxdunpriv.unset_uids",
"pytest.raises",
"pwd.getpwuid",
"os.stat",
"qnaplxdunpriv.STATION_DEFAULT.lstrip",
"grp.getgrgid",
"qnaplxdunpriv.set_uids"
] | [((311, 362), 're.compile', 're.compile', (['"""^group::([r-][w-][x-])$"""', 're.MULTILINE'], {}), "('^group::([r-][w-][x-])$', re.MULTILINE)\n", (321, 362), False, 'import re\n'), ((367, 473), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode,user_perms,group_perms"""', "[('770', 'r-x', 'rwx'), ('640', ... |
from functools import lru_cache
import math
import logging
from enum import Enum
from typing import Optional, List, Tuple, Any, Union, Dict, Callable
from concurrent.futures import ThreadPoolExecutor
from io import BytesIO
import requests
import numpy as np
from google.api_core import retry
from PIL import Image
from ... | [
"logging.getLogger",
"pygeotile.point.Point.from_latitude_longitude",
"pygeotile.point.Point.from_pixel",
"math.tan",
"pydantic.validator",
"numpy.hstack",
"concurrent.futures.ThreadPoolExecutor",
"pygeotile.point.Point.from_meters",
"io.BytesIO",
"math.radians",
"numpy.max",
"numpy.array",
... | [((765, 792), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (782, 792), False, 'import logging\n'), ((1532, 1551), 'pydantic.validator', 'validator', (['"""bounds"""'], {}), "('bounds')\n", (1541, 1551), False, 'from pydantic import BaseModel, validator\n'), ((3019, 3035), 'pydantic.vali... |
import unittest
import time
import httpagentparser
detect = httpagentparser.detect
simple_detect = httpagentparser.simple_detect
data = (
# tuple of tuples
# tuple (agent-string, expected result of simple_detect, expected result of detect)
("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Ge... | [
"unittest.main",
"time.time"
] | [((17350, 17365), 'unittest.main', 'unittest.main', ([], {}), '()\n', (17363, 17365), False, 'import unittest\n'), ((16219, 16230), 'time.time', 'time.time', ([], {}), '()\n', (16228, 16230), False, 'import time\n'), ((16343, 16354), 'time.time', 'time.time', ([], {}), '()\n', (16352, 16354), False, 'import time\n')] |
"""Distributed Extension"""
import re
import os
import sys
try:
import drmaa
except:
pass
import itertools
import argparse
from cement.core import backend, handler, hook
from scilifelab.pm.core import command
LOG = backend.minimal_logger(__name__)
class DistributedCommandHandler(command.CommandHandler):
... | [
"os.path.exists",
"os.getenv",
"os.path.join",
"cement.core.handler.register",
"os.path.isdir",
"cement.core.hook.register",
"cement.core.backend.minimal_logger",
"os.path.abspath",
"drmaa.Session",
"re.search"
] | [((226, 258), 'cement.core.backend.minimal_logger', 'backend.minimal_logger', (['__name__'], {}), '(__name__)\n', (248, 258), False, 'from cement.core import backend, handler, hook\n'), ((7977, 8033), 're.search', 're.search', (['"""(^[0-9]+\\\\-)?([0-9]+:)?([0-9]+):([0-9]+)"""', 't'], {}), "('(^[0-9]+\\\\-)?([0-9]+:)?... |
from game_data_gatherer import GameDataGatherer
class GameAnalyzer:
def __add__(self, other):
if not isinstance(other, GameAnalyzer):
raise Exception("Invalid operation '__add__' on type " + str(type(self)) + " and " + str(type(other)))
for team in other.analysis:
... | [
"game_data_gatherer.GameDataGatherer"
] | [((1516, 1541), 'game_data_gatherer.GameDataGatherer', 'GameDataGatherer', (['gameUrl'], {}), '(gameUrl)\n', (1532, 1541), False, 'from game_data_gatherer import GameDataGatherer\n')] |
# coding: utf-8
"""
turktools tests
mitcho (<NAME>), <EMAIL>, May 2013
The MIT License (MIT)
Copyright (c) 2013 <NAME>
See readme for license block
"""
from __future__ import print_function
import unittest, sys
# todo: import doctest
runner = unittest.TextTestRunner(verbosity=1 + sys.argv.count('-v... | [
"sys.argv.count",
"unittest.TestLoader"
] | [((333, 354), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (352, 354), False, 'import unittest, sys\n'), ((302, 322), 'sys.argv.count', 'sys.argv.count', (['"""-v"""'], {}), "('-v')\n", (316, 322), False, 'import unittest, sys\n')] |
import collections
from supriya.enums import CalculationRate
from supriya.synthdefs import UGen
class PulseDivider(UGen):
"""
::
>>> pulse_divider = supriya.ugens.PulseDivider.ar(
... div=2,
... start=0,
... trigger=0,
... )
>>> pulse_divider
... | [
"collections.OrderedDict",
"supriya.synthdefs.UGen.__init__"
] | [((411, 461), 'collections.OrderedDict', 'collections.OrderedDict', (['"""trigger"""', '"""div"""', '"""start"""'], {}), "('trigger', 'div', 'start')\n", (434, 461), False, 'import collections\n'), ((693, 790), 'supriya.synthdefs.UGen.__init__', 'UGen.__init__', (['self'], {'calculation_rate': 'calculation_rate', 'div'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2020-06-30 10:19:04
# @Author : gwentmaster(<EMAIL>)
# I regret in my life
"""summary
"""
import json
import os
import re
from collections import defaultdict
from typing import Any, Dict, List, Generator, Union
import click
TEMPLATE = "INSERT INTO {tabl... | [
"click.argument",
"re.compile",
"click.option",
"json.dumps",
"os.path.isfile",
"collections.defaultdict",
"json.load",
"click.command"
] | [((5105, 5120), 'click.command', 'click.command', ([], {}), '()\n', (5118, 5120), False, 'import click\n'), ((5122, 5144), 'click.argument', 'click.argument', (['"""file"""'], {}), "('file')\n", (5136, 5144), False, 'import click\n'), ((5146, 5222), 'click.option', 'click.option', (['"""--reverse"""'], {'is_flag': '(Tr... |
import numpy
import time
import threading
import matplotlib.pyplot
from matplotlib.animation import FuncAnimation
class VisualizationWindow:
def __init__(self, signal_collector):
self.figure, self.axes = matplotlib.pyplot.subplots(7, 1, sharex=True)
self.figure.subplots_adjust(hspace=0)
... | [
"matplotlib.animation.FuncAnimation",
"numpy.array",
"time.time"
] | [((3421, 3432), 'time.time', 'time.time', ([], {}), '()\n', (3430, 3432), False, 'import time\n'), ((3562, 3634), 'matplotlib.animation.FuncAnimation', 'FuncAnimation', (['self.figure', 'self.update_plots'], {'interval': '(1000)', 'blit': '(False)'}), '(self.figure, self.update_plots, interval=1000, blit=False)\n', (35... |
from math import trunc
num=float(input('Digite um número: '))
truncado=trunc(num)
print('O resultado truncado de {} é {}.'.format(num,truncado))
| [
"math.trunc"
] | [((71, 81), 'math.trunc', 'trunc', (['num'], {}), '(num)\n', (76, 81), False, 'from math import trunc\n')] |
import graphene
from graphql_extensions.auth.decorators import login_required
from ..helpers.permission_required import role_required, token_required
from ..helpers.validate_object_id import validate_object_id
from ..helpers.validation_errors import error_dict
from ..helpers.constants import SUCCESS_ACTION
from .model... | [
"graphene.String",
"graphene.Field"
] | [((875, 899), 'graphene.Field', 'graphene.Field', (['BookType'], {}), '(BookType)\n', (889, 899), False, 'import graphene\n'), ((913, 930), 'graphene.String', 'graphene.String', ([], {}), '()\n', (928, 930), False, 'import graphene\n'), ((945, 962), 'graphene.String', 'graphene.String', ([], {}), '()\n', (960, 962), Fa... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import h5py as h5
import os.path as fs
import keras
from keras.models import Sequential
from keras.utils import np_utils
from keras.layers.core import Dense, Activation, Dropout
from sklearn.model_selection import trai... | [
"sklearn.metrics.f1_score",
"keras.layers.core.Activation",
"sklearn.decomposition.PCA",
"os.path.join",
"numpy.heaviside",
"keras.models.Sequential",
"keras.optimizers.SGD",
"keras.utils.np_utils.to_categorical",
"numpy.empty",
"umap.UMAP",
"sklearn.preprocessing.scale",
"keras.layers.core.De... | [((1697, 1729), 'numpy.empty', 'np.empty', (['(n, 1)'], {'dtype': 'np.int32'}), '((n, 1), dtype=np.int32)\n', (1705, 1729), True, 'import numpy as np\n'), ((1871, 1902), 'keras.utils.np_utils.to_categorical', 'np_utils.to_categorical', (['labels'], {}), '(labels)\n', (1894, 1902), False, 'from keras.utils import np_uti... |
import os
from datetime import timedelta
from typing import Any
class Track(object):
def __init__(self, id: str, title: str, url: str, duration: Any, filename: str):
self.id = id
self.title = title
self.url = url
self.duration = int(duration)
self.filename = filename
... | [
"os.path.isfile",
"datetime.timedelta"
] | [((771, 800), 'os.path.isfile', 'os.path.isfile', (['self.filename'], {}), '(self.filename)\n', (785, 800), False, 'import os\n'), ((424, 456), 'datetime.timedelta', 'timedelta', ([], {'seconds': 'self.duration'}), '(seconds=self.duration)\n', (433, 456), False, 'from datetime import timedelta\n'), ((647, 679), 'dateti... |
"""
Builds wheel files for the dependencies of an app, specified in requirements.txt, into the wheels/
folder of the app repo, and updates the app's JSON config specifying any generated wheels as pip
dependencies.
NOTE: If running this script with the --repair_wheels flag, make sure the script is executed from
a manyl... | [
"logging.getLogger",
"re.compile",
"logging.exception",
"random.choices",
"logging.info",
"logging.error",
"os.remove",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"pathlib.Path",
"subprocess.run",
"os.mkdir",
"collections.namedtuple",
"logging.warning",
"os.path.join",
... | [((665, 837), 're.compile', 're.compile', (['"""^(?P<distribution>([A-Z0-9][A-Z0-9._-]*[A-Z0-9]))-([0-9]+\\\\.?)+-(?P<python_version>[A-Z0-9]+\\\\.?[A-Z0-9]+)-.+-(?P<platform>.+)\\\\.whl$"""', 're.IGNORECASE'], {}), "(\n '^(?P<distribution>([A-Z0-9][A-Z0-9._-]*[A-Z0-9]))-([0-9]+\\\\.?)+-(?P<python_version>[A-Z0-9]+\... |
#!/usr/bin/env python
'''
kmer-collapse.py
Starting with a set of kmers using a standard DNA alphabet (ACTG), collapse
it to an encoded, optimized set using IUPAC-derived, degenerate base alphabet.
'''
import sys
import json
import itertools as it
import marisa_trie as mt
"""
Generate all subsets of specified set. ... | [
"json.dumps",
"marisa_trie.Trie"
] | [((3729, 3743), 'marisa_trie.Trie', 'mt.Trie', (['input'], {}), '(input)\n', (3736, 3743), True, 'import marisa_trie as mt\n'), ((7556, 7584), 'json.dumps', 'json.dumps', (['result'], {'indent': '(4)'}), '(result, indent=4)\n', (7566, 7584), False, 'import json\n')] |
import unittest
from conpype import Pipeline, InitTask
import base64
import os
import subprocess
from conpype.utils.docker_daemon import START_SCRIPT, STOP_SCRIPT
from conpype.concourse.__shared import set_concourse_context
from contextlib import contextmanager
@contextmanager
def concourse_ctx():
set_concourse_... | [
"conpype.concourse.__shared.set_concourse_context",
"os.path.join",
"base64.b64decode",
"os.path.dirname",
"os.path.basename",
"unittest.main",
"os.path.abspath",
"conpype.Pipeline"
] | [((306, 333), 'conpype.concourse.__shared.set_concourse_context', 'set_concourse_context', (['(True)'], {}), '(True)\n', (327, 333), False, 'from conpype.concourse.__shared import set_concourse_context\n'), ((436, 461), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (451, 461), False, 'import... |
import os
import cv2
import numpy as np
import tensorflow as tf
import tensorflow.compat.v1 as tf
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from flask_ngrok import run_with_ngrok
from flask import Flask,request,send_from_directory,render_template
# GLOBAL ACCESS
os.environ['TF_CPP_MIN_L... | [
"flask.render_template",
"flask.Flask",
"PIL.Image.new",
"numpy.array",
"PIL.ImageDraw.Draw",
"tensorflow.compat.v1.get_collection",
"tensorflow.compat.v1.get_default_graph",
"flask.send_from_directory",
"tensorflow.compat.v1.nn.ctc_greedy_decoder",
"numpy.asarray",
"PIL.ImageFont.truetype",
"... | [((414, 442), 'tensorflow.compat.v1.disable_eager_execution', 'tf.disable_eager_execution', ([], {}), '()\n', (440, 442), True, 'import tensorflow.compat.v1 as tf\n'), ((449, 484), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '""""""'}), "(__name__, static_url_path='')\n", (454, 484), False, 'from flask i... |
#!/usr/bin/python3
"""
Library for Raspberry Pi interfacing with the 16-Bit I/O Expander MCP23017
from Microchip Technology.
"""
__all__ = ["MCP23017", "LCD20x4"]
import time
import smbus
from collections import Iterable
class MCP23017:
"""
Class for the MCP23017 I/O port expander.
"""
REG_BASE_ADDR ... | [
"smbus.SMBus",
"time.sleep"
] | [((998, 1014), 'smbus.SMBus', 'smbus.SMBus', (['bus'], {}), '(bus)\n', (1009, 1014), False, 'import smbus\n'), ((8627, 8656), 'time.sleep', 'time.sleep', (['(delay_ms / 1000.0)'], {}), '(delay_ms / 1000.0)\n', (8637, 8656), False, 'import time\n')] |
from pyspark.sql import SparkSession
from pyspark.sql.functions import explode
from pyspark.sql.functions import split
spark = SparkSession \
.builder \
.appName("StructuredNetworkWordCount") \
.getOrCreate()
# Create DataFrame representing the stream of input lines from connection to localhost:9999
# "ID"... | [
"pyspark.sql.functions.split",
"pyspark.sql.SparkSession.builder.appName"
] | [((128, 186), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""StructuredNetworkWordCount"""'], {}), "('StructuredNetworkWordCount')\n", (156, 186), False, 'from pyspark.sql import SparkSession\n'), ((1142, 1165), 'pyspark.sql.functions.split', 'split', (['lines.value', '""" """'], {}),... |
import time,os,math,inspect,re,sys,random,argparse
from env import SenseEnv
from torch.autograd import Variable
import numpy as np
from itertools import count
from collections import namedtuple
from tensorboardX import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim a... | [
"torch.nn.ReLU",
"torch.nn.CrossEntropyLoss",
"numpy.random.rand",
"torch.max",
"torch.from_numpy",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.nn.functional.softmax",
"os.path.exists",
"torch.nn.BatchNorm2d",
"tensorboardX.SummaryWriter",
"argparse.ArgumentParser",
"numpy.asarray"... | [((408, 423), 'tensorboardX.SummaryWriter', 'SummaryWriter', ([], {}), '()\n', (421, 423), False, 'from tensorboardX import SummaryWriter\n'), ((438, 484), 'collections.namedtuple', 'namedtuple', (['"""SavedAction"""', "['action', 'value']"], {}), "('SavedAction', ['action', 'value'])\n", (448, 484), False, 'from colle... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 21 07:57:49 2021
@author: amts
"""
import networkx as nx
import random
from ant_colony import ant_colony
import math
size =16
#size = 4
G = nx.fast_gnp_random_graph(size, .3)
#G = nx.complete_graph(size)
#G = nx.binomial_tree(size)
for (u, v) i... | [
"ant_colony.ant_colony",
"networkx.get_edge_attributes",
"networkx.spring_layout",
"networkx.shortest_path_length",
"networkx.fast_gnp_random_graph",
"random.randint",
"networkx.draw"
] | [((215, 250), 'networkx.fast_gnp_random_graph', 'nx.fast_gnp_random_graph', (['size', '(0.3)'], {}), '(size, 0.3)\n', (239, 250), True, 'import networkx as nx\n'), ((458, 494), 'networkx.spring_layout', 'nx.spring_layout', (['G'], {'weight': '"""weight"""'}), "(G, weight='weight')\n", (474, 494), True, 'import networkx... |
#!/usr/bin/env python3
# Copyright 2021 Xiaomi Corporation (authors: <NAME>)
import kaldifst
# see also https://www.openfst.org/twiki/bin/view/FST/DeterminizeDoc
def test_determinize():
isym = kaldifst.SymbolTable()
isym.add_symbol("<eps>", 0)
isym.add_symbol("a", 1)
isym.add_symbol("c", 2)
... | [
"kaldifst.compile",
"kaldifst.SymbolTable",
"kaldifst.determinize",
"kaldifst.draw"
] | [((208, 230), 'kaldifst.SymbolTable', 'kaldifst.SymbolTable', ([], {}), '()\n', (228, 230), False, 'import kaldifst\n'), ((359, 381), 'kaldifst.SymbolTable', 'kaldifst.SymbolTable', ([], {}), '()\n', (379, 381), False, 'import kaldifst\n'), ((660, 725), 'kaldifst.compile', 'kaldifst.compile', (['s'], {'acceptor': '(Fal... |
import requests # this is to GET the javascript
import re # this is to do regular expression and extract the list of words
import streamlit as st #web app development
m = st.markdown("""
<style>
div.stButton > button:first-child {
background-color: #0000FF;
color:#ffffff;
}
div.stButton > button:hover {
... | [
"streamlit.markdown",
"streamlit.balloons",
"streamlit.button",
"requests.get",
"streamlit.error",
"re.findall",
"streamlit.text_input",
"streamlit.title"
] | [((175, 420), 'streamlit.markdown', 'st.markdown', (['"""\n<style>\ndiv.stButton > button:first-child {\n background-color: #0000FF;\n color:#ffffff;\n}\ndiv.stButton > button:hover {\n background-color: #FF0000;\n color:##ff99ff;\n }\n</style>"""'], {'unsafe_allow_html': '(True)'}), '(\n """\n<style>... |
import pandas as pd
import re
import numpy as np
import os
import sys
from collections import OrderedDict, defaultdict
import matplotlib as mpl
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import stats, integrate
# load msncodes
msncodes = pd.read_csv("data/csv/original/msncodes.csv")
# load state ... | [
"pandas.DataFrame",
"collections.OrderedDict",
"pandas.read_csv",
"re.search"
] | [((261, 306), 'pandas.read_csv', 'pd.read_csv', (['"""data/csv/original/msncodes.csv"""'], {}), "('data/csv/original/msncodes.csv')\n", (272, 306), True, 'import pandas as pd\n'), ((331, 406), 'pandas.read_csv', 'pd.read_csv', (['"""data/csv/state_data/az_data.csv"""'], {'engine': '"""c"""', 'low_memory': '(True)'}), "... |
"""empty message
Revision ID: <KEY>
Revises: afacc23c2670
Create Date: 2019-11-27 09:22:33.188541
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "afacc23c2670"
branch_labels = None
depends_on = ... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.VARCHAR",
"sqlalchemy.dialects.postgresql.UUID",
"sqlalchemy.String",
"sqlalchemy.INTEGER",
"alembic.op.drop_index",
"sqlalchemy.dialects.postgresq... | [((412, 472), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_kind_images_id"""'], {'table_name': '"""kind_images"""'}), "('ix_kind_images_id', table_name='kind_images')\n", (425, 472), False, 'from alembic import op\n'), ((477, 542), 'alembic.op.drop_index', 'op.drop_index', (['"""ix_kind_images_kind_id"""'], {'tab... |
import unittest
import collections_and_iterators
""" Linked lists - TESTS
Testing Collections programming examples from collections.py
"""
class TestObjectMethods(unittest.TestCase):
def setUp(self):
self.singleLinkList = collections_and_iterators.SinglyLinkedList()
self.singleLink... | [
"unittest.main",
"collections_and_iterators.DoublyLinkedList",
"collections_and_iterators.SinglyLinkedList"
] | [((5045, 5071), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (5058, 5071), False, 'import unittest\n'), ((249, 293), 'collections_and_iterators.SinglyLinkedList', 'collections_and_iterators.SinglyLinkedList', ([], {}), '()\n', (291, 293), False, 'import collections_and_iterators\n'),... |
import os
import random
import pytest
from fastapi.testclient import TestClient
from jsonschema import Draft7Validator
from pathlib import Path
from main import app
from app.test.schema.schema_generator import test_generate_product_schema
client = TestClient(app)
current_path = Path(__file__).resolve().parent
@py... | [
"jsonschema.Draft7Validator",
"fastapi.testclient.TestClient",
"pathlib.Path"
] | [((251, 266), 'fastapi.testclient.TestClient', 'TestClient', (['app'], {}), '(app)\n', (261, 266), False, 'from fastapi.testclient import TestClient\n'), ((469, 505), 'pathlib.Path', 'Path', (['current_path', '"""img/"""', 'img_name'], {}), "(current_path, 'img/', img_name)\n", (473, 505), False, 'from pathlib import P... |
from sanic.response import json
from sanic import Blueprint
from sanic_openapi import doc
health_blueprint = Blueprint('health', url_prefix='/health', strict_slashes=True)
@health_blueprint.route('/', methods=['GET', 'OPTIONS'])
@doc.summary("Get health and stats about the service.")
@doc.produces(json)
async def h... | [
"sanic_openapi.doc.summary",
"sanic.response.json",
"sanic.Blueprint",
"sanic_openapi.doc.produces"
] | [((111, 173), 'sanic.Blueprint', 'Blueprint', (['"""health"""'], {'url_prefix': '"""/health"""', 'strict_slashes': '(True)'}), "('health', url_prefix='/health', strict_slashes=True)\n", (120, 173), False, 'from sanic import Blueprint\n'), ((234, 288), 'sanic_openapi.doc.summary', 'doc.summary', (['"""Get health and sta... |
"""The actual schema part of `json_schema`."""
from itertools import izip
from yape.json_schema.tokens import token_stream
json_types = (
list, dict, unicode, int, long, bool, type(None)
)
class SchemaError(Exception):
pass
class UnexpectedToken(SchemaError):
def __init__(self, token, expected=None... | [
"yape.json_schema.tokens.token_stream",
"itertools.izip"
] | [((935, 960), 'itertools.izip', 'izip', (['self.tokens', 'tokens'], {}), '(self.tokens, tokens)\n', (939, 960), False, 'from itertools import izip\n'), ((642, 661), 'yape.json_schema.tokens.token_stream', 'token_stream', (['value'], {}), '(value)\n', (654, 661), False, 'from yape.json_schema.tokens import token_stream\... |
import unittest
from lib_db import DBClient
class TestDBClient(unittest.TestCase):
client: DBClient
def setUp(self) -> None:
self.client = DBClient()
def test_integrity(self):
all_peer_ids = set(self.client.get_all_peer_ids())
online_peer_ids = set(self.client.get_online_peer_i... | [
"unittest.main",
"lib_db.DBClient._DBClient__flatten",
"lib_db.DBClient",
"pandas.DataFrame"
] | [((7464, 7479), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7477, 7479), False, 'import unittest\n'), ((159, 169), 'lib_db.DBClient', 'DBClient', ([], {}), '()\n', (167, 169), False, 'from lib_db import DBClient\n'), ((7341, 7382), 'lib_db.DBClient._DBClient__flatten', 'DBClient._DBClient__flatten', (['[(1,), ... |
import numpy as np
from sklearn import svm
class character:
def __init__(self, raw_character):
self.identity = None
def recognize(characters, classifier):
for char in characters:
data = np.reshape(char.image_centered, np.prod(char.image_centered.shape)).reshape(1, -1)
char.ide... | [
"numpy.prod"
] | [((253, 287), 'numpy.prod', 'np.prod', (['char.image_centered.shape'], {}), '(char.image_centered.shape)\n', (260, 287), True, 'import numpy as np\n')] |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import logging
def add2(item, mpc):
"""
主要入口
"""
items = listall2(item, mpc)
items = _filter(items, mpc)
return items
def _filter(items, mpc):
occupied = []
playlists = []
for item in items:
if 'playlist' in item:
try:... | [
"logging.debug"
] | [((1755, 1796), 'logging.debug', 'logging.debug', (['"""add single item:%s"""', 'item'], {}), "('add single item:%s', item)\n", (1768, 1796), False, 'import logging\n')] |
import datetime
SESSION_LIFETIME = datetime.timedelta(minutes=5)
| [
"datetime.timedelta"
] | [((35, 64), 'datetime.timedelta', 'datetime.timedelta', ([], {'minutes': '(5)'}), '(minutes=5)\n', (53, 64), False, 'import datetime\n')] |
# -*- coding: utf-8 -*-
from skimage.viewer import utils
from skimage.viewer.utils import dialogs
from skimage.viewer.qt import QtCore, QtGui, has_qt
from numpy.testing.decorators import skipif
@skipif(not has_qt)
def test_event_loop():
utils.init_qtapp()
timer = QtCore.QTimer()
timer.singleShot(10, QtGui... | [
"skimage.viewer.utils.init_qtapp",
"numpy.testing.decorators.skipif",
"skimage.viewer.utils.dialogs._format_filename",
"skimage.viewer.utils.dialogs.open_file_dialog",
"skimage.viewer.qt.QtCore.QTimer",
"skimage.viewer.utils.dialogs.save_file_dialog",
"skimage.viewer.utils.start_qtapp",
"skimage.viewe... | [((197, 215), 'numpy.testing.decorators.skipif', 'skipif', (['(not has_qt)'], {}), '(not has_qt)\n', (203, 215), False, 'from numpy.testing.decorators import skipif\n'), ((367, 385), 'numpy.testing.decorators.skipif', 'skipif', (['(not has_qt)'], {}), '(not has_qt)\n', (373, 385), False, 'from numpy.testing.decorators ... |
import sys
def utr_selection(transcripts, log):
"""UTR selection function"""
tmp = []
for t in transcripts:
t.utr5_exons = t.utr5_regions()
t.utr3_exons = t.utr3_regions()
t.utr5_start = t.start if t.strand == '+' else t.end - 1
t.utr3_end = t.end - 1 if t.strand == '+' el... | [
"sys.exit"
] | [((3944, 3963), 'sys.exit', 'sys.exit', (['"""Error 1"""'], {}), "('Error 1')\n", (3952, 3963), False, 'import sys\n'), ((5643, 5662), 'sys.exit', 'sys.exit', (['"""Error 2"""'], {}), "('Error 2')\n", (5651, 5662), False, 'import sys\n'), ((6991, 7010), 'sys.exit', 'sys.exit', (['"""Error 3"""'], {}), "('Error 3')\n", ... |
import multiprocessing
import os
import subprocess
import sys
import threading
import time
import sdat.tmp as sdat
try:
from Queue import Queue #for python2
except:
from queue import Queue #for python3
def cell():
print("")
print("######################################################################... | [
"sdat.tmp.merge_sam",
"multiprocessing.Process",
"sdat.tmp.merge_rmdup_log",
"sdat.tmp.merge_cell",
"sdat.tmp.merge_cell_log",
"sdat.tmp.split_sam_to_cell",
"sys.exit",
"os.path.exists",
"os.listdir",
"sdat.tmp.sam_rmdup",
"threading.Lock",
"subprocess.Popen",
"sdat.tmp.split_sam",
"sys.st... | [((6536, 6630), 'sdat.tmp.merge_sam', 'sdat.merge_sam', (["('%s/tmp/rmdup' % directory)", "('%s/%s_rmdup.sam' % (directory, pre))", 'chr_list'], {}), "('%s/tmp/rmdup' % directory, '%s/%s_rmdup.sam' % (directory,\n pre), chr_list)\n", (6550, 6630), True, 'import sdat.tmp as sdat\n'), ((6762, 6852), 'sdat.tmp.merge_sa... |
import json
from flask import Flask, request
import requests
# Token that has to be generated from webhook page portal
ACCESS_TOKEN = "random <PASSWORD>"
# Token that has to be added for verification with developer portal
VERIFICATION_TOKEN = "abc"
# Identifier payloads for initial button
C19INDIA = "C19INDIA"
app = Fl... | [
"flask.request.args.get",
"requests.post",
"flask.Flask",
"json.dumps",
"requests.get",
"flask.request.get_json"
] | [((318, 333), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (323, 333), False, 'from flask import Flask, request\n'), ((469, 505), 'flask.request.args.get', 'request.args.get', (['"""hub.verify_token"""'], {}), "('hub.verify_token')\n", (485, 505), False, 'from flask import Flask, request\n'), ((708, 726)... |
import os
from pathlib import Path
from django.apps import apps as django_apps
from django.conf import settings
from django.core.management.base import BaseCommand, CommandParser, DjangoHelpFormatter
from django.db.models import Model
from rich.align import Align
from rich.bar import Bar
from rich.console import Conso... | [
"rich.style.Style",
"django.apps.apps.get_models",
"pathlib.Path",
"rich.table.Table",
"rich.console.Console",
"django.apps.apps.get_app_config",
"os.path.basename",
"rich.bar.Bar",
"rich.padding.Padding",
"django.apps.apps.get_model"
] | [((1224, 1244), 'rich.console.Console', 'Console', ([], {'record': '(True)'}), '(record=True)\n', (1231, 1244), False, 'from rich.console import Console\n'), ((6402, 6449), 'rich.style.Style', 'Style', ([], {'color': '"""green"""', 'bold': '(True)', 'underline': '(True)'}), "(color='green', bold=True, underline=True)\n... |
from django.urls import path
from django.conf.urls import url,include
from . import views
urlpatterns = [
path('',views.indexView,name='index'),
] | [
"django.urls.path"
] | [((108, 147), 'django.urls.path', 'path', (['""""""', 'views.indexView'], {'name': '"""index"""'}), "('', views.indexView, name='index')\n", (112, 147), False, 'from django.urls import path\n')] |
# login.txt should contain address on first line and app specific password on the second
#
# <EMAIL>
# <PASSWORD>
def sendEmail(subject, message_):
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
with open("login.txt") as f:
login = f.read().... | [
"email.mime.multipart.MIMEMultipart",
"email.mime.text.MIMEText",
"smtplib.SMTP"
] | [((447, 462), 'email.mime.multipart.MIMEMultipart', 'MIMEMultipart', ([], {}), '()\n', (460, 462), False, 'from email.mime.multipart import MIMEMultipart\n'), ((598, 633), 'smtplib.SMTP', 'smtplib.SMTP', (['"""smtp.gmail.com"""', '(587)'], {}), "('smtp.gmail.com', 587)\n", (610, 633), False, 'import smtplib\n'), ((561,... |
from dockit import schema
from dockit import backends
from django.utils import unittest
from mock import Mock, patch
class SimpleSchema(schema.Schema): #TODO make a more complex testcase
charfield = schema.CharField()
class SimpleDocument(schema.Document): #TODO make a more complex testcase
charfield = sche... | [
"dockit.backends.get_document_backends",
"mock.Mock",
"mock.patch.object",
"dockit.schema.CharField",
"dockit.schema.BooleanField"
] | [((206, 224), 'dockit.schema.CharField', 'schema.CharField', ([], {}), '()\n', (222, 224), False, 'from dockit import schema\n'), ((316, 334), 'dockit.schema.CharField', 'schema.CharField', ([], {}), '()\n', (332, 334), False, 'from dockit import schema\n'), ((351, 372), 'dockit.schema.BooleanField', 'schema.BooleanFie... |
'''
Vidbull urlresolver plugin
Copyright (C) 2013 Vinnydude
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is di... | [
"re.search",
"urlresolver.plugnplay.interfaces.UrlResolver.ResolverError",
"t0mm0.common.net.Net"
] | [((1257, 1262), 't0mm0.common.net.Net', 'Net', ([], {}), '()\n', (1260, 1262), False, 'from t0mm0.common.net import Net\n'), ((1541, 1583), 're.search', 're.search', (['"""<source\\\\s+src="([^"]+)"""', 'html'], {}), '(\'<source\\\\s+src="([^"]+)\', html)\n', (1550, 1583), False, 'import re\n'), ((1859, 1887), 're.sear... |
from .utils import inverse as _inverse, gcd as _gcd
import itertools as _itertools
import re as _re
import copy as _copy
def affine_encrypt(msg, k, b):
res = ''
for c in msg:
if c.isalpha() == False:
res += c
continue
t = ord('A') if c.isupper() else ord('a')
re... | [
"itertools.permutations",
"itertools.cycle",
"copy.deepcopy"
] | [((1351, 1372), 'itertools.cycle', '_itertools.cycle', (['key'], {}), '(key)\n', (1367, 1372), True, 'import itertools as _itertools\n'), ((1761, 1782), 'itertools.cycle', '_itertools.cycle', (['key'], {}), '(key)\n', (1777, 1782), True, 'import itertools as _itertools\n'), ((6066, 6113), 'itertools.permutations', '_it... |
from pathlib import Path
from discord.ext import commands
from gainsworth.cogs.gainsworth_core import Gainsworth
bot = commands.Bot(command_prefix="$")
def test_logger():
g = Gainsworth(bot)
assert g.logger
def test_logfile():
path = Path("gainsworth_debug.log")
assert path.is_file()
| [
"discord.ext.commands.Bot",
"gainsworth.cogs.gainsworth_core.Gainsworth",
"pathlib.Path"
] | [((122, 154), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""$"""'}), "(command_prefix='$')\n", (134, 154), False, 'from discord.ext import commands\n'), ((184, 199), 'gainsworth.cogs.gainsworth_core.Gainsworth', 'Gainsworth', (['bot'], {}), '(bot)\n', (194, 199), False, 'from gainsworth.cogs.g... |
from flask import Flask
from celery import Celery
# Create App
app = Flask(__name__)
app.config.from_object('config.Config')
# Create pp return
from ppserver.pixel.models import PPFeedback
pp = PPFeedback()
# Create Celery object
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(a... | [
"celery.Celery",
"ppserver.pixel.models.PPFeedback",
"logging.Formatter",
"flask.Flask"
] | [((71, 86), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (76, 86), False, 'from flask import Flask\n'), ((197, 209), 'ppserver.pixel.models.PPFeedback', 'PPFeedback', ([], {}), '()\n', (207, 209), False, 'from ppserver.pixel.models import PPFeedback\n'), ((243, 299), 'celery.Celery', 'Celery', (['app.nam... |
# -*- coding: utf-8 -*-
"""
/dms/exercisefolder/views_sitemap.py
.. zeigt die Sitemap des aktuellen Lernarchivs an
Django content Management System
<NAME>
<EMAIL>
Die Programme des dms-Systems koennen frei genutzt und den spezifischen
Beduerfnissen entsprechend angepasst werden.
0.01 02.05.2008 Beginn de... | [
"dms.edufolder.utils.get_user_support",
"dms.queries.get_site_url",
"django.template.loader.get_template",
"django.shortcuts.render_to_response",
"django.template.Context",
"django.utils.translation.ugettext",
"dms.queries.get_container_sitemap"
] | [((2880, 2919), 'django.utils.translation.ugettext', '_', (['u"""Sitemap <i>dieses</i> Lernarchivs"""'], {}), "(u'Sitemap <i>dieses</i> Lernarchivs')\n", (2881, 2919), True, 'from django.utils.translation import ugettext as _\n'), ((2985, 3036), 'django.shortcuts.render_to_response', 'render_to_response', (['"""app/bas... |
import sys
if sys.version_info >= (2, 7):
import unittest
else:
try:
import unittest2 as unittest
except ImportError:
raise RuntimeError("unittest2 is required for Python < 2.7")
import sys
from twiggy import levels
class LevelTestCase(unittest.TestCase):
def test_display(self):
... | [
"unittest2.skipIf",
"twiggy.levels.name2level"
] | [((2891, 2968), 'unittest2.skipIf', 'unittest.skipIf', (['(sys.version_info < (3,))', '"""Python 2.x comparisons are insane"""'], {}), "(sys.version_info < (3,), 'Python 2.x comparisons are insane')\n", (2906, 2968), True, 'import unittest2 as unittest\n'), ((463, 489), 'twiggy.levels.name2level', 'levels.name2level', ... |
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from flask import Flask, render_template, request, jsonify, flash, redirect, url_for
import pickle
from FaceDetector_v7 import EmotionFacePredictor
import json
from werkzeug.utils import secure_filename
import tensorflow as tf
global gr... | [
"flask.render_template",
"flask.request.args.get",
"flask.flash",
"os.makedirs",
"flask.Flask",
"matplotlib.use",
"os.path.join",
"matplotlib.pyplot.ioff",
"os.getcwd",
"flask.redirect",
"flask.url_for",
"os.path.isdir",
"werkzeug.utils.secure_filename",
"FaceDetector_v7.EmotionFacePredict... | [((29, 50), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (43, 50), False, 'import matplotlib\n'), ((339, 361), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (359, 361), True, 'import tensorflow as tf\n'), ((362, 372), 'matplotlib.pyplot.ioff', 'plt.ioff', ([], {}), '... |
""" Hook decorator. """
import logging
from eris.decorators import BaseDecorator
from eris.events.hooks import Hook as EventHook
LOGGER = logging.getLogger(__name__)
class Hook(BaseDecorator):
""" Hook decorator, used for more easily setting up handlers for messages. """
hook: EventHook = None
def __... | [
"logging.getLogger",
"eris.events.hooks.Hook"
] | [((140, 167), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'import logging\n'), ((847, 940), 'eris.events.hooks.Hook', 'EventHook', ([], {'name': 'name', '_type': 'event_type', 'contains': 'contains', 'match_criteria': 'match_criteria'}), '(name=name, _type=event_type... |
#!/usr/bin/python
from colorama import init, Fore, Back, Style
init(autoreset=True)
print(Fore.RED + 'some red text')
print(Fore.GREEN + 'some green text')
print(Fore.BLUE + 'some blue text')
print(Fore.CYAN + 'some cyan text')
print(Fore.MAGENTA + 'some magenta text')
print(Back.GREEN + 'and with a green background... | [
"colorama.init"
] | [((64, 84), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (68, 84), False, 'from colorama import init, Fore, Back, Style\n')] |
from .conftest import TestTimeouts
from ftplib import FTP
from socket import timeout
class TestFtplib(TestTimeouts):
def test_connect(self):
with self.raises(timeout):
with FTP(self.connect_host(), timeout=1) as ftp:
ftp.login()
def test_read(self):
with self.raise... | [
"ftplib.FTP"
] | [((349, 363), 'ftplib.FTP', 'FTP', ([], {'timeout': '(1)'}), '(timeout=1)\n', (352, 363), False, 'from ftplib import FTP\n')] |
from aoi_envs.MultiAgent import MultiAgentEnv
import numpy as np
class MobileEnv(MultiAgentEnv):
def __init__(self, agent_velocity=1.0, initialization='Random', biased_velocities=False, flocking=False,
random_acceleration=True, aoi_reward=True, flocking_position_control=False, num_agents=40):
... | [
"numpy.clip",
"numpy.copy",
"numpy.random.normal",
"numpy.multiply",
"numpy.where",
"numpy.nanmean",
"numpy.sum",
"numpy.cos",
"numpy.random.uniform",
"numpy.sin",
"numpy.nansum",
"numpy.divide"
] | [((1140, 1226), 'numpy.random.uniform', 'np.random.uniform', (['(-self.max_velocity)', 'self.max_velocity'], {'size': '(self.n_agents, 2)'}), '(-self.max_velocity, self.max_velocity, size=(self.\n n_agents, 2))\n', (1157, 1226), True, 'import numpy as np\n'), ((3705, 3773), 'numpy.clip', 'np.clip', (['acceleration',... |
from unittest.mock import MagicMock
import pytest
from datastore.shared.di import injector
from datastore.shared.services import EnvironmentService, ShutdownService
from datastore.writer.redis_backend.connection_handler import ConnectionHandler
from datastore.writer.redis_backend.redis_connection_handler import (
... | [
"pytest.fixture",
"datastore.shared.di.injector.get",
"unittest.mock.MagicMock",
"datastore.shared.di.injector.register"
] | [((392, 420), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (406, 420), False, 'import pytest\n'), ((658, 674), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (672, 674), False, 'import pytest\n'), ((459, 510), 'datastore.shared.di.injector.register', 'injector.register', (... |
# Copyright (c) 2015 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sub... | [
"csv.DictReader",
"Germlib.Germlib",
"Bio.SeqRecord.SeqRecord",
"Bio.Seq.Seq",
"traceback.format_exception",
"sys.exc_info",
"doctest.testmod",
"Bio.SeqIO.write",
"Bio.Align.MultipleSeqAlignment",
"Germlib.Germlib.translate_imgt_name"
] | [((33302, 33344), 'Bio.SeqIO.write', 'SeqIO.write', (['outrecs', 'output_file', '"""fasta"""'], {}), "(outrecs, output_file, 'fasta')\n", (33313, 33344), False, 'from Bio import SeqIO\n'), ((33433, 33450), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (33448, 33450), False, 'import doctest\n'), ((9497, 9546),... |
from typing import List
from webbrowser import get
from fastapi import APIRouter, Response
from .schemas import TodoItem, TodoPayload, UserPayload #,User
#-----Agregado jtortolero-----
from sqlalchemy.orm import Session
from fastapi import Depends, HTTPException, status
from .models import Item, User
from .utils impor... | [
"fastapi.HTTPException",
"fastapi.APIRouter",
"fastapi.Response",
"fastapi.Depends"
] | [((400, 411), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (409, 411), False, 'from fastapi import APIRouter, Response\n'), ((493, 508), 'fastapi.Depends', 'Depends', (['get_db'], {}), '(get_db)\n', (500, 508), False, 'from fastapi import Depends, HTTPException, status\n'), ((741, 756), 'fastapi.Depends', 'Depen... |
from setuptools import setup
setup(
name='pytransmute',
version='0.1.0',
packages=['pytransmute', 'pytransmute.plugin'],
package_data={"pytransmute": ["py.typed"]},
url='https://github.com/leeshangqian/pytransmute',
license='Apache-2.0 License',
author='<NAME>',
author_email='<EMAIL>',
... | [
"setuptools.setup"
] | [((30, 484), 'setuptools.setup', 'setup', ([], {'name': '"""pytransmute"""', 'version': '"""0.1.0"""', 'packages': "['pytransmute', 'pytransmute.plugin']", 'package_data': "{'pytransmute': ['py.typed']}", 'url': '"""https://github.com/leeshangqian/pytransmute"""', 'license': '"""Apache-2.0 License"""', 'author': '"""<N... |
from torch.autograd import Variable
import torch.nn.functional as F
import scripts.utils as utils
import torch.nn as nn
import numpy as np
import torch
class CrossEntropy2d(nn.Module):
def __init__(self, size_average=True, ignore_label=255):
super(CrossEntropy2d, self).__init__()
self.size_average... | [
"torch.sort",
"torch.nn.functional.nll_loss",
"numpy.put",
"torch.eye",
"torch.unsqueeze",
"torch.LongTensor",
"scripts.utils.mean",
"torch.pow",
"torch.from_numpy",
"torch.randn",
"numpy.array",
"numpy.zeros",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.log_softmax",
"torc... | [((1750, 1777), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['input'], {'dim': '(1)'}), '(input, dim=1)\n', (1763, 1777), True, 'import torch.nn.functional as F\n'), ((2124, 2202), 'torch.nn.functional.nll_loss', 'F.nll_loss', (['log_p', 'target'], {'ignore_index': '(250)', 'weight': 'weight', 'size_average': ... |
# Generated by Django 2.0.2 on 2018-05-01 06:48
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('upload', '0004_auto_20180430_2344'),
]
operations = [
migrations.RemoveField(
model_name='logfile',
name='id',
... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((234, 289), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""logfile"""', 'name': '"""id"""'}), "(model_name='logfile', name='id')\n", (256, 289), False, 'from django.db import migrations, models\n'), ((438, 535), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(... |
from google.appengine.ext import db
from google.appengine.api import urlfetch
class PegasusFiles(db.Model):
name = db.StringProperty()
file = db.BlobProperty()
added = db.DateTimeProperty(auto_now_add=True)
| [
"google.appengine.ext.db.BlobProperty",
"google.appengine.ext.db.DateTimeProperty",
"google.appengine.ext.db.StringProperty"
] | [((117, 136), 'google.appengine.ext.db.StringProperty', 'db.StringProperty', ([], {}), '()\n', (134, 136), False, 'from google.appengine.ext import db\n'), ((145, 162), 'google.appengine.ext.db.BlobProperty', 'db.BlobProperty', ([], {}), '()\n', (160, 162), False, 'from google.appengine.ext import db\n'), ((172, 210), ... |
#
# Copyright 2022 European Centre for Medium-Range Weather Forecasts (ECMWF)
#
# 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 req... | [
"polytope_server.common.request.Request",
"polytope_server.common.user.User",
"pytest.raises",
"copy.deepcopy"
] | [((1033, 1060), 'polytope_server.common.user.User', 'User', (['"""joebloggs"""', '"""realm1"""'], {}), "('joebloggs', 'realm1')\n", (1037, 1060), False, 'from polytope_server.common.user import User\n'), ((1168, 1227), 'polytope_server.common.request.Request', 'request.Request', ([], {'user': 'self.user', 'verb': 'requ... |
#!/usr/bin/env python
import yaml
from pprint import pprint as pp
from napalm import get_network_driver
import requests
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
# Read YAML file
with open("my_devices.yml", 'r') as strea... | [
"yaml.load",
"requests.packages.urllib3.disable_warnings",
"napalm.get_network_driver"
] | [((194, 260), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', (['InsecureRequestWarning'], {}), '(InsecureRequestWarning)\n', (236, 260), False, 'import requests\n'), ((365, 390), 'napalm.get_network_driver', 'get_network_driver', (['"""ios"""'], {}), "('ios')\n", (383, 390),... |
import responses
from requests.exceptions import HTTPError
from infoblox import infoblox
from . import testcasefixture
class TestGetHost(testcasefixture.TestCaseWithFixture):
fixture_name = 'host_get'
@classmethod
def setUpClass(cls):
super(TestGetHost, cls).setUpClass()
with responses.Re... | [
"responses.add",
"responses.RequestsMock"
] | [((1470, 1570), 'responses.add', 'responses.add', (['responses.GET', '"""https://10.10.10.10/wapi/v1.6/record:host"""'], {'body': '"""[]"""', 'status': '(200)'}), "(responses.GET, 'https://10.10.10.10/wapi/v1.6/record:host',\n body='[]', status=200)\n", (1483, 1570), False, 'import responses\n'), ((1833, 1933), 'res... |