code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.shortcuts import render, redirect
from django.contrib.messages.views import SuccessMessageMixin
from django.contrib.auth.views import LoginView, LogoutView
from user.forms import UserRegisterForm
from django.views.generic import CreateView
class UserRegisterView(SuccessMessageMixin, CreateView):
tem... | [
"django.shortcuts.redirect"
] | [((786, 812), 'django.shortcuts.redirect', 'redirect', (['self.success_url'], {}), '(self.success_url)\n', (794, 812), False, 'from django.shortcuts import render, redirect\n')] |
import os
import re
import threading
import pytest
import pexpect.fdpexpect
from trunner.config import ALL_TARGETS
from trunner.testcase import TestCase
# Pytest tries to collect TestCase as a class to test
# Mark TestCase as not testable
TestCase.__test__ = False
class TestPexpectException:
""" Tests check i... | [
"threading.Lock",
"trunner.testcase.TestCase",
"os.unlink",
"os.mkfifo",
"pytest.fixture",
"threading.Thread",
"re.search"
] | [((624, 653), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""class"""'}), "(scope='class')\n", (638, 653), False, 'import pytest\n'), ((464, 551), 'trunner.testcase.TestCase', 'TestCase', ([], {'name': '"""xyz"""', 'target': 'ALL_TARGETS[0]', 'timeout': '(3)', 'exec_cmd': "['xyz']", 'psh': '(False)'}), "(name='... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Examples for the NURBS-Python Package
Released under MIT License
Developed by <NAME> (c) 2019
"""
import os
from geomdl import BSpline
from geomdl import exchange
from geomdl import tessellate
from geomdl.visualization import VisVTK as vis
from geomdl.shap... | [
"geomdl.visualization.VisVTK.VisSurface",
"geomdl.tessellate.TrimTessellate",
"geomdl.BSpline.Surface",
"os.path.realpath",
"geomdl.exchange.import_txt",
"geomdl.shapes.analytic.Circle",
"geomdl.visualization.VisVTK.VisConfig"
] | [((455, 472), 'geomdl.BSpline.Surface', 'BSpline.Surface', ([], {}), '()\n', (470, 472), False, 'from geomdl import BSpline\n'), ((890, 917), 'geomdl.tessellate.TrimTessellate', 'tessellate.TrimTessellate', ([], {}), '()\n', (915, 917), False, 'from geomdl import tessellate\n'), ((959, 1014), 'geomdl.visualization.VisV... |
# Copyright (c) 2020 Leiden University Medical Center
#
# 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, me... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.splitext",
"io.open",
"io.BufferedReader",
"struct.unpack",
"io.TextIOWrapper",
"sys.exit",
"time.time"
] | [((15085, 15116), 'struct.unpack', 'struct.unpack', (['"""<HBB"""', 'data[:4]'], {}), "('<HBB', data[:4])\n", (15098, 15116), False, 'import struct\n'), ((17270, 17295), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (17293, 17295), False, 'import argparse\n'), ((4093, 4149), 'io.TextIOWrapper'... |
# @Author ZhangGJ
# @Date 2021/09/01 11:18
import cx_Oracle
user_list = ['HIFM_CENTER', 'JJCCB', 'HIFM_NACOS', 'HIFM_XXL_JOB', 'HIFM_FLOWABLE']
oracle_conn = cx_Oracle.connect("root", "123456", "localhost")
oracle_curs = oracle_conn.cursor()
with open('sequence.sql', 'a') as f:
f.write('-- SEQUENCE')
f.writ... | [
"cx_Oracle.connect"
] | [((161, 209), 'cx_Oracle.connect', 'cx_Oracle.connect', (['"""root"""', '"""123456"""', '"""localhost"""'], {}), "('root', '123456', 'localhost')\n", (178, 209), False, 'import cx_Oracle\n')] |
from collections import namedtuple
import jax.numpy as jnp
import pytest
from numpy.testing import assert_allclose
from numpyro.infer.einstein.kernels import (
RBFKernel,
RandomFeatureKernel,
GraphicalKernel,
IMQKernel,
LinearKernel,
MixtureKernel,
HessianPrecondMatrix,
PrecondMatrixKe... | [
"collections.namedtuple",
"numpyro.infer.einstein.kernels.RBFKernel",
"numpy.testing.assert_allclose",
"jax.numpy.array",
"pytest.mark.parametrize",
"numpyro.infer.einstein.kernels.HessianPrecondMatrix"
] | [((332, 409), 'collections.namedtuple', 'namedtuple', (['"""TestSteinKernel"""', "['kernel', 'particle_info', 'loss_fn', 'kval']"], {}), "('TestSteinKernel', ['kernel', 'particle_info', 'loss_fn', 'kval'])\n", (342, 409), False, 'from collections import namedtuple\n'), ((426, 487), 'jax.numpy.array', 'jnp.array', (['[[... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 5 13:38:43 2022
@author: Dartoon
"""
import numpy as np
from scipy import ndimage
import scipy.optimize as op
from galight.tools.astro_tools import plt_fits
import matplotlib.pyplot as plt
def shift_img(img, shift_pix, order=1):
shift_pix = s... | [
"scipy.ndimage.interpolation.shift",
"numpy.flip",
"numpy.intc",
"numpy.sqrt",
"galight.tools.measure_tools.detect_obj",
"galight.tools.measure_tools.mask_obj",
"scipy.optimize.minimize",
"numpy.asarray",
"numpy.sum",
"galight.tools.astro_tools.plt_fits",
"numpy.around",
"numpy.zeros_like"
] | [((432, 466), 'scipy.ndimage.interpolation.shift', 'shift', (['img', 'shift_pix'], {'order': 'order'}), '(img, shift_pix, order=order)\n', (437, 466), False, 'from scipy.ndimage.interpolation import shift\n'), ((663, 678), 'numpy.flip', 'np.flip', (['shift_'], {}), '(shift_)\n', (670, 678), True, 'import numpy as np\n'... |
import os
import pytest
from mergepurge import clean, match
import pandas as pd
import numpy as np
from context import COMP_PATH, PARTIAL_PATH
COMP_DTYPES = {'aa_streetnum': str, 'aa_zip': str, 'zipcode': str}
complete = pd.read_csv(COMP_PATH, sep='\t', encoding='utf-8', dtype=COMP_DTYPES)
COMP_LOC_COLS = ['addre... | [
"mergepurge.clean.parse_business_name",
"mergepurge.match.find_related",
"pandas.read_csv",
"mergepurge.clean.parse_location_cols",
"pytest.mark.parametrize",
"mergepurge.clean.parse_contact_name"
] | [((222, 291), 'pandas.read_csv', 'pd.read_csv', (['COMP_PATH'], {'sep': '"""\t"""', 'encoding': '"""utf-8"""', 'dtype': 'COMP_DTYPES'}), "(COMP_PATH, sep='\\t', encoding='utf-8', dtype=COMP_DTYPES)\n", (233, 291), True, 'import pandas as pd\n'), ((583, 658), 'pandas.read_csv', 'pd.read_csv', (['PARTIAL_PATH'], {'sep': ... |
#!/usr/bin/python
import time
import argparse
import board
import neopixel
# set led
import RPi.GPIO as gpio
gpio.setmode(gpio.BCM)
ActiveLED = int(16) #pin 36
InactiveLED= int(19) #pin 35
gpio.setup(ActiveLED, gpio.OUT)
gpio.setup(InactiveLED, gpio.OUT)
pixels = neopixel.NeoPixel(board.D18, 12)
parser = argparse.... | [
"argparse.ArgumentParser",
"RPi.GPIO.setup",
"RPi.GPIO.output",
"time.sleep",
"neopixel.NeoPixel",
"time.localtime",
"RPi.GPIO.setmode"
] | [((112, 134), 'RPi.GPIO.setmode', 'gpio.setmode', (['gpio.BCM'], {}), '(gpio.BCM)\n', (124, 134), True, 'import RPi.GPIO as gpio\n'), ((192, 223), 'RPi.GPIO.setup', 'gpio.setup', (['ActiveLED', 'gpio.OUT'], {}), '(ActiveLED, gpio.OUT)\n', (202, 223), True, 'import RPi.GPIO as gpio\n'), ((224, 257), 'RPi.GPIO.setup', 'g... |
from sp500project.tools import dedup
import pandas as pd
from pandas._testing import assert_frame_equal
testing_dfs = ['testing_df', 'testing_df2',
'testing_df3', 'testing_item78_switched_case',
'testing_row_bw_df']
for df in testing_dfs:
test_ans = dedup(pd.read_csv(f"sp500project... | [
"pandas.read_csv"
] | [((388, 484), 'pandas.read_csv', 'pd.read_csv', (['f"""sp500project/testing_dfs/correct_dfs/{df}.csv"""'], {'usecols': "['item', 'st', 'ed']"}), "(f'sp500project/testing_dfs/correct_dfs/{df}.csv', usecols=[\n 'item', 'st', 'ed'])\n", (399, 484), True, 'import pandas as pd\n'), ((294, 373), 'pandas.read_csv', 'pd.rea... |
"""Use Leaflet JavaScript API to display an interactive web map within a QWidget"""
from lcmap_tap.RetrieveData.retrieve_geo import GeoInfo
from lcmap_tap.Controls import UNITS
from lcmap_tap.logger import log, exc_handler
import sys
import pkg_resources
from PyQt5.Qt import PYQT_VERSION_STR
from PyQt5.QtC... | [
"PyQt5.QtCore.pyqtSignal",
"lcmap_tap.RetrieveData.retrieve_geo.GeoInfo.unit_conversion",
"PyQt5.QtWebEngineWidgets.QWebEngineView",
"PyQt5.QtCore.QUrl.fromLocalFile",
"lcmap_tap.RetrieveData.retrieve_geo.GeoInfo.get_hv",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWebKitWidgets.QWebView",
"PyQt5.QtWidgets.QLab... | [((959, 1005), 'lcmap_tap.logger.log.info', 'log.info', (["('PyQt version=%s' % PYQT_VERSION_STR)"], {}), "('PyQt version=%s' % PYQT_VERSION_STR)\n", (967, 1005), False, 'from lcmap_tap.logger import log, exc_handler\n'), ((1007, 1044), 'lcmap_tap.logger.log.info', 'log.info', (["('Qt Web Map using %s' % USE)"], {}), "... |
import base64
import json
from http.server import SimpleHTTPRequestHandler
from pathlib import Path
from typing import Callable
from urllib.parse import urlparse, parse_qs
class RequestHandler(SimpleHTTPRequestHandler):
auth_file = Path('.auth.txt') # username:password see RFC 7617
query_index = 4
path_i... | [
"urllib.parse.urlparse",
"pathlib.Path",
"json.dumps",
"base64.b64decode",
"urllib.parse.parse_qs"
] | [((238, 255), 'pathlib.Path', 'Path', (['""".auth.txt"""'], {}), "('.auth.txt')\n", (242, 255), False, 'from pathlib import Path\n'), ((805, 824), 'urllib.parse.urlparse', 'urlparse', (['self.path'], {}), '(self.path)\n', (813, 824), False, 'from urllib.parse import urlparse, parse_qs\n'), ((913, 932), 'urllib.parse.pa... |
"""
Tests for error conditions.
"""
import unittest
import tempfile
import os
import platform
import struct
import numpy as np
import kastore as kas
import kastore.store as store
IS_WINDOWS = platform.system() == "Windows"
class InterfaceMixin(object):
"""
Exercise the low-level interface.
"""
def ... | [
"os.path.getsize",
"kastore.store.write_file",
"os.close",
"kastore.dump",
"kastore.load",
"struct.pack",
"os.rmdir",
"platform.system",
"numpy.zeros",
"tempfile.mkdtemp",
"os.unlink",
"kastore.store.pack_items",
"tempfile.mkstemp",
"numpy.arange"
] | [((195, 212), 'platform.system', 'platform.system', ([], {}), '()\n', (210, 212), False, 'import platform\n'), ((352, 394), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'prefix': '"""kas_test_errors"""'}), "(prefix='kas_test_errors')\n", (368, 394), False, 'import tempfile\n'), ((403, 415), 'os.close', 'os.close', (['... |
from collections import Iterable
from image_lite import utils
class AlreadyRegistered(KeyError):
pass
class NotRegistered(KeyError):
pass
class Unregisterable(Exception):
pass
class ClassByModuleRegistry:
'''
Simple registry.
This is useful for locating code. Why do that when Py... | [
"image_lite.utils.app_name"
] | [((907, 928), 'image_lite.utils.app_name', 'utils.app_name', (['klass'], {}), '(klass)\n', (921, 928), False, 'from image_lite import utils\n'), ((1245, 1266), 'image_lite.utils.app_name', 'utils.app_name', (['klass'], {}), '(klass)\n', (1259, 1266), False, 'from image_lite import utils\n'), ((2412, 2445), 'image_lite.... |
"""
Project Euler Problem 173: https://projecteuler.net/problem=173
We shall define a square lamina to be a square outline with a square "hole" so that
the shape possesses vertical and horizontal symmetry. For example, using exactly
thirty-two square tiles we can form two different square laminae:
With one-hundred ti... | [
"math.sqrt"
] | [((896, 926), 'math.sqrt', 'sqrt', (['(outer_width ** 2 - limit)'], {}), '(outer_width ** 2 - limit)\n', (900, 926), False, 'from math import ceil, sqrt\n')] |
import requests
import twitter
import os
import logging
import json
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from api.models import Token
from api.twitter_tools import api as twitter_tools_api
from api.twitter_tools.tweet_seeker import Tw... | [
"api.twitter_tools.tweet_seeker.TweetSeeker",
"rest_framework.response.Response",
"api.models.Token",
"twitter.Api",
"api.models.Token.objects.all"
] | [((633, 723), 'api.models.Token', 'Token', ([], {'token_type': "credentials['token_type']", 'access_token': "credentials['access_token']"}), "(token_type=credentials['token_type'], access_token=credentials[\n 'access_token'])\n", (638, 723), False, 'from api.models import Token\n'), ((755, 776), 'rest_framework.resp... |
import yaml
import numpy as np
from os import path
from absl import flags
from pysc2.env import sc2_env
from pysc2.lib import features
from pysc2.lib import actions
sc2_f_path = path.abspath(path.join(path.dirname(__file__), "..", "configs", "sc2_config.yml"))
with open(sc2_f_path, 'r') as ymlfile:
sc2_cfg = yam... | [
"numpy.intersect1d",
"pysc2.lib.actions.FunctionCall",
"pysc2.env.sc2_env.SC2Env",
"numpy.asarray",
"yaml.load",
"numpy.log",
"os.path.dirname",
"numpy.array",
"numpy.zeros",
"numpy.concatenate",
"numpy.expand_dims"
] | [((317, 335), 'yaml.load', 'yaml.load', (['ymlfile'], {}), '(ymlfile)\n', (326, 335), False, 'import yaml\n'), ((788, 1000), 'pysc2.env.sc2_env.SC2Env', 'sc2_env.SC2Env', ([], {'map_name': 'map_name', 'step_mul': "sc2_cfg[mode]['step_mul']", 'screen_size_px': "((sc2_cfg[mode]['resl'],) * 2)", 'minimap_size_px': "((sc2_... |
from utils.path import *
from utils.audio.tools import get_mel
from tqdm import tqdm
import numpy as np
import glob, os, sys
from multiprocessing import Pool
from scipy.io.wavfile import write
import librosa, ffmpeg
from sklearn.preprocessing import StandardScaler
def job(wav_filename):
original_wav_filename, prep... | [
"os.path.exists",
"ffmpeg.input",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"utils.audio.tools.get_mel",
"multiprocessing.Pool",
"numpy.save"
] | [((971, 986), 'multiprocessing.Pool', 'Pool', (['n_workers'], {}), '(n_workers)\n', (975, 986), False, 'from multiprocessing import Pool\n'), ((1002, 1028), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {'copy': '(False)'}), '(copy=False)\n', (1016, 1028), False, 'from sklearn.preprocessing import Stan... |
# coding=utf-8
from __future__ import unicode_literals
from flask import Blueprint
main_entry_mod = Blueprint('main_entry', __name__)
from . import views, test_views, deprecated_views
| [
"flask.Blueprint"
] | [((102, 135), 'flask.Blueprint', 'Blueprint', (['"""main_entry"""', '__name__'], {}), "('main_entry', __name__)\n", (111, 135), False, 'from flask import Blueprint\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
The MIT License (MIT)
Copyright (c) 2014-2015 by Halfmoon Labs, Inc.
Copyright (c) 2016 by Blocktatck.org
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software... | [
"logging.getLogger",
"logging.StreamHandler",
"logging.Formatter",
"os.environ.get",
"os.getpid",
"logging.disable"
] | [((1286, 1325), 'os.environ.get', 'os.environ.get', (['"""BLOCKSTACK_TEST"""', 'None'], {}), "('BLOCKSTACK_TEST', None)\n", (1300, 1325), False, 'import os\n'), ((1646, 1674), 'logging.getLogger', 'logging.getLogger', ([], {'name': 'name'}), '(name=name)\n', (1663, 1674), False, 'import logging\n'), ((1715, 1738), 'log... |
from setuptools import setup
setup(
name='cptest',
entry_points={
'console_scripts': [
'cptest=main:main'
]
}
)
| [
"setuptools.setup"
] | [((30, 106), 'setuptools.setup', 'setup', ([], {'name': '"""cptest"""', 'entry_points': "{'console_scripts': ['cptest=main:main']}"}), "(name='cptest', entry_points={'console_scripts': ['cptest=main:main']})\n", (35, 106), False, 'from setuptools import setup\n')] |
from paleomix.nodes.bowtie2 import Bowtie2IndexNode, Bowtie2Node
########################################################################################
# Indexing
def test_index_description():
node = Bowtie2IndexNode(input_file="/path/genome.fasta")
assert str(node) == "creating Bowtie2 index for /path/g... | [
"paleomix.nodes.bowtie2.Bowtie2IndexNode",
"paleomix.nodes.bowtie2.Bowtie2Node"
] | [((210, 259), 'paleomix.nodes.bowtie2.Bowtie2IndexNode', 'Bowtie2IndexNode', ([], {'input_file': '"""/path/genome.fasta"""'}), "(input_file='/path/genome.fasta')\n", (226, 259), False, 'from paleomix.nodes.bowtie2 import Bowtie2IndexNode, Bowtie2Node\n'), ((483, 620), 'paleomix.nodes.bowtie2.Bowtie2Node', 'Bowtie2Node'... |
import tkinter
from math import sqrt, sin, cos, atan, radians, pi
from evolution import *
def magnitude(vector):
# Take a list/tuple that represents a vector and return its magnitude.
return sqrt(sum([i ** 2 for i in vector]))
def direction(td_vector):
# Take a 2d vector (list with two elements) and retu... | [
"math.sqrt",
"math.radians",
"math.cos",
"math.sin",
"math.atan"
] | [((928, 939), 'math.radians', 'radians', (['(45)'], {}), '(45)\n', (935, 939), False, 'from math import sqrt, sin, cos, atan, radians, pi\n'), ((396, 429), 'math.atan', 'atan', (['(td_vector[1] / td_vector[0])'], {}), '(td_vector[1] / td_vector[0])\n', (400, 429), False, 'from math import sqrt, sin, cos, atan, radians,... |
import numpy as np
from PyNeuronToolbox.morphology import allsec_preorder
def ez_record(h,var='v',sections=None,order=None,\
targ_names=None,cust_labels=None):
"""
Records state variables across segments
Args:
h = hocObject to interface with neuron
var = string specifying sta... | [
"PyNeuronToolbox.morphology.allsec_preorder",
"numpy.linspace"
] | [((1381, 1412), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(sec.nseg + 2)'], {}), '(0, 1, sec.nseg + 2)\n', (1392, 1412), True, 'import numpy as np\n'), ((1004, 1022), 'PyNeuronToolbox.morphology.allsec_preorder', 'allsec_preorder', (['h'], {}), '(h)\n', (1019, 1022), False, 'from PyNeuronToolbox.morphology impo... |
import unittest
from problems.problem24 import solution
class Test(unittest.TestCase):
def test(self):
self.assertEqual(solution('12'), 2)
self.assertEqual(solution('226'), 3)
self.assertEqual(solution('0'), 0)
| [
"problems.problem24.solution"
] | [((125, 139), 'problems.problem24.solution', 'solution', (['"""12"""'], {}), "('12')\n", (133, 139), False, 'from problems.problem24 import solution\n'), ((163, 178), 'problems.problem24.solution', 'solution', (['"""226"""'], {}), "('226')\n", (171, 178), False, 'from problems.problem24 import solution\n'), ((202, 215)... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2016 <NAME> (http://www.jdhp.org)
# This script is provided under the terms and conditions of the MIT license:
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Softw... | [
"datapipe.optimization.objectivefunc.wavelets_mrfilter_delta_psi.ObjectiveFunction",
"datapipe.optimization.objectivefunc.tailcut_delta_psi.ObjectiveFunction",
"datapipe.denoising.inverse_transform_sampling.EmpiricalDistribution",
"scipy.optimize.brute",
"json.dump"
] | [((4186, 4252), 'scipy.optimize.brute', 'optimize.brute', (['func', 'search_ranges'], {'full_output': '(True)', 'finish': 'None'}), '(func, search_ranges, full_output=True, finish=None)\n', (4200, 4252), False, 'from scipy import optimize\n'), ((2056, 2116), 'datapipe.denoising.inverse_transform_sampling.EmpiricalDistr... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import json
from datetime import datetime
from typing import Dict, Generator, List
import smartsheet
from airbyte_cdk import AirbyteLogger
from airbyte_cdk.models import (
AirbyteCatalog,
AirbyteConnectionStatus,
AirbyteMessage,
AirbyteReco... | [
"smartsheet.Smartsheet",
"airbyte_cdk.models.AirbyteConnectionStatus",
"airbyte_cdk.models.AirbyteCatalog",
"datetime.datetime.now",
"airbyte_cdk.models.AirbyteStream"
] | [((2257, 2302), 'airbyte_cdk.models.AirbyteConnectionStatus', 'AirbyteConnectionStatus', ([], {'status': 'Status.FAILED'}), '(status=Status.FAILED)\n', (2280, 2302), False, 'from airbyte_cdk.models import AirbyteCatalog, AirbyteConnectionStatus, AirbyteMessage, AirbyteRecordMessage, AirbyteStream, ConfiguredAirbyteCata... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from torch.nn import init
import matplotlib.pyplot as plt
class myConv(nn.Module):
def __init__(self, in_size, out_size,filter_size=3,stride=1,pad=None,do_batch=1,dov=0):
super().__init__()
pad=int((filte... | [
"torch.nn.BatchNorm2d",
"torch.nn.Dropout",
"torch.nn.init.constant_",
"torch.nn.ModuleList",
"torch.nn.functional.adaptive_max_pool2d",
"torch.nn.Conv2d",
"torch.nn.init.xavier_normal_",
"torch.nn.functional.relu",
"torch.nn.functional.max_pool2d"
] | [((412, 466), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_size', 'out_size', 'filter_size', 'stride', 'pad'], {}), '(in_size, out_size, filter_size, stride, pad)\n', (421, 466), True, 'import torch.nn as nn\n'), ((489, 527), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['out_size'], {'momentum': '(0.1)'}), '(out_size, momentum... |
# encoding: utf-8
"""Slightly more advanced example application."""
class Person:
__dispatch__ = 'rest'
def get(self):
return "Person details."
def post(self):
# Often not supported!
return "Create a child object."
def put(self):
return "Replace or creat... | [
"web.core.application.Application"
] | [((880, 897), 'web.core.application.Application', 'Application', (['Root'], {}), '(Root)\n', (891, 897), False, 'from web.core.application import Application\n')] |
import sys, socket, pytest, py, pathlib
from xprocess import ProcessStarter
from pathlib import Path
import subprocess
import platform
import os
import hashlib
import time
import json
from urllib.request import urlopen
@pytest.fixture
def get_proj_root(cwd=os.getcwd()):
proj_root = cwd
if not Path(proj_root)... | [
"subprocess.check_output",
"os.path.getsize",
"hashlib.sha256",
"socket.socket",
"pathlib.Path",
"os.environ.get",
"os.getcwd",
"platform.system",
"urllib.request.urlopen"
] | [((260, 271), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (269, 271), False, 'import os\n'), ((462, 495), 'os.environ.get', 'os.environ.get', (['"""POWERLOADER_EXE"""'], {}), "('POWERLOADER_EXE')\n", (476, 495), False, 'import os\n'), ((893, 912), 'pathlib.Path', 'Path', (['get_proj_root'], {}), '(get_proj_root)\n', (8... |
from django.urls import path, include
from rest_framework import routers
from backend.handler.case import case_info
# 用例
case_router = routers.DefaultRouter()
case_router.register(r'', case_info.CaseInfoViewSet, basename='case') | [
"rest_framework.routers.DefaultRouter"
] | [((136, 159), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (157, 159), False, 'from rest_framework import routers\n')] |
from lichtenberg.util import draw_blur_with_points
from lichtenberg.fastdbm import BiasDirection, make_bias
import lichtenberg as lb
from PIL import Image
from pathlib import Path
def main():
width, height = 300, 300
img = Image.new("RGB", (width, height))
# Using FastDBM(see also 10_fastdbm_top.py)
... | [
"lichtenberg.util.draw_blur_with_points",
"lichtenberg.FastDBM",
"PIL.Image.new",
"pathlib.Path",
"lichtenberg.Simulator",
"lichtenberg.fastdbm.make_bias"
] | [((233, 266), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(width, height)'], {}), "('RGB', (width, height))\n", (242, 266), False, 'from PIL import Image\n'), ((585, 629), 'lichtenberg.fastdbm.make_bias', 'make_bias', (['BiasDirection.Down', 'width', 'height'], {}), '(BiasDirection.Down, width, height)\n', (594, 629)... |
import random
from multiprocessing import Process, Lock, RLock
import time
class WriteProcess(Process):
""" 写入文件 """
def __init__(self, file_name, num, lock, *args, **kwargs):
# 文件的名称
self.file_name = file_name
self.num = num
# 锁对象
self.lock = lock
... | [
"random.randint",
"multiprocessing.RLock"
] | [((1230, 1237), 'multiprocessing.RLock', 'RLock', ([], {}), '()\n', (1235, 1237), False, 'from multiprocessing import Process, Lock, RLock\n'), ((977, 997), 'random.randint', 'random.randint', (['(1)', '(5)'], {}), '(1, 5)\n', (991, 997), False, 'import random\n')] |
# -*- coding: utf-8 -*-
from pathlib import Path
import requests
from packratt.cache import CacheEntry
class UrlCacheEntry(CacheEntry):
def __init__(self, url, sha_hash, filename):
self.url = url
self.sha_hash = sha_hash
self.filename = filename
def download(self, destination: Path) -... | [
"requests.Session"
] | [((416, 434), 'requests.Session', 'requests.Session', ([], {}), '()\n', (432, 434), False, 'import requests\n')] |
import numpy as np
from numpy.linalg import eig
from scipy.linalg import fractional_matrix_power
from sklearn.preprocessing import normalize
from kmeans import KMeans
class Spectral:
def cluster(self, x, k, delta=2.):
def dist(i, j):
if i == j: return 0.
return np.exp(-delta * np.... | [
"kmeans.KMeans",
"numpy.linalg.eig",
"numpy.matmul",
"sklearn.preprocessing.normalize",
"scipy.linalg.fractional_matrix_power",
"numpy.vectorize"
] | [((511, 543), 'scipy.linalg.fractional_matrix_power', 'fractional_matrix_power', (['D', '(-0.5)'], {}), '(D, -0.5)\n', (534, 543), False, 'from scipy.linalg import fractional_matrix_power\n'), ((627, 633), 'numpy.linalg.eig', 'eig', (['L'], {}), '(L)\n', (630, 633), False, 'from numpy.linalg import eig\n'), ((764, 795)... |
import csv
import io
import tempfile
import unittest
from io import IOBase
from collections import defaultdict
import json
import numpy as np
from requests import Response
from lightly.openapi_generated.swagger_client.models.datasource_processed_until_timestamp_response import DatasourceProcessedUntilTimestampResponse... | [
"lightly.openapi_generated.swagger_client.models.write_csv_url_data.WriteCSVUrlData",
"lightly.openapi_generated.swagger_client.models.datasource_raw_samples_data.DatasourceRawSamplesData",
"lightly.openapi_generated.swagger_client.api.mappings_api.MappingsApi.__init__",
"lightly.openapi_generated.swagger_cli... | [((17020, 17030), 'requests.Response', 'Response', ([], {}), '()\n', (17028, 17030), False, 'from requests import Response\n'), ((3407, 3458), 'lightly.openapi_generated.swagger_client.api.embeddings_api.EmbeddingsApi.__init__', 'EmbeddingsApi.__init__', (['self'], {'api_client': 'api_client'}), '(self, api_client=api_... |
"""
Insertion Sort
"""
import unittest
from typing import TypeVar
T = TypeVar('T')
def insertion_sort(array: list[T]):
for j in range(1, len(array)):
key = array[j]
i = j - 1
while i >= 0 and array[i] > key:
array[i + 1] = array[i]
i -= 1
array[i + 1] = key... | [
"unittest.main",
"typing.TypeVar"
] | [((71, 83), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (78, 83), False, 'from typing import TypeVar\n'), ((1117, 1132), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1130, 1132), False, 'import unittest\n')] |
#
# Copyright (c) 2022 TUM Department of Electrical and Computer Engineering.
#
# This file is part of MLonMCU.
# See https://github.com/tum-ei-eda/mlonmcu.git for further info.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You m... | [
"mlonmcu.logging.get_logger",
"os.getcwd",
"re.search",
"pathlib.Path"
] | [((923, 935), 'mlonmcu.logging.get_logger', 'get_logger', ([], {}), '()\n', (933, 935), False, 'from mlonmcu.logging import get_logger\n'), ((2107, 2143), 'pathlib.Path', 'Path', (["self.config['corstone300.exe']"], {}), "(self.config['corstone300.exe'])\n", (2111, 2143), False, 'from pathlib import Path\n'), ((2297, 2... |
"""Simple CMD."""
from types import FunctionType
import inspect
import argparse
def _default_handle(typ):
def handle_type(_):
return dict(type=typ)
return typ, handle_type
def _handle_bool(param: inspect.Parameter):
if param.default != inspect.Parameter.empty:
if param.default is True:
actio... | [
"inspect.signature",
"argparse.ArgumentParser"
] | [((872, 897), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (895, 897), False, 'import argparse\n'), ((1325, 1368), 'inspect.signature', 'inspect.signature', (['fun'], {'follow_wrapped': '(True)'}), '(fun, follow_wrapped=True)\n', (1342, 1368), False, 'import inspect\n')] |
import sys
import os
import argparse
import shutil
from os.path import join as pjoin
from xml.etree import ElementTree
from collections import namedtuple
from pprint import pprint
from distutils.dir_util import mkpath
class AdobeCCFontExtractor:
pass
def mkdir_p(path):
try:
os.makedirs(path)
excep... | [
"distutils.dir_util.mkpath",
"collections.namedtuple",
"xml.etree.ElementTree.parse",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.expandvars",
"os.path.join",
"os.path.isdir",
"shutil.copy",
"pprint.pprint"
] | [((600, 640), 'collections.namedtuple', 'namedtuple', (['"""FontData"""', '"""id name weight"""'], {}), "('FontData', 'id name weight')\n", (610, 640), False, 'from collections import namedtuple\n'), ((691, 723), 'xml.etree.ElementTree.parse', 'ElementTree.parse', (['manifest_path'], {}), '(manifest_path)\n', (708, 723... |
#!/usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
import os, sys
if len( sys.argv ) < 2:
print( "Please specify the folder containing the benchmark logs!" )
folder = sys.argv[1]
suffix = '-full-first-read.log'
benchmarkLogs = [ os.path.join( folder, file ) for file in os.listdir( folder ) ... | [
"numpy.mean",
"os.listdir",
"os.path.join",
"numpy.max",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.show"
] | [((1634, 1661), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (1644, 1661), True, 'import matplotlib.pyplot as plt\n'), ((2475, 2485), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2483, 2485), True, 'import matplotlib.pyplot as plt\n'), ((258, 284), 'os.path.... |
#!/usr/bin/env python
# title : savegolds.py
# description : Saves replay buffer of your best livesplit segment
# authors : hies, Bootscreen
# date : 2020 08 06
# version : 1.0-0
# dependencies : Python 3.6, livesplit, livesplit.server, moviepy
# notes ... | [
"re.search",
"os.path.exists",
"socket.socket",
"moviepy.tools.subprocess_call",
"glob.iglob",
"os.rename",
"os.path.splitext",
"os.path.join",
"time.sleep",
"time.perf_counter",
"sys.exc_info",
"moviepy.config.get_setting",
"shutil.copyfile",
"os.path.basename",
"os.path.abspath",
"mo... | [((2353, 2374), 'os.path.exists', 'os.path.exists', (['fpath'], {}), '(fpath)\n', (2367, 2374), False, 'import os, sys, subprocess, time, socket, glob, re, select\n'), ((2562, 2570), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (2567, 2570), False, 'from time import sleep, perf_counter\n'), ((2587, 2613), 'os.path.sp... |
import logging
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from polymorphic_sqlalchemy import (create_polymorphic_base, Relation,
PolyField, NetRelationship, NetModel, BaseInitializer)
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm ... | [
"logging.getLogger",
"sqlalchemy.orm.relationship",
"polymorphic_sqlalchemy.NetModel",
"flask.Flask",
"sqlalchemy.ForeignKey",
"sqlalchemy.String",
"polymorphic_sqlalchemy.create_polymorphic_base",
"polymorphic_sqlalchemy.PolyField",
"flask_sqlalchemy.SQLAlchemy",
"sqlalchemy.Column",
"polymorph... | [((414, 429), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (419, 429), False, 'from flask import Flask\n'), ((550, 570), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['test_app'], {}), '(test_app)\n', (560, 570), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((582, 609), 'logging.getLogger', 'log... |
import torch
import numpy as np
import torch.nn.functional as F
from torch import nn, optim
import torch.nn.utils.rnn as rnn_utils
class SentLSTM(nn.Module):
def __init__(self, embedding_dim, hidden_dim, batch_size, bi_direction=True):
super(SentLSTM, self).__init__()
self.hidden_dim = hidden_dim
... | [
"torch.sort",
"torch.nn.Sigmoid",
"torch.nn.LSTM",
"torch.LongTensor",
"torch.nn.utils.rnn.pad_sequence",
"torch.cat",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.utils.rnn.pack_padded_sequence",
"torch.nn.Linear",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.nn.functional.softmax",
... | [((386, 448), 'torch.nn.LSTM', 'nn.LSTM', (['embedding_dim', 'hidden_dim'], {'bidirectional': 'bi_direction'}), '(embedding_dim, hidden_dim, bidirectional=bi_direction)\n', (393, 448), False, 'from torch import nn, optim\n'), ((599, 624), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (622, 624... |
import torch
import numpy as np
import torch.nn as nn
from mmcv.cnn import normal_init
from ..registry import HEADS
from ..utils import ConvModule, bias_init_with_prob
from .anchor_head import AnchorHead
from mmdet.core import (delta2bbox, force_fp32,
multiclass_nms_with_feat)
""" RetinaHead t... | [
"torch.nn.ReLU",
"mmdet.core.multiclass_nms_with_feat",
"torch.nn.ModuleList",
"mmdet.core.delta2bbox",
"torch.nn.Conv2d",
"torch.cat",
"mmcv.cnn.normal_init",
"mmdet.core.force_fp32"
] | [((3418, 3482), 'mmdet.core.force_fp32', 'force_fp32', ([], {'apply_to': "('cls_scores', 'bbox_preds', 'embed_feats')"}), "(apply_to=('cls_scores', 'bbox_preds', 'embed_feats'))\n", (3428, 3482), False, 'from mmdet.core import delta2bbox, force_fp32, multiclass_nms_with_feat\n'), ((1374, 1395), 'torch.nn.ReLU', 'nn.ReL... |
# <NAME> (<EMAIL>)
#
# Based on dragonfly-plus-topo-gen-v2.py,
# implements relative global link arrangement
#
# Assumptions: num_router_per_group = router_radix, half spine half leaf,
# a -- number of routers in a group; h -- number of global link per spine;
# r -- router radix; g -- number of groups
# a == r, and ... | [
"struct.pack"
] | [((1660, 1690), 'struct.pack', 'struct.pack', (['"""2i"""', 'src', 'des_id'], {}), "('2i', src, des_id)\n", (1671, 1690), False, 'import struct\n'), ((1808, 1835), 'struct.pack', 'struct.pack', (['"""2i"""', 'src', 'des'], {}), "('2i', src, des)\n", (1819, 1835), False, 'import struct\n'), ((2877, 2916), 'struct.pack',... |
import time
import chromedriver_binary # noqa
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.select import Select
from tqdm import tqdm
from scraping import table
# 旧GPAは未対応
HOME_URL = "http://educate.academic.hokudai.ac.jp/seiseki/GradeDistSerc... | [
"selenium.webdriver.chrome.options.Options",
"selenium.webdriver.Chrome",
"tqdm.tqdm",
"selenium.webdriver.support.select.Select",
"time.sleep"
] | [((497, 506), 'selenium.webdriver.chrome.options.Options', 'Options', ([], {}), '()\n', (504, 506), False, 'from selenium.webdriver.chrome.options import Options\n'), ((572, 605), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'options': 'options'}), '(options=options)\n', (588, 605), False, 'from selenium impo... |
# dependencies
from lifelines import KaplanMeierFitter
from lifelines.statistics import pairwise_logrank_test
from bokeh.io import output_file, output_notebook
from bokeh.plotting import figure, show
from bokeh.models import ColumnDataSource, HoverTool,Band
from bokeh.layouts import row, column, gridplot
from bokeh.mod... | [
"bokeh.plotting.figure",
"bokeh.plotting.show",
"bokeh.io.output_notebook",
"lifelines.statistics.pairwise_logrank_test",
"lifelines.KaplanMeierFitter",
"pandas.DataFrame",
"bokeh.models.HoverTool"
] | [((1947, 1964), 'bokeh.io.output_notebook', 'output_notebook', ([], {}), '()\n', (1962, 1964), False, 'from bokeh.io import output_file, output_notebook\n'), ((6553, 6567), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (6565, 6567), True, 'import pandas as pd\n'), ((2048, 2067), 'lifelines.KaplanMeierFitter', '... |
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
import codecs
import json
import pathlib
import yaml
# path = pathlib.Path('or_fill.json')
def json2yaml(path):
# .json -> .yaml
with path.open(encoding='utf-8') as fo:
s = json.load(fo)
y = yaml.dump(s, encoding='utf-8')
y = y.decode(... | [
"yaml.dump",
"pathlib.Path",
"yaml.load",
"json.load",
"json.dump"
] | [((698, 731), 'pathlib.Path', 'pathlib.Path', (['"""or_truefalse.yaml"""'], {}), "('or_truefalse.yaml')\n", (710, 731), False, 'import pathlib\n'), ((520, 532), 'yaml.load', 'yaml.load', (['y'], {}), '(y)\n', (529, 532), False, 'import yaml\n'), ((242, 255), 'json.load', 'json.load', (['fo'], {}), '(fo)\n', (251, 255),... |
"""Tests that basis kets are working properly"""
import Python.density_matrix as DM
import Python.measurements as mes
class TestMeasurements:
"""
Testing that measurements produce the expected results.
"""
def test_temp(self):
"""Tests the creation of a simple ket and validates its properties... | [
"Python.measurements.change_in_extractable_work",
"Python.measurements.entropy",
"Python.measurements.temp_from_pop",
"Python.measurements.D",
"Python.measurements.extractable_work",
"Python.measurements.pop_from_temp",
"Python.density_matrix.qbit",
"Python.measurements.temp"
] | [((337, 350), 'Python.density_matrix.qbit', 'DM.qbit', (['(0.25)'], {}), '(0.25)\n', (344, 350), True, 'import Python.density_matrix as DM\n'), ((413, 425), 'Python.density_matrix.qbit', 'DM.qbit', (['(0.4)'], {}), '(0.4)\n', (420, 425), True, 'import Python.density_matrix as DM\n'), ((523, 535), 'Python.density_matrix... |
# Copyright 2011, OpenStack Foundation
# Copyright 2012, Red Hat, Inc.
# Copyright 2013 IBM Corp.
#
# 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/li... | [
"six.add_metaclass",
"oslo_config.cfg.StrOpt",
"oslo_messaging.Notifier",
"oslo_config.cfg.ListOpt",
"oslo_messaging.get_notification_transport"
] | [((3320, 3350), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (3337, 3350), False, 'import six\n'), ((3691, 3721), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (3708, 3721), False, 'import six\n'), ((4283, 4313), 'six.add_metaclass', 'six.add_... |
import os
import sys
if len(sys.argv) >= 2:
for i in sys.argv[1:]:
os.system(f'type nul > {i}')
else:
print('Pass parameters for creating files. E.g. touch file.py file2.pyw')
| [
"os.system"
] | [((80, 108), 'os.system', 'os.system', (['f"""type nul > {i}"""'], {}), "(f'type nul > {i}')\n", (89, 108), False, 'import os\n')] |
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("/tmp/data/", one_hot=True)
LEARNING_RATE = 0.001
EPOCHS = 15
BATCH_SIZE = 100
STEP = 1
NROFCLASSES = 10
X = tf.placeholder("float", [None, 28*28*1])... | [
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.global_variables_initializer",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.argmax",
"tensorflow.matmul",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.nn.softmax"... | [((143, 196), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""/tmp/data/"""'], {'one_hot': '(True)'}), "('/tmp/data/', one_hot=True)\n", (168, 196), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((280, 324), 'tensorflow.placeholder', 'tf.plac... |
"""
Read csv file in data-sample folder by defaul but also allow reading data from different file source provided with open-csv function or merge function
"""
import csv
from os import path
import pandas as pd
from typing import Dict
class DataManager():
"""Data manager class which handle the raw data at the lowe... | [
"csv.DictWriter",
"csv.DictReader",
"pandas.read_csv"
] | [((2335, 2405), 'pandas.read_csv', 'pd.read_csv', (['filePath'], {'usecols': "['decimalLatitude', 'decimalLongitude']"}), "(filePath, usecols=['decimalLatitude', 'decimalLongitude'])\n", (2346, 2405), True, 'import pandas as pd\n'), ((716, 736), 'csv.DictReader', 'csv.DictReader', (['data'], {}), '(data)\n', (730, 736)... |
# Copyright 2016 - Wipro Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"logging.getLogger",
"galaxia.common.json.promdash_json.create_json",
"os.getenv",
"importlib.import_module",
"oslo_config.cfg.StrOpt",
"galaxia.gdata.common.sql_helper.engine.connect",
"datetime.datetime.now",
"oslo_config.cfg.OptGroup",
"galaxia.gmiddleware.handler.client.http_request"
] | [((1426, 1453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1443, 1453), False, 'import logging\n'), ((1186, 1280), 'oslo_config.cfg.StrOpt', 'cfg.StrOpt', (['"""renderer_db_url"""'], {'default': '"""localhost"""', 'help': '"""The db_url for renderer server"""'}), "('renderer_db_url',... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import *
from future.utils import iteritems
import numpy as np
from pandas import DataFrame, Series
import scipy.sparse as sparse
from sqlalchemy.sql import... | [
"pandas.Series",
"sqlalchemy.sql.bindparam",
"pandas.DataFrame",
"sqlalchemy.sql.select",
"scipy.sparse.issparse",
"numpy.array",
"numpy.zeros",
"numpy.vstack",
"numpy.ravel",
"numpy.arange"
] | [((24435, 24460), 'numpy.ravel', 'np.ravel', (['marginals[:, 1]'], {}), '(marginals[:, 1])\n', (24443, 24460), True, 'import numpy as np\n'), ((20898, 20917), 'numpy.array', 'np.array', (['marginals'], {}), '(marginals)\n', (20906, 20917), True, 'import numpy as np\n'), ((21102, 21139), 'numpy.vstack', 'np.vstack', (['... |
# Copyright 2016 Hewlett Packard Enterprise Development Company LP
#
# 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
#
# Unles... | [
"testtools.ExpectedException",
"oslo_utils.uuidutils.generate_uuid",
"tempest.lib.decorators.idempotent_id",
"tempest.test.attr"
] | [((907, 933), 'tempest.test.attr', 'test.attr', ([], {'type': '"""negative"""'}), "(type='negative')\n", (916, 933), False, 'from tempest import test\n'), ((939, 1003), 'tempest.lib.decorators.idempotent_id', 'decorators.idempotent_id', (['"""1b5cf87a-1d3a-4a94-ba64-647153d54f32"""'], {}), "('1b5cf87a-1d3a-4a94-ba64-64... |
# Copyright 2020 Curtin University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | [
"datetime.datetime",
"csv.DictReader",
"observatory.platform.utils.template_utils.upload_files_from_list",
"os.path.join",
"pendulum.instance",
"observatory.platform.utils.url_utils.retry_session",
"croniter.croniter",
"observatory.platform.utils.telescope_utils.list_to_jsonl_gz",
"logging.info"
] | [((5207, 5263), 'os.path.join', 'os.path.join', (['self.download_folder', 'f"""{self.dag_id}.txt"""'], {}), "(self.download_folder, f'{self.dag_id}.txt')\n", (5219, 5263), False, 'import os\n'), ((5473, 5535), 'os.path.join', 'os.path.join', (['self.transform_folder', 'f"""{self.dag_id}.jsonl.gz"""'], {}), "(self.trans... |
"""
Class to construct parabolas from 3 points.
ADW: Need to move all of the plotting stuff
"""
import numpy
import scipy.stats
import scipy.interpolate
############################################################
class Parabola:
def __init__(self, x, y):
"""
INPUTS
x = variable of inte... | [
"numpy.allclose",
"numpy.sqrt",
"numpy.argmax",
"numpy.min",
"numpy.max",
"numpy.argsort",
"numpy.array",
"numpy.linspace",
"numpy.linalg.inv",
"numpy.concatenate",
"numpy.nonzero",
"numpy.argmin",
"numpy.cumsum",
"numpy.matrix"
] | [((9052, 9092), 'numpy.linspace', 'numpy.linspace', (['ts_min', 'ts_max', 'ts_steps'], {}), '(ts_min, ts_max, ts_steps)\n', (9066, 9092), False, 'import numpy\n'), ((413, 429), 'numpy.argsort', 'numpy.argsort', (['x'], {}), '(x)\n', (426, 429), False, 'import numpy\n'), ((529, 549), 'numpy.argmax', 'numpy.argmax', (['s... |
import coreapi
import json
import requests
from rest_framework import status, renderers
from rest_framework.response import Response
from rest_framework.views import APIView
from config.settings.base import FAIRSHAKE_TOKEN
from presqt.api_v1.utilities import (
fairshake_request_validator, fairshake_assessment_val... | [
"presqt.api_v1.utilities.fairshare_results",
"json.dumps",
"presqt.api_v1.utilities.fairshake_request_validator",
"rest_framework.response.Response",
"coreapi.auth.TokenAuthentication",
"presqt.utilities.read_file",
"presqt.api_v1.utilities.fairshake_assessment_validator"
] | [((2668, 2754), 'presqt.utilities.read_file', 'read_file', (['"""presqt/specs/services/fairshake/fairshake_score_translator.json"""', '(True)'], {}), "('presqt/specs/services/fairshake/fairshake_score_translator.json',\n True)\n", (2677, 2754), False, 'from presqt.utilities import PresQTValidationError, read_file\n'... |
######################################################################################################################
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"boto_retry.add_retry_methods_to_resource",
"boto3.resource",
"time.time",
"decimal.Decimal"
] | [((2488, 2506), 'decimal.Decimal', 'Decimal', (['(12 * 3600)'], {}), '(12 * 3600)\n', (2495, 2506), False, 'from decimal import Decimal\n'), ((3032, 3043), 'time.time', 'time.time', ([], {}), '()\n', (3041, 3043), False, 'import time\n'), ((3379, 3405), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('d... |
import numpy as np
from numpy.random import rand
from numpy import *
from pathlib import Path
import csv
# activation function? if we'd use ReLU with grayscale images the value stays
# the same
# This script creates a .csv file in the work directory
# containing integer numbers in the following form
# Input X : x1, ... | [
"csv.writer",
"numpy.random.rand"
] | [((1691, 1710), 'csv.writer', 'csv.writer', (['csvFile'], {}), '(csvFile)\n', (1701, 1710), False, 'import csv\n'), ((1109, 1130), 'numpy.random.rand', 'rand', (['(1)', 'N_inputlayer'], {}), '(1, N_inputlayer)\n', (1113, 1130), False, 'from numpy.random import rand\n'), ((1188, 1221), 'numpy.random.rand', 'rand', (['N_... |
import pkg_resources
try:
__version__: str = pkg_resources.require("eduvpn")[0].version
except pkg_resources.DistributionNotFound:
__version__ = "0.0dev"
| [
"pkg_resources.require"
] | [((50, 81), 'pkg_resources.require', 'pkg_resources.require', (['"""eduvpn"""'], {}), "('eduvpn')\n", (71, 81), False, 'import pkg_resources\n')] |
from abc import abstractmethod
import re
from pyboletox.util import Util
from pyboletox.Contracts.Boleto.boleto import Boleto as BoletoContract
class AbstractRetorno:
def __init__(self, file) -> None:
# Se Cnab ja foi processado
self._processado = False
# Código do banco
self._cod... | [
"pyboletox.util.Util.isHeaderRetorno",
"re.match",
"pyboletox.util.Util.isCnab400",
"pyboletox.util.Util.file2array",
"pyboletox.util.Util.remove"
] | [((662, 683), 'pyboletox.util.Util.file2array', 'Util.file2array', (['file'], {}), '(file)\n', (677, 683), False, 'from pyboletox.util import Util\n'), ((2236, 2260), 'pyboletox.util.Util.remove', 'Util.remove', (['i', 'f', 'array'], {}), '(i, f, array)\n', (2247, 2260), False, 'from pyboletox.util import Util\n'), ((7... |
import logging
import os
import threading
import time
import curio
import pytest
try:
import catvs
import catvs.server
except ImportError:
catvs = None
import caproto as ca
from caproto.tests.verify_with_catvs import CatvsIOC
logger = logging.getLogger(__name__)
# logging.getLogger('caproto').setLevel('... | [
"logging.getLogger",
"catvs.util.TestMixinServer.setUp",
"caproto.random_ports",
"caproto.tests.verify_with_catvs.CatvsIOC",
"time.sleep",
"pytest.mark.parametrize",
"curio.Kernel",
"catvs.util.TestMixinClient.setUp",
"pytest.mark.skipif",
"pytest.fixture",
"threading.Thread",
"pytest.skip",
... | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((500, 550), 'pytest.fixture', 'pytest.fixture', ([], {'params': "['curio']", 'scope': '"""function"""'}), "(params=['curio'], scope='function')\n", (514, 550), False, 'import pytest\n'), ... |
# Utility functions to query the feedly API
import requests
import json
import urllib
def get_subscriptions(headers):
'''Get all subscriptions for current user.
Parameters
----------
headers: dict
Authenication information for feedly API
Returns
-------
list of dictionaries
... | [
"urllib.parse.urlencode",
"urllib.parse.quote",
"requests.get"
] | [((445, 487), 'requests.get', 'requests.get', ([], {'url': 'service', 'headers': 'headers'}), '(url=service, headers=headers)\n', (457, 487), False, 'import requests\n'), ((948, 990), 'requests.get', 'requests.get', ([], {'url': 'service', 'headers': 'headers'}), '(url=service, headers=headers)\n', (960, 990), False, '... |
"""
Support for interface with a Sony Bravia TV.
For more details about this platform, please refer to the documentation at
https://github.com/custom-components/media_player.braviatv_psk
"""
import urllib.parse as urlparse
from urllib.parse import parse_qs
import logging
import asyncio
import homeassistant.helpers.con... | [
"logging.getLogger",
"voluptuous.Required",
"braviarc.braviarc.BraviaRC",
"urllib.parse.urlparse"
] | [((1948, 1975), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1965, 1975), False, 'import logging\n'), ((5206, 5239), 'braviarc.braviarc.BraviaRC', 'braviarc.BraviaRC', (['host', 'psk', 'mac'], {}), '(host, psk, mac)\n', (5223, 5239), False, 'from braviarc import braviarc\n'), ((3364, 3... |
from keras.utils import to_categorical
from keras.models import load_model
import matplotlib.pyplot as plt
'''lib loading error prevention'''
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
'''========================'''
'''tensorflow configuration'''
'''========================'''
import tensorflow as tf
from k... | [
"keras.models.load_model",
"tensorflow.Session",
"matplotlib.pyplot.plot",
"keras.backend.set_session",
"numpy.argmax",
"keras.utils.to_categorical",
"numpy.array",
"tensorflow.ConfigProto",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((395, 571), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'intra_op_parallelism_threads': 'num_cores', 'inter_op_parallelism_threads': 'num_cores', 'allow_soft_placement': '(True)', 'device_count': "{'CPU': num_CPU, 'GPU': num_GPU}"}), "(intra_op_parallelism_threads=num_cores,\n inter_op_parallelism_threads=nu... |
from django.conf.urls import include, url
from django.contrib import admin
urlpatterns = [
url(r"^accounts/", include("django.contrib.auth.urls")),
url(r"^admin/", admin.site.urls),
url(
r"^microsoft/",
include("sites_microsoft_auth.urls", namespace="sites_microsoft_auth"),
),
]
| [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((157, 188), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (160, 188), False, 'from django.conf.urls import include, url\n'), ((115, 150), 'django.conf.urls.include', 'include', (['"""django.contrib.auth.urls"""'], {}), "('django.contrib.auth.urls')\n", (1... |
from __future__ import annotations
from typing import Optional
from os import PathLike
from math import *
import pygame
class Vector3:
def __init__(self, x=0, y=0, z=0):
self.x = x
self.y = y
self.z = z
self.w = 1
def __add__(a, b):
if type(b) == Vector3:
... | [
"pygame.mouse.get_pressed",
"pygame.event.get",
"colorsys.hsv_to_rgb",
"pygame.key.get_pressed",
"copy.deepcopy"
] | [((3868, 3886), 'pygame.event.get', 'pygame.event.get', ([], {}), '()\n', (3884, 3886), False, 'import pygame\n'), ((12603, 12619), 'copy.deepcopy', 'deepcopy', (['matrix'], {}), '(matrix)\n', (12611, 12619), False, 'from copy import deepcopy\n'), ((2098, 2122), 'pygame.key.get_pressed', 'pygame.key.get_pressed', ([], ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_restplus import fields
from app import api
groups_fields_attributes = api.model('GroupsFieldsAttributes', {
'name': fields.String
})
groups_fields_attributes_post = api.model('GroupsFieldsAttributesPost', {
'name': fields.String(required=True, pattern=... | [
"flask_restplus.fields.String",
"flask_restplus.fields.Nested",
"app.api.model"
] | [((129, 189), 'app.api.model', 'api.model', (['"""GroupsFieldsAttributes"""', "{'name': fields.String}"], {}), "('GroupsFieldsAttributes', {'name': fields.String})\n", (138, 189), False, 'from app import api\n'), ((283, 335), 'flask_restplus.fields.String', 'fields.String', ([], {'required': '(True)', 'pattern': '"""^(... |
import flask
app = flask.Flask(__name__)
from werkzeug.contrib.fixers import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
from flask.ext.babel import Babel
babel = Babel(app)
from flask import render_template
from flask.ext.babel import gettext as _, ngettext
@babel.localeselector
def get_locale():
return 'fr... | [
"werkzeug.contrib.fixers.ProxyFix",
"flask.Flask",
"flask.ext.babel.gettext",
"flask.ext.babel.Babel",
"flask.ext.babel.ngettext"
] | [((19, 40), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (30, 40), False, 'import flask\n'), ((102, 124), 'werkzeug.contrib.fixers.ProxyFix', 'ProxyFix', (['app.wsgi_app'], {}), '(app.wsgi_app)\n', (110, 124), False, 'from werkzeug.contrib.fixers import ProxyFix\n'), ((168, 178), 'flask.ext.babel.B... |
"""1. Calculate Cp from LES data different
wind farm "extractability"
2. Predict Cp using two scale momentum theory
3. Plot results
"""
import numpy as np
import scipy.optimize as sp
import matplotlib.pyplot as plt
#wind farm parameters
#momentum `extractability' factor
zeta=[0,5,10,15,20,25]
#bottom friction exponen... | [
"scipy.optimize.bisect",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"numpy.delete",
"numpy.zeros",
"numpy.linspace",
"matplotlib.pyplot.tight_layout",
"numpy.genfromtxt",
"matplotlib.pyplot.subplots"
] | [((367, 384), 'numpy.zeros', 'np.zeros', (['(50, 6)'], {}), '((50, 6))\n', (375, 384), True, 'import numpy as np\n'), ((407, 419), 'numpy.zeros', 'np.zeros', (['(50)'], {}), '(50)\n', (415, 419), True, 'import numpy as np\n'), ((433, 450), 'numpy.zeros', 'np.zeros', (['(50, 6)'], {}), '((50, 6))\n', (441, 450), True, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File: Ampel-core/ampel/mongo/update/MongoStockIngester.py
# License: BSD-3-Clause
# Author: <NAME> <<EMAIL>>
# Date: 14.12.2017
# Last Modified Date: 21.11.2021
# Last Modified By: <NAME> <<EMAIL>>
from typing im... | [
"ampel.util.collections.try_reduce",
"ampel.mongo.utils.maybe_use_each",
"pymongo.UpdateOne"
] | [((784, 814), 'ampel.mongo.utils.maybe_use_each', 'maybe_use_each', (["doc['channel']"], {}), "(doc['channel'])\n", (798, 814), False, 'from ampel.mongo.utils import maybe_use_each\n'), ((922, 948), 'ampel.mongo.utils.maybe_use_each', 'maybe_use_each', (["doc['tag']"], {}), "(doc['tag'])\n", (936, 948), False, 'from am... |
#!/bin/env python
"""
Icarus Client (High Pressure Apparatus Client Level)
dates: Nov 2017 - Sept 2018
by <NAME> @ National Institutes of Health
I’d like to reorganize the layout with an aim to make it more intuitive and logical. Since we read from left to write, and top to bottom, I’m thinking of shifting the User c... | [
"platform.node",
"wx.StaticLine",
"wx.MessageBox",
"wx.Font",
"wx.App",
"epics.wx.PVText",
"epics.wx.PVBitmap",
"platform.system",
"os.getpid",
"wx.Frame.__init__",
"wx.Panel",
"wx.Colour",
"socket.gethostname",
"icarus_nmr.pyepics.PVImage",
"epics.wx.PVButton",
"wx.GridBagSizer",
"m... | [((1282, 1293), 'os.getpid', 'os.getpid', ([], {}), '()\n', (1291, 1293), False, 'import psutil, os\n'), ((1398, 1415), 'platform.system', 'platform.system', ([], {}), '()\n', (1413, 1415), False, 'import platform\n'), ((2125, 2142), 'platform.system', 'platform.system', ([], {}), '()\n', (2140, 2142), False, 'import p... |
from elasticsearch import Elasticsearch
import pandas as pd
import numpy as np
from elasticsearch.helpers import scan
es = Elasticsearch(["ec2-3-135-203-125.us-east-2.compute.amazonaws.com","ec2-13-58-53-1.us-east-2.compute.amazonaws.com","ec2-18-220-232-235.us-east-2.compute.amazonaws.com","ec2-18-224-63-68.us-ea... | [
"pandas.DataFrame",
"elasticsearch.Elasticsearch",
"elasticsearch.helpers.scan",
"pandas.to_datetime"
] | [((128, 434), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["['ec2-3-135-203-125.us-east-2.compute.amazonaws.com',\n 'ec2-13-58-53-1.us-east-2.compute.amazonaws.com',\n 'ec2-18-220-232-235.us-east-2.compute.amazonaws.com',\n 'ec2-18-224-63-68.us-east-2.compute.amazonaws.com']"], {'http_auth': "('elastic', ... |
'''
模拟多项式函数的拟合过程
'''
import tensorflow as tf
import tensorflow.keras as ks
import numpy as np
import matplotlib.pyplot as plt
from IPython import display
# 自定义训练集、测试集、权重和偏量
n_train,n_test,true_w,true_b=100,100,[1.2,-3.4,5.6],5
features=tf.random.normal(shape=(n_train+n_test,1))
poly_features=tf.concat([featu... | [
"tensorflow.random.normal",
"matplotlib.pyplot.semilogy",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"tensorflow.losses.MeanSquaredError",
"tensorflow.keras.Sequential",
"matplotlib.pyplot.xlabel",
"tensorflow.pow",
"tensorflow.data.Dataset.from_tensor_slices",
"tensorflow.keras.optimiz... | [((246, 291), 'tensorflow.random.normal', 'tf.random.normal', ([], {'shape': '(n_train + n_test, 1)'}), '(shape=(n_train + n_test, 1))\n', (262, 291), True, 'import tensorflow as tf\n'), ((533, 591), 'tensorflow.random.normal', 'tf.random.normal', ([], {'shape': 'labels.shape', 'mean': '(0.0)', 'stddev': '(0.1)'}), '(s... |
#!/usr/bin/env python
import os
import re
import sys
import socket
import struct
ip_pattern = re.compile("(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")
def findIPAddress(value):
try:
# Might be a simple integer
return int(value)
except ValueError:
m = ip_pattern.search(value)
if m: #... | [
"socket.gethostbyname",
"socket.inet_aton",
"re.compile"
] | [((96, 153), 're.compile', 're.compile', (['"""(\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})"""'], {}), "('(\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3})')\n", (106, 153), False, 'import re\n'), ((530, 550), 'socket.inet_aton', 'socket.inet_aton', (['ip'], {}), '(ip)\n', (546, 550), False, 'impor... |
import os
from distutils.command.install_lib import install_lib
from distutils.core import setup
class g8stor_client_install_lib(install_lib):
def run(self):
# run default handler
install_lib.run(self)
# locating destination
target = os.path.join(self.install_dir, 'g8storclient')
... | [
"distutils.command.install_lib.install_lib.run",
"os.path.exists",
"distutils.core.setup",
"os.path.join",
"os.symlink",
"os.getcwd",
"os.chdir"
] | [((749, 1152), 'distutils.core.setup', 'setup', ([], {'name': '"""g8storclient"""', 'packages': "['g8storclient']", 'version': '"""0.1.5"""', 'description': '"""g8os stor native driver"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/jumpscale/g8stor-client-pypi"""', 'downlo... |
import numpy as np
import pdb
class History:
def __init__(self, data_format, batch_size, history_length, screen_dims):
self.data_format = data_format
self.history = np.zeros([history_length] + list(screen_dims), dtype=np.float32)
def add(self, screen):
self.history[:-1] = self.history[1:]
self... | [
"numpy.transpose"
] | [((483, 520), 'numpy.transpose', 'np.transpose', (['self.history', '(1, 2, 0)'], {}), '(self.history, (1, 2, 0))\n', (495, 520), True, 'import numpy as np\n')] |
"""
This modules performs spectral analysis of EEG signals (sometimes
refered as quantitative EEG) on a mne object. EEG Sleep EEG is ideally suited
to frequency and time-frequency analysis, since different stages or
micro-elements (such as spindles, K-complexes, slow waves) have
specific frequency characteristics [1].
... | [
"numpy.hstack",
"psga.features.time_features.compute_maximum_value_epochs",
"numpy.log",
"numpy.column_stack",
"psga.features.utils.power_spectrum",
"numpy.arange",
"numpy.asarray",
"psga.features.time_features.compute_zero_crossings",
"pandas.DataFrame.from_dict",
"psga.features.utils._psd_params... | [((14328, 14395), 'numpy.asarray', 'np.asarray', (["(Stages['onset'].values * raw.info['sfreq'])"], {'dtype': '"""int"""'}), "(Stages['onset'].values * raw.info['sfreq'], dtype='int')\n", (14338, 14395), True, 'import numpy as np\n'), ((14406, 14476), 'numpy.asarray', 'np.asarray', (["(Stages['duration'].values * raw.i... |
"""Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mhangar` python will execute
``__main__.py``... | [
"click.Choice",
"time.sleep",
"click.echo",
"click.ClickException",
"click.progressbar",
"hangar.Repository",
"click.make_pass_decorator",
"pathlib.Path",
"click.group",
"click.option",
"hangar.remote.server.serve",
"hangar.records.summarize.status",
"hangar.records.summarize.details",
"cl... | [((831, 881), 'click.make_pass_decorator', 'click.make_pass_decorator', (['Repository'], {'ensure': '(True)'}), '(Repository, ensure=True)\n', (856, 881), False, 'import click\n'), ((885, 973), 'click.group', 'click.group', ([], {'no_args_is_help': '(True)', 'add_help_option': '(True)', 'invoke_without_command': '(True... |
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
from com.android.monkeyrunner.easy import EasyMonkeyDevice
from com.android.monkeyrunner.easy import By
import time
def get_package():
return 'org.solovyev.android.messenger'
def get_start_activity():
return '.StartActivity'
def get_actions(d... | [
"com.android.monkeyrunner.easy.EasyMonkeyDevice",
"com.android.monkeyrunner.easy.By.id",
"time.sleep"
] | [((1823, 1836), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (1833, 1836), False, 'import time\n'), ((2031, 2044), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (2041, 2044), False, 'import time\n'), ((2153, 2177), 'com.android.monkeyrunner.easy.EasyMonkeyDevice', 'EasyMonkeyDevice', (['device'], {}), '(de... |
# -*- coding: utf-8 -*-
import numpy as np
from numpy import ndarray
from numba import njit, prange
__cache = True
@njit(nogil=True, cache=__cache)
def shape_function_values(x, L):
"""
Evaluates the shape functions at a point x in the range [-1, 1].
"""
return np.array([
[
0.5 * x ... | [
"numpy.array",
"numpy.zeros",
"numba.njit",
"numba.prange"
] | [((118, 149), 'numba.njit', 'njit', ([], {'nogil': '(True)', 'cache': '__cache'}), '(nogil=True, cache=__cache)\n', (122, 149), False, 'from numba import njit, prange\n'), ((1148, 1179), 'numba.njit', 'njit', ([], {'nogil': '(True)', 'cache': '__cache'}), '(nogil=True, cache=__cache)\n', (1152, 1179), False, 'from numb... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | [
"warehouse.i18n._locale",
"pretend.stub",
"pretend.call",
"warehouse.i18n.includeme",
"pretend.call_recorder"
] | [((638, 652), 'pretend.stub', 'pretend.stub', ([], {}), '()\n', (650, 652), False, 'import pretend\n'), ((1189, 1211), 'warehouse.i18n.includeme', 'i18n.includeme', (['config'], {}), '(config)\n', (1203, 1211), False, 'from warehouse import i18n\n'), ((868, 889), 'warehouse.i18n._locale', 'i18n._locale', (['request'], ... |
import os
import glob
import pandas as pd
import datetime as dt
from typing import Any, Iterator, Sequence, Optional, Union
from ..logger import get_logger
from .. import files, sql
from . import connection
logger = get_logger(__name__)
def upload_csv(
csv_path: str,
schema: str,
table: str,
*,
... | [
"os.path.exists",
"os.makedirs",
"pandas.read_csv",
"os.getcwd",
"os.path.dirname",
"datetime.datetime.now",
"os.mkdir",
"os.path.basename",
"pandas.concat",
"os.remove"
] | [((1180, 1206), 'os.path.basename', 'os.path.basename', (['csv_path'], {}), '(csv_path)\n', (1196, 1206), False, 'import os\n'), ((2719, 2745), 'os.path.basename', 'os.path.basename', (['csv_path'], {}), '(csv_path)\n', (2735, 2745), False, 'import os\n'), ((2760, 2785), 'os.path.dirname', 'os.path.dirname', (['csv_pat... |
from datetime import datetime
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from django.db.models import Q
from django.shortcuts import render, get_object_or_404, redirect
# Create your views here.
from django.urls import reverse
from django.views.decorators.... | [
"django.shortcuts.render",
"django.contrib.auth.get_user_model",
"django.shortcuts.get_object_or_404",
"django.views.decorators.http.require_http_methods",
"datetime.datetime.now",
"django.contrib.auth.decorators.login_required",
"django.urls.reverse",
"django.db.models.Q"
] | [((398, 414), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (412, 414), False, 'from django.contrib.auth import get_user_model\n'), ((417, 433), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {}), '()\n', (431, 433), False, 'from django.contrib.auth.decorators import... |
# ===============================================================================
# Copyright 2013 <NAME>
#
# 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/LI... | [
"traits.api.Bool",
"traits.api.on_trait_change",
"six.moves.zip",
"chaco.plot_label.PlotLabel"
] | [((2832, 2842), 'traits.api.Bool', 'Bool', (['(True)'], {}), '(True)\n', (2836, 2842), False, 'from traits.api import List, Bool, Int, on_trait_change, Color\n'), ((2862, 2872), 'traits.api.Bool', 'Bool', (['(True)'], {}), '(True)\n', (2866, 2872), False, 'from traits.api import List, Bool, Int, on_trait_change, Color\... |
#-*- coding: utf-8 -*-
""" 通过某个关键字排序一个字典列表 """
from operator import itemgetter
rows = [
{'fname': 'Brian', 'lname': 'Jones', 'uid': 1003},
{'fname': 'David', 'lname': 'Beazley', 'uid': 1002},
{'fname': 'John', 'lname': 'Cleese', 'uid': 1002},
{'fname': 'Big', 'lname': 'Jones', 'uid': 1004}
]
rows_by_f... | [
"operator.itemgetter"
] | [((344, 363), 'operator.itemgetter', 'itemgetter', (['"""fname"""'], {}), "('fname')\n", (354, 363), False, 'from operator import itemgetter\n'), ((396, 413), 'operator.itemgetter', 'itemgetter', (['"""uid"""'], {}), "('uid')\n", (406, 413), False, 'from operator import itemgetter\n'), ((452, 478), 'operator.itemgetter... |
"""Synchronous client."""
from socket import socket
from typing import Optional
from rcon.exceptions import RequestIdMismatch, WrongPassword
from rcon.proto import Packet, Type
__all__ = ['Client']
class Client:
"""An RCON client."""
__slots__ = ('_socket', 'host', 'port', 'passwd')
def __init__(sel... | [
"rcon.proto.Packet.read",
"rcon.exceptions.RequestIdMismatch",
"socket.socket",
"rcon.proto.Packet.make_login",
"rcon.proto.Packet.make_command",
"rcon.exceptions.WrongPassword"
] | [((545, 553), 'socket.socket', 'socket', ([], {}), '()\n', (551, 553), False, 'from socket import socket\n'), ((2612, 2652), 'rcon.proto.Packet.make_command', 'Packet.make_command', (['command', '*arguments'], {}), '(command, *arguments)\n', (2631, 2652), False, 'from rcon.proto import Packet, Type\n'), ((2017, 2034), ... |
"""Print scikit-validate version"""
import click
import sys
from . import __version__
from . import config as cfg
from . import connection as glc
def print_version(plain):
if plain:
click.echo(__version__)
else:
click.echo("gitlab-migrate version: {}".format(__version__))
def migration_ins... | [
"click.confirm",
"click.option",
"click.echo",
"click.Path",
"sys.exit",
"click.command"
] | [((1285, 1312), 'click.command', 'click.command', ([], {'help': '__doc__'}), '(help=__doc__)\n', (1298, 1312), False, 'import click\n'), ((1391, 1430), 'click.option', 'click.option', (['"""--version"""'], {'is_flag': '(True)'}), "('--version', is_flag=True)\n", (1403, 1430), False, 'import click\n'), ((1432, 1469), 'c... |
# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------
# Huawei.MA5600T.get_metrics
# ---------------------------------------------------------------------
# Copyright (C) 2007-2019 The NOC Project
# See LICENSE for details
# -----------------------------------------------------... | [
"noc.core.text.parse_kv",
"noc.sa.profiles.Generic.get_metrics.metrics"
] | [((1124, 1436), 'noc.sa.profiles.Generic.get_metrics.metrics', 'metrics', (["['Interface | DOM | RxPower', 'Interface | DOM | TxPower',\n 'Interface | DOM | Voltage', 'Interface | DOM | Bias Current',\n 'Interface | DOM | Temperature', 'Interface | Errors | BIP | In',\n 'Interface | Errors | BIP | Out']"], {'h... |
###
### Read a geometry from a single xml file created from mfxmlwriter.py
### and write it into a db file.
###
import FWCore.ParameterSet.Config as cms
process = cms.Process("MagneticFieldWriter")
process.load("CondCore.DBCommon.CondDBCommon_cfi")
#GEOMETRY_VERSION = '90322'
#GEOMETRY_VERSION = '120812'
#GEOMETRY_... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.Path",
"FWCore.ParameterSet.Config.uint64"
] | [((165, 199), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""MagneticFieldWriter"""'], {}), "('MagneticFieldWriter')\n", (176, 199), True, 'import FWCore.ParameterSet.Config as cms\n'), ((1370, 1421), 'FWCore.ParameterSet.Config.untracked.string', 'cms.untracked.string', (['"""TBufferBlobStreamingService"""... |
from helper import unittest, PillowTestCase, hopper
from test_imageqt import PillowQtTestCase, PillowQPixmapTestCase
from PIL import ImageQt
class TestFromQPixmap(PillowQPixmapTestCase, PillowTestCase):
def roundtrip(self, expected):
PillowQtTestCase.setUp(self)
result = ImageQt.fromqpixmap(Imag... | [
"helper.hopper",
"helper.unittest.main",
"test_imageqt.PillowQtTestCase.setUp",
"PIL.ImageQt.toqpixmap"
] | [((821, 836), 'helper.unittest.main', 'unittest.main', ([], {}), '()\n', (834, 836), False, 'from helper import unittest, PillowTestCase, hopper\n'), ((250, 278), 'test_imageqt.PillowQtTestCase.setUp', 'PillowQtTestCase.setUp', (['self'], {}), '(self)\n', (272, 278), False, 'from test_imageqt import PillowQtTestCase, P... |
"""
Created on Sun Jan 5 15:22:02 2020
@author: Mohammad
"""
from sklearn.datasets import load_iris
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import svm
import matplotlib.pyplot as plt
from sklearn.datasets.samples_generator import make_circles
from sklearn.metri... | [
"sklearn.datasets.load_iris",
"sklearn.svm.SVC",
"sklearn.model_selection.cross_val_score",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"sklearn.model_selection.StratifiedKFold",
"matplotlib.pyplot.show"
] | [((421, 447), 'sklearn.datasets.load_iris', 'load_iris', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (430, 447), False, 'from sklearn.datasets import load_iris\n'), ((457, 498), 'sklearn.model_selection.StratifiedKFold', 'StratifiedKFold', ([], {'n_splits': '(4)', 'shuffle': '(True)'}), '(n_splits=4, shuffle... |
import time
import json
from typing import List, Iterable
def parse_to_dict(input_data: List[str]) -> str:
# check if input_data is VALID here or before calling this function
parsed_data = {
"time": input_data[0],
"id": input_data[1],
"air_pres": input_data[2],
"voc": input_data[3], # it's volatile... | [
"json.loads",
"time.time"
] | [((848, 870), 'json.loads', 'json.loads', (['parsed_str'], {}), '(parsed_str)\n', (858, 870), False, 'import json\n'), ((737, 748), 'time.time', 'time.time', ([], {}), '()\n', (746, 748), False, 'import time\n')] |
"""payment_table_change
Revision ID: f35e4c5621ac
Revises: <KEY>
Create Date: 2019-06-19 13:28:19.059113
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'f35e4c5621ac'
down_revision = '<KEY>'
branch_labels = None
depen... | [
"alembic.op.drop_column",
"sqlalchemy.dialects.postgresql.DOUBLE_PRECISION"
] | [((420, 453), 'alembic.op.drop_column', 'op.drop_column', (['"""payment"""', '"""paid"""'], {}), "('payment', 'paid')\n", (434, 453), False, 'from alembic import op\n'), ((621, 662), 'sqlalchemy.dialects.postgresql.DOUBLE_PRECISION', 'postgresql.DOUBLE_PRECISION', ([], {'precision': '(53)'}), '(precision=53)\n', (648, ... |
from stackstrap.commands import Command, CommandError
from stackstrap.template import Template
class Remove(Command):
"Remove a template"
name = 'remove'
def setup_parser(self, parser):
self.parser = parser
self.parser.add_argument(
'name',
metavar='NAME',
... | [
"stackstrap.template.Template",
"stackstrap.commands.CommandError"
] | [((421, 440), 'stackstrap.template.Template', 'Template', (['args.name'], {}), '(args.name)\n', (429, 440), False, 'from stackstrap.template import Template\n'), ((491, 544), 'stackstrap.commands.CommandError', 'CommandError', (["('Invalid template name: %s' % args.name)"], {}), "('Invalid template name: %s' % args.nam... |
import click
from db_helper import add_task, remove_task, get_list
from wallpaper import set_wallpaper
@click.command()
@click.option('-a', '--add', help='Task you want to add')
@click.option('-rm', '--remove', help='Type comma separated IDs of tasks you want to remove OR all to remove all tasks')
def cli(add, remove... | [
"click.option",
"wallpaper.set_wallpaper",
"db_helper.get_list",
"db_helper.remove_task",
"click.echo",
"db_helper.add_task",
"click.command"
] | [((106, 121), 'click.command', 'click.command', ([], {}), '()\n', (119, 121), False, 'import click\n'), ((123, 179), 'click.option', 'click.option', (['"""-a"""', '"""--add"""'], {'help': '"""Task you want to add"""'}), "('-a', '--add', help='Task you want to add')\n", (135, 179), False, 'import click\n'), ((181, 310),... |
from handlers.decorators import OsuEvent
from packets.OsuPacketID import OsuPacketID
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from objects.Player import Player
# client packet: 44, bancho response: update match
@OsuEvent.register_handler(OsuPacketID.Client_MatchStart)
async def match_change_team(_, to... | [
"handlers.decorators.OsuEvent.register_handler"
] | [((230, 286), 'handlers.decorators.OsuEvent.register_handler', 'OsuEvent.register_handler', (['OsuPacketID.Client_MatchStart'], {}), '(OsuPacketID.Client_MatchStart)\n', (255, 286), False, 'from handlers.decorators import OsuEvent\n')] |