code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
The setup package to install SeleniumBase dependencies and plugins
(Uses selenium 3.x and is compatible with Python 2.7+ and Python 3.6+)
"""
from setuptools import setup, find_packages # noqa
from os import path
this_directory = path.abspath(path.dirname(__file__))
long_description = None
try:
with open(pa... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((512, 3263), 'setuptools.setup', 'setup', ([], {'name': '"""seleniumbase"""', 'version': '"""1.21.3"""', 'description': '"""Reliable Browser Automation & Testing Framework"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/seleniumbase/Se... |
"""The tests for the Rfxtrx light platform."""
from unittest.mock import call
import pytest
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.core import State
from homeassistant.setup import async_setup_component
from . import _signal_event
from tests.common import mock_restore_cache
... | [
"pytest.mark.parametrize",
"homeassistant.setup.async_setup_component",
"homeassistant.core.State"
] | [((2971, 3061), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state,brightness"""', "[['on', 100], ['on', 50], ['off', None]]"], {}), "('state,brightness', [['on', 100], ['on', 50], [\n 'off', None]])\n", (2994, 3061), False, 'import pytest\n'), ((4641, 4687), 'pytest.mark.parametrize', 'pytest.mark.pa... |
"""
Copyright (c) Microsoft Corporation.
Licensed under the MIT license.
Pytorch modules
some classes are modified from HuggingFace
(https://github.com/huggingface/transformers)
"""
import copy
import json
import logging
from io import open
import torch
from torch import nn
#from apex.normalization.fused_layer_norm i... | [
"logging.getLogger",
"json.loads",
"torch.nn.Dropout",
"torch.nn.LayerNorm",
"io.open",
"torch.cat",
"torch.nn.Linear",
"copy.deepcopy",
"torch.zeros_like",
"torch.nn.Embedding"
] | [((443, 470), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (460, 470), False, 'import logging\n'), ((4570, 4598), 'copy.deepcopy', 'copy.deepcopy', (['self.__dict__'], {}), '(self.__dict__)\n', (4583, 4598), False, 'import copy\n'), ((9234, 9300), 'torch.nn.Embedding', 'nn.Embedding', (... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mediapipe/framework/formats/object_detection/anchor.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from... | [
"google.protobuf.symbol_database.Default"
] | [((481, 507), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (505, 507), True, 'from google.protobuf import symbol_database as _symbol_database\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: library.py
#
# Copyright 2018 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitatio... | [
"logging.getLogger",
"logging.StreamHandler",
"shlex.split",
"os.pathsep.join",
"dataclasses.dataclass",
"configuration.ENVIRONMENT_VARIABLES.items",
"os.listdir",
"subprocess.Popen",
"semver.parse",
"os.chmod",
"os.path.isdir",
"os.unlink",
"os.path.expanduser",
"logging.NullHandler",
"... | [((1834, 1863), 'configuration.ENVIRONMENT_VARIABLES.items', 'ENVIRONMENT_VARIABLES.items', ([], {}), '()\n', (1861, 1863), False, 'from configuration import LOGGERS_TO_DISABLE, ENVIRONMENT_VARIABLES, LOGGING_LEVEL\n'), ((2452, 2486), 'logging.getLogger', 'logging.getLogger', (['LOGGER_BASENAME'], {}), '(LOGGER_BASENAM... |
# -*- coding:utf-8 -*-
# Author:lixuecheng
from selenium import webdriver
import time
import os
from pro.core.logger import log, logger
from pro.util.parse_msg import p_addhttp
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.action... | [
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.Chrome",
"pro.core.logger.logger.warning",
"time.sleep",
"selenium.webdriver.support.select.Select",
"pro.core.logger.logger.info",
"selenium.webdriver.common.action_chains.ActionChains",
"pro.util.parse_msg.p_addhttp",
"time.time"
] | [((690, 701), 'time.time', 'time.time', ([], {}), '()\n', (699, 701), False, 'import time\n'), ((26223, 26326), 'pro.core.logger.logger.info', 'logger.info', (['"""浏览器关闭\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"""'], {}), '(\n """浏览器关闭\n<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... |
# Copyright 2019 IBM Corporation All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
import os
from .live_qpylib import LiveQpylib
from .sdk_qpylib import SdkQpylib
def is_sdk():
sdk_env = os.getenv('QRADAR_APPFW_SDK', 'no').lower() == 'true'
return sdk_env
def strategy():
if is_sdk():
r... | [
"os.getenv"
] | [((204, 239), 'os.getenv', 'os.getenv', (['"""QRADAR_APPFW_SDK"""', '"""no"""'], {}), "('QRADAR_APPFW_SDK', 'no')\n", (213, 239), False, 'import os\n')] |
from __future__ import division
import struct
import zlib
from PIL import Image
import gameduino2.base
import gameduino2.registers as reg
from gameduino2 import convert
try:
# noinspection PyUnresolvedReferences,PyCompatibility
from StringIO import StringIO # Python 2
except ImportError:
from io import... | [
"PIL.Image.new",
"struct.pack",
"zlib.compress",
"io.StringIO",
"gameduino2.convert.convert"
] | [((587, 597), 'io.StringIO', 'StringIO', ([], {}), '()\n', (595, 597), False, 'from io import StringIO\n'), ((3222, 3232), 'io.StringIO', 'StringIO', ([], {}), '()\n', (3230, 3232), False, 'from io import StringIO\n'), ((3984, 4027), 'gameduino2.convert.convert', 'convert.convert', (['im'], {'dither': 'dither', 'fmt': ... |
# -*- coding: utf-8 -*-
import os
from time import time
from unittest.mock import patch
import jwt
from oauthlib.common import Request
from oauthlib.oauth2 import ServiceApplicationClient
from tests.unittest import TestCase
class ServiceApplicationClientTest(TestCase):
gt = ServiceApplicationClient.grant_type... | [
"jwt.decode",
"oauthlib.oauth2.ServiceApplicationClient",
"oauthlib.common.Request",
"time.time",
"unittest.mock.patch"
] | [((1224, 1242), 'unittest.mock.patch', 'patch', (['"""time.time"""'], {}), "('time.time')\n", (1229, 1242), False, 'from unittest.mock import patch\n'), ((4013, 4031), 'unittest.mock.patch', 'patch', (['"""time.time"""'], {}), "('time.time')\n", (4018, 4031), False, 'from unittest.mock import patch\n'), ((5362, 5380), ... |
import time
import board
import busio
import adafruit_mpu6050
i2c = busio.I2C(board.SCL, board.SDA)
mpu = adafruit_mpu6050.MPU6050(i2c)
while True:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2"%(mpu.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s"%(mpu.gyro))
print("Temperature: %.2f ... | [
"busio.I2C",
"adafruit_mpu6050.MPU6050",
"time.sleep"
] | [((69, 100), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (78, 100), False, 'import busio\n'), ((107, 136), 'adafruit_mpu6050.MPU6050', 'adafruit_mpu6050.MPU6050', (['i2c'], {}), '(i2c)\n', (131, 136), False, 'import adafruit_mpu6050\n'), ((358, 371), 'time.sleep', 'time.sleep... |
#!/usr/bin/env python
#====================================================
import os
import copy
import uuid
import time
import pickle
import threading
from Submitter import LocalSubmitter
from Submitter import solve_circuit
from Utilities import FileLogger
from Utilities.decorators import thread
#==============... | [
"Utilities.decorators.thread.start",
"Utilities.FileLogger",
"pickle.load",
"uuid.uuid4",
"Submitter.LocalSubmitter",
"copy.deepcopy",
"threading.Thread",
"os.remove"
] | [((1557, 1577), 'os.remove', 'os.remove', (['file_name'], {}), '(file_name)\n', (1566, 1577), False, 'import os\n'), ((1637, 1657), 'os.remove', 'os.remove', (['file_name'], {}), '(file_name)\n', (1646, 1657), False, 'import os\n'), ((1919, 1955), 'copy.deepcopy', 'copy.deepcopy', (['self.RECEIVED_RESULTS'], {}), '(sel... |
import kerastuner
import pytest
import tensorflow as tf
from tensorflow.python.util import nest
from autokeras import blocks
from autokeras.blocks import basic
from tests import utils
def test_resnet_build_return_tensor():
block = blocks.ResNetBlock()
outputs = block.build(
kerastuner.HyperParameter... | [
"autokeras.blocks.ResNetBlock",
"autokeras.blocks.DenseBlock",
"autokeras.blocks.RNNBlock",
"autokeras.blocks.Embedding",
"autokeras.blocks.XceptionBlock",
"tensorflow.python.util.nest.flatten",
"kerastuner.HyperParameters",
"autokeras.blocks.ConvBlock",
"tests.utils.get_func_args",
"pytest.raises... | [((238, 258), 'autokeras.blocks.ResNetBlock', 'blocks.ResNetBlock', ([], {}), '()\n', (256, 258), False, 'from autokeras import blocks\n'), ((607, 643), 'autokeras.blocks.deserialize', 'blocks.deserialize', (['serialized_block'], {}), '(serialized_block)\n', (625, 643), False, 'from autokeras import blocks\n'), ((757, ... |
''' UFL_AuxFunction.py
Auxiliary functions
Author: <NAME>
Date: 20.02.2015
Version: 1.0
'''
import numpy as np
import sys
def computeNumericalGradient(func, params, args=()):
'''
Computes numerical gradients of a function
'''
# Initialize numgrad with zeros
numgrad = np.zeros(np.shape(params));
eps = ... | [
"numpy.exp",
"numpy.shape",
"numpy.resize",
"sys.exit"
] | [((1664, 1689), 'numpy.resize', 'np.resize', (['y', 'resizearray'], {}), '(y, resizearray)\n', (1673, 1689), True, 'import numpy as np\n'), ((292, 308), 'numpy.shape', 'np.shape', (['params'], {}), '(params)\n', (300, 308), True, 'import numpy as np\n'), ((1280, 1290), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1288, 1... |
#-*- coding: utf-8 -*-
'''
快代理免费ip
'''
import re
from proxy import Proxy
from .basespider import BaseSpider
class KuaiDaiLiSpider(BaseSpider):
name = 'kuaidaili'
def __init__(self, *a, **kwargs):
super(KuaiDaiLiSpider, self).__init__(*a, **kwargs)
self.urls = ['http://www.kuaidaili.com/... | [
"proxy.Proxy",
"re.compile"
] | [((799, 1015), 're.compile', 're.compile', (['"""<tr>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?</tr>"""', 're.RegexFlag.S'], {}), "(\n '<tr>\\\\s.*?<td.*?>(.*?)</td>\\\\s.*?<td... |
from esphome.components import light
import esphome.config_validation as cv
import esphome.codegen as cg
from esphome.const import (
CONF_OUTPUT_ID,
CONF_MIN_VALUE,
CONF_MAX_VALUE,
CONF_GAMMA_CORRECT,
CONF_DEFAULT_TRANSITION_LENGTH,
CONF_SWITCH_DATAPOINT,
CONF_COLD_WHITE_COLOR_TEMPERATURE,
... | [
"esphome.codegen.new_Pvariable",
"esphome.codegen.get_variable",
"esphome.codegen.register_component",
"esphome.config_validation.Optional",
"esphome.components.light.register_light",
"esphome.config_validation.declare_id",
"esphome.config_validation.Exclusive",
"esphome.config_validation.Inclusive",
... | [((2558, 2671), 'esphome.config_validation.has_at_least_one_key', 'cv.has_at_least_one_key', (['CONF_DIMMER_DATAPOINT', 'CONF_SWITCH_DATAPOINT', 'CONF_RGB_DATAPOINT', 'CONF_HSV_DATAPOINT'], {}), '(CONF_DIMMER_DATAPOINT, CONF_SWITCH_DATAPOINT,\n CONF_RGB_DATAPOINT, CONF_HSV_DATAPOINT)\n', (2581, 2671), True, 'import ... |
# -*- coding: utf-8 -*-
import approvaltests
from approvaltests.reporters import GenericDiffReporterFactory, PythonNativeReporter
def pytest_addoption(parser):
"""Add options to configure approval testing."""
group = parser.getgroup('approvaltests', 'approval testing')
group.addoption('--approvaltests-us... | [
"approvaltests.reporters.PythonNativeReporter",
"approvaltests.set_default_reporter",
"approvaltests.reporters.GenericDiffReporterFactory"
] | [((1898, 1942), 'approvaltests.set_default_reporter', 'approvaltests.set_default_reporter', (['reporter'], {}), '(reporter)\n', (1932, 1942), False, 'import approvaltests\n'), ((2032, 2060), 'approvaltests.reporters.GenericDiffReporterFactory', 'GenericDiffReporterFactory', ([], {}), '()\n', (2058, 2060), False, 'from ... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import numpy as np
import tensorflow as tf
from tensorflow.python.platform import flags
import math
import copy
sys.path.append("../")
from nmutan... | [
"os.path.exists",
"numpy.random.shuffle",
"tensorflow.reset_default_graph",
"math.ceil",
"os.makedirs",
"math.floor",
"tensorflow.python.platform.flags.DEFINE_string",
"tensorflow.train.Saver",
"os.path.join",
"nmutant_model.model_operation.model_eval",
"nmutant_data.data.get_data",
"tensorflo... | [((285, 307), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (300, 307), False, 'import sys\n'), ((571, 595), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (593, 595), True, 'import tensorflow as tf\n'), ((635, 653), 'nmutant_data.data.get_data', 'get_data', (['d... |
from collections import Counter
import numpy as np
import tokenize as tk
from io import BytesIO
def text_tokenize(txt):
""" specific tokenizer suitable for extracting 'python tokens' """
toks = []
try:
for x in tk.tokenize(BytesIO(txt.encode('utf-8')).readline):
toks.append(x)
exc... | [
"collections.Counter"
] | [((1699, 1714), 'collections.Counter', 'Counter', (['tokens'], {}), '(tokens)\n', (1706, 1714), False, 'from collections import Counter\n')] |
# -*- coding: utf-8 -*-
"""
@date: 2020/4/16 下午12:50
@file: yolo_v1.py
@author: zj
@description:
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.basic_conv2d import BasicConv2d
class YOLO_v1(nn.Module):
def __init__(self, S=7, B=2, C=20):
super(YOLO_v1, self).__init_... | [
"torch.nn.ReLU",
"torch.sigmoid",
"torch.nn.MaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.randn",
"torch.flatten"
] | [((2801, 2830), 'torch.randn', 'torch.randn', (['(1, 3, 224, 224)'], {}), '((1, 3, 224, 224))\n', (2812, 2830), False, 'import torch\n'), ((2053, 2081), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['(7, 7)'], {}), '((7, 7))\n', (2073, 2081), True, 'import torch.nn as nn\n'), ((2571, 2590), 'torch.flatten', '... |
# -*- coding: utf-8 -*-
"""
Created on Fri May 1 20:05:53 2015
@author: Ziang
"""
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.cross_validation import train_test_split
from sklearn.decomposition import Truncated... | [
"GPSVI.core.GPClassifier.GPClassifier",
"sklearn.decomposition.TruncatedSVD",
"sklearn.datasets.load_digits",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"sklearn.cross_validation.train_test_split"
] | [((374, 391), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (388, 391), True, 'import numpy as np\n'), ((399, 421), 'sklearn.datasets.load_digits', 'datasets.load_digits', ([], {}), '()\n', (419, 421), False, 'from sklearn import datasets\n'), ((443, 498), 'sklearn.cross_validation.train_test_split', '... |
import asyncio
from collections import defaultdict
from ipaddress import ip_network
from typing import Dict, List
from gql import Client, gql
from gql.transport.aiohttp import AIOHTTPTransport
from irrexplorer.settings import config
from irrexplorer.state import DataSource, IPNetwork, RouteInfo, RPKIStatus
IRRD_TIME... | [
"gql.transport.aiohttp.AIOHTTPTransport",
"gql.Client",
"ipaddress.ip_network",
"collections.defaultdict",
"asyncio.gather",
"irrexplorer.settings.config",
"gql.gql"
] | [((612, 875), 'gql.gql', 'gql', (['f"""\n query getRoutes ($asn: [ASN!]!) {{\n rpslObjects(\n asn: $asn\n objectClass: ["route", "route6"],\n rpkiStatus: [valid,invalid,not_found]\n ) {{\n {COMMON_GRAPHQL_FIELDS}\n }}\n }}\n"""'], {}), '(f"""\n q... |
import re
from cli.export import api_to_dict
def _cli_to_schema(
api_dict,
target,
):
pod_api = None
for d in api_dict['methods']:
if d['name'] == target:
pod_api = d['options']
break
_schema = {
'properties': {},
'required': [],
}
for p ... | [
"cli.export.api_to_dict"
] | [((1655, 1668), 'cli.export.api_to_dict', 'api_to_dict', ([], {}), '()\n', (1666, 1668), False, 'from cli.export import api_to_dict\n')] |
import logging
import cmath
import numpy as np
LG = logging.getLogger('pyd.hp')
def unit_vectors(thetamax=7.5, ngrid=32):
thetamax = np.radians(thetamax)
pls = np.linspace(0, 2*np.pi, ngrid)
tls = np.linspace(0, thetamax, ngrid)
P, T = np.meshgrid(pls, tls)
# Raux = np.hypot(P, T - np.pi / 2)
... | [
"logging.getLogger",
"numpy.radians",
"numpy.sqrt",
"numpy.linspace",
"numpy.zeros",
"numpy.empty",
"numpy.cos",
"numpy.sin",
"numpy.meshgrid"
] | [((54, 81), 'logging.getLogger', 'logging.getLogger', (['"""pyd.hp"""'], {}), "('pyd.hp')\n", (71, 81), False, 'import logging\n'), ((141, 161), 'numpy.radians', 'np.radians', (['thetamax'], {}), '(thetamax)\n', (151, 161), True, 'import numpy as np\n'), ((172, 204), 'numpy.linspace', 'np.linspace', (['(0)', '(2 * np.p... |
import logging
import os
from functools import wraps
from rcon.commands import CommandFailedError
from discord_webhook import DiscordEmbed
from rcon.recorded_commands import RecordedRcon
from rcon.player_history import (
save_player,
save_start_player_session,
save_end_player_session,
safe_save_player... | [
"logging.getLogger",
"rcon.map_recorder.VoteMap",
"rcon.player_history.save_start_player_session",
"rcon.workers.temporary_broadcast",
"rcon.discord.get_prepared_discord_hooks",
"discord_webhook.DiscordEmbed",
"rcon.user_config.VoteMapConfig",
"rcon.recorded_commands.RecordedRcon",
"functools.wraps"... | [((1041, 1068), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1058, 1068), False, 'import logging\n'), ((1881, 1920), 'os.getenv', 'os.getenv', (['"""BAN_ON_VAC_HISTORY_DAYS"""', '(0)'], {}), "('BAN_ON_VAC_HISTORY_DAYS', 0)\n", (1890, 1920), False, 'import os\n'), ((1939, 2033), 'os.get... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 F5 Networks Inc.
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | [
"os.path.splitext",
"re.match",
"os.path.join",
"ansible.module_utils.f5_utils.AnsibleF5Client",
"ansible.module_utils.f5_utils.F5ModuleError",
"io.StringIO",
"hashlib.sha1"
] | [((10558, 10696), 'ansible.module_utils.f5_utils.AnsibleF5Client', 'AnsibleF5Client', ([], {'argument_spec': 'spec.argument_spec', 'supports_check_mode': 'spec.supports_check_mode', 'f5_product_name': 'spec.f5_product_name'}), '(argument_spec=spec.argument_spec, supports_check_mode=spec.\n supports_check_mode, f5_pr... |
import logging
import mimetypes
from rdmo.core.xml import get_ns_map, get_uri, read_xml_file
from rdmo.domain.models import Attribute
from rdmo.options.models import Option
from rdmo.questions.models import Catalog
from rdmo.tasks.models import Task
from rdmo.views.models import View
from .models import Project, Snap... | [
"logging.getLogger",
"rdmo.core.xml.get_ns_map",
"rdmo.domain.models.Attribute.objects.get",
"rdmo.questions.models.Catalog.objects.all",
"rdmo.views.models.View.objects.get",
"rdmo.core.xml.read_xml_file",
"rdmo.options.models.Option.objects.get",
"rdmo.tasks.models.Task.objects.get",
"mimetypes.gu... | [((339, 366), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (356, 366), False, 'import logging\n'), ((886, 922), 'mimetypes.guess_type', 'mimetypes.guess_type', (['self.file_name'], {}), '(self.file_name)\n', (906, 922), False, 'import mimetypes\n'), ((990, 1019), 'rdmo.core.xml.read_xml... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
import random
import numpy as np
import pandas as pd
from pandas.compat import lrange
from pandas.api.types import CategoricalDtype
from pandas import (DataFrame, Series, MultiIndex, Timestamp,
date_range, NaT, IntervalIn... | [
"pandas.util.testing.assert_raises_regex",
"pandas.MultiIndex.from_tuples",
"pandas.date_range",
"numpy.arange",
"pandas.util.testing.assert_frame_equal",
"numpy.repeat",
"pandas.Categorical",
"pandas.DataFrame",
"pandas.util.testing.assert_produces_warning",
"pandas.compat.lrange",
"numpy.rando... | [((20813, 20855), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""level"""', "['A', 0]"], {}), "('level', ['A', 0])\n", (20836, 20855), False, 'import pytest\n'), ((872, 911), 'pandas.util.testing.assert_frame_equal', 'assert_frame_equal', (['sorted_df', 'expected'], {}), '(sorted_df, expected)\n', (890, 91... |
# @Author ZhangGJ
# @Date 2021/04/09 17:08
from selenium import webdriver
from selenium.webdriver import ActionChains
driver = webdriver.Chrome()
driver.get('https://www.baidu.com')
above = driver.find_element_by_id('s-usersetting-top')
ActionChains(driver).move_to_element(above).perform()
| [
"selenium.webdriver.Chrome",
"selenium.webdriver.ActionChains"
] | [((128, 146), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (144, 146), False, 'from selenium import webdriver\n'), ((239, 259), 'selenium.webdriver.ActionChains', 'ActionChains', (['driver'], {}), '(driver)\n', (251, 259), False, 'from selenium.webdriver import ActionChains\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from exam import fixture
from sentry.testutils import TestCase
from sentry.interfaces.user import User
from sentry.models import Event
class UserTest(TestCase):
@fixture
def event(self):
return mock.Mock(spec=Event())
@... | [
"sentry.models.Event",
"sentry.interfaces.user.User.to_python"
] | [((305, 312), 'sentry.models.Event', 'Event', ([], {}), '()\n', (310, 312), False, 'from sentry.models import Event\n'), ((550, 568), 'sentry.interfaces.user.User.to_python', 'User.to_python', (['{}'], {}), '({})\n', (564, 568), False, 'from sentry.interfaces.user import User\n')] |
import our_db
our_db.show_all() | [
"our_db.show_all"
] | [((17, 34), 'our_db.show_all', 'our_db.show_all', ([], {}), '()\n', (32, 34), False, 'import our_db\n')] |
#!/usr/bin/python3
# file: realtime_communication_model.py
# Created by Guang at 19-8-6
# description:
# *-* coding:utf8 *-*
# 即时通信模块, 参考参考
import random
import time
class Message(object):
def __init__(self, msgarr=[], toacc=''):
self.msgbody = msgarr # 此处为MsgDict对象实例的列表或者空列表
self.toacc = toacc... | [
"time.time",
"random.randint"
] | [((371, 400), 'random.randint', 'random.randint', (['(1)', '(1000000000)'], {}), '(1, 1000000000)\n', (385, 400), False, 'import random\n'), ((1545, 1574), 'random.randint', 'random.randint', (['(1)', '(1000000000)'], {}), '(1, 1000000000)\n', (1559, 1574), False, 'import random\n'), ((2009, 2020), 'time.time', 'time.t... |
import logging
import os
from types import ModuleType
from typing import Any, Dict, List, Optional
from pathlib import Path
import asyncio
from ray.experimental.internal_kv import _internal_kv_initialized
from ray._private.runtime_env.context import RuntimeEnvContext
from ray._private.runtime_env.packaging import (
... | [
"logging.getLogger",
"ray._private.runtime_env.packaging.delete_package",
"ray._private.runtime_env.packaging.parse_uri",
"ray._private.utils.try_to_create_directory",
"os.pathsep.join",
"ray._private.utils.get_directory_size_bytes",
"ray._private.runtime_env.packaging.Protocol.remote_protocols",
"os.... | [((616, 643), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (633, 643), False, 'import logging\n'), ((715, 727), 'ray._private.runtime_env.packaging.parse_uri', 'parse_uri', (['s'], {}), '(s)\n', (724, 727), False, 'from ray._private.runtime_env.packaging import download_and_unpack_packa... |
from django.http import JsonResponse
from rest_framework import viewsets
from rest_framework.permissions import IsAdminUser
from .models import Gallery
from .serializers import GallerySerializer
# =============================
# Home view
# =============================
def home_view(req, *args, **kwargs):
retur... | [
"django.http.JsonResponse"
] | [((322, 365), 'django.http.JsonResponse', 'JsonResponse', (["{'project': 'CampsForChamps'}"], {}), "({'project': 'CampsForChamps'})\n", (334, 365), False, 'from django.http import JsonResponse\n')] |
import six
from eclcli.common import command
from eclcli.common import exceptions
from eclcli.common import utils
from ..interconnectivityclient.common.utils import objectify, get_request_body
class ListCIC(command.Lister):
def get_parser(self, prog_name):
parser = super(ListCIC, self).get_parser(prog_n... | [
"six.iteritems",
"eclcli.common.utils.get_item_properties"
] | [((983, 1020), 'eclcli.common.utils.get_item_properties', 'utils.get_item_properties', (['s', 'columns'], {}), '(s, columns)\n', (1008, 1020), False, 'from eclcli.common import utils\n'), ((1999, 2022), 'six.iteritems', 'six.iteritems', (['printout'], {}), '(printout)\n', (2012, 2022), False, 'import six\n'), ((3622, 3... |
# Generated by Django 3.1.3 on 2020-11-19 17:18
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('visitorx', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='visit',
name='session_id',
),
]... | [
"django.db.migrations.RemoveField"
] | [((217, 278), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""visit"""', 'name': '"""session_id"""'}), "(model_name='visit', name='session_id')\n", (239, 278), False, 'from django.db import migrations\n')] |
__copyright__ = "Copyright (c) Microsoft Corporation and Mila - Quebec AI Institute"
__license__ = "MIT"
import unittest
import numpy as np
from segar.factors import (
Charge,
Magnetism,
Mass,
Floor,
Heat,
Friction,
GaussianNoise,
Label,
Position,
ID,
)
from segar.mdps.initiali... | [
"segar.things.Entity",
"segar.rules.inspect_signature",
"segar.rules.IsEqual",
"numpy.array",
"segar.sim.Simulator",
"unittest.main",
"segar.rules.Prior",
"segar.rules.IsOn",
"segar.factors.Heat",
"segar.things.Charger",
"segar.things.Magnet",
"segar.factors.Magnetism",
"segar.factors.Gaussi... | [((706, 717), 'segar.sim.Simulator', 'Simulator', ([], {}), '()\n', (715, 717), False, 'from segar.sim import Simulator\n'), ((911, 954), 'segar.rules.TransitionFunction', 'TransitionFunction', (['_factors_and_parameters'], {}), '(_factors_and_parameters)\n', (929, 954), False, 'from segar.rules import SetFactor, IsEqu... |
"""Some things never change."""
import typer
from ee_cli.settings import Settings
settings = Settings()
EXIT_HOTWORDS = {"end", "exit", "done", "quit", "q"}
RESET_HOTWORDS = {"clear", "restart", "c"}
DROP_HOTWORDS = {"drop", "remove", "rm", "d"}
TOGGLE_INDEX_HOTWORDS = {"index", "idx", "indexes", "i"}
HELP_HOTWORDS ... | [
"ee_cli.settings.Settings",
"typer.style"
] | [((95, 105), 'ee_cli.settings.Settings', 'Settings', ([], {}), '()\n', (103, 105), False, 'from ee_cli.settings import Settings\n'), ((682, 782), 'typer.style', 'typer.style', (['"""\n Type the word \'back\' to leave this screen\n\n"""', 'typer.colors.BRIGHT_MAGENTA'], {}), '("""\n Type the word \'back\' to leave t... |
"""Darknet-53 for yolo v3.
"""
from keras.models import Model
from keras.layers import Input, Conv2D, GlobalAveragePooling2D, Dense
from keras.layers import add, Activation, BatchNormalization
from keras.layers.advanced_activations import LeakyReLU
from keras.regularizers import l2
def conv2d_unit(x, filters, kernel... | [
"keras.layers.add",
"keras.layers.Dense",
"keras.layers.Input",
"keras.models.Model",
"keras.layers.Activation",
"keras.regularizers.l2",
"keras.layers.advanced_activations.LeakyReLU",
"keras.layers.GlobalAveragePooling2D",
"keras.layers.BatchNormalization"
] | [((728, 744), 'keras.layers.add', 'add', (['[inputs, x]'], {}), '([inputs, x])\n', (731, 744), False, 'from keras.layers import add, Activation, BatchNormalization\n'), ((1595, 1621), 'keras.layers.Input', 'Input', ([], {'shape': '(416, 416, 3)'}), '(shape=(416, 416, 3))\n', (1600, 1621), False, 'from keras.layers impo... |
import zlib
import base64
import urllib.parse
from urllib.parse import unquote
from urllib.parse import quote
def decodeURL_decode64_inflate(SAMLRequest):
decoded_data = base64.b64decode(unquote(SAMLRequest))
return zlib.decompress( decoded_data , -15)
def deflate_and_base64_encode(StringSAMLRequest... | [
"urllib.parse.unquote",
"base64.b64encode",
"zlib.decompress",
"zlib.compress"
] | [((233, 267), 'zlib.decompress', 'zlib.decompress', (['decoded_data', '(-15)'], {}), '(decoded_data, -15)\n', (248, 267), False, 'import zlib\n'), ((342, 374), 'zlib.compress', 'zlib.compress', (['StringSAMLRequest'], {}), '(StringSAMLRequest)\n', (355, 374), False, 'import zlib\n'), ((199, 219), 'urllib.parse.unquote'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Softmax
import matplotlib.pyplot as plt
def INF(B,H,W):
return -torch.diag(torch.tensor(float("inf")).cuda().repeat(H),0).unsqueeze(0).repeat(B*W,1,1)
def warpImage(input,field):
B,C,H,W=field.shape
#print(B,C,H,W)
... | [
"torch.nn.Softmax",
"torch.mean",
"torch.eye",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.cat",
"torch.bmm",
"torch.zeros",
"torch.linspace",
"torch.randn"
] | [((10893, 10921), 'torch.randn', 'torch.randn', (['(4)', '(2048)', '(41)', '(41)'], {}), '(4, 2048, 41, 41)\n', (10904, 10921), False, 'import torch\n'), ((871, 941), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'in_dim', 'out_channels': '(in_dim // 8)', 'kernel_size': '(1)'}), '(in_channels=in_dim, out_channel... |
# ==============================================================================
# KratosShapeOptimizationApplication
#
# License: BSD License
# license: ShapeOptimizationApplication/license.txt
#
# Main authors: <NAME>, https://github.com/dbaumgaertner
# <NAME>, https:... | [
"KratosMultiphysics.Logger.PrintInfo",
"KratosMultiphysics.ShapeOptimizationApplication.loggers.data_logger_factory.CreateDataLogger",
"KratosMultiphysics.ShapeOptimizationApplication.mapper_factory.CreateMapper",
"KratosMultiphysics.Vector",
"KratosMultiphysics.Matrix",
"KratosMultiphysics.Parameters",
... | [((1633, 2099), 'KratosMultiphysics.Parameters', 'KM.Parameters', (['"""\n {\n "name" : "penalized_projection",\n "max_correction_share" : 0.75,\n "max_iterations" : 100,\n "relative_tolerance" : 1e-3,\n "line_search" : {\... |
from metagov.core.utils import SaferDraft7Validator
plugin_registry = {}
class Parameters:
def __init__(self, values={}, schema=None):
if schema:
from metagov.core.utils import validate_and_fill_defaults
validate_and_fill_defaults(values, schema)
for k, v in values.items... | [
"metagov.core.utils.SaferDraft7Validator.check_schema",
"metagov.core.utils.validate_and_fill_defaults"
] | [((244, 286), 'metagov.core.utils.validate_and_fill_defaults', 'validate_and_fill_defaults', (['values', 'schema'], {}), '(values, schema)\n', (270, 286), False, 'from metagov.core.utils import validate_and_fill_defaults\n'), ((2728, 2780), 'metagov.core.utils.SaferDraft7Validator.check_schema', 'SaferDraft7Validator.c... |
import six
import pytest
from mock import Mock, patch
from nefertari import tweens
def mock_timer():
mock_timer.time = 0
def time_func():
mock_timer.time += 1
return mock_timer.time
return time_func
class DummyConfigurator(object):
def __init__(self):
self.subscribed = []
... | [
"nefertari.tweens.get_tunneling",
"mock.patch",
"six.b",
"nefertari.tweens.request_timing",
"mock.Mock",
"nefertari.tweens.enable_selfalias",
"nefertari.tweens.cache_control",
"nefertari.tweens.ssl",
"pytest.raises",
"nefertari.tweens.cors",
"six.callable"
] | [((451, 481), 'mock.patch', 'patch', (['"""nefertari.tweens.time"""'], {}), "('nefertari.tweens.time')\n", (456, 481), False, 'from mock import Mock, patch\n'), ((487, 516), 'mock.patch', 'patch', (['"""nefertari.tweens.log"""'], {}), "('nefertari.tweens.log')\n", (492, 516), False, 'from mock import Mock, patch\n'), (... |
# Copyright 2018-2020 Xanadu Quantum Technologies 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... | [
"pennylane.Rot",
"pennylane.qnode",
"pennylane.device",
"pennylane.PauliZ",
"pennylane.RX",
"numpy.log2"
] | [((947, 990), 'pennylane.device', 'qml.device', (['"""default.qubit"""'], {'wires': 'n_qubits'}), "('default.qubit', wires=n_qubits)\n", (957, 990), True, 'import pennylane as qml\n'), ((1179, 1214), 'pennylane.qnode', 'qml.qnode', (['dev'], {'interface': 'interface'}), '(dev, interface=interface)\n', (1188, 1214), Tru... |
# BOJ 14494 다이나믹이 뭐에요?
import sys
sys.setrecursionlimit(1000000)
sys.stdin = open("../input.txt", "r")
si = sys.stdin.readline
MOD = 1000000007
def memoize(y, x):
if dp[y][x] > -1:
return dp[y][x]
if y == n and x == m:
dp[y][x] = 1
return dp[y][x]
dp[y][x] = 0
if y + 1 <= n:... | [
"sys.setrecursionlimit"
] | [((35, 65), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(1000000)'], {}), '(1000000)\n', (56, 65), False, 'import sys\n')] |
import json
import os
import time
from .baseclient import BaseClient
from .payloads import Payload
from .utils import remove_none
class Presence(BaseClient):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def update(self, pid: int = os.getpid(),
state: s... | [
"os.getpid"
] | [((278, 289), 'os.getpid', 'os.getpid', ([], {}), '()\n', (287, 289), False, 'import os\n'), ((1269, 1280), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1278, 1280), False, 'import os\n'), ((1836, 1847), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1845, 1847), False, 'import os\n'), ((2683, 2694), 'os.getpid', 'os.get... |
# pylint: disable=missing-docstring, invalid-name, too-many-locals
import random
# 生成随机元组
def random_int_list(max_dim_length, each_dim_max_length):
random_list = []
for _ in range(max_dim_length):
random_list.append(random.randint(2, each_dim_max_length))
return tuple(random_list)
# nram_single_bu... | [
"random.randint"
] | [((232, 270), 'random.randint', 'random.randint', (['(2)', 'each_dim_max_length'], {}), '(2, each_dim_max_length)\n', (246, 270), False, 'import random\n'), ((2032, 2065), 'random.randint', 'random.randint', (['(2)', 'max_dim_length'], {}), '(2, max_dim_length)\n', (2046, 2065), False, 'import random\n'), ((2080, 2118)... |
#! /usr/bin/env python
from distutils.core import setup
setup(name="commadecimal",
version="1.0.0",
description="",
packages=["commadecimal"],
author="<NAME>",
author_email="<EMAIL>",
url='https://github.com/iogf/django-commadecimal',
download_url='https://github.com/iogf/dja... | [
"distutils.core.setup"
] | [((58, 396), 'distutils.core.setup', 'setup', ([], {'name': '"""commadecimal"""', 'version': '"""1.0.0"""', 'description': '""""""', 'packages': "['commadecimal']", 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/iogf/django-commadecimal"""', 'download_url': '"""https://github.c... |
from lib.common import min_edit_distance
from lib.common import send_reply
def test_send_reply(mock_client, make_zulip_message):
"""
Tests that send_reply functions correctly.
"""
mock_client.email = "<EMAIL>"
message, _ = make_zulip_message("help")
send_reply(
mock_client, message, "... | [
"lib.common.min_edit_distance",
"lib.common.send_reply"
] | [((277, 329), 'lib.common.send_reply', 'send_reply', (['mock_client', 'message', '"""Here is a reply!"""'], {}), "(mock_client, message, 'Here is a reply!')\n", (287, 329), False, 'from lib.common import send_reply\n'), ((663, 720), 'lib.common.min_edit_distance', 'min_edit_distance', (['""""""', '"""a"""'], {'insert_c... |
# Generated by Django 3.2.6 on 2021-08-08 13:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('weCodeBlog', '0003_auto_20210805_1927'),
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.BigAutoField"
] | [((623, 681), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""web developing"""', 'max_length': '(255)'}), "(default='web developing', max_length=255)\n", (639, 681), False, 'from django.db import migrations, models\n'), ((335, 431), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'... |
from django.conf.urls import url
from core.views import general, host, host_group, task_template, task, ansible_user, rest
urlpatterns = [
url(r'^$', general.index, name='index'),
url(r'^hosts/$', host.search, name='host_search'),
url(r'^hosts/create/$', host.edit, name='host_create'),
url(r'^hosts/(... | [
"django.conf.urls.url"
] | [((145, 183), 'django.conf.urls.url', 'url', (['"""^$"""', 'general.index'], {'name': '"""index"""'}), "('^$', general.index, name='index')\n", (148, 183), False, 'from django.conf.urls import url\n'), ((191, 239), 'django.conf.urls.url', 'url', (['"""^hosts/$"""', 'host.search'], {'name': '"""host_search"""'}), "('^ho... |
import sys
if sys.version_info[0] < 3:
from io import BytesIO as stream
else:
from io import StringIO as stream
sys.stdin = stream(sys.stdin.read())
input = lambda: sys.stdin.readline().rstrip('\r\n')
def binary_search(arr, x):
N = len(arr)
l = -1 # arr[l] < x
r = N # arr... | [
"sys.stdin.readline",
"sys.stdin.read"
] | [((141, 157), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (155, 157), False, 'import sys\n'), ((175, 195), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (193, 195), False, 'import sys\n')] |
"""Data getters for Glass business website data."""
import logging
import pickle
from pathlib import Path
from typing import Dict
import pandas as pd
from metaflow import namespace
from sg_covid_impact.utils.metaflow import flow_getter
import sg_covid_impact
OUTPUT_DIR = Path(f"{sg_covid_impact.project_dir}/data/in... | [
"logging.getLogger",
"pickle.dump",
"pathlib.Path",
"pickle.load",
"metaflow.namespace"
] | [((276, 341), 'pathlib.Path', 'Path', (['f"""{sg_covid_impact.project_dir}/data/interim/topsbm_models"""'], {}), "(f'{sg_covid_impact.project_dir}/data/interim/topsbm_models')\n", (280, 341), False, 'from pathlib import Path\n'), ((398, 425), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n',... |
from scrapy import Spider
from xiachufang.items import CategoryItem
from xiachufang.util import base_url, domains
class CategoryListSpider(Spider):
name = 'category'
allowed_domains = domains
start_urls = ['http://www.xiachufang.com/category/']
def parse(self, response):
for sel in response.c... | [
"xiachufang.items.CategoryItem"
] | [((367, 381), 'xiachufang.items.CategoryItem', 'CategoryItem', ([], {}), '()\n', (379, 381), False, 'from xiachufang.items import CategoryItem\n')] |
from pyecharts import options as opts
from pyecharts.charts import Tree
data = [
{
"children": [
{"name": "B"},
{
"children": [{"children": [{"name": "I"}], "name": "E"}, {"name": "F"}],
"name": "C",
},
{
"chil... | [
"pyecharts.options.TitleOpts",
"pyecharts.charts.Tree"
] | [((614, 647), 'pyecharts.options.TitleOpts', 'opts.TitleOpts', ([], {'title': '"""Tree-基本示例"""'}), "(title='Tree-基本示例')\n", (628, 647), True, 'from pyecharts import options as opts\n'), ((556, 562), 'pyecharts.charts.Tree', 'Tree', ([], {}), '()\n', (560, 562), False, 'from pyecharts.charts import Tree\n')] |
"""
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: MIT-0
"""
import six
from cfnlint.rules import CloudFormationLintRule
from cfnlint.rules import RuleMatch
class PropertiesTemplated(CloudFormationLintRule):
"""Check Base Resource Configuration"""
id = 'W3002'
... | [
"cfnlint.rules.RuleMatch"
] | [((1314, 1338), 'cfnlint.rules.RuleMatch', 'RuleMatch', (['path', 'message'], {}), '(path, message)\n', (1323, 1338), False, 'from cfnlint.rules import RuleMatch\n')] |
import argparse
from datetime import datetime
import os
from sagemaker.estimator import Estimator
MODEL_NAME = 'ssd'
BUCKET_NAME = 'your_bucket_name'
HYPER_PARAMS = {
'output_path': '/opt/ml/model',
'ckpt_path': '/opt/ml/checkpoints',
'data_dir': '/opt/ml/input/data/training'
}
IAM_ROLE = os.getenv('AWS_I... | [
"datetime.datetime.now",
"sagemaker.estimator.Estimator",
"argparse.ArgumentParser",
"os.getenv"
] | [((304, 329), 'os.getenv', 'os.getenv', (['"""AWS_IAM_ROLE"""'], {}), "('AWS_IAM_ROLE')\n", (313, 329), False, 'import os\n'), ((403, 428), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (426, 428), False, 'import argparse\n'), ((1152, 1468), 'sagemaker.estimator.Estimator', 'Estimator', ([], {... |
# Generated by Django 2.1.7 on 2019-04-03 15:40
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('user', '0016_profile_follower'),
]
operations = [
migrations.RemoveField(
model_name='profile',
name='following',
),... | [
"django.db.migrations.RemoveField"
] | [((222, 284), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""profile"""', 'name': '"""following"""'}), "(model_name='profile', name='following')\n", (244, 284), False, 'from django.db import migrations\n')] |
import warnings
import pytest
import pandas as pd
import pandas._testing as tm
from pandas.tests.extension.base.base import BaseExtensionTests
class BaseReduceTests(BaseExtensionTests):
"""
Reduction specific tests. Generally these only
make sense for numeric/boolean operations.
"""
... | [
"pandas.Series",
"pandas._testing.assert_almost_equal",
"warnings.catch_warnings",
"pytest.mark.parametrize",
"pytest.raises",
"warnings.simplefilter"
] | [((641, 689), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""skipna"""', '[True, False]'], {}), "('skipna', [True, False])\n", (664, 689), False, 'import pytest\n'), ((1115, 1163), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""skipna"""', '[True, False]'], {}), "('skipna', [True, False])\n", ... |
import sys
import time
import numpy as np
from gym.spaces.discrete import Discrete
from tianshou.data import Batch
from tianshou.env import DummyVectorEnv, RayVectorEnv, ShmemVectorEnv, SubprocVectorEnv
if __name__ == '__main__':
from env import MyTestEnv, NXEnv
else: # pytest
from test.base.env import MyTe... | [
"tianshou.env.ShmemVectorEnv",
"numpy.allclose",
"tianshou.env.DummyVectorEnv",
"tianshou.data.Batch.cat",
"numpy.where",
"test.base.env.MyTestEnv",
"tianshou.env.RayVectorEnv",
"gym.spaces.discrete.Discrete",
"tianshou.data.Batch",
"tianshou.env.SubprocVectorEnv",
"test.base.env.NXEnv",
"time... | [((2060, 2071), 'time.time', 'time.time', ([], {}), '()\n', (2069, 2071), False, 'import time\n'), ((2780, 2792), 'tianshou.data.Batch.cat', 'Batch.cat', (['o'], {}), '(o)\n', (2789, 2792), False, 'from tianshou.data import Batch\n'), ((3732, 3746), 'numpy.arange', 'np.arange', (['num'], {}), '(num)\n', (3741, 3746), T... |
# -*- coding: utf-8 -*-
import sys
sys.path.insert(0,"../../src")
sys.path.insert(0,"../credibleinterval")
import math
import functools
import time
import torch
import numpy as np
from scipy.special import gamma
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import pandas as pd
import seaborn ... | [
"torch.manual_seed",
"sys.path.insert",
"torch.load",
"numpy.exp",
"numpy.random.seed",
"pymc3.stats.hpd",
"numpy.load"
] | [((35, 66), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../../src"""'], {}), "(0, '../../src')\n", (50, 66), False, 'import sys\n'), ((66, 107), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../credibleinterval"""'], {}), "(0, '../credibleinterval')\n", (81, 107), False, 'import sys\n'), ((611, 630), 'numpy... |
import pytest
import numpy as np
from sklearn.datasets import load_iris, load_boston
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.svm import SVR
from alibi.confidence.model_linearity import linearity_measure, LinearityMeasure
from alibi.confidence.model_linearity import _linear_sup... | [
"sklearn.datasets.load_iris",
"alibi.confidence.model_linearity.LinearityMeasure",
"numpy.ones",
"sklearn.datasets.load_boston",
"alibi.confidence.model_linearity._linear_superposition",
"alibi.confidence.model_linearity._sample_knn",
"sklearn.linear_model.LogisticRegression",
"pytest.mark.parametrize... | [((390, 447), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""input_shape"""', '((3,), (4, 4, 1))'], {}), "('input_shape', ((3,), (4, 4, 1)))\n", (413, 447), False, 'import pytest\n'), ((449, 497), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""nb_instances"""', '(1, 10)'], {}), "('nb_instances... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2017-09-05 16:52:10
# Project: douban_movies_time
from pyspider.libs.base_handler import *
import pymysql
import re
class Handler(BaseHandler):
crawl_config = {
'itag': 'v004',
'proxy': 'https://192.168.127.12:80',
'cookies': {
... | [
"pymysql.connect",
"re.compile"
] | [((609, 637), 're.compile', 're.compile', (['""".+\\\\/(\\\\d+)\\\\/"""'], {}), "('.+\\\\/(\\\\d+)\\\\/')\n", (619, 637), False, 'import re\n'), ((668, 690), 're.compile', 're.compile', (['"""(.+?)\\\\?"""'], {}), "('(.+?)\\\\?')\n", (678, 690), False, 'import re\n'), ((718, 746), 're.compile', 're.compile', (['""".+\\... |
# Copyright (C) 2011 by
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
# All rights reserved.
# BSD license.
from itertools import chain, count
import networkx as nx
from networkx.utils import make_str
__author__ = """<NAME> (<EMAIL>))"""
__all__ = ['tree_data', 'tree_graph']
_attrs = dict(... | [
"networkx.DiGraph",
"networkx.NetworkXError",
"networkx.utils.make_str"
] | [((3503, 3515), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (3513, 3515), True, 'import networkx as nx\n'), ((2076, 2127), 'networkx.NetworkXError', 'nx.NetworkXError', (['"""Attribute names are not unique."""'], {}), "('Attribute names are not unique.')\n", (2092, 2127), True, 'import networkx as nx\n'), ((410... |
#copyright (c) 2020 PaddlePaddle Authors. All Rights Reserve.
#
#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 l... | [
"pycocotools.mask.toBbox",
"pycocotools.cocoeval.COCOeval",
"numpy.array",
"copy.deepcopy",
"paddlex.utils.logging.debug",
"numpy.mean",
"pycocotools.coco.COCO",
"numpy.max",
"math.fabs",
"numpy.min",
"numpy.maximum",
"sys.stdout.flush",
"pycocotools.mask.area",
"cv2.resize",
"time.time"... | [((1475, 1497), 'copy.deepcopy', 'copy.deepcopy', (['coco_gt'], {}), '(coco_gt)\n', (1488, 1497), False, 'import copy\n'), ((3464, 3482), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (3480, 3482), False, 'import sys\n'), ((4086, 4113), 'copy.deepcopy', 'copy.deepcopy', (['xywh_results'], {}), '(xywh_result... |
from sklearn.linear_model import LogisticRegression
from src.models.base_model import BaseModel
class LogisticRegressionModel(BaseModel):
def __init__(self):
self.hyperparameter = {
"max_iter": 10000
}
pass
def get_name(self):
return 'logistic_regression'
de... | [
"sklearn.linear_model.LogisticRegression"
] | [((472, 513), 'sklearn.linear_model.LogisticRegression', 'LogisticRegression', ([], {}), '(**self.hyperparameter)\n', (490, 513), False, 'from sklearn.linear_model import LogisticRegression\n')] |
import numpy as np
class HMC():
def __init__(self, log_prob, grad_log_prob, invmetric_diag=None):
self.log_prob, self.grad_log_prob = log_prob, grad_log_prob
self.V = lambda x : self.log_prob(x)*-1.
#self.V_g = lambda x : self.grad_log_prob(x)*-1.
self.leapcount, self.Vgcoun... | [
"numpy.random.normal",
"numpy.prod",
"numpy.log10",
"sys.exit",
"numpy.sqrt",
"numpy.ones",
"numpy.allclose",
"numpy.random.choice",
"numpy.where",
"numpy.log",
"numpy.exp",
"numpy.stack",
"numpy.zeros",
"numpy.linspace",
"numpy.isnan",
"numpy.random.uniform",
"numpy.cumsum",
"nump... | [((2043, 2058), 'numpy.exp', 'np.exp', (['(H0 - H1)'], {}), '(H0 - H1)\n', (2049, 2058), True, 'import numpy as np\n'), ((3450, 3464), 'numpy.zeros', 'np.zeros', (['ntry'], {}), '(ntry)\n', (3458, 3464), True, 'import numpy as np\n'), ((3975, 3988), 'numpy.cumsum', 'np.cumsum', (['pp'], {}), '(pp)\n', (3984, 3988), Tru... |
import logging
import multiprocessing
import os
import sys
import time
import cv2
import h5py
import numpy as np
import caiman
from caiman.motion_correction import high_pass_filter_space, motion_correct_iteration_fast, sliding_window, tile_and_correct
from caiman.source_extraction.cnmf import online_cnmf, pre_processi... | [
"modules.laser_handler.LaserHandler",
"numpy.hstack",
"multiprocessing.Process",
"modules.video_handler.CV2VideoHandler",
"time.sleep",
"cv2.imshow",
"cv2.destroyAllWindows",
"logging.info",
"os.path.exists",
"caiman.source_extraction.cnmf.initialization.downscale",
"numpy.repeat",
"modules.fp... | [((2647, 2675), 'modules.fp_detector.model.FpDetector', 'FpDetector', (['fp_detect_method'], {}), '(fp_detect_method)\n', (2657, 2675), False, 'from modules.fp_detector.model import FpDetector\n'), ((3669, 3685), 'time.sleep', 'time.sleep', (['(0.01)'], {}), '(0.01)\n', (3679, 3685), False, 'import time\n'), ((3832, 38... |
import torch
from torchvision import datasets, transforms
def mnist():
transform = transforms.Compose([transforms.ToTensor(),
transforms.Normalize((0.5,), (0.5,))])
# exchange with the real mnist dataset
trainset = datasets.MNIST('~/.pytorch/MNIST_data/', download=True, trai... | [
"torchvision.transforms.ToTensor",
"torchvision.transforms.Normalize",
"torchvision.datasets.MNIST"
] | [((260, 352), 'torchvision.datasets.MNIST', 'datasets.MNIST', (['"""~/.pytorch/MNIST_data/"""'], {'download': '(True)', 'train': '(True)', 'transform': 'transform'}), "('~/.pytorch/MNIST_data/', download=True, train=True,\n transform=transform)\n", (274, 352), False, 'from torchvision import datasets, transforms\n')... |
from sys import argv, exit
from Evie import tbot
from Evie import TOKEN
import Evie.events
try:
tbot.start(bot_token=TOKEN)
except Exception:
print("Bot Token Invalid")
exit(1)
if len(argv) not in (1, 3, 4):
tbot.disconnect()
else:
tbot.run_until_disconnected()
| [
"Evie.tbot.start",
"Evie.tbot.run_until_disconnected",
"Evie.tbot.disconnect",
"sys.exit"
] | [((102, 129), 'Evie.tbot.start', 'tbot.start', ([], {'bot_token': 'TOKEN'}), '(bot_token=TOKEN)\n', (112, 129), False, 'from Evie import tbot\n'), ((227, 244), 'Evie.tbot.disconnect', 'tbot.disconnect', ([], {}), '()\n', (242, 244), False, 'from Evie import tbot\n'), ((255, 284), 'Evie.tbot.run_until_disconnected', 'tb... |
# python3.7
"""Contains the distributed data sampler.
Basically, the sampler is responsible for maintaining a queue of indices, where
each index corresponds to a sample in the dataset. The samplers on all replicas
have exactly the same index order. Then, the first replica will fetch data
(0, R, 2R, ...), the second wi... | [
"torch.randperm",
"torch.distributed.get_world_size",
"torch.distributed.get_rank",
"torch.arange",
"torch.Generator"
] | [((3259, 3280), 'torch.distributed.get_world_size', 'dist.get_world_size', ([], {}), '()\n', (3278, 3280), True, 'import torch.distributed as dist\n'), ((3301, 3316), 'torch.distributed.get_rank', 'dist.get_rank', ([], {}), '()\n', (3314, 3316), True, 'import torch.distributed as dist\n'), ((4702, 4719), 'torch.Generat... |
'''
*cTDS* is a pure C implementation of the `Python DB API 2.0 <https://www.python.org/dev/peps/pep-0249>`_
specification for Microsoft SQL Server.
'''
import logging
# pylint: disable=no-name-in-module,redefined-builtin
from _tds import (
apilevel,
connect,
paramstyle,
threadsafety,
Date,
Ti... | [
"logging.getLogger"
] | [((1939, 1966), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1956, 1966), False, 'import logging\n')] |
# ADVENT OF CODE 2021
# Challenge #{day:02}
# <NAME>
SAMPLE_INPUT = """\
\
"""
PT1_SAMPLE_ANS = None
def pt1(input: str):
input = input.splitlines()
return input
PT2_SAMPLE_ANS = None
def pt2(input: str):
input = input.splitlines()
return input
# ===============================... | [
"os.path.dirname",
"time.perf_counter_ns",
"os.path.join",
"colorama.init"
] | [((647, 669), 'time.perf_counter_ns', 'time.perf_counter_ns', ([], {}), '()\n', (667, 669), False, 'import time\n'), ((716, 738), 'time.perf_counter_ns', 'time.perf_counter_ns', ([], {}), '()\n', (736, 738), False, 'import time\n'), ((1083, 1094), 'colorama.init', 'colr_init', ([], {}), '()\n', (1092, 1094), True, 'fro... |
"""Tools for managing OS commands
Copyright (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
* AUTHOR : <NAME>
* DATE : Apr 2019
General Example:
How to launch the OpendTect software from python terminal
>>> execnm = 'od_main' #execnm is executable name=od_main for the OpendTect so... | [
"os.path.exists",
"odpy.common.getODSoftwareDir",
"odpy.common.isMac",
"odpy.common.get_std_stream",
"json.dumps",
"odpy.common.isWin",
"psutil.Popen",
"os.environ.copy",
"odpy.common.getExecPlfDir",
"os.path.isfile",
"os.path.dirname",
"odpy.common.sTimeUnitString",
"threading.Thread",
"o... | [((1956, 1963), 'odpy.common.isLux', 'isLux', ([], {}), '()\n', (1961, 1963), False, 'from odpy.common import isWin, isLux, isMac, getODSoftwareDir, getExecPlfDir, get_std_stream, std_msg, sTimeUnitString, log_msg\n'), ((3645, 3667), 'odpy.common.getODSoftwareDir', 'getODSoftwareDir', (['args'], {}), '(args)\n', (3661,... |
import time
import telepot
from telepot.utils import clean_data
import telepot.test_settings as st
class AdminBot(telepot.Bot):
def on_chat_message(self, msg):
content_type, chat_type, chat_id = telepot.glance(msg)
print(chat_id)
bot.sendAnimation(chat_id, open('TestFiles/tenor.gif', 'rb')... | [
"telepot.utils.clean_data",
"telepot.glance",
"time.sleep"
] | [((823, 836), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (833, 836), False, 'import time\n'), ((209, 228), 'telepot.glance', 'telepot.glance', (['msg'], {}), '(msg)\n', (223, 228), False, 'import telepot\n'), ((434, 481), 'telepot.glance', 'telepot.glance', (['msg'], {'flavor': '"""all_passport_data"""'}), "(m... |
'''
MAVLink protocol implementation (auto-generated by mavgen.py)
Generated from: common.xml
Note: this file has been auto-generated. DO NOT EDIT
'''
import struct, array, mavutil, time, json
WIRE_PROTOCOL_VERSION = "1.0"
# some base types from mavlink_types.h
MAVLINK_TYPE_CHAR = 0
MAVLINK_TYPE_UINT8_T = 1
M... | [
"mavutil.x25crc",
"array.array",
"json.dumps",
"struct.pack",
"struct.unpack",
"time.time"
] | [((881, 980), 'struct.pack', 'struct.pack', (['"""BBBBBB"""', '(254)', 'self.mlen', 'self.seq', 'self.srcSystem', 'self.srcComponent', 'self.msgId'], {}), "('BBBBBB', 254, self.mlen, self.seq, self.srcSystem, self.\n srcComponent, self.msgId)\n", (892, 980), False, 'import struct, array, mavutil, time, json\n'), ((2... |
__author__ = "<NAME>"
__status__ = "prototype"
import calendar
import os
import pymongo
import sys
import tarfile
import time
from tw_funcs import create_dir, process_bz2_db, download_archive
import subprocess
# essential variables
year = 2019
month = sys.argv[1]
day_start = int(sys.argv[2])
day_end = int(sys.argv[3]... | [
"os.path.exists",
"tarfile.open",
"subprocess.run",
"tw_funcs.create_dir",
"pymongo.MongoClient",
"tw_funcs.process_bz2_db",
"time.time"
] | [((337, 362), 'tw_funcs.create_dir', 'create_dir', (['"""./time_log/"""'], {}), "('./time_log/')\n", (347, 362), False, 'from tw_funcs import create_dir, process_bz2_db, download_archive\n'), ((375, 421), 'pymongo.MongoClient', 'pymongo.MongoClient', (["os.environ['CLIENT_ADDR']"], {}), "(os.environ['CLIENT_ADDR'])\n",... |
from argparse import ArgumentParser
from softioc import softioc, builder, pvlog
if __name__ == "__main__":
import cothread
# Being run as an IOC, so parse args and set prefix
parser = ArgumentParser()
parser.add_argument('prefix', help="The PV prefix for the records")
parsed_args = parser.parse_... | [
"softioc.builder.SetDeviceName",
"argparse.ArgumentParser",
"cothread.WaitForQuit",
"softioc.softioc.iocInit",
"softioc.builder.LoadDatabase"
] | [((200, 216), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (214, 216), False, 'from argparse import ArgumentParser\n'), ((331, 372), 'softioc.builder.SetDeviceName', 'builder.SetDeviceName', (['parsed_args.prefix'], {}), '(parsed_args.prefix)\n', (352, 372), False, 'from softioc import softioc, builde... |
#!/usr/bin/env python
# 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... | [
"typing.TypeVar"
] | [((834, 884), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': "Union['WebDriver', 'LogEvent']"}), "('T', bound=Union['WebDriver', 'LogEvent'])\n", (841, 884), False, 'from typing import TYPE_CHECKING, Dict, List, TypeVar, Union\n')] |
import asyncio
import json
from django.contrib.auth import get_user_model
from channels.consumer import AsyncConsumer
from channels.db import database_sync_to_async
from .models import Thread, ChatMessage
# Consumer are for channels as views are for django
class ChatConsumer(AsyncConsumer):
async def websocket_... | [
"json.loads",
"json.dumps"
] | [((1157, 1179), 'json.loads', 'json.loads', (['front_text'], {}), '(front_text)\n', (1167, 1179), False, 'import json\n'), ((1837, 1859), 'json.dumps', 'json.dumps', (['myResponse'], {}), '(myResponse)\n', (1847, 1859), False, 'import json\n')] |
import os
import sys
import cv2
import numpy as np
import logging
MODEL_FILE = "model.mdl"
def detect(img, cascade):
gray = to_grayscale(img)
rects = cascade.detectMultiScale(gray, scaleFactor=1.3, minNeighbors=2, minSize=(15, 15), flags = cv2.CASCADE_SCALE_IMAGE)
if len(rects) == 0:
return []
return... | [
"cv2.equalizeHist",
"cv2.CascadeClassifier",
"cv2.imwrite",
"cv2.cvtColor"
] | [((425, 481), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_frontalface_alt.xml"""'], {}), "('haarcascade_frontalface_alt.xml')\n", (446, 481), False, 'import cv2\n'), ((547, 584), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (559, 584), False... |
# Import Modules
import re, datetime, time, os, sys #standard modules
import random
import textwrap # standard module for removing trailing idnents in post string
import json # https://docs.python.org/3/library/json.html
import logging # https://docs.python.org/3/library/logging.html
import threading # https... | [
"logging.basicConfig",
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"time.sleep",
"threading.Event",
"praw.Reddit",
"logging.FileHandler",
"json.load",
"json.dump",
"re.search"
] | [((6044, 6098), 'logging.FileHandler', 'logging.FileHandler', (['"""SDBotcast.log"""'], {'encoding': '"""utf-8"""'}), "('SDBotcast.log', encoding='utf-8')\n", (6063, 6098), False, 'import logging\n'), ((6485, 6655), 'logging.basicConfig', 'logging.basicConfig', ([], {'handlers': 'handlers', 'level': 'logging.DEBUG', 'f... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="procspec",
version="0.0.4",
author="<NAME>",
author_email="<EMAIL>",
description="Library for simple and powerful YAML specification of computational tasks.",
long_description=long_des... | [
"setuptools.find_packages"
] | [((587, 613), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (611, 613), False, 'import setuptools\n')] |
import random
BLACK = 0
RED = 1
class NodeRBT(object):
def __init__(self, key=None, value=None, color=BLACK):
self.key = key
self.value = value
self.parent = None
self.left_child = None
self.right_child = None
self.color = color
self.size_tree... | [
"random.randint",
"random.shuffle"
] | [((25669, 25693), 'random.shuffle', 'random.shuffle', (['key_list'], {}), '(key_list)\n', (25683, 25693), False, 'import random\n'), ((26040, 26067), 'random.shuffle', 'random.shuffle', (['delete_list'], {}), '(delete_list)\n', (26054, 26067), False, 'import random\n'), ((25542, 25568), 'random.randint', 'random.randin... |
##########################################
# File: util.py
# Author: <NAME>
# Co-Author: <NAME>
# Last modified: Jan 17, 2017
##########################################
import copy
from PIL import Image, ImageDraw
# Debug echo flag.
DEBUG = False
# True represents light pixels and Fal... | [
"PIL.Image.new",
"PIL.ImageDraw.Draw",
"copy.deepcopy"
] | [((599, 638), 'PIL.Image.new', 'Image.new', (['"""1"""', '(width, width)', '"""white"""'], {}), "('1', (width, width), 'white')\n", (608, 638), False, 'from PIL import Image, ImageDraw\n'), ((649, 668), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['img'], {}), '(img)\n', (663, 668), False, 'from PIL import Image, ImageDra... |
import torch
import torch.nn as nn
from ltprg.model.seq import sort_seq_tensors, unsort_seq_tensors, SequenceModel
from torch.autograd import Variable
class ObservationModel(nn.Module):
def __init__(self):
super(ObservationModel, self).__init__()
def forward(self, observation):
"""... | [
"torch.nn.Tanh",
"ltprg.model.seq.unsort_seq_tensors",
"torch.load",
"torch.eye",
"torch.arange",
"torch.save",
"ltprg.model.seq.SequenceModel.make",
"torch.autograd.Variable",
"torch.cat",
"torch.ones"
] | [((728, 761), 'torch.save', 'torch.save', (['model_obj', 'model_path'], {}), '(model_obj, model_path)\n', (738, 761), False, 'import torch\n'), ((831, 853), 'torch.load', 'torch.load', (['model_path'], {}), '(model_path)\n', (841, 853), False, 'import torch\n'), ((2453, 2491), 'torch.autograd.Variable', 'Variable', (['... |
from PIL import Image
img_path=input("Enter your image path here:") #ex -> r'C:\Users\xyz\images\p1.jpg'
img = Image.open(img_path)
img = img.resize((900, 900), Image.ANTIALIAS)
img.save('resized_image.jpg')
filename1 = 'resized_image.jpg'
filename=input("Independence Day.png")
# Open Front Image
frontImage =... | [
"PIL.Image.open"
] | [((114, 134), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (124, 134), False, 'from PIL import Image\n'), ((321, 341), 'PIL.Image.open', 'Image.open', (['filename'], {}), '(filename)\n', (331, 341), False, 'from PIL import Image\n'), ((380, 401), 'PIL.Image.open', 'Image.open', (['filename1'], {}... |
import numpy as np
import cv2
from shapely.geometry import Polygon
import pyclipper
class MakeShrinkMap():
r'''
Making binary mask from detection data with ICDAR format.
Typically following the process of class `MakeICDARData`.
'''
def __init__(self, min_text_size=8, shrink_ratio=0.4):
se... | [
"numpy.clip",
"numpy.ones",
"numpy.power",
"numpy.array",
"numpy.zeros",
"shapely.geometry.Polygon",
"pyclipper.PyclipperOffset"
] | [((828, 862), 'numpy.zeros', 'np.zeros', (['(h, w)'], {'dtype': 'np.float32'}), '((h, w), dtype=np.float32)\n', (836, 862), True, 'import numpy as np\n'), ((878, 911), 'numpy.ones', 'np.ones', (['(h, w)'], {'dtype': 'np.float32'}), '((h, w), dtype=np.float32)\n', (885, 911), True, 'import numpy as np\n'), ((2528, 2560)... |
import os
import sqlite3
import time
import types
from . import common
from . import exceptions
from . import pushshift
from voussoirkit import pathclass
from voussoirkit import sqlhelpers
from voussoirkit import vlogging
log = vlogging.get_logger(__name__)
# For backwards compatibility reasons, this list of format... | [
"voussoirkit.vlogging.get_logger",
"sqlite3.connect",
"voussoirkit.sqlhelpers.insert_filler",
"os.path.splitext",
"os.path.isfile",
"os.path.basename",
"voussoirkit.pathclass.Path",
"time.time"
] | [((231, 260), 'voussoirkit.vlogging.get_logger', 'vlogging.get_logger', (['__name__'], {}), '(__name__)\n', (250, 260), False, 'from voussoirkit import vlogging\n'), ((4376, 4400), 'voussoirkit.pathclass.Path', 'pathclass.Path', (['filepath'], {}), '(filepath)\n', (4390, 4400), False, 'from voussoirkit import pathclass... |
#!/usr/bin/env python
"""Tests for the ee.apifunction module."""
import types
import unittest
import ee
from ee import apitestcase
class ApiFunctionTest(apitestcase.ApiTestCase):
def testAddFunctions(self):
"""Verifies that addition of static and instance API functions."""
# Check instance vs static... | [
"unittest.main",
"ee.ApiFunction.clearApi",
"ee.ApiFunction.importApi"
] | [((1941, 1956), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1954, 1956), False, 'import unittest\n'), ((760, 821), 'ee.ApiFunction.importApi', 'ee.ApiFunction.importApi', (['TestClass', '"""Image"""', '"""Image"""', '"""pre_"""'], {}), "(TestClass, 'Image', 'Image', 'pre_')\n", (784, 821), False, 'import ee\n'... |
# imports
from __future__ import print_function
from IPython.display import display, Image
from six.moves import cPickle as pickle
from six.moves.urllib.request import urlretrieve
from sklearn.linear_model import LogisticRegression
import imageio
import matplotlib.pyplot as plt
import numpy as np
import os
import sys
i... | [
"tarfile.open",
"file_helper.join_paths",
"sys.stdout.write",
"file_helper.get_file_name",
"numpy.mean",
"os.path.exists",
"os.listdir",
"six.moves.cPickle.load",
"six.moves.cPickle.dump",
"os.path.isdir",
"numpy.random.seed",
"sys.stdout.flush",
"numpy.random.permutation",
"numpy.std",
... | [((502, 528), 'numpy.random.seed', 'np.random.seed', (['NUMPY_SEED'], {}), '(NUMPY_SEED)\n', (516, 528), True, 'import numpy as np\n'), ((1229, 1271), 'os.path.join', 'os.path.join', (['NOT_MNIST_ZIPS_DIR', 'filename'], {}), '(NOT_MNIST_ZIPS_DIR, filename)\n', (1241, 1271), False, 'import os\n'), ((1557, 1579), 'os.sta... |
import math
R, X, Y = [int(x) for x in input().split()]
dist = math.sqrt(X*X+Y*Y)
if dist < R:
print(2)
else:
print(math.ceil(dist/R))
| [
"math.ceil",
"math.sqrt"
] | [((64, 88), 'math.sqrt', 'math.sqrt', (['(X * X + Y * Y)'], {}), '(X * X + Y * Y)\n', (73, 88), False, 'import math\n'), ((126, 145), 'math.ceil', 'math.ceil', (['(dist / R)'], {}), '(dist / R)\n', (135, 145), False, 'import math\n')] |
# Generated by Django 2.1.4 on 2019-01-22 02:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_auto_20190114_0136'),
]
operations = [
migrations.AddField(
model_name='tweetstats',
name='female',
... | [
"django.db.models.PositiveIntegerField"
] | [((335, 373), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n', (362, 373), False, 'from django.db import migrations, models\n'), ((495, 533), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
from . import compressed
from . import uncompress
@click.command()
@click.argument('srcs', type=click.Path(exists=True), nargs=-1)
@click.option('--dist', '-d', default='', help='An optional directory to which extract files.')
def uncmprs(srcs, dist):
if... | [
"click.option",
"click.command",
"click.Path",
"click.progressbar"
] | [((113, 128), 'click.command', 'click.command', ([], {}), '()\n', (126, 128), False, 'import click\n'), ((194, 293), 'click.option', 'click.option', (['"""--dist"""', '"""-d"""'], {'default': '""""""', 'help': '"""An optional directory to which extract files."""'}), "('--dist', '-d', default='', help=\n 'An optional... |
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from api.models.guild import Guild
from api.models.role import Role
from api.models.utils import ModelReprMixin
class User(ModelReprMixin, models.Model):
"""A Discord user."""
id = models.BigIntegerField(
... | [
"django.core.validators.MaxValueValidator",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.core.validators.MinValueValidator",
"api.models.role.Role.objects.get",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((571, 639), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(32)', 'help_text': '"""The username of a user."""'}), "(max_length=32, help_text='The username of a user.')\n", (587, 639), False, 'from django.db import models\n'), ((964, 1035), 'django.db.models.DateTimeField', 'models.DateTimeFiel... |
# libraries and data
import matplotlib.pyplot as plt
import matplotlib.lines as mlines
import matplotlib.patches as mpatches
import numpy as np
import pandas as pd
import pprint
from tabulate import tabulate
def plot_line(X,Y,x_label,y_label,title,legend):
# style
plt.style.use('seaborn-darkgrid')
# line ... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.title",
"matplotlib.lines.Line2D",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((274, 307), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-darkgrid"""'], {}), "('seaborn-darkgrid')\n", (287, 307), True, 'import matplotlib.pyplot as plt\n'), ((367, 427), 'matplotlib.pyplot.plot', 'plt.plot', (['X', 'Y'], {'marker': '""""""', 'color': '"""red"""', 'linewidth': '(1)', 'alpha': '(1)'}... |
import time
import logging
import unittest
import os
import warnings
tests_root = os.path.dirname(__file__)
output_root = os.path.join(tests_root, "tmp")
if not os.path.exists(output_root):
os.mkdir(output_root)
class SniparTest(unittest.TestCase):
p_value_threshold = 0.01
subsample_snp = 50
log = Fal... | [
"logging.basicConfig",
"os.path.exists",
"os.path.join",
"os.path.dirname",
"os.mkdir",
"time.time",
"warnings.filterwarnings"
] | [((83, 108), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (98, 108), False, 'import os\n'), ((123, 154), 'os.path.join', 'os.path.join', (['tests_root', '"""tmp"""'], {}), "(tests_root, 'tmp')\n", (135, 154), False, 'import os\n'), ((162, 189), 'os.path.exists', 'os.path.exists', (['output_... |
import os
import astropy.table
import astropy.io
import sys
current_path = sys.path[0]
ex_op_str = current_path[current_path.index('progs')+6: current_path.index('w2w_ensembleplots')-1]
sys.path.append('/progs/{}'.format(ex_op_str))
from w2w_ensembleplots.core.download_forecast import calc_latest_run_time
from w2w_e... | [
"w2w_ensembleplots.core.read_data.read_forecast_data",
"w2w_ensembleplots.core.download_forecast.calc_latest_run_time",
"w2w_ensembleplots.core.meteogram_boxplot.get_meta_data",
"os.system",
"time.time"
] | [((494, 521), 'w2w_ensembleplots.core.download_forecast.calc_latest_run_time', 'calc_latest_run_time', (['model'], {}), '(model)\n', (514, 521), False, 'from w2w_ensembleplots.core.download_forecast import calc_latest_run_time\n'), ((1881, 1924), 'os.system', 'os.system', (["('git ' + git_paths + 'add --all')"], {}), "... |
from logging.config import fileConfig
from sqlalchemy import engine_from_config
from sqlalchemy import pool
from alembic import context
# To set register primary key operation:
from alembic.operations import Operations, MigrateOperation
import sqlalchemy as sa
# Custom database types to support UUID:
from sqlalche... | [
"alembic.operations.Operations.implementation_for",
"sqlalchemy.func.now",
"alembic.context.run_migrations",
"alembic.context.configure",
"alembic.context.is_offline_mode",
"logging.config.fileConfig",
"alembic.context.begin_transaction",
"sqlalchemy.dialects.oracle.RAW",
"alembic.operations.Operati... | [((615, 650), 'logging.config.fileConfig', 'fileConfig', (['config.config_file_name'], {}), '(config.config_file_name)\n', (625, 650), False, 'from logging.config import fileConfig\n'), ((1729, 1778), 'alembic.operations.Operations.register_operation', 'Operations.register_operation', (['"""set_identifiable"""'], {}), ... |
# Copyright 2018-2021
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
# 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/LICE... | [
"nilearn.plotting.view_img"
] | [((2090, 2138), 'nilearn.plotting.view_img', 'plotting.view_img', (['img'], {'bg_img': 'None', 'cmap': '"""gray"""'}), "(img, bg_img=None, cmap='gray')\n", (2107, 2138), False, 'from nilearn import plotting\n')] |