code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import pathlib
import traceback
import typing
def get_traceback_msg(err):
return ''.join(traceback.format_exception(
etype=type(err),
value=err,
tb=err.__traceback__))
def json_to_envfiles(output_file: pathlib.Path):
try:
output_na... | [
"json.loads",
"json.dumps",
"os._exit",
"pathlib.Path"
] | [((476, 510), 'json.loads', 'json.loads', (['input_env_file_content'], {}), '(input_env_file_content)\n', (486, 510), False, 'import json\n'), ((579, 615), 'pathlib.Path', 'pathlib.Path', (['"""template/launch.json"""'], {}), "('template/launch.json')\n", (591, 615), False, 'import pathlib\n'), ((1016, 1050), 'pathlib.... |
# -*- coding: utf-8 -*-
import csv
import logging as logmodule
import math
import os
import sys
import tempfile
from collections import OrderedDict
# On OS X, the default backend will fail if you are not using a Framework build of Python,
# e.g. in a virtualenv. To avoid having to set MPLBACKEND each time we use Studi... | [
"logging.getLogger",
"contentcuration.utils.format.format_size",
"pdfkit.from_string",
"sys.platform.startswith",
"pptx.Presentation",
"math.log",
"matplotlib.pyplot.annotate",
"os.path.sep.join",
"matplotlib.pyplot.switch_backend",
"pressurecooker.encodings.encode_file_to_base64",
"pptx.dml.col... | [((359, 392), 'sys.platform.startswith', 'sys.platform.startswith', (['"""darwin"""'], {}), "('darwin')\n", (382, 392), False, 'import sys\n'), ((1653, 1678), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (1671, 1678), True, 'import matplotlib.pyplot as plt\n'), ((1927, 195... |
import os
import numpy
from pydub import AudioSegment
from scipy.fftpack import fft
class AudioSignal(object):
def __init__(self, sample_rate, signal=None, filename=None):
# Set sample rate
self._sample_rate = sample_rate
if signal is None:
# Get file name and file extensio... | [
"numpy.ones",
"os.path.splitext",
"numpy.hamming",
"numpy.append",
"numpy.array",
"pydub.AudioSegment.from_file",
"scipy.fftpack.fft",
"numpy.fromstring"
] | [((1474, 1500), 'os.path.splitext', 'os.path.splitext', (['filename'], {}), '(filename)\n', (1490, 1500), False, 'import os\n'), ((1995, 2027), 'pydub.AudioSegment.from_file', 'AudioSegment.from_file', (['filename'], {}), '(filename)\n', (2017, 2027), False, 'from pydub import AudioSegment\n'), ((4962, 5037), 'numpy.ap... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2018-2020 The Pybricks Authors
# Expose method and class written in C
from _pybricks.tools import wait, StopWatch
# Imports for DataLog implementation
from utime import localtime, ticks_us
class DataLog:
def __init__(self, *headers, name="log", timestamp=True, exte... | [
"utime.ticks_us",
"utime.localtime"
] | [((468, 479), 'utime.localtime', 'localtime', ([], {}), '()\n', (477, 479), False, 'from utime import localtime, ticks_us\n'), ((501, 511), 'utime.ticks_us', 'ticks_us', ([], {}), '()\n', (509, 511), False, 'from utime import localtime, ticks_us\n')] |
# -*- coding: utf-8 -*-
"""
#The following formula is used
#Adjusted Volume = Raw Volume - Regression Slope * (TIV - Cohort Mean TIV)
#Reference Literature: Voevodskaya et al, 2014: The effects of intracranial volume adjustment approaches on multiple regional MRI volumes in healthy aging and Alzheimer's disease
"""
i... | [
"nipype.interfaces.base.Directory",
"pandas.read_csv",
"re.compile",
"nipype.interfaces.base.File",
"nipype.interfaces.freesurfer.base.Info.looseversion",
"nipype.logging.getLogger",
"sklearn.linear_model.LinearRegression",
"glob.glob"
] | [((1168, 1205), 'nipype.logging.getLogger', 'logging.getLogger', (['"""nipype.interface"""'], {}), "('nipype.interface')\n", (1185, 1205), False, 'from nipype import logging, LooseVersion\n'), ((1330, 1349), 'nipype.interfaces.freesurfer.base.Info.looseversion', 'Info.looseversion', ([], {}), '()\n', (1347, 1349), Fals... |
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
from flask import Flask, request, Response, jsonify
from slackclient import SlackClient
import datetime
try:
import a... | [
"os.path.exists",
"os.makedirs",
"flask.Flask",
"argparse.ArgumentParser",
"datetime.datetime.utcnow",
"os.path.join",
"oauth2client.client.flow_from_clientsecrets",
"os.environ.get",
"flask.request.form.get",
"slackclient.SlackClient",
"oauth2client.tools.run",
"oauth2client.file.Storage",
... | [((841, 869), 'slackclient.SlackClient', 'SlackClient', (['SLACK_DEV_TOKEN'], {}), '(SLACK_DEV_TOKEN)\n', (852, 869), False, 'from slackclient import SlackClient\n'), ((876, 891), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (881, 891), False, 'from flask import Flask, request, Response, jsonify\n'), ((1... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
__author__ = "<EMAIL>"
from test_auth_app.backend import test_auth_app_db
from test_auth_app.backend.db_models import User, Role, Application
from test_auth_app.backend.db_models import ... | [
"test_auth_app.backend.test_auth_app_db.session.add",
"test_auth_app.backend.test_auth_app_db.session.commit",
"test_auth_app.backend.db_models.Application.query.all",
"test_auth_app.backend.db_models.Application",
"test_auth_app.backend.test_auth_app_db.session.delete",
"uuid.uuid1",
"test_auth_app.bac... | [((69, 131), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (90, 131), False, 'import warnings\n'), ((397, 413), 'test_auth_app.backend.db_models.User.query.all', 'User.query.all', ([], {}), '()\n', (411, 41... |
import sys
from cos_backend import COSBackend
import json
import re
import pika
class ReduceCallback(object):
def __init__ (self, cb, target_bucket, nthreads):
self.cb = cb
self.target_bucket = target_bucket
self.nthreads = nthreads
self.result = {} # where we... | [
"json.dumps",
"pika.URLParameters",
"pika.BlockingConnection",
"cos_backend.COSBackend"
] | [((1370, 1472), 'cos_backend.COSBackend', 'COSBackend', (["args['cos']['service_endpoint']", "args['cos']['secret_key']", "args['cos']['access_key']"], {}), "(args['cos']['service_endpoint'], args['cos']['secret_key'], args\n ['cos']['access_key'])\n", (1380, 1472), False, 'from cos_backend import COSBackend\n'), ((... |
from tensorflow import keras
import numpy as np
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
model = keras.models.load_model("Saved models/2layerNet.h5")
x = np.load("data/preprocessedInputs.npy")
y = np.load("data/outputs.npy")
oosx = np.load("data/testx.npy")
oosy = np.load("data/testy.npy")
... | [
"numpy.load",
"tensorflow.keras.models.load_model"
] | [((115, 167), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""Saved models/2layerNet.h5"""'], {}), "('Saved models/2layerNet.h5')\n", (138, 167), False, 'from tensorflow import keras\n'), ((173, 211), 'numpy.load', 'np.load', (['"""data/preprocessedInputs.npy"""'], {}), "('data/preprocessedInputs... |
import mock
import pytest
from iocage.cli.activate import\
(get_zfs_pools, set_zfs_pool_active_property, set_zfs_pool_comment)
@mock.patch('iocage.cli.activate.Popen.communicate')
def test_get_zfs_pools_multiple_pools(mock_communicate):
""" Fake the expected output from zpool list -H -o name
on a syst... | [
"mock.patch",
"iocage.cli.activate.get_zfs_pools",
"iocage.cli.activate.set_zfs_pool_comment",
"pytest.raises",
"iocage.cli.activate.set_zfs_pool_active_property"
] | [((134, 185), 'mock.patch', 'mock.patch', (['"""iocage.cli.activate.Popen.communicate"""'], {}), "('iocage.cli.activate.Popen.communicate')\n", (144, 185), False, 'import mock\n'), ((537, 588), 'mock.patch', 'mock.patch', (['"""iocage.cli.activate.Popen.communicate"""'], {}), "('iocage.cli.activate.Popen.communicate')\... |
from treeNode import TreeNode
from collections import defaultdict
from treeNodeTravelThrewTreeNodes import TravelThrewTreeNodes
# In positionEncoding wird die Zugehörigkeit der Ecodierung zu ihrem Wert festgelegt.
# Dieser Wert entspricht der Position des Buchstabens der nächsten Zeile.
positionEncoding = defa... | [
"treeNode.TreeNode",
"treeNodeTravelThrewTreeNodes.TravelThrewTreeNodes",
"collections.defaultdict"
] | [((316, 1277), 'collections.defaultdict', 'defaultdict', (['list', "{'0': ['1000001', '1011111'], '1': ['1000010', '1100000'], '2': ['1000011',\n '1100001'], '3': ['1000100', '1100010'], '4': ['1000101', '1100011'],\n '5': ['1000110', '1100100'], '6': ['1000111', '1100101'], '7': [\n '1001000', '1100110'], '8'... |
from actor import Actor, Location, Passage, Switch, Ghost
from json import load
class Pool(dict):
""" Contains ingame objects. """
def fill(self):
with open('data/actors.json', 'r') as data:
actors = load(data)
for name, properties in actors.items():
self._build(properties, name)
with ope... | [
"json.load",
"actor.Switch",
"actor.Location",
"actor.Passage",
"actor.Ghost",
"actor.Actor"
] | [((482, 489), 'actor.Actor', 'Actor', ([], {}), '()\n', (487, 489), False, 'from actor import Actor, Location, Passage, Switch, Ghost\n'), ((215, 225), 'json.load', 'load', (['data'], {}), '(data)\n', (219, 225), False, 'from json import load\n'), ((374, 384), 'json.load', 'load', (['data'], {}), '(data)\n', (378, 384)... |
from api.models.config import Config
from api.tests.utils.test_objects import TestObjects
class TestConfigs(TestObjects):
MODEL = Config
POSTPAID_LIMIT: MODEL
POSTPAID_LIMIT_PATCHED: MODEL
@classmethod
def init(cls):
# These models are created in the initial Django signal, not from this... | [
"api.models.config.Config.objects.get"
] | [((713, 767), 'api.models.config.Config.objects.get', 'Config.objects.get', ([], {'key': 'TestConfigs.POSTPAID_LIMIT.key'}), '(key=TestConfigs.POSTPAID_LIMIT.key)\n', (731, 767), False, 'from api.models.config import Config\n')] |
import numpy as np
import scipy as sp
from scipy.sparse.linalg import LinearOperator, lgmres, gmres
import tensornetwork as tn
import jax_vumps.numpy_backend.contractions as ct
# import jax_vumps.numpy_backend.mps_linalg as mps_linalg
def LH_linear_operator(A_L, lR):
"""
Return, as a LinearOperator, the LH... | [
"scipy.sparse.linalg.LinearOperator",
"numpy.eye",
"jax_vumps.numpy_backend.contractions.proj",
"jax_vumps.numpy_backend.contractions.tmdense",
"tensornetwork.ncon",
"jax_vumps.numpy_backend.contractions.compute_hR",
"jax_vumps.numpy_backend.contractions.XopR",
"jax_vumps.numpy_backend.contractions.co... | [((462, 490), 'numpy.eye', 'np.eye', (['chi'], {'dtype': 'A_L.dtype'}), '(chi, dtype=A_L.dtype)\n', (468, 490), True, 'import numpy as np\n'), ((686, 754), 'scipy.sparse.linalg.LinearOperator', 'LinearOperator', (['(chi ** 2, chi ** 2)'], {'matvec': 'matvec', 'dtype': 'A_L.dtype'}), '((chi ** 2, chi ** 2), matvec=matve... |
# -*- coding: utf-8 -*-
"""
File Name: utils
Description :
Author : mick.yi
date: 2019/1/4
"""
import numpy as np
def enqueue(np_array, elem):
"""
入队列,新增元素放到队首,队尾元素丢弃
:param np_array: 原始队列
:param elem: 增加元素
:return:
"""
np_array[1:] = np_arra... | [
"numpy.argsort",
"numpy.asarray",
"numpy.argmax"
] | [((1123, 1141), 'numpy.argsort', 'np.argsort', (['labels'], {}), '(labels)\n', (1133, 1141), True, 'import numpy as np\n'), ((1322, 1341), 'numpy.asarray', 'np.asarray', (['weights'], {}), '(weights)\n', (1332, 1341), True, 'import numpy as np\n'), ((1658, 1685), 'numpy.argmax', 'np.argmax', (['predict'], {'axis': '(-1... |
import random
import pandas as pd
import pronouncing
from collections import defaultdict
import re
import pkg_resources
def load_data():
stream = pkg_resources.resource_stream(__name__, 'data.pkl.compress')
return pd.read_pickle(stream, compression="gzip")
def define_structure():
length = random.randint(4... | [
"pandas.read_pickle",
"random.choice",
"pronouncing.rhyming_part",
"collections.defaultdict",
"re.sub",
"pronouncing.phones_for_word",
"random.randint",
"pkg_resources.resource_stream",
"re.search"
] | [((151, 211), 'pkg_resources.resource_stream', 'pkg_resources.resource_stream', (['__name__', '"""data.pkl.compress"""'], {}), "(__name__, 'data.pkl.compress')\n", (180, 211), False, 'import pkg_resources\n'), ((223, 265), 'pandas.read_pickle', 'pd.read_pickle', (['stream'], {'compression': '"""gzip"""'}), "(stream, co... |
# pylint: disable=line-too-long
from django.conf.urls import url
from django.contrib.auth.views import LogoutView
from django.conf import settings
from .views import pdk_add_data_point, pdk_add_data_bundle, pdk_app_config, pdk_issues, \
pdk_issues_json, pdk_fetch_metadata_json
urlpatterns = [
... | [
"django.conf.urls.url",
"django.contrib.auth.views.LogoutView.as_view"
] | [((320, 390), 'django.conf.urls.url', 'url', (['"""^add-point.json$"""', 'pdk_add_data_point'], {'name': '"""pdk_add_data_point"""'}), "('^add-point.json$', pdk_add_data_point, name='pdk_add_data_point')\n", (323, 390), False, 'from django.conf.urls import url\n'), ((397, 470), 'django.conf.urls.url', 'url', (['"""^add... |
import unittest
from nose.tools import *
from footy.test_data.test_data_paths import premier_league_2015_2016_path
from footy.src.clubs.club_gateway import ClubGateway
class ClubGatewayTest(unittest.TestCase):
def setUp(self):
self.gateway = ClubGateway(premier_league_2015_2016_path)
def test_get_al... | [
"footy.src.clubs.club_gateway.ClubGateway"
] | [((257, 299), 'footy.src.clubs.club_gateway.ClubGateway', 'ClubGateway', (['premier_league_2015_2016_path'], {}), '(premier_league_2015_2016_path)\n', (268, 299), False, 'from footy.src.clubs.club_gateway import ClubGateway\n')] |
"""
Module with reading functionalities of color and magnitude data from photometric and
spectral libraries.
"""
import os
import configparser
from typing import Optional, Tuple
import h5py
import numpy as np
from typeguard import typechecked
from species.core import box
from species.read import read_spectrum
from... | [
"configparser.ConfigParser",
"species.util.phot_util.apparent_to_absolute",
"numpy.where",
"numpy.size",
"numpy.asarray",
"species.core.box.create_box",
"h5py.File",
"os.getcwd",
"numpy.array",
"numpy.isnan",
"species.read.read_spectrum.ReadSpectrum"
] | [((1538, 1565), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1563, 1565), False, 'import configparser\n'), ((8001, 8028), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (8026, 8028), False, 'import configparser\n'), ((1485, 1496), 'os.getcwd', 'os.getcwd', ([... |
"""
Parses league of legend history from my `lolexport.parse` format
from: https://github.com/seanbreckenridge/lolexport
"""
REQUIRES = ["git+https://github.com/seanbreckenridge/lolexport"]
# see https://github.com/seanbreckenridge/dotfiles/blob/master/.config/my/my/config/__init__.py for an example
from my.config i... | [
"itertools.chain",
"my.core.stat",
"my.core.get_files",
"functools.partial",
"datetime.timedelta"
] | [((1211, 1240), 'my.core.get_files', 'get_files', (['config.export_path'], {}), '(config.export_path)\n', (1220, 1240), False, 'from my.core import get_files, Stats, Res, Json, warn_if_empty\n'), ((2398, 2440), 'functools.partial', 'partial', (['_read_parsed_json'], {'username': 'sname'}), '(_read_parsed_json, username... |
# Generated by Django 2.1a1 on 2018-07-30 18:50
import aboutme.models
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Me',
fields=[
('id', ... | [
"django.db.models.ImageField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((320, 413), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (336, 413), False, 'from django.db import migrations, models\... |
import sys
import re
from pprint import pprint
sample = { 'awesome-cancer-variant-databases':
{ 'Cancer':
{
'Clinically-focused':
[{'CanDL': 'https://candl.osu.edu' }],
'Catalogs':
[{ 'COSMIC':
... | [
"pprint.pprint",
"re.compile"
] | [((3054, 3109), 're.compile', 're.compile', (['"""\\\\[([^\\\\]]*)\\\\]\\\\s*\\\\(([^\\\\)]*)\\\\)([^$]*)"""'], {}), "('\\\\[([^\\\\]]*)\\\\]\\\\s*\\\\(([^\\\\)]*)\\\\)([^$]*)')\n", (3064, 3109), False, 'import re\n'), ((2974, 2985), 'pprint.pprint', 'pprint', (['new'], {}), '(new)\n', (2980, 2985), False, 'from pprint... |
from collections import OrderedDict
import logging
import warnings
warnings.filterwarnings("ignore")
logging.basicConfig(filename="runtime.log", \
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', \
datefmt='%d-%b-%y %H:%M:%S', \
level=logging.DEBUG, filemode="a")
import torch
import torch... | [
"logging.basicConfig",
"torch.cuda.is_available",
"torch.no_grad",
"warnings.filterwarnings",
"torch.argmax"
] | [((67, 100), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (90, 100), False, 'import warnings\n'), ((102, 282), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""runtime.log"""', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'da... |
from django import forms
from tablemanager.models import Workspace
from wmsmanager.models import WmsServer,WmsLayer
from borg_utils.form_fields import GeoserverSettingForm,MetaTilingFactorField,GridSetField
from borg_utils.form_fields import GroupedModelChoiceField
class WmsServerForm(forms.ModelForm,GeoserverSetting... | [
"tablemanager.models.Workspace.objects.filter",
"django.forms.BooleanField",
"django.forms.IntegerField",
"tablemanager.models.Workspace.objects.all"
] | [((396, 494), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'label': '"""Max concurrent connections"""', 'initial': '(6)', 'min_value': '(1)', 'max_value': '(128)'}), "(label='Max concurrent connections', initial=6, min_value\n =1, max_value=128)\n", (414, 494), False, 'from django import forms\n'), ((610... |
import tkinter as tk
from pyprocessing.renderer.tkinter.window import Window
class TkRenderer:
def __init__(self, pyprocessing):
self.pp = pyprocessing
self.root = None
self.window = None
self.this = self
def init(self):
self.root = tk.Tk()
w = self.pp.namespac... | [
"pyprocessing.renderer.tkinter.window.Window",
"tkinter.Tk"
] | [((284, 291), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (289, 291), True, 'import tkinter as tk\n'), ((828, 864), 'pyprocessing.renderer.tkinter.window.Window', 'Window', (['self.root', 'self.pyprocessing'], {}), '(self.root, self.pyprocessing)\n', (834, 864), False, 'from pyprocessing.renderer.tkinter.window import Win... |
from uuid import UUID
from fastapi import status, APIRouter
from starlette.requests import Request
from starlette.responses import FileResponse, RedirectResponse
from erica.api.v2.responses.model import response_model_get_tax_number_validity_from_queue, response_model_post_to_queue
from erica.application.JobService.job... | [
"fastapi.APIRouter",
"starlette.responses.FileResponse",
"erica.application.Shared.service_injector.get_service",
"erica.application.JobService.job_service_factory.get_job_service"
] | [((695, 706), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (704, 706), False, 'from fastapi import status, APIRouter\n'), ((1975, 2016), 'erica.application.Shared.service_injector.get_service', 'get_service', (['RequestType.check_tax_number'], {}), '(RequestType.check_tax_number)\n', (1986, 2016), False, 'from e... |
from typing import Tuple
from hypothesis import given
from tests.port_tests.hints import PortedPolygon
from tests.utils import (equivalence,
implication)
from . import strategies
@given(strategies.polygons)
def test_reflexivity(polygon: PortedPolygon) -> None:
assert polygon == polygon
... | [
"hypothesis.given",
"tests.utils.implication",
"tests.utils.equivalence"
] | [((209, 235), 'hypothesis.given', 'given', (['strategies.polygons'], {}), '(strategies.polygons)\n', (214, 235), False, 'from hypothesis import given\n'), ((323, 355), 'hypothesis.given', 'given', (['strategies.polygons_pairs'], {}), '(strategies.polygons_pairs)\n', (328, 355), False, 'from hypothesis import given\n'),... |
from flask import Flask, render_template, request, jsonify, \
redirect, Response, url_for, abort
import helpers
config_dic = helpers.load_config()
# flask app setup
app = Flask(__name__)
app.secret_key = config_dic["app_secret_key"]
@app.route("/", methods=["GET"])
def home():
return render_... | [
"flask.render_template",
"flask.Flask",
"helpers.verify",
"helpers.load_config",
"flask.jsonify"
] | [((146, 167), 'helpers.load_config', 'helpers.load_config', ([], {}), '()\n', (165, 167), False, 'import helpers\n'), ((193, 208), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (198, 208), False, 'from flask import Flask, render_template, request, jsonify, redirect, Response, url_for, abort\n'), ((313, 38... |
from scripts.processing import Processor
import time
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--train", type=str, default='files/mmhsct_dataset.csv', help="--train file_path")
parser.add_argument("--data", type=str, default='files/sr_all_comments_111.csv', help="--data file_path")
parse... | [
"scripts.processing.Processor",
"time.time",
"argparse.ArgumentParser"
] | [((79, 104), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (102, 104), False, 'import argparse\n'), ((756, 767), 'time.time', 'time.time', ([], {}), '()\n', (765, 767), False, 'import time\n'), ((785, 813), 'scripts.processing.Processor', 'Processor', ([], {'settings': 'settings'}), '(settings... |
#!/usr/bin/env python3
from joblib import Parallel, delayed
import os
import sys
from pathlib import Path
from typing import Dict, List
import fire
from logless import get_logger, logged, logged_block
import runnow
from tqdm import tqdm
import uio
code_file = os.path.realpath(__file__)
repo_dir = os.path.dirname(os.p... | [
"uio.delete_file",
"uio.create_text_file",
"fire.Fire",
"logless.get_logger",
"logless.logged",
"uio.ls",
"logless.logged_block",
"pathlib.Path",
"os.path.isdir",
"runnow.run",
"json.loads",
"os.path.dirname",
"uio.create_folder",
"uio.get_text_file_contents",
"uio.list_local_files",
"... | [((262, 288), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (278, 288), False, 'import os\n'), ((477, 524), 'logless.get_logger', 'get_logger', (['"""slalom.dataops.infra"""'], {'debug': 'DEBUG'}), "('slalom.dataops.infra', debug=DEBUG)\n", (487, 524), False, 'from logless import get_logge... |
"""
:copyright: © 2019, <NAME>
:license: Apache License 2.0
"""
from urllib.parse import quote_plus
import requests
from pyquery import PyQuery as pq
from .mobilizer import Mobilizer
class InstapaperMobilizer(Mobilizer):
"""From a URL, get an Instapaper mobilizered HTML"""
mobilizer_url = "http://www.in... | [
"pyquery.PyQuery",
"requests.get"
] | [((581, 608), 'requests.get', 'requests.get', (['mobilizer_url'], {}), '(mobilizer_url)\n', (593, 608), False, 'import requests\n'), ((824, 837), 'pyquery.PyQuery', 'pq', (['r.content'], {}), '(r.content)\n', (826, 837), True, 'from pyquery import PyQuery as pq\n')] |
# ===========================================================================
# imgcv.py ----------------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... | [
"rsvis.utils.imgtools.expand_image_dim",
"PIL.Image.fromarray",
"numpy.logical_and",
"rsvis.utils.imgtools.project_and_stack",
"numpy.asarray",
"rsvis.utils.imgtools.invert_bool_img",
"rsvis.utils.imgtools.bool_to_img",
"PIL.ImageTk.PhotoImage"
] | [((6408, 6438), 'rsvis.utils.imgtools.expand_image_dim', 'imgtools.expand_image_dim', (['img'], {}), '(img)\n', (6433, 6438), True, 'import rsvis.utils.imgtools as imgtools\n'), ((6594, 6614), 'PIL.Image.fromarray', 'Image.fromarray', (['img'], {}), '(img)\n', (6609, 6614), False, 'from PIL import Image, ImageTk\n'), (... |
# -*- coding: utf-8 -*-
# (The MIT License)
#
# Copyright (c) 2013-2021 Kura
#
# 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 limitation the rights
# ... | [
"logging.NullHandler",
"logging.getLogger",
"os.path.join",
"os.getcwd",
"os.chdir",
"tempfile.mkdtemp",
"pytest.fixture"
] | [((1302, 1318), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1316, 1318), False, 'import pytest\n'), ((1393, 1409), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1407, 1409), False, 'import pytest\n'), ((1276, 1297), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (1295, 1297), False,... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"tvm.script.tir.func_attr",
"tvm.script.tir.allocate",
"tvm.script.tir.match_buffer",
"tvm.script.tir.float32",
"pytest.main",
"tvm.script.tir.load",
"tvm.relay.var",
"pytest.importorskip",
"tvm.relay.concatenate",
"tvm.relay.transform.InferType",
"tvm.ir.assert_structural_equal",
"tvm.relay.a... | [((800, 834), 'pytest.importorskip', 'pytest.importorskip', (['"""ethosu.vela"""'], {}), "('ethosu.vela')\n", (819, 834), False, 'import pytest\n'), ((5677, 5695), 'tvm.relay.backend.contrib.ethosu.tir.compiler.lower_to_tir', 'lower_to_tir', (['func'], {}), '(func)\n', (5689, 5695), False, 'from tvm.relay.backend.contr... |
# from django.core.cache import cache
from django.db.models import Sum
from django.http import JsonResponse, Http404, HttpResponse
from django.shortcuts import render, redirect
from django.core.cache import cache
# from django.urls import reverse
# from django.views.decorators.csrf import csrf_exempt
from blog.models... | [
"django.shortcuts.render",
"blog.models.Wheels.objects.all",
"blog.models.Tag.objects.filter",
"django.http.JsonResponse",
"blog.models.FriendsBlog.objects.all",
"django.http.HttpResponse",
"blog.helper.page_cache",
"blog.models.Blog.objects.filter",
"blog.models.Category.objects.filter",
"blog.mo... | [((572, 596), 'blog.helper.page_cache', 'page_cache', (['(60 * 60 * 24)'], {}), '(60 * 60 * 24)\n', (582, 596), False, 'from blog.helper import page_cache\n'), ((1464, 1488), 'blog.helper.page_cache', 'page_cache', (['(60 * 60 * 24)'], {}), '(60 * 60 * 24)\n', (1474, 1488), False, 'from blog.helper import page_cache\n'... |
#! /usr/bin/env python3
#
"""
Plot time series data in an interactive plot viewer.
Usage
=====
$ python3 plot_time_series.py --loglevel=20 --stderr
Plots add new data every second, and update on screen every 5 sec.
24 hours of data is kept. Each plot starts out in "autoaxis X PAN"
and "autoaxis Y VIS".
Things you c... | [
"ginga.plot.data_source.XYDataSource",
"ginga.gw.Widgets.Button",
"ginga.toolkit.use",
"ginga.plot.data_source.update_plot_from_source",
"ginga.plot.time_series.TimePlotTitle",
"ginga.gw.Widgets.HBox",
"ginga.gw.Viewers.CanvasView",
"sys.exit",
"numpy.arange",
"ginga.plot.time_series.TimePlotBG",
... | [((3175, 3186), 'time.time', 'time.time', ([], {}), '()\n', (3184, 3186), False, 'import time\n'), ((3906, 3949), 'ginga.gw.Viewers.CanvasView', 'Viewers.CanvasView', (['logger'], {'render': '"""widget"""'}), "(logger, render='widget')\n", (3924, 3949), False, 'from ginga.gw import Viewers\n'), ((4227, 4243), 'ginga.pl... |
import asyncio
from aioflows.simple import Printer, Ticker
async def start():
await (Ticker() >> Printer()).start()
asyncio.run(start())
| [
"aioflows.simple.Printer",
"aioflows.simple.Ticker"
] | [((92, 100), 'aioflows.simple.Ticker', 'Ticker', ([], {}), '()\n', (98, 100), False, 'from aioflows.simple import Printer, Ticker\n'), ((104, 113), 'aioflows.simple.Printer', 'Printer', ([], {}), '()\n', (111, 113), False, 'from aioflows.simple import Printer, Ticker\n')] |
from functools import wraps
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Type, TypeVar
from graia.amnesia.json import TJson
from graia.amnesia.json.frontend import Json
if TYPE_CHECKING:
from graia.amnesia.transport.common.websocket.io import AbstractWebsocketIO
_S = TypeVar("_S")
_R = TypeVar("_R")... | [
"graia.amnesia.json.frontend.Json.deserialize",
"functools.wraps",
"typing.TypeVar"
] | [((288, 301), 'typing.TypeVar', 'TypeVar', (['"""_S"""'], {}), "('_S')\n", (295, 301), False, 'from typing import TYPE_CHECKING, Any, AnyStr, Callable, Type, TypeVar\n'), ((307, 320), 'typing.TypeVar', 'TypeVar', (['"""_R"""'], {}), "('_R')\n", (314, 320), False, 'from typing import TYPE_CHECKING, Any, AnyStr, Callable... |
#
# download.py
#
# futaba - A Discord Mod bot for the Programming server
# Copyright (c) 2017-2020 <NAME>, <NAME>, jackylam5
#
# futaba is available free of charge under the terms of the MIT
# License. You are free to redistribute and/or modify it under those
# terms. It is distributed in the hopes that it will be use... | [
"logging.getLogger",
"aiohttp.ClientSession",
"io.BytesIO",
"aiohttp.ClientTimeout"
] | [((499, 526), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (516, 526), False, 'import logging\n'), ((801, 845), 'aiohttp.ClientTimeout', 'aiohttp.ClientTimeout', ([], {'total': '(45)', 'sock_read': '(5)'}), '(total=45, sock_read=5)\n', (822, 845), False, 'import aiohttp\n'), ((1269, 127... |
#-*- coding:utf-8 -*-
from __future__ import print_function
import os,sys,sip,time
from datetime import datetime,timedelta
from qtpy.QtWidgets import QTreeWidgetItem,QMenu,QApplication,QAction,QMainWindow
from qtpy import QtGui,QtWidgets
from qtpy.QtCore import Qt,QUrl,QDate
from Graph import graphpage
from layout impo... | [
"qtpy.QtCore.QUrl.fromLocalFile",
"qtpy.QtCore.QDate.fromString",
"Graph.graphpage",
"numpy.array",
"qtpy.QtWidgets.QAction",
"tushare.get_industry_classified",
"datetime.timedelta",
"qtpy.QtWidgets.QTreeWidgetItem",
"pandas.DataFrame",
"layout.Ui_MainWindow",
"qtpy.QtWidgets.QMenu",
"pickle.l... | [((16921, 16943), 'qtpy.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (16933, 16943), False, 'from qtpy.QtWidgets import QTreeWidgetItem, QMenu, QApplication, QAction, QMainWindow\n'), ((564, 579), 'layout.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (577, 579), False, 'from layout ... |
# Licensed to the Encore Technologies ("Encore") under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use... | [
"pip.req.parse_requirements",
"setuptools.find_packages"
] | [((1117, 1174), 'pip.req.parse_requirements', 'parse_requirements', (['requirements_file_path'], {'session': '(False)'}), '(requirements_file_path, session=False)\n', (1135, 1174), False, 'from pip.req import parse_requirements\n'), ((2044, 2076), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']... |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | [
"datasets.utils.file_utils.add_start_docstrings",
"datasets.Value",
"sklearn.metrics.recall_score"
] | [((5732, 5817), 'datasets.utils.file_utils.add_start_docstrings', 'datasets.utils.file_utils.add_start_docstrings', (['_DESCRIPTION', '_KWARGS_DESCRIPTION'], {}), '(_DESCRIPTION,\n _KWARGS_DESCRIPTION)\n', (5778, 5817), False, 'import datasets\n'), ((6833, 6985), 'sklearn.metrics.recall_score', 'recall_score', (['re... |
# Find simplified formula for bank balance sheet change as a result of
# ELA collateral seizure
# <NAME>
# MIT License
################################################################################
# Import SymPy
import sympy as sp
from sympy.abc import eta, gamma
# Define symbols (eta and gamma imported)
A, AD = s... | [
"sympy.symbols",
"sympy.latex"
] | [((319, 338), 'sympy.symbols', 'sp.symbols', (['"""A A_d"""'], {}), "('A A_d')\n", (329, 338), True, 'import sympy as sp\n'), ((346, 363), 'sympy.latex', 'sp.latex', (['lambdaA'], {}), '(lambdaA)\n', (354, 363), True, 'import sympy as sp\n'), ((605, 636), 'sympy.latex', 'sp.latex', (['(expr_npl1 - expr_npl2)'], {}), '(... |
"""
Versions of the base functionality optimized for the NT kernel.
The 9x kernel is just unsupported.
"""
import ctypes
import _winapi
import signal
from . import base
__all__ = ('Process', 'ProcessGroup')
# {{{ win32 API calls
def _falsey_errcheck(result, func, arguments):
if not result:
raise ctypes... | [
"ctypes.WinError",
"ctypes.POINTER"
] | [((797, 832), 'ctypes.POINTER', 'ctypes.POINTER', (['SECURITY_ATTRIBUTES'], {}), '(SECURITY_ATTRIBUTES)\n', (811, 832), False, 'import ctypes\n'), ((314, 331), 'ctypes.WinError', 'ctypes.WinError', ([], {}), '()\n', (329, 331), False, 'import ctypes\n')] |
import collections
import logging
import asyncio
import importlib
import pip
import toastbot.toast as toast
try:
import discord
import discord.ext.commands as commands
except ImportError:
print('Installing discord package...')
pip.main(['install', 'discord'])
import discord
import discord.ext... | [
"importlib.import_module",
"toastbot.botfunctions.logbot.get_log_id",
"toastbot.toast.ToastBot",
"toastbot.configuration.read_api_configuration",
"collections.Counter",
"toastbot.botfunctions.logbot.get_text",
"toastbot.defaultlogger.init_logging",
"toastbot.botfunctions.logbot.LogSessionConfigs.add_l... | [((420, 454), 'importlib.import_module', 'importlib.import_module', (['"""discord"""'], {}), "('discord')\n", (443, 454), False, 'import importlib\n'), ((483, 530), 'importlib.import_module', 'importlib.import_module', (['"""discord.ext.commands"""'], {}), "('discord.ext.commands')\n", (506, 530), False, 'import import... |
import time
from alpha_vantage.fundamentaldata import FundamentalData
def fundamental_download_case(case: int,
ticker: str,
fd):
'''
Due to the API limit of 5 calls per minute, this function was desinged so
that every 5th download can impose a sl... | [
"alpha_vantage.fundamentaldata.FundamentalData",
"time.sleep"
] | [((2391, 2439), 'alpha_vantage.fundamentaldata.FundamentalData', 'FundamentalData', (['api_key'], {'output_format': '"""pandas"""'}), "(api_key, output_format='pandas')\n", (2406, 2439), False, 'from alpha_vantage.fundamentaldata import FundamentalData\n'), ((3307, 3321), 'time.sleep', 'time.sleep', (['(65)'], {}), '(6... |
#Función que calcula la matriz resultante "C" después de aplicar la operación convolución de A*B=
# EJERCICIO 28 DE OCTUBRE
# <NAME> A01377098
import numpy as np
def convolucion (A, B):
contaFil = 0
contaCol = 0
limiteFil = len(A)
limiteCol = len(A)
longitudB = len(B)
for x in range (len(C))... | [
"numpy.array",
"numpy.zeros"
] | [((1153, 1169), 'numpy.array', 'np.array', (['Matriz'], {}), '(Matriz)\n', (1161, 1169), True, 'import numpy as np\n'), ((1174, 1190), 'numpy.array', 'np.array', (['Filtro'], {}), '(Filtro)\n', (1182, 1190), True, 'import numpy as np\n'), ((1196, 1212), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (1204, ... |
# Generated by Django 2.1.8 on 2020-05-27 15:24
import datetime
from django.db import migrations, models
from django.utils.timezone import utc
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ArticleCategory',... | [
"datetime.datetime",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((365, 458), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (381, 458), False, 'from django.db import migrations, models\... |
from flask import Flask, render_template, redirect, session, request
import random
import datetime
app = Flask(__name__)
app.secret_key = "<KEY>"
@app.route('/')
def index():
if not 'gold' in session:
session['gold'] = 0
if not 'log' in session:
session['log'] = ["Thanks for joining the game!"]
return render_t... | [
"flask.render_template",
"flask.Flask",
"flask.redirect",
"datetime.datetime.now",
"flask.session.clear",
"random.randint"
] | [((106, 121), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (111, 121), False, 'from flask import Flask, render_template, redirect, session, request\n'), ((312, 341), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (327, 341), False, 'from flask import Flask, re... |
import cv2 as cv
import matplotlib.pyplot as plt
import random as rd
import pandas as pd
from emotion_icon import load_emotion_icon
angry_man = None
all_image = load_emotion_icon()
# images = pd.DataFrame(all_image)
# print(all_image['angry_man'])
# load
# angry_man = cv.imread("./img/angry_man.jpg... | [
"emotion_icon.load_emotion_icon",
"cv2.waitKey",
"cv2.imread",
"cv2.imshow"
] | [((175, 194), 'emotion_icon.load_emotion_icon', 'load_emotion_icon', ([], {}), '()\n', (192, 194), False, 'from emotion_icon import load_emotion_icon\n'), ((473, 503), 'cv2.imread', 'cv.imread', (['"""./img/123.jpg"""', '(-1)'], {}), "('./img/123.jpg', -1)\n", (482, 503), True, 'import cv2 as cv\n'), ((813, 842), 'cv2.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""This module handles API endpoints"""
# Import builtin python libraries
import json
import logging
import os
import sys
# Import external python libraries
import click
# Import custom (local) python packages
from . import dnac_handler as dnac
# Source code meta data... | [
"logging.debug",
"click.secho",
"os.access",
"os.path.isfile",
"os.path.realpath",
"sys.exit",
"json.load"
] | [((858, 907), 'logging.debug', 'logging.debug', (['f"""Endpoint file: {api_collection}"""'], {}), "(f'Endpoint file: {api_collection}')\n", (871, 907), False, 'import logging\n'), ((915, 945), 'os.path.isfile', 'os.path.isfile', (['api_collection'], {}), '(api_collection)\n', (929, 945), False, 'import os\n'), ((1680, ... |
from django.shortcuts import redirect
def home(request):
return redirect('/ResumeParser') | [
"django.shortcuts.redirect"
] | [((66, 91), 'django.shortcuts.redirect', 'redirect', (['"""/ResumeParser"""'], {}), "('/ResumeParser')\n", (74, 91), False, 'from django.shortcuts import redirect\n')] |
"""
Module For the ScreenOptionsParser
"""
from conjur.version import __version__
from conjur.argument_parser.parser_utils import conjur_copyright
# pylint: disable=too-few-public-methods
class ScreenOptionsParser:
"""Partial class of the ArgParseBuilder.
This class add the ScreenOptions subparser to the ArgP... | [
"conjur.argument_parser.parser_utils.conjur_copyright"
] | [((1094, 1112), 'conjur.argument_parser.parser_utils.conjur_copyright', 'conjur_copyright', ([], {}), '()\n', (1110, 1112), False, 'from conjur.argument_parser.parser_utils import conjur_copyright\n')] |
# -*- coding: utf8 -*-
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="fledgling",
version="0.0.1",
author="Liutos",
author_email="<EMAIL>",
description="Client of nest",
long_description=long_description,
long... | [
"setuptools.find_packages"
] | [((686, 712), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (710, 712), False, 'import setuptools\n')] |
import pyautogui
import time
def increase_volume():
i = 0
while i < 5:
pyautogui.press("volumeup")
i = i + 1
def decrease_volume():
i = 0
while i < 5:
pyautogui.press("volumedown")
i = i + 1
def switch_window():
pyautogui.keyDown('alt')
pyautog... | [
"pyautogui.press",
"pyautogui.keyDown",
"pyautogui.keyUp"
] | [((283, 307), 'pyautogui.keyDown', 'pyautogui.keyDown', (['"""alt"""'], {}), "('alt')\n", (300, 307), False, 'import pyautogui\n'), ((313, 335), 'pyautogui.press', 'pyautogui.press', (['"""tab"""'], {}), "('tab')\n", (328, 335), False, 'import pyautogui\n'), ((341, 363), 'pyautogui.keyUp', 'pyautogui.keyUp', (['"""alt"... |
"""
Run MESS calculations
"""
import os
import mess_io
from mechlib.amech_io import printer as ioprinter
def output(formulastr, final_pf, mess_path, filename='pf.dat'):
""" Write a mess output file for a pf file
"""
mess_out_str = mess_io.writer.pf_output(formulastr, *final_pf)
ioprinter.messpf... | [
"os.path.exists",
"os.makedirs",
"mechlib.amech_io.printer.messpf",
"mess_io.writer.pf_output",
"os.path.join"
] | [((251, 298), 'mess_io.writer.pf_output', 'mess_io.writer.pf_output', (['formulastr', '*final_pf'], {}), '(formulastr, *final_pf)\n', (275, 298), False, 'import mess_io\n'), ((304, 347), 'mechlib.amech_io.printer.messpf', 'ioprinter.messpf', (['"""write_output"""', 'mess_path'], {}), "('write_output', mess_path)\n", (3... |
"""
This module is used to generate correlation (R) and regression (b)
coefficients for relationships between the 2015 Census,
2018 Yale Climate Opinion Maps (YCOM) and land area datasets,
as well as p values for these relationships.
"""
import numpy as np
import pandas as pd
from scipy.stats import linregress
def ca... | [
"pandas.DataFrame",
"scipy.stats.linregress",
"numpy.mean",
"numpy.std"
] | [((2469, 2546), 'pandas.DataFrame', 'pd.DataFrame', (['stats_outputs_standard[:, :, 0]'], {'columns': 'n_census', 'index': 'n_ycom'}), '(stats_outputs_standard[:, :, 0], columns=n_census, index=n_ycom)\n', (2481, 2546), True, 'import pandas as pd\n'), ((2691, 2759), 'pandas.DataFrame', 'pd.DataFrame', (['stats_outputs[... |
import unittest
from pyramid import testing
class Test_parse_settings(unittest.TestCase):
def _callFUT(self, settings):
from pyramid_debugtoolbar import parse_settings
return parse_settings(settings)
def test_it(self):
panels = ('pyramid_debugtoolbar.tests.test_init.DummyPanel\n'
... | [
"pyramid.testing.setUp",
"pyramid_debugtoolbar.parse_settings",
"pyramid_debugtoolbar.includeme"
] | [((196, 220), 'pyramid_debugtoolbar.parse_settings', 'parse_settings', (['settings'], {}), '(settings)\n', (210, 220), False, 'from pyramid_debugtoolbar import parse_settings\n'), ((1672, 1687), 'pyramid.testing.setUp', 'testing.setUp', ([], {}), '()\n', (1685, 1687), False, 'from pyramid import testing\n'), ((1795, 18... |
import subprocess
from vuln_server.outputgrabber import OutputGrabber
from flask import request, redirect, render_template
class SubprocessVuln():
def bypass(self):
if request.method == 'POST':
# Check if data is not empty, post forms has all params defined
# which may be empty a... | [
"flask.render_template",
"vuln_server.outputgrabber.OutputGrabber",
"flask.redirect",
"subprocess.call"
] | [((1015, 1049), 'flask.render_template', 'render_template', (['"""subprocess.html"""'], {}), "('subprocess.html')\n", (1030, 1049), False, 'from flask import request, redirect, render_template\n'), ((978, 999), 'flask.redirect', 'redirect', (['request.url'], {}), '(request.url)\n', (986, 999), False, 'from flask import... |
import pytest
from pyramid_resource import Resource
def test_default_lookup():
class SubResource(Resource):
pass
class MyResource(Resource):
__children__ = {
"sub": SubResource,
}
root = MyResource("request")
sub = root["sub"]
assert isinstance(sub, SubResour... | [
"pytest.raises"
] | [((437, 460), 'pytest.raises', 'pytest.raises', (['KeyError'], {}), '(KeyError)\n', (450, 460), False, 'import pytest\n'), ((1706, 1735), 'pytest.raises', 'pytest.raises', (['AttributeError'], {}), '(AttributeError)\n', (1719, 1735), False, 'import pytest\n')] |
#!/usr/bin/env python3
"""Planningpoker project setup."""
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
# Requirements specified up to the minor version to allow bugfixes to be automatic... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((137, 162), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (152, 162), False, 'import os\n'), ((175, 207), 'os.path.join', 'os.path.join', (['here', '"""README.rst"""'], {}), "(here, 'README.rst')\n", (187, 207), False, 'import os\n'), ((1585, 1616), 'setuptools.find_packages', 'find_packag... |
"""
爬取原网页的html,过滤新闻内容并重新拼接,保留原网页样式。
"""
import pymysql
import datetime
import requests
from lxml import etree
import pdfkit
import os
import time
import json
import re
# 敏感词过滤类,AC自动机
import Ac_auto
# 任务id
task_id = 2
# 爬取的地址和名称
spider_url = 'https://news.cqu.edu.cn/newsv2/'
spider_name = '重大新闻网'
# 爬虫程序爬取主页和首页的运行日期
... | [
"Ac_auto.ac_automation",
"os.path.exists",
"json.loads",
"pdfkit.from_url",
"pdfkit.from_string",
"json.dumps",
"pymysql.connect",
"requests.get",
"os.getcwd",
"time.sleep",
"datetime.datetime.now",
"lxml.etree.HTML",
"os.mkdir",
"time.time",
"re.sub",
"datetime.date.today",
"pdfkit.... | [((404, 542), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""localhost"""', 'port': '(3307)', 'user': '"""root"""', 'passwd': '"""<PASSWORD>"""', 'db': '"""spider_test"""', 'use_unicode': '(True)', 'charset': '"""utf8mb4"""'}), "(host='localhost', port=3307, user='root', passwd=\n '<PASSWORD>', db='spider_t... |
import pandas as pd
import os
import shutil
def get_list_zips_file_path(folder_path):
list_file_path_zip = []
for root, _, files in os.walk(folder_path):
for file_ in files:
file_lower = file_.lower()
if file_lower.endswith(tuple(['.zip', '.rar', '.7z'])):
file... | [
"os.path.join",
"os.path.basename",
"shutil.copy",
"pandas.read_excel",
"pandas.DataFrame",
"pandas.concat",
"os.walk"
] | [((143, 163), 'os.walk', 'os.walk', (['folder_path'], {}), '(folder_path)\n', (150, 163), False, 'import os\n'), ((903, 938), 'pandas.DataFrame', 'pd.DataFrame', (['dict_description_docs'], {}), '(dict_description_docs)\n', (915, 938), True, 'import pandas as pd\n'), ((1037, 1090), 'os.path.join', 'os.path.join', (['fo... |
# Authors: <NAME> <<EMAIL>>
# + All contributors to <https://github.com/smarie/python-pytest-cases>
#
# License: 3-clause BSD, <https://github.com/smarie/python-pytest-cases/blob/master/LICENSE>
import pytest
from pytest_cases import parametrize_with_cases
def case_sum_one_plus_two():
a = 1
b = 2
... | [
"pytest_cases.parametrize_with_cases",
"pytest.raises"
] | [((350, 409), 'pytest_cases.parametrize_with_cases', 'parametrize_with_cases', ([], {'argnames': "['a', 'b', 'c']", 'cases': '"""."""'}), "(argnames=['a', 'b', 'c'], cases='.')\n", (372, 409), False, 'from pytest_cases import parametrize_with_cases\n'), ((471, 530), 'pytest_cases.parametrize_with_cases', 'parametrize_w... |
"""Contains functions to handle roles and permissions"""
import ast
import configparser
import globvars
Config = configparser.ConfigParser()
Config.read("config.INI")
LOBBY_CHANNEL_ID = Config["user"]["LOBBY_CHANNEL_ID"]
SERVER_ID = Config["user"]["SERVER_ID"]
ALIVE_ROLE_ID = Config["user"]["ALIVE_ROLE_ID"]
DEAD_ROL... | [
"ast.literal_eval",
"configparser.ConfigParser"
] | [((115, 142), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (140, 142), False, 'import configparser\n'), ((424, 473), 'ast.literal_eval', 'ast.literal_eval', (["Config['user']['LOCK_ROLES_ID']"], {}), "(Config['user']['LOCK_ROLES_ID'])\n", (440, 473), False, 'import ast\n')] |
# -*- coding: utf-8 -*-
from settings import *
from messages import *
from functions import *
import time
import random
import sqlite3
from aiogram import asyncio
from aiogram import Bot, types
from aiogram.dispatcher import Dispatcher
from aiogram.utils import executor
from aiogram.utils.helper import Helper, HelperMo... | [
"aiogram.utils.helper.ListItem",
"aiogram.contrib.fsm_storage.memory.MemoryStorage",
"aiogram.types.InlineKeyboardButton",
"aiogram.types.ReplyKeyboardMarkup",
"aiogram.contrib.middlewares.logging.LoggingMiddleware",
"aiogram.types.InlineKeyboardMarkup",
"asyncio.sleep",
"aiogram.Bot",
"asyncio.get_... | [((946, 970), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (968, 970), False, 'import asyncio\n'), ((978, 1005), 'aiogram.Bot', 'Bot', ([], {'token': 'token', 'loop': 'loop'}), '(token=token, loop=loop)\n', (981, 1005), False, 'from aiogram import Bot, types\n'), ((1348, 1389), 'aiogram.types.R... |
import asyncio
import time
import itertools
from . import pipeline
from . import protocol
class Splitter(pipeline.Element):
def __init__(self, downstream=None, logger=None):
super().__init__(downstream=downstream, logger=logger)
self.buffer = bytes()
self.buffer_length = 0
self.st... | [
"time.time"
] | [((913, 924), 'time.time', 'time.time', ([], {}), '()\n', (922, 924), False, 'import time\n'), ((1883, 1894), 'time.time', 'time.time', ([], {}), '()\n', (1892, 1894), False, 'import time\n')] |
import numpy as np
from mindspore import context
import mindspore as ms
import mindspore.nn as nn
from mindspore.ops import operations as P
from mindspore import Tensor
from mindspore.common.api import _executor
from tests.ut.python.ops.test_math_ops import VirtualLoss
from mindspore.parallel import set_algo_parameters... | [
"mindspore.common.api._executor._get_strategy",
"numpy.ones",
"mindspore.ops.operations.ReLU",
"mindspore.context.set_context",
"mindspore.nn.BatchNorm2d",
"mindspore.parallel.set_algo_parameters",
"tests.ut.python.ops.test_math_ops.VirtualLoss",
"mindspore.parallel._utils._reset_op_id",
"mindspore.... | [((1523, 1560), 'mindspore.context.set_context', 'context.set_context', ([], {'save_graphs': '(True)'}), '(save_graphs=True)\n', (1542, 1560), False, 'from mindspore import context\n'), ((1565, 1627), 'mindspore.context.set_auto_parallel_context', 'context.set_auto_parallel_context', ([], {'device_num': '(8)', 'global_... |
import random
from card import Card, CardType
class Pile:
def __init__(self, cards):
self.cards = cards
def __getitem__(self, key):
return self.cards[key]
def __str__(self):
representation = f'Pile with {len(self.cards)} cards:\n'
for card in self.cards:
rep... | [
"card.Card",
"random.shuffle"
] | [((916, 942), 'random.shuffle', 'random.shuffle', (['self.cards'], {}), '(self.cards)\n', (930, 942), False, 'import random\n'), ((471, 500), 'card.Card', 'Card', (['None', 'CardType.WILDCARD'], {}), '(None, CardType.WILDCARD)\n', (475, 500), False, 'from card import Card, CardType\n'), ((514, 543), 'card.Card', 'Card'... |
from flask import Flask
from config import DevelopmentConfig
app = Flask(__name__)
app.config.from_object(DevelopmentConfig)
from app import routes,errors | [
"flask.Flask"
] | [((68, 83), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (73, 83), False, 'from flask import Flask\n')] |
import tensorflow as tf
import numpy as np
tf.set_random_seed(777)
data = np.loadtxt('data-04-zoo.csv', delimiter=',', dtype=np.float32)
x_data = data[:, 0:-1]
y_data = data[:, [-1]]
x = tf.placeholder(dtype=tf.float32, shape=[None, 16])
y = tf.placeholder(dtype=tf.int32, shape=[None, 1])
y_ont_hot = tf.one_hot(y, 7)... | [
"tensorflow.one_hot",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.softmax_cross_entropy_with_logits_v2",
"tensorflow.train.GradientDescentOptimizer",
"tensorflow.global_variables_initializer",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.nn.s... | [((43, 66), 'tensorflow.set_random_seed', 'tf.set_random_seed', (['(777)'], {}), '(777)\n', (61, 66), True, 'import tensorflow as tf\n'), ((75, 137), 'numpy.loadtxt', 'np.loadtxt', (['"""data-04-zoo.csv"""'], {'delimiter': '""","""', 'dtype': 'np.float32'}), "('data-04-zoo.csv', delimiter=',', dtype=np.float32)\n", (85... |
# USAGE
# python dlib_face_detector.py --images dataset/gray/test/images --detector models/dlib_face_detector.svm
# import the necessary packages
from imutils import face_utils
from imutils import paths
import numpy as np
import imutils
import argparse
import imutils
import time
import dlib
import cv2
import os
# c... | [
"cv2.rectangle",
"argparse.ArgumentParser",
"imutils.face_utils.rect_to_bb",
"dlib.simple_object_detector",
"cv2.imshow",
"imutils.resize",
"imutils.paths.list_files",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.imread"
] | [((378, 403), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (401, 403), False, 'import argparse\n'), ((792, 837), 'dlib.simple_object_detector', 'dlib.simple_object_detector', (["args['detector']"], {}), "(args['detector'])\n", (819, 837), False, 'import dlib\n'), ((884, 916), 'imutils.paths.l... |
from inliner import inline
class SillyGetterSetter(object):
def __init__(self, stuff):
self.stuff = stuff
@inline
def setStuff(self, obj):
self.stuff = obj
@inline
def getStuff(self):
return self.stuff
@inline
def add_stuff(x, y):
return x + y
def add_lots_of_number... | [
"dis.dis"
] | [((389, 417), 'dis.dis', 'dis.dis', (['add_lots_of_numbers'], {}), '(add_lots_of_numbers)\n', (396, 417), False, 'import dis\n')] |
import ctypes
class CDLL_errno(ctypes.CDLL):
class _FuncPtr(ctypes._CFuncPtr):
_flags_ = ctypes._FUNCFLAG_CDECL | ctypes._FUNCFLAG_USE_ERRNO
_restype_ = ctypes.c_int
def __call__(self, *args):
ctypes.set_errno(0)
try:
return ctypes._CFuncPtr.__call_... | [
"ctypes._CFuncPtr.__call__",
"ctypes.set_errno",
"ctypes.get_errno",
"os.strerror",
"ctypes.CDLL.__init__"
] | [((562, 601), 'ctypes.CDLL.__init__', 'ctypes.CDLL.__init__', (['self', '*args'], {}), '(self, *args, **kw)\n', (582, 601), False, 'import ctypes\n'), ((236, 255), 'ctypes.set_errno', 'ctypes.set_errno', (['(0)'], {}), '(0)\n', (252, 255), False, 'import ctypes\n'), ((296, 334), 'ctypes._CFuncPtr.__call__', 'ctypes._CF... |
from cmx import doc
import gym
import numpy as np
from env_wrappers.flat_env import FlatGoalEnv
from sawyer.misc import space2dict, obs2dict
def test_start():
doc @ """
# Sawyer Blocks Environment
## To-do
- [ ] automatically generate the environment table
We include the following domain... | [
"env_wrappers.flat_env.FlatGoalEnv",
"cmx.doc",
"numpy.array",
"cmx.doc.video",
"sawyer.misc.space2dict",
"numpy.min",
"sawyer.misc.obs2dict",
"cmx.doc.flush",
"gym.make"
] | [((1064, 1102), 'cmx.doc.video', 'doc.video', (['frames', 'f"""videos/reach.gif"""'], {}), "(frames, f'videos/reach.gif')\n", (1073, 1102), False, 'from cmx import doc\n'), ((1107, 1118), 'cmx.doc.flush', 'doc.flush', ([], {}), '()\n', (1116, 1118), False, 'from cmx import doc\n'), ((3801, 3844), 'cmx.doc.video', 'doc.... |
from colorhash import ColorHash
from discord import Embed, Colour
from requests import get
from ics import Calendar
import arrow
URL = "https://cloud.timeedit.net/chalmers/web/public/ri6Y73QQZ55Zn6Q14854Q8Z85640y.ics"
def get_timeline():
c = Calendar(get(URL).text)
return c.timeline
def day(offset):
"""... | [
"arrow.utcnow",
"colorhash.ColorHash",
"discord.Embed",
"requests.get"
] | [((1018, 1032), 'arrow.utcnow', 'arrow.utcnow', ([], {}), '()\n', (1030, 1032), False, 'import arrow\n'), ((2144, 2222), 'discord.Embed', 'Embed', ([], {'title': 'title', 'description': "(location + '\\n' + desc)", 'url': 'link', 'colour': 'color'}), "(title=title, description=location + '\\n' + desc, url=link, colour=... |
import numpy as np
import pandas as pa
import time
from sklearn.metrics import pairwise_distances
from scipy.sparse import csr_matrix
class Kmeans:
def __init__(self,data,k,geneNames,cellNames,cluster_label=None,seed=None):
self.data=data
self.k=k
self.geneNames=geneNames
self.cellN... | [
"numpy.mean",
"sklearn.metrics.pairwise_distances",
"numpy.max",
"numpy.array",
"numpy.random.randint",
"numpy.apply_along_axis",
"numpy.zeros",
"numpy.sum",
"numpy.random.seed",
"numpy.min",
"numpy.argwhere",
"time.time"
] | [((1207, 1238), 'numpy.random.randint', 'np.random.randint', (['(0)', 'n', 'self.k'], {}), '(0, n, self.k)\n', (1224, 1238), True, 'import numpy as np\n'), ((1839, 1877), 'numpy.zeros', 'np.zeros', (['(self.k, self.data.shape[1])'], {}), '((self.k, self.data.shape[1]))\n', (1847, 1877), True, 'import numpy as np\n'), (... |
from django.db import models
from sessions_coding.models import Classroom_session,Subject,Axis,Skill,Learning_goal,Copus_code
DIALOGIC_CHOICES = (
('Autoritativo', 'Autoritativo'),
('Dialogico', 'Dialógico'),
('NA', 'NA'),
)
class Discourse_form(models.Model):
session = models.ForeignKey(Classroom_ses... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((289, 362), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Classroom_session'], {'on_delete': 'models.CASCADE', 'default': '(1)'}), '(Classroom_session, on_delete=models.CASCADE, default=1)\n', (306, 362), False, 'from django.db import models\n'), ((378, 408), 'django.db.models.IntegerField', 'models.IntegerF... |
import FWCore.ParameterSet.Config as cms
allSuperClusterCandidates = cms.EDProducer("ConcreteEcalCandidateProducer",
src = cms.InputTag("hybridSuperClusters"),
particleType = cms.string('gamma')
)
| [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.InputTag"
] | [((128, 163), 'FWCore.ParameterSet.Config.InputTag', 'cms.InputTag', (['"""hybridSuperClusters"""'], {}), "('hybridSuperClusters')\n", (140, 163), True, 'import FWCore.ParameterSet.Config as cms\n'), ((184, 203), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""gamma"""'], {}), "('gamma')\n", (194, 203), True, ... |
#!/usr/bin/python
# coding:utf-8
import sys
sys.path.append('./libs')
import RPi.GPIO as GPIO
from time import sleep
#from libs import snapshot as snap
import snapshot as snap
#from libs import aws_iot_pub as iot
import aws_iot_pub as iot
import commands
#import system
#from subprocess import check_call
import Confi... | [
"RPi.GPIO.cleanup",
"commands.getoutput",
"RPi.GPIO.add_event_detect",
"ConfigParser.SafeConfigParser",
"aws_iot_pub.publish",
"RPi.GPIO.setup",
"time.sleep",
"snapshot.capture_camera",
"sys.path.append",
"RPi.GPIO.setmode"
] | [((45, 70), 'sys.path.append', 'sys.path.append', (['"""./libs"""'], {}), "('./libs')\n", (60, 70), False, 'import sys\n'), ((352, 383), 'ConfigParser.SafeConfigParser', 'ConfigParser.SafeConfigParser', ([], {}), '()\n', (381, 383), False, 'import ConfigParser\n'), ((1032, 1054), 'RPi.GPIO.setmode', 'GPIO.setmode', (['... |
#!/usr/bin/env python
import glob
import logging
import os
import sys
from msspec.calculator import MSSPEC
from msspec.utils import get_atom_index
from msspec.utils import hemispherical_cluster
from msspec.utils import SPRKKRPotential
from ase2sprkkr.sprkkr.calculator import SPRKKR
from ase.build import bulk
loggin... | [
"logging.basicConfig",
"logging.getLogger",
"msspec.calculator.MSSPEC",
"ase2sprkkr.sprkkr.calculator.SPRKKR",
"msspec.utils.get_atom_index",
"msspec.utils.hemispherical_cluster",
"ase.build.bulk",
"glob.glob"
] | [((314, 354), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (333, 354), False, 'import logging\n'), ((364, 391), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (381, 391), False, 'import logging\n'), ((421, 431), 'ase.build.bulk... |
# -*- coding: utf-8 -*-
from dd_invitation import models
from django.contrib import admin
class TokenAdmin(admin.ModelAdmin):
list_display = ('value', 'consumed', 'created')
ordering = ('-created',)
class Media:
js = ('dd_invitation.js',)
admin.site.register(models.Token, TokenAdmin)
| [
"django.contrib.admin.site.register"
] | [((255, 300), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Token', 'TokenAdmin'], {}), '(models.Token, TokenAdmin)\n', (274, 300), False, 'from django.contrib import admin\n')] |
from __future__ import absolute_import
from pyti import catch_errors
from pyti.exponential_moving_average import (
exponential_moving_average as ema
)
def double_exponential_moving_average(data, period):
"""
Double Exponential Moving Average.
Formula:
DEMA = 2*EMA - EMA(EMA)
"""
catch... | [
"pyti.catch_errors.check_for_period_error",
"pyti.exponential_moving_average.exponential_moving_average"
] | [((315, 364), 'pyti.catch_errors.check_for_period_error', 'catch_errors.check_for_period_error', (['data', 'period'], {}), '(data, period)\n', (350, 364), False, 'from pyti import catch_errors\n'), ((382, 399), 'pyti.exponential_moving_average.exponential_moving_average', 'ema', (['data', 'period'], {}), '(data, period... |
import importlib
import os
from PyQt5.QtCore import QSettings
class Continue(BaseException):
pass
class PluginLoader:
loadedPlugins = []
loaded = False
settings = QSettings("plugins.ini", QSettings.IniFormat)
@staticmethod
def getLoadedPlugins():
"""
This returns instance... | [
"os.listdir",
"PyQt5.QtCore.QSettings",
"importlib.import_module"
] | [((185, 230), 'PyQt5.QtCore.QSettings', 'QSettings', (['"""plugins.ini"""', 'QSettings.IniFormat'], {}), "('plugins.ini', QSettings.IniFormat)\n", (194, 230), False, 'from PyQt5.QtCore import QSettings\n'), ((481, 504), 'os.listdir', 'os.listdir', (['"""plugins/."""'], {}), "('plugins/.')\n", (491, 504), False, 'import... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""A More Flexible Video models."""
import math
import torch
import torch.nn as nn
from .build import MODEL_REGISTRY
from .monet import Monet
@MODEL_REGISTRY.register()
class Linear(nn.Module):
"""
Simple linea... | [
"collections.namedtuple",
"torch.nn.Linear",
"torch.flatten"
] | [((1708, 1749), 'collections.namedtuple', 'namedtuple', (['"""MonetConfig"""', 'config_options'], {}), "('MonetConfig', config_options)\n", (1718, 1749), False, 'from collections import namedtuple\n'), ((736, 773), 'torch.nn.Linear', 'nn.Linear', (['(224 * 224 * 3)', 'num_classes'], {}), '(224 * 224 * 3, num_classes)\n... |
import collections
import requests
from sentinels import NOTHING
from ._compat import xrange, iteritems
class LazyQuery(object):
def __init__(self, client, path=None, url=None, query_params=None, page_size=100):
super(LazyQuery, self).__init__()
self._client = client
if url is None:
... | [
"collections.defaultdict"
] | [((618, 659), 'collections.defaultdict', 'collections.defaultdict', (['(lambda : NOTHING)'], {}), '(lambda : NOTHING)\n', (641, 659), False, 'import collections\n')] |
import importlib.util
import logging
import logging.config
import os
import typing as t
from pathlib import Path
import yaml
import xleapp.globals as g
from ..helpers.utils import generate_program_header
StrPath = t.Union[str, os.PathLike[str]]
class ProcessFileFilter(logging.Filter):
def filter(self, recor... | [
"logging.StreamHandler.emit",
"pathlib.Path",
"logging.config.dictConfig",
"logging.FileHandler.__init__",
"xleapp.globals.app.log_folder.exists",
"logging.FileHandler.emit",
"xleapp.globals.app.log_folder.mkdir"
] | [((825, 865), 'logging.StreamHandler.emit', 'logging.StreamHandler.emit', (['self', 'record'], {}), '(self, record)\n', (851, 865), False, 'import logging\n'), ((1429, 1467), 'logging.FileHandler.emit', 'logging.FileHandler.emit', (['self', 'record'], {}), '(self, record)\n', (1453, 1467), False, 'import logging\n'), (... |
from pydantic import Field
from pystratis.api import Model
from pystratis.core.types import uint256
# noinspection PyUnresolvedReferences
class ScheduleVoteWhitelistHashRequest(Model):
"""A request model for the voting/schedulevote-whitelist endpoint.
Args:
hash_id (uint256): The hash to whitelist.
... | [
"pydantic.Field"
] | [((350, 369), 'pydantic.Field', 'Field', ([], {'alias': '"""hash"""'}), "(alias='hash')\n", (355, 369), False, 'from pydantic import Field\n')] |
address_coordinate_cache = {}
def calculate_distance_address_store(address, store):
address_latitude, address_longitude = get_coordinates_for_address(address)
return calculate_distance_between_coordinates(address_latitude, address_longitude, store.latitude, store.longitude)
def calculate_distance_between_co... | [
"json.loads",
"math.sqrt",
"math.cos",
"urllib3.PoolManager",
"math.sin"
] | [((924, 945), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (943, 945), False, 'import urllib3\n'), ((1173, 1191), 'json.loads', 'json.loads', (['r.data'], {}), '(r.data)\n', (1183, 1191), False, 'import json\n'), ((689, 702), 'math.sin', 'sin', (['(dlat / 2)'], {}), '(dlat / 2)\n', (692, 702), False,... |
import os
import logging
from pathlib import Path
import pandas as pd
from simsi_transfer.merging_functions import merge_with_msmsscanstxt, merge_with_summarytxt, merge_with_msmstxt
logger = logging.getLogger(__name__)
def export_annotated_clusters(annotated_clusters, mainpath, pval):
export_csv(annotated_clus... | [
"logging.getLogger",
"os.path.exists",
"os.makedirs",
"pathlib.Path",
"simsi_transfer.merging_functions.merge_with_msmstxt",
"simsi_transfer.merging_functions.merge_with_msmsscanstxt",
"simsi_transfer.merging_functions.merge_with_summarytxt"
] | [((194, 221), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'import logging\n'), ((3872, 3921), 'simsi_transfer.merging_functions.merge_with_msmsscanstxt', 'merge_with_msmsscanstxt', (['clusterfile', 'msmsscansdf'], {}), '(clusterfile, msmsscansdf)\n', (3895, 3921), Fa... |
from django.conf import settings
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from rest_framework import mixins, viewsets
from rest_framework.permissions import AllowAny
from inquest.users.models import User
from inquest.users.permissions import IsUserOrRead... | [
"django.views.decorators.cache.cache_page",
"inquest.users.models.User.objects.all"
] | [((569, 587), 'inquest.users.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (585, 587), False, 'from inquest.users.models import User\n'), ((944, 962), 'inquest.users.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (960, 962), False, 'from inquest.users.models import User\n'), ((694, 72... |
from collections import namedtuple
from re import compile
from sys import exit as sysexit
from typing import List
from util import read_input
DAY = 10
UPPER_LIMIT = 25000
Point = namedtuple("Point", ["x", "y"])
Star = namedtuple("Star", ["position", "velocity"])
line_re = compile(r"position=<(?P<x>[-\s\d]+),(?P<y>[-\... | [
"util.read_input",
"collections.namedtuple",
"sys.exit",
"re.compile"
] | [((181, 212), 'collections.namedtuple', 'namedtuple', (['"""Point"""', "['x', 'y']"], {}), "('Point', ['x', 'y'])\n", (191, 212), False, 'from collections import namedtuple\n'), ((220, 264), 'collections.namedtuple', 'namedtuple', (['"""Star"""', "['position', 'velocity']"], {}), "('Star', ['position', 'velocity'])\n",... |
import csv
from django.contrib.auth.models import User
from jcourse_api.models import Course, Review, FormerCode, Semester
f = open('./data/2021_wenjuan.csv', mode='r', encoding='utf-8-sig')
csv_reader = csv.DictReader(f)
q = []
users = User.objects.filter(username__istartswith='工具人')
for row in csv_reader:
try:... | [
"django.contrib.auth.models.User.objects.get_or_create",
"csv.DictReader",
"jcourse_api.models.Semester.objects.get",
"jcourse_api.models.Course.objects.get",
"jcourse_api.models.Review.objects.filter",
"jcourse_api.models.FormerCode.objects.get",
"django.contrib.auth.models.User.objects.filter",
"jco... | [((207, 224), 'csv.DictReader', 'csv.DictReader', (['f'], {}), '(f)\n', (221, 224), False, 'import csv\n'), ((240, 288), 'django.contrib.auth.models.User.objects.filter', 'User.objects.filter', ([], {'username__istartswith': '"""工具人"""'}), "(username__istartswith='工具人')\n", (259, 288), False, 'from django.contrib.auth.... |
from flask import Flask, render_template, request
from keras.preprocessing.image import img_to_array, load_img
from keras.models import load_model
import cv2
import os
import numpy as np
from flask_cors import CORS, cross_origin
import tensorflow.keras
from PIL import Image, ImageOps
import base64
import json
import dl... | [
"flask.render_template",
"flask_cors.CORS",
"flask.Flask",
"PIL.ImageOps.fit",
"numpy.array",
"cv2.imdecode",
"json.dumps",
"numpy.asarray",
"dlib.shape_predictor",
"dlib.get_frontal_face_detector",
"numpy.squeeze",
"cv2.cvtColor",
"imutils.face_utils.shape_to_np",
"cv2.imread",
"numpy.s... | [((4465, 4480), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (4470, 4480), False, 'from flask import Flask, render_template, request\n'), ((4488, 4497), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (4492, 4497), False, 'from flask_cors import CORS, cross_origin\n'), ((807, 839), 'dlib.get_frontal... |
import multiprocessing
import tlib.conf as conf
bind='0.0.0.0:%s' % conf.get("port")
# workers=multiprocessing.cpu_count() * 2 + 1
# workers=multiprocessing.cpu_count()
workers=10
backlog=2048
worker_class="gevent"
debug=False
daemon=False
timeout=30
| [
"tlib.conf.get"
] | [((70, 86), 'tlib.conf.get', 'conf.get', (['"""port"""'], {}), "('port')\n", (78, 86), True, 'import tlib.conf as conf\n')] |
import os
import pytest
if __name__ == '__main__':
os.environ['PYWEBVIEW_GUI'] = 'win32'
pytest.main() | [
"pytest.main"
] | [((99, 112), 'pytest.main', 'pytest.main', ([], {}), '()\n', (110, 112), False, 'import pytest\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 6 13:17:19 2021
@author: matthew-bailey
"""
from layer_utils import verify_layer_sequence
import pytest
class TestSequenceVerifier:
def test_all_same_type(self):
"""
Test two simple valid sequences.
"""
seq = ... | [
"layer_utils.verify_layer_sequence",
"pytest.raises"
] | [((354, 380), 'layer_utils.verify_layer_sequence', 'verify_layer_sequence', (['seq'], {}), '(seq)\n', (375, 380), False, 'from layer_utils import verify_layer_sequence\n'), ((430, 456), 'layer_utils.verify_layer_sequence', 'verify_layer_sequence', (['seq'], {}), '(seq)\n', (451, 456), False, 'from layer_utils import ve... |
# -*- coding: utf-8 -*-
u"""zgoubi datafile parser
:copyright: Copyright (c) 2018 RadiaSoft LLC. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
from pykern import pkresource
from pykern.pkdebug import pkdc, pkdlog, pk... | [
"sirepo.simulation_db.default_data",
"sirepo.template.template_common.update_model_defaults",
"pykern.pkdebug.pkdlog",
"sirepo.simulation_db.get_schema",
"re.sub",
"sirepo.template.elegant_common.sort_elements_and_beamlines",
"sirepo.template.zgoubi_parser.parse_file",
"re.search"
] | [((512, 547), 'sirepo.simulation_db.get_schema', 'simulation_db.get_schema', (['_SIM_TYPE'], {}), '(_SIM_TYPE)\n', (536, 547), False, 'from sirepo import simulation_db\n'), ((1065, 1102), 'sirepo.simulation_db.default_data', 'simulation_db.default_data', (['_SIM_TYPE'], {}), '(_SIM_TYPE)\n', (1091, 1102), False, 'from ... |
from django.db import models
LINEAGE_CHOICES = (
('startswith', 'startswith'),
('endswith', 'endswith'),
('contains', 'contains'),
('equals', 'equals')
)
class Lineage(models.Model):
parent = models.ForeignKey("self", blank=True, null=True, on_delete=models.CASCADE)
key = models.CharField(ch... | [
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((216, 290), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""'], {'blank': '(True)', 'null': '(True)', 'on_delete': 'models.CASCADE'}), "('self', blank=True, null=True, on_delete=models.CASCADE)\n", (233, 290), False, 'from django.db import models\n'), ((301, 387), 'django.db.models.CharField', 'model... |
"""
Tests of ModelAdmin validation logic.
"""
from django.db import models
class Album(models.Model):
title = models.CharField(max_length=150)
class Song(models.Model):
title = models.CharField(max_length=150)
album = models.ForeignKey(Album)
original_release = models.DateField(editable=False)
... | [
"django.db.models.FloatField",
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.CharField"
] | [((117, 149), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (133, 149), False, 'from django.db import models\n'), ((190, 222), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (206, 222), False, 'from django.d... |