code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import asyncio
from io import BytesIO
import pytest
from asyncssh.connection import SSHClientConnection
from asyncssh.stream import SSHReader
from scrapli.exceptions import ScrapliConnectionNotOpened, ScrapliTimeout
class DumbContainer:
def __init__(self):
self.preferred_auth = ()
def __getattr__(s... | [
"asyncssh.stream.SSHReader",
"io.BytesIO",
"pytest.raises",
"asyncio.sleep",
"asyncio.get_event_loop_policy"
] | [((3113, 3130), 'asyncssh.stream.SSHReader', 'SSHReader', (['""""""', '""""""'], {}), "('', '')\n", (3122, 3130), False, 'from asyncssh.stream import SSHReader\n'), ((3683, 3700), 'asyncssh.stream.SSHReader', 'SSHReader', (['""""""', '""""""'], {}), "('', '')\n", (3692, 3700), False, 'from asyncssh.stream import SSHRea... |
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import plotly.io as pio
from dataProcessor import parseLabels, parseLangs
import plotly.io as pio
import os
years = parseLabels()
langs = parseLangs()
#make the plotly results
fig = make_subplots(
rows=1, cols=2,
specs=[[{"type": "x... | [
"plotly.io.write_html",
"dataProcessor.parseLangs",
"plotly.subplots.make_subplots",
"dataProcessor.parseLabels"
] | [((194, 207), 'dataProcessor.parseLabels', 'parseLabels', ([], {}), '()\n', (205, 207), False, 'from dataProcessor import parseLabels, parseLangs\n'), ((216, 228), 'dataProcessor.parseLangs', 'parseLangs', ([], {}), '()\n', (226, 228), False, 'from dataProcessor import parseLabels, parseLangs\n'), ((262, 337), 'plotly.... |
# Copyright 2019 BDL Benchmarks Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow_datasets.as_numpy",
"os.listdir",
"zipfile.ZipFile",
"tqdm.tqdm",
"numpy.asarray",
"os.path.join",
"inspect.isgenerator",
"absl.logging.info",
"numpy.argsort",
"numpy.zeros",
"numpy.empty_like",
"numpy.concatenate",
"tempfile.NamedTemporaryFile",
"tensorflow_datasets.download.k... | [((1435, 1514), 'os.path.join', 'os.path.join', (['DATA_DIR', '"""downloads"""', '"""manual"""', '"""diabetic_retinopathy_diagnosis"""'], {}), "(DATA_DIR, 'downloads', 'manual', 'diabetic_retinopathy_diagnosis')\n", (1447, 1514), False, 'import os\n'), ((3842, 3855), 'tqdm.tqdm', 'tqdm.tqdm', (['ds'], {}), '(ds)\n', (3... |
import base64
import logging
import msgpack
logger = logging.getLogger(__name__)
loadargs = {'use_list': False, 'raw': False}
if msgpack.version < (1, 0, 0):
loadargs['encoding'] = 'utf-8'
else:
loadargs['strict_map_key'] = False
VSIG = b'MSGVIV'.ljust(8, b'\x00')
def vivEventsAppendFile(filename, events)... | [
"logging.getLogger",
"msgpack.pack",
"base64.b64encode",
"base64.b64decode",
"msgpack.Unpacker"
] | [((55, 82), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (72, 82), False, 'import logging\n'), ((818, 859), 'msgpack.pack', 'msgpack.pack', (['VSIG', 'f'], {'use_bin_type': '(False)'}), '(VSIG, f, use_bin_type=False)\n', (830, 859), False, 'import msgpack\n'), ((1323, 1354), 'msgpack.Un... |
import glob
from os import walk
exclude_folders = [
'node_modules',
'ios',
'android',
'__pycache__'
]
exclude_files = [
'json',
'txt',
'traineddata',
'lstmf',
'yml',
'md'
'log',
'env',
'gitignore',
'dockerignore'
]
# get all files in directory
dirr = '/home/vik... | [
"glob.glob"
] | [((400, 440), 'glob.glob', 'glob.glob', (["(dirr + '/**/')"], {'recursive': '(True)'}), "(dirr + '/**/', recursive=True)\n", (409, 440), False, 'import glob\n'), ((618, 641), 'glob.glob', 'glob.glob', (["(folder + '*')"], {}), "(folder + '*')\n", (627, 641), False, 'import glob\n')] |
from models.contact import Contact
testdata = [Contact(first_name="Firstname", last_name="Lastname", mobile_phone="+12345678",
work_phone="12345", home_phone="67890", fax="55443322", email_1="<EMAIL>",
email_2="<EMAIL>", email_3="<EMAIL>",
... | [
"models.contact.Contact"
] | [((49, 298), 'models.contact.Contact', 'Contact', ([], {'first_name': '"""Firstname"""', 'last_name': '"""Lastname"""', 'mobile_phone': '"""+12345678"""', 'work_phone': '"""12345"""', 'home_phone': '"""67890"""', 'fax': '"""55443322"""', 'email_1': '"""<EMAIL>"""', 'email_2': '"""<EMAIL>"""', 'email_3': '"""<EMAIL>"""'... |
"""Implements the generic progress logger class, and the ProgressBar class.
"""
from tqdm import tqdm, tqdm_notebook
from collections import OrderedDict
import time
SETTINGS = {
'notebook': False
}
def notebook(turn='on'):
SETTINGS['notebook'] = True if (turn == 'on') else False
def troncate_string(s, max_l... | [
"collections.OrderedDict",
"time.time"
] | [((9891, 9938), 'collections.OrderedDict', 'OrderedDict', (['[(bar, None) for bar in self.bars]'], {}), '([(bar, None) for bar in self.bars])\n', (9902, 9938), False, 'from collections import OrderedDict\n'), ((3666, 3679), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3677, 3679), False, 'from collectio... |
# -*- coding: utf-8 -*-
"""
@date Created on Thu Dec 18 13:56:33 2014
@copyright (C) 2014-2015 EOMYS ENGINEERING.
@author pierre_b
"""
from unittest import TestCase
from ddt import ddt, data
from pyleecan.Classes.Arc1 import Arc1
from pyleecan.Classes.Segment import Segment
from pyleecan.Classes.MagnetType11 import... | [
"pyleecan.Methods.Machine.Magnet.comp_surface.comp_surface",
"pyleecan.Classes.LamSlotMag.LamSlotMag",
"numpy.angle",
"numpy.exp",
"pyleecan.Classes.Segment.Segment",
"ddt.data",
"pyleecan.Classes.SlotMPolar.SlotMPolar",
"pyleecan.Classes.MagnetType11.MagnetType11"
] | [((598, 636), 'pyleecan.Classes.LamSlotMag.LamSlotMag', 'LamSlotMag', ([], {'is_internal': '(True)', 'Rext': '(0.5)'}), '(is_internal=True, Rext=0.5)\n', (608, 636), False, 'from pyleecan.Classes.LamSlotMag import LamSlotMag\n'), ((648, 681), 'pyleecan.Classes.SlotMPolar.SlotMPolar', 'SlotMPolar', ([], {'H0': '(0)', 'W... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
"""
from operator import mod
from tomo_encoders.misc.voxel_processing import modified_autocontrast, TimerGPU
from tomo_encoders.reconstruction.recon import recon_patches_3d
import cupy as cp
import numpy as np
from skimage.filters import threshold_otsu
from tomo_en... | [
"cupy.zeros_like",
"numpy.clip",
"numpy.prod",
"tomo_encoders.misc.voxel_processing.TimerGPU",
"tomo_encoders.Grid",
"cupy.cuda.get_elapsed_time",
"cupy.repeat",
"numpy.sum",
"tomo_encoders.reconstruction.recon.recon_patches_3d",
"cupy.sqrt",
"cupy.meshgrid",
"numpy.std",
"cupy.cuda.Event",
... | [((688, 724), 'cupy.meshgrid', 'cp.meshgrid', (['pts', 'pts'], {'indexing': '"""ij"""'}), "(pts, pts, indexing='ij')\n", (699, 724), True, 'import cupy as cp\n'), ((850, 882), 'cupy.repeat', 'cp.repeat', (['circ', 'shape_z'], {'axis': '(0)'}), '(circ, shape_z, axis=0)\n', (859, 882), True, 'import cupy as cp\n'), ((127... |
# Generated by Django 2.2.1 on 2019-06-22 11:03
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='SubscribeModel',
fields=[
('id', models.Aut... | [
"django.db.models.DateTimeField",
"django.db.models.EmailField",
"django.db.models.AutoField"
] | [((310, 403), '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", (326, 403), False, 'from django.db import migrations, models\... |
# -*- coding: UTF-8 -*-
import json
from django.http import HttpResponse
from django.views.decorators.csrf import csrf_exempt
import tushare as ts
from .publiceClass import DateEncoder
@csrf_exempt
def sh_margins(request):
try:
start = request.POST.get('start','')#选填
end = request.POST.get('end','... | [
"django.http.HttpResponse",
"json.dumps",
"tushare.sh_margins"
] | [((341, 366), 'tushare.sh_margins', 'ts.sh_margins', (['start', 'end'], {}), '(start, end)\n', (354, 366), True, 'import tushare as ts\n'), ((676, 703), 'django.http.HttpResponse', 'HttpResponse', (['BaseException'], {}), '(BaseException)\n', (688, 703), False, 'from django.http import HttpResponse\n'), ((743, 758), 'j... |
# Generated by Django 3.1.4 on 2021-05-05 21:16
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('Main', '0071_auto_20210506_0004'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='chooseColor',
... | [
"django.db.migrations.RemoveField"
] | [((224, 288), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""product"""', 'name': '"""chooseColor"""'}), "(model_name='product', name='chooseColor')\n", (246, 288), False, 'from django.db import migrations\n'), ((333, 396), 'django.db.migrations.RemoveField', 'migrations.RemoveFie... |
import json
import setuptools
with open("template/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as fr:
requirements = fr.read().strip().split('\n')
with open('metadata.json') as fr:
metadata = json.load(fr)
setuptools.setup(
name="", # Name of the repository
... | [
"json.load",
"setuptools.find_packages"
] | [((245, 258), 'json.load', 'json.load', (['fr'], {}), '(fr)\n', (254, 258), False, 'import json\n'), ((640, 666), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (664, 666), False, 'import setuptools\n')] |
"""
@Time : 201/21/19 10:41
@Author : TaylorMei
@Email : <EMAIL>
@Project : iccv
@File : train_base3.py
@Function:
"""
import datetime
import os
import torch
from torch import nn
from torch import optim
from torch.autograd import Variable
from torch.backends import cudnn
from torch.utils.data import... | [
"dataset.ImageFolder",
"joint_transforms.RandomRotate",
"loss.lovasz_hinge",
"tensorboardX.SummaryWriter",
"misc.AvgMeter",
"model.base3.BASE3",
"os.path.join",
"torch.nn.DataParallel",
"joint_transforms.Resize",
"datetime.datetime.now",
"torchvision.transforms.Normalize",
"torch.utils.data.Da... | [((1041, 1063), 'misc.check_mkdir', 'check_mkdir', (['ckpt_path'], {}), '(ckpt_path)\n', (1052, 1063), False, 'from misc import AvgMeter, check_mkdir\n'), ((1122, 1162), 'os.path.join', 'os.path.join', (['ckpt_path', 'exp_name', '"""log"""'], {}), "(ckpt_path, exp_name, 'log')\n", (1134, 1162), False, 'import os\n'), (... |
import unittest
from app.models import Comment, Pitch
from app import db
class TestPitchComment(unittest.TestCase):
def setUp(self):
self.new_pitch = Pitch(post = "doit", category='Quotes')
self.new_comment = Comment(comment = "good comment", pitch=self.new_pitch)
def test_instance(se... | [
"app.models.Comment",
"app.models.Pitch"
] | [((164, 201), 'app.models.Pitch', 'Pitch', ([], {'post': '"""doit"""', 'category': '"""Quotes"""'}), "(post='doit', category='Quotes')\n", (169, 201), False, 'from app.models import Comment, Pitch\n'), ((231, 284), 'app.models.Comment', 'Comment', ([], {'comment': '"""good comment"""', 'pitch': 'self.new_pitch'}), "(co... |
from django.shortcuts import render
from django.http import HttpResponse
from django.contrib.auth.decorators import login_required
from django.views.decorators.csrf import csrf_exempt
from django.template import loader
from django.db import connection
from django.http import HttpResponseRedirect
import datetime
from dj... | [
"django.db.connection.cursor",
"django.contrib.auth.decorators.login_required",
"datetime.datetime.today",
"django.template.loader.get_template",
"administrator.models.Course.objects.select_related"
] | [((776, 810), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""/users"""'}), "(login_url='/users')\n", (790, 810), False, 'from django.contrib.auth.decorators import login_required\n'), ((2666, 2711), 'django.template.loader.get_template', 'loader.get_template', (['"""teacher/da... |
import logging
import pytest
import re
from . import text
from ... import matchers
from ...utils import answer, SimpleTrigger
logger = logging.getLogger(__name__)
@pytest.mark.asyncio
async def test_should_run_story_on_equal_message():
trigger = SimpleTrigger()
with answer.Talk() as talk:
story = ta... | [
"logging.getLogger"
] | [((136, 163), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (153, 163), False, 'import logging\n')] |
from flask import Flask
from flask import render_template, request
from flask import jsonify
import requests
import json
app = Flask(__name__)
@app.route("/symbo",methods=['POST'])
def symbo():
#import pdb; pdb.set_trace()
session = requests.session()
token = session.get("https://es.symbolab.com/solver/s... | [
"flask.render_template",
"requests.session",
"flask.Flask"
] | [((128, 143), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (133, 143), False, 'from flask import Flask\n'), ((244, 262), 'requests.session', 'requests.session', ([], {}), '()\n', (260, 262), False, 'import requests\n'), ((1160, 1189), 'flask.render_template', 'render_template', (['"""index.html"""'], {})... |
from pyspark.sql import SparkSession
# spark = SparkSession.builder.master("local[*]").getOrCreate()
spark = SparkSession.builder.getOrCreate()
file_path = "C:\home_work\local_github\Spark-The-Definitive-Guide\data\/flight-data\csv\/2015-summary.csv"
# COMMAND ----------
# COMMAND ----------
flightData2015 = spa... | [
"pyspark.sql.functions.col",
"pyspark.sql.SparkSession.builder.getOrCreate",
"pyspark.sql.functions.desc"
] | [((111, 145), 'pyspark.sql.SparkSession.builder.getOrCreate', 'SparkSession.builder.getOrCreate', ([], {}), '()\n', (143, 145), False, 'from pyspark.sql import SparkSession\n'), ((876, 888), 'pyspark.sql.functions.col', 'col', (['"""count"""'], {}), "('count')\n", (879, 888), False, 'from pyspark.sql.functions import m... |
import os
import pickle
import pytest
import pandas as pd
from shapely import wkt
from intake_postgres import PostgresSource
from intake import open_catalog
from .util import verify_datasource_interface
TEST_DATA_DIR = 'tests'
TEST_DATA = [
('sample1', 'sample1.csv'),
('sample2_1', 'sample2_1.csv'),
('sa... | [
"pandas.read_sql_query",
"intake.open_catalog",
"pandas.read_csv",
"pickle.dumps",
"pickle.loads",
"sqlalchemy.create_engine",
"shapely.wkt.loads",
"os.path.join",
"pytest.mark.parametrize",
"sqlalchemy.MetaData",
"pytest.fixture"
] | [((736, 766), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (750, 766), False, 'import pytest\n'), ((1804, 1854), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""table_name,_"""', 'TEST_DATA'], {}), "('table_name,_', TEST_DATA)\n", (1827, 1854), False, 'import py... |
import numpy as np
class DataGenerator:
def __init__(self, inputs, shuffle=True, batch_size=32):
assert len(inputs) > 0
self.inputs = inputs
self.idx = np.arange(len(inputs[0]))
self.shuffle = shuffle
self.batch_size = batch_size
self.on_epoch_end()
def data_le... | [
"numpy.random.shuffle"
] | [((831, 858), 'numpy.random.shuffle', 'np.random.shuffle', (['self.idx'], {}), '(self.idx)\n', (848, 858), True, 'import numpy as np\n')] |
from nltk.tokenize import sent_tokenize, word_tokenize
from nltk.corpus import stopwords
import speech_recognition as sr
import nltk
from google_images_download import google_images_download
response = google_images_download.googleimagesdownload()
r = sr.Recognizer()
with sr.Microphone() as source:
print("Say some... | [
"nltk.corpus.stopwords.words",
"google_images_download.google_images_download.googleimagesdownload",
"nltk.tokenize.word_tokenize",
"speech_recognition.Recognizer",
"speech_recognition.Microphone"
] | [((203, 248), 'google_images_download.google_images_download.googleimagesdownload', 'google_images_download.googleimagesdownload', ([], {}), '()\n', (246, 248), False, 'from google_images_download import google_images_download\n'), ((253, 268), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (266, 2... |
# Copyright (c) 2009-2021 The Regents of the University of Michigan
# This file is part of the HOOMD-blue project, released under the BSD 3-Clause
# License.
"""MPI communicator."""
from hoomd import _hoomd
import hoomd
import contextlib
class Communicator(object):
"""MPI communicator.
Args:
mpi_c... | [
"hoomd._hoomd.MPIConfiguration",
"hoomd._hoomd.MPIConfiguration._make_mpi_conf_mpi_comm",
"hoomd._hoomd.mpi_barrier_world",
"mpi4py.MPI._addressof"
] | [((1818, 1843), 'hoomd._hoomd.MPIConfiguration', '_hoomd.MPIConfiguration', ([], {}), '()\n', (1841, 1843), False, 'from hoomd import _hoomd\n'), ((5167, 5193), 'hoomd._hoomd.mpi_barrier_world', '_hoomd.mpi_barrier_world', ([], {}), '()\n', (5191, 5193), False, 'from hoomd import _hoomd\n'), ((2718, 2775), 'hoomd._hoom... |
import _ast
from peon.src.project.file.function_def.function import FunctionLint
class ReflectionAtLineFixture:
empty_node = _ast.Pass
is_instance_at_first_lvl = _ast.FunctionDef(id='isinstance', lineno=1)
type_at_first_lvl = _ast.FunctionDef(id='type', lineno=1)
is_instance_at_second_lvl = _ast.Func... | [
"_ast.Expr",
"_ast.FunctionDef",
"peon.src.project.file.function_def.function.FunctionLint"
] | [((173, 216), '_ast.FunctionDef', '_ast.FunctionDef', ([], {'id': '"""isinstance"""', 'lineno': '(1)'}), "(id='isinstance', lineno=1)\n", (189, 216), False, 'import _ast\n'), ((241, 278), '_ast.FunctionDef', '_ast.FunctionDef', ([], {'id': '"""type"""', 'lineno': '(1)'}), "(id='type', lineno=1)\n", (257, 278), False, '... |
###############################################################################
# #
'''Website Database-connection-related features''' #
# #
... | [
"cymysql.connect",
"time.gmtime"
] | [((1043, 1121), 'cymysql.connect', 'cymysql.connect', ([], {'host': 'db_host', 'port': 'db_port', 'user': 'db_user', 'passwd': 'db_pw', 'db': 'db'}), '(host=db_host, port=db_port, user=db_user, passwd=db_pw, db=db)\n', (1058, 1121), False, 'import cymysql\n'), ((1722, 1730), 'time.gmtime', 'gmtime', ([], {}), '()\n', (... |
"""
Proxmox VE exporter for the Prometheus monitoring system.
"""
import sys
from argparse import ArgumentParser
from pve_exporter.http import start_http_server
def main(args=None):
"""
Main entry point.
"""
parser = ArgumentParser()
parser.add_argument('config', nargs='?', default='pve.yml',
... | [
"pve_exporter.http.start_http_server",
"argparse.ArgumentParser"
] | [((236, 252), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (250, 252), False, 'from argparse import ArgumentParser\n'), ((741, 802), 'pve_exporter.http.start_http_server', 'start_http_server', (['params.config', 'params.port', 'params.address'], {}), '(params.config, params.port, params.address)\n', (... |
#SPDX-License-Identifier: MIT
import logging, os, sys, time, requests, json
from datetime import datetime
from multiprocessing import Process, Queue
import pandas as pd
import sqlalchemy as s
from workers.worker_base import Worker
# NOTE: This worker primarily inserts rows into the REPO_INFO table, which serves the pr... | [
"json.dumps",
"requests.post",
"requests.get"
] | [((10670, 10709), 'requests.get', 'requests.get', (['url'], {'headers': 'self.headers'}), '(url, headers=self.headers)\n', (10682, 10709), False, 'import logging, os, sys, time, requests, json\n'), ((11137, 11176), 'requests.get', 'requests.get', (['url'], {'headers': 'self.headers'}), '(url, headers=self.headers)\n', ... |
# coding: utf-8
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from __future__ import unicode_literals
import argparse
def parse_args_tolerance():
parser = argparse.ArgumentParser(description='just for tolerance')
parser.add_argument("--tolerance"... | [
"argparse.ArgumentParser"
] | [((225, 282), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""just for tolerance"""'}), "(description='just for tolerance')\n", (248, 282), False, 'import argparse\n'), ((575, 628), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'main_description'}), '(descript... |
import math
class Schedule():
def __init__(self, total, batch_size):
self._batch_size = batch_size
self._state = ""
self.total = total
self.scheduled = 0
self.finished = 0
@property
def _batch(self):
return math.ceil(self.scheduled / self._batch_size)
... | [
"math.ceil"
] | [((272, 316), 'math.ceil', 'math.ceil', (['(self.scheduled / self._batch_size)'], {}), '(self.scheduled / self._batch_size)\n', (281, 316), False, 'import math\n'), ((371, 411), 'math.ceil', 'math.ceil', (['(self.total / self._batch_size)'], {}), '(self.total / self._batch_size)\n', (380, 411), False, 'import math\n')] |
# -*- coding: utf-8 -*-
""" Function that implement Complement the Complementary Cumulative
Distribution Function (CCDF).
"""
#
# written by <NAME> <<EMAIL>>
import numpy as np
import pandas as pd
def ccdf(s):
"""
Parameters:
`s`, series, the values of s should be variable to be handled
Return:
... | [
"pandas.Series",
"numpy.inner"
] | [((946, 982), 'pandas.Series', 'pd.Series', (['cumulative'], {'index': 's.index'}), '(cumulative, index=s.index)\n', (955, 982), True, 'import pandas as pd\n'), ((1463, 1499), 'pandas.Series', 'pd.Series', (['cumulative'], {'index': 's.index'}), '(cumulative, index=s.index)\n', (1472, 1499), True, 'import pandas as pd\... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import pandas as pd
from lifelines.fitters import UnivariateFitter
from lifelines.utils import _preprocess_inputs, _additive_estimate, StatError, inv_normal_cdf,\
median_survival_times
from lifelines.plotting import plot_loglogs
cla... | [
"lifelines.utils._additive_estimate",
"numpy.sqrt",
"numpy.log",
"lifelines.utils._preprocess_inputs",
"lifelines.utils.StatError",
"numpy.exp",
"lifelines.utils.inv_normal_cdf",
"pandas.DataFrame",
"numpy.seterr",
"lifelines.utils.median_survival_times",
"lifelines.plotting.plot_loglogs"
] | [((2218, 2280), 'lifelines.utils._preprocess_inputs', '_preprocess_inputs', (['durations', 'event_observed', 'timeline', 'entry'], {}), '(durations, event_observed, timeline, entry)\n', (2236, 2280), False, 'from lifelines.utils import _preprocess_inputs, _additive_estimate, StatError, inv_normal_cdf, median_survival_t... |
import numpy as np
from pydmfet import tools
from .fermi import find_efermi, entropy_corr
from pyscf import ao2mo, gto, scf, dft, lib
from pydmfet.qcwrap import fermi
import time
from functools import reduce
def scf_oei( OEI, Norb, Nelec, smear_sigma = 0.0):
OEI = 0.5*(OEI.T + OEI)
eigenvals, eigenvecs = np.l... | [
"time.clock",
"numpy.einsum",
"pyscf.ao2mo.restore",
"pydmfet.tools.op_ao2sub",
"pydmfet.tools.timer",
"numpy.asarray",
"numpy.dot",
"pydmfet.tools.dm_sub2ao",
"numpy.linalg.eigh",
"pyscf.dft.rks.prune_small_rho_grids_",
"pyscf.scf.RKS",
"numpy.eye",
"time.time",
"numpy.set_printoptions",
... | [((316, 335), 'numpy.linalg.eigh', 'np.linalg.eigh', (['OEI'], {}), '(OEI)\n', (330, 335), True, 'import numpy as np\n'), ((686, 700), 'numpy.zeros', 'np.zeros', (['Norb'], {}), '(Norb)\n', (694, 700), True, 'import numpy as np\n'), ((1036, 1068), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)... |
"""Unit tests."""
import inspect
import json
from mock import Mock
import os
import sys
import uuid
import pytest
# Add the lambda directory to the python library search path
lambda_dir = os.path.join(
os.path.dirname(inspect.getfile(inspect.currentframe())), '..')
sys.path.append(lambda_dir)
import lambdautils... | [
"mock.Mock",
"inspect.currentframe",
"json.dumps",
"uuid.uuid4",
"pytest.mark.parametrize",
"pytest.raises",
"sys.path.append"
] | [((273, 300), 'sys.path.append', 'sys.path.append', (['lambda_dir'], {}), '(lambda_dir)\n', (288, 300), False, 'import sys\n'), ((330, 612), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""key,environment,stage,namespace,table,nkey"""', "[('k', 'e', 's', None, 'e-s-secrets', 'k'), ('k', 'e', None, None,\n ... |
import os
from testr.packages import make_regress_files
regress_files = ['starcheck.txt',
'starcheck/pcad_att_check.txt']
clean = {'starcheck.txt': [(r'\s*Run on.*[\n\r]*', ''),
(os.environ['SKA'], '')],
'starcheck/pcad_att_check.txt': [(os.environ['SKA'], '')]}
m... | [
"testr.packages.make_regress_files"
] | [((319, 365), 'testr.packages.make_regress_files', 'make_regress_files', (['regress_files'], {'clean': 'clean'}), '(regress_files, clean=clean)\n', (337, 365), False, 'from testr.packages import make_regress_files\n')] |
from django.test import TestCase
from .validators import validate_budget_period
from .models import Budget, Expense, Payment
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
class ExpenseTestCases(TestCase):
def setUp(self) -> None:
user = User.objects.create... | [
"django.contrib.auth.models.User.objects.create",
"django.contrib.auth.models.User.objects.create_user"
] | [((301, 372), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""joe"""'], {'email': '"""<EMAIL>"""', 'password': '"""<PASSWORD>"""'}), "('joe', email='<EMAIL>', password='<PASSWORD>')\n", (325, 372), False, 'from django.contrib.auth.models import User\n'), ((2948, 3023), 'django.c... |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
from spack.package import *
class Abacus(MakefilePackage):
"""ABACUS (Atomic-orbital Based Ab-initio Com... | [
"re.compile"
] | [((2657, 2688), 're.compile', 're.compile', (['"""^ELPA_INCLUDE_DIR"""'], {}), "('^ELPA_INCLUDE_DIR')\n", (2667, 2688), False, 'import re\n'), ((2708, 2737), 're.compile', 're.compile', (['"""^ELPA_LIB\\\\s*= """'], {}), "('^ELPA_LIB\\\\s*= ')\n", (2718, 2737), False, 'import re\n')] |
import cv2
import numpy as np
def process_core(image):
'''
Returns an inverted preprocessed binary image, with noise
reduction achieved with greyscaling, Gaussian Blur, Otsu's Threshold, and
an open morph.
'''
#apply greyscaling, Gaussian Blur, and Otsu's Threshold
greyscale = cv2.cvtColor... | [
"cv2.HoughLinesP",
"cv2.threshold",
"cv2.arcLength",
"cv2.line",
"numpy.diff",
"cv2.contourArea",
"cv2.morphologyEx",
"numpy.zeros",
"cv2.cvtColor",
"cv2.findContours",
"cv2.GaussianBlur",
"cv2.getStructuringElement"
] | [((308, 347), 'cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2GRAY'], {}), '(image, cv2.COLOR_BGR2GRAY)\n', (320, 347), False, 'import cv2\n'), ((359, 397), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['greyscale', '(3, 3)', '(0)'], {}), '(greyscale, (3, 3), 0)\n', (375, 397), False, 'import cv2\n'), ((561, 610)... |
"""
MIT License
Copyright (c) 2018 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"csv.DictWriter",
"csv.DictReader",
"os.access",
"os.path.isfile",
"datetime.date.today"
] | [((5034, 5059), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (5048, 5059), False, 'import os\n'), ((5072, 5101), 'os.access', 'os.access', (['file_path', 'os.R_OK'], {}), '(file_path, os.R_OK)\n', (5081, 5101), False, 'import os\n'), ((5445, 5470), 'os.path.isfile', 'os.path.isfile', (['fil... |
from PyQt4.QtGui import QImage, QPainter
from PyQt4.QtCore import QSize
# configure the output image
width = 800
height = 600
dpi = 92
img = QImage(QSize(width, height), QImage.Format_RGB32)
img.setDotsPerMeterX(dpi / 25.4 * 1000)
img.setDotsPerMeterY(dpi / 25.4 * 1000)
# get the map layers and extent
layers ... | [
"PyQt4.QtGui.QPainter",
"PyQt4.QtCore.QSize"
] | [((845, 855), 'PyQt4.QtGui.QPainter', 'QPainter', ([], {}), '()\n', (853, 855), False, 'from PyQt4.QtGui import QImage, QPainter\n'), ((154, 174), 'PyQt4.QtCore.QSize', 'QSize', (['width', 'height'], {}), '(width, height)\n', (159, 174), False, 'from PyQt4.QtCore import QSize\n'), ((606, 626), 'PyQt4.QtCore.QSize', 'QS... |
from django.db import router
from django.db.models import Q, Manager
from django.db import connections
from .contenttypes import ct, get_content_type
from .query import GM2MTgtQuerySet
class GM2MBaseManager(Manager):
use_in_migration = True
def __init__(self, instance):
super(GM2MBaseM... | [
"django.db.models.Q",
"django.db.router.db_for_read",
"django.db.router.db_for_write"
] | [((3080, 3137), 'django.db.router.db_for_write', 'router.db_for_write', (['self.through'], {'instance': 'self.instance'}), '(self.through, instance=self.instance)\n', (3099, 3137), False, 'from django.db import router\n'), ((3642, 3699), 'django.db.router.db_for_write', 'router.db_for_write', (['self.through'], {'insta... |
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
import logging
import coloredlogs
import os
import pathlib
import time
import twitter as tt
from utils import retry
from fetch_likes import get_user_likes, login
from conf.settings import USER_ID, USERNAME, PASSWORD
CURR_PATH = path... | [
"logging.basicConfig",
"selenium.webdriver.chrome.options.Options",
"logging.getLogger",
"twitter.get_username_from_id",
"twitter.get_url",
"coloredlogs.install",
"twitter.get_tweets",
"pathlib.Path",
"selenium.webdriver.Chrome",
"logging.Formatter",
"os.path.join",
"fetch_likes.get_user_likes... | [((373, 411), 'os.path.join', 'os.path.join', (['CURR_PATH', '"""screenshots"""'], {}), "(CURR_PATH, 'screenshots')\n", (385, 411), False, 'import os\n'), ((427, 474), 'os.path.join', 'os.path.join', (['CURR_PATH', '"""screenshots"""', '"""liked"""'], {}), "(CURR_PATH, 'screenshots', 'liked')\n", (439, 474), False, 'im... |
from runner import runner
if __name__ == '__main__':
r = runner()
p = 'public class main{public static void main (String[] args){' \
'public String StudentAnswer(String myInput){' \
'return "myOutput"; ' \
'}System.out.println("hello world!");}}'
print (r.sendCode(p, '')) | [
"runner.runner"
] | [((62, 70), 'runner.runner', 'runner', ([], {}), '()\n', (68, 70), False, 'from runner import runner\n')] |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import pytest
import numpy as np
import sklearn.metrics as skm
import fairlearn.metrics as metrics
# ======================================================
a = "a"
b = "b"
c = "c"
Y_true = [0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0... | [
"numpy.random.rand",
"sklearn.metrics.precision_score",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.r2_score",
"sklearn.metrics.zero_one_loss",
"fairlearn.metrics.group_accuracy_score",
"numpy.asarray",
"fairlearn.metrics.group_roc_auc_score",
"fairlearn.metri... | [((2279, 2346), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_tuple"""', 'supported_metrics_unweighted'], {}), "('func_tuple', supported_metrics_unweighted)\n", (2302, 2346), False, 'import pytest\n'), ((2896, 2968), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_tuple"""', 'support... |
"""
Adapted from OpenAI Baselines.
"""
import numpy as np
import tensorflow as tf # pylint: ignore-module
import random
import copy
import os
import functools
import collections
import multiprocessing
def switch(condition, then_expression, else_expression):
"""Switches between two operations depending on a scala... | [
"numpy.prod",
"tensorflow.tanh",
"tensorflow.split",
"tensorflow.get_default_session",
"multiprocessing.cpu_count",
"tensorflow.gradients",
"tensorflow.group",
"tensorflow.cast",
"tensorflow.variables_initializer",
"tensorflow.set_random_seed",
"tensorflow.clip_by_global_norm",
"cloudpickle.lo... | [((1837, 1931), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'inter_op_parallelism_threads': 'num_cpu', 'intra_op_parallelism_threads': 'num_cpu'}), '(inter_op_parallelism_threads=num_cpu,\n intra_op_parallelism_threads=num_cpu)\n', (1851, 1931), True, 'import tensorflow as tf\n'), ((2277, 2295), 'functools.wra... |
from functools import wraps
from werkzeug.exceptions import HTTPException
from api.exceptions import MessageNotFound
def api_error_handler(func):
@wraps(func)
def handle_errors(*args, **kwargs):
try:
return func(*args, **kwargs)
except MessageNotFound as e:
return e.mes... | [
"functools.wraps"
] | [((153, 164), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (158, 164), False, 'from functools import wraps\n')] |
"""Command to run Nile scripts."""
import logging
from importlib.machinery import SourceFileLoader
from nile.nre import NileRuntimeEnvironment
def run(path, network):
"""Run nile scripts passing on the NRE object."""
logger = logging.getLogger()
logger.disabled = True
script = SourceFileLoader("scrip... | [
"logging.getLogger",
"importlib.machinery.SourceFileLoader",
"nile.nre.NileRuntimeEnvironment"
] | [((237, 256), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (254, 256), False, 'import logging\n'), ((354, 385), 'nile.nre.NileRuntimeEnvironment', 'NileRuntimeEnvironment', (['network'], {}), '(network)\n', (376, 385), False, 'from nile.nre import NileRuntimeEnvironment\n'), ((297, 329), 'importlib.machi... |
#!/usr/bin/env python
import setuptools
from setuptools import setup
from os import path
# Read the package requirements
with open("requirements.txt", "r") as f:
requirements = [line.rstrip("\n") for line in f if line != "\n"]
# Read the contents of the README file
this_directory = path.abspath(path.dirname(__fi... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((303, 325), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (315, 325), False, 'from os import path\n'), ((337, 375), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (346, 375), False, 'from os import path\n'), ((562, 588), 'setuptool... |
import os
import pandas as pd
class LiveProjectPopularityBasedRecs:
def __init__(self):
self.charts = {}
charts_folder = "charts"
if os.path.isdir(charts_folder):
for file in os.listdir("charts"):
name, ext = file.split('.')
if ext == "csv" an... | [
"os.listdir",
"os.path.isdir"
] | [((165, 193), 'os.path.isdir', 'os.path.isdir', (['charts_folder'], {}), '(charts_folder)\n', (178, 193), False, 'import os\n'), ((220, 240), 'os.listdir', 'os.listdir', (['"""charts"""'], {}), "('charts')\n", (230, 240), False, 'import os\n')] |
#!../env/bin/python
"""A simple test script for the PCE portion of OnRamp.
Usage: ./test_pce.py
This script is only intended to be run in a fresh install of the repository. It
has side-effects that could corrupt module and user data if run in a production
setting.
Prior to running this script, ensure that onramp/pce... | [
"nose.main",
"sys.exit"
] | [((635, 646), 'nose.main', 'nose.main', ([], {}), '()\n', (644, 646), False, 'import nose\n'), ((618, 629), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (626, 629), False, 'import sys\n')] |
from sanic import Blueprint
from sanic_transmute import add_route
from .views import (
get_all,
get_status_by_country_id,
get_status_by_country_name,
get_deaths,
get_active_cases,
get_recovered_cases,
get_confirmed_cases,
list_countries,
)
cases = Blueprint("cases", url_prefix="/cases")... | [
"sanic.Blueprint",
"sanic_transmute.add_route"
] | [((281, 320), 'sanic.Blueprint', 'Blueprint', (['"""cases"""'], {'url_prefix': '"""/cases"""'}), "('cases', url_prefix='/cases')\n", (290, 320), False, 'from sanic import Blueprint\n'), ((321, 346), 'sanic_transmute.add_route', 'add_route', (['cases', 'get_all'], {}), '(cases, get_all)\n', (330, 346), False, 'from sani... |
# -*- coding:utf-8 -*-
# edit by fuzongfei
import base64
import datetime
# Create your views here.
import json
from django.http import Http404, HttpResponse
from django.utils import timezone
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters
from rest_framework.exceptions ... | [
"sqlorders.models.ReleaseVersions.objects.filter",
"sqlorders.serializers.ExecuteMultiTasksSerializer",
"sqlorders.models.DbEnvironment.objects.all",
"sqlorders.serializers.IncepSyntaxCheckSerializer",
"sqlorders.models.DbOrdersExecuteTasks.objects.filter",
"datetime.timedelta",
"sqlorders.models.Releas... | [((868, 902), 'sqlorders.models.DbEnvironment.objects.all', 'models.DbEnvironment.objects.all', ([], {}), '()\n', (900, 902), False, 'from sqlorders import models, serializers\n'), ((3250, 3279), 'sqlorders.models.DbOrders.objects.all', 'models.DbOrders.objects.all', ([], {}), '()\n', (3277, 3279), False, 'from sqlorde... |
# Importing Fernet class
from cryptography.fernet import Fernet
# Importing dump and load function
from pickle import dump,load
# To generate a strong pw
def generate_pw():
from random import choice
choices = list("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()_-+=.,/<>?;:\\|[... | [
"random.choice",
"pickle.dump",
"pickle.load",
"pyperclip.copy",
"cryptography.fernet.Fernet"
] | [((2100, 2108), 'pyperclip.copy', 'copy', (['pw'], {}), '(pw)\n', (2104, 2108), False, 'from pyperclip import copy\n'), ((379, 394), 'random.choice', 'choice', (['choices'], {}), '(choices)\n', (385, 394), False, 'from random import choice\n'), ((608, 618), 'pickle.load', 'load', (['file'], {}), '(file)\n', (612, 618),... |
from django.db import models
from django.utils import timezone
# Course Category
class Course_category(models.Model):
category_id = models.AutoField(primary_key=True)
category_name = models.CharField(max_length=100)
date_of_creation = models.DateTimeField(default=timezone.now)
# Course Subcategory
class ... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((137, 171), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (153, 171), False, 'from django.db import models\n'), ((192, 224), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (208, 224), False, 'from djan... |
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
urlpatterns = [
# Examples:
# url(r'^$', 'evetool.views.home', name='home'),
url(r'^', include('users.urls')),
url(r'^', include('apis.urls')),
] + static(settings.STATIC_URL, document_... | [
"django.conf.urls.include",
"django.conf.urls.static.static"
] | [((283, 346), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (289, 346), False, 'from django.conf.urls.static import static\n'), ((218, 239), 'django.conf.urls.include', 'include', (['"""use... |
from rest_framework import serializers
from applications.models import Application
class ApplicationSerializer(serializers.Serializer):
content = serializers.JSONField()
portfolio = serializers.FileField()
class ApplicationAdminSerializer(serializers.ModelSerializer):
class Meta:
model = Appli... | [
"rest_framework.serializers.FileField",
"rest_framework.serializers.JSONField"
] | [((154, 177), 'rest_framework.serializers.JSONField', 'serializers.JSONField', ([], {}), '()\n', (175, 177), False, 'from rest_framework import serializers\n'), ((194, 217), 'rest_framework.serializers.FileField', 'serializers.FileField', ([], {}), '()\n', (215, 217), False, 'from rest_framework import serializers\n')] |
from pathlib import Path
import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder
# api_token = "<KEY>"
# brand_center = "mdanderson.co1"
# data_center = "iad1"
# headers = {"x-api-token": api_token}
class QualtricsTool:
"""Data model to manage Qualtrics-related tools
Parameters:
... | [
"requests.post",
"pathlib.Path",
"requests_toolbelt.multipart.encoder.MultipartEncoder",
"requests.get",
"requests.delete"
] | [((4027, 4066), 'requests_toolbelt.multipart.encoder.MultipartEncoder', 'MultipartEncoder', ([], {'fields': 'encoded_fields'}), '(fields=encoded_fields)\n', (4043, 4066), False, 'from requests_toolbelt.multipart.encoder import MultipartEncoder\n'), ((4090, 4207), 'requests.post', 'requests.post', (['upload_url'], {'dat... |
#!/usr/bin/env python3
from app.lib.utils.request import request
from app.lib.utils.encode import base64encode
from app.lib.utils.common import get_capta, get_useragent
class S2_052_BaseVerify:
def __init__(self, url):
self.info = {
'name': 'S2-052漏洞,又名CVE-2017-9805漏洞',
'descriptio... | [
"app.lib.utils.common.get_capta",
"app.lib.utils.request.request.post",
"app.lib.utils.common.get_useragent"
] | [((700, 711), 'app.lib.utils.common.get_capta', 'get_capta', ([], {}), '()\n', (709, 711), False, 'from app.lib.utils.common import get_capta, get_useragent\n'), ((772, 787), 'app.lib.utils.common.get_useragent', 'get_useragent', ([], {}), '()\n', (785, 787), False, 'from app.lib.utils.common import get_capta, get_user... |
import setuptools
from hugdatafast.__init__ import __version__
with open("README.md", "r") as fh:
long_description = fh.read()
REQUIRED_PKGS = [
'fastai>=2.0.8',
'fastscore>=1.0.1', # change of store_attr api
'datasets',
]
setuptools.setup(
name="hugdatafast",
version=__version__,
author=... | [
"setuptools.find_packages"
] | [((615, 641), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (639, 641), False, 'import setuptools\n')] |
import pytest
from leapp.repository.actor_definition import ActorDefinition, ActorInspectionFailedError, MultipleActorsError
from leapp.exceptions import UnsupportedDefinitionKindError
from leapp.repository import DefinitionKind
from helpers import repository_dir
import logging
import mock
_FAKE_META_DATA = {
'de... | [
"logging.getLogger",
"mock.patch",
"leapp.repository.actor_definition.ActorDefinition",
"mock.patch.object",
"pytest.raises",
"helpers.repository_dir.as_cwd"
] | [((567, 590), 'helpers.repository_dir.as_cwd', 'repository_dir.as_cwd', ([], {}), '()\n', (588, 590), False, 'from helpers import repository_dir\n'), ((609, 646), 'logging.getLogger', 'logging.getLogger', (['"""leapp.actor.test"""'], {}), "('leapp.actor.test')\n", (626, 646), False, 'import logging\n'), ((660, 692), 'm... |
import numpy as np
import math
import matplotlib.pyplot as plt
U = 5 # equival a l'E
R = 2 # equival a R1
R2 = 3
P = 1.2
Vt = 0.026
Is = 0.000005
n = 200 # profunditat
Vd = np.zeros(n) # sèries
Vl = np.zeros(n)
I1 = np.zeros(n)
I1[0] = U / R # inicialització de les sèries
Vd[0] = Vt * math.log(1 + I1[0] / Is)... | [
"numpy.sum",
"numpy.zeros",
"math.log"
] | [((179, 190), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (187, 190), True, 'import numpy as np\n'), ((206, 217), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (214, 217), True, 'import numpy as np\n'), ((223, 234), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (231, 234), True, 'import numpy as np\n'), ((10... |
"""
Autonomous dataset collection of data for jetson nano
<NAME> - <EMAIL>
"""
import datasets
import json
from datasets import Board, ChessPiece, PieceColor, PieceType
#from realsense_utils import RealSenseCamera
import preprocessing as pr
import cv2
import pandas as pd
import os
from os.path import isfile, join
im... | [
"cv2.imwrite",
"cv2.warpAffine",
"PIL.Image.open",
"PIL.ExifTags.TAGS.get",
"numpy.array",
"preprocessing.board_to_64_files",
"pandas.DataFrame",
"cv2.getRotationMatrix2D",
"pandas.concat",
"json.dump",
"os.remove"
] | [((1065, 1114), 'cv2.getRotationMatrix2D', 'cv2.getRotationMatrix2D', (['image_center', 'angle', '(1.0)'], {}), '(image_center, angle, 1.0)\n', (1088, 1114), False, 'import cv2\n'), ((1126, 1200), 'cv2.warpAffine', 'cv2.warpAffine', (['image', 'rot_mat', 'image.shape[1::-1]'], {'flags': 'cv2.INTER_LINEAR'}), '(image, r... |
from __future__ import absolute_import
# Copyright (c) 2010-2017 openpyxl
import pytest
from openpyxl.xml.functions import fromstring, tostring
from openpyxl.tests.helper import compare_xml
@pytest.fixture
def GradientFillProperties():
from ..fill import GradientFillProperties
return GradientFillProperties
... | [
"openpyxl.tests.helper.compare_xml",
"openpyxl.xml.functions.fromstring"
] | [((565, 591), 'openpyxl.tests.helper.compare_xml', 'compare_xml', (['xml', 'expected'], {}), '(xml, expected)\n', (576, 591), False, 'from openpyxl.tests.helper import compare_xml\n'), ((756, 771), 'openpyxl.xml.functions.fromstring', 'fromstring', (['src'], {}), '(src)\n', (766, 771), False, 'from openpyxl.xml.functio... |
import os
import unittest
import json
import types
from http.client import BadStatusLine
from io import BytesIO
import pytest
wptserve = pytest.importorskip("wptserve")
from .base import TestUsingServer, TestUsingH2Server, doc_root
def send_body_as_header(self):
if self._response.add_required_headers:
s... | [
"json.loads",
"io.BytesIO",
"os.path.join",
"pytest.importorskip",
"pytest.raises",
"unittest.main",
"types.MethodType"
] | [((140, 171), 'pytest.importorskip', 'pytest.importorskip', (['"""wptserve"""'], {}), "('wptserve')\n", (159, 171), False, 'import pytest\n'), ((11826, 11841), 'unittest.main', 'unittest.main', ([], {}), '()\n', (11839, 11841), False, 'import unittest\n'), ((603, 657), 'types.MethodType', 'types.MethodType', (['send_bo... |
# -*- coding: utf-8 -*-
"""
Copyright (c) 2017 beyond-blockchain.org.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | [
"sys.path.extend",
"argparse.ArgumentParser"
] | [((646, 673), 'sys.path.extend', 'sys.path.extend', (["['../../']"], {}), "(['../../'])\n", (661, 673), False, 'import sys\n'), ((1197, 1224), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'usage': 'usage'}), '(usage=usage)\n', (1211, 1224), False, 'from argparse import ArgumentParser\n')] |
"""
Usage:
main.py [<project>]
Options:
<project> Path to the .uvprojx file (Keil® µVision5 Project File).
The .uvoptx file (Keil® µVision5 Project Options file) will
be located automatically as it shall be adjacent to the
.uvprojx file, having the same filenam... | [
"operator.attrgetter",
"pathlib.Path",
"os.scandir",
"os.path.splitext",
"lxml.etree.parse",
"os.path.realpath",
"os.path.dirname",
"os.path.isfile",
"collections.defaultdict",
"os.path.basename",
"warnings.warn",
"docopt.docopt"
] | [((31964, 31979), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (31970, 31979), False, 'from docopt import docopt\n'), ((32611, 32641), 'os.path.realpath', 'os.path.realpath', (['project_path'], {}), '(project_path)\n', (32627, 32641), False, 'import os\n'), ((32046, 32074), 'os.path.isfile', 'os.path.is... |
#!/usr/bin/python
"""
(C) Copyright 2018 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 a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... | [
"uuid.UUID"
] | [((1866, 1885), 'uuid.UUID', 'uuid.UUID', (['uuidstr2'], {}), '(uuidstr2)\n', (1875, 1885), False, 'import uuid\n')] |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'ProductType'
db.create_table('inventory_producttype', (
('id', self.gf('django... | [
"south.db.db.send_create_signal",
"south.db.db.delete_table"
] | [((389, 440), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""inventory"""', "['ProductType']"], {}), "('inventory', ['ProductType'])\n", (410, 440), False, 'from south.db import db\n'), ((1480, 1527), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""inventory"""', "['Product']"], {}), ... |
import numpy as np
import sys
sys.path.append('/homes/rlreed/workspace/unotran/src')
from coarseBounds import computeBounds, Grouping
import pickle
from makeDLPbasis import makeBasis as makeDLP
from makeKLTbasis import makeBasis as makeKLT
import sph
import sph_dgm
import pydgm
def buildGEO(ass_map):
fine_map = [... | [
"sph_dgm.DGMSOLVER",
"coarseBounds.computeBounds",
"makeDLPbasis.makeBasis",
"pydgm.dgmsolver.initialize_dgmsolver",
"pydgm.control.finalize_control",
"numpy.cumsum",
"sph_dgm.XS",
"sys.path.append",
"makeKLTbasis.makeBasis",
"pydgm.dgmsolver.finalize_dgmsolver",
"numpy.set_printoptions"
] | [((30, 84), 'sys.path.append', 'sys.path.append', (['"""/homes/rlreed/workspace/unotran/src"""'], {}), "('/homes/rlreed/workspace/unotran/src')\n", (45, 84), False, 'import sys\n'), ((612, 625), 'numpy.cumsum', 'np.cumsum', (['cm'], {}), '(cm)\n', (621, 625), True, 'import numpy as np\n'), ((1025, 1101), 'sph_dgm.DGMSO... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict",
"oci.util.value_allowed_none_or_none_sentinel"
] | [((9062, 9087), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (9081, 9087), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((5437, 5509), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sentinel',... |
from sympy import (
limit,
Symbol,
oo,
sqrt,
Rational,
log,
exp,
cos,
sin,
tan,
pi,
asin,
together,
root,
S,
)
# Numbers listed with the tests refer to problem numbers in the book
# "Anti-demidovich, problemas resueltos, Ed. URSS"
x = Symbol("x")
def test_... | [
"sympy.sin",
"sympy.Symbol",
"sympy.cos",
"sympy.root",
"sympy.sqrt",
"sympy.limit",
"sympy.tan",
"sympy.log",
"sympy.exp",
"sympy.asin",
"sympy.Rational"
] | [((297, 308), 'sympy.Symbol', 'Symbol', (['"""x"""'], {}), "('x')\n", (303, 308), False, 'from sympy import limit, Symbol, oo, sqrt, Rational, log, exp, cos, sin, tan, pi, asin, together, root, S\n'), ((429, 439), 'sympy.root', 'root', (['x', '(3)'], {}), '(x, 3)\n', (433, 439), False, 'from sympy import limit, Symbol,... |
from notion.client import NotionClient
from notion.settings import Settings
class Context:
def __init__(self):
self.settings = Settings.from_file()
self._client = None
def get_client(self):
if not self._client:
self.settings.validate()
self._client = NotionClie... | [
"notion.settings.Settings.from_file",
"notion.client.NotionClient"
] | [((141, 161), 'notion.settings.Settings.from_file', 'Settings.from_file', ([], {}), '()\n', (159, 161), False, 'from notion.settings import Settings\n'), ((310, 367), 'notion.client.NotionClient', 'NotionClient', ([], {'token_v2': 'self.settings.token', 'monitor': '(False)'}), '(token_v2=self.settings.token, monitor=Fa... |
import unittest
from Observers import Observer, ObserverMailServer, ObserverPbx
from Subjects import Subject, SubjectEflow
class UtVisitor(unittest.TestCase):
def test_observer(self):
# Create observers
pbx = ObserverPbx()
ms = ObserverMailServer()
# Create subject
... | [
"unittest.main",
"Observers.ObserverMailServer",
"Subjects.SubjectEflow",
"Observers.ObserverPbx"
] | [((567, 582), 'unittest.main', 'unittest.main', ([], {}), '()\n', (580, 582), False, 'import unittest\n'), ((233, 246), 'Observers.ObserverPbx', 'ObserverPbx', ([], {}), '()\n', (244, 246), False, 'from Observers import Observer, ObserverMailServer, ObserverPbx\n'), ((260, 280), 'Observers.ObserverMailServer', 'Observe... |
from durations import Duration
from typing import Any, Dict, Optional
from timeeval import Algorithm, TrainingType, InputDimensionality
from timeeval.adapters import DockerAdapter
from timeeval.params import ParameterConfig
_eif_parameters: Dict[str, Dict[str, Any]] = {
"extension_level": {
"defaultValue": None,
... | [
"timeeval.adapters.DockerAdapter",
"timeeval.params.ParameterConfig.defaults",
"timeeval.InputDimensionality"
] | [((1500, 1631), 'timeeval.adapters.DockerAdapter', 'DockerAdapter', ([], {'image_name': '"""registry.gitlab.hpi.de/akita/i/eif"""', 'skip_pull': 'skip_pull', 'timeout': 'timeout', 'group_privileges': '"""akita"""'}), "(image_name='registry.gitlab.hpi.de/akita/i/eif', skip_pull=\n skip_pull, timeout=timeout, group_pr... |
"""
Convenience classes for assembling graph models.
"""
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
__author__ = "<NAME> and <NAME>"
__copyright__ = "Copyright 2016, Stanford University"
__license__ = "MIT"
import tensorflow as tf
from deepchem.nn.lay... | [
"tensorflow.Graph",
"deepchem.models.tf_new_models.graph_topology.GraphTopology"
] | [((874, 884), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (882, 884), True, 'import tensorflow as tf\n'), ((2863, 2873), 'tensorflow.Graph', 'tf.Graph', ([], {}), '()\n', (2871, 2873), True, 'import tensorflow as tf\n'), ((947, 968), 'deepchem.models.tf_new_models.graph_topology.GraphTopology', 'GraphTopology', (... |
"""
Cement generate extension module.
"""
import re
import os
import inspect
import yaml
import shutil
from .. import Controller, minimal_logger, shell
from ..utils.version import VERSION, get_version
LOG = minimal_logger(__name__)
class GenerateTemplateAbstractBase(Controller):
class Meta:
pass
de... | [
"os.path.exists",
"os.listdir",
"os.path.join",
"re.match",
"inspect.getfile",
"shutil.copytree",
"shutil.rmtree"
] | [((3977, 4006), 'shutil.copytree', 'shutil.copytree', (['source', 'dest'], {}), '(source, dest)\n', (3992, 4006), False, 'import shutil\n'), ((4414, 4444), 'os.path.join', 'os.path.join', (['path', '"""generate"""'], {}), "(path, 'generate')\n", (4426, 4444), False, 'import os\n'), ((5491, 5507), 'os.listdir', 'os.list... |
from .gpxfile import get_hr_measurements
from .utils import interpolate
from operator import itemgetter
def __calculate_moving_sums(points, window):
""" Calculates hr moving sums of the window len """
time, hrs = zip(*points)
moving_sum = sum(hrs[0:window])
sums = [(time[0], moving_sum)]
for i, t ... | [
"operator.itemgetter"
] | [((819, 832), 'operator.itemgetter', 'itemgetter', (['(1)'], {}), '(1)\n', (829, 832), False, 'from operator import itemgetter\n')] |
#! /usr/bin/env python3
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import argparse
import xml.etree.ElementTree as ET
import os
import sys
import shutil
import ate... | [
"os.listdir",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"os.popen",
"os.path.isdir",
"os.path.basename",
"sys.exit",
"os.system",
"atexit.register"
] | [((401, 412), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (410, 412), False, 'import os\n'), ((475, 492), 'os.chdir', 'os.chdir', (['workdir'], {}), '(workdir)\n', (483, 492), False, 'import os\n'), ((493, 527), 'atexit.register', 'atexit.register', (['os.chdir', 'prevdir'], {}), '(os.chdir, prevdir)\n', (508, 527), Fa... |
from discord.ext import commands
import discord
def setup(client):
client.add_cog(KeyWordFilter(client))
class KeyWordFilter(commands.Cog):
def __init__(self, client):
self.client = client
self.log_ch = self.client.get_channel(int(self.client.SETTINGS.LOG_CHANNEL))
@commands.Cog.listene... | [
"discord.ext.commands.Cog.listener",
"discord.Embed",
"discord.Colour.red"
] | [((300, 323), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (321, 323), False, 'from discord.ext import commands\n'), ((669, 684), 'discord.Embed', 'discord.Embed', ([], {}), '()\n', (682, 684), False, 'import discord\n'), ((708, 728), 'discord.Colour.red', 'discord.Colour.red', ([], {... |
import os
import compas
from compas.datastructures import Mesh
from compas_rhino.artists import MeshArtist
HERE = os.path.dirname(__file__)
DATA = os.path.join(HERE, 'data')
FILE = os.path.join(DATA, 'faces.obj')
mesh = Mesh.from_obj(FILE)
artist = MeshArtist(mesh, layer="Mesh")
artist.draw_vertices(
color={ke... | [
"os.path.dirname",
"compas_rhino.artists.MeshArtist",
"os.path.join",
"compas.datastructures.Mesh.from_obj"
] | [((116, 141), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'import os\n'), ((149, 175), 'os.path.join', 'os.path.join', (['HERE', '"""data"""'], {}), "(HERE, 'data')\n", (161, 175), False, 'import os\n'), ((183, 214), 'os.path.join', 'os.path.join', (['DATA', '"""faces.ob... |
"""Tests for the pandas helpers in the pd_helpers.py module."""
import pytest
from pandas.testing import assert_frame_equal
from tests.conftest import create_dataframe
from ons_utils.pandas import *
def test_nested_dict_to_df():
"""Test for nested_dict_to_df."""
input_d = {
'bones': {
'f... | [
"pytest.mark.skip",
"tests.conftest.create_dataframe"
] | [((1278, 1315), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test shell"""'}), "(reason='test shell')\n", (1294, 1315), False, 'import pytest\n'), ((1603, 1640), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""test shell"""'}), "(reason='test shell')\n", (1619, 1640), False, 'import pytest\n'... |
#
# Created by <NAME>.
# Copyright 2018 Intuition. All rights reserved.
#
import os
import platform
from setuptools import setup
from setuptools.command.build_ext import build_ext
from distutils.extension import Extension
from Cython.Build import cythonize
from rbp_setup_tools.code_generation import generate_from_cy... | [
"Cython.Build.cythonize",
"platform.mac_ver",
"rbp_setup_tools.code_generation.generate_from_cython_src",
"platform.system",
"distutils.extension.Extension"
] | [((1740, 1796), 'rbp_setup_tools.code_generation.generate_from_cython_src', 'generate_from_cython_src', (['src_1', 'output_1', 'TYPES[:-1]', '(0)'], {}), '(src_1, output_1, TYPES[:-1], 0)\n', (1764, 1796), False, 'from rbp_setup_tools.code_generation import generate_from_cython_src\n'), ((1797, 1849), 'rbp_setup_tools.... |
import numpy as np
from PIL import Image
from keras.models import load_model
img_gray = Image.open('1002.png')
number = np.array(img_gray)
print(number.shape)
print('准备的图片的shape:',number.flatten().shape)
print('原number:',number)
number = number.astype('float32')
number = number/255 #归一化
number = number.flatten()
pri... | [
"numpy.array",
"PIL.Image.open",
"keras.models.load_model"
] | [((89, 111), 'PIL.Image.open', 'Image.open', (['"""1002.png"""'], {}), "('1002.png')\n", (99, 111), False, 'from PIL import Image\n'), ((121, 139), 'numpy.array', 'np.array', (['img_gray'], {}), '(img_gray)\n', (129, 139), True, 'import numpy as np\n'), ((367, 393), 'keras.models.load_model', 'load_model', (['"""mnist-... |
from dataclasses import dataclass, field
from typing import Mapping, List, Any
from datetime import datetime
import logging
import pandas as pd
import glob
import numpy as np
import logging
import os
from collections import OrderedDict
import nrrd
import vtk
import vedo
from vtk.util.numpy_support import numpy_to_vtk
... | [
"vedo.colors.getColor",
"numpy.random.rand",
"iblviewer.utils.get_transformation_matrix",
"nrrd.read",
"vtk.vtkPlane",
"iblviewer.objects.Points",
"vtk.vtkImageAppend",
"numpy.array",
"vedo.io.loadImageData",
"vtk.vtkImageReslice",
"vedo.colorMap",
"numpy.linalg.norm",
"vedo.loadImageData",
... | [((753, 787), 'dataclasses.field', 'field', ([], {'default_factory': 'unique_name'}), '(default_factory=unique_name)\n', (758, 787), False, 'from dataclasses import dataclass, field\n'), ((841, 874), 'dataclasses.field', 'field', ([], {'default_factory': 'Collection'}), '(default_factory=Collection)\n', (846, 874), Fal... |
# Copyright (c) 2013 <NAME> <<EMAIL>>
#
# 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 to use, copy, modify, merge, publish, di... | [
"rply.LexerGenerator"
] | [((1136, 1152), 'rply.LexerGenerator', 'LexerGenerator', ([], {}), '()\n', (1150, 1152), False, 'from rply import LexerGenerator\n')] |
# Python provides a built-in method called random.shuffle that will shuffle the list data type. Do not use this.
# For this assignment, you are to create your own shuffle algorithm that will take as input a sorted list and randomly shuffle the items before returning the list. Try to make your algorithm as efficient a... | [
"random.randint"
] | [((755, 775), 'random.randint', 'random.randint', (['(0)', 'i'], {}), '(0, i)\n', (769, 775), False, 'import random\n')] |
from typing import Callable, TypeVar, Union, Tuple
from krogon.infix import Infix
A = TypeVar('A')
B = TypeVar('B')
E = TypeVar('E')
Maybe = Union[Tuple['just', A], Tuple['nothing']]
def just(value=None):
return "just", value
def nothing():
return "nothing", None
def from_value(value) -> Maybe[B]:
r... | [
"typing.TypeVar"
] | [((87, 99), 'typing.TypeVar', 'TypeVar', (['"""A"""'], {}), "('A')\n", (94, 99), False, 'from typing import Callable, TypeVar, Union, Tuple\n'), ((104, 116), 'typing.TypeVar', 'TypeVar', (['"""B"""'], {}), "('B')\n", (111, 116), False, 'from typing import Callable, TypeVar, Union, Tuple\n'), ((121, 133), 'typing.TypeVa... |
# Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"functools.partial",
"neutron.conf.agent.ovs_conf.register_ovs_agent_opts",
"neutron.conf.plugins.ml2.drivers.ovs_conf.register_ovs_opts"
] | [((861, 909), 'neutron.conf.agent.ovs_conf.register_ovs_agent_opts', 'agent_ovs_conf.register_ovs_agent_opts', (['cfg.CONF'], {}), '(cfg.CONF)\n', (899, 909), True, 'from neutron.conf.agent import ovs_conf as agent_ovs_conf\n'), ((910, 954), 'neutron.conf.plugins.ml2.drivers.ovs_conf.register_ovs_opts', 'ml2_ovs_conf.r... |
import json
from .base_serializer import BaseSerializer
class JsonSerializer(BaseSerializer):
'''Json serializer.'''
def _serialize(self, data: dict, **kwargs) -> str:
return json.dumps(data)
def _deserialize(self, data: str, **kwargs) -> dict:
return json.loads(data)
| [
"json.loads",
"json.dumps"
] | [((195, 211), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (205, 211), False, 'import json\n'), ((285, 301), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (295, 301), False, 'import json\n')] |
from datetime import datetime
import warnings
import logging
from django.db.models import Q, Case, Value, When
from django.core.cache import caches, CacheKeyWarning
import django.apps
from usaspending_api.references.models import Agency, Location, RefCountryCode
from usaspending_api.references.helpers import canonica... | [
"logging.getLogger",
"usaspending_api.references.models.Location.objects.filter",
"datetime.datetime.strptime",
"usaspending_api.submissions.models.SubmissionAttributes.objects.filter",
"usaspending_api.references.models.Location.objects.create",
"usaspending_api.references.helpers.canonicalize_location_d... | [((463, 511), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'CacheKeyWarning'], {}), "('ignore', CacheKeyWarning)\n", (484, 511), False, 'import warnings\n'), ((3005, 3046), 'usaspending_api.references.helpers.canonicalize_location_dict', 'canonicalize_location_dict', (['location_dict'], {}), '(lo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 21 11:11:56 2020
This program is use to plot polarization map from vlbi fits image.
You should specify the input fits images by -i or --infile,
output file by -o or --output,
contour levs by -l or --levs
contour base by -c or --cmul
polarization... | [
"getopt.getopt",
"matplotlib.pyplot.savefig",
"sys.exit",
"matplotlib.colors.LogNorm",
"numpy.min",
"matplotlib.colors.ListedColormap",
"numpy.max",
"numpy.array",
"matplotlib.colors.PowerNorm",
"matplotlib.colors.SymLogNorm",
"astropy.table.Table.read",
"astropy.io.fits.open",
"matplotlib.c... | [((1726, 1788), 'matplotlib.patches.Ellipse', 'Ellipse', (['bpos', 'bmaj', 'bmin'], {'angle': 'bpa', 'ec': '"""k"""', 'facecolor': '"""gray"""'}), "(bpos, bmaj, bmin, angle=bpa, ec='k', facecolor='gray')\n", (1733, 1788), False, 'from matplotlib.patches import Ellipse\n'), ((2198, 2216), 'matplotlib.pyplot.get_cmap', '... |
from rest_framework.viewsets import ModelViewSet,GenericViewSet
from rest_framework.response import Response
from api.serializers.domain import *
from api.pagination.page import MyPageNumberPagination
from api.models import *
class MDomainListViewSet(ModelViewSet):
queryset = MasterDomainName.objects.all().order... | [
"rest_framework.response.Response",
"api.pagination.page.MyPageNumberPagination"
] | [((779, 803), 'api.pagination.page.MyPageNumberPagination', 'MyPageNumberPagination', ([], {}), '()\n', (801, 803), False, 'from api.pagination.page import MyPageNumberPagination\n'), ((1023, 1036), 'rest_framework.response.Response', 'Response', (['res'], {}), '(res)\n', (1031, 1036), False, 'from rest_framework.respo... |
import json
from .accuracy_tool import gen_micro_macro_result
def null_output_function(data, config, *args, **params):
return ""
def basic_output_function(data, config, *args, **params):
which = config.get("output", "output_value").replace(" ", "").split(",")
temp = gen_micro_macro_result(da... | [
"json.dumps"
] | [((414, 448), 'json.dumps', 'json.dumps', (['result'], {'sort_keys': '(True)'}), '(result, sort_keys=True)\n', (424, 448), False, 'import json\n')] |
# Copyright 2017 AT&T Intellectual Property. All other rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | [
"logging.getLogger",
"drydock_provisioner.objects.NodeTagDefinition",
"drydock_provisioner.objects.HostVolumeGroupList",
"drydock_provisioner.objects.HostVolumeGroup",
"drydock_provisioner.objects.ValidationMessage",
"drydock_provisioner.objects.IpAddressAssignmentList",
"drydock_provisioner.objects.Boo... | [((1180, 1218), 'beaker.util.parse_cache_config_options', 'parse_cache_config_options', (['cache_opts'], {}), '(cache_opts)\n', (1206, 1218), False, 'from beaker.util import parse_cache_config_options\n'), ((1334, 1380), 'logging.getLogger', 'logging.getLogger', (['"""drydock.ingester.deckhand"""'], {}), "('drydock.ing... |
# Copyright 2019 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 "licens... | [
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.parse"
] | [((1008, 1041), 'xml.etree.ElementTree.Element', 'etree.Element', (['tag'], {'attrib': 'attrib'}), '(tag, attrib=attrib)\n', (1021, 1041), True, 'import xml.etree.ElementTree as etree\n'), ((5375, 5401), 'xml.etree.ElementTree.parse', 'etree.parse', (['"""package.xml"""'], {}), "('package.xml')\n", (5386, 5401), True, ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import random
from random import choice
from string import digits
from faker import Faker
fake = Faker("fi_FI")
def sanitize_address(value):
return fake.address()
def sanitize_address_if_exist(value):
if value:
return sanitize_addres... | [
"faker.Faker",
"random.choice",
"random.randint"
] | [((164, 178), 'faker.Faker', 'Faker', (['"""fi_FI"""'], {}), "('fi_FI')\n", (169, 178), False, 'from faker import Faker\n'), ((1202, 1216), 'random.choice', 'choice', (['digits'], {}), '(digits)\n', (1208, 1216), False, 'from random import choice\n'), ((1232, 1253), 'random.randint', 'random.randint', (['(0)', '(10)'],... |
# Copyright 2012 Grid Dynamics
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"fixtures.MonkeyPatch",
"nova.virt.libvirt.config.LibvirtConfigGuestDisk",
"mock.create_autospec",
"functools.partial",
"collections.defaultdict",
"os.path.basename",
"nova.virt.libvirt.utils.get_instance_path"
] | [((1711, 1751), 'collections.defaultdict', 'collections.defaultdict', (['self._mock_disk'], {}), '(self._mock_disk)\n', (1734, 1751), False, 'import collections\n'), ((2083, 2130), 'mock.create_autospec', 'mock.create_autospec', (['libvirt_utils.fetch_image'], {}), '(libvirt_utils.fetch_image)\n', (2103, 2130), False, ... |
"""
第二版:多进程二手房信息爬虫
1. 将爬虫分解为下载任务和解析任务(可以继续分解,但在本案中意义不大)两部分,两部分各使用一个子进程,相互通过数据管道通信
2. 下载任务内部不使用队列,使用任务管道实现(在多进程:主进程、子进程、子进程内部进程池等场景下,队列并不好用)任务管理和通信
3. 解析任务从与下载任务间的管道中获取数据,解析并保存
问题:当目标被爬完后,怎样让爬虫停止?
"""
import csv
import datetime
import logging
import multiprocessing as mp
import re
import time
from collections import O... | [
"logging.basicConfig",
"multiprocessing.Process",
"pyquery.PyQuery",
"re.match",
"csv.writer",
"multiprocessing.cpu_count",
"requests.get",
"time.sleep",
"multiprocessing.Pool",
"multiprocessing.Lock",
"datetime.date.today",
"multiprocessing.Pipe",
"logging.info",
"logging.error"
] | [((530, 539), 'multiprocessing.Lock', 'mp.Lock', ([], {}), '()\n', (537, 539), True, 'import multiprocessing as mp\n'), ((578, 599), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (597, 599), False, 'import datetime\n'), ((804, 916), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging... |
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"hashlib.sha256",
"base64.urlsafe_b64encode",
"subprocess.Popen",
"json.dumps",
"os.environ.get",
"struct.pack",
"pyu2f.model.ClientData",
"struct.unpack",
"pyu2f.errors.U2FError"
] | [((2908, 2949), 'os.environ.get', 'os.environ.get', (['SK_SIGNING_PLUGIN_ENV_VAR'], {}), '(SK_SIGNING_PLUGIN_ENV_VAR)\n', (2922, 2949), False, 'import os\n'), ((5811, 5842), 'struct.pack', 'struct.pack', (['"""<I"""', 'input_length'], {}), "('<I', input_length)\n", (5822, 5842), False, 'import struct\n'), ((5933, 6001)... |
import itertools
import os
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = 'Generates class diagrams.'
def handle(self, *args, **options):
if 'django_extensions' not in settings.IN... | [
"os.path.join"
] | [((442, 488), 'os.path.join', 'os.path.join', (['os.path.pardir', '"""docs"""', '"""models"""'], {}), "(os.path.pardir, 'docs', 'models')\n", (454, 488), False, 'import os\n'), ((1145, 1181), 'os.path.join', 'os.path.join', (['docs_path', '"""README.md"""'], {}), "(docs_path, 'README.md')\n", (1157, 1181), False, 'impo... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import time
import json
import os
import sys
import time
import urllib
import socket
import argparse
import requests
import lib.common as common
base_url = 'http://localhost:24879/player/'
#------------------------------------------------------------------------------#
# ... | [
"requests.post",
"socket.socket",
"argparse.ArgumentParser",
"json.dumps",
"requests.get",
"time.sleep",
"os.chdir",
"lib.common.run_http",
"os.path.abspath",
"urllib.request.urlopen"
] | [((7049, 7070), 'lib.common.run_http', 'common.run_http', (['port'], {}), '(port)\n', (7064, 7070), True, 'import lib.common as common\n'), ((587, 608), 'os.chdir', 'os.chdir', (['script_path'], {}), '(script_path)\n', (595, 608), False, 'import os\n'), ((622, 698), 'argparse.ArgumentParser', 'argparse.ArgumentParser',... |