code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# pylint: disable-msg=W0401,W0511,W0611,W0612,W0614,R0201,E1102
"""Tests suite for MaskedArray & subclassing.
:author: <NAME>
:contact: pierregm_at_uga_dot_edu
"""
from __future__ import division, absolute_import, print_function
__author__ = "<NAME>"
import warnings
import pickle
import operator
import itertools
fro... | [
"numpy.ma.core.make_mask",
"numpy.ma.core.fix_invalid",
"numpy.arctan2",
"numpy.sum",
"numpy.ravel",
"numpy.ma.core.make_mask_descr",
"numpy.ma.core.empty_like",
"numpy.ma.core.greater_equal",
"numpy.ma.testutils.assert_equal_records",
"numpy.ones",
"numpy.argsort",
"numpy.arange",
"numpy.ex... | [((166569, 166613), 'numpy.ma.array', 'np.ma.array', (['[0, 1, 2, 3]'], {'mask': '[0, 0, 1, 0]'}), '([0, 1, 2, 3], mask=[0, 0, 1, 0])\n', (166580, 166613), True, 'import numpy as np\n'), ((166700, 166738), 'numpy.ma.masked_equal', 'np.ma.masked_equal', (['[1, 2, 3]'], {'value': '(2)'}), '([1, 2, 3], value=2)\n', (16671... |
import os
from unittest import TestCase, skipIf
from app.main import ALLOWED_TASKS
from app.validation import ffmpeg_read
from starlette.testclient import TestClient
from tests.test_api import TESTABLE_MODELS
@skipIf(
"text-to-speech" not in ALLOWED_TASKS,
"text-to-speech not implemented",
)
class AudioSourc... | [
"starlette.testclient.TestClient",
"unittest.skipIf",
"os.getenv",
"app.validation.ffmpeg_read"
] | [((213, 292), 'unittest.skipIf', 'skipIf', (["('text-to-speech' not in ALLOWED_TASKS)", '"""text-to-speech not implemented"""'], {}), "('text-to-speech' not in ALLOWED_TASKS, 'text-to-speech not implemented')\n", (219, 292), False, 'from unittest import TestCase, skipIf\n'), ((453, 474), 'os.getenv', 'os.getenv', (['""... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
# -----------------------------------------------------------------------------
try:
basestri... | [
"ccxt.base.errors.ExchangeError",
"ccxt.base.errors.ExchangeNotAvailable",
"json.loads",
"math.pow"
] | [((3970, 4004), 'math.pow', 'math.pow', (['(10)', "(-precision['amount'])"], {}), "(10, -precision['amount'])\n", (3978, 4004), False, 'import math\n'), ((12813, 12829), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (12823, 12829), False, 'import json\n'), ((13363, 13386), 'ccxt.base.errors.ExchangeError', 'E... |
from timeit import timeit
from planar import Vec2
from planar.c import Polygon
from random import random
import itertools
def rand_pt(span=10):
return Vec2(random() * span - 0.5, random() * span - 0.5)
tris = [Polygon([rand_pt(), rand_pt(), rand_pt()]) for i in range(100)]
pts = [rand_pt(20) for i in range(1000)]
in... | [
"random.random",
"timeit.timeit"
] | [((788, 819), 'timeit.timeit', 'timeit', (['test_null'], {'number': 'times'}), '(test_null, number=times)\n', (794, 819), False, 'from timeit import timeit\n'), ((951, 985), 'timeit.timeit', 'timeit', (['test_winding'], {'number': 'times'}), '(test_winding, number=times)\n', (957, 985), False, 'from timeit import timei... |
from aiocqhttp import CQHttp, ApiError, jsonify, request
import os
import random
from Repeater import Repeater
import logging
import asyncio
import time
from util import load_json, purgeMsg
from datetime import datetime, timezone, timedelta
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from apscheduler.tr... | [
"Repeater.Repeater",
"logging.exception",
"os.path.dirname",
"util.load_json",
"random.choice",
"aiocqhttp.CQHttp",
"random.random",
"datetime.timedelta",
"apscheduler.schedulers.asyncio.AsyncIOScheduler",
"datetime.datetime.now",
"queue.Queue"
] | [((677, 718), 'aiocqhttp.CQHttp', 'CQHttp', ([], {'api_root': '"""http://127.0.0.1:5700/"""'}), "(api_root='http://127.0.0.1:5700/')\n", (683, 718), False, 'from aiocqhttp import CQHttp, ApiError, jsonify, request\n'), ((750, 776), 'util.load_json', 'load_json', (['"""settings.json"""'], {}), "('settings.json')\n", (75... |
"""Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from collections import OrderedDict
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from ... | [
"textwrap.dedent",
"os.mkdir",
"pip._internal.utils.misc.call_subprocess",
"pip._vendor.pkg_resources.Requirement.parse",
"os.pathsep.join",
"pip._vendor.pkg_resources.WorkingSet",
"distutils.sysconfig.get_python_lib",
"os.path.dirname",
"os.path.exists",
"pip._internal.utils.ui.open_spinner",
"... | [((742, 769), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (759, 769), False, 'import logging\n'), ((1191, 1239), 'distutils.sysconfig.get_python_lib', 'get_python_lib', ([], {'plat_specific': '(False)', 'prefix': 'path'}), '(plat_specific=False, prefix=path)\n', (1205, 1239), False, 'f... |
#!/usr/bin/env python
# add-issue-id-hook version 1.1.0
#
# Created by <NAME>
# https://github.com/pbetkier/add-issue-id-hook
# customize the final commit message using placeholders:
# - {issue_id} replaced with discovered issue id
# - {user_message} replaced with message provided by the user
commit_message_format ... | [
"subprocess.check_output",
"sys.exit"
] | [((1383, 1393), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1391, 1393), False, 'import sys\n'), ((1123, 1183), 'subprocess.check_output', 'subprocess.check_output', (['"""git symbolic-ref HEAD"""'], {'shell': '(True)'}), "('git symbolic-ref HEAD', shell=True)\n", (1146, 1183), False, 'import subprocess\n')] |
import jieba.analyse as jba
import re
class Text(object):
'''
## 初始化
- text_data: 文本
- words_libs: 词库文件路径列表
## 方法
- getText() 获取文本
- getWordsLibs() 获取词库文件路径列表
- getKeywords() 提取文本关键词
- getCategories() 提取文本分类
'''
def __init__(self, text_data, words_libs):
self.da... | [
"re.findall"
] | [((1632, 1658), 're.findall', 're.findall', (['"""【(.*?)】"""', 'lib'], {}), "('【(.*?)】', lib)\n", (1642, 1658), False, 'import re\n')] |
#!/usr/bin/python -tt
# Copyright 2010 Google Inc.
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
# Google's Python Class
# http://code.google.com/edu/languages/google-python-class/
"""Mimic pyquick exercise -- optional extra exercise.
Google's Python Class
Read in the ... | [
"random.choice",
"sys.exit"
] | [((3720, 3731), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3728, 3731), False, 'import sys\n'), ((3360, 3391), 'random.choice', 'random.choice', (['mimic_dict[word]'], {}), '(mimic_dict[word])\n', (3373, 3391), False, 'import random\n'), ((3425, 3454), 'random.choice', 'random.choice', (["mimic_dict['']"], {}), "... |
r"""
Finite dimensional graded commutative algebras
AUTHORS:
- <NAME> (2021): initial version
"""
#*****************************************************************************
# Copyright (C) 2021 <NAME> <m.jung at vu.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the... | [
"sage.misc.functional.is_even",
"sage.arith.misc.gcd",
"sage.misc.functional.is_odd",
"sage.categories.algebras.Algebras",
"sage.sets.condition_set.ConditionSet",
"sage.combinat.integer_vector_weighted.WeightedIntegerVectors",
"sage.combinat.free_module.CombinatorialFreeModule.__init__"
] | [((7473, 7504), 'sage.combinat.integer_vector_weighted.WeightedIntegerVectors', 'WeightedIntegerVectors', (['degrees'], {}), '(degrees)\n', (7495, 7504), False, 'from sage.combinat.integer_vector_weighted import WeightedIntegerVectors\n'), ((7645, 7657), 'sage.arith.misc.gcd', 'gcd', (['degrees'], {}), '(degrees)\n', (... |
from django.conf.urls.defaults import *
from livesettings import config_value, config_get_group
config = config_get_group('PAYMENT_CYBERSOURCE')
urlpatterns = patterns('',
(r'^$', 'payment.modules.cybersource.views.pay_ship_info', {'SSL':config.SSL.value}, 'CYBERSOURCE_satchmo_checkout-step2'),
(r'^confirm/... | [
"livesettings.config_get_group"
] | [((106, 145), 'livesettings.config_get_group', 'config_get_group', (['"""PAYMENT_CYBERSOURCE"""'], {}), "('PAYMENT_CYBERSOURCE')\n", (122, 145), False, 'from livesettings import config_value, config_get_group\n')] |
"""COMMAND : .balaji"""
from telethon import events
import asyncio
@borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True))
async def _(event):
if event.fwd_from:
return
animation_interval = 5
animation_ttl = range(0, 15)
input_str = event.pattern_match.group(1)
if input_s... | [
"telethon.events.NewMessage",
"asyncio.sleep"
] | [((83, 134), 'telethon.events.NewMessage', 'events.NewMessage', ([], {'pattern': '"""\\\\.(.*)"""', 'outgoing': '(True)'}), "(pattern='\\\\.(.*)', outgoing=True)\n", (100, 134), False, 'from telethon import events\n'), ((2062, 2095), 'asyncio.sleep', 'asyncio.sleep', (['animation_interval'], {}), '(animation_interval)\... |
# 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
# distributed under t... | [
"ironic.common.exception.Invalid",
"oslo_log.log.getLogger",
"ironic.conf.CONF.set_override",
"ironic.common.exception.FailedToUpdateMacOnPort",
"ironic.common.i18n._",
"neutronclient.v2_0.client.Client",
"ironic.common.context.RequestContext",
"oslo_utils.uuidutils.is_uuid_like",
"ironic.common.key... | [((1052, 1075), 'oslo_log.log.getLogger', 'log.getLogger', (['__name__'], {}), '(__name__)\n', (1065, 1075), False, 'from oslo_log import log\n'), ((2269, 2297), 'ironic.common.keystone.get_auth', 'keystone.get_auth', (['"""neutron"""'], {}), "('neutron')\n", (2286, 2297), False, 'from ironic.common import keystone\n')... |
import nltk
nltk.download('punkt')
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')
def get_sentence_list_from_corpus(text_path):
output_list = []
with open(text_path, 'r') as f:
f_as_string = f.read().replace("\n", " ")
output_list = tokenizer.tokenize(f_as_string)
return ou... | [
"nltk.download",
"nltk.data.load"
] | [((12, 34), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (25, 34), False, 'import nltk\n'), ((47, 96), 'nltk.data.load', 'nltk.data.load', (['"""tokenizers/punkt/english.pickle"""'], {}), "('tokenizers/punkt/english.pickle')\n", (61, 96), False, 'import nltk\n')] |
"""
Support to trigger Maker IFTTT recipes.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/ifttt/
"""
import logging
import requests
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
REQUIREMENTS = ['pyfttt==0.3']
_LOGGER... | [
"pyfttt.send_event",
"voluptuous.Required",
"voluptuous.Optional",
"logging.getLogger"
] | [((323, 350), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'import logging\n'), ((550, 574), 'voluptuous.Required', 'vol.Required', (['ATTR_EVENT'], {}), '(ATTR_EVENT)\n', (562, 574), True, 'import voluptuous as vol\n'), ((591, 616), 'voluptuous.Optional', 'vol.Option... |
import unittest
from align.jaccard import *
from align.roc import *
import numpy as np
from PIL import Image
class JaccardIndexTest(unittest.TestCase):
def setUp(self):
self.y_true = np.ones((10, 3, 100, 100))
self.y_pred = np.zeros((10, 3, 100, 100))
self.y_pred[1] = np.ones((3,100,100))
... | [
"unittest.main",
"numpy.zeros",
"numpy.ones",
"PIL.Image.open"
] | [((1114, 1129), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1127, 1129), False, 'import unittest\n'), ((197, 223), 'numpy.ones', 'np.ones', (['(10, 3, 100, 100)'], {}), '((10, 3, 100, 100))\n', (204, 223), True, 'import numpy as np\n'), ((246, 273), 'numpy.zeros', 'np.zeros', (['(10, 3, 100, 100)'], {}), '((10... |
#!/usr/bin/env python
#
import sys
from cbapi.response.models import Sensor
from cbapi.example_helpers import build_cli_parser, get_cb_response_object
import logging
import csv
import traceback
log = logging.getLogger(__name__)
def export_sensors(cb, export_file_name, export_fields, query):
print("Starting CbR ... | [
"csv.writer",
"cbapi.example_helpers.build_cli_parser",
"traceback.format_exc",
"cbapi.example_helpers.get_cb_response_object",
"logging.getLogger"
] | [((202, 229), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (219, 229), False, 'import logging\n'), ((1121, 1200), 'cbapi.example_helpers.build_cli_parser', 'build_cli_parser', ([], {'description': '"""Export CbR Sensors from your environment as CSV"""'}), "(description='Export CbR Senso... |
"""
This module contains functions to retrieve platform dependent locations to store app
data. It supports macOS and Linux.
"""
# system imports
import os
import platform
from os import path as osp
from typing import Optional
__all__ = [
"get_log_path",
"get_cache_path",
"get_autostart_path",
"get_ru... | [
"os.path.expanduser",
"os.makedirs",
"os.path.isdir",
"os.environ.get",
"platform.system",
"os.path.join"
] | [((1137, 1152), 'os.path.isdir', 'osp.isdir', (['path'], {}), '(path)\n', (1146, 1152), True, 'from os import path as osp\n'), ((540, 565), 'os.path.join', 'osp.join', (['path', 'subfolder'], {}), '(path, subfolder)\n', (548, 565), True, 'from os import path as osp\n'), ((590, 622), 'os.makedirs', 'os.makedirs', (['pat... |
# Generated by Django 3.0.4 on 2020-03-26 22:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("budget", "0001_initial"),
]
operations = [
migrations.RenameField(
model_name="budget", old_name="budget", new_name="balance",
)... | [
"django.db.migrations.RenameField"
] | [((215, 302), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""budget"""', 'old_name': '"""budget"""', 'new_name': '"""balance"""'}), "(model_name='budget', old_name='budget', new_name=\n 'balance')\n", (237, 302), False, 'from django.db import migrations\n')] |
import re
from collections import namedtuple
from .exceptions import ParseError, ExpressionNotClosed
from .exceptions import NotClosedError, StatementNotFound
from .exceptions import StatementNotAllowed, UnexpectedClosingFound
from .registry import Registry
class Node:
def __init__(self, parent=None):
s... | [
"collections.namedtuple"
] | [((4002, 4058), 'collections.namedtuple', 'namedtuple', (['"""Loop"""', "['index', 'index0', 'first', 'last']"], {}), "('Loop', ['index', 'index0', 'first', 'last'])\n", (4012, 4058), False, 'from collections import namedtuple\n')] |
import theano
import theano.tensor as T
import numpy as np
from itertools import chain, izip
from learntools.libs.logger import log_me
from learntools.libs.auc import auc
from learntools.model.mlp import ConvolutionalMLP
from learntools.model.theano_utils import make_shared
from learntools.model import Model, gen_bat... | [
"itertools.chain.from_iterable",
"theano.tensor.log",
"learntools.model.mlp.ConvolutionalMLP",
"learntools.libs.logger.log_me",
"theano.function",
"learntools.model.gen_batches_by_size",
"theano.tensor.ivector",
"numpy.random.RandomState",
"theano.tensor.grad",
"itertools.izip",
"theano.tensor.a... | [((407, 439), 'learntools.libs.logger.log_me', 'log_me', (['"""...building ConvEmotiv"""'], {}), "('...building ConvEmotiv')\n", (413, 439), False, 'from learntools.libs.logger import log_me\n'), ((1281, 1323), 'learntools.model.gen_batches_by_size', 'gen_batches_by_size', (['train_idx', 'batch_size'], {}), '(train_idx... |
import random
from abc import ABCMeta, abstractmethod
from enum import Enum
from mockquitto.client.exceptions import GeneratorCreationError
from mockquitto.client.generator.laws import LawGeneration
class FrequencyType(Enum):
CONSTANT = 0
RANDOM = 1
class GenerationType(Enum):
FINITE = 0
INFINITE =... | [
"mockquitto.client.exceptions.GeneratorCreationError",
"random.uniform"
] | [((2858, 2882), 'mockquitto.client.exceptions.GeneratorCreationError', 'GeneratorCreationError', ([], {}), '()\n', (2880, 2882), False, 'from mockquitto.client.exceptions import GeneratorCreationError\n'), ((3812, 3844), 'random.uniform', 'random.uniform', (['*self.freq_range'], {}), '(*self.freq_range)\n', (3826, 3844... |
# -*- coding: utf-8 -*-
# Copyright CERN since 2014
#
# 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 ... | [
"rucio.web.rest.flaskapi.v1.common.check_accept_header_wrapper_flask",
"rucio.core.replica_sorter.sort_replicas",
"flask.Blueprint",
"flask.request.args.get",
"flask.request.headers.get",
"flask.redirect",
"flask.Flask",
"werkzeug.datastructures.Headers",
"rucio.core.replica_sorter.site_selector",
... | [((1712, 1776), 'rucio.web.rest.flaskapi.v1.common.check_accept_header_wrapper_flask', 'check_accept_header_wrapper_flask', (["['application/metalink4+xml']"], {}), "(['application/metalink4+xml'])\n", (1745, 1776), False, 'from rucio.web.rest.flaskapi.v1.common import check_accept_header_wrapper_flask, parse_scope_nam... |
"""
Celery base task aimed at longish-running jobs that return a result.
``AwesomeResultTask`` adds thundering herd avoidance, result caching, progress
reporting, error fallback and JSON encoding of results.
"""
from __future__ import division
import logging
import simplejson
import time
from contextlib import contex... | [
"djcelery.models.TaskMeta",
"uuid.uuid4",
"hashlib.md5",
"johnny.middleware.LocalStoreClearMiddleware",
"django.core.cache.cache.set",
"celery.signals.task_prerun.connect",
"simplejson.dumps",
"django.core.cache.cache.incr",
"django.core.cache.cache.get",
"time.time",
"logging.info",
"celery.r... | [((1046, 1086), 'celery.signals.task_prerun.connect', 'task_prerun.connect', (['task_prerun_handler'], {}), '(task_prerun_handler)\n', (1065, 1086), False, 'from celery.signals import task_prerun, task_postrun\n'), ((1393, 1435), 'celery.signals.task_postrun.connect', 'task_postrun.connect', (['task_postrun_handler'], ... |
from __future__ import print_function, division
"""
@ About :
@ Author : <NAME>
@ ref. : https://labrosa.ee.columbia.edu/matlab/rastamat/
"""
import warnings
import librosa
import scipy.fftpack as fft
import numpy as np
import spectrum
from scipy import signal
def specgram(x, nfft=256, fs=8000, window=np.array([]), o... | [
"numpy.roots",
"numpy.abs",
"numpy.sum",
"numpy.angle",
"numpy.floor",
"numpy.ones",
"numpy.argsort",
"librosa.istft",
"numpy.arange",
"numpy.tile",
"numpy.diag",
"numpy.round",
"spectrum.LEVINSON",
"numpy.multiply",
"numpy.random.randn",
"scipy.signal.lfilter",
"numpy.fft.fft",
"n... | [((305, 317), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (313, 317), True, 'import numpy as np\n'), ((1490, 1507), 'numpy.concatenate', 'np.concatenate', (['S'], {}), '(S)\n', (1504, 1507), True, 'import numpy as np\n'), ((1516, 1535), 'numpy.fft.fft', 'np.fft.fft', (['S', 'nfft'], {}), '(S, nfft)\n', (1526, 15... |
from flask import Flask
import calculate
app = Flask(__name__)
@app.route("/")
def index():
important_facility_data = [["site office", 10, 0, 500, 500, 0, 0], ["labour shed", 5, 0, 10000, 500, 0, 0],
["security shed", 5, 0, 200, 0, 0, 0], ["Batching plant", 10, 100, 20000, 1000, 2,... | [
"flask.Flask",
"calculate.main"
] | [((49, 64), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'from flask import Flask\n'), ((745, 814), 'calculate.main', 'calculate.main', (['important_facility_data', 'less_important_facility_data'], {}), '(important_facility_data, less_important_facility_data)\n', (759, 814), False, 'impo... |
import numpy as np
initial_state = globals().copy()
non_element_functions = ['element_metadata',
'initial_state',
'non_element_functions',
'typeChecker',
'circuit_elements']
# populated at the end of the file -
# this m... | [
"numpy.sinh",
"numpy.array",
"numpy.tanh",
"numpy.sqrt"
] | [((1933, 1944), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (1941, 1944), True, 'import numpy as np\n'), ((2143, 2154), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2151, 2154), True, 'import numpy as np\n'), ((2412, 2423), 'numpy.array', 'np.array', (['f'], {}), '(f)\n', (2420, 2423), True, 'import numpy as ... |
#!/usr/bin/env python
#
# Copyright 2012-2015 clowwindy
#
# 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 la... | [
"logging.error",
"hashlib.md5",
"logging.warn",
"shadowsocks.crypto.openssl.rand_bytes",
"shadowsocks.common.to_bytes",
"shadowsocks.lru_cache.LRUCache",
"os.urandom",
"sys.exit"
] | [((1256, 1287), 'shadowsocks.lru_cache.LRUCache', 'lru_cache.LRUCache', ([], {'timeout': '(180)'}), '(timeout=180)\n', (1274, 1287), False, 'from shadowsocks import common, lru_cache\n'), ((6445, 6459), 'os.urandom', 'urandom', (['(10240)'], {}), '(10240)\n', (6452, 6459), False, 'from os import urandom\n'), ((6797, 68... |
import builtins
import copyreg
import gc
import itertools
import math
import pickle
import sys
import types
import unittest
import weakref
from copy import deepcopy
from test import support
class OperatorsTest(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *arg... | [
"gc.collect",
"sys.getsizeof",
"weakref.ref",
"sys.gettrace",
"unittest.skipIf",
"xxsubtype.spamdict",
"types.MethodType",
"test.support.gc_collect",
"test.support.check_impl_detail",
"itertools.product",
"test.support.run_unittest",
"builtins.__dict__.values",
"unittest.TestCase.__init__",
... | [((10263, 10320), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\' is internal"""'], {}), '("the module \'xxsubtype\' is internal")\n', (10282, 10320), False, 'from test import support\n'), ((12220, 12277), 'test.support.impl_detail', 'support.impl_detail', (['"""the module \'xxsubtype\... |
#!/usr/bin/env python
import os
import requests
import time
import sys
from . import github
from .utils import update_conda_forge_config
# https://circleci.com/docs/api#add-environment-variable
# curl -X POST --header "Content-Type: application/json" -d '{"name":"foo", "value":"bar"}'
# https://circleci.com/api/v1/... | [
"Crypto.Cipher.PKCS1_v1_5.new",
"requests.patch",
"argparse.ArgumentParser",
"time.sleep",
"Crypto.PublicKey.RSA.importKey",
"sys.stdout.flush",
"requests.get",
"requests.put",
"requests.post",
"os.path.expanduser",
"os.getenv"
] | [((1998, 2048), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.conda-smithy/travis.token"""'], {}), "('~/.conda-smithy/travis.token')\n", (2016, 2048), False, 'import os\n'), ((3369, 3393), 'requests.post', 'requests.post', (['url', 'data'], {}), '(url, data)\n', (3382, 3393), False, 'import requests\n'), ((4072,... |
from urlparse import urlparse
import os
from flask import Blueprint, request, redirect, session
from flask_login import logout_user
from onelogin.saml2.auth import OneLogin_Saml2_Auth
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from web.views.helpers import prevent_csrf
from web.auth.saml.user_management im... | [
"flask.Blueprint",
"flask.request.args.get",
"os.path.dirname",
"web.auth.saml.user_management.authenticate",
"flask_login.logout_user",
"flask.request.form.copy",
"urlparse.urlparse",
"onelogin.saml2.utils.OneLogin_Saml2_Utils.get_self_url",
"flask.request.args.copy"
] | [((347, 403), 'flask.Blueprint', 'Blueprint', (['"""auth"""', '__name__'], {'template_folder': '"""templates"""'}), "('auth', __name__, template_folder='templates')\n", (356, 403), False, 'from flask import Blueprint, request, redirect, session\n'), ((635, 656), 'urlparse.urlparse', 'urlparse', (['request.url'], {}), '... |
import random
import time
from copy import deepcopy
import gym
import networkx as nx
import numpy as np
from gym.spaces import Box, Dict, Discrete, MultiDiscrete, Tuple
class MyTestEnv(gym.Env):
"""This is a "going right" task. The task is to go right ``size`` steps.
"""
def __init__(
self,
... | [
"copy.deepcopy",
"gym.spaces.Discrete",
"numpy.zeros",
"numpy.random.RandomState",
"gym.spaces.MultiDiscrete",
"time.sleep",
"random.random",
"networkx.Graph",
"numpy.array",
"gym.spaces.Box",
"numpy.arange",
"numpy.random.rand"
] | [((2491, 2518), 'numpy.random.RandomState', 'np.random.RandomState', (['seed'], {}), '(seed)\n', (2512, 2518), True, 'import numpy as np\n'), ((4941, 4951), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (4949, 4951), True, 'import networkx as nx\n'), ((5241, 5261), 'copy.deepcopy', 'deepcopy', (['self.graph'], {}), '... |
#! /usr/bin/env python3
#
# 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
# "... | [
"itertools.chain"
] | [((2834, 2907), 'itertools.chain', 'chain', (['program.enums', 'program.typedefs', 'program.objects', 'program.services'], {}), '(program.enums, program.typedefs, program.objects, program.services)\n', (2839, 2907), False, 'from itertools import chain\n')] |
from django.contrib import admin
from .models import Task
@admin.register(Task)
class TaskAdmin(admin.ModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((62, 82), 'django.contrib.admin.register', 'admin.register', (['Task'], {}), '(Task)\n', (76, 82), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# "Fuzzing with Generators" - a chapter of "The Fuzzing Book"
# Web site: https://www.fuzzingbook.org/html/GeneratorGrammarFuzzer.html
# Last change: 2022-02-09 08:27:19+01:00
#
# Copyright (c) 2021 CISPA Helmholtz Center for Information Security
# Copyright (c) 2018-2020... | [
"copy.deepcopy",
"random.randint",
"typing.cast",
"random.choice",
"inspect.isgeneratorfunction",
"random.seed"
] | [((4615, 4632), 'random.seed', 'random.seed', (['(2001)'], {}), '(2001)\n', (4626, 4632), False, 'import random\n'), ((34447, 34483), 'random.choice', 'random.choice', (["['555', '554', '553']"], {}), "(['555', '554', '553'])\n", (34460, 34483), False, 'import random\n'), ((5955, 5989), 'random.randint', 'random.randin... |
# -*- coding: iso-8859-1 -*-
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the usef... | [
"string.lower",
"imp.get_suffixes",
"sys.getdefaultencoding",
"string.expandtabs",
"sys.exc_info",
"sys.modules.get",
"string.join",
"os.path.abspath",
"os.path.exists",
"string.lstrip",
"linecache.getlines",
"string.strip",
"os.path.basename",
"os.path.realpath",
"sys._getframe",
"ope... | [((11019, 11077), 'collections.namedtuple', 'namedtuple', (['"""Attribute"""', '"""name kind defining_class object"""'], {}), "('Attribute', 'name kind defining_class object')\n", (11029, 11077), False, 'from collections import namedtuple\n'), ((16747, 16803), 'collections.namedtuple', 'namedtuple', (['"""ModuleInfo"""... |
# Based on https://colab.research.google.com/github/reiinakano/neural-painters/blob/master/notebooks/generate_stroke_examples.ipynb
from lib import surface, tiledsurface, brush
import torch
import numpy as np
from PIL import Image
def point_on_curve_1(t, cx, cy, sx, sy, x1, y1, x2, y2):
ratio = t / 100.0
x3... | [
"torch.from_numpy",
"lib.tiledsurface.Surface",
"lib.brush.Brush",
"lib.surface.scanline_strips_iter",
"numpy.expand_dims",
"numpy.random.default_rng",
"PIL.Image.fromarray",
"numpy.sqrt"
] | [((607, 629), 'numpy.sqrt', 'np.sqrt', (['(x * x + y * y)'], {}), '(x * x + y * y)\n', (614, 629), True, 'import numpy as np\n'), ((1396, 1421), 'numpy.random.default_rng', 'np.random.default_rng', (['(42)'], {}), '(42)\n', (1417, 1421), True, 'import numpy as np\n'), ((1495, 1517), 'lib.tiledsurface.Surface', 'tiledsu... |
#!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceresolution.py,v $
## Language: Python
## Date: $$
## Version: $$
## Copyright (c) <NAME>, <NAME>. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## ... | [
"vtk.vtkPolyDataMapper",
"vmtk.vtkvmtk.vtkvmtkPolyDataSampleFunction",
"vtk.vtkPoints",
"vtk.vtkCellPicker",
"vtk.vtkDoubleArray",
"vtk.vtkGlyph3D",
"vtk.vtkScalarBarActor",
"vtk.vtkActor",
"vmtk.vtkvmtk.vtkvmtkRBFInterpolation2",
"vmtk.pypes.pypeScript.__init__",
"vtk.vtkTextActor",
"vtk.vtkP... | [((14858, 14874), 'vmtk.pypes.pypeMain', 'pypes.pypeMain', ([], {}), '()\n', (14872, 14874), False, 'from vmtk import pypes\n'), ((1069, 1100), 'vmtk.pypes.pypeScript.__init__', 'pypes.pypeScript.__init__', (['self'], {}), '(self)\n', (1094, 1100), False, 'from vmtk import pypes\n'), ((1242, 1259), 'vtk.vtkPolyData', '... |
from __future__ import division, print_function, unicode_literals
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
#
testinfo = "dt 0.1, q"
tags = "actions"
import cocos
from cocos.director import director
... | [
"cocos.scene.Scene",
"os.path.dirname",
"cocos.director.director.init",
"cocos.director.director.run"
] | [((729, 744), 'cocos.director.director.init', 'director.init', ([], {}), '()\n', (742, 744), False, 'from cocos.director import director\n'), ((834, 853), 'cocos.scene.Scene', 'cocos.scene.Scene', ([], {}), '()\n', (851, 853), False, 'import cocos\n'), ((905, 929), 'cocos.director.director.run', 'director.run', (['main... |
# Main
import argparse
from img_crop import crop_to_size, crop_to_percentage
# from img_resize import *
from img_resize import resize_by_percentage, resize_by_width, resize_by_height
from j2p import j2p
from p2j import p2j
print(f'Main running __name__ = {__name__}')
if __name__ == '__main__':
... | [
"img_crop.crop_to_size",
"argparse.ArgumentParser",
"img_crop.crop_to_percentage",
"p2j.p2j",
"img_resize.resize_by_percentage",
"img_resize.resize_by_height",
"j2p.j2p",
"img_resize.resize_by_width"
] | [((329, 354), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (352, 354), False, 'import argparse\n'), ((4184, 4253), 'img_crop.crop_to_size', 'crop_to_size', (['args.new_path', 'args.image_path', 'args.width', 'args.height'], {}), '(args.new_path, args.image_path, args.width, args.height)\n', (... |
import severus
import json
def respond(obj, data):
obj.send(json.dumps(data).encode())
def greet(obj, ip, data):
"""
Allows two peers to exchange information.
Receives host and port of peer and responds with own host and port
"""
host = ip[0]
port = data.get("port")
is_relay = data.get... | [
"severus.db.get_block",
"severus.Peer",
"json.dumps",
"severus.db.peers.all"
] | [((745, 767), 'severus.db.peers.all', 'severus.db.peers.all', ([], {}), '()\n', (765, 767), False, 'import severus\n'), ((934, 961), 'severus.db.get_block', 'severus.db.get_block', (['index'], {}), '(index)\n', (954, 961), False, 'import severus\n'), ((365, 389), 'severus.Peer', 'severus.Peer', (['host', 'port'], {}), ... |
import base64
import json
import os
import requests
def load_manifest(path):
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, "manifests", path), "rb") as fp:
return base64.b64encode(fp.read()).decode("utf-8")
def get_release():
return {
"os": {
... | [
"os.path.dirname",
"json.dumps",
"os.environ.get",
"requests.get",
"os.path.join"
] | [((107, 132), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (122, 132), False, 'import os\n'), ((2182, 2282), 'requests.get', 'requests.get', (['"""https://storage.googleapis.com/release.kelproject.com/distro/channels.json"""'], {}), "(\n 'https://storage.googleapis.com/release.kelproject... |
import warnings
from . import NetworkTable # noqa
warnings.warn(
"networktables.networktable is deprecated, import networktables.NetworkTable directly",
DeprecationWarning,
stacklevel=2,
)
| [
"warnings.warn"
] | [((53, 198), 'warnings.warn', 'warnings.warn', (['"""networktables.networktable is deprecated, import networktables.NetworkTable directly"""', 'DeprecationWarning'], {'stacklevel': '(2)'}), "(\n 'networktables.networktable is deprecated, import networktables.NetworkTable directly'\n , DeprecationWarning, stacklev... |
# Copyright 2021 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"syne_tune.config_space.uniform",
"syne_tune.StoppingCriterion",
"syne_tune.config_space.randint",
"syne_tune.config_space.loguniform",
"pathlib.Path",
"syne_tune.backend.LocalBackend",
"syne_tune.optimizer.schedulers.FIFOScheduler",
"syne_tune.Tuner",
"logging.getLogger"
] | [((2470, 2507), 'syne_tune.backend.LocalBackend', 'LocalBackend', ([], {'entry_point': 'entry_point'}), '(entry_point=entry_point)\n', (2482, 2507), False, 'from syne_tune.backend import LocalBackend\n'), ((2969, 3102), 'syne_tune.optimizer.schedulers.FIFOScheduler', 'FIFOScheduler', (['config_space'], {'searcher': 'se... |
'''
Created on Jun 24, 2020
@author: ballance
'''
from enum import Enum, auto, IntEnum
import vsc
from vsc_test_case import VscTestCase
class TestAttrEnum(VscTestCase):
def test_rand_plain_enum(self):
class my_e(Enum):
A = auto()
B = auto()
@vsc.randobj
... | [
"enum.auto",
"vsc.enum_t",
"vsc.rand_enum_t",
"vsc.rand_uint8_t"
] | [((265, 271), 'enum.auto', 'auto', ([], {}), '()\n', (269, 271), False, 'from enum import Enum, auto, IntEnum\n'), ((288, 294), 'enum.auto', 'auto', ([], {}), '()\n', (292, 294), False, 'from enum import Enum, auto, IntEnum\n'), ((666, 672), 'enum.auto', 'auto', ([], {}), '()\n', (670, 672), False, 'from enum import En... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Import unicode literals so that StringIO works on both Python 2 and 3
from __future__ import unicode_literals
from __future__ import print_function
import sys
import os
import re
from argparse import ArgumentParser
try:
# Python 3
from io import StringIO
except... | [
"argparse.ArgumentParser",
"pygccxml.parser.source_reader.source_reader_t",
"pygccxml.declarations.remove_reference",
"pygccxml.declarations.templates.name",
"os.path.join",
"pygccxml.declarations.templates.args",
"os.path.dirname",
"os.path.exists",
"pygccxml.declarations.is_reference",
"re.finda... | [((33037, 33053), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (33051, 33053), False, 'from argparse import ArgumentParser\n'), ((35686, 35727), 'sys.path.insert', 'sys.path.insert', (['(1)', 'options.pygccxml_path'], {}), '(1, options.pygccxml_path)\n', (35701, 35727), False, 'import sys\n'), ((35801... |
from pathlib import Path
file_names = dict(
train='train.csv',
test='test.csv',
submission='sample_submission.csv',
)
home_path = Path(__file__).parent.resolve()
file_paths = {
file_key: home_path / file_name
for file_key, file_name in file_names.items()
}
| [
"pathlib.Path"
] | [((144, 158), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (148, 158), False, 'from pathlib import Path\n')] |
# -*- coding: utf-8 -*-
############################################################################
#
# Copyright © 2015 OnlineGroups.net and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this dis... | [
"mock.MagicMock",
"mock.patch"
] | [((862, 923), 'mock.patch', 'patch', (['"""gs.profile.status.base.hook.SkipQuery"""'], {'autospec': '(True)'}), "('gs.profile.status.base.hook.SkipQuery', autospec=True)\n", (867, 923), False, 'from mock import patch, MagicMock\n'), ((1291, 1352), 'mock.patch', 'patch', (['"""gs.profile.status.base.hook.SkipQuery"""'],... |
import threading
from kervi.controllers import Controller
from kervi.values import NumberValue, StringValue
import kervi.hal as hal
class _InputThread(threading.Thread):
def __init__(self, controller, device):
super().__init__(Name="InputThread")
self._controller = controller
self.deamon =... | [
"kervi.hal.get_user_inputs",
"kervi.controllers.Controller.__init__"
] | [((1021, 1062), 'kervi.controllers.Controller.__init__', 'Controller.__init__', (['self', 'input_id', 'name'], {}), '(self, input_id, name)\n', (1040, 1062), False, 'from kervi.controllers import Controller\n'), ((1285, 1306), 'kervi.hal.get_user_inputs', 'hal.get_user_inputs', ([], {}), '()\n', (1304, 1306), True, 'im... |
import os
import smtplib
from .conf import settings
from .conf import inputConfiguration
from .logger import Logger
# Import the email modules we'll need
from email.mime.multipart import MIMEMultipart
#from email.MIMEBase import MIMEBase
from email.mime.text import MIMEText
from email.utils import formatdate
#from ema... | [
"os.path.join",
"smtplib.SMTP",
"os.path.basename",
"email.mime.text.MIMEText",
"email.mime.multipart.MIMEMultipart",
"email.utils.formatdate"
] | [((647, 705), 'os.path.join', 'os.path.join', (['smtp.settings.BASE_PATH', '"""emailprocessor.py"""'], {}), "(smtp.settings.BASE_PATH, 'emailprocessor.py')\n", (659, 705), False, 'import os\n'), ((2344, 2370), 'os.path.basename', 'os.path.basename', (['textfile'], {}), '(textfile)\n', (2360, 2370), False, 'import os\n'... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from numba import f8
from numba import i8
from numba import jit
from numba import prange
from numpy import argmin
from numpy import array
from numpy import empty
from numpy import min
from numpy.random import ... | [
"numpy.random.choice",
"numpy.empty",
"numpy.argmin",
"time.time",
"numpy.min",
"numba.jit",
"numpy.array",
"numba.prange",
"numpy.random.rand"
] | [((568, 613), 'numba.jit', 'jit', ([], {'nogil': '(True)', 'nopython': '(True)', 'parallel': '(True)'}), '(nogil=True, nopython=True, parallel=True)\n', (571, 613), False, 'from numba import jit\n'), ((766, 832), 'numba.jit', 'jit', (['(f8[:, :], i8, i8)'], {'nogil': '(True)', 'nopython': '(True)', 'parallel': '(False)... |
# -*- coding: utf-8 -*-
"""
smartcat.api
~~~~~~~~~~~~
This module contains classes that make http requests to SmartCAT
`API Documentation <https://smartcat.ai/api/methods/>`_
Original project at https://github.com/gilyaev/smartcat-python-sdk
Modified by <NAME> https://github.com/yakninja (added account part, some m... | [
"requests.Session",
"json.dumps"
] | [((3932, 3950), 'requests.Session', 'requests.Session', ([], {}), '()\n', (3948, 3950), False, 'import requests\n'), ((5973, 5989), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (5983, 5989), False, 'import json\n')] |
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import re
import spacy
import pickle
import time
from collections import defaultdict
import pmi_tfidf_classifier as ptic
path = "../data/"
np.random.seed(250)
#spacy.prefer_gpu()
#nlp = spacy.load("en_core_sci_sm", disable=['ner', 'parser'])
data_... | [
"pmi_tfidf_classifier.get_word_stat",
"numpy.random.seed",
"numpy.sum",
"numpy.logical_and",
"pandas.read_csv",
"pmi_tfidf_classifier.create_pmi_dict",
"pmi_tfidf_classifier.classify_pmi_based",
"numpy.random.permutation",
"pmi_tfidf_classifier.tokenization"
] | [((211, 230), 'numpy.random.seed', 'np.random.seed', (['(250)'], {}), '(250)\n', (225, 230), True, 'import numpy as np\n'), ((326, 361), 'pandas.read_csv', 'pd.read_csv', (["(path + 'DILI_data.csv')"], {}), "(path + 'DILI_data.csv')\n", (337, 361), True, 'import pandas as pd\n'), ((372, 409), 'numpy.random.permutation'... |
# -*- coding: utf-8 -*-
"""Heartbeat service.
This is the internal thread responsible for sending heartbeat events
at regular intervals (may not be an actual thread).
"""
from __future__ import absolute_import, unicode_literals
from celery.signals import heartbeat_sent
from celery.utils.sysinfo import load_average
f... | [
"celery.utils.sysinfo.load_average"
] | [((1646, 1660), 'celery.utils.sysinfo.load_average', 'load_average', ([], {}), '()\n', (1658, 1660), False, 'from celery.utils.sysinfo import load_average\n')] |
import cell
import line
def test_str():
_line = line.Line(cell.Cell(3, 3), cell.Cell(6, 3))
assert str(_line) == '((3, 3, 0), (6, 3, 0))'
def test_repr():
_line = line.Line(cell.Cell(3, 3), cell.Cell(6, 3))
assert repr(_line) == 'line.Line((3, 3, 0), (6, 3, 0))'
def test_length_distance_direct():
... | [
"line.Line",
"cell.Cell"
] | [((330, 345), 'cell.Cell', 'cell.Cell', (['(3)', '(3)'], {}), '(3, 3)\n', (339, 345), False, 'import cell\n'), ((356, 371), 'cell.Cell', 'cell.Cell', (['(6)', '(3)'], {}), '(6, 3)\n', (365, 371), False, 'import cell\n'), ((384, 405), 'line.Line', 'line.Line', (['start', 'end'], {}), '(start, end)\n', (393, 405), False,... |
import pandas as pd
import numpy as np
import re
import urllib.request
import pandas as pd
import glob
import zipfile
class inflecteur():
def __init__(self, filepath=None):
self.dico_transformer = None
self.nlp_token_class = None
self.blob_to_gram = {'NN': 'Nom', 'NNP': 'Nom', 'VB': 'Verbe'... | [
"pandas.DataFrame",
"transformers.AutoModelForTokenClassification.from_pretrained",
"zipfile.ZipFile",
"transformers.pipeline",
"transformers.AutoTokenizer.from_pretrained",
"glob.glob",
"re.sub"
] | [((5682, 5719), 'pandas.DataFrame', 'pd.DataFrame', (['data'], {'columns': "['forme']"}), "(data, columns=['forme'])\n", (5694, 5719), True, 'import pandas as pd\n'), ((8159, 8226), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""gilf/french-camembert-postag-model"""'], {}), "('gilf... |
from textwrap import dedent
from behave import then, when
import wrappers
@when('we run dbcli with {arg}')
def step_run_cli_with_arg(context, arg):
wrappers.run_cli(context, run_args=arg.split('='))
@when('we execute a small query')
def step_execute_small_query(context):
context.cli.sendline('select 1')
... | [
"textwrap.dedent",
"behave.when",
"behave.then",
"wrappers.expect_exact",
"wrappers.expect_pager"
] | [((79, 110), 'behave.when', 'when', (['"""we run dbcli with {arg}"""'], {}), "('we run dbcli with {arg}')\n", (83, 110), False, 'from behave import then, when\n'), ((210, 242), 'behave.when', 'when', (['"""we execute a small query"""'], {}), "('we execute a small query')\n", (214, 242), False, 'from behave import then,... |
import requests
api_url = 'https://anipython.com/crawler/8/api/'
response = requests.get(api_url)
data_dict = response.json()
print(data_dict)
"""
输出:
{
'data': [
{
'desc': '如果只选一门编程语言来学习, 就学 Python 吧',
'id': 1,
'title': 'Python入门视频',
'url': 'https://study.... | [
"requests.get"
] | [((78, 99), 'requests.get', 'requests.get', (['api_url'], {}), '(api_url)\n', (90, 99), False, 'import requests\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PacketStorm information
# Based on Vulners
#
# Software is free software released under the "Modified BSD license"
#
# Copyright (c) 2017 <NAME> - <EMAIL>
# Sources
SOURCE_NAME = 'packetstorm'
SOURCE_FILE = "https://vulners.com/api/v3/archive/collection/?type=packe... | [
"collections.defaultdict",
"lib.Config.Configuration.getFeedData",
"lib.Config.Configuration.readSetting"
] | [((770, 787), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (781, 787), False, 'from collections import defaultdict\n'), ((894, 936), 'lib.Config.Configuration.getFeedData', 'conf.getFeedData', (['SOURCE_NAME', 'source_file'], {}), '(SOURCE_NAME, source_file)\n', (910, 936), True, 'from lib.Conf... |
from dtest import Tester
from tools import putget
from ccmlib.cluster import Cluster
class TestMultiDCPutGet(Tester):
def putget_2dc_rf1_test(self):
""" Simple put-get test for 2 DC with one node each (RF=1) [catches #3539] """
cluster = self.cluster
cluster.populate([1, 1]).start()
... | [
"tools.putget"
] | [((500, 523), 'tools.putget', 'putget', (['cluster', 'cursor'], {}), '(cluster, cursor)\n', (506, 523), False, 'from tools import putget\n'), ((922, 945), 'tools.putget', 'putget', (['cluster', 'cursor'], {}), '(cluster, cursor)\n', (928, 945), False, 'from tools import putget\n')] |
from statzcw import zvariance
from statistics import variance
import unittest
class TestZVariance(unittest.TestCase):
def test_variance1(self):
test_data = [1, 2, 3, 4, 5]
self.assertEqual(round(variance(test_data), 5), zvariance.variance(test_data))
def test_stddev2(self):
test_data... | [
"unittest.main",
"statistics.variance",
"statzcw.zvariance.variance"
] | [((622, 637), 'unittest.main', 'unittest.main', ([], {}), '()\n', (635, 637), False, 'import unittest\n'), ((243, 272), 'statzcw.zvariance.variance', 'zvariance.variance', (['test_data'], {}), '(test_data)\n', (261, 272), False, 'from statzcw import zvariance\n'), ((396, 425), 'statzcw.zvariance.variance', 'zvariance.v... |
import fire
import torch
from torch.utils.data import DataLoader as TorchDataLoader
from deepproblog.dataset import DataLoader, QueryDataset
from deepproblog.engines import ExactEngine
from deepproblog.evaluate import get_confusion_matrix
from deepproblog.examples.Forth.Sort.data.for_calibration import RawSortValidati... | [
"deepproblog.dataset.DataLoader",
"torch.utils.data.DataLoader",
"deepproblog.evaluate.get_confusion_matrix",
"deepproblog.calibrated_network.NetworkECECollector",
"deepproblog.model.Model",
"deepproblog.engines.ExactEngine",
"deepproblog.network.Network",
"deepproblog.examples.Forth.EncodeModule",
... | [((969, 995), 'deepproblog.examples.Forth.Sort.data.for_calibration.RawSortValidationDataset', 'RawSortValidationDataset', ([], {}), '()\n', (993, 995), False, 'from deepproblog.examples.Forth.Sort.data.for_calibration import RawSortValidationDataset\n'), ((1004, 1027), 'deepproblog.examples.Forth.EncodeModule', 'Encod... |
# TODO 该模块存在大量exec用法,请勿随意改动相关文件名或函数名
__all__ = ['manage_task']
import random
from src.BusinessCentralLayer.middleware.redis_io import RedisClient
from src.BusinessCentralLayer.middleware.work_io import Middleware
from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_... | [
"src.BusinessCentralLayer.setting.logger.catch",
"src.BusinessCentralLayer.setting.logger.warning",
"src.BusinessCentralLayer.middleware.work_io.Middleware.poseidon.qsize",
"random.shuffle",
"src.BusinessCentralLayer.setting.logger.success",
"src.BusinessCentralLayer.setting.logger.info",
"src.BusinessC... | [((5953, 5967), 'src.BusinessCentralLayer.setting.logger.catch', 'logger.catch', ([], {}), '()\n', (5965, 5967), False, 'from src.BusinessCentralLayer.setting import CRAWLER_SEQUENCE, REDIS_SECRET_KEY, SINGLE_TASK_CAP, ENABLE_DEPLOY, SINGLE_DEPLOYMENT, logger\n'), ((915, 942), 'src.BusinessCentralLayer.middleware.work_... |
import numpy as np
def msaeye(msa, unique, turbo):
tic1 = timeit.default_timer()
length = msa.shape[1]
number = msa.shape[0]
# number = 5
array = np.eye(int(number))
seqs = []
for i in range(number):
seqs.append(msa[i,:])
iseq = np.zeros((number, length), dtype=int)
for i ... | [
"scipy.cluster.hierarchy.fcluster",
"numpy.sum",
"numpy.empty",
"scipy.cluster.hierarchy.linkage",
"numpy.argmin",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.gca",
"numpy.unique",
"matplotlib.colors.Normalize",
"numpy.max",
"collections.Counter",
"numpy.intersect1d",
"numpy.repeat",
"s... | [((271, 308), 'numpy.zeros', 'np.zeros', (['(number, length)'], {'dtype': 'int'}), '((number, length), dtype=int)\n', (279, 308), True, 'import numpy as np\n'), ((10729, 10757), 'numpy.concatenate', 'np.concatenate', (['atom_indices'], {}), '(atom_indices)\n', (10743, 10757), True, 'import numpy as np\n'), ((10772, 107... |
# Copyright 2014 ETH Zurich
# Copyright 2018 ETH Zurich, Anapaya Systems
#
# 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 b... | [
"os.getcwd",
"yaml.dump",
"topology.common.prom_addr_br",
"topology.common.prom_addr_sciond",
"collections.defaultdict",
"os.path.join",
"topology.common.prom_addr_infra",
"topology.common.prom_addr_dispatcher"
] | [((4080, 4097), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (4091, 4097), False, 'from collections import defaultdict\n'), ((5773, 5840), 'os.path.join', 'os.path.join', (['base_path', 'self.PROM_DIR', 'self.TARGET_FILES[ele_type]'], {}), '(base_path, self.PROM_DIR, self.TARGET_FILES[ele_type]... |
"""CLI interface for migrator."""
from argparse import ArgumentParser
from pathlib import Path
from . import VERSION, get_all_environments, get_environments, main
from .config import Config
def parse_args(argv, config_path=None):
"""
Parse the arguments passed to the script using argparse.
:param argv: ... | [
"pathlib.Path",
"argparse.ArgumentParser"
] | [((501, 533), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': 'desc'}), '(description=desc)\n', (515, 533), False, 'from argparse import ArgumentParser\n'), ((874, 881), 'pathlib.Path', 'Path', (['p'], {}), '(p)\n', (878, 881), False, 'from pathlib import Path\n')] |
import tensorflow as tf
from models.bin_vgg16_cifar100 import VGG_cifar100
import utils.preprocess as preprocess
import numpy
import random
import os
def lr_scheduler(epoch):
return learning_rate * (0.1 ** (epoch // lr_drop))
def get_dataset():
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.cifar... | [
"tensorflow.keras.utils.to_categorical",
"tensorflow.keras.datasets.cifar100.load_data",
"tensorflow.keras.optimizers.SGD",
"tensorflow.reshape",
"utils.preprocess.scale_random_crop",
"tensorflow.keras.callbacks.LearningRateScheduler",
"models.bin_vgg16_cifar100.VGG_cifar100"
] | [((760, 774), 'models.bin_vgg16_cifar100.VGG_cifar100', 'VGG_cifar100', ([], {}), '()\n', (772, 774), False, 'from models.bin_vgg16_cifar100 import VGG_cifar100\n'), ((872, 926), 'tensorflow.keras.callbacks.LearningRateScheduler', 'tf.keras.callbacks.LearningRateScheduler', (['lr_scheduler'], {}), '(lr_scheduler)\n', (... |
import os
import sys
class tool_chain:
def __init__(self, config, tools_path=''):
self.config = config
self.tools_path = tools_path
self.binary_raw = os.path.join(self.config.out_dir, 'binary', self.config.app + '@' + self.config.board)
@staticmethod
def __get_os():
os = ''... | [
"sys.platform.startswith",
"os.path.isabs",
"os.path.abspath",
"os.path.isdir",
"os.path.join",
"os.getenv"
] | [((179, 270), 'os.path.join', 'os.path.join', (['self.config.out_dir', '"""binary"""', "(self.config.app + '@' + self.config.board)"], {}), "(self.config.out_dir, 'binary', self.config.app + '@' + self.\n config.board)\n", (191, 270), False, 'import os\n'), ((332, 364), 'sys.platform.startswith', 'sys.platform.start... |
# Graphics / Primitives
# Use the #graphics module to render and update shapes.
# ---
from h2o_wave import site, ui, graphics as g
# Create some shapes
arc = g.arc(r1=25, r2=50, a1=90, a2=180)
circle = g.circle(cx=25, cy=25, r=25)
ellipse = g.ellipse(cx=25, cy=25, rx=25, ry=20)
image = g.image(width=50, height=50, hr... | [
"h2o_wave.graphics.p",
"h2o_wave.graphics.type_of",
"h2o_wave.graphics.arc",
"h2o_wave.graphics.text",
"h2o_wave.graphics.stage",
"h2o_wave.graphics.image",
"h2o_wave.graphics.line",
"h2o_wave.graphics.circle",
"h2o_wave.graphics.polygon",
"h2o_wave.graphics.path",
"h2o_wave.graphics.rect",
"h... | [((160, 194), 'h2o_wave.graphics.arc', 'g.arc', ([], {'r1': '(25)', 'r2': '(50)', 'a1': '(90)', 'a2': '(180)'}), '(r1=25, r2=50, a1=90, a2=180)\n', (165, 194), True, 'from h2o_wave import site, ui, graphics as g\n'), ((204, 232), 'h2o_wave.graphics.circle', 'g.circle', ([], {'cx': '(25)', 'cy': '(25)', 'r': '(25)'}), '... |
import numpy as np
import cv2 as cv
from split import SliceImage
import utils
class DocumentScanner:
def __init__(self, path):
self.path = path
self.contrast = 0
self.row = 4
self.column = 4
def setImage(self):
self.image = cv.imread(self.path, 1)
def copy... | [
"cv2.GaussianBlur",
"cv2.medianBlur",
"cv2.getPerspectiveTransform",
"cv2.arcLength",
"cv2.approxPolyDP",
"numpy.argmax",
"cv2.adaptiveThreshold",
"numpy.argmin",
"numpy.linalg.norm",
"cv2.warpPerspective",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"split.SliceImage",
"cv2.drawContour... | [((278, 301), 'cv2.imread', 'cv.imread', (['self.path', '(1)'], {}), '(self.path, 1)\n', (287, 301), True, 'import cv2 as cv\n'), ((749, 791), 'cv2.cvtColor', 'cv.cvtColor', (['self.clone', 'cv.COLOR_BGR2GRAY'], {}), '(self.clone, cv.COLOR_BGR2GRAY)\n', (760, 791), True, 'import cv2 as cv\n'), ((881, 930), 'split.Slice... |
import demistomock as demisto
from CommonServerPython import *
import urllib3
from typing import Any, Dict
# Disable insecure warnings
urllib3.disable_warnings()
class Client(BaseClient):
@logger
def __init__(self, headers, verify=False, proxy=False):
url = 'https://api.cloudconvert.com/v2'
... | [
"demistomock.args",
"demistomock.command",
"demistomock.params",
"demistomock.debug",
"urllib3.disable_warnings"
] | [((137, 163), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (161, 163), False, 'import urllib3\n'), ((17114, 17131), 'demistomock.command', 'demisto.command', ([], {}), '()\n', (17129, 17131), True, 'import demistomock as demisto\n'), ((17149, 17165), 'demistomock.params', 'demisto.params', ... |
import tensorflow as tf
import numpy as np
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train, x_test = np.array(x_train/255.0,dtype="<f4"), np.array(x_test/255.0,dtype="<f4")
idx=np.argsort(y_train.flatten())
vdx=np.array([6000*i+j for i in range(10) for j in range(5400,6000)])... | [
"numpy.random.permutation",
"tensorflow.convert_to_tensor",
"numpy.array",
"tensorflow.keras.datasets.mnist.load_data"
] | [((86, 121), 'tensorflow.keras.datasets.mnist.load_data', 'tf.keras.datasets.mnist.load_data', ([], {}), '()\n', (119, 121), True, 'import tensorflow as tf\n'), ((508, 536), 'numpy.random.permutation', 'np.random.permutation', (['(54000)'], {}), '(54000)\n', (529, 536), True, 'import numpy as np\n'), ((636, 663), 'nump... |
# Copyright 2020 by <NAME>. All rights reserved.
# This file is part of the Biopython distribution and governed by your
# choice of the "Biopython License Agreement" or the "BSD 3-Clause License".
# Please see the LICENSE file that should have been included as part of this
# package.
"""Unit tests for PARTS of the pa... | [
"unittest.main",
"Bio.PDB.SCADIO.write_SCAD",
"io.StringIO",
"unittest.TextTestRunner",
"warnings.simplefilter",
"Bio.PDB.MMCIFParser.MMCIFParser",
"Bio.MissingPythonDependencyError",
"Bio.File.as_handle",
"re.findall",
"warnings.catch_warnings",
"re.search",
"Bio.PDB.ic_rebuild.structure_rebu... | [((1176, 1214), 'Bio.PDB.PDBParser.PDBParser', 'PDBParser', ([], {'PERMISSIVE': '(True)', 'QUIET': '(True)'}), '(PERMISSIVE=True, QUIET=True)\n', (1185, 1214), False, 'from Bio.PDB.PDBParser import PDBParser\n'), ((1232, 1255), 'Bio.PDB.MMCIFParser.MMCIFParser', 'MMCIFParser', ([], {'QUIET': '(True)'}), '(QUIET=True)\n... |
import numpy as np
import mido
from mido import Message, MidiFile, MidiTrack
import argparse
from functools import partial
def main():
#Get options from input
parser = argparse.ArgumentParser(description='Superpermutation to midi converter')
parser.add_argument('inputfile',
help='The f... | [
"functools.partial",
"numpy.zeros_like",
"argparse.ArgumentParser",
"mido.MidiFile",
"mido.Message",
"mido.MidiTrack",
"mido.open_output",
"numpy.unique"
] | [((178, 251), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Superpermutation to midi converter"""'}), "(description='Superpermutation to midi converter')\n", (201, 251), False, 'import argparse\n'), ((1550, 1581), 'numpy.zeros_like', 'np.zeros_like', (['superpermutation'], {}), '(superp... |
import logging
import time
import os
import re
from functools import lru_cache
import torch
from flask import Flask, request, jsonify
import sentry_sdk
from sentry_sdk.integrations.flask import FlaskIntegration
import src.data.config as cfg
import src.interactive.functions as interactive
sentry_sdk.init(dsn=os.geten... | [
"src.interactive.functions.set_sampler",
"sentry_sdk.integrations.flask.FlaskIntegration",
"src.interactive.functions.get_conceptnet_sequence",
"flask.jsonify",
"torch.cuda.set_device",
"re.sub",
"flask.request.json.get",
"src.interactive.functions.load_data",
"os.getenv",
"re.compile",
"logging... | [((374, 481), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (393, 481), False, 'import logging\n'), ((486, 513), 'loggin... |
#!/usr/bin/env python
from __future__ import (print_function, unicode_literals, division,
absolute_import)
"""
Simple script to create a bunch of AppInstances with similar names. This
has been replaced by DBMP, but the script can still be useful for one-off
creations.
Usage:
$ ./make_ais... | [
"threading.Thread",
"dfs_sdk.scaffold.get_api",
"dfs_sdk.scaffold.get_argparser",
"queue.Queue",
"sys.exit"
] | [((1048, 1066), 'dfs_sdk.scaffold.get_api', 'scaffold.get_api', ([], {}), '()\n', (1064, 1066), False, 'from dfs_sdk import scaffold\n'), ((1104, 1111), 'queue.Queue', 'Queue', ([], {}), '()\n', (1109, 1111), False, 'from queue import Queue\n'), ((1508, 1532), 'dfs_sdk.scaffold.get_argparser', 'scaffold.get_argparser',... |
import discord
from random import shuffle
from dotenv import dotenv_values
TOKEN = dotenv_values(".env")["TOKEN"]
class Client(discord.Client):
async def on_ready(self):
members = [x for x in self.guilds[0].members if not x.bot]
shuffle(members)
savelist(members)
msg = ("@everyone... | [
"random.shuffle",
"dotenv.dotenv_values",
"discord.Intents.default"
] | [((1121, 1146), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (1144, 1146), False, 'import discord\n'), ((84, 105), 'dotenv.dotenv_values', 'dotenv_values', (['""".env"""'], {}), "('.env')\n", (97, 105), False, 'from dotenv import dotenv_values\n'), ((252, 268), 'random.shuffle', 'shuffle', ([... |
from flask import Flask, request, render_template
from intelli.Sentiment_Analyzer import Sentiment_Analyzer
from dotenv import load_dotenv
import os
load_dotenv()
PORT = os.getenv("PORT")
app = Flask(__name__, template_folder='templates')
@app.route('/', methods=['GET'])
def home():
return render_template('home.h... | [
"flask.Flask",
"intelli.Sentiment_Analyzer.Sentiment_Analyzer",
"dotenv.load_dotenv",
"flask.render_template",
"os.getenv"
] | [((150, 163), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (161, 163), False, 'from dotenv import load_dotenv\n'), ((171, 188), 'os.getenv', 'os.getenv', (['"""PORT"""'], {}), "('PORT')\n", (180, 188), False, 'import os\n'), ((195, 239), 'flask.Flask', 'Flask', (['__name__'], {'template_folder': '"""templates... |
import itertools
from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk
from tkinter.ttk import Frame, Notebook, Combobox, Entry
from tkinter import filedialog
from tkinter import messagebox
import os.path as osp
import webbrowser
from . import picketfence, vmat, ct, log_analyzer,... | [
"tkinter.StringVar",
"tkinter.BooleanVar",
"tkinter.Label",
"tkinter.Checkbutton",
"tkinter.Button",
"tkinter.filedialog.askopenfilename",
"tkinter.ttk.Frame",
"tkinter.Tk",
"tkinter.ttk.Entry",
"tkinter.filedialog.askopenfilenames",
"itertools.count",
"tkinter.filedialog.askdirectory",
"tki... | [((20698, 20702), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (20700, 20702), False, 'from tkinter import Label, Button, StringVar, BooleanVar, DoubleVar, IntVar, Checkbutton, Tk\n'), ((526, 540), 'tkinter.ttk.Notebook', 'Notebook', (['self'], {}), '(self)\n', (534, 540), False, 'from tkinter.ttk import Frame, Notebook, Comb... |
#!/usr/bin/env python3
"""
Netflow V9 collector and parser implementation in Python 3.
This file belongs to https://github.com/bitkeks/python-netflow-v9-softflowd.
Created for learning purposes and unsatisfying alternatives.
Reference: https://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186... | [
"struct.unpack",
"ipaddress.ip_address"
] | [((6669, 6699), 'struct.unpack', 'struct.unpack', (['"""!HH"""', 'data[:4]'], {}), "('!HH', data[:4])\n", (6682, 6699), False, 'import struct\n'), ((9708, 9739), 'struct.unpack', 'struct.unpack', (['"""!HHH"""', 'data[:6]'], {}), "('!HHH', data[:6])\n", (9721, 9739), False, 'import struct\n'), ((10206, 10236), 'struct.... |
import argparse
import logging
from typing import Any, Dict, List, Optional
import pandas
import annofabcli
import annofabcli.common.cli
from annofabcli import AnnofabApiFacade
from annofabcli.common.cli import AbstractCommandLineInterface, ArgumentParser, build_annofabapi_resource_and_login
from annofabcli.common.ut... | [
"pandas.DataFrame",
"annofabcli.common.cli.ArgumentParser",
"annofabcli.common.cli.build_annofabapi_resource_and_login",
"annofabcli.utils.print_csv",
"annofabcli.common.utils.isoduration_to_hour",
"annofabcli.common.cli.add_parser",
"annofabcli.AnnofabApiFacade",
"logging.getLogger"
] | [((361, 388), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (378, 388), False, 'import logging\n'), ((2019, 2041), 'annofabcli.common.cli.ArgumentParser', 'ArgumentParser', (['parser'], {}), '(parser)\n', (2033, 2041), False, 'from annofabcli.common.cli import AbstractCommandLineInterfac... |
""" the main query widget
"""
# Copyright (c) 2021 ipyradiant contributors.
# Distributed under the terms of the Modified BSD License.
import re
import IPython
import ipywidgets as W
import traitlets as T
from pandas import DataFrame
from rdflib import Graph, URIRef
from .namespace_manager import collapse_namespace
... | [
"traitlets.default",
"rdflib.Graph",
"ipywidgets.Button",
"ipywidgets.Output",
"traitlets.Instance",
"re.compile"
] | [((793, 830), 're.compile', 're.compile', (['"""PREFIX ([\\\\w]*): <(.+)>"""'], {}), "('PREFIX ([\\\\w]*): <(.+)>')\n", (803, 830), False, 'import re\n'), ((844, 861), 'traitlets.Instance', 'T.Instance', (['Graph'], {}), '(Graph)\n', (854, 861), True, 'import traitlets as T\n'), ((879, 899), 'traitlets.Instance', 'T.In... |
from django.db import models
class Course(models.Model):
identifier = models.CharField('ID', max_length=100, unique=True)
title = models.CharField('Published title', max_length=100)
url = models.CharField('Url', max_length=100)
image_240x135 = models.URLField('Image 240x135')
image_480x270 = model... | [
"django.db.models.CharField",
"django.db.models.URLField"
] | [((76, 127), 'django.db.models.CharField', 'models.CharField', (['"""ID"""'], {'max_length': '(100)', 'unique': '(True)'}), "('ID', max_length=100, unique=True)\n", (92, 127), False, 'from django.db import models\n'), ((140, 191), 'django.db.models.CharField', 'models.CharField', (['"""Published title"""'], {'max_lengt... |
"""
This module implements the intermediates computation for plot(df) function.
""" # pylint: disable=too-many-lines
from collections import defaultdict
from typing import Any, DefaultDict, Dict, List, Optional, Tuple, Union, cast
import dask
import dask.array as da
import dask.dataframe as dd
import numpy as np
impo... | [
"pandas.DataFrame",
"dask.array.stats.skew",
"dask.delayed",
"nltk.stem.PorterStemmer",
"nltk.stem.WordNetLemmatizer",
"dask.array.histogram",
"typing.cast",
"dask.array.stats.kurtosis",
"pandas.pivot_table",
"collections.defaultdict",
"pandas.to_timedelta",
"pandas.Grouper",
"numpy.linspace... | [((7664, 7680), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (7675, 7680), False, 'from collections import defaultdict\n'), ((8921, 8947), 'dask.compute', 'dask.compute', (['datas', 'stats'], {}), '(datas, stats)\n', (8933, 8947), False, 'import dask\n'), ((25009, 25047), 'pandas.Grouper', 'pd.Gr... |
# encoding: utf-8
"""Utility functions wrapping the excellent *mock* library"""
from __future__ import absolute_import, division, print_function, unicode_literals
import sys
if sys.version_info > (3, 0):
from unittest.mock import ANY, call, MagicMock # noqa
from unittest.mock import create_autospec, Mock, ... | [
"mock.patch.object",
"mock.patch",
"mock.create_autospec",
"unittest.mock.mock_open",
"mock.Mock"
] | [((853, 901), 'mock.patch', 'patch', (['q_class_name'], {'autospec': 'autospec'}), '(q_class_name, autospec=autospec, **kwargs)\n', (858, 901), False, 'from mock import create_autospec, Mock, patch, PropertyMock\n'), ((1226, 1275), 'mock.patch.object', 'patch.object', (['cls', 'attr_name'], {'name': 'name'}), '(cls, at... |
# -*- coding: utf-8 -*-
# Copyright 2020 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... | [
"proto.RepeatedField",
"proto.module",
"proto.Field"
] | [((853, 1164), 'proto.module', 'proto.module', ([], {'package': '"""google.cloud.aiplatform.v1"""', 'manifest': "{'SearchMigratableResourcesRequest', 'SearchMigratableResourcesResponse',\n 'BatchMigrateResourcesRequest', 'MigrateResourceRequest',\n 'BatchMigrateResourcesResponse', 'MigrateResourceResponse',\n ... |
from unittest import TestCase
import pandas.api.types as ptypes
from pytrends.request import TrendReq
class TestTrendReq(TestCase):
def test__get_data(self):
"""Should use same values as in the documentation"""
pytrend = TrendReq()
self.assertEqual(pytrend.hl, 'en-US')
self.asser... | [
"pytrends.request.TrendReq",
"pandas.api.types.is_bool_dtype"
] | [((245, 255), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (253, 255), False, 'from pytrends.request import TrendReq\n'), ((539, 549), 'pytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (547, 549), False, 'from pytrends.request import TrendReq\n'), ((707, 717), 'pytrends.request.TrendReq', 'TrendR... |
from collections import defaultdict
from email.headerregistry import Address
from smtplib import (
SMTPAuthenticationError,
SMTPDataError,
SMTPRecipientsRefused,
SMTPSenderRefused,
SMTPServerDisconnected,
)
from ssl import SSLCertVerificationError
from time import time
from typing import Any, Dict, ... | [
"email.headerregistry.Address",
"time.time"
] | [((6829, 6900), 'email.headerregistry.Address', 'Address', (['users_email_sender'], {'addr_spec': 'EmailSettings.default_from_email'}), '(users_email_sender, addr_spec=EmailSettings.default_from_email)\n', (6836, 6900), False, 'from email.headerregistry import Address\n'), ((8258, 8264), 'time.time', 'time', ([], {}), ... |
################################################################################
# Numba-DPPY
#
# Copyright 2020-2021 Intel Corporation
#
# 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 ... | [
"dpctl.SyclDevice",
"numba_dppy.tests._helper.assert_auto_offloading",
"numpy.empty",
"dpctl.device_context",
"numpy.testing.assert_allclose",
"pytest.fixture",
"pytest.skip",
"numpy.random.random",
"numba_dppy.tests._helper.is_gen12",
"pytest.mark.parametrize"
] | [((1088, 1130), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_filter_strs'}), '(params=list_of_filter_strs)\n', (1102, 1130), False, 'import pytest\n'), ((1440, 1479), 'pytest.fixture', 'pytest.fixture', ([], {'params': 'list_of_trig_ops'}), '(params=list_of_trig_ops)\n', (1454, 1479), False, 'import pyt... |
import hashlib
import os
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
from samcli.lib.utils.hash import dir_checksum, str_checksum
class TestHash(TestCase):
def setUp(self):
self.temp_dir = tempfile.mkdtemp()
def tearDown(self):
shutil.rmtree(se... | [
"os.mkdir",
"tempfile.NamedTemporaryFile",
"os.path.abspath",
"hashlib.md5",
"os.path.dirname",
"samcli.lib.utils.hash.dir_checksum",
"unittest.mock.patch",
"hashlib.sha256",
"tempfile.mkdtemp",
"samcli.lib.utils.hash.str_checksum",
"shutil.rmtree",
"os.path.join"
] | [((252, 270), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (268, 270), False, 'import tempfile\n'), ((304, 352), 'shutil.rmtree', 'shutil.rmtree', (['self.temp_dir'], {'ignore_errors': '(True)'}), '(self.temp_dir, ignore_errors=True)\n', (317, 352), False, 'import shutil\n'), ((427, 468), 'os.path.join', '... |
# -*- coding: utf-8 -*-
"""
A urls module that raises a DeadlineExceededError
:Copyright: (c) 2010 <NAME> <<EMAIL>> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from google.appengine.runtime import DeadlineExceededError
raise DeadlineExceededError()
| [
"google.appengine.runtime.DeadlineExceededError"
] | [((255, 278), 'google.appengine.runtime.DeadlineExceededError', 'DeadlineExceededError', ([], {}), '()\n', (276, 278), False, 'from google.appengine.runtime import DeadlineExceededError\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009, <NAME>
# Copyright (c) 2010, <NAME>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the ab... | [
"trac.ticket.model.Component.select",
"announcer.api._",
"trac.core.implements",
"announcer.util.settings.BoolSubscriptionSetting"
] | [((2116, 2184), 'trac.core.implements', 'implements', (['IAnnouncementSubscriber', 'IAnnouncementPreferenceProvider'], {}), '(IAnnouncementSubscriber, IAnnouncementPreferenceProvider)\n', (2126, 2184), False, 'from trac.core import Component, implements\n'), ((3621, 3653), 'trac.ticket.model.Component.select', 'model.C... |
import tkinter
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
from matplotlib.figure import Figure
import requests
from scipy.signal import medfilt
from copy import deepcopy
from json import loads
import numpy as np
with open('endomondo.config', 'r') as conf:
username = conf... | [
"matplotlib.backends.backend_tkagg.NavigationToolbar2Tk",
"tkinter.Checkbutton",
"tkinter.StringVar",
"copy.deepcopy",
"requests.session",
"json.loads",
"numpy.average",
"tkinter.mainloop",
"tkinter.Button",
"tkinter.Entry",
"scipy.signal.medfilt",
"matplotlib.figure.Figure",
"tkinter.Scale"... | [((7376, 7388), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (7386, 7388), False, 'import tkinter\n'), ((7432, 7463), 'matplotlib.figure.Figure', 'Figure', ([], {'figsize': '(5, 4)', 'dpi': '(100)'}), '(figsize=(5, 4), dpi=100)\n', (7438, 7463), False, 'from matplotlib.figure import Figure\n'), ((7534, 7569), 'matplot... |
# -----------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# -----------------------------------------------------------------------------
""... | [
"os.path.dirname"
] | [((544, 569), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (559, 569), False, 'import os\n')] |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL/OGR Test Suite
# Purpose: Test basic integration with Numeric Python.
# Author: <NAME>, <EMAIL>
#
###############################################################################
# Copyrigh... | [
"sys.path.append",
"numpy.zeros_like",
"osgeo.gdal_array.OpenArray",
"_gdal.GDALRegister_NUMPY",
"gdaltest.post_reason",
"osgeo.gdal.Unlink",
"numpy.empty",
"numpy.zeros",
"numpy.empty_like",
"osgeo.gdalnumeric.OpenArray",
"gdaltest.run_tests",
"gdaltest.setup_run",
"gdaltest.summarize",
"... | [((1577, 1604), 'sys.path.append', 'sys.path.append', (['"""../pymod"""'], {}), "('../pymod')\n", (1592, 1604), False, 'import sys\n'), ((2138, 2167), 'osgeo.gdal.GetDriverByName', 'gdal.GetDriverByName', (['"""NUMPY"""'], {}), "('NUMPY')\n", (2158, 2167), False, 'from osgeo import gdal\n'), ((2588, 2629), 'osgeo.gdaln... |
#!/usr/bin/python
import time
import hmac
import hashlib
import requests
import json
bitso_key = "your api key"
bitso_secret = "your api secret"
http_method = "GET" # Change to POST if endpoint requires data
request_path = "/v3/balance/"
parameters = {} # Needed for POST endpoints requiring data
# Create signat... | [
"requests.get",
"requests.post",
"json.dumps",
"time.time"
] | [((451, 473), 'json.dumps', 'json.dumps', (['parameters'], {}), '(parameters)\n', (461, 473), False, 'import json\n'), ((810, 907), 'requests.get', 'requests.get', (["('https://api.bitso.com' + request_path)"], {'headers': "{'Authorization': auth_header}"}), "('https://api.bitso.com' + request_path, headers={\n 'Aut... |
# coding: utf-8
"""
ASR documentation
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
impor... | [
"cloud_client.cloud_api_client.CloudApiClient",
"six.iteritems"
] | [((2852, 2883), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (2865, 2883), False, 'import six\n'), ((7458, 7489), 'six.iteritems', 'six.iteritems', (["params['kwargs']"], {}), "(params['kwargs'])\n", (7471, 7489), False, 'import six\n'), ((12193, 12224), 'six.iteritems', 'six.it... |
import random
w, h = 128, 128
Matrix1 = [[random.randint(-100, 100) for x in range(w)] for y in range(h)]
Matrix2 = [[random.randint(-100, 100) for x in range(w)] for y in range(h)]
Matrix_out = [[0 for x in range(w)] for y in range(h)]
print(Matrix2)
print(Matrix1)
print(Matrix_out)
for x in range(len(... | [
"random.randint"
] | [((48, 73), 'random.randint', 'random.randint', (['(-100)', '(100)'], {}), '(-100, 100)\n', (62, 73), False, 'import random\n'), ((125, 150), 'random.randint', 'random.randint', (['(-100)', '(100)'], {}), '(-100, 100)\n', (139, 150), False, 'import random\n')] |
import inspect
import os
import re
from typing import Optional
import requests
from colorama import Fore
from colorama import Style
from ruamel.yaml import YAML
from voluptuous.error import Invalid
from voluptuous.error import MultipleInvalid
from .compliance import Compliance
from .get_apikeys_from_env_vars import get... | [
"os.path.isabs",
"inspect.stack",
"os.getcwd",
"os.path.dirname",
"os.path.exists",
"ruamel.yaml.YAML",
"os.path.join",
"re.compile"
] | [((5212, 5237), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (5227, 5237), False, 'import os\n'), ((5272, 5320), 'os.path.join', 'os.path.join', (['pkg_root', '"""data"""', '""".howfairis.yml"""'], {}), "(pkg_root, 'data', '.howfairis.yml')\n", (5284, 5320), False, 'import os\n'), ((7358, 7... |
from .. import haven_utils
from .. import haven_results as hr
from .. import haven_utils as hu
from .. import haven_share as hd
import os
import pprint
import json
import copy
import pprint
import pandas as pd
from . import widgets as wdg
try:
import ast
from ipywidgets import Button, HBox, VBox
from ipyw... | [
"matplotlib.backends.backend_pdf.PdfPages",
"zipfile.ZipFile",
"ipywidgets.widgets.HBox",
"os.path.join",
"IPython.core.display.display",
"ipywidgets.widgets.Button",
"ipywidgets.widgets.interaction.show_inline_matplotlib_plots",
"ipywidgets.widgets.Output",
"os.path.split",
"IPython.display.FileL... | [((1308, 1380), 'ipywidgets.widgets.Button', 'widgets.Button', ([], {'description': '"""Download Images"""', 'layout': 'self.layout_button'}), "(description='Download Images', layout=self.layout_button)\n", (1322, 1380), False, 'from ipywidgets import widgets\n'), ((1401, 1442), 'ipywidgets.widgets.Output', 'widgets.Ou... |