code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import cv2
import mediapipe as mp
class FaceDetection():
# initialize the face detection class with arguments from https://google.github.io/mediapipe/solutions/face_detection.html
def __init__(self, model_selection = 0, threshold = 0.5):
self.model_selection = model_selection
self.threshold = t... | [
"cv2.rectangle",
"mediapipe.solutions.face_detection.FaceDetection",
"cv2.putText"
] | [((410, 535), 'mediapipe.solutions.face_detection.FaceDetection', 'mp.solutions.face_detection.FaceDetection', ([], {'model_selection': 'self.model_selection', 'min_detection_confidence': 'self.threshold'}), '(model_selection=self.\n model_selection, min_detection_confidence=self.threshold)\n', (451, 535), True, 'im... |
#!/usr/bin/env python3.4
from flask import Flask
import requests
from fibonacci import fibonacci as fib
app = Flask(__name__)
@app.route('/count/<key>')
def count(key):
return requests.get('http://127.0.0.1:8080/count/{}'.format(key)).text
@app.route('/fibonacci/<n>')
def fibonacci(n):
return str(fib(int(... | [
"flask.Flask"
] | [((112, 127), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (117, 127), False, 'from flask import Flask\n')] |
from importlib.resources import path
from jsonschema_typed import JSONSchema
with path("sentry_data_schemas", "event.schema.json") as schema_path:
EventData = JSONSchema["var:sentry_data_schemas:schema_path"]
| [
"importlib.resources.path"
] | [((83, 131), 'importlib.resources.path', 'path', (['"""sentry_data_schemas"""', '"""event.schema.json"""'], {}), "('sentry_data_schemas', 'event.schema.json')\n", (87, 131), False, 'from importlib.resources import path\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import pontoon.base.models
class Migration(migrations.Migration):
dependencies = [
("base", "0006_auto_20150602_0616"),
]
operations = [
migrations.AddField(
model_name="... | [
"django.db.models.CommaSeparatedIntegerField",
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((380, 523), 'django.db.models.CommaSeparatedIntegerField', 'models.CommaSeparatedIntegerField', ([], {'blank': '(True)', 'max_length': '(11)', 'verbose_name': "b'CLDR Plurals'", 'validators': '[pontoon.base.models.validate_cldr]'}), "(blank=True, max_length=11, verbose_name=\n b'CLDR Plurals', validators=[pontoon.... |
# Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"click.echo",
"platformio.project.generator.ProjectGenerator",
"platformio.project.config.ProjectConfig",
"click.BadParameter",
"platformio.fs.cd",
"click.secho",
"click.option",
"json.dumps",
"os.path.isdir",
"click.command",
"platformio.project.helpers.is_platformio_project",
"platformio.pro... | [((1482, 1557), 'click.command', 'click.command', (['"""init"""'], {'short_help': '"""Initialize a project or update existing"""'}), "('init', short_help='Initialize a project or update existing')\n", (1495, 1557), False, 'import click\n'), ((1744, 1833), 'click.option', 'click.option', (['"""-b"""', '"""--board"""'], ... |
# Copyright 2013 Nebula Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"osc_choochoo.v1.train.TrainList",
"mock.patch",
"os.path.join",
"osc_choochoo.v1.train.TrainShow",
"mock.MagicMock"
] | [((1438, 1469), 'osc_choochoo.v1.train.TrainList', 'train.TrainList', (['self.app', 'None'], {}), '(self.app, None)\n', (1453, 1469), False, 'from osc_choochoo.v1 import train\n'), ((2209, 2240), 'osc_choochoo.v1.train.TrainShow', 'train.TrainShow', (['self.app', 'None'], {}), '(self.app, None)\n', (2224, 2240), False,... |
#!/usr/bin/env python3
import sys
from os.path import dirname, abspath, join
import subprocess
# Note this does not resolve symbolic links
# https://stackoverflow.com/a/17806123
FIREFOX_BINARY = join(dirname(abspath(__file__)), 'firefox')
argvs = list(sys.argv)
argvs[0] = FIREFOX_BINARY
# geckdriver will run `firef... | [
"os.path.abspath",
"subprocess.check_call"
] | [((1105, 1133), 'subprocess.check_call', 'subprocess.check_call', (['argvs'], {}), '(argvs)\n', (1126, 1133), False, 'import subprocess\n'), ((417, 445), 'subprocess.check_call', 'subprocess.check_call', (['argvs'], {}), '(argvs)\n', (438, 445), False, 'import subprocess\n'), ((210, 227), 'os.path.abspath', 'abspath', ... |
import json
import logging
from collections import OrderedDict
from decimal import ROUND_HALF_UP, Decimal
from typing import Any, Dict, Union
import pytz
from django import forms
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.fo... | [
"logging.getLogger",
"django.forms.CheckboxSelectMultiple",
"pytz.timezone",
"pretix.base.models.Order.objects.get",
"json.dumps",
"django_countries.Countries",
"django.utils.timezone.now",
"pretix.presale.views.cart.cart_session",
"django.dispatch.receiver",
"django.conf.settings.CURRENCY_PLACES.... | [((1331, 1358), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1348, 1358), False, 'import logging\n'), ((36977, 37042), 'django.dispatch.receiver', 'receiver', (['register_payment_providers'], {'dispatch_uid': '"""payment_free"""'}), "(register_payment_providers, dispatch_uid='payment_f... |
from __future__ import absolute_import, division, print_function, unicode_literals
from unittest import TestCase
from beast.env.ReadEnvFile import read_env_file
from beast.util import Terminal
Terminal.CAN_CHANGE_COLOR = False
JSON = """
{
"FOO": "foo",
"BAR": "bar bar bar",
"CPPFLAGS": "-std=c++11 -frtti -fno... | [
"beast.env.ReadEnvFile.read_env_file"
] | [((805, 824), 'beast.env.ReadEnvFile.read_env_file', 'read_env_file', (['JSON'], {}), '(JSON)\n', (818, 824), False, 'from beast.env.ReadEnvFile import read_env_file\n'), ((883, 901), 'beast.env.ReadEnvFile.read_env_file', 'read_env_file', (['ENV'], {}), '(ENV)\n', (896, 901), False, 'from beast.env.ReadEnvFile import ... |
"""
Changes existing registered_meta on a node to new schema layout
required for the prereg-prize
"""
import json
import sys
import logging
from modularodm import Q
from framework.mongo import database as db
from framework.mongo.utils import from_mongo
from framework.transactions.context import TokuTransaction
from ... | [
"logging.getLogger",
"json.loads",
"framework.transactions.context.TokuTransaction",
"modularodm.Q",
"framework.mongo.utils.from_mongo",
"scripts.utils.add_file_logger",
"website.app.init_app"
] | [((497, 524), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (514, 524), False, 'import logging\n'), ((1081, 1103), 'website.app.init_app', 'init_app', ([], {'routes': '(False)'}), '(routes=False)\n', (1089, 1103), False, 'from website.app import init_app\n'), ((1138, 1185), 'scripts.util... |
# Generated by Django 2.2.12 on 2020-05-01 03:34
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
op... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((248, 305), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (279, 305), False, 'from django.db import migrations, models\n'), ((435, 528), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import asyncio
from typing import Union
import datetime
import time
from discord.ext import commands
import yaml
from cogs import checks
import database
import utils
# Loads the repeating interval dictionary
with open("conversions.yml", "r") as conversion_file:
conversion_dict = yaml.load(conversion_file, Loade... | [
"utils.split_date",
"datetime.datetime.fromtimestamp",
"database.insert_reminder",
"utils.generate_embed",
"yaml.load",
"utils.split_time",
"discord.ext.commands.check",
"discord.ext.commands.UserInputError",
"asyncio.gather",
"database.get_reminders",
"database.remove_reminder",
"time.time",
... | [((346, 364), 'utils.get_prefix', 'utils.get_prefix', ([], {}), '()\n', (362, 364), False, 'import utils\n'), ((288, 334), 'yaml.load', 'yaml.load', (['conversion_file'], {'Loader': 'yaml.Loader'}), '(conversion_file, Loader=yaml.Loader)\n', (297, 334), False, 'import yaml\n'), ((3895, 4313), 'discord.ext.commands.comm... |
import setuptools
from toraman.version import __version__
with open('README.md', 'r') as input_file:
long_description = input_file.read()
setuptools.setup(
name='toraman',
version=__version__,
author='<NAME>',
author_email='<EMAIL>',
description='A computer-assisted translation tool package',... | [
"setuptools.find_packages"
] | [((590, 616), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (614, 616), False, 'import setuptools\n')] |
"""
CTC-like decoder utilitis.
"""
from itertools import groupby
import numpy as np
def ctc_best_path_decode(probs_seq, vocabulary):
"""
Best path decoding, also called argmax decoding or greedy decoding.
Path consisting of the most probable tokens are further post-processed to
remove consecutive... | [
"numpy.array",
"itertools.groupby"
] | [((1104, 1127), 'itertools.groupby', 'groupby', (['max_index_list'], {}), '(max_index_list)\n', (1111, 1127), False, 'from itertools import groupby\n'), ((973, 992), 'numpy.array', 'np.array', (['probs_seq'], {}), '(probs_seq)\n', (981, 992), True, 'import numpy as np\n')] |
"""dbt_airflow_factory module."""
from setuptools import find_packages, setup
with open("README.md") as f:
README = f.read()
# Runtime Requirements.
INSTALL_REQUIRES = ["pytimeparse==1.1.8"]
# Dev Requirements
EXTRA_REQUIRE = {
"tests": [
"pytest>=6.2.2, <7.0.0",
"pytest-cov>=2.8.0, <3.0.0",... | [
"setuptools.find_packages"
] | [((1274, 1338), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['ez_setup', 'examples', 'tests', 'docs']"}), "(exclude=['ez_setup', 'examples', 'tests', 'docs'])\n", (1287, 1338), False, 'from setuptools import find_packages, setup\n')] |
import numpy as np
import pytest
from karabo_bridge import serialize, deserialize
from .utils import compare_nested_dict
def test_serialize(data, protocol_version):
msg = serialize(data, protocol_version=protocol_version)
assert isinstance(msg, list)
d, m = deserialize(msg)
compare_nested_dict(data... | [
"karabo_bridge.serialize",
"pytest.raises",
"karabo_bridge.deserialize"
] | [((179, 229), 'karabo_bridge.serialize', 'serialize', (['data'], {'protocol_version': 'protocol_version'}), '(data, protocol_version=protocol_version)\n', (188, 229), False, 'from karabo_bridge import serialize, deserialize\n'), ((275, 291), 'karabo_bridge.deserialize', 'deserialize', (['msg'], {}), '(msg)\n', (286, 29... |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import inspect
from datetime import datetime
import freezegun
import pytest
from sqlalchemy import DateTi... | [
"datetime.datetime.now",
"freezegun.freeze_time",
"inspect.getmembers"
] | [((797, 838), 'inspect.getmembers', 'inspect.getmembers', (['cls', 'inspect.ismethod'], {}), '(cls, inspect.ismethod)\n', (815, 838), False, 'import inspect\n'), ((1848, 1885), 'freezegun.freeze_time', 'freezegun.freeze_time', (['time_to_freeze'], {}), '(time_to_freeze)\n', (1869, 1885), False, 'import freezegun\n'), (... |
#!/usr/bin/env python3
import rospy
from std_msgs.msg import Int32
import time
rospy.init_node('count') # ノード名「count」に設定
pub = rospy.Publisher('count_up', Int32, queue_size=1) # パブリッシャ「count_up」を作成
rate = rospy.Rate(10) # 10Hzで実行
n = 0
time.sleep(2)
w... | [
"rospy.is_shutdown",
"rospy.init_node",
"time.sleep",
"rospy.Rate",
"rospy.Publisher"
] | [((80, 104), 'rospy.init_node', 'rospy.init_node', (['"""count"""'], {}), "('count')\n", (95, 104), False, 'import rospy\n'), ((159, 207), 'rospy.Publisher', 'rospy.Publisher', (['"""count_up"""', 'Int32'], {'queue_size': '(1)'}), "('count_up', Int32, queue_size=1)\n", (174, 207), False, 'import rospy\n'), ((238, 252),... |
import requests
from bs4 import BeautifulSoup
def Check(auth, mirrors):
response = requests.get("https://www.x.org/releases/individual/proto/")
html = response.content.decode("utf-8")
parsedHtml = BeautifulSoup(html, "html.parser")
links = parsedHtml.find_all("a")
maxVersionMajor = -1
maxVers... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((88, 148), 'requests.get', 'requests.get', (['"""https://www.x.org/releases/individual/proto/"""'], {}), "('https://www.x.org/releases/individual/proto/')\n", (100, 148), False, 'import requests\n'), ((210, 244), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (22... |
import os
import string
from collections import Counter
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Optional
import numpy as np
import pandas as pd
from scipy.stats.stats import chisquare
from tangled_up_in_unicode import block, block_abbr, categor... | [
"pandas_profiling.model.summary_helpers_image.open_image",
"numpy.mean",
"numpy.histogram",
"tangled_up_in_unicode.category_long",
"os.path.splitdrive",
"tangled_up_in_unicode.category",
"numpy.max",
"numpy.min",
"tangled_up_in_unicode.block",
"tangled_up_in_unicode.script",
"scipy.stats.stats.c... | [((5143, 5159), 'pandas_profiling.model.summary_helpers_image.open_image', 'open_image', (['path'], {}), '(path)\n', (5153, 5159), False, 'from pandas_profiling.model.summary_helpers_image import extract_exif, hash_image, is_image_truncated, open_image\n'), ((7511, 7541), 'pandas.Series', 'pd.Series', (['counts'], {'in... |
# Author: <NAME>
# Copyright (c) 2019, <NAME>
# All rights reserved.
# based on github.com/ClementPinard/SfMLearner-Pytorch
from __future__ import division
import torch
from torch.autograd import Variable
pixel_coords = None
def set_id_grid(depth):
global pixel_coords
b, h, w = depth.size()
i_range = Va... | [
"torch.nn.functional.grid_sample",
"torch.stack",
"torch.sin",
"torch.cos",
"torch.arange",
"torch.cat",
"torch.ones"
] | [((576, 620), 'torch.stack', 'torch.stack', (['(j_range, i_range, ones)'], {'dim': '(1)'}), '((j_range, i_range, ones), dim=1)\n', (587, 620), False, 'import torch\n'), ((3008, 3044), 'torch.stack', 'torch.stack', (['[X_norm, Y_norm]'], {'dim': '(2)'}), '([X_norm, Y_norm], dim=2)\n', (3019, 3044), False, 'import torch\... |
import uuid
from invenio_indexer.api import RecordIndexer
from invenio_pidstore.models import PersistentIdentifier, PIDStatus
from invenio_records_draft.api import RecordContext
from invenio_records_draft.proxies import current_drafts
from invenio_search import RecordsSearch, current_search, current_search_client
from... | [
"sample.records.config.PublishedRecord.get_record",
"invenio_indexer.api.RecordIndexer",
"invenio_pidstore.models.PersistentIdentifier.get",
"uuid.uuid4",
"sample.records.config.PublishedRecord.create",
"invenio_pidstore.models.PersistentIdentifier.create",
"sample.records.config.DraftRecord.create",
... | [((501, 529), 'tests.helpers.disable_test_authenticated', 'disable_test_authenticated', ([], {}), '()\n', (527, 529), False, 'from tests.helpers import disable_test_authenticated\n'), ((1906, 1945), 'invenio_search.current_search_client.indices.refresh', 'current_search_client.indices.refresh', ([], {}), '()\n', (1943,... |
import os
import subprocess
from collections import namedtuple
import gi
gi.require_version("Gst", "1.0")
gi.require_version("Tcam", "0.1")
from gi.repository import Tcam, Gst, GLib, GObject
DeviceInfo = namedtuple("DeviceInfo", "status name identifier connection_type")
CameraProperty = namedtuple("CameraProperty", ... | [
"collections.namedtuple",
"gi.repository.Gst.parse_launch",
"gi.repository.Gst.init",
"subprocess.Popen",
"gi.require_version",
"os.remove"
] | [((74, 106), 'gi.require_version', 'gi.require_version', (['"""Gst"""', '"""1.0"""'], {}), "('Gst', '1.0')\n", (92, 106), False, 'import gi\n'), ((107, 140), 'gi.require_version', 'gi.require_version', (['"""Tcam"""', '"""0.1"""'], {}), "('Tcam', '0.1')\n", (125, 140), False, 'import gi\n'), ((207, 273), 'collections.n... |
from sqlalchemy import exc
from sqlalchemy.sql.expression import func
from models import Watchlist, Portfolio, Activity
from app import db
import metric
def buy_stock(ticker, units):
unit_price = metric.get_price(ticker)
total_price = units * unit_price
max_id = db.session.query(func.max(Activity.activity... | [
"models.Watchlist",
"app.db.session.commit",
"models.Portfolio",
"models.Watchlist.query.all",
"metric.get_company",
"models.Portfolio.query.filter",
"models.Activity",
"models.Portfolio.query.all",
"models.Activity.query.filter",
"models.Watchlist.query.filter",
"sqlalchemy.sql.expression.func.... | [((202, 226), 'metric.get_price', 'metric.get_price', (['ticker'], {}), '(ticker)\n', (218, 226), False, 'import metric\n'), ((1165, 1189), 'metric.get_price', 'metric.get_price', (['ticker'], {}), '(ticker)\n', (1181, 1189), False, 'import metric\n'), ((3039, 3060), 'models.Watchlist.query.all', 'Watchlist.query.all',... |
import unittest
from pyavl3 import AVLTree
class AVLTreeUpdateTest(unittest.TestCase):
def test_add_one(self):
a = AVLTree()
a.update({1:'a'})
self.assertEqual(len(a), 1)
| [
"pyavl3.AVLTree"
] | [((129, 138), 'pyavl3.AVLTree', 'AVLTree', ([], {}), '()\n', (136, 138), False, 'from pyavl3 import AVLTree\n')] |
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
self.wfile.write("Hel... | [
"SocketServer.TCPServer"
] | [((428, 475), 'SocketServer.TCPServer', 'SocketServer.TCPServer', (["('', PORT + i)", 'Handler'], {}), "(('', PORT + i), Handler)\n", (450, 475), False, 'import SocketServer\n')] |
#!/usr/bin/env python3
# Usage:
# $0 -o log.txt products/
#
# concatenates .log files (even those in subdirs or .zip) and combines into a single combined.log
from xdfile.utils import find_files_with_time, open_output, get_args
import boto3
# from boto.s3.connection import S3Connection
import os
def main():
a... | [
"boto3.resource",
"xdfile.utils.open_output",
"xdfile.utils.get_args",
"xdfile.utils.find_files_with_time"
] | [((326, 363), 'xdfile.utils.get_args', 'get_args', (['"""aggregates all .log files"""'], {}), "('aggregates all .log files')\n", (334, 363), False, 'from xdfile.utils import find_files_with_time, open_output, get_args\n'), ((375, 388), 'xdfile.utils.open_output', 'open_output', ([], {}), '()\n', (386, 388), False, 'fro... |
import torch
import numpy as np
import pickle
torch.manual_seed(17)
torch.backends.cudnn.deterministic = True
torch.backends.cudnn.benchmark = False
np.random.seed(17)
import argparse
import torch.nn as nn
import torch.nn.functional as F
import matplotlib
import os
from rational.torch import Rational, RecurrentRationa... | [
"torch.manual_seed",
"argparse.ArgumentParser",
"torch.nn.functional.nll_loss",
"os.path.join",
"torch.cuda.is_available",
"torch.set_anomaly_enabled",
"matplotlib.rc",
"numpy.random.seed",
"torchvision.transforms.Resize",
"torch.no_grad",
"torchvision.transforms.ToTensor",
"torchvision.transf... | [((47, 68), 'torch.manual_seed', 'torch.manual_seed', (['(17)'], {}), '(17)\n', (64, 68), False, 'import torch\n'), ((150, 168), 'numpy.random.seed', 'np.random.seed', (['(17)'], {}), '(17)\n', (164, 168), True, 'import numpy as np\n'), ((592, 621), 'matplotlib.rc', 'matplotlib.rc', (['"""font"""'], {}), "('font', **fo... |
from typing import Union
import torch
import torch.nn as nn
from kornia.color.hsv import rgb_to_hsv, hsv_to_rgb
from kornia.constants import pi
def adjust_saturation_raw(input: torch.Tensor, saturation_factor: Union[float, torch.Tensor]) -> torch.Tensor:
r"""Adjust color saturation of an image. Expecting input ... | [
"kornia.color.hsv.rgb_to_hsv",
"kornia.color.hsv.hsv_to_rgb",
"torch.unsqueeze",
"kornia.constants.pi.item",
"torch.pow",
"torch.is_tensor",
"torch.tensor",
"torch.chunk",
"torch.fmod",
"torch.clamp",
"torch.cat"
] | [((1212, 1248), 'torch.chunk', 'torch.chunk', (['input'], {'chunks': '(3)', 'dim': '(-3)'}), '(input, chunks=3, dim=-3)\n', (1223, 1248), False, 'import torch\n'), ((1322, 1370), 'torch.clamp', 'torch.clamp', (['(s * saturation_factor)'], {'min': '(0)', 'max': '(1)'}), '(s * saturation_factor, min=0, max=1)\n', (1333, ... |
from data.data_loader_dad import (
NASA_Anomaly,
WADI
)
from exp.exp_basic import Exp_Basic
from models.model import Informer
from utils.tools import EarlyStopping, adjust_learning_rate
from utils.metrics import metric
from sklearn.metrics import classification_report
import numpy as np
import torch
import t... | [
"os.path.exists",
"os.makedirs",
"numpy.average",
"torch.load",
"torch.nn.MSELoss",
"utils.tools.EarlyStopping",
"numpy.array",
"utils.tools.adjust_learning_rate",
"torch.cat",
"torch.utils.data.DataLoader",
"utils.metrics.metric",
"torch.no_grad",
"torch.zeros_like",
"time.time",
"warni... | [((438, 471), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (461, 471), False, 'import warnings\n'), ((2215, 2335), 'torch.utils.data.DataLoader', 'DataLoader', (['data_set'], {'batch_size': 'batch_size', 'shuffle': 'shuffle_flag', 'num_workers': 'args.num_workers', 'drop... |
from django.db import migrations, models
from django.conf import settings
from opaque_keys.edx.django.models import CourseKeyField
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"opaque_keys.edx.django.model... | [((202, 259), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (233, 259), False, 'from django.db import migrations, models\n'), ((3807, 3907), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether',... |
from cloud.permission import Permission, NeedPermission
from cloud.message import error
# Define the input output format of the function.
# This information is used when creating the *SDK*.
info = {
'input_format': {
'session_id': 'str',
'field': 'str',
'value?': 'str',
},
'output_... | [
"cloud.permission.NeedPermission"
] | [((410, 452), 'cloud.permission.NeedPermission', 'NeedPermission', (['Permission.Run.Auth.set_me'], {}), '(Permission.Run.Auth.set_me)\n', (424, 452), False, 'from cloud.permission import Permission, NeedPermission\n')] |
import names
import os
import datetime
from random import random
def generate_gedcom_file():
"""generate some gedcom file"""
db = {}
db['n_individuals'] = 0
db['max_individuals'] = 8000
db['n_families'] = 0
db['yougest'] = None
gedcom_content = """
0 HEAD
1 SOUR Gramps
2 VERS 3.3.0
2 N... | [
"names.get_last_name",
"PIL.Image.new",
"PIL.ImageFont.truetype",
"os.path.dirname",
"PIL.ImageDraw.Draw",
"names.get_first_name",
"random.random",
"datetime.date.today"
] | [((464, 485), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (483, 485), False, 'import datetime\n'), ((649, 712), 'names.get_first_name', 'names.get_first_name', ([], {'gender': "('male' if sex == 'M' else 'female')"}), "(gender='male' if sex == 'M' else 'female')\n", (669, 712), False, 'import names\... |
# -*- coding: utf-8 -*-
# pylint: disable=E1101
from sqlalchemy import sql
from sqlalchemy import orm
from sqlalchemy.orm.exc import NoResultFound
from .. import Base
# http://www.iana.org/assignments/media-types/media-types.xhtml
class MimeMajor(Base):
"""Mime major"""
def __init__(self, name):
... | [
"sqlalchemy.sql.and_",
"sqlalchemy.orm.contains_eager",
"sqlalchemy.sql.select"
] | [((722, 775), 'sqlalchemy.sql.and_', 'sql.and_', (['(MimeMajor.name == major)', '(Mime.name == minor)'], {}), '(MimeMajor.name == major, Mime.name == minor)\n', (730, 775), False, 'from sqlalchemy import sql\n'), ((1187, 1197), 'sqlalchemy.sql.and_', 'sql.and_', ([], {}), '()\n', (1195, 1197), False, 'from sqlalchemy i... |
# encoding: utf-8
from goods.models import Goods
from django.views.generic.base import View
class GoodsListView(View):
def get(self, request):
"""
通过django的view实现商品列表页
"""
json_list = []
goods = Goods.objects.all()[:10]
# for good in goods:
# json_dict ... | [
"json.loads",
"django.http.JsonResponse",
"goods.models.Goods.objects.all",
"django.forms.models.model_to_dict",
"django.core.serializers.serialize"
] | [((986, 1022), 'django.core.serializers.serialize', 'serializers.serialize', (['"""json"""', 'goods'], {}), "('json', goods)\n", (1007, 1022), False, 'from django.core import serializers\n'), ((1043, 1064), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (1053, 1064), False, 'import json\n'), ((1376, ... |
"""Organize the calculation of statistics for each series in this DataFrame."""
import warnings
from datetime import datetime
from typing import Optional
import pandas as pd
from tqdm.auto import tqdm
from visions import VisionsTypeset
from pandas_profiling.config import Settings
from pandas_profiling.model.correlati... | [
"pandas_profiling.model.summary.get_missing_diagrams",
"pandas_profiling.model.summary.get_messages",
"datetime.datetime.utcnow",
"pandas_profiling.model.summary.get_series_descriptions",
"pandas_profiling.model.summary.get_table_stats",
"pandas_profiling.model.duplicates.get_duplicates",
"pandas_profil... | [((1774, 1791), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1789, 1791), False, 'from datetime import datetime\n'), ((5130, 5147), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (5145, 5147), False, 'from datetime import datetime\n'), ((1652, 1703), 'warnings.warn', 'warnings.war... |
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import os
import os.path
import sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
if sys.argv[-1] == 'publish':
os.system('python setup.py sdist upload')
sys.exit()
NAME = "futur... | [
"os.path.join",
"os.system",
"sys.exit",
"distutils.core.setup"
] | [((4823, 5361), 'distutils.core.setup', 'setup', ([], {'name': 'NAME', 'version': 'VERSION', 'author': 'AUTHOR', 'author_email': 'AUTHOR_EMAIL', 'url': 'URL', 'description': 'DESCRIPTION', 'long_description': 'LONG_DESC', 'license': 'LICENSE', 'keywords': 'KEYWORDS', 'entry_points': "{'console_scripts': ['futurize = li... |
import requests
from bs4 import BeautifulSoup
import urllib.request
import os
import random
import time
def html(url):
user_agents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11',
'Opera/9.25 (Windows NT 5.1; U; en)',
'Mozilla/4.0 (compatible... | [
"bs4.BeautifulSoup",
"random.choice",
"requests.get"
] | [((923, 949), 'random.choice', 'random.choice', (['user_agents'], {}), '(user_agents)\n', (936, 949), False, 'import random\n'), ((1045, 1083), 'requests.get', 'requests.get', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (1057, 1083), False, 'import requests\n'), ((1119, 1157), 'bs4.Beaut... |
import os
import numpy as np
import pandas as pd
from keras.utils import to_categorical
from sklearn.model_selection import KFold, train_test_split
def load_data(path):
train = pd.read_json(os.path.join(path, "./train.json"))
test = pd.read_json(os.path.join(path, "./test.json"))
return (train, test)
... | [
"sklearn.model_selection.train_test_split",
"os.path.join",
"numpy.array",
"numpy.cos",
"numpy.concatenate",
"numpy.full",
"sklearn.model_selection.KFold"
] | [((1090, 1209), 'numpy.concatenate', 'np.concatenate', (['[X_band_1[:, :, :, np.newaxis], X_band_2[:, :, :, np.newaxis], angl[:, :, :,\n np.newaxis]]'], {'axis': '(-1)'}), '([X_band_1[:, :, :, np.newaxis], X_band_2[:, :, :, np.newaxis\n ], angl[:, :, :, np.newaxis]], axis=-1)\n', (1104, 1209), True, 'import numpy... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
import sys
import click
import rhea
from polyaxon_cli.cli.getters.experiment import (
get_experiment_job_or_local,
get_project_experiment_or_local
)
from polyaxon_cli.cli.upload import upload
from polyaxon_cli.client imp... | [
"polyaxon_cli.utils.formatting.Printer.print_warning",
"polyaxon_cli.utils.log_handler.get_logs_handler",
"click.echo",
"polyaxon_cli.utils.formatting.dict_tabulate",
"sys.exit",
"click.group",
"click.option",
"polyaxon_cli.utils.formatting.list_dicts_to_tabulate",
"polyaxon_cli.client.PolyaxonClien... | [((1936, 1949), 'click.group', 'click.group', ([], {}), '()\n', (1947, 1949), False, 'import click\n'), ((1951, 2053), 'click.option', 'click.option', (['"""--project"""', '"""-p"""'], {'type': 'str', 'help': '"""The project name, e.g. \'mnist\' or \'adam/mnist\'."""'}), '(\'--project\', \'-p\', type=str, help=\n "T... |
from bs4 import BeautifulSoup
import requests
import json
import datetime
import codecs
import re
featHolder = {}
featHolder['name'] = 'Pathfinder 2.0 Ancestry feat list'
featHolder['date'] = datetime.date.today().strftime("%B %d, %Y")
def get_details(link):
res = requests.get(link)
res.raise_for_status()
... | [
"re.split",
"json.dumps",
"datetime.date.today",
"requests.get",
"bs4.BeautifulSoup",
"codecs.open"
] | [((2384, 2434), 'codecs.open', 'codecs.open', (['"""ancestryFeats.csv"""'], {'encoding': '"""utf-8"""'}), "('ancestryFeats.csv', encoding='utf-8')\n", (2395, 2434), False, 'import codecs\n'), ((2632, 2664), 'json.dumps', 'json.dumps', (['featHolder'], {'indent': '(4)'}), '(featHolder, indent=4)\n', (2642, 2664), False,... |
import unittest
import scrape
class TestScrapeFunctions(unittest.TestCase):
def test_build_url(self):
url = scrape.build_url("indeed",
"/jobs?q=Data+Scientist&l=Texas&start=10",
join_next=True)
expected = ("https://www.indeed.com/"
... | [
"unittest.main",
"scrape.build_url"
] | [((1212, 1227), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1225, 1227), False, 'import unittest\n'), ((123, 212), 'scrape.build_url', 'scrape.build_url', (['"""indeed"""', '"""/jobs?q=Data+Scientist&l=Texas&start=10"""'], {'join_next': '(True)'}), "('indeed', '/jobs?q=Data+Scientist&l=Texas&start=10',\n jo... |
import random
# Create a deck of cards
deck = [x for x in range(52)]
# Create suits and ranks lists
suits = ["Spades", "Hearts", "Diamonds", "Clubs"]
ranks = ["Ace", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "Jack", "Queen", "King"]
# Shuffle the cards
random.shuffle(deck)
# Display the first four card... | [
"random.shuffle"
] | [((269, 289), 'random.shuffle', 'random.shuffle', (['deck'], {}), '(deck)\n', (283, 289), False, 'import random\n')] |
# -*- coding: utf-8 -*-
#
# Copyright 2018 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"google.cloud.automl_v1beta1.proto.service_pb2.UndeployModelRequest",
"google.cloud.automl_v1beta1.proto.service_pb2.GetModelEvaluationRequest",
"google.cloud.automl_v1beta1.proto.service_pb2.ListDatasetsRequest",
"google.oauth2.service_account.Credentials.from_service_account_file",
"google.cloud.automl_v1... | [((2057, 2110), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""google-cloud-automl"""'], {}), "('google-cloud-automl')\n", (2087, 2110), False, 'import pkg_resources\n'), ((3380, 3443), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service_account.Credentials.from_se... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import ast
from datetime import timedelta, datetime
from random import randint
from odoo import api, fields, models, tools, SUPERUSER_ID, _
from odoo.exceptions import UserError, AccessError, ValidationError, RedirectWa... | [
"odoo.fields.Datetime.from_string",
"odoo.fields.Datetime.today",
"odoo.osv.expression.OR",
"odoo.fields.Many2one",
"odoo.api.onchange",
"datetime.timedelta",
"odoo._",
"odoo.fields.Float",
"odoo.fields.datetime.now",
"odoo.fields.One2many",
"odoo.fields.Text",
"odoo.api.returns",
"random.ra... | [((786, 824), 'odoo.fields.Boolean', 'fields.Boolean', (['"""Active"""'], {'default': '(True)'}), "('Active', default=True)\n", (800, 824), False, 'from odoo import api, fields, models, tools, SUPERUSER_ID, _\n'), ((836, 899), 'odoo.fields.Char', 'fields.Char', ([], {'string': '"""Stage Name"""', 'required': '(True)', ... |
import time
import logger
from basetestcase import BaseTestCase
from couchbase_helper.documentgenerator import DocumentGenerator
from membase.api.rest_client import RestConnection
from couchbase_helper.documentgenerator import BlobGenerator
class DocsTests(BaseTestCase):
def setUp(self):
super(DocsTests, ... | [
"couchbase_helper.documentgenerator.BlobGenerator",
"time.time",
"couchbase_helper.documentgenerator.DocumentGenerator",
"membase.api.rest_client.RestConnection"
] | [((683, 774), 'couchbase_helper.documentgenerator.DocumentGenerator', 'DocumentGenerator', (['"""test_docs"""', 'template', '[number]', 'first'], {'start': '(0)', 'end': 'self.num_items'}), "('test_docs', template, [number], first, start=0, end=self\n .num_items)\n", (700, 774), False, 'from couchbase_helper.documen... |
from bs4 import BeautifulSoup
import requests
from urllib.request import urlretrieve
ROOT = 'http://pdaotao.duytan.edu.vn'
def get_url_sub(sub, id_, page):
all_td_tag = []
for i in range(1, page+1):
print('http://pdaotao.duytan.edu.vn/EXAM_LIST/?page={}&lang=VN'.format(i))
r = requests.get('ht... | [
"bs4.BeautifulSoup",
"requests.get",
"urllib.request.urlretrieve"
] | [((1004, 1021), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1016, 1021), False, 'import requests\n'), ((1033, 1062), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""lxml"""'], {}), "(r.text, 'lxml')\n", (1046, 1062), False, 'from bs4 import BeautifulSoup\n'), ((401, 430), 'bs4.BeautifulSoup', 'Beau... |
# coding=utf-8
# Copyright 2021 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"models.upload_task.UploadTask.from_json",
"models.process_result.ProcessResult",
"content_api_client.ContentApiClient",
"flask.Flask",
"batch_creator.create_batch",
"result_recorder.ResultRecorder.from_service_account_json",
"flask.request.data.decode",
"bigquery_client.BigQueryClient.from_service_ac... | [((1246, 1267), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (1257, 1267), False, 'import flask\n'), ((1287, 1309), 'google.cloud.logging.Client', 'cloud_logging.Client', ([], {}), '()\n', (1307, 1309), True, 'from google.cloud import logging as cloud_logging\n'), ((3229, 3275), 'models.upload_task... |
# -*- coding: utf-8 -*-
'''
Framework: Tensorflow
Training samples: 1600
Validation samples: 400
RNN with 128 units
Optimizer: Adam
Epoch: 100
Loss: Cross Entropy
Activation function: Relu for network and Soft-max for regression
Regularization: Drop-out, keep_prob = 0.8
Accuracy of Validation set: 95%
'''
from __future... | [
"tflearn.data_utils.to_categorical",
"tflearn.embedding",
"tflearn.DNN",
"tflearn.data_utils.pad_sequences",
"tflearn.simple_rnn",
"tflearn.regression",
"tflearn.fully_connected",
"tflearn.input_data"
] | [((824, 861), 'tflearn.data_utils.pad_sequences', 'pad_sequences', (['X'], {'maxlen': '(5)', 'value': '(0.0)'}), '(X, maxlen=5, value=0.0)\n', (837, 861), False, 'from tflearn.data_utils import to_categorical, pad_sequences\n'), ((865, 885), 'tflearn.data_utils.to_categorical', 'to_categorical', (['Y', '(2)'], {}), '(Y... |
import numpy as np
import tensorflow as tf
H = 2
N = 2
M = 3
BS = 10
def my_softmax(arr):
max_elements = np.reshape(np.max(arr, axis = 2), (BS, N, 1))
arr = arr - max_elements
exp_array = np.exp(arr)
print (exp_array)
sum_array = np.reshape(np.sum(exp_array, axis=2), (BS, N, 1))
return exp_arra... | [
"tensorflow.tile",
"tensorflow.shape",
"tensorflow.get_variable",
"tensorflow.transpose",
"numpy.array",
"tensorflow.nn.softmax",
"tensorflow.cast",
"tensorflow.Session",
"numpy.max",
"numpy.exp",
"tensorflow.concat",
"tensorflow.matmul",
"numpy.tile",
"tensorflow.add",
"tensorflow.resha... | [((201, 212), 'numpy.exp', 'np.exp', (['arr'], {}), '(arr)\n', (207, 212), True, 'import numpy as np\n'), ((1260, 1284), 'tensorflow.add', 'tf.add', (['logits', 'exp_mask'], {}), '(logits, exp_mask)\n', (1266, 1284), True, 'import tensorflow as tf\n'), ((1347, 1380), 'tensorflow.nn.softmax', 'tf.nn.softmax', (['masked_... |
import numpy as np
import pytest
from astropy import convolution
from scipy.signal import medfilt
import astropy.units as u
from ..spectra.spectrum1d import Spectrum1D
from ..tests.spectral_examples import simulated_spectra
from ..manipulation.smoothing import (convolution_smooth, box_smooth,
... | [
"numpy.allclose",
"astropy.convolution.CustomKernel",
"pytest.mark.parametrize",
"numpy.array",
"astropy.convolution.convolve",
"astropy.convolution.Gaussian1DKernel",
"astropy.convolution.Box1DKernel",
"scipy.signal.medfilt",
"numpy.sum",
"pytest.raises",
"astropy.convolution.Trapezoid1DKernel"... | [((2105, 2147), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', '[1, 2.3]'], {}), "('width', [1, 2.3])\n", (2128, 2147), False, 'import pytest\n'), ((2941, 2987), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""width"""', "[-1, 0, 'a']"], {}), "('width', [-1, 0, 'a'])\n", (2964, 2987)... |
import json
import matplotlib.pyplot as plt
from pprint import pprint
import numpy as np
from scipy.stats import linregress
from util.stats import *
with open('data/game_stats.json', 'r') as f:
df = json.load(f)
X, y = [], []
for match, stats in df.items():
home, away = stats['home'], stats['away']
if home['mp'] !... | [
"scipy.stats.linregress",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.scatter",
"json.load",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((654, 670), 'scipy.stats.linregress', 'linregress', (['X', 'y'], {}), '(X, y)\n', (664, 670), False, 'from scipy.stats import linregress\n'), ((737, 770), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Free Throw Attempts"""'], {}), "('Free Throw Attempts')\n", (747, 770), True, 'import matplotlib.pyplot as plt\n'),... |
import os
import numpy as np
import pandas as pd
import tensorflow as tf
from keras.preprocessing.image import ImageDataGenerator
from keras.preprocessing.image import img_to_array, load_img
from keras.utils.np_utils import to_categorical
from sklearn.model_selection import StratifiedShuffleSplit
from sklearn.preproces... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"os.path.exists",
"keras.preprocessing.image.img_to_array",
"sklearn.preprocessing.LabelEncoder",
"pandas.read_csv",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"tensorflow.train.BytesList",
"tensorflow.train.Int64List",
"sklear... | [((419, 446), 'pandas.read_csv', 'pd.read_csv', (['"""../train.csv"""'], {}), "('../train.csv')\n", (430, 446), True, 'import pandas as pd\n'), ((706, 732), 'pandas.read_csv', 'pd.read_csv', (['"""../test.csv"""'], {}), "('../test.csv')\n", (717, 732), True, 'import pandas as pd\n'), ((920, 939), 'numpy.argmax', 'np.ar... |
import numpy as np
from skimage.transform import resize
from skimage import measure
from skimage.measure import regionprops
class OCROnObjects():
def __init__(self, license_plate):
character_objects = self.identify_boundary_objects(license_plate)
self.get_regions(character_objects, license_pla... | [
"skimage.measure.regionprops",
"numpy.array",
"numpy.concatenate",
"skimage.transform.resize",
"skimage.measure.label"
] | [((412, 442), 'skimage.measure.label', 'measure.label', (['a_license_plate'], {}), '(a_license_plate)\n', (425, 442), False, 'from skimage import measure\n'), ((692, 715), 'skimage.measure.regionprops', 'regionprops', (['labelImage'], {}), '(labelImage)\n', (703, 715), False, 'from skimage.measure import regionprops\n'... |
from django.shortcuts import render
import requests
from bs4 import BeautifulSoup
def corona_data(request):
"Testaaaa"
corona_html = requests.get("https://www.mygov.in/covid-19")
soup = BeautifulSoup(corona_html.content, 'html.parser')
state_wise_data = soup.find_all('div', class_='views-row')
inf... | [
"bs4.BeautifulSoup",
"django.shortcuts.render",
"requests.get"
] | [((143, 188), 'requests.get', 'requests.get', (['"""https://www.mygov.in/covid-19"""'], {}), "('https://www.mygov.in/covid-19')\n", (155, 188), False, 'import requests\n'), ((200, 249), 'bs4.BeautifulSoup', 'BeautifulSoup', (['corona_html.content', '"""html.parser"""'], {}), "(corona_html.content, 'html.parser')\n", (2... |
# Script tests GPD model using UW truth data
# Test outputs:
# - type of event tested [EQS, EQP, SUS, SUP, THS, THP, SNS, SNP, PXS, PXP]
# - phase [P, S, N] Note: N - not detected
# - model time offset (t_truth - t_model_pick)
import numpy
import math
import string
import datetime
import sys
import os
im... | [
"datetime.datetime.strptime",
"datetime.timedelta",
"datetime.datetime.strftime"
] | [((433, 454), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(27)'}), '(seconds=27)\n', (442, 454), False, 'from datetime import timedelta\n'), ((467, 488), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(10)'}), '(seconds=10)\n', (476, 488), False, 'from datetime import timedelta\n'), ((1567, 1616), 'datet... |
import argparse
import boto3
import datetime
import json
import os
import posixpath
import re
import shutil
import tempfile
import uuid
from concurrent import futures
from multiprocessing import Pool
from ultitrackerapi import get_backend, get_logger, get_s3Client, video
backend_instance = get_backend()
logger = ... | [
"posixpath.join",
"boto3.client",
"ultitrackerapi.video.get_video_duration",
"ultitrackerapi.get_backend",
"ultitrackerapi.get_s3Client",
"datetime.timedelta",
"os.remove",
"os.listdir",
"posixpath.splitext",
"argparse.ArgumentParser",
"json.dumps",
"concurrent.futures.as_completed",
"posixp... | [((297, 310), 'ultitrackerapi.get_backend', 'get_backend', ([], {}), '()\n', (308, 310), False, 'from ultitrackerapi import get_backend, get_logger, get_s3Client, video\n'), ((320, 355), 'ultitrackerapi.get_logger', 'get_logger', (['__name__'], {'level': '"""DEBUG"""'}), "(__name__, level='DEBUG')\n", (330, 355), False... |
# --- SECTION 1 ---
# Import the required libraries
from sklearn import datasets, naive_bayes, svm, neighbors
from sklearn.ensemble import VotingClassifier
from sklearn.metrics import accuracy_score
# Load the dataset
breast_cancer = datasets.load_breast_cancer()
x, y = breast_cancer.data, breast_cancer.target
... | [
"sklearn.ensemble.VotingClassifier",
"matplotlib.pyplot.title",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.datasets.load_breast_cancer",
"matplotlib.pyplot.bar",
"matplotlib.style.use",
"matplotlib.pyplot.sca... | [((241, 270), 'sklearn.datasets.load_breast_cancer', 'datasets.load_breast_cancer', ([], {}), '()\n', (268, 270), False, 'from sklearn import datasets, naive_bayes, svm, neighbors\n'), ((569, 614), 'sklearn.neighbors.KNeighborsClassifier', 'neighbors.KNeighborsClassifier', ([], {'n_neighbors': '(5)'}), '(n_neighbors=5)... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"sklearn.datasets.load_iris",
"sklearn.model_selection.train_test_split",
"sklearn.decomposition.PCA",
"numpy.append",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.scatter",
"qiskit.aqua.MissingOptionalLibraryError",
"matplotlib.pyplot.title",
"sklearn.preprocessing.MinMaxScaler",
"m... | [((908, 943), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (926, 943), False, 'from sklearn import datasets\n'), ((1011, 1071), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'target'], {'test_size': '(1)', 'random_state': '(42)'})... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import json
import mock
import pytest
from oauthlib.oauth2 import InvalidRequestFatalError
from oauthlib.common import Request as OAuthRequest
from pyramid import httpexceptions
from h._compat import urlparse
from h.exceptions import O... | [
"oauthlib.oauth2.InvalidRequestFatalError",
"mock.Mock",
"mock.create_autospec",
"datetime.timedelta",
"h._compat.urlparse.urlparse",
"h.views.api_auth.debug_token",
"h.services.auth_token.auth_token_service_factory",
"json.dumps",
"h._compat.urlparse.parse_qs",
"h.views.api_auth.api_token_error",... | [((685, 748), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""routes"""', '"""oauth_provider"""', '"""user_svc"""'], {}), "('routes', 'oauth_provider', 'user_svc')\n", (708, 748), False, 'import pytest\n'), ((9321, 9362), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""oauth_provider"""'], {}), ... |
import time
from typing import Dict, List, Tuple, Optional
from utils.logger_utils import LogManager
from utils.str_utils import check_is_json
from config import LOG_LEVEL, PROCESS_STATUS_FAIL
from utils.time_utils import datetime_str_change_fmt
from utils.exception_utils import LoginException, ParseDataException
from... | [
"utils.exception_utils.LoginException",
"time.sleep",
"utils.str_utils.check_is_phone_number",
"utils.logger_utils.LogManager",
"utils.str_utils.check_is_email_address",
"utils.exception_utils.ParseDataException",
"utils.time_utils.datetime_str_change_fmt"
] | [((471, 491), 'utils.logger_utils.LogManager', 'LogManager', (['__name__'], {}), '(__name__)\n', (481, 491), False, 'from utils.logger_utils import LogManager\n'), ((1681, 1729), 'utils.str_utils.check_is_phone_number', 'check_is_phone_number', ([], {'data': 'self._login_username'}), '(data=self._login_username)\n', (1... |
from paddle.vision.transforms import (
ToTensor, RandomHorizontalFlip, RandomResizedCrop, SaturationTransform, Compose,
HueTransform, BrightnessTransform, ContrastTransform, RandomCrop, Normalize, RandomRotation
)
from paddle.vision.datasets import Cifar100
from paddle.io import DataLoader
from paddle.optimizer... | [
"paddle.optimizer.lr.CosineAnnealingDecay",
"paddleslim.nas.ofa.convert_super.supernet",
"paddle.vision.datasets.Cifar100",
"paddle.Model",
"paddle.metric.Accuracy",
"paddleslim.nas.ofa.convert_super.Convert",
"paddle.vision.transforms.RandomCrop",
"paddle.vision.transforms.Normalize",
"paddle.visio... | [((2136, 2169), 'paddleslim.nas.ofa.DistillConfig', 'DistillConfig', ([], {'teacher_model': 'net2'}), '(teacher_model=net2)\n', (2149, 2169), False, 'from paddleslim.nas.ofa import OFA, RunConfig, DistillConfig\n'), ((2186, 2220), 'paddleslim.nas.ofa.convert_super.supernet', 'supernet', ([], {'channel': 'channel_option... |
import json
import re
from string import ascii_uppercase
from time import time
from urllib.parse import urljoin
import scrapy
from more_itertools import first
from scrapy import Request
from product_spider.items import JkProduct, JKPackage
from product_spider.utils.functions import strip
class JkPrdSpider(scrapy.Sp... | [
"json.loads",
"product_spider.items.JKPackage",
"json.dumps",
"urllib.parse.urljoin",
"time.time",
"re.findall",
"more_itertools.first",
"product_spider.items.JkProduct"
] | [((2746, 2759), 'json.loads', 'json.loads', (['s'], {}), '(s)\n', (2756, 2759), False, 'import json\n'), ((2824, 2843), 'more_itertools.first', 'first', (['packages', '{}'], {}), '(packages, {})\n', (2829, 2843), False, 'from more_itertools import first\n'), ((2678, 2724), 're.findall', 're.findall', (['"""(?<=\\\\().+... |
import os
import sys
import random
import datetime
import gym
from gym import spaces
import numpy as np
from env.IDM import IDM
from env.Road import Road
from env.Vehicle import Vehicle
import math
# add sumo/tools into python environment
if 'SUMO_HOME' in os.environ:
tools = os.path.join(os.environ['SUMO_HOME'], ... | [
"math.sqrt",
"env.IDM.IDM",
"traci.vehicle.getSpeedFactor",
"sys.exit",
"env.Vehicle.Vehicle",
"math.exp",
"sys.path.append",
"traci.simulation.getDeltaT",
"numpy.empty",
"traci.vehicle.setSpeed",
"traci.vehicle.getLaneID",
"env.Road.Road",
"traci.vehicle.setSpeedMode",
"gym.spaces.Discret... | [((282, 328), 'os.path.join', 'os.path.join', (["os.environ['SUMO_HOME']", '"""tools"""'], {}), "(os.environ['SUMO_HOME'], 'tools')\n", (294, 328), False, 'import os\n'), ((333, 355), 'sys.path.append', 'sys.path.append', (['tools'], {}), '(tools)\n', (348, 355), False, 'import sys\n'), ((387, 446), 'sys.exit', 'sys.ex... |
import boto3
import ipaddress
import json
import logging
import os
import requests
import uuid
logger = logging.getLogger()
logger.setLevel(logging.INFO)
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table(os.environ['DYNAMODB_TABLE'])
client = boto3.client('ssm')
def downloader(instance, latest, param... | [
"logging.getLogger",
"boto3.client",
"ipaddress.IPv6Address",
"ipaddress.IPv4Address",
"ipaddress.IPv4Network",
"json.dumps",
"ipaddress.IPv6Network",
"requests.get",
"uuid.uuid4",
"boto3.resource",
"ipaddress.ip_address"
] | [((105, 124), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (122, 124), False, 'import logging\n'), ((167, 193), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (181, 193), False, 'import boto3\n'), ((261, 280), 'boto3.client', 'boto3.client', (['"""ssm"""'], {}), "('ssm')\... |
#!/usr/bin/env python
import os
import socket
import subprocess
import argparse
import logging
LOGGER = logging.getLogger(__name__)
class ValidatorError(Exception):
pass
def ping(address):
try:
subprocess.check_call(('ping', '-c 1', '-W 1', address), stdout=subprocess.PIPE, stderr=subprocess.PIPE)... | [
"logging.getLogger",
"socket.socket",
"subprocess.check_call"
] | [((106, 133), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (123, 133), False, 'import logging\n'), ((569, 584), 'socket.socket', 'socket.socket', ([], {}), '()\n', (582, 584), False, 'import socket\n'), ((216, 325), 'subprocess.check_call', 'subprocess.check_call', (["('ping', '-c 1', '... |
from PlayerState import *
from pathFinder import PathFinder
from StateLook4Resources import *
class StateGoHome(PlayerState):
""" State Implementation: has a resource and go back home """
def __init__(self, player):
self.player = player
self.player.setTarget(self.player.playerData.HouseLocati... | [
"pathFinder.PathFinder"
] | [((450, 481), 'pathFinder.PathFinder', 'PathFinder', (['self.player.mapView'], {}), '(self.player.mapView)\n', (460, 481), False, 'from pathFinder import PathFinder\n')] |
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"models.models.QuestionDTO",
"models.models.QuestionDAO.save_all",
"models.models.StudentPropertyEntity.safe_key",
"models.models.QuestionDAO.load",
"models.models.StudentAnswersEntity.safe_key",
"models.models.Student",
"models.models.QuestionDAO.used_by",
"models.models.Student.safe_key",
"models.... | [((994, 1042), 'models.models.EventEntity', 'models.EventEntity', ([], {'source': '"""source"""', 'user_id': '"""1"""'}), "(source='source', user_id='1')\n", (1012, 1042), False, 'from models import models\n'), ((1531, 1552), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (1550, 1552), False, 'import d... |
# -*- coding: utf-8 -*-
import io
import math
import warnings
from typing import Optional, Tuple
import torch
from torch import Tensor
from torchaudio._internal import module_utils as _mod_utils
import torchaudio
__all__ = [
"spectrogram",
"griffinlim",
"amplitude_to_DB",
"DB_to_amplitude",
"comp... | [
"torch.ops.torchaudio.kaldi_ComputeKaldiPitch",
"torchaudio._internal.module_utils.requires_sox",
"torchaudio.sox_effects.sox_effects.apply_effects_file",
"torch.max",
"io.BytesIO",
"torch.sin",
"torch.exp",
"math.log",
"torch.min",
"torch.nn.functional.conv1d",
"torch.cos",
"torch.pow",
"ma... | [((36079, 36104), 'torchaudio._internal.module_utils.requires_sox', '_mod_utils.requires_sox', ([], {}), '()\n', (36102, 36104), True, 'from torchaudio._internal import module_utils as _mod_utils\n'), ((38148, 38175), 'torchaudio._internal.module_utils.requires_kaldi', '_mod_utils.requires_kaldi', ([], {}), '()\n', (38... |
#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function
import curses
import sys
from collections import deque
from datetime import datetime
import numpy as np
import rospy
from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus
from geometry_msgs.msg import PoseStamped
from ... | [
"rospy.init_node",
"mavros_msgs.msg.State",
"curses.curs_set",
"rospy.Rate",
"curses.nocbreak",
"numpy.mean",
"collections.deque",
"scipy.spatial.transform.Rotation.from_euler",
"sensor_msgs.msg.NavSatFix",
"curses.init_pair",
"rospy.Subscriber",
"numpy.rad2deg",
"curses.color_pair",
"curs... | [((831, 855), 'curses.color_pair', 'curses.color_pair', (['color'], {}), '(color)\n', (848, 855), False, 'import curses\n'), ((1120, 1139), 'numpy.isnan', 'np.isnan', (['frequency'], {}), '(frequency)\n', (1128, 1139), True, 'import numpy as np\n'), ((1094, 1112), 'numpy.mean', 'np.mean', (['durations'], {}), '(duratio... |
try:
import importlib.resources as pkg_resources
except ImportError:
# Try backported to PY<37 `importlib_resources`.
import importlib_resources as pkg_resources
from . import images
from gym import Env, spaces
from time import time
import numpy as np
from copy import copy
import colorsys
import pygame
f... | [
"numpy.prod",
"pygame.init",
"pygame.quit",
"colorsys.hsv_to_rgb",
"numpy.array",
"copy.copy",
"importlib_resources.path",
"pygame.display.set_mode",
"pygame.display.flip",
"numpy.ndenumerate",
"pygame.draw.rect",
"numpy.ones",
"gym.spaces.MultiDiscrete",
"numpy.indices",
"numpy.any",
... | [((567, 586), 'numpy.prod', 'np.prod', (['grid_shape'], {}), '(grid_shape)\n', (574, 586), True, 'import numpy as np\n'), ((1274, 1312), 'gym.spaces.MultiDiscrete', 'spaces.MultiDiscrete', (['nvec_observation'], {}), '(nvec_observation)\n', (1294, 1312), False, 'from gym import Env, spaces\n'), ((1336, 1368), 'numpy.ar... |
import tables
import numpy as np
import matplotlib.pyplot as plt
# Reading the file.
fileh = tables.open_file('development.hdf5', mode='r')
# Dimentionality of the data structure.
print(fileh.root.utterance_test.shape)
print(fileh.root.utterance_train.shape)
print(fileh.root.label_train.shape)
print(fileh.root.label_... | [
"tables.open_file"
] | [((94, 140), 'tables.open_file', 'tables.open_file', (['"""development.hdf5"""'], {'mode': '"""r"""'}), "('development.hdf5', mode='r')\n", (110, 140), False, 'import tables\n')] |
#!/usr/bin/env python
from distutils.core import setup
setup(name='Mimik',
version='1.0',
description='Python framework for markov models',
author='<NAME>',
author_email='<EMAIL>',
url='https://www.python.org/sigs/distutils-sig/',
packages=['distutils', 'distutils.command'],
... | [
"distutils.core.setup"
] | [((57, 292), 'distutils.core.setup', 'setup', ([], {'name': '"""Mimik"""', 'version': '"""1.0"""', 'description': '"""Python framework for markov models"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://www.python.org/sigs/distutils-sig/"""', 'packages': "['distutils', 'distutils.comman... |
import os
import shutil
import sqlite3
import tarfile
from datetime import datetime
import bagit
def create_package(images, batch_dir):
package_threshold = 838860800 # 800 Mib to the next power of 2 = 1GiB
print("Package threshold: " + get_human_readable_file_size(package_threshold))
abs_path = os.getc... | [
"sqlite3.connect",
"os.makedirs",
"datetime.datetime.utcnow",
"os.path.join",
"os.getcwd",
"os.path.split",
"shutil.rmtree",
"bagit.make_bag",
"os.walk"
] | [((313, 324), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (322, 324), False, 'import os\n'), ((1870, 2625), 'bagit.make_bag', 'bagit.make_bag', (['batch_dir', "{'Source-Organization': 'Deplatformr Project', 'Organization-Address':\n 'https://open-images.deplatformr.com', 'External-Description':\n 'This package co... |
import sklearn
import pandas
import seaborn as sns
import matplotlib.pyplot as pyplot
from functools import reduce
# import numpy as np
def metrics_from_prediction_and_label(labels, predictions, verbose=False):
measures = {
"accuracy": sklearn.metrics.accuracy_score(labels, predictions),
"balance... | [
"sklearn.metrics.accuracy_score",
"sklearn.preprocessing.LabelBinarizer",
"sklearn.metrics.f1_score",
"matplotlib.pyplot.xticks",
"sklearn.metrics.balanced_accuracy_score",
"sklearn.metrics.classification_report",
"sklearn.metrics.average_precision_score",
"seaborn.heatmap",
"sklearn.metrics.roc_auc... | [((4466, 4560), 'sklearn.metrics.classification_report', 'sklearn.metrics.classification_report', ([], {'y_true': 'labels', 'y_pred': 'predictions', 'output_dict': '(True)'}), '(y_true=labels, y_pred=predictions,\n output_dict=True)\n', (4503, 4560), False, 'import sklearn\n'), ((4637, 4675), 'sklearn.preprocessing.... |
import warnings
from unittest.mock import patch
from django.apps import apps
from django.core import management
from django.core.management.base import CommandError
from django.db import models
from django.db.utils import ProgrammingError
from django.test import TransactionTestCase, tag
from django_pgschemas.checks i... | [
"django.db.models.TextField",
"django.core.management.call_command",
"django_pgschemas.utils.get_tenant_model",
"warnings.catch_warnings",
"django.apps.apps.get_app_config",
"warnings.simplefilter",
"django.test.tag",
"unittest.mock.patch"
] | [((460, 478), 'django_pgschemas.utils.get_tenant_model', 'get_tenant_model', ([], {}), '()\n', (476, 478), False, 'from django_pgschemas.utils import get_tenant_model\n'), ((706, 716), 'django.test.tag', 'tag', (['"""bug"""'], {}), "('bug')\n", (709, 716), False, 'from django.test import TransactionTestCase, tag\n'), (... |
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 14:47:13 2021
@author: huzongxiang
"""
import tensorflow as tf
from tensorflow.keras import layers
class PartitionPadding(layers.Layer):
def __init__(self, batch_size, **kwargs):
super().__init__(**kwargs)
self.batch_size = batch_size
def ... | [
"tensorflow.unique",
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.reduce_sum",
"tensorflow.reduce_max",
"tensorflow.gather",
"tensorflow.dynamic_partition",
"tensorflow.squeeze"
] | [((428, 490), 'tensorflow.dynamic_partition', 'tf.dynamic_partition', (['features', 'graph_indices', 'self.batch_size'], {}), '(features, graph_indices, self.batch_size)\n', (448, 490), True, 'import tensorflow as tf\n'), ((624, 651), 'tensorflow.reduce_max', 'tf.reduce_max', (['num_features'], {}), '(num_features)\n',... |
from django.urls import path
from . import views
app_name = 'reservation'
urlpatterns = [
path('', views.reserve_table, name = 'reserve_table'),
] | [
"django.urls.path"
] | [((96, 147), 'django.urls.path', 'path', (['""""""', 'views.reserve_table'], {'name': '"""reserve_table"""'}), "('', views.reserve_table, name='reserve_table')\n", (100, 147), False, 'from django.urls import path\n')] |
#!/usr/bin/env python3
"""
Author : <NAME> <<EMAIL>>
Date : 2021-12-15
Purpose: Working with lists
"""
import argparse
# --------------------------------------------------
def get_args():
"""Get command-line arguments"""
parser = argparse.ArgumentParser(
description="Working with lists",
f... | [
"argparse.ArgumentParser"
] | [((244, 362), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Working with lists"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Working with lists', formatter_class=\n argparse.ArgumentDefaultsHelpFormatter)\n", (267, 362), False, 'import argparse\n'... |
import numpy as np
import cv2
import os
import json
import glob
from PIL import Image, ImageDraw
plate_diameter = 25 #cm
plate_depth = 1.5 #cm
plate_thickness = 0.2 #cm
def Max(x, y):
if (x >= y):
return x
else:
return y
def polygons_to_mask(img_shape, polygons):
mask = np.zeros(img_shape... | [
"PIL.Image.fromarray",
"cv2.pointPolygonTest",
"numpy.max",
"numpy.array",
"numpy.zeros",
"numpy.argwhere",
"PIL.ImageDraw.Draw",
"numpy.min",
"json.load",
"cv2.imread"
] | [((2774, 2798), 'cv2.imread', 'cv2.imread', (['"""out.png"""', '(0)'], {}), "('out.png', 0)\n", (2784, 2798), False, 'import cv2\n'), ((302, 337), 'numpy.zeros', 'np.zeros', (['img_shape'], {'dtype': 'np.uint8'}), '(img_shape, dtype=np.uint8)\n', (310, 337), True, 'import numpy as np\n'), ((349, 370), 'PIL.Image.fromar... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cntk as C
import numpy as np
from .common import floatx, epsilon, image_dim_ordering, image_data_format
from collections import defaultdict
from contextlib import contextmanager
import warnings
C.set_g... | [
"cntk.cntk_py.Value",
"cntk.constant",
"cntk.element_select",
"numpy.random.binomial",
"cntk.assign",
"cntk.swapaxes",
"cntk.relu",
"cntk.pooling",
"cntk.initializer.normal",
"cntk.log",
"numpy.random.seed",
"warnings.warn",
"cntk.less_equal",
"cntk.sin",
"cntk.one_hot",
"cntk.sequence... | [((313, 349), 'cntk.set_global_option', 'C.set_global_option', (['"""align_axis"""', '(1)'], {}), "('align_axis', 1)\n", (332, 349), True, 'import cntk as C\n'), ((371, 400), 'cntk.device.use_default_device', 'C.device.use_default_device', ([], {}), '()\n', (398, 400), True, 'import cntk as C\n'), ((854, 933), 'cntk.co... |
# -*- coding: utf-8 -*-
"""
oauthlib.oauth1.rfc5849.endpoints.resource
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This module is an implementation of the resource protection provider logic of
OAuth 1.0 RFC 5849.
"""
from __future__ import absolute_import, unicode_literals
from oauthlib.common import log
from .base i... | [
"oauthlib.common.log.info"
] | [((6638, 6688), 'oauthlib.common.log.info', 'log.info', (['"""[Failure] request verification failed."""'], {}), "('[Failure] request verification failed.')\n", (6646, 6688), False, 'from oauthlib.common import log\n'), ((6701, 6743), 'oauthlib.common.log.info', 'log.info', (['"""Valid client: %s"""', 'valid_client'], {... |
# Natural Language Toolkit: Aligner Utilities
#
# Copyright (C) 2001-2015 NLTK Project
# Author: <NAME>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
from nltk.align.api import Alignment
def pharaohtext2tuples(pharaoh_text):
"""
Converts pharaoh text format into an Alignment object ... | [
"nltk.align.api.Alignment"
] | [((893, 918), 'nltk.align.api.Alignment', 'Alignment', (['list_of_tuples'], {}), '(list_of_tuples)\n', (902, 918), False, 'from nltk.align.api import Alignment\n')] |
#!/usr/bin/env python3
import copy
import math
import torch
from ..distributions import MultivariateNormal
from ..lazy import DiagLazyTensor, LowRankRootAddedDiagLazyTensor, LowRankRootLazyTensor, MatmulLazyTensor, delazify
from ..mlls import InducingPointKernelAddedLossTerm
from ..models import exact_prediction_str... | [
"copy.deepcopy",
"torch.nn.Parameter",
"torch.equal",
"torch.triangular_solve"
] | [((2083, 2102), 'torch.equal', 'torch.equal', (['x1', 'x2'], {}), '(x1, x2)\n', (2094, 2102), False, 'import torch\n'), ((848, 883), 'torch.nn.Parameter', 'torch.nn.Parameter', (['inducing_points'], {}), '(inducing_points)\n', (866, 883), False, 'import torch\n'), ((1790, 1823), 'torch.triangular_solve', 'torch.triangu... |
import logging
import os
from flask import Flask
from flask_cors import CORS
from app.extensions import api
from app.extensions.database import db
from app.extensions.schema import ma
from app.views import albums, artists, hello, tracks
def create_app(config, **kwargs):
logging.basicConfig(level=logging.INFO)
... | [
"logging.basicConfig",
"app.extensions.schema.ma.init_app",
"flask_cors.CORS",
"flask.Flask",
"os.makedirs",
"app.extensions.api.register_blueprint",
"app.extensions.api.init_app",
"app.extensions.database.db.init_app",
"app.extensions.database.db.create_all"
] | [((280, 319), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (299, 319), False, 'import logging\n'), ((331, 356), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__, **kwargs)\n', (336, 356), False, 'from flask import Flask\n'), ((361, 410), 'flask_cors.CORS... |
# Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
"tensorflow_probability.python.bijectors.Identity",
"tensorflow_probability.python.distributions.Gamma",
"tensorflow_probability.python.bijectors.Invert",
"tensorflow.compat.v2.TensorShape",
"tensorflow_probability.python.bijectors.bijector_test_util.assert_scalar_congruency",
"tensorflow_probability.pyth... | [((3555, 3569), 'tensorflow.compat.v2.test.main', 'tf.test.main', ([], {}), '()\n', (3567, 3569), True, 'import tensorflow.compat.v2 as tf\n'), ((2413, 2534), 'tensorflow_probability.python.bijectors.bijector_test_util.assert_scalar_congruency', 'bijector_test_util.assert_scalar_congruency', (['bijector'], {'lower_x': ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###################################################################
# Author: <NAME>
# Date : 2019.2
# Email : <EMAIL>
###################################################################
"""
MAlert class.
"""
import six
import functools
from dayu_widgets.avatar import MAv... | [
"dayu_widgets.qt.QHBoxLayout",
"dayu_widgets.qt.Property",
"dayu_widgets.label.MLabel",
"functools.partial",
"dayu_widgets.tool_button.MToolButton",
"dayu_widgets.avatar.MAvatar"
] | [((3636, 3689), 'dayu_widgets.qt.Property', 'Property', (['six.text_type', 'get_dayu_text', 'set_dayu_text'], {}), '(six.text_type, get_dayu_text, set_dayu_text)\n', (3644, 3689), False, 'from dayu_widgets.qt import QWidget, QHBoxLayout, MPixmap, Qt, MIcon, Property\n'), ((3706, 3749), 'dayu_widgets.qt.Property', 'Prop... |
import tensorflow as tf
import numpy as np
import hyperchamber as hc
from hypergan.losses.base_loss import BaseLoss
from hypergan.multi_component import MultiComponent
TINY=1e-8
class MultiLoss(BaseLoss):
"""Takes multiple distributions and does an additional approximator"""
def _create(self, d_real, d_fake):... | [
"tensorflow.add_n",
"hypergan.multi_component.MultiComponent"
] | [((908, 959), 'hypergan.multi_component.MultiComponent', 'MultiComponent', ([], {'combine': '"""concat"""', 'components': 'losses'}), "(combine='concat', components=losses)\n", (922, 959), False, 'from hypergan.multi_component import MultiComponent\n'), ((692, 708), 'tensorflow.add_n', 'tf.add_n', (['ds[1:]'], {}), '(d... |
import logging
from typing import Any, Dict, List
from fastapi import APIRouter, Body, Depends, Security
from fastapi_pagination import (
Page,
Params,
)
from fastapi_pagination.bases import AbstractPage
from fastapi_pagination.ext.sqlalchemy import paginate
from fidesops.schemas.shared_schemas import FidesOp... | [
"logging.getLogger",
"fastapi.Security",
"pydantic.conlist",
"fidesops.schemas.api.BulkUpdateFailed",
"fastapi_pagination.ext.sqlalchemy.paginate",
"fidesops.models.policy.RuleTarget.create_or_update",
"fidesops.models.policy.Rule.filter",
"fastapi.Body",
"fidesops.models.policy.Policy.get_by",
"f... | [((1199, 1252), 'fastapi.APIRouter', 'APIRouter', ([], {'tags': "['Policy']", 'prefix': 'urls.V1_URL_PREFIX'}), "(tags=['Policy'], prefix=urls.V1_URL_PREFIX)\n", (1208, 1252), False, 'from fastapi import APIRouter, Body, Depends, Security\n'), ((1263, 1290), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}),... |
# -*- coding: UTF-8 -*-
# Copyright 2010-2018 Rumma & Ko Ltd
# License: BSD (see file COPYING for details)
from builtins import object
from django.contrib.contenttypes.models import *
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.text import format_lazy
... | [
"django.utils.translation.ugettext_lazy",
"lino.core.gfks.gfk2lookup",
"lino.api.dd.update_field"
] | [((568, 586), 'django.utils.translation.ugettext_lazy', '_', (['"""Controlled by"""'], {}), "('Controlled by')\n", (569, 586), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1465, 1507), 'lino.api.dd.update_field', 'dd.update_field', (['cls', '"""owner_id"""'], {}), "(cls, 'owner_id', **kwargs)\n... |
import time
import psutil
import pymysql
from fastapi import APIRouter
from api.utils import response_code
router = APIRouter()
@router.get('/dashboard/getinfo')
def getinfo():
from init_global import g
res = {}
db = g.db_pool.connection()
cur = db.cursor()
cur.execute(f'select count(app_name) ... | [
"init_global.g.db_pool.connection",
"psutil.cpu_percent",
"init_global.g.dc.networks.list",
"psutil.disk_usage",
"main.socket_manager.emit",
"api.utils.response_code.resp_200",
"psutil.virtual_memory",
"time.sleep",
"psutil.disk_partitions",
"fastapi.APIRouter",
"psutil.cpu_count",
"init_globa... | [((119, 130), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (128, 130), False, 'from fastapi import APIRouter\n'), ((234, 256), 'init_global.g.db_pool.connection', 'g.db_pool.connection', ([], {}), '()\n', (254, 256), False, 'from init_global import g\n'), ((810, 851), 'api.utils.response_code.resp_200', 'respons... |
import torch
import torch.nn as nn
import numpy as np
import math
class ForwardKinematics:
def __init__(self, args, edges):
self.topology = [-1] * (len(edges) + 1)
self.rotation_map = []
for i, edge in enumerate(edges):
self.topology[edge[1]] = edge[0]
self.rotation... | [
"torch.optim.Adam",
"torch.sin",
"torch.nn.MSELoss",
"torch.norm",
"torch.cos",
"numpy.array",
"torch.tensor",
"torch.matmul",
"torch.empty",
"torch.zeros"
] | [((2281, 2344), 'torch.empty', 'torch.empty', (['(rotation.shape[:-1] + (3,))'], {'device': 'position.device'}), '(rotation.shape[:-1] + (3,), device=position.device)\n', (2292, 2344), False, 'import torch\n'), ((2363, 2405), 'torch.norm', 'torch.norm', (['rotation'], {'dim': '(-1)', 'keepdim': '(True)'}), '(rotation, ... |
import pygame, math
from game import map, ui
window = pygame.display.set_mode([800, 600])
ui.window = window
screen = "game"
s = {"fullscreen": False}
running = True
gamedata = {"level": 0, "coal": 0, "iron": 1, "copper":0}
tiles = pygame.sprite.Group()
rails = pygame.sprite.Group()
carts = pygame.sprite.Group()
inter... | [
"pygame.quit",
"pygame.sprite.spritecollide",
"pygame.event.get",
"pygame.surface.Surface",
"pygame.sprite.Group",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.sprite.Sprite.__init__",
"math.floor",
"pygame.mouse.get_pos",
"game.ui.Text",
"pygame.time.Clock",
"pygame.image.load"... | [((55, 90), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[800, 600]'], {}), '([800, 600])\n', (78, 90), False, 'import pygame, math\n'), ((233, 254), 'pygame.sprite.Group', 'pygame.sprite.Group', ([], {}), '()\n', (252, 254), False, 'import pygame, math\n'), ((263, 284), 'pygame.sprite.Group', 'pygame.sprit... |
"""
Algorithms for solving Parametric Risch Differential Equations.
The methods used for solving Parametric Risch Differential Equations parallel
those for solving Risch Differential Equations. See the outline in the
docstring of rde.py for more information.
The Parametric Risch Differential Equation problem is, giv... | [
"sympy.integrals.risch.derivation",
"sympy.polys.Poly",
"sympy.matrices.zeros",
"sympy.integrals.risch.frac_in",
"sympy.integrals.risch.DecrementLevel",
"sympy.integrals.rde.order_at",
"sympy.matrices.eye",
"sympy.core.Mul",
"sympy.integrals.rde.bound_degree",
"sympy.polys.polymatrix.PolyMatrix",
... | [((1901, 1920), 'sympy.integrals.risch.splitfactor', 'splitfactor', (['fd', 'DE'], {}), '(fd, DE)\n', (1912, 1920), False, 'from sympy.integrals.risch import gcdex_diophantine, frac_in, derivation, residue_reduce, splitfactor, residue_reduce_derivation, DecrementLevel, recognize_log_derivative\n'), ((2022, 2041), 'symp... |
from pprint import pprint
import yaml
import netmiko
import paramiko
def send_cmd_with_prompt(device, command, *, wait_for, confirmation):
if type(wait_for) == str:
wait_for = [wait_for]
if type(confirmation) == str:
confirmation = [confirmation]
with netmiko.Netmiko(**device) as ssh:
... | [
"yaml.safe_load",
"netmiko.Netmiko"
] | [((282, 307), 'netmiko.Netmiko', 'netmiko.Netmiko', ([], {}), '(**device)\n', (297, 307), False, 'import netmiko\n'), ((782, 799), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (796, 799), False, 'import yaml\n')] |
# GROWNG BEYOND EARTH CONTROL BOX Traning
# RASPBERRY PI PICO / MICROPYTHON
# FAIRCHILD TROPICAL BOTANIC GARDEN, Oct 18, 2021
# The Growing Beyond Earth (GBE) control box is a device that controls
# the LED lights and fan in a GBE growth chamber. It can also control
# accessories including a 12v water pump and enviro... | [
"machine.Pin",
"time.sleep"
] | [((2409, 2422), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (2419, 2422), False, 'import time\n'), ((1639, 1653), 'machine.Pin', 'machine.Pin', (['(0)'], {}), '(0)\n', (1650, 1653), False, 'import machine\n'), ((1700, 1714), 'machine.Pin', 'machine.Pin', (['(2)'], {}), '(2)\n', (1711, 1714), False, 'import mach... |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.reset_default_graph",
"tensorflow.placeholder",
"nets.mobilenet.mobilenet.training_scope",
"tensorflow.test.main",
"copy.deepcopy",
"tensorflow.get_default_graph"
] | [((1190, 1212), 'tensorflow.get_default_graph', 'tf.get_default_graph', ([], {}), '()\n', (1210, 1212), True, 'import tensorflow as tf\n'), ((7068, 7082), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (7080, 7082), True, 'import tensorflow as tf\n'), ((1348, 1372), 'tensorflow.reset_default_graph', 'tf.rese... |
from firebase import firebase
import os
import datetime
import json
import logging
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from github3 import login
firebase_url = os.environ['FIREBASE_DB']
firebase_secret = os.environ['FIREBASE_SECRET']
firebase_path = os.environ['FIREBASE_PATH']
fireb... | [
"logging.basicConfig",
"logging.getLogger",
"firebase.firebase.FirebaseApplication",
"json.dumps",
"firebase.firebase.FirebaseAuthentication",
"github3.login"
] | [((487, 526), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (506, 526), False, 'import logging\n'), ((536, 563), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (553, 563), False, 'import logging\n'), ((916, 978), 'json.dumps', 'js... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `ged4py.date` module."""
import unittest
from ged4py.calendar import (
CalendarType, CalendarDate, FrenchDate, GregorianDate, HebrewDate, JulianDate,
CalendarDateVisitor
)
from ged4py.date import (
DateValue, DateValueAbout, DateValueAfter, DateV... | [
"ged4py.date.DateValueSimple",
"ged4py.date.DateValueAfter",
"ged4py.date.DateValuePhrase",
"ged4py.calendar.FrenchDate",
"ged4py.date.DateValueRange",
"ged4py.date.DateValue.parse",
"ged4py.date.DateValueAbout",
"ged4py.date.DateValuePeriod",
"ged4py.calendar.HebrewDate",
"ged4py.date.DateValueCa... | [((3455, 3484), 'ged4py.calendar.GregorianDate', 'GregorianDate', (['(2017)', '"""OCT"""', '(9)'], {}), "(2017, 'OCT', 9)\n", (3468, 3484), False, 'from ged4py.calendar import CalendarType, CalendarDate, FrenchDate, GregorianDate, HebrewDate, JulianDate, CalendarDateVisitor\n'), ((3858, 3893), 'ged4py.calendar.Gregoria... |
import time
import h5py
import hdbscan
import numpy as np
import torch
from sklearn.cluster import MeanShift
from pytorch3dunet.datasets.hdf5 import SliceBuilder
from pytorch3dunet.unet3d.utils import get_logger
from pytorch3dunet.unet3d.utils import unpad
logger = get_logger('UNet3DPredictor')
class _AbstractPred... | [
"numpy.bitwise_or",
"numpy.unique",
"sklearn.cluster.MeanShift",
"pytorch3dunet.unet3d.utils.unpad",
"pytorch3dunet.datasets.hdf5.SliceBuilder._build_slices",
"numpy.argmax",
"h5py.File",
"pytorch3dunet.unet3d.utils.get_logger",
"numpy.max",
"numpy.zeros",
"numpy.bitwise_and",
"numpy.expand_di... | [((269, 298), 'pytorch3dunet.unet3d.utils.get_logger', 'get_logger', (['"""UNet3DPredictor"""'], {}), "('UNet3DPredictor')\n", (279, 298), False, 'from pytorch3dunet.unet3d.utils import get_logger\n'), ((3293, 3325), 'h5py.File', 'h5py.File', (['self.output_file', '"""w"""'], {}), "(self.output_file, 'w')\n", (3302, 33... |