code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2019 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 to in writing, s... | [
"synthtool.shell.run",
"synthtool.gcp.GAPICBazel",
"synthtool.languages.python.fix_pb2_grpc_headers",
"synthtool.replace",
"synthtool.languages.python.fix_pb2_headers",
"synthtool.move",
"synthtool.gcp.CommonTemplates"
] | [((757, 773), 'synthtool.gcp.GAPICBazel', 'gcp.GAPICBazel', ([], {}), '()\n', (771, 773), True, 'import synthtool.gcp as gcp\n'), ((783, 804), 'synthtool.gcp.CommonTemplates', 'gcp.CommonTemplates', ([], {}), '()\n', (802, 804), True, 'import synthtool.gcp as gcp\n'), ((2073, 2252), 'synthtool.replace', 's.replace', ([... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import, division
from alchemist.db import session
from alchemist.conf import settings
from importlib import import_module
from alchemist.db.query import Query
from sqlalchemy.orm.util import has_identity
from sqlalchemy.ext.declarative import cls... | [
"sqlalchemy.ext.declarative.base.__module__.startswith",
"weakref.WeakValueDictionary",
"alchemist.db.session.flush",
"alchemist.db.session.commit",
"sqlalchemy.MetaData",
"sqlalchemy.orm.util.has_identity",
"alchemist.db.session.query",
"alchemist.conf.settings.get",
"six.with_metaclass",
"alchem... | [((1260, 1273), 'sqlalchemy.MetaData', 'sa.MetaData', ([], {}), '()\n', (1271, 1273), True, 'import sqlalchemy as sa\n'), ((2443, 2483), 'six.with_metaclass', 'six.with_metaclass', (['ModelBaseProxy', 'type'], {}), '(ModelBaseProxy, type)\n', (2461, 2483), False, 'import six\n'), ((5743, 5772), 'six.with_metaclass', 's... |
import os, sys, inspect
import multiprocessing
import platform
def setup_paths(caffe_path, malis_path):
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile(inspect.currentframe()))[0]))
if cmd_folder not in sys.path:
sys.path.append(cmd_folder)
cmd_subfolder = os.pa... | [
"platform.version",
"inspect.currentframe",
"platform.platform",
"platform.linux_distribution",
"multiprocessing.cpu_count",
"os.getcwd",
"os.chdir",
"platform.uname",
"platform.system",
"platform.mac_ver",
"platform.machine",
"platform.dist",
"sys.exit",
"os.system",
"sys.version.split"... | [((757, 796), 'sys.path.append', 'sys.path.append', (["(caffe_path + '/python')"], {}), "(caffe_path + '/python')\n", (772, 796), False, 'import os, sys, inspect\n'), ((801, 840), 'sys.path.append', 'sys.path.append', (["(malis_path + '/python')"], {}), "(malis_path + '/python')\n", (816, 840), False, 'import os, sys, ... |
# -*- coding: utf-8 -*-
from datetime import datetime
from django import forms
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ValidationError
from django.db.models.signals import pre_delete
from django.dispatch import receiver
from django.template.loader import render_to... | [
"django.utils.translation.ugettext_lazy",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"datetime.datetime.strptime",
"django.utils.translation.ugettext_noop",
"django.forms.DateTimeInput",
"django.utils.translation.ugettext",
"openslides.projector.api.get_active_slide",
"ope... | [((1011, 1070), 'django.dispatch.receiver', 'receiver', (['config_signal'], {'dispatch_uid': '"""setup_agenda_config"""'}), "(config_signal, dispatch_uid='setup_agenda_config')\n", (1019, 1070), False, 'from django.dispatch import receiver\n'), ((3167, 3235), 'django.dispatch.receiver', 'receiver', (['projector_overlay... |
import os
import random
from cv2 import cv2
import numpy as np
import config
training_data = []
for category in config.CATEGORIES:
category_path = os.path.join(config.DATA_DIR, category)
for image_path in os.listdir(category_path):
try:
img_path = os.path.join(category_path, image_path)
... | [
"os.listdir",
"random.shuffle",
"cv2.cv2.imread",
"os.path.join",
"config.CATEGORIES.index"
] | [((580, 609), 'random.shuffle', 'random.shuffle', (['training_data'], {}), '(training_data)\n', (594, 609), False, 'import random\n'), ((155, 194), 'os.path.join', 'os.path.join', (['config.DATA_DIR', 'category'], {}), '(config.DATA_DIR, category)\n', (167, 194), False, 'import os\n'), ((217, 242), 'os.listdir', 'os.li... |
from jax.experimental import stax
from jax.experimental.stax import Dense, Conv, Relu, Flatten
def DeepQNetwork():
init_fun, predict_fun = stax.serial(
Conv(16, (8, 8), strides=(4, 4)), Relu,
Conv(32, (4, 4), strides=(2, 2)), Relu,
Conv(64, (3, 3)), Relu,
Flatten,
Dense(256... | [
"jax.experimental.stax.Conv",
"jax.experimental.stax.Dense"
] | [((166, 198), 'jax.experimental.stax.Conv', 'Conv', (['(16)', '(8, 8)'], {'strides': '(4, 4)'}), '(16, (8, 8), strides=(4, 4))\n', (170, 198), False, 'from jax.experimental.stax import Dense, Conv, Relu, Flatten\n'), ((214, 246), 'jax.experimental.stax.Conv', 'Conv', (['(32)', '(4, 4)'], {'strides': '(2, 2)'}), '(32, (... |
import random
import typing
from typing import List, Callable
from hearthstone.agent import Agent, Action, generate_valid_actions, BuyAction, EndPhaseAction, SummonAction, \
TavernUpgradeAction, RerollAction, SellFromHandAction
if typing.TYPE_CHECKING:
from hearthstone.cards import Card, MonsterCard
from ... | [
"hearthstone.agent.TavernUpgradeAction",
"hearthstone.agent.RerollAction",
"hearthstone.player.StoreIndex",
"hearthstone.agent.generate_valid_actions",
"hearthstone.agent.EndPhaseAction",
"random.Random"
] | [((789, 808), 'random.Random', 'random.Random', (['seed'], {}), '(seed)\n', (802, 808), False, 'import random\n'), ((3488, 3502), 'hearthstone.agent.RerollAction', 'RerollAction', ([], {}), '()\n', (3500, 3502), False, 'from hearthstone.agent import Agent, Action, generate_valid_actions, BuyAction, EndPhaseAction, Summ... |
from selenium import webdriver
from time import sleep
# 設定使用者偏好將通知顯示授權請求視窗關閉
op = webdriver.ChromeOptions()
prefs = {"profile.default_content_setting_values.notifications": 2}
op.add_experimental_option("prefs", prefs)
driver = webdriver.Chrome(options=op)
# 進入IG首頁
driver.get('http://instagram.com')
print('歡迎來到IG ~ ~... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"time.sleep"
] | [((83, 108), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (106, 108), False, 'from selenium import webdriver\n'), ((229, 257), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'options': 'op'}), '(options=op)\n', (245, 257), False, 'from selenium import webdriver\n'), ((325, 33... |
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
import os
import django
from django.conf import settings
django.setup()
# pylint: disable=wrong-import-position
import cavedb.models
def generate_bulletins():
attachment_filename = os.path.join(settings.MEDIA_ROOT, 'bulletin_attachments', 'index.txt')... | [
"django.setup",
"os.path.join"
] | [((120, 134), 'django.setup', 'django.setup', ([], {}), '()\n', (132, 134), False, 'import django\n'), ((250, 320), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', '"""bulletin_attachments"""', '"""index.txt"""'], {}), "(settings.MEDIA_ROOT, 'bulletin_attachments', 'index.txt')\n", (262, 320), False, 'import o... |
import requests
import urllib.parse
funcs = {'commande': {}, 'action': {}}
class Cmd(str):
'''
Object for text of message
'''
__atts = []
def __init__(self, text):
str.__init__(text)
def set_atts(self, atts):
for att in atts:
self.__atts.append(att)
@pro... | [
"requests.get"
] | [((3970, 4009), 'requests.get', 'requests.get', (['url'], {'allow_redirects': '(True)'}), '(url, allow_redirects=True)\n', (3982, 4009), False, 'import requests\n')] |
import pytest
import random
import tempfile
import fault
from common.zext_wrapper import ZextWrapper
@pytest.mark.parametrize("in_width,out_width", [(5, 10), (10, 5)])
def test_zext_wrapper(in_width, out_width):
if in_width >= out_width:
with pytest.raises(ValueError) as pytest_e:
ZextWrapper(... | [
"tempfile.TemporaryDirectory",
"fault.Tester",
"pytest.mark.parametrize",
"common.zext_wrapper.ZextWrapper",
"pytest.raises",
"random.randint"
] | [((104, 169), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""in_width,out_width"""', '[(5, 10), (10, 5)]'], {}), "('in_width,out_width', [(5, 10), (10, 5)])\n", (127, 169), False, 'import pytest\n'), ((735, 767), 'common.zext_wrapper.ZextWrapper', 'ZextWrapper', (['in_width', 'out_width'], {}), '(in_width,... |
from aiogram import Bot, Dispatcher, executor, types, utils
import aiogram
from ..core.settings import Settings
from .utils import res_dict
from ..excel.excel import Students
from ..tests.downloader import download
from ..tests.start_tests import gen_summary
bot = Bot(token=Settings().telegram_api_key)
dp = Dispatche... | [
"aiogram.Dispatcher",
"aiogram.executor.start_polling"
] | [((311, 326), 'aiogram.Dispatcher', 'Dispatcher', (['bot'], {}), '(bot)\n', (321, 326), False, 'from aiogram import Bot, Dispatcher, executor, types, utils\n'), ((2904, 2949), 'aiogram.executor.start_polling', 'executor.start_polling', (['dp'], {'skip_updates': '(True)'}), '(dp, skip_updates=True)\n', (2926, 2949), Fal... |
from fastapi import APIRouter, HTTPException
router = APIRouter()
@router.get("/1")
def hello1():
return {"message": "Hello Thing 1!"}
@router.get("/2")
def hello2():
return {"message": "Hello Thing 2!"}
@router.get("/3")
def hello3():
return {"message": "Hello Thing 3!"}
| [
"fastapi.APIRouter"
] | [((55, 66), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (64, 66), False, 'from fastapi import APIRouter, HTTPException\n')] |
"""Main script for controlling the calculation of the IS spectrum.
Calculate spectra from specified parameters as shown in the examples given in the class
methods, create a new set-up with the `Reproduce` abstract base class in `reproduce.py` or
use one of the pre-defined classes from `reproduce.py`.
"""
# The start ... | [
"isr_spectrum.plotting.reproduce.PlotSpectra",
"matplotlib.rcParams.update",
"isr_spectrum.plotting.hello_kitty.HelloKitty",
"isr_spectrum.plotting.plot_class.PlotClass",
"numpy.ndarray",
"multiprocessing.set_start_method",
"matplotlib.pyplot.show"
] | [((652, 679), 'multiprocessing.set_start_method', 'mp.set_start_method', (['"""fork"""'], {}), "('fork')\n", (671, 679), True, 'import multiprocessing as mp\n'), ((1041, 1176), 'matplotlib.rcParams.update', 'matplotlib.rcParams.update', (["{'text.usetex': True, 'font.family': 'serif', 'axes.unicode_minus': False,\n ... |
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | [
"mock.patch",
"os.path.join",
"heat.cloudinit.loguserdata.call",
"heat.cloudinit.loguserdata.main",
"heat.cloudinit.loguserdata.chk_ci_version",
"mock.MagicMock"
] | [((846, 890), 'mock.patch', 'mock.patch', (['"""pkg_resources.get_distribution"""'], {}), "('pkg_resources.get_distribution')\n", (856, 890), False, 'import mock\n'), ((1674, 1718), 'mock.patch', 'mock.patch', (['"""pkg_resources.get_distribution"""'], {}), "('pkg_resources.get_distribution')\n", (1684, 1718), False, '... |
import os
import unittest
import ddt
from httptesting.library.scripts import (load_case_data, get_run_flag)
from httptesting.library import HTMLTESTRunnerCN
from httptesting.library.http import HttpWebRequest
from httptesting.library.case import exec_test_case
from httptesting.globalVar import gl
from httptesting.libra... | [
"unittest.TestSuite",
"httptesting.library.case.exec_test_case",
"httptesting.library.HTMLTESTRunnerCN.HTMLTestRunner",
"httptesting.library.scripts.load_case_data",
"unittest.TestLoader"
] | [((1239, 1259), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (1257, 1259), False, 'import unittest\n'), ((1161, 1187), 'httptesting.library.case.exec_test_case', 'exec_test_case', (['self', 'data'], {}), '(self, data)\n', (1175, 1187), False, 'from httptesting.library.case import exec_test_case\n'), ((... |
import pytest
from common.version import InvalidVersionError, GenericVersion
from indy_common.version import NodeVersion
from indy_node.utils.node_control_utils import DebianVersion, NodeControlUtil, ShellError
# TODO
# - conditionally skip all tests for non-debian systems
generated_command = None
class UpstreamT... | [
"pytest.fixture",
"pytest.mark.parametrize",
"pytest.raises",
"indy_node.utils.node_control_utils.DebianVersion"
] | [((502, 530), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (516, 530), False, 'import pytest\n'), ((990, 1038), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""version"""', "['', '1:-1']"], {}), "('version', ['', '1:-1'])\n", (1013, 1038), False, 'import pytest\n'), (... |
import svgwrite
from svgwrite import cm, mm
dwg = svgwrite.Drawing(filename='time.svg', size=('100cm', '3000cm'), debug=True)
shapes = dwg.add(dwg.g(id='shapes', fill='red'))
text = dwg.add(dwg.g(font_size=14))
hlines = dwg.add(dwg.g(id='hlines', stroke='blue'))
def drawLine():
for y in range(100):
hlines... | [
"svgwrite.Drawing"
] | [((51, 126), 'svgwrite.Drawing', 'svgwrite.Drawing', ([], {'filename': '"""time.svg"""', 'size': "('100cm', '3000cm')", 'debug': '(True)'}), "(filename='time.svg', size=('100cm', '3000cm'), debug=True)\n", (67, 126), False, 'import svgwrite\n')] |
# -*- coding: utf-8 -*-
# Project: maxent-ml
# Author: chaoxu create this file
# Time: 2017/7/11
# Company : Maxent
# Email: <EMAIL>
"""
this file is used to draw data cloumns which has mutiple values as bar
"""
import traceback
import matplotlib.pyplot as plt
import pandas as pd
from Pic.maxent_style import maxent_st... | [
"traceback.format_exc",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"pandas.value_counts",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((791, 807), 'matplotlib.pyplot.title', 'plt.title', (['title'], {}), '(title)\n', (800, 807), True, 'import matplotlib.pyplot as plt\n'), ((820, 838), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['xlabel'], {}), '(xlabel)\n', (830, 838), True, 'import matplotlib.pyplot as plt\n'), ((851, 869), 'matplotlib.pyplot.ylabe... |
import requests
from http.client import responses
from os.path import dirname
from os import environ
import inspect
import srcomapi
import srcomapi.datatypes as datatypes
from .exceptions import APIRequestException, APINotProvidedException
# libraries for mocking
import json
import gzip
with open(dirname(srcomapi.__... | [
"inspect.getmembers",
"gzip.open",
"json.dumps",
"requests.get",
"os.path.dirname"
] | [((441, 467), 'os.path.dirname', 'dirname', (['srcomapi.__file__'], {}), '(srcomapi.__file__)\n', (448, 467), False, 'from os.path import dirname\n'), ((301, 327), 'os.path.dirname', 'dirname', (['srcomapi.__file__'], {}), '(srcomapi.__file__)\n', (308, 327), False, 'from os.path import dirname\n'), ((3163, 3190), 'req... |
from __future__ import print_function
import unittest
import numpy as np
from openmdao.api import Problem, IndepVarComp, Group
from openmdao.utils.assert_utils import assert_check_partials
from CADRE.orbit_dymos.ori_comp import ORIComp
class TestOrbitEOM(unittest.TestCase):
@classmethod
def setUpClass(cls... | [
"CADRE.orbit_dymos.ori_comp.ORIComp",
"numpy.random.rand",
"numpy.ones",
"openmdao.utils.assert_utils.assert_check_partials",
"openmdao.api.IndepVarComp",
"openmdao.api.Group",
"numpy.set_printoptions"
] | [((1121, 1172), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'linewidth': '(1024)', 'edgeitems': '(1000)'}), '(linewidth=1024, edgeitems=1000)\n', (1140, 1172), True, 'import numpy as np\n'), ((1230, 1256), 'openmdao.utils.assert_utils.assert_check_partials', 'assert_check_partials', (['cpd'], {}), '(cpd)\n',... |
"""Queenbee DAG.
A DAG defines a single step in a Recipe. Each DAG is a collection of tasks/steps. Each
step indicates what function template should be used and maps inputs and outputs for the
specific task.
"""
from queenbee.io.outputs.task import TaskPathReturn, TaskReturn
from typing import List, Set, Union
from py... | [
"pydantic.Field",
"pydantic.constr",
"pydantic.validator"
] | [((759, 780), 'pydantic.constr', 'constr', ([], {'regex': '"""^DAG$"""'}), "(regex='^DAG$')\n", (765, 780), False, 'from pydantic import Field, validator, root_validator, constr\n'), ((806, 859), 'pydantic.Field', 'Field', (['...'], {'description': '"""A unique name for this dag."""'}), "(..., description='A unique nam... |
# Slightly modified from original Lucid library
# Copyright 2018 The Lucid 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/license... | [
"string.Template",
"base64.b64encode",
"lucent.misc.io.collapse_channels.collapse_channels",
"numpy.concatenate",
"lucent.misc.io.serialize_array.serialize_array"
] | [((1795, 1858), 'lucent.misc.io.serialize_array.serialize_array', 'serialize_array', (['array'], {'fmt': 'fmt', 'quality': 'quality', 'domain': 'domain'}), '(array, fmt=fmt, quality=quality, domain=domain)\n', (1810, 1858), False, 'from lucent.misc.io.serialize_array import serialize_array, array_to_jsbuffer\n'), ((116... |
from django.urls import path
from staff.views import activity
app_name = 'staff'
urlpatterns = [
path('graph/', activity.graph, name='graph'),
path('list/', activity.list, name='list'),
path('today/', activity.for_today, name='today'),
path('user/<username>/', activity.for_user, name='user'),
pat... | [
"django.urls.path"
] | [((104, 148), 'django.urls.path', 'path', (['"""graph/"""', 'activity.graph'], {'name': '"""graph"""'}), "('graph/', activity.graph, name='graph')\n", (108, 148), False, 'from django.urls import path\n'), ((154, 195), 'django.urls.path', 'path', (['"""list/"""', 'activity.list'], {'name': '"""list"""'}), "('list/', act... |
from django.template import Library
from coursedashboards.dao.gws import is_in_admin_group
register = Library()
@register.simple_tag(takes_context=True)
def add_admin_checks(context):
context['is_overrider'] = is_in_admin_group('USERSERVICE_ADMIN_GROUP')
context['is_rest_browser'] = is_in_admin_group('RESTC... | [
"coursedashboards.dao.gws.is_in_admin_group",
"django.template.Library"
] | [((104, 113), 'django.template.Library', 'Library', ([], {}), '()\n', (111, 113), False, 'from django.template import Library\n'), ((218, 262), 'coursedashboards.dao.gws.is_in_admin_group', 'is_in_admin_group', (['"""USERSERVICE_ADMIN_GROUP"""'], {}), "('USERSERVICE_ADMIN_GROUP')\n", (235, 262), False, 'from coursedash... |
import os, json
import pandas as pd
import glob
import datetime
def create_current_df(path):
if os.path.exists(path):
df = pd.read_csv(path, sep =';', header=0).to_dict(orient="records")
return df
else:
return None
def update_record(record, key, value):
# if key in record:
if (va... | [
"os.path.exists",
"pandas.read_csv",
"datetime.datetime.strptime",
"os.path.join",
"json.load",
"pandas.DataFrame",
"os.walk"
] | [((5611, 5642), 'os.path.exists', 'os.path.exists', (['"""resources.csv"""'], {}), "('resources.csv')\n", (5625, 5642), False, 'import os, json\n'), ((5784, 5804), 'pandas.DataFrame', 'pd.DataFrame', (['n_list'], {}), '(n_list)\n', (5796, 5804), True, 'import pandas as pd\n'), ((102, 122), 'os.path.exists', 'os.path.ex... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
# Third Party Stuff
from django.contrib import admin
from simple_history.admin import SimpleHistoryAdmin
# Junction Stuff
from junction.base.admin import AuditAdmin
from . import models, service
class ConferenceAdmin(AuditAdmin):
... | [
"django.contrib.admin.site.register"
] | [((2199, 2254), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Conference', 'ConferenceAdmin'], {}), '(models.Conference, ConferenceAdmin)\n', (2218, 2254), False, 'from django.contrib import admin\n'), ((2255, 2328), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Confere... |
from sesion14.app import db
class Author(db.Model):
id = db.Column("idAuthor", db.Integer, primary_key=True)
first_name = db.Column(db.String(45))
last_name = db.Column(db.String(45))
nationality = db.Column(db.String(45)) | [
"sesion14.app.db.String",
"sesion14.app.db.Column"
] | [((62, 113), 'sesion14.app.db.Column', 'db.Column', (['"""idAuthor"""', 'db.Integer'], {'primary_key': '(True)'}), "('idAuthor', db.Integer, primary_key=True)\n", (71, 113), False, 'from sesion14.app import db\n'), ((141, 154), 'sesion14.app.db.String', 'db.String', (['(45)'], {}), '(45)\n', (150, 154), False, 'from se... |
from forex_python.converter import CurrencyRates, CurrencyCodes
from forex_python.bitcoin import BtcConverter
from random import choices
import time
balance = 15000.0
btcBalance = 0.0
btc = BtcConverter()
btcSymb = btc.get_symbol()
symbol = CurrencyCodes().get_symbol("USD")
while True:
print("\n### Welcome to Bitc... | [
"forex_python.bitcoin.BtcConverter",
"random.choices",
"forex_python.converter.CurrencyCodes",
"time.sleep"
] | [((192, 206), 'forex_python.bitcoin.BtcConverter', 'BtcConverter', ([], {}), '()\n', (204, 206), False, 'from forex_python.bitcoin import BtcConverter\n'), ((244, 259), 'forex_python.converter.CurrencyCodes', 'CurrencyCodes', ([], {}), '()\n', (257, 259), False, 'from forex_python.converter import CurrencyRates, Curren... |
# Copyright 2019 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 to in writing, ... | [
"metrics.monitor.metrics_store",
"bot.startup.run_bot._Monitor",
"mock.Mock",
"metrics.monitoring_metrics.TASK_COUNT.get",
"tests.test_libs.helpers.MockTime"
] | [((895, 913), 'tests.test_libs.helpers.MockTime', 'helpers.MockTime', ([], {}), '()\n', (911, 913), False, 'from tests.test_libs import helpers\n'), ((1024, 1035), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1033, 1035), False, 'import mock\n'), ((1360, 1371), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1369, 1371), ... |
from keras.utils import Sequence
from keras.preprocessing.sequence import pad_sequences
import numpy as np
import json
from multiprocessing import Pool
class DataGenerator(Sequence):
def __init__(self, filepaths: str, encoded_labels: dict, max_length: int, batch_size: int=32, shuffle: bool=True, mp: bool=True):
... | [
"json.load",
"numpy.array",
"multiprocessing.Pool",
"numpy.random.shuffle"
] | [((345, 364), 'numpy.array', 'np.array', (['filepaths'], {}), '(filepaths)\n', (353, 364), True, 'import numpy as np\n'), ((824, 855), 'numpy.random.shuffle', 'np.random.shuffle', (['self.indexes'], {}), '(self.indexes)\n', (841, 855), True, 'import numpy as np\n'), ((1224, 1241), 'json.load', 'json.load', (['infile'],... |
import math
from .lang import H, sig, t
#=============================================================================#
# Standard types, classes, and related functions
## Basic data types
from .Data.Maybe import Maybe, Just, Nothing, in_maybe, maybe
from .Data.Either import Either, Left, Right, in_either, either
... | [
"math.gcd"
] | [((2691, 2705), 'math.gcd', 'math.gcd', (['x', 'y'], {}), '(x, y)\n', (2699, 2705), False, 'import math\n')] |
#!/usr/bin/env python
import numpy as np
import scipy.stats as stats
import itertools
import matplotlib
from matplotlib import cm
from matplotlib.ticker import FuncFormatter
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import sklearn as sk
import sklearn.linear_model
from volcanic.helpers import bround
from ... | [
"numpy.clip",
"matplotlib.cm.colors.Normalize",
"volcanic.tof.calc_tof",
"numpy.hstack",
"matplotlib.pyplot.ylabel",
"numpy.array",
"numpy.arange",
"numpy.mean",
"matplotlib.ticker.FuncFormatter",
"matplotlib.pyplot.xlabel",
"numpy.sort",
"itertools.product",
"numpy.linspace",
"numpy.vstac... | [((176, 197), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (190, 197), False, 'import matplotlib\n'), ((1549, 1565), 'numpy.zeros_like', 'np.zeros_like', (['d'], {}), '(d)\n', (1562, 1565), True, 'import numpy as np\n'), ((5379, 5404), 'numpy.hstack', 'np.hstack', (['(d_refill, d2)'], {}), '((d... |
import scrapy
from kingfisher_scrapy.base_spider import CompressedFileSpider
from kingfisher_scrapy.util import components, handle_http_error
class MexicoAdministracionPublicaFederalBulk(CompressedFileSpider):
"""
Domain
Administración Pública Federal (APF): Secretaría de Hacienda y Crédito Público (SH... | [
"scrapy.Request",
"kingfisher_scrapy.util.components"
] | [((679, 871), 'scrapy.Request', 'scrapy.Request', (['"""https://datos.gob.mx/busca/api/3/action/package_search?q=concentrado-de-contrataciones-abiertas-de-la-apf"""'], {'meta': "{'file_name': 'list.json'}", 'callback': 'self.parse_list'}), "(\n 'https://datos.gob.mx/busca/api/3/action/package_search?q=concentrado-de... |
from datetime import datetime, timezone
from django.test import TestCase
from django_bulk_load import bulk_upsert_models
from .test_project.models import (
TestComplexModel,
TestForeignKeyModel,
)
class E2ETestBulkUpsertModels(TestCase):
def test_empty_upsert(self):
self.assertEqual(bulk_upsert_m... | [
"datetime.datetime",
"django_bulk_load.bulk_upsert_models"
] | [((718, 753), 'django_bulk_load.bulk_upsert_models', 'bulk_upsert_models', (['[unsaved_model]'], {}), '([unsaved_model])\n', (736, 753), False, 'from django_bulk_load import bulk_upsert_models\n'), ((1184, 1212), 'django_bulk_load.bulk_upsert_models', 'bulk_upsert_models', (['[model1]'], {}), '([model1])\n', (1202, 121... |
# -*- coding: utf-8 -*-
"""
controlbeast
~~~~~~~~~~~~
:copyright: Copyright 2013, 2014 by the ControlBeast team, see AUTHORS.
:license: ISC, see LICENSE for details.
"""
VERSION = (0, 1, 0, 'alpha', 0)
COPYRIGHT = ('2013, 2014', 'the ControlBeast team')
def get_version(*args, **kwargs):
"""
... | [
"controlbeast.utils.version.get_development_status",
"controlbeast.utils.version.get_version"
] | [((465, 493), 'controlbeast.utils.version.get_version', 'get_version', (['*args'], {}), '(*args, **kwargs)\n', (476, 493), False, 'from controlbeast.utils.version import get_version\n'), ((729, 768), 'controlbeast.utils.version.get_development_status', 'get_development_status', (['*args'], {}), '(*args, **kwargs)\n', (... |
#! /usr/bin/python3
import tkinter
import tkinter.messagebox as mb
def main():
window = tkinter.Tk()
mb.showinfo("Yo yo title", "Yo yo body")
answer = mb.askquestion("Do you ...", "Do something ?")
if answer == "yes":
print("Ok")
window.mainloop()
if __name__ == '__main__':
main(... | [
"tkinter.messagebox.askquestion",
"tkinter.Tk",
"tkinter.messagebox.showinfo"
] | [((94, 106), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (104, 106), False, 'import tkinter\n'), ((113, 153), 'tkinter.messagebox.showinfo', 'mb.showinfo', (['"""Yo yo title"""', '"""Yo yo body"""'], {}), "('Yo yo title', 'Yo yo body')\n", (124, 153), True, 'import tkinter.messagebox as mb\n'), ((168, 214), 'tkinter.... |
import numpy as np
from dnnv.properties.expressions import *
from dnnv.properties.visitors import DetailsInference
def test_Image_symbolic():
inference = DetailsInference()
expr = Image(Symbol("path"))
inference.visit(expr)
assert not inference.shapes[expr].is_concrete
assert not inference.type... | [
"numpy.random.rand",
"numpy.save",
"dnnv.properties.visitors.DetailsInference"
] | [((161, 179), 'dnnv.properties.visitors.DetailsInference', 'DetailsInference', ([], {}), '()\n', (177, 179), False, 'from dnnv.properties.visitors import DetailsInference\n'), ((393, 411), 'dnnv.properties.visitors.DetailsInference', 'DetailsInference', ([], {}), '()\n', (409, 411), False, 'from dnnv.properties.visitor... |
import json
import os
import glob
import shutil
import logging
import time
import itertools
from nullunit.common import GIT_CMD, WORK_DIR, PACKAGE_MANAGER, getPackrat, getContractor, getConfluence, runMake, MakeException
from nullunit.procutils import execute, execute_rc, ExecutionException
from nullunit.targets import... | [
"json.loads",
"logging.warn",
"os.makedirs",
"nullunit.common.runMake",
"nullunit.targets.testTarget",
"nullunit.targets.docTarget",
"json.dumps",
"os.path.join",
"nullunit.procutils.execute",
"nullunit.targets.otherTarget",
"nullunit.common.getPackrat",
"shutil.rmtree",
"time.time",
"null... | [((4098, 4119), 'os.walk', 'os.walk', (["state['dir']"], {}), "(state['dir'])\n", (4105, 4119), False, 'import os\n'), ((4532, 4572), 'logging.info', 'logging.info', (['"""iterate: executing clean"""'], {}), "('iterate: executing clean')\n", (4544, 4572), False, 'import logging\n'), ((6223, 6269), 'logging.info', 'logg... |
from cryptography.hazmat.backends import default_backend
from requests.models import HTTPBasicAuth
import jwt
import requests
import time
import os
gh_pat = os.environ.get("GH_PAT")
gh_user = "maoo"
gh_app_id = os.environ.get("GH_APP_ID")
fname = os.environ.get("GH_PRIVATE_KEY")
cert_str = open(fname, 'r').read()
cert... | [
"os.environ.get",
"jwt.encode",
"requests.models.HTTPBasicAuth",
"time.time",
"cryptography.hazmat.backends.default_backend"
] | [((158, 182), 'os.environ.get', 'os.environ.get', (['"""GH_PAT"""'], {}), "('GH_PAT')\n", (172, 182), False, 'import os\n'), ((212, 239), 'os.environ.get', 'os.environ.get', (['"""GH_APP_ID"""'], {}), "('GH_APP_ID')\n", (226, 239), False, 'import os\n'), ((248, 280), 'os.environ.get', 'os.environ.get', (['"""GH_PRIVATE... |
#!/usr/bin/env python3
""" FOP
Filter Orderer and Preener
Copyright (C) 2011 Michael
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 yo... | [
"re.compile",
"os.walk",
"re.search",
"os.remove",
"argparse.ArgumentParser",
"subprocess.Popen",
"subprocess.CalledProcessError",
"os.path.isdir",
"subprocess.check_output",
"collections.namedtuple",
"os.rename",
"re.match",
"os.path.splitext",
"re.sub",
"urllib.parse.urlparse",
"os.p... | [((883, 908), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (906, 908), False, 'import argparse\n'), ((1854, 1900), 're.compile', 're.compile', (['"""^([^\\\\/\\\\*\\\\|\\\\@\\\\"\\\\!]*?)#\\\\@?#"""'], {}), '(\'^([^\\\\/\\\\*\\\\|\\\\@\\\\"\\\\!]*?)#\\\\@?#\')\n', (1864, 1900), False, 'import... |
import logging
from PyPDF2 import PdfFileReader, utils
def main() -> None:
# Open the first file as binary, load it into the pdf reader
first_file = open("document-1.pdf", "rb")
first_pdf = PdfFileReader(first_file)
# Examine the stats of the first pdf
logging.info("---EXAMINING PDF 1 STATISTICS... | [
"logging.basicConfig",
"PyPDF2.PdfFileReader",
"logging.info"
] | [((205, 230), 'PyPDF2.PdfFileReader', 'PdfFileReader', (['first_file'], {}), '(first_file)\n', (218, 230), False, 'from PyPDF2 import PdfFileReader, utils\n'), ((277, 326), 'logging.info', 'logging.info', (['"""---EXAMINING PDF 1 STATISTICS ---"""'], {}), "('---EXAMINING PDF 1 STATISTICS ---')\n", (289, 326), False, 'i... |
from .message_media_downloadable import DownloadableMediaMessageProtocolEntity
from yowsup.layers.protocol_messages.protocolentities.attributes.attributes_audio import AudioAttributes
from yowsup.layers.protocol_messages.protocolentities.attributes.attributes_message_meta import MessageMetaAttributes
from yowsup.layers... | [
"yowsup.layers.protocol_messages.protocolentities.attributes.attributes_message.MessageAttributes"
] | [((722, 758), 'yowsup.layers.protocol_messages.protocolentities.attributes.attributes_message.MessageAttributes', 'MessageAttributes', ([], {'audio': 'audio_attrs'}), '(audio=audio_attrs)\n', (739, 758), False, 'from yowsup.layers.protocol_messages.protocolentities.attributes.attributes_message import MessageAttributes... |
import subprocess
from config.directory import temp_builds
from .. import directory
def deploy_to_test_pypi() -> None:
directory.working.set_as_project_base_path()
subprocess.call(f"python3 -m twine upload --repository testpypi {temp_builds()}/*".split())
if __name__ == "__main__":
deploy_to_test_pypi... | [
"config.directory.temp_builds"
] | [((241, 254), 'config.directory.temp_builds', 'temp_builds', ([], {}), '()\n', (252, 254), False, 'from config.directory import temp_builds\n')] |
import signal
import os
import logging
#from multiprocessing_logging import install_mp_handler
from multiprocessing import Process, cpu_count
from subprocess import call
from docopt import docopt
# Workflow:
# Start Mongo
# Launch high level python controller script
# Launch external processes
# Wait for controller... | [
"os.kill",
"multiprocessing.Process",
"multiprocessing.cpu_count",
"subprocess.call",
"docopt.docopt"
] | [((825, 851), 'multiprocessing.Process', 'Process', ([], {'target': 'mongo_call'}), '(target=mongo_call)\n', (832, 851), False, 'from multiprocessing import Process, cpu_count\n'), ((892, 923), 'multiprocessing.Process', 'Process', ([], {'target': 'high_level_call'}), '(target=high_level_call)\n', (899, 923), False, 'f... |
from arghelp import Application, arg
app = Application([arg("-v", "--verbose", action="store_true"), arg("name")])
args = app.parse_args()
greeting = "hello" if args.verbose else "hi"
print(f"{greeting}, {args.name}")
| [
"arghelp.arg"
] | [((57, 100), 'arghelp.arg', 'arg', (['"""-v"""', '"""--verbose"""'], {'action': '"""store_true"""'}), "('-v', '--verbose', action='store_true')\n", (60, 100), False, 'from arghelp import Application, arg\n'), ((102, 113), 'arghelp.arg', 'arg', (['"""name"""'], {}), "('name')\n", (105, 113), False, 'from arghelp import ... |
#-*-coding:utf-8-*-
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import os
import os.path as osp
def test(model, test_loader):
model.eval()
test_correct = 0
test_total = 0
for i, (batch, label) in enumerate(test_loader):
batch = batch.cuda(... | [
"os.path.exists",
"torch.nn.CrossEntropyLoss",
"os.mkdir",
"torch.save",
"torch.autograd.Variable"
] | [((668, 683), 'torch.autograd.Variable', 'Variable', (['batch'], {}), '(batch)\n', (676, 683), False, 'from torch.autograd import Variable\n'), ((726, 753), 'torch.nn.CrossEntropyLoss', 'torch.nn.CrossEntropyLoss', ([], {}), '()\n', (751, 753), False, 'import torch\n'), ((1404, 1420), 'os.path.exists', 'osp.exists', ([... |
from django.contrib import admin
from .models import Card, Rule, Transfer, Transaction
class CardAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('owner_id', 'owner_type', 'name_on_card', 'number',
'expiration_date', 'type', 'sub_type', 'amount_on_card',
... | [
"django.contrib.admin.site.register"
] | [((847, 883), 'django.contrib.admin.site.register', 'admin.site.register', (['Card', 'CardAdmin'], {}), '(Card, CardAdmin)\n', (866, 883), False, 'from django.contrib import admin\n'), ((884, 920), 'django.contrib.admin.site.register', 'admin.site.register', (['Rule', 'RuleAdmin'], {}), '(Rule, RuleAdmin)\n', (903, 920... |
#! /usr/bin/python
import sys
import os
import json
import grpc
import time
import subprocess
from google.oauth2 import service_account
import google.oauth2.credentials
import google.auth.transport.requests
import google.auth.transport.grpc
from google.firestore.v1beta1 import firestore_pb2
from google.firestore.v1be... | [
"google.firestore.v1beta1.document_pb2.Value",
"os.path.join",
"google.protobuf.timestamp_pb2.Timestamp",
"json.load",
"google.firestore.v1beta1.document_pb2.Document",
"google.firestore.v1beta1.firestore_pb2_grpc.FirestoreStub",
"google.firestore.v1beta1.common_pb2.DocumentMask",
"os.path.abspath",
... | [((813, 842), 'os.path.join', 'os.path.join', (['fl', '"""grpc.json"""'], {}), "(fl, 'grpc.json')\n", (825, 842), False, 'import os\n'), ((778, 803), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (793, 803), False, 'import os\n'), ((905, 925), 'json.load', 'json.load', (['grpc_file'], {}), '... |
import traceback
import os
import meraki
# SET THIS UP
API_KEY = None
ORG_NAME = None
NET_NAME = None
SSID_NAME = None
#If you have this information handy, you can pre-fill the items below. If not, the script will find it for you.
ORG_ID = None
NETWORK_ID = None
SSID_ID = None
def get_org_id(api_key, org_name):
... | [
"os.getenv",
"meraki.updateclientsplash",
"meraki.myorgaccess",
"meraki.getnetworklist",
"meraki.getssids",
"meraki.getallclients",
"traceback.print_exc"
] | [((328, 375), 'meraki.myorgaccess', 'meraki.myorgaccess', (['api_key'], {'suppressprint': '(True)'}), '(api_key, suppressprint=True)\n', (346, 375), False, 'import meraki\n'), ((636, 694), 'meraki.getnetworklist', 'meraki.getnetworklist', (['api_key', 'org_id'], {'suppressprint': '(True)'}), '(api_key, org_id, suppress... |
import tensorflow as tf
import numpy as np
import scipy.io
# layers = [
# 'conv1_1', 'relu1_1', 'conv1_2', 'relu1_2', 'pool1',
# 'conv2_1', 'relu2_1', 'conv2_2', 'relu2_2', 'pool2',
# 'conv3_1', 'relu3_1', 'conv3_2', 'relu3_2',
# 'conv3_3', 'relu3_3', 'conv3_4', 'relu3_4', 'pool3',
# ... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.variable_scope",
"tensorflow.nn.relu",
"tensorflow.Variable",
"numpy.array",
"numpy.transpose",
"tensorflow.nn.bias_add"
] | [((1803, 1839), 'numpy.array', 'np.array', (['[123.68, 116.779, 103.939]'], {}), '([123.68, 116.779, 103.939])\n', (1811, 1839), True, 'import numpy as np\n'), ((1915, 1951), 'numpy.array', 'np.array', (['[123.68, 116.779, 103.939]'], {}), '([123.68, 116.779, 103.939])\n', (1923, 1951), True, 'import numpy as np\n'), (... |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import pathlib
import pickle
import warnings
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Unio... | [
"numpy.prod",
"torch.ones_like",
"mbrl.util.lifelong_learning.separate_observations_and_task_ids",
"torch.nn.functional.mse_loss",
"torch.broadcast_to",
"torch.no_grad",
"torch.zeros_like",
"gtimer.stamp",
"torch.cat"
] | [((2833, 2898), 'mbrl.util.lifelong_learning.separate_observations_and_task_ids', 'separate_observations_and_task_ids', (['observations', 'self._num_tasks'], {}), '(observations, self._num_tasks)\n', (2867, 2898), False, 'from mbrl.util.lifelong_learning import separate_observations_and_task_ids\n'), ((3612, 3645), 'gt... |
from fastapi import APIRouter, Depends, HTTPException
from fastapi.security import APIKeyHeader
from api import item
api_router = APIRouter()
router = APIRouter()
API_KEY_SCHEME = APIKeyHeader(name='X-API-KEY')
async def verify_api_key(api_key: str = Depends(API_KEY_SCHEME)):
if api_key != "dd74decc-8825-4a49... | [
"fastapi.HTTPException",
"fastapi.APIRouter",
"fastapi.security.APIKeyHeader",
"fastapi.Depends"
] | [((132, 143), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (141, 143), False, 'from fastapi import APIRouter, Depends, HTTPException\n'), ((154, 165), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (163, 165), False, 'from fastapi import APIRouter, Depends, HTTPException\n'), ((184, 214), 'fastapi.security.... |
import numpy as np
import cv2
mydata = {}
def detectShape(c):
shape = 'unknown'
# calculate perimeter using
peri = cv2.arcLength(c, True)
# apply contour approximation and store the result in vertices
vertices = cv2.approxPolyDP(c, 0.04 * peri, True)
# If the shape it triangle... | [
"numpy.median",
"cv2.drawContours",
"cv2.arcLength",
"cv2.minEnclosingCircle",
"cv2.approxPolyDP",
"cv2.cvtColor",
"cv2.moments",
"cv2.findContours",
"cv2.Canny",
"cv2.imread",
"cv2.boundingRect"
] | [((141, 163), 'cv2.arcLength', 'cv2.arcLength', (['c', '(True)'], {}), '(c, True)\n', (154, 163), False, 'import cv2\n'), ((248, 286), 'cv2.approxPolyDP', 'cv2.approxPolyDP', (['c', '(0.04 * peri)', '(True)'], {}), '(c, 0.04 * peri, True)\n', (264, 286), False, 'import cv2\n'), ((1840, 1859), 'cv2.imread', 'cv2.imread'... |
from webdnn.graph.operator import Operator
from webdnn.graph.order import OrderNHWC
from webdnn.graph.variable import Variable
def test_append_input():
op = Operator("op")
v1 = Variable((1, 2, 3, 4), OrderNHWC)
v2 = Variable((1, 2, 3, 4), OrderNHWC)
op.append_input("v1", v1)
op.append_input("v2",... | [
"webdnn.graph.operator.Operator",
"webdnn.graph.variable.Variable"
] | [((163, 177), 'webdnn.graph.operator.Operator', 'Operator', (['"""op"""'], {}), "('op')\n", (171, 177), False, 'from webdnn.graph.operator import Operator\n'), ((187, 220), 'webdnn.graph.variable.Variable', 'Variable', (['(1, 2, 3, 4)', 'OrderNHWC'], {}), '((1, 2, 3, 4), OrderNHWC)\n', (195, 220), False, 'from webdnn.g... |
from contextlib import contextmanager
import os
from pathlib import Path
import pytest
import trio
from pons import (
abi,
ABIDecodingError,
Address,
Amount,
ContractABI,
DeployedContract,
ReadMethod,
TxHash,
BlockHash,
Block,
Either,
ContractPanic,
ContractLegacyEr... | [
"trio.current_time",
"pons.Either",
"pons._abi_types.encode_args",
"pons._abi_types.keccak",
"trio.sleep",
"pons._entities.rpc_encode_data",
"os.urandom",
"pathlib.Path",
"pons._provider.RPCError",
"pons.DeployedContract",
"pons.TxHash",
"trio.open_nursery",
"pons.Amount.ether",
"pytest.ra... | [((2572, 2588), 'pons.Amount.ether', 'Amount.ether', (['(10)'], {}), '(10)\n', (2584, 2588), False, 'from pons import abi, ABIDecodingError, Address, Amount, ContractABI, DeployedContract, ReadMethod, TxHash, BlockHash, Block, Either, ContractPanic, ContractLegacyError, ContractError\n'), ((4095, 4111), 'pons.Amount.et... |
import asyncio
from typing import Sequence, Dict, Tuple, AsyncIterator, Any, Optional
from enum import Enum
import grpc
import torch
from hivemind.averaging.partition import TensorPartContainer, TensorPartReducer, AllreduceException
from hivemind.utils import Endpoint, get_logger, ChannelCache
from hivemind.utils.asy... | [
"hivemind.proto.averaging_pb2.AveragingData",
"hivemind.utils.asyncio.aenumerate",
"hivemind.utils.compression.serialize_torch_tensor",
"hivemind.utils.ChannelCache.get_stub",
"hivemind.averaging.partition.TensorPartContainer",
"hivemind.utils.compression.deserialize_torch_tensor",
"hivemind.utils.async... | [((574, 594), 'hivemind.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (584, 594), False, 'from hivemind.utils import Endpoint, get_logger, ChannelCache\n'), ((3456, 3472), 'asyncio.Future', 'asyncio.Future', ([], {}), '()\n', (3470, 3472), False, 'import asyncio\n'), ((3884, 3938), 'hivemind.aver... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Loss(object):
"""docstring for Loss"""
def __init__(self, opts):
super(Loss, self).__init__()
self.opts = opts
def StackedHourGlass(self, output, target, meta=None):
meta = ... | [
"torch.nn.functional.mse_loss"
] | [((1291, 1331), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['(output * meta)', '(target * meta)'], {}), '(output * meta, target * meta)\n', (1301, 1331), True, 'import torch.nn.functional as F\n'), ((470, 513), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['(output[i] * meta)', '(target * meta)'], {}), '(output[i... |
import argparse
import timeit
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import edi.simple.ad as ad
import edi.util.check as check
parser = argparse.ArgumentParser(description='Run tests')
parser.add_argument('--dir',
'-d',
... | [
"argparse.ArgumentParser",
"edi.simple.ad.batch",
"edi.util.check.main",
"os.path.dirname",
"edi.simple.ad.stream"
] | [((205, 253), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run tests"""'}), "(description='Run tests')\n", (228, 253), False, 'import argparse\n'), ((101, 126), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (116, 126), False, 'import os\n'), ((902, 1020), 'e... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
11b.py
~~~~~~
Advent of Code 2017 - Day 11: Hex Ed
Part Two
How many steps away is the furthest he ever got from his starting position?
:copyright: (c) 2017 by <NAME>.
:license: MIT, see LICENSE for more details.
"""
import sys
class He... | [
"sys.stderr.write"
] | [((1767, 1810), 'sys.stderr.write', 'sys.stderr.write', (['"""reading from stdin...\n"""'], {}), "('reading from stdin...\\n')\n", (1783, 1810), False, 'import sys\n')] |
#!/usr/bin/env python3
#python clean_video.py
import sys
import argparse
import tensorflow as tf
import cv2
import math
from model import OpenNsfwModel
from image_utils import create_yahoo_image_loader
def main(argv):
# parse input
parser = argparse.ArgumentParser()
parser.add_argument("input_file", help=... | [
"cv2.imwrite",
"image_utils.create_yahoo_image_loader",
"argparse.ArgumentParser",
"math.floor",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"model.OpenNsfwModel"
] | [((251, 276), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (274, 276), False, 'import argparse\n'), ((476, 491), 'model.OpenNsfwModel', 'OpenNsfwModel', ([], {}), '()\n', (489, 491), False, 'from model import OpenNsfwModel\n'), ((741, 753), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n'... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-04-21 06:38
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('x', '0013_icon_text'),
]
operations = [
migra... | [
"django.db.models.ForeignKey"
] | [((413, 505), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': "b''", 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""x.Icon"""'}), "(default=b'', on_delete=django.db.models.deletion.CASCADE,\n to='x.Icon')\n", (430, 505), False, 'from django.db import migrations, models\n')] |
from django.utils.translation import ugettext_lazy as _
from allianceauth.services.hooks import MenuItemHook, UrlHook
from allianceauth import hooks
from . import urls
class FleetMenuItem(MenuItemHook):
""" This class ensures only authorized users will see the menu entry """
def __init__(self):
# s... | [
"allianceauth.services.hooks.UrlHook",
"allianceauth.services.hooks.MenuItemHook.render",
"django.utils.translation.ugettext_lazy",
"allianceauth.hooks.register"
] | [((692, 724), 'allianceauth.hooks.register', 'hooks.register', (['"""menu_item_hook"""'], {}), "('menu_item_hook')\n", (706, 724), False, 'from allianceauth import hooks\n'), ((776, 802), 'allianceauth.hooks.register', 'hooks.register', (['"""url_hook"""'], {}), "('url_hook')\n", (790, 802), False, 'from allianceauth i... |
import os
import time
import random
import queue
import multiprocessing
from multiprocessing import Pool
from queue import Queue
from sklearn.model_selection import ParameterGrid
def benchmark(item):
# print(item)
os.system(item['command'])
if __name__ == "__main__":
# command=['pwd', 'pwd', 'pwd']
... | [
"sklearn.model_selection.ParameterGrid",
"queue.put_nowait",
"multiprocessing.Pool",
"os.system",
"queue.Queue",
"time.time"
] | [((224, 250), 'os.system', 'os.system', (["item['command']"], {}), "(item['command'])\n", (233, 250), False, 'import os\n'), ((437, 448), 'time.time', 'time.time', ([], {}), '()\n', (446, 448), False, 'import time\n'), ((1086, 1093), 'queue.Queue', 'Queue', ([], {}), '()\n', (1091, 1093), False, 'from queue import Queu... |
import re
class RegexPattern(object):
def __init__(self, regex, handler, default_kwargs={}):
self.regex = re.compile(regex, re.UNICODE)
self.callback = handler
self.default_kwargs = default_kwargs
def resolve(self, line):
match = self.regex.search(line)
if match:
... | [
"re.compile"
] | [((119, 148), 're.compile', 're.compile', (['regex', 're.UNICODE'], {}), '(regex, re.UNICODE)\n', (129, 148), False, 'import re\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"warnings.warn",
"pulumi.log.warn",
"pulumi.ResourceOptions"
] | [((1689, 1888), 'warnings.warn', 'warnings.warn', (['"""DataCatalogEncryptionSettings is not yet supported by AWS Native, so its creation will currently fail. Please use the classic AWS provider, if possible."""', 'DeprecationWarning'], {}), "(\n 'DataCatalogEncryptionSettings is not yet supported by AWS Native, so ... |
from pathlib import Path
import matplotlib.pyplot as plt
import networkx as nx
import algos.walker as wk
from helper_functions import graph_helper_functions as gh
def run(path, figsize=(20, 20), key=None):
G = gh.load_file(path, key=key)
G.greedy_cycle_removal()
G.longest_path_layering()
pos = wk.t... | [
"helper_functions.graph_helper_functions.load_file",
"matplotlib.pyplot.figure",
"networkx.draw",
"pathlib.Path"
] | [((218, 245), 'helper_functions.graph_helper_functions.load_file', 'gh.load_file', (['path'], {'key': 'key'}), '(path, key=key)\n', (230, 245), True, 'from helper_functions import graph_helper_functions as gh\n'), ((461, 488), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n'... |
from bc211.is_inactive import is_inactive
class InactiveRecordsCollector:
def __init__(self):
self.inactive_organizations_ids = []
self.inactive_services_ids = []
self.inactive_locations_ids = []
def add_inactive_organization_id(self, organization_id):
self.inactive_organizati... | [
"bc211.is_inactive.is_inactive"
] | [((656, 680), 'bc211.is_inactive.is_inactive', 'is_inactive', (['description'], {}), '(description)\n', (667, 680), False, 'from bc211.is_inactive import is_inactive\n'), ((885, 909), 'bc211.is_inactive.is_inactive', 'is_inactive', (['description'], {}), '(description)\n', (896, 909), False, 'from bc211.is_inactive imp... |
import warnings
import argparse
import torch
import numpy as np
from rich import print
from constants import DPAC_ATT_CAT_COUNT
from dataloader import load_data
from models.base import MultiOutputModel
# from loss import MultiTaskLoss_DPAC
from sklearn.metrics import precision_score, f1_score, recall_score, accuracy_... | [
"sklearn.metrics.f1_score",
"argparse.ArgumentParser",
"models.base.MultiOutputModel",
"torch.load",
"warnings.catch_warnings",
"numpy.asarray",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"torch.cuda.is_available",
"dataloader.load_data",
"warnings.simplefilter",
"torch... | [((3127, 3281), 'models.base.MultiOutputModel', 'MultiOutputModel', (['device'], {'n_age_cat': "DPAC_ATT_CAT_COUNT['age']", 'n_gender_cat': "DPAC_ATT_CAT_COUNT['gender']", 'n_emotion_cat': "DPAC_ATT_CAT_COUNT['emotion']"}), "(device, n_age_cat=DPAC_ATT_CAT_COUNT['age'], n_gender_cat=\n DPAC_ATT_CAT_COUNT['gender'], ... |
import yaml
import json
import json, ast, datetime
from datetime import timedelta
_DATE_FMT = '%Y-%m-%dT%H:%M:%S'
# returns a dictionary
def load_dictionary(encoded_dict):
e = yaml.dump(encoded_dict).replace('!!python/unicode ', '')
return yaml.load(e)
# returns a string
def load_yaml_as_str(encoded_dict):
... | [
"yaml.dump",
"datetime.datetime.strptime",
"yaml.load",
"datetime.datetime.now",
"datetime.timedelta"
] | [((251, 263), 'yaml.load', 'yaml.load', (['e'], {}), '(e)\n', (260, 263), False, 'import yaml\n'), ((1222, 1275), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date_str[:-10]', '_DATE_FMT'], {}), '(date_str[:-10], _DATE_FMT)\n', (1248, 1275), False, 'import json, ast, datetime\n'), ((1529, 1558), 'date... |
import Config
import getifaddrs
import AnnouncementHandler
import socket
import logging
import string
import threading
import struct
import select
#Some multicast groups are per-network-segment and require distinct sockets bound to an address
#so we have to keep a list of sockets and also which multicast addresses/de... | [
"logging.getLogger",
"AnnouncementHandler.process_message",
"select.select",
"socket.socket",
"socket.inet_pton",
"socket.inet_aton",
"getifaddrs.get_network_interfaces"
] | [((585, 612), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (602, 612), False, 'import logging\n'), ((924, 959), 'getifaddrs.get_network_interfaces', 'getifaddrs.get_network_interfaces', ([], {}), '()\n', (957, 959), False, 'import getifaddrs\n'), ((1716, 1784), 'socket.socket', 'socket.... |
# -*- coding: utf-8 -*-
import sys, os
sys.path.insert(0, os.path.abspath('..'))
import ga, optimization, numpy, struct
def binary(num):
return ''.join(bin(ord(c)).replace('0b', '').rjust(8, '0') for c in struct.pack('!f', num))
class RastriginFloatIndividualFactory(ga.IndividualFactory):
def __init__(self,... | [
"optimization.XSquareBinaryFitnessEvaluator",
"numpy.put",
"optimization.RastriginBinaryFitnessEvaluator",
"optimization.XSquareFloatFitnessEvaluator",
"optimization.XAbsoluteSquareFloatFitnessEvaluator",
"optimization.SineXSquareRootFloatFitnessEvaluator",
"optimization.SineXSquareRootBinaryFitnessEval... | [((1508, 1570), 'ga.IndividualFactory.register', 'ga.IndividualFactory.register', (['RastriginFloatIndividualFactory'], {}), '(RastriginFloatIndividualFactory)\n', (1537, 1570), False, 'import ga, optimization, numpy, struct\n'), ((2892, 2955), 'ga.IndividualFactory.register', 'ga.IndividualFactory.register', (['Rastri... |
# (C) Copyright 2017 Inova Development 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 appl... | [
"os.path.isfile",
"csv.DictReader",
"os.path.join",
"os.path.isabs"
] | [((3111, 3128), 'os.path.isabs', 'os.path.isabs', (['fn'], {}), '(fn)\n', (3124, 3128), False, 'import os\n'), ((3314, 3332), 'os.path.isfile', 'os.path.isfile', (['fn'], {}), '(fn)\n', (3328, 3332), False, 'import os\n'), ((3832, 3858), 'csv.DictReader', 'csv.DictReader', (['input_file'], {}), '(input_file)\n', (3846,... |
"""add type
Revision ID: f766ca85916b
Revises:
Create Date: 2019-03-23 11:29:46.634200
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f766ca85916b'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated... | [
"sqlalchemy.VARCHAR"
] | [((422, 444), 'sqlalchemy.VARCHAR', 'sa.VARCHAR', ([], {'length': '(128)'}), '(length=128)\n', (432, 444), True, 'import sqlalchemy as sa\n'), ((665, 687), 'sqlalchemy.VARCHAR', 'sa.VARCHAR', ([], {'length': '(128)'}), '(length=128)\n', (675, 687), True, 'import sqlalchemy as sa\n')] |
import json
from json import JSONDecodeError
import pandas as pd
from requests import post
import yaml
# General class for necessary file imports
class FileImport():
def read_app_key_file(self, filename: str = "keys.json") -> tuple:
"""Reads file with consumer key and consumer secret (JSON)
Args:... | [
"json.load",
"requests.post",
"yaml.load",
"pandas.read_csv"
] | [((2801, 2822), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (2812, 2822), True, 'import pandas as pd\n'), ((7888, 7928), 'requests.post', 'post', (['api_base_url'], {'auth': 'auth', 'data': 'data'}), '(api_base_url, auth=auth, data=data)\n', (7892, 7928), False, 'from requests import post\n'),... |
import urllib.request
import json
import time
import os.path
import sys
import datetime
import twitter
def getJSONFromUrl(fetch_url):
#Fetch json data from the url
with urllib.request.urlopen(fetch_url, timeout=1) as url:
data = json.loads(url.read().decode())
return data
de... | [
"twitter.setupTwitterBot",
"datetime.datetime.strptime",
"time.sleep",
"json.load",
"json.dump"
] | [((5581, 5606), 'twitter.setupTwitterBot', 'twitter.setupTwitterBot', ([], {}), '()\n', (5604, 5606), False, 'import twitter\n'), ((1061, 1081), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (1070, 1081), False, 'import json\n'), ((1207, 1260), 'json.dump', 'json.dump', (['data', 'write_file'], {'inde... |
from discord import activity, message
from discord.ext import commands
import discord
import logging
import random
import math
from data import data
from dateutil.relativedelta import relativedelta
from datetime import datetime
from utils import A_EMOJI, MAPS, SKIP_EMOJI, YES_NO_SHOW, YES_NO_SHOW, emoji_list, closest_u... | [
"random.choice",
"data.data",
"discord.Embed",
"utils.closest_user",
"datetime.datetime.now",
"discord.ext.commands.command",
"utils.emoji_list_team",
"logging.info",
"random.randint",
"discord_eprompt.react_prompt_response"
] | [((560, 601), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""side"""', 'aliases': '[]'}), "(name='side', aliases=[])\n", (576, 601), False, 'from discord.ext import commands\n'), ((1017, 1045), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""map"""'}), "(name='map')\n", (103... |
from pathlib import Path
import numpy as np
import pytest
def pytest_addoption(parser):
parser.addoption('--integration', action='store_true', default=False, dest='integration',
help='enable integration tests')
def pytest_collection_modifyitems(config, items):
if not config.getoption('... | [
"numpy.log10",
"pathlib.Path",
"pytest.mark.skip",
"numpy.ma.MaskedArray",
"pytest.fixture",
"numpy.load"
] | [((561, 592), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (575, 592), False, 'import pytest\n'), ((823, 854), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (837, 854), False, 'import pytest\n'), ((1039, 1070), 'pytest.fixtur... |
# Copyright 2017 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 ... | [
"corpuscrawler.util.crawl_udhr",
"corpuscrawler.util.urljoin",
"re.findall",
"corpuscrawler.util.cleantext",
"re.search"
] | [((824, 873), 'corpuscrawler.util.crawl_udhr', 'crawl_udhr', (['crawler', 'out'], {'filename': '"""udhr_mlt.txt"""'}), "(crawler, out, filename='udhr_mlt.txt')\n", (834, 873), False, 'from corpuscrawler.util import cleantext, crawl_udhr, fixquotes, urljoin\n'), ((1258, 1307), 're.findall', 're.findall', (["('/artikli/%... |
#!/usr/bin/env python
# requires rg (aka ripgrep) to be installed
import argparse
import re
import subprocess
CVIOLET = "\33[35m"
CEND = "\33[0m"
def get_output(cmd):
return subprocess.check_output(cmd, shell=True, text=True).strip()
parser = argparse.ArgumentParser(
description="Finds instances where do... | [
"subprocess.check_output",
"argparse.ArgumentParser",
"re.compile"
] | [((254, 352), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Finds instances where docstring is a single line long."""'}), "(description=\n 'Finds instances where docstring is a single line long.')\n", (277, 352), False, 'import argparse\n'), ((749, 771), 're.compile', 're.compile', (... |
import sys
import os
import pytest
import subprocess
from pathlib import Path
from pytest_mock import MockerFixture
from mock import MagicMock
from typing import List
from subprocess import CompletedProcess
# make sure that the source can be found
RootPath = Path(os.getcwd())
src_path = str(RootPath / "src")
if not sr... | [
"os.path.exists",
"stubber.basicgit.checkout_tag",
"pathlib.Path",
"stubber.basicgit.get_tag",
"subprocess.CompletedProcess",
"pytest.mark.skip",
"stubber.basicgit.pull",
"stubber.basicgit.switch_branch",
"stubber.basicgit.fetch",
"os.getcwd",
"stubber.basicgit.switch_tag",
"stubber.basicgit.c... | [((2572, 2643), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test discards uncomitted changes in top repo"""'}), "(reason='test discards uncomitted changes in top repo')\n", (2588, 2643), False, 'import pytest\n'), ((3170, 3241), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test discards u... |
"""A Raspberry Pi GPIO Interface."""
from raspy import board_revision
from raspy.io import gpio_pins
from raspy.io.gpio import Gpio
class RaspiGpio(Gpio):
"""A Raspberry Pi GPIO interface."""
def __init__(self):
"""Initialize a new instance of the raspy.io.raspi_gpio.RaspiGpio class."""
sup... | [
"raspy.io.gpio_pins.GpioNone"
] | [((740, 760), 'raspy.io.gpio_pins.GpioNone', 'gpio_pins.GpioNone', ([], {}), '()\n', (758, 760), False, 'from raspy.io import gpio_pins\n')] |
from django import forms
from django.contrib.auth.forms import UsernameField, AuthenticationForm
from . import models
class QuestionCollectionForm(forms.ModelForm):
class Meta:
model = models.QuestionCollection
fields = [
"name"
]
labels = {
"name": 'Nazwa'... | [
"django.forms.TextInput",
"django.forms.Textarea",
"django.forms.CharField",
"django.forms.ValidationError"
] | [((3144, 3209), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""<PASSWORD>ło"""', 'widget': 'forms.PasswordInput'}), "(label='<PASSWORD>ło', widget=forms.PasswordInput)\n", (3159, 3209), False, 'from django import forms\n'), ((1204, 1255), 'django.forms.ValidationError', 'forms.ValidationError', (['"""Z... |
"""
polarAWB_noGT.py
Copyright (c) 2022 Sony Group Corporation
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
"""
import json
from pathlib import Path
import shutil
import numpy as np
from myutils.imageutils import MAX_16BIT, my_read_image, my_write_image, rgb_to_srgb... | [
"numpy.clip",
"numpy.mean",
"myutils.weighturils.rg_bg_sigmoid_weight_achromatic",
"myutils.weighturils.rg_bg_sigmoid_weight_achromatic_phase",
"pathlib.Path",
"myutils.wbutils.polarAWB",
"myutils.weighturils.valid_weight_fourPolar",
"myutils.polarutils.calc_dolp_from_s0s1s2",
"myutils.weighturils.r... | [((691, 734), 'shutil.copy', 'shutil.copy', (['"""parameters.json"""', 'result_path'], {}), "('parameters.json', result_path)\n", (702, 734), False, 'import shutil\n'), ((1374, 1431), 'myutils.polarutils.calc_s0s1s2_from_fourPolar', 'plutil.calc_s0s1s2_from_fourPolar', (['i000', 'i045', 'i090', 'i135'], {}), '(i000, i0... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Contact : <EMAIL>
import json
import os
from autoflow.resource_manager.base import ResourceManager
from .structure import Job
class DatabaseResultLogger():
def __init__(self, resource_manager: ResourceManager):
self.resource_manager ... | [
"json.dumps",
"os.path.join",
"os.makedirs"
] | [((1581, 1618), 'os.makedirs', 'os.makedirs', (['directory'], {'exist_ok': '(True)'}), '(directory, exist_ok=True)\n', (1592, 1618), False, 'import os\n'), ((1645, 1684), 'os.path.join', 'os.path.join', (['directory', '"""configs.json"""'], {}), "(directory, 'configs.json')\n", (1657, 1684), False, 'import os\n'), ((17... |
from typing import Any
def custom_eval_extended(ctx: Any, extend: Any) -> Any:
for c in evalPart(ctx, extend.p):
try:
if hasattr(extend.expr, "iri") and extend.expr.iri == function_uri:
evaluation = function_result
else:
evaluation = _eval(extend.exp... | [
"rdflib.Namespace",
"rdflib.plugins.sparql.evaluate.evalPart"
] | [((924, 970), 'rdflib.Namespace', 'Namespace', (['"""example:rdflib:plugin:sparqleval:"""'], {}), "('example:rdflib:plugin:sparqleval:')\n", (933, 970), False, 'from rdflib import Namespace\n'), ((94, 117), 'rdflib.plugins.sparql.evaluate.evalPart', 'evalPart', (['ctx', 'extend.p'], {}), '(ctx, extend.p)\n', (102, 117)... |
from copy import deepcopy
from typing import Any, Optional, Union
import pandas as pd
from pycaret.internal.logging import get_logger
from pycaret.internal.Display import Display
from sklearn.base import clone
from sklearn.utils.validation import check_is_fitted
from sklearn.pipeline import Pipeline
def is_sklearn_p... | [
"sklearn.utils.validation.check_is_fitted",
"pycaret.internal.logging.get_logger",
"copy.deepcopy"
] | [((580, 606), 'sklearn.utils.validation.check_is_fitted', 'check_is_fitted', (['estimator'], {}), '(estimator)\n', (595, 606), False, 'from sklearn.utils.validation import check_is_fitted\n'), ((948, 960), 'pycaret.internal.logging.get_logger', 'get_logger', ([], {}), '()\n', (958, 960), False, 'from pycaret.internal.l... |
#!/usr/bin/env python3
# coding=utf-8
import RPi.GPIO as GPIO
import time
from rpi_backlight import Backlight
GPIO.setmode(GPIO.BCM)
GPIO.setup(23, GPIO.IN)
backlight = Backlight()
def main():
try:
time.sleep(2) # to stabilize sensor
start_time = time.time()
while True:
elapsed_time = time.time() - sta... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"time.sleep",
"rpi_backlight.Backlight",
"RPi.GPIO.input",
"time.time",
"RPi.GPIO.setmode"
] | [((112, 134), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (124, 134), True, 'import RPi.GPIO as GPIO\n'), ((135, 158), 'RPi.GPIO.setup', 'GPIO.setup', (['(23)', 'GPIO.IN'], {}), '(23, GPIO.IN)\n', (145, 158), True, 'import RPi.GPIO as GPIO\n'), ((172, 183), 'rpi_backlight.Backlight', 'Backli... |
# Generated by Django 2.2.10 on 2020-03-05 10:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('geonames_place', '0004_change_meta_options_on_country'),
('agents', '0004_alter_agent_based_near'),
]
oper... | [
"django.db.models.ForeignKey"
] | [((443, 639), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'help_text': '"""The location of birth of this Person."""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""births"""', 'to': '"""geonames_place.Place"""'}), "(blank=True, help_text=\n '... |
from requests import Session
from bs4 import BeautifulSoup
import re
class tiktok:
def __init__(self) -> None:
self.request = Session()
self.url = "https://ssstik.io"
self.html = self.request.get(self.url).text
self.key = BeautifulSoup(self.html, "html.parser").find_all("... | [
"bs4.BeautifulSoup",
"requests.Session",
"re.search"
] | [((139, 148), 'requests.Session', 'Session', ([], {}), '()\n', (146, 148), False, 'from requests import Session\n'), ((1309, 1348), 'bs4.BeautifulSoup', 'BeautifulSoup', (['post.text', '"""html.parser"""'], {}), "(post.text, 'html.parser')\n", (1322, 1348), False, 'from bs4 import BeautifulSoup\n'), ((1914, 1923), 'req... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import nose
from nose.tools import *
from sknano.core import dedupe, rezero_array
def test1():
lst = [1, 2, 2, 3, 4, 50, 50, 4, 5]
assert_equal(list(dedupe(lst)), [1, 2, 3, 4, 50,... | [
"sknano.core.dedupe",
"nose.runmodule"
] | [((358, 374), 'nose.runmodule', 'nose.runmodule', ([], {}), '()\n', (372, 374), False, 'import nose\n'), ((290, 301), 'sknano.core.dedupe', 'dedupe', (['lst'], {}), '(lst)\n', (296, 301), False, 'from sknano.core import dedupe, rezero_array\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import core.models
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Alert',
fields=[
('id', mode... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((3508, 3569), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'related_name': '"""products"""', 'to': '"""core.Service"""'}), "(related_name='products', to='core.Service')\n", (3525, 3569), False, 'from django.db import models, migrations\n'), ((3694, 3758), 'django.db.models.ForeignKey', 'models.ForeignKey... |
from typing import Dict, List, Optional, Tuple
import numpy as np
import scipy
import torch
from tqdm import tqdm
import datasets
from fewie.data.datasets.generic.nway_kshot import NwayKshotDataset
from fewie.encoders.encoder import Encoder
from fewie.evaluation.classifiers.classifier import Classifier
from fewie.eva... | [
"numpy.mean",
"scipy.stats.t._ppf",
"tqdm.tqdm",
"numpy.array",
"scipy.stats.sem",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"torch.no_grad",
"fewie.evaluation.utils.get_metric"
] | [((929, 943), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (937, 943), True, 'import numpy as np\n'), ((4441, 4474), 'numpy.concatenate', 'np.concatenate', (['X_support'], {'axis': '(0)'}), '(X_support, axis=0)\n', (4455, 4474), True, 'import numpy as np\n'), ((4491, 4510), 'numpy.array', 'np.array', (['y_sup... |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField,IntegerField
from wtforms.validators import DataRequired, Email, EqualTo, Length, Optional, NumberRange
import re
from wtforms import validators, ValidationError
class SignupForm(FlaskForm):
name = StringField('name',validat... | [
"wtforms.validators.Email",
"wtforms.validators.DataRequired",
"re.match",
"wtforms.SubmitField",
"wtforms.ValidationError"
] | [((1016, 1037), 'wtforms.SubmitField', 'SubmitField', (['"""Submit"""'], {}), "('Submit')\n", (1027, 1037), False, 'from wtforms import StringField, PasswordField, SubmitField, IntegerField\n'), ((586, 658), 're.match', 're.match', (['"""^(?=.*[a-z])(?=.*[A-Z])(?=.*\\\\d)[a-zA-Z\\\\d]{8,}$"""', 'field.data'], {}), "('^... |
# Generated by Django 2.2.10 on 2020-05-04 17:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('majora2', '0070_publishedartifactgroup_public_timestamp'),
]
operations = [
migrations.AddField(
model_name='institute',
... | [
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((364, 419), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(512)', 'null': '(True)'}), '(blank=True, max_length=512, null=True)\n', (380, 419), False, 'from django.db import migrations, models\n'), ((547, 603), 'django.db.models.CharField', 'models.CharField', ([], {'blank':... |
from __future__ import division, print_function # confidence high
import astropy
from stsciutils.tools import parseinput, fileutil, convertwaiveredfits, readgeis
from astropy.io import fits
import os
import sys
from distutils.version import LooseVersion
PY3K = sys.version_info[0] > 2
if PY3K:
string_types = str
... | [
"os.path.exists",
"stsciutils.tools.fileutil.buildNewRootname",
"astropy.io.fits.HDUList",
"stsciutils.tools.fileutil.buildFITSName",
"stsciutils.tools.parseinput.parseinput",
"astropy.io.fits.getval",
"os.remove",
"stsciutils.tools.fileutil.getKeyword",
"stsciutils.tools.fileutil.isFits",
"astrop... | [((376, 409), 'distutils.version.LooseVersion', 'LooseVersion', (['astropy.__version__'], {}), '(astropy.__version__)\n', (388, 409), False, 'from distutils.version import LooseVersion\n'), ((413, 432), 'distutils.version.LooseVersion', 'LooseVersion', (['"""1.3"""'], {}), "('1.3')\n", (425, 432), False, 'from distutil... |
from data_loader.simple_mnist_data_loader import SimpleMnistDataLoader
from models.simple_mnist_model import SimpleMnistModel
from data_loader.face_landmark_77_data_loader import FaceLandmark77DataLoader
from models.mobilenet_v2_model import MobileNetV2Model
from utils.config import process_config
from utils.dirs impor... | [
"utils.config.process_config",
"pathlib.Path",
"data_loader.simple_mnist_data_loader.SimpleMnistDataLoader",
"tensorflow.global_variables",
"keras.backend.get_session",
"tensorflow.python.framework.graph_util.convert_variables_to_constants",
"data_loader.face_landmark_77_data_loader.FaceLandmark77DataLo... | [((754, 830), 'utils.dirs.create_dirs', 'create_dirs', (["[config.tensorboard_log_dir, config.checkpoint_dir, 'val_test']"], {}), "([config.tensorboard_log_dir, config.checkpoint_dir, 'val_test'])\n", (765, 830), False, 'from utils.dirs import create_dirs\n'), ((585, 595), 'utils.utils.get_args', 'get_args', ([], {}), ... |
import os
import json
import argus
from argus.callbacks import MonitorCheckpoint, EarlyStopping, LoggingToFile
from torch.utils.data import DataLoader
from src.dataset import SaltDataset, SaltTestDataset
from src.transforms import SimpleDepthTransform, SaltTransform
from src.lr_scheduler import ReduceLROnPlateau
fro... | [
"src.argus_models.SaltMeanTeacherModel",
"src.transforms.SimpleDepthTransform",
"os.path.exists",
"src.transforms.SaltTransform",
"os.makedirs",
"os.path.join",
"src.dataset.SaltDataset",
"src.lr_scheduler.ReduceLROnPlateau",
"torch.utils.data.DataLoader",
"src.dataset.SaltTestDataset",
"argus.c... | [((1947, 1969), 'src.transforms.SimpleDepthTransform', 'SimpleDepthTransform', ([], {}), '()\n', (1967, 1969), False, 'from src.transforms import SimpleDepthTransform, SaltTransform\n'), ((1987, 2026), 'src.transforms.SaltTransform', 'SaltTransform', (['IMAGE_SIZE', '(True)', '"""crop"""'], {}), "(IMAGE_SIZE, True, 'cr... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2019.
#
# 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... | [
"qiskit.ClassicalRegister",
"numpy.sqrt",
"qiskit.providers.aer.extensions.snapshot.Snapshot",
"numpy.array",
"qiskit.QuantumCircuit",
"qiskit.QuantumRegister"
] | [((1084, 1111), 'qiskit.QuantumRegister', 'QuantumRegister', (['num_qubits'], {}), '(num_qubits)\n', (1099, 1111), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'), ((1121, 1150), 'qiskit.ClassicalRegister', 'ClassicalRegister', (['num_qubits'], {}), '(num_qubits)\n', (1138, 1150), Fals... |
# Ported from the Synchrosqueezing Toolbox, authored by
# <NAME>, <NAME>
# (http://www.math.princeton.edu/~ebrevdo/)
# (https://github.com/ebrevdo/synchrosqueezing/)
import numpy as np
from .utils import wfiltfn, padsignal, buffer
from quadpy import quad as quadgk
PI = np.pi
EPS = np.finfo(np.float64).eps # ma... | [
"numpy.abs",
"numpy.ceil",
"numpy.sqrt",
"numpy.arange",
"numpy.fft.fft",
"numpy.floor",
"numpy.hamming",
"numpy.diag",
"numpy.sum",
"numpy.linspace",
"numpy.zeros",
"numpy.isnan",
"numpy.mod",
"numpy.finfo",
"numpy.fft.ifft",
"numpy.imag",
"numpy.round"
] | [((290, 310), 'numpy.finfo', 'np.finfo', (['np.float64'], {}), '(np.float64)\n', (298, 310), True, 'import numpy as np\n'), ((7841, 7863), 'numpy.floor', 'np.floor', (['((n1 - 1) / 2)'], {}), '((n1 - 1) / 2)\n', (7849, 7863), True, 'import numpy as np\n'), ((3366, 3403), 'numpy.linspace', 'np.linspace', (['(0)', '(1)',... |