code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from __future__ import absolute_import, division
import logging
import time
from builtins import int
import numpy as np
from future.utils import raise_with_traceback
from scipy.stats import ks_2samp
from sklearn.metrics import silhouette_score
from .mediods import k_medoids
from .tfidf import get_n_top_keywords
from... | [
"numpy.average",
"numpy.zeros",
"numpy.apply_along_axis",
"numpy.linalg.norm",
"numpy.argmin",
"builtins.int",
"sklearn.metrics.silhouette_score",
"time.time",
"logging.error"
] | [((1002, 1049), 'numpy.zeros', 'np.zeros', (['(chunks_num, similarites_vector_size)'], {}), '((chunks_num, similarites_vector_size))\n', (1010, 1049), True, 'import numpy as np\n'), ((1744, 1815), 'numpy.apply_along_axis', 'np.apply_along_axis', (['ks_2samp', '(1)', 'second_mat[j - T + 1:j]', 'first_mat[i]'], {}), '(ks... |
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 12 17:13:27 2020
@author: ThachLN
Install libraries:
pip install pypdf2
Refer:
http://www.blog.pythonlibrary.org/2018/04/11/splitting-and-merging-pdfs-with-python/
"""
import os, sys
from PyPDF2 import PdfFileReader, PdfFileWriter
def pdf_splitter(path, outFold... | [
"PyPDF2.PdfFileWriter",
"PyPDF2.PdfFileReader",
"os.path.basename"
] | [((444, 463), 'PyPDF2.PdfFileReader', 'PdfFileReader', (['path'], {}), '(path)\n', (457, 463), False, 'from PyPDF2 import PdfFileReader, PdfFileWriter\n'), ((598, 613), 'PyPDF2.PdfFileWriter', 'PdfFileWriter', ([], {}), '()\n', (611, 613), False, 'from PyPDF2 import PdfFileReader, PdfFileWriter\n'), ((354, 376), 'os.pa... |
# from django.contrib.auth.models import User
from django.db import models
from django.urls import reverse
class Person(models.Model):
name = models.CharField('Nome',max_length=100)
birthday = models.DateField('Aniversário')
observation = models.CharField('Observações',max_length=100)
purchase_limit =... | [
"django.db.models.DateField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DecimalField",
"django.db.models.CharField"
] | [((148, 188), 'django.db.models.CharField', 'models.CharField', (['"""Nome"""'], {'max_length': '(100)'}), "('Nome', max_length=100)\n", (164, 188), False, 'from django.db import models\n'), ((203, 234), 'django.db.models.DateField', 'models.DateField', (['"""Aniversário"""'], {}), "('Aniversário')\n", (219, 234), Fals... |
# encoding: utf-8
# butterfly.py
# TODO fix documentation
import numpy as np
from math import sqrt
from numba import jit
from scipy.linalg import block_diag
from scipy.stats import chi
from .basics import get_D, radius, rnsimp
NQ = 3
@jit(nopython=True)
def butterfly_generating_vector(n):
'''
Generates... | [
"numpy.prod",
"numpy.sqrt",
"numpy.random.rand",
"math.sqrt",
"numpy.array",
"numpy.arctan2",
"numpy.einsum",
"numpy.sin",
"numpy.arange",
"numpy.repeat",
"numpy.empty",
"numpy.vstack",
"numpy.concatenate",
"numpy.diagflat",
"numpy.ceil",
"numpy.eye",
"numpy.fill_diagonal",
"numba.... | [((244, 262), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (247, 262), False, 'from numba import jit\n'), ((1468, 1486), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (1471, 1486), False, 'from numba import jit\n'), ((1980, 1998), 'numba.jit', 'jit', ([], {'nopython': ... |
from datetime import datetime, timedelta
import json
import os
from bs4 import BeautifulSoup
from dateutil.parser import parse as dateparse
import requests
START_DATE = dateparse("2008-03-15").date()
def main():
number_ones = open_hot_100_file("hot-100.json")
number_ones["_last_updated"] = dateparse(
... | [
"dateutil.parser.parse",
"requests.get",
"bs4.BeautifulSoup",
"os.path.isfile",
"datetime.datetime.now",
"json.load",
"datetime.timedelta",
"json.dump"
] | [((1953, 1971), 'requests.get', 'requests.get', (['site'], {}), '(site)\n', (1965, 1971), False, 'import requests\n'), ((1983, 2025), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.content', '"""html.parser"""'], {}), "(page.content, 'html.parser')\n", (1996, 2025), False, 'from bs4 import BeautifulSoup\n'), ((3928, 394... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 1 23:29:40 2021
@author: <NAME>
Converted from Yi Jiang's 'postProcess.m''
"""
import numpy as np
from skimage.transform import rotate, rescale
def sind(x):
return np.sin(x * np.pi / 180)
def cosd(x):
return np.cos(x * np.pi / 180)
def removePhaseRamp(input, d... | [
"numpy.ceil",
"skimage.transform.rotate",
"numpy.size",
"numpy.floor",
"numpy.angle",
"numpy.exp",
"numpy.array",
"numpy.cos",
"numpy.linalg.lstsq",
"numpy.sin",
"numpy.meshgrid",
"skimage.transform.rescale"
] | [((218, 241), 'numpy.sin', 'np.sin', (['(x * np.pi / 180)'], {}), '(x * np.pi / 180)\n', (224, 241), True, 'import numpy as np\n'), ((267, 290), 'numpy.cos', 'np.cos', (['(x * np.pi / 180)'], {}), '(x * np.pi / 180)\n', (273, 290), True, 'import numpy as np\n'), ((496, 513), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y']... |
from mitmproxy import http
import re
def request(flow):
if 'golden.secret' in flow.request.url or re.match(r'^http://127.0.0.1:8000/[a-z._/]*$', flow.request.url) is None:
flow.response = http.HTTPResponse.make(401, b"Haha! Only allowed hats can see this page!")
def response(flow):
flow.response.heade... | [
"mitmproxy.http.HTTPResponse.make",
"re.match"
] | [((201, 275), 'mitmproxy.http.HTTPResponse.make', 'http.HTTPResponse.make', (['(401)', "b'Haha! Only allowed hats can see this page!'"], {}), "(401, b'Haha! Only allowed hats can see this page!')\n", (223, 275), False, 'from mitmproxy import http\n'), ((103, 166), 're.match', 're.match', (['"""^http://127.0.0.1:8000/[a... |
'''
New Integration test for cold migration of data volume from snapshot with snapshot between hosts.
@author: SyZhao
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.volume_operations as vol_ops
import zstackwoodpecker.operations.reso... | [
"zstackwoodpecker.test_lib.lib_error_cleanup",
"zstackwoodpecker.test_state.TestStateDict",
"zstackwoodpecker.test_util.test_pass",
"zstackwoodpecker.test_util.test_skip",
"zstackwoodpecker.test_util.test_dsc",
"zstackwoodpecker.operations.volume_operations.migrate_volume",
"zstackwoodpecker.test_lib.li... | [((551, 579), 'zstackwoodpecker.test_lib.lib_get_test_stub', 'test_lib.lib_get_test_stub', ([], {}), '()\n', (577, 579), True, 'import zstackwoodpecker.test_lib as test_lib\n'), ((596, 622), 'zstackwoodpecker.test_state.TestStateDict', 'test_state.TestStateDict', ([], {}), '()\n', (620, 622), True, 'import zstackwoodpe... |
import vim
import json
class config_manager:
def __init__(self, root_path):
try:
self.root_path = root_path
self.marked = []
self.load_array = None
self.err = None
with open(root_path + '/.vim-sync', 'r') as f:
self.load_array = js... | [
"json.load",
"vim.command"
] | [((1327, 1368), 'vim.command', 'vim.command', (['"""let g:all_vim_sync_dest=[]"""'], {}), "('let g:all_vim_sync_dest=[]')\n", (1338, 1368), False, 'import vim\n'), ((1421, 1489), 'vim.command', 'vim.command', (['(\'call add(g:all_vim_sync_dest, "%s")\' % element[\'dest\'])'], {}), '(\'call add(g:all_vim_sync_dest, "%s"... |
from dipdup.models import Transaction
from dipdup.context import HandlerContext
import tzprofiles_indexer.models as models
from tzprofiles_indexer.types.tzprofile.parameter.default import DefaultParameter
from tzprofiles_indexer.types.tzprofile.storage import TzprofileStorage
from tzprofiles_indexer.handlers import r... | [
"tzprofiles_indexer.models.TZProfile.get",
"tzprofiles_indexer.handlers.resolve_profile"
] | [((485, 545), 'tzprofiles_indexer.models.TZProfile.get', 'models.TZProfile.get', ([], {'account': 'tzprofile_update.storage.owner'}), '(account=tzprofile_update.storage.owner)\n', (505, 545), True, 'import tzprofiles_indexer.models as models\n'), ((1010, 1067), 'tzprofiles_indexer.handlers.resolve_profile', 'resolve_pr... |
"""
A module for plotting candlesticks
"""
import pandas as pd
from pyalgotrading.constants import PlotType
def import_with_install(package_import_name, package_install_name=None, dependancies=()):
"""
Helps import 'package' even if its not installed.
If package is installed, it will be imported and ret... | [
"plotly.graph_objects.Scatter",
"plotly.graph_objects.Candlestick",
"plotly.subplots.make_subplots",
"subprocess.check_call"
] | [((4452, 4565), 'plotly.subplots.make_subplots', 'make_subplots', ([], {'rows': '(3)', 'cols': '(1)', 'vertical_spacing': '(0.05)', 'shared_xaxes': '(True)', 'specs': "[[{'rowspan': 2}], [{}], [{}]]"}), "(rows=3, cols=1, vertical_spacing=0.05, shared_xaxes=True,\n specs=[[{'rowspan': 2}], [{}], [{}]])\n", (4465, 456... |
from __future__ import annotations
from enum import Enum
from puzzle_input import puzzle_input
from typing import NamedTuple
class Cucumber(Enum):
none = "."
east = ">"
south = "v"
class Coord(NamedTuple):
x: int
y: int
GridT = list[list[Cucumber]]
def can_move(grid: GridT, from_: Coord) ->... | [
"puzzle_input.puzzle_input"
] | [((1828, 1842), 'puzzle_input.puzzle_input', 'puzzle_input', ([], {}), '()\n', (1840, 1842), False, 'from puzzle_input import puzzle_input\n')] |
# uses the FHIR_parser project at: https://pypi.org/project/FHIR-Parser/
from haversine import haversine
from fhir_parser import FHIR, Patient, Observation
fhir = FHIR()
def loadpatients(filteroption=None, key=None, lat=None, long=None):
patients = fhir.get_all_patients()
if filteroption is None or key is ... | [
"fhir_parser.FHIR",
"haversine.haversine"
] | [((165, 171), 'fhir_parser.FHIR', 'FHIR', ([], {}), '()\n', (169, 171), False, 'from fhir_parser import FHIR, Patient, Observation\n'), ((792, 884), 'haversine.haversine', 'haversine', (['(lat, long)', '(patient.addresses[0].latitude, patient.addresses[0].longitude)'], {}), '((lat, long), (patient.addresses[0].latitude... |
# importing required libraries of opencv
import cv2
import glob
import random as rd
from scipy.stats import wasserstein_distance
import numpy as np
from matplotlib import pyplot as plt
hist_success, hist_failure = [], []
def showMultiPlot(path, color, title, i):
list_images = [cv2.imread(file) for file in glob.... | [
"random.choice",
"matplotlib.pyplot.savefig",
"cv2.calcHist",
"matplotlib.pyplot.legend",
"cv2.imread",
"glob.glob",
"matplotlib.pyplot.show"
] | [((1170, 1182), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (1180, 1182), True, 'from matplotlib import pyplot as plt\n'), ((1183, 1193), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1191, 1193), True, 'from matplotlib import pyplot as plt\n'), ((286, 302), 'cv2.imread', 'cv2.imread', (['fil... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `fpipy.raw` module."""
import numpy as np
import xarray as xr
import xarray.testing as xrt
import fpipy.raw as fpr
import fpipy.conventions as c
from fpipy.raw import BayerPattern
def test_read_calibration_format(calib_seq):
assert type(calib_seq) is x... | [
"fpipy.raw.BayerPattern.get",
"numpy.ones",
"fpipy.raw.subtract_dark",
"numpy.isnan",
"fpipy.raw.raw_to_radiance",
"numpy.all",
"numpy.bincount",
"xarray.testing.assert_equal",
"fpipy.raw.radiance_to_reflectance"
] | [((2619, 2659), 'numpy.bincount', 'np.bincount', (['rad_computed[c.image_index]'], {}), '(rad_computed[c.image_index])\n', (2630, 2659), True, 'import numpy as np\n'), ((3046, 3072), 'numpy.all', 'np.all', (['(expected == actual)'], {}), '(expected == actual)\n', (3052, 3072), True, 'import numpy as np\n'), ((3510, 354... |
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2020, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is in the file COPYING.txt... | [
"os.path.join",
"PyInstaller.utils.hooks.collect_dynamic_libs",
"glob.glob"
] | [((1183, 1210), 'PyInstaller.utils.hooks.collect_dynamic_libs', 'collect_dynamic_libs', (['"""cv2"""'], {}), "('cv2')\n", (1203, 1210), False, 'from PyInstaller.utils.hooks import collect_dynamic_libs\n'), ((851, 901), 'os.path.join', 'os.path.join', (['compat.base_prefix', '"""Library"""', '"""bin"""'], {}), "(compat.... |
import pytest
from blobmodel import Model
from blobmodel.geometry import Geometry
def test_blob_shape_exception():
with pytest.raises(NotImplementedError):
bm = Model(
Nx=2,
Ny=2,
Lx=10,
Ly=10,
dt=0.5,
T=1,
periodic_y=Fals... | [
"pytest.raises",
"blobmodel.geometry.Geometry",
"blobmodel.Model"
] | [((491, 524), 'blobmodel.geometry.Geometry', 'Geometry', (['(1)', '(1)', '(1)', '(1)', '(1)', '(1)', '(False)'], {}), '(1, 1, 1, 1, 1, 1, False)\n', (499, 524), False, 'from blobmodel.geometry import Geometry\n'), ((685, 783), 'blobmodel.Model', 'Model', ([], {'Nx': '(2)', 'Ny': '(2)', 'Lx': '(10)', 'Ly': '(10)', 'dt':... |
from setuptools import setup
try:
from pip import main as pipmain
except ImportError:
from pip._internal import main as pipmain
# install_requires sucks, I don't know why and I really
# don't care, so I do this:
pipmain(["install", "-r", "requirements.txt"])
scripts = ["scripts/squid-dl", "scripts/squidson"]... | [
"pip._internal.main",
"setuptools.setup"
] | [((222, 268), 'pip._internal.main', 'pipmain', (["['install', '-r', 'requirements.txt']"], {}), "(['install', '-r', 'requirements.txt'])\n", (229, 268), True, 'from pip._internal import main as pipmain\n'), ((322, 607), 'setuptools.setup', 'setup', ([], {'name': '"""squid-dl"""', 'version': '"""0.9"""', 'author': '"""<... |
import tensorflow as tf
import os
from tensorflow.python.framework import graph_util
from tensorflow.python.platform import gfile
def show_help():
help(tf.contrib.lite.TocoConverter)
# 本地的pb文件转换成TensorFlow Lite (float)
def pb_to_tflite(pb_file, save_name, input_arrays, output_arrays):
# graph_def_file = "./... | [
"tensorflow.contrib.lite.TocoConverter.from_saved_model",
"tensorflow.contrib.lite.TocoConverter.from_frozen_graph",
"tensorflow.Session",
"os.path.join",
"tensorflow.GraphDef",
"tensorflow.contrib.lite.TFLiteConverter.from_saved_model",
"tensorflow.python.framework.graph_util.convert_variables_to_const... | [((544, 633), 'tensorflow.contrib.lite.TocoConverter.from_frozen_graph', 'tf.contrib.lite.TocoConverter.from_frozen_graph', (['pb_file', 'input_arrays', 'output_arrays'], {}), '(pb_file, input_arrays,\n output_arrays)\n', (591, 633), True, 'import tensorflow as tf\n'), ((1088, 1165), 'tensorflow.contrib.lite.TocoCon... |
from django.db.models.signals import pre_delete, pre_save
from django.dispatch import receiver
from task.models import InveraTask, TaskLogs
from datetime import datetime
from django.contrib.auth.signals import user_logged_in, user_logged_out, user_login_failed
@receiver(pre_delete, sender=InveraTask)
def audit_log_del... | [
"django.dispatch.receiver",
"datetime.datetime.now"
] | [((263, 302), 'django.dispatch.receiver', 'receiver', (['pre_delete'], {'sender': 'InveraTask'}), '(pre_delete, sender=InveraTask)\n', (271, 302), False, 'from django.dispatch import receiver\n'), ((463, 500), 'django.dispatch.receiver', 'receiver', (['pre_save'], {'sender': 'InveraTask'}), '(pre_save, sender=InveraTas... |
import os
import views as pv
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# serve assets via django, during development
(r'^poll/assets/(?P<path>.*)$', "django.views.static.serve",
{"document_root": os.path.dirname(__file__) + "/assets"}),
# graphs are generated and stored to be v... | [
"os.path.dirname"
] | [((235, 260), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (250, 260), False, 'import os\n'), ((428, 453), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (443, 453), False, 'import os\n')] |
import xml.etree.ElementTree as ET
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.http import HttpResponse
from rdkit import Chem
from rdkit.Chem import AllChem, Draw, Atom, rdFMCS, rdDepictor
import re
from rdkit.Chem.Draw.MolDrawing import DrawingOptions... | [
"rdkit.Chem.AllChem.AddHs",
"rdkit.Chem.Kekulize",
"rdkit.Chem.AllChem.EditableMol",
"frag.utils.network_utils.canon_input",
"rdkit.Chem.rdFMCS.FindMCS",
"rdkit.Chem.Draw.rdMolDraw2D.MolDraw2DSVG",
"rdkit.Chem.AllChem.Compute2DCoords",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.rdDepictor.Compute2DCoor... | [((1226, 1244), 'xml.etree.ElementTree.fromstring', 'ET.fromstring', (['svg'], {}), '(svg)\n', (1239, 1244), True, 'import xml.etree.ElementTree as ET\n'), ((2259, 2334), 'rdkit.Chem.rdFMCS.FindMCS', 'Chem.rdFMCS.FindMCS', (['mols'], {'ringMatchesRingOnly': '(True)', 'completeRingsOnly': '(True)'}), '(mols, ringMatches... |
import pandas as pd
import argparse
import gspread
from gspread_dataframe import get_as_dataframe, set_with_dataframe
"""This module is use to access data from google sheet,
preprocess data, average data by days/hours (if you need),
make csv formate file and stored in data folder.
Example
-------
$ python clean_d... | [
"argparse.ArgumentParser",
"pandas.DatetimeIndex",
"gspread_dataframe.get_as_dataframe",
"gspread.service_account",
"pandas.to_datetime"
] | [((1530, 1583), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""modify dataset"""'}), "(description='modify dataset')\n", (1553, 1583), False, 'import argparse\n'), ((666, 758), 'gspread.service_account', 'gspread.service_account', ([], {'filename': '"""./cow_disease_detection/fetch_data/... |
import pytest
from application import Application
# def is_alert_present(wd):
# try:
# wd.switch_to_alert().text
# return True
# except:
# return False
@pytest.fixture()
def app(request):
fixture = Application()
request.addfinalizer(fixture.destroy)
return fixture
def t... | [
"pytest.fixture",
"application.Application"
] | [((189, 205), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (203, 205), False, 'import pytest\n'), ((238, 251), 'application.Application', 'Application', ([], {}), '()\n', (249, 251), False, 'from application import Application\n')] |
from authlib.jose import JsonWebEncryption
from authlib.jose.drafts import register_jwe_draft
register_jwe_draft(JsonWebEncryption)
| [
"authlib.jose.drafts.register_jwe_draft"
] | [((95, 132), 'authlib.jose.drafts.register_jwe_draft', 'register_jwe_draft', (['JsonWebEncryption'], {}), '(JsonWebEncryption)\n', (113, 132), False, 'from authlib.jose.drafts import register_jwe_draft\n')] |
"""
tick diff-
couts the diffrence between last 2 commits.
"""
import os
import shutil
import zipfile
from subprocess import call
def tickDiff():
"""
code for tick diff
"""
current = os.getcwd()
os.chdir('.tick/commits')
sorted_a = sorted( os.listdir('.'), key=os.path.getmtime)
os.chdir... | [
"os.listdir",
"zipfile.ZipFile",
"os.getcwd",
"os.chdir",
"subprocess.call",
"os.mkdir",
"shutil.rmtree"
] | [((204, 215), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (213, 215), False, 'import os\n'), ((220, 245), 'os.chdir', 'os.chdir', (['""".tick/commits"""'], {}), "('.tick/commits')\n", (228, 245), False, 'import os\n'), ((312, 329), 'os.chdir', 'os.chdir', (['current'], {}), '(current)\n', (320, 329), False, 'import os\... |
#pylint: disable=logging-fstring-interpolation
#Standart library imports
import platform
import re
#Third library imports
from bs4 import BeautifulSoup
# Local imports
from selenium_driver_updater.util.logger import logger
from selenium_driver_updater.driver_base import DriverBase
class SafariDriver(DriverBase):
... | [
"bs4.BeautifulSoup",
"platform.system",
"selenium_driver_updater.util.logger.logger.info",
"selenium_driver_updater.driver_base.DriverBase.__init__"
] | [((460, 495), 'selenium_driver_updater.driver_base.DriverBase.__init__', 'DriverBase.__init__', (['self'], {}), '(self, **kwargs)\n', (479, 495), False, 'from selenium_driver_updater.driver_base import DriverBase\n'), ((2167, 2206), 'bs4.BeautifulSoup', 'BeautifulSoup', (['json_data', '"""html.parser"""'], {}), "(json_... |
from django.conf.urls import url
from base import views as base_views
from django.urls import re_path, path
app_name = 'base'
urlpatterns = [
re_path(r'',
base_views.ProtectedDataView.as_view(),
name='protected_data'),
]
| [
"base.views.ProtectedDataView.as_view"
] | [((168, 206), 'base.views.ProtectedDataView.as_view', 'base_views.ProtectedDataView.as_view', ([], {}), '()\n', (204, 206), True, 'from base import views as base_views\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 25 11:41:02 2021
@author: ike
"""
import numpy as np
import pandas as pd
from ..utils.csvreader import CSVReader
from ..utils.csvcolumns import STIM
voltage=2.437588
def count_frames(
filename, threshold=1, volCol="AIN4", fCol="frames... | [
"numpy.mean",
"numpy.ones",
"numpy.diff",
"numpy.max",
"numpy.round"
] | [((3491, 3502), 'numpy.max', 'np.max', (['rel'], {}), '(rel)\n', (3497, 3502), True, 'import numpy as np\n'), ((5390, 5417), 'numpy.mean', 'np.mean', (['(dfs[1:] - dfs[:-1])'], {}), '(dfs[1:] - dfs[:-1])\n', (5397, 5417), True, 'import numpy as np\n'), ((2217, 2253), 'numpy.round', 'np.round', (['(max_t_step / time_int... |
# -*- coding: utf-8 -*-
import cv2
import os
import dlib
from scipy import misc
import numpy as np
from PIL import Image
def getBound(img, shape):
xMin = len(img[0])
xMax = 0
yMin = len(img)
yMax = 0
for i in range(shape.num_parts):
if (shape.part(i).x < xMin):
x... | [
"numpy.uint8",
"os.path.exists",
"os.listdir",
"numpy.reshape",
"PIL.Image.new",
"scipy.misc.imsave",
"os.path.join",
"dlib.shape_predictor",
"dlib.get_frontal_face_detector",
"numpy.zeros",
"os.mkdir",
"cv2.resize",
"cv2.imread"
] | [((648, 700), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(imga.shape[0] * 2, imga.shape[1])'], {}), "('RGB', (imga.shape[0] * 2, imga.shape[1]))\n", (657, 700), False, 'from PIL import Image\n'), ((1337, 1370), 'dlib.shape_predictor', 'dlib.shape_predictor', (['shape_model'], {}), '(shape_model)\n', (1357, 1370), Fa... |
import numbers
import math
from functools import total_ordering
from euclidean.exceptions import unexpected_type_error
def cross2(v1, v2):
return v1.x * v2.y - v1.y * v2.x
def dot2(v1, v2):
return v1.x * v2.x + v1.y * v2.y
class Cartesian2:
__slots__ = ("_coords",)
coords = property(lambda self... | [
"math.cos",
"euclidean.exceptions.unexpected_type_error",
"math.sin"
] | [((1911, 1928), 'math.cos', 'math.cos', (['radians'], {}), '(radians)\n', (1919, 1928), False, 'import math\n'), ((1943, 1960), 'math.sin', 'math.sin', (['radians'], {}), '(radians)\n', (1951, 1960), False, 'import math\n'), ((1180, 1221), 'euclidean.exceptions.unexpected_type_error', 'unexpected_type_error', (['"""oth... |
#!/usr/bin/env python3
from __future__ import generator_stop
import sys
# Different from setuptools script, because we want the one in this dir.
from sopel.cli import run
sys.exit(run.main())
| [
"sopel.cli.run.main"
] | [((183, 193), 'sopel.cli.run.main', 'run.main', ([], {}), '()\n', (191, 193), False, 'from sopel.cli import run\n')] |
import torch
import calibration as cal
class TScalCalibrator:
def __init__(self, num_bins):
self._num_bins = num_bins
self._temp = None
def train_calibration(self, zs, ys):
best_ece = 10000
log_zs = torch.log(zs)
for temp in [0.1, 0.5, 0.8, 0.9, 1.0, 1.1, 1.25, 1.5, 1.... | [
"torch.softmax",
"torch.log"
] | [((242, 255), 'torch.log', 'torch.log', (['zs'], {}), '(zs)\n', (251, 255), False, 'import torch\n'), ((735, 748), 'torch.log', 'torch.log', (['zs'], {}), '(zs)\n', (744, 748), False, 'import torch\n'), ((769, 811), 'torch.softmax', 'torch.softmax', (['(log_zs / self._temp)'], {'dim': '(-1)'}), '(log_zs / self._temp, d... |
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.rarithmetic import maxint
from rpython.rtyper.lltypesystem import lltype, rffi
from pypy.interpreter.error import OperationError, oefmt
from pypy.module._hpy_universal.apiset import API
@API.func("HPy HPyLong_FromLong(HPyContext *ctx, long value... | [
"pypy.module._hpy_universal.apiset.API.func",
"rpython.rtyper.lltypesystem.rffi.sizeof",
"rpython.rlib.objectmodel.we_are_translated",
"pypy.interpreter.error.oefmt",
"pypy.module._hpy_universal.apiset.API.cast",
"rpython.rtyper.lltypesystem.rffi.cast"
] | [((262, 323), 'pypy.module._hpy_universal.apiset.API.func', 'API.func', (['"""HPy HPyLong_FromLong(HPyContext *ctx, long value)"""'], {}), "('HPy HPyLong_FromLong(HPyContext *ctx, long value)')\n", (270, 323), False, 'from pypy.module._hpy_universal.apiset import API\n'), ((523, 601), 'pypy.module._hpy_universal.apiset... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jan 28 20:15:39 2022
@author1: <NAME> - Correo: <EMAIL>
@author2: <NAME> - Correo: <EMAIL>
@author3: <NAME> - Correo: <EMAIL>
UNIVERSIDAD DEL VALLE - INGENIERÍA TOPOGRÁFICA
2022-1
OBJETIVO DEL SCRIPT:
Graficación de resultados y parámetros obtenidos con Step2_gr... | [
"statistics.mean",
"os.scandir",
"math.sqrt",
"time.sleep",
"os.mkdir",
"pandas.read_excel",
"pandas.DataFrame"
] | [((1009, 1020), 'pandas.DataFrame', 'DataFrame', ([], {}), '()\n', (1018, 1020), False, 'from pandas import read_excel, DataFrame\n'), ((1316, 1324), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (1321, 1324), False, 'from time import sleep\n'), ((5847, 5886), 'os.mkdir', 'mkdir', (['"""Cálculo de Índices Espectrales"... |
import json
from datetime import datetime
from typing import Any
from typing import List
from typing import Optional
from myfunds.core.constants import FundsDirection
class TransactionJSONEncoder(json.JSONEncoder):
def default(self, o: Any) -> Any:
if isinstance(o, datetime):
return o.strftim... | [
"datetime.datetime.now"
] | [((1616, 1630), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1628, 1630), False, 'from datetime import datetime\n')] |
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.array",
"paddle.nn.CrossEntropyLoss"
] | [((1505, 1533), 'paddle.nn.CrossEntropyLoss', 'paddle.nn.CrossEntropyLoss', ([], {}), '()\n', (1531, 1533), False, 'import paddle\n'), ((4704, 4738), 'numpy.array', 'np.array', (['data[key]'], {'dtype': '"""int64"""'}), "(data[key], dtype='int64')\n", (4712, 4738), True, 'import numpy as np\n')] |
import time
from aiohttp import web
result = {}
async def handle(request):
text = request.match_info.get('param', "Home")
if text == 'q1' and text not in result:
for _ in range(12):
print("processing")
time.sleep(5)
result[text] = f'Response for query: {text}'
... | [
"aiohttp.web.run_app",
"aiohttp.web.Response",
"aiohttp.web.Application",
"time.sleep",
"aiohttp.web.get"
] | [((397, 414), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (412, 414), False, 'from aiohttp import web\n'), ((358, 389), 'aiohttp.web.Response', 'web.Response', ([], {'text': 'result[text]'}), '(text=result[text])\n', (370, 389), False, 'from aiohttp import web\n'), ((515, 531), 'aiohttp.web.run_app'... |
from __future__ import absolute_import
from django.db.models import Max
from django.core.urlresolvers import reverse, NoReverseMatch
from django.contrib import messages
from django.http import Http404
from django.shortcuts import redirect, render, get_object_or_404, render_to_response
from django.utils.translation impo... | [
"django.core.mail.send_mail",
"django.http.HttpResponse",
"json.dumps",
"django.template.RequestContext",
"django.shortcuts.redirect",
"django.db.models.Q"
] | [((1682, 1813), 'django.core.mail.send_mail', 'send_mail', (['"""Voucher For you!"""', "('Congratulation! You receive the voucher of ' + voucher)", '"""<EMAIL>"""', '[email]'], {'fail_silently': '(False)'}), "('Voucher For you!', 'Congratulation! You receive the voucher of ' +\n voucher, '<EMAIL>', [email], fail_sil... |
# Libraries
import csv
import logging
from core.data.RawDataHandler import RawDataHandler
# Constants
LOGGER = logging.getLogger(__name__)
"""
CSV fields separator, in order no diferentiate the different information in the file
"""
CSV_DELIMITER = ";"
"""
CSV filename
"""
CSV_FILE = "res/tweets/SentimentAn... | [
"logging.getLogger",
"csv.reader"
] | [((113, 140), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (130, 140), False, 'import logging\n'), ((866, 910), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': 'CSV_DELIMITER'}), '(csvfile, delimiter=CSV_DELIMITER)\n', (876, 910), False, 'import csv\n')] |
# -*- coding: utf-8 -*-
import os
from icon.utils.in_memory_zip import InMemoryZip
def test_in_memory_zip():
parent_path: str = os.path.dirname(__file__)
path: str = os.path.join(parent_path, "data_to_zip")
mem_zip = InMemoryZip()
mem_zip.run(path)
with open("data.zip", "wb") as f:
f.w... | [
"os.path.dirname",
"os.path.join",
"icon.utils.in_memory_zip.InMemoryZip"
] | [((136, 161), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (151, 161), False, 'import os\n'), ((178, 218), 'os.path.join', 'os.path.join', (['parent_path', '"""data_to_zip"""'], {}), "(parent_path, 'data_to_zip')\n", (190, 218), False, 'import os\n'), ((234, 247), 'icon.utils.in_memory_zip.... |
from mainframe import MainFrame
with open("txnlog.dat", mode='rb') as file: # b is important -> binary
fileContent = file.read()
m = MainFrame(fileContent)
print("Total amount of dollars in debits:", m.amountTotal(m.recordTypes[0x00]))
print("Total amount of dollars in credits:", m.amountTotal(m.recordTypes[0x01... | [
"mainframe.MainFrame"
] | [((139, 161), 'mainframe.MainFrame', 'MainFrame', (['fileContent'], {}), '(fileContent)\n', (148, 161), False, 'from mainframe import MainFrame\n')] |
from insertion_sort import __version__
from insertion_sort.insertion_sort import InsertionSort
def test_version():
assert __version__ == '0.1.0'
def test_1():
arr = [9,8,5,2,20,18,16]
actual = InsertionSort(arr)
excepted = [2,5,8,9,16,18,20]
assert actual == excepted
def test_2():
arr = [9... | [
"insertion_sort.insertion_sort.InsertionSort"
] | [((209, 227), 'insertion_sort.insertion_sort.InsertionSort', 'InsertionSort', (['arr'], {}), '(arr)\n', (222, 227), False, 'from insertion_sort.insertion_sort import InsertionSort\n'), ((360, 378), 'insertion_sort.insertion_sort.InsertionSort', 'InsertionSort', (['arr'], {}), '(arr)\n', (373, 378), False, 'from inserti... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from decimal import Decimal
# The rates used here are pull from the following sources December 17, 2014:
#
# http://ec.europa.eu/taxation_customs/resources/documents/taxation/vat/how_vat_works/rates/vat_rates_en.pdf
# http://www.skatteetaten.no/en/Bedri... | [
"decimal.Decimal"
] | [((1916, 1931), 'decimal.Decimal', 'Decimal', (['"""0.20"""'], {}), "('0.20')\n", (1923, 1931), False, 'from decimal import Decimal\n'), ((2096, 2111), 'decimal.Decimal', 'Decimal', (['"""0.21"""'], {}), "('0.21')\n", (2103, 2111), False, 'from decimal import Decimal\n'), ((2159, 2174), 'decimal.Decimal', 'Decimal', ([... |
from requests import Request, Session
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json
import time, datetime
import sys
import schedule
global is_test
is_test = False
def check_crypto(config_json, last_sent):
print("Debug: Job Started " + str(datetime.datetime.utcnow()))
total... | [
"json.loads",
"requests.Session",
"datetime.datetime.utcnow",
"schedule.run_pending",
"sys.stderr.flush",
"time.sleep",
"schedule.every",
"sys.stdout.flush"
] | [((1702, 1720), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (1718, 1720), False, 'import sys\n'), ((1722, 1740), 'sys.stderr.flush', 'sys.stderr.flush', ([], {}), '()\n', (1738, 1740), False, 'import sys\n'), ((1967, 1976), 'requests.Session', 'Session', ([], {}), '()\n', (1974, 1976), False, 'from reques... |
'''
This contains a number of methods and functions to calculate the iRep metric
https://github.com/christophertbrown/iRep
https://www.nature.com/articles/nbt.3704
'''
import os
import sys
import glob
import scipy
import lmfit
import scipy.signal
import numpy as np
import pandas as pd
import seaborn as sns
from Bio... | [
"numpy.mean",
"numpy.median",
"numpy.ones",
"numpy.average",
"pandas.merge",
"numpy.asarray",
"scipy.signal.fftconvolve",
"numpy.var",
"collections.defaultdict",
"pandas.DataFrame",
"numpy.log2",
"lmfit.Parameters",
"lmfit.minimize"
] | [((1130, 1143), 'numpy.mean', 'np.mean', (['rcov'], {}), '(rcov)\n', (1137, 1143), True, 'import numpy as np\n'), ((3977, 3992), 'numpy.ones', 'np.ones', (['window'], {}), '(window)\n', (3984, 3992), True, 'import numpy as np\n'), ((4005, 4022), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (401... |
import os
class Patient:
def __init__(self, SSN: str):
self.file_write = open(SSN + '.txt', 'at')
self.file_read = open(SSN + '.txt')
self.ssn = SSN
self.attributesAndValues = [line for line in self.file_read.read().split(',^')]
self.attributedValues = [line.split(... | [
"os.remove"
] | [((2035, 2063), 'os.remove', 'os.remove', (["(self.ssn + '.txt')"], {}), "(self.ssn + '.txt')\n", (2044, 2063), False, 'import os\n')] |
import numpy as np
import pandas as pd
from tensorflow import keras
from tensorflow.keras.layers import Input, Dense, Dropout, Conv2D, MaxPool2D, Flatten, Reshape, BatchNormalization
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.callbacks import TensorBoard, ModelCheckpoint, EarlySto... | [
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.callbacks.TensorBoard",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.optimizers.schedules.ExponentialDecay",
"time.time",
"tensorflow.keras.layers.Dropout",
"tensorflow.keras.optimizers.SGD",
"tensorflow.keras.layers.BatchNormalization",
"t... | [((1096, 1108), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1106, 1108), False, 'from tensorflow.keras.models import Sequential, load_model\n'), ((2321, 2431), 'tensorflow.keras.optimizers.schedules.ExponentialDecay', 'keras.optimizers.schedules.ExponentialDecay', ([], {'initial_learning_rate... |
"""Takeoff-hover-land for one CF. Useful to validate hardware config."""
from pycrazyswarm import Crazyswarm
def main():
swarm = Crazyswarm()
timeHelper = swarm.timeHelper
cf = swarm.allcfs.crazyflies[0]
t0 = timeHelper.time()
state = "TAKEOFF"
while not timeHelper.isShutdown():
... | [
"pycrazyswarm.Crazyswarm"
] | [((138, 150), 'pycrazyswarm.Crazyswarm', 'Crazyswarm', ([], {}), '()\n', (148, 150), False, 'from pycrazyswarm import Crazyswarm\n')] |
# losernator
# License-Identifier: MIT
# 2022/05/03
import time
import board
import digitalio
import analogio
import usb_hid
import neopixel
from hid_gamepad import Gamepad
from rainbowio import colorwheel
from configs import config
gp = Gamepad(usb_hid.devices)
# Buttons
turbo_speed = config.get('turbo_speed')
turbo... | [
"configs.config.get",
"time.monotonic",
"rainbowio.colorwheel",
"time.sleep",
"hid_gamepad.Gamepad",
"digitalio.DigitalInOut"
] | [((239, 263), 'hid_gamepad.Gamepad', 'Gamepad', (['usb_hid.devices'], {}), '(usb_hid.devices)\n', (246, 263), False, 'from hid_gamepad import Gamepad\n'), ((289, 314), 'configs.config.get', 'config.get', (['"""turbo_speed"""'], {}), "('turbo_speed')\n", (299, 314), False, 'from configs import config\n'), ((1029, 1047),... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Support module generated by PAGE version 4.15a
# In conjunction with Tcl version 8.6
# Jun 16, 2018 10:56:46 AM
# ======================================================
# customwidgetdemo_support.py
# ------------------------------------------------------
# Cr... | [
"customwidgetdemo.vp_start_gui"
] | [((4745, 4776), 'customwidgetdemo.vp_start_gui', 'customwidgetdemo.vp_start_gui', ([], {}), '()\n', (4774, 4776), False, 'import customwidgetdemo\n')] |
from django.contrib.sites.models import Site
from django.test import TestCase
from wagtail.core.models import Page
from ppa.editorial.models import EditorialIndexPage
from ppa.pages.management.commands import setup_site_pages
from ppa.pages.models import CollectionPage, ContentPage, HomePage
class TestSetupSitePages... | [
"wagtail.core.models.Page.objects.first",
"wagtail.core.models.Page.objects.filter",
"ppa.pages.models.ContentPage.objects.count",
"ppa.pages.management.commands.setup_site_pages.Command",
"ppa.pages.models.HomePage.objects.first",
"django.contrib.sites.models.Site.objects.first"
] | [((379, 405), 'ppa.pages.management.commands.setup_site_pages.Command', 'setup_site_pages.Command', ([], {}), '()\n', (403, 405), False, 'from ppa.pages.management.commands import setup_site_pages\n'), ((467, 487), 'wagtail.core.models.Page.objects.first', 'Page.objects.first', ([], {}), '()\n', (485, 487), False, 'fro... |
import numpy as np
import torch.optim as optim
import networks.networks as net
from networks.gtsrb import *
from networks.svhn import *
import torchvision as tv
from torchvision import transforms
from torch.utils.data import DataLoader
from data.idadataloader import DoubleDataset
from config import get_transform
from d... | [
"config.get_transform",
"argparse.ArgumentParser",
"torchvision.transforms.Grayscale",
"numpy.exp",
"torchvision.datasets.SVHN",
"networks.networks.parameters",
"torch.utils.data.DataLoader",
"data.idadataloader.DoubleDataset",
"torchvision.transforms.Compose"
] | [((372, 429), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sanity Checks Only"""'}), "(description='Sanity Checks Only')\n", (395, 429), False, 'import argparse\n'), ((6591, 6612), 'config.get_transform', 'get_transform', (['"""svhn"""'], {}), "('svhn')\n", (6604, 6612), False, 'from c... |
"""Inversion Tools
This file contains the classes that compute least squares inversions using data
stored in DesignMatrix and DataArray objects.
This file can also be imported as a module and contains the following
classes:
* Inversion
"""
import numpy as np
from typing import Union
from scipy.linalg import lst... | [
"numpy.isin",
"numpy.zeros",
"scipy.sparse.coo_matrix",
"threadpoolctl.threadpool_limits",
"scipy.sparse.vstack"
] | [((3718, 3735), 'scipy.sparse.coo_matrix', 'coo_matrix', (['gamma'], {}), '(gamma)\n', (3728, 3735), False, 'from scipy.sparse import coo_matrix, vstack, hstack\n'), ((3817, 3835), 'scipy.sparse.vstack', 'vstack', (['(g, gamma)'], {}), '((g, gamma))\n', (3823, 3835), False, 'from scipy.sparse import coo_matrix, vstack,... |
import os, json, argparse
import numpy as np
import os.path as osp
parser = argparse.ArgumentParser()
##folder to take experiments from
parser.add_argument("-f", "--f", type=str, required=True)
parser.add_argument("-gpu", "--gpu", type=str, required=False)
parser.add_argument("-N", "--N", type=str, required=True)
#... | [
"argparse.ArgumentParser",
"json.load",
"dev.utils.perms",
"dev.train_script_cpu.train_model",
"os.path.expanduser"
] | [((77, 102), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (100, 102), False, 'import os, json, argparse\n'), ((1299, 1310), 'dev.utils.perms', 'perms', (['diff'], {}), '(diff)\n', (1304, 1310), False, 'from dev.utils import perms\n'), ((618, 653), 'os.path.expanduser', 'osp.expanduser', (['""... |
#!/usr/bin/python3.6
import argparse
import multiprocessing
import os
import sys
from typing import List
from functools import partial
import numpy as np
from tqdm import tqdm
def read_confidences(s: str) -> List[float]:
return list(map(float, s.split()[7::6]))
def trim_line(threshold: float, s: str) -> str:... | [
"os.path.exists",
"argparse.ArgumentParser",
"numpy.partition",
"functools.partial",
"multiprocessing.Pool",
"sys.exit"
] | [((617, 642), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (640, 642), False, 'import argparse\n'), ((1165, 1187), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {}), '()\n', (1185, 1187), False, 'import multiprocessing\n'), ((1036, 1063), 'os.path.exists', 'os.path.exists', (['args.res... |
'''
Assign stellar mass/magnitude to subhalos via abundance matching.
Masses in log {M_sun}, luminosities in log {L_sun / h^2}, distances in {Mpc comoving}.
'''
# system -----
#from __future__ import division
import numpy as np
from numpy import log10, Inf
from scipy import integrate, interpolate, ndimage
# local ---... | [
"numpy.log10",
"numpy.log",
"numpy.argsort",
"numpy.array",
"utilities.utility.math.deconvolute",
"numpy.arange",
"utilities.utility.bin.idigitize",
"numpy.exp",
"scipy.interpolate.splev",
"numpy.min",
"utilities.utility.array.elements",
"scipy.integrate.quad",
"scipy.ndimage.filters.gaussia... | [((1353, 1375), 'utilities.utility.array.arrayize', 'ut.array.arrayize', (['zis'], {}), '(zis)\n', (1370, 1375), True, 'from utilities import utility as ut\n'), ((28456, 28497), 'utilities.utility.bin.idigitize', 'ut.bin.idigitize', (['sub[zi][m_kind]', 'm_bins'], {}), '(sub[zi][m_kind], m_bins)\n', (28472, 28497), Tru... |
"""
Morphology operations on multi-label ANTsImage types
"""
__all__ = ['multi_label_morphology']
import numpy as np
def multi_label_morphology(image, operation, radius, dilation_mask=None, label_list=None, force=False):
"""
Morphology on multi label images.
Wraps calls to iMath binary morphology. A... | [
"numpy.unique"
] | [((2317, 2344), 'numpy.unique', 'np.unique', (['image[image > 0]'], {}), '(image[image > 0])\n', (2326, 2344), True, 'import numpy as np\n')] |
import numpy as np
from conftest import EPS
from testutils import (
CLUSTER_LABEL_FIRST_CLUSTER,
CLUSTER_LABEL_NOISE,
assert_cluster_labels,
assert_label_of_object_is_among_possible_ones,
assert_two_objects_are_in_same_cluster,
insert_objects_then_assert_cluster_labels,
reflect_horizontally... | [
"testutils.assert_label_of_object_is_among_possible_ones",
"testutils.assert_cluster_labels",
"numpy.array",
"numpy.vstack",
"testutils.assert_two_objects_are_in_same_cluster",
"testutils.insert_objects_then_assert_cluster_labels",
"testutils.reflect_horizontally"
] | [((445, 516), 'testutils.assert_cluster_labels', 'assert_cluster_labels', (['incdbscan4', 'object_far_away', 'CLUSTER_LABEL_NOISE'], {}), '(incdbscan4, object_far_away, CLUSTER_LABEL_NOISE)\n', (466, 516), False, 'from testutils import CLUSTER_LABEL_FIRST_CLUSTER, CLUSTER_LABEL_NOISE, assert_cluster_labels, assert_labe... |
import logging
import multiprocessing
def _get_logger():
logger = logging.getLogger('hu.ai_training.save')
return logger
class SaveController:
"""A multiprocess aware class that can be passed into processes to keep shared state"""
def __init__(self, manager: multiprocessing.Manager):
self._... | [
"logging.getLogger"
] | [((72, 112), 'logging.getLogger', 'logging.getLogger', (['"""hu.ai_training.save"""'], {}), "('hu.ai_training.save')\n", (89, 112), False, 'import logging\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import glob
import json
import argparse
import Adafruit_DHT
from datetime import datetime
from inky import InkyPHAT
from PIL import Image, ImageDraw, ImageFont
from font_fredoka_one import FredokaOne
try:
import requests
except ImportError:
exit("This sc... | [
"datetime.datetime.utcfromtimestamp",
"PIL.Image.open",
"requests.post",
"argparse.ArgumentParser",
"PIL.Image.new",
"PIL.ImageFont.truetype",
"requests.get",
"os.path.dirname",
"PIL.ImageDraw.Draw",
"Adafruit_DHT.read_retry",
"inky.InkyPHAT",
"glob.glob"
] | [((544, 569), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (567, 569), False, 'import argparse\n'), ((737, 762), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (752, 762), False, 'import os\n'), ((958, 974), 'inky.InkyPHAT', 'InkyPHAT', (['colour'], {}), '(colour)\n... |
import os
def init (args):
shell_cmd = ['git-openaps-init' ] + args.args
os.execvp(shell_cmd[0], shell_cmd)
| [
"os.execvp"
] | [((79, 113), 'os.execvp', 'os.execvp', (['shell_cmd[0]', 'shell_cmd'], {}), '(shell_cmd[0], shell_cmd)\n', (88, 113), False, 'import os\n')] |
#!/usr/bin/env python
#
# :History:
#
# 11 Oct 2018: Created
# 18 Oct 2018: Modified to merge CDP-5 format CDPs together to make a new
# CDP-7 format CDP. Added --document and --description parameters.
#
# @author: <NAME> (UKATC)
#
"""
Script `append_lrs_photom` creates a merged photometric CDP for the ... | [
"optparse.OptionParser",
"time.sleep",
"miri.datamodels.miri_fluxconversion_models.MiriLrsFluxconversionModel",
"miri.datamodels.miri_photometric_models.MiriImagingPhotometricModel",
"miri.datamodels.miri_photometric_models.MiriPhotometricModel_CDP5",
"sys.exit"
] | [((2424, 2452), 'optparse.OptionParser', 'optparse.OptionParser', (['usage'], {}), '(usage)\n', (2445, 2452), False, 'import optparse\n'), ((4137, 4175), 'miri.datamodels.miri_photometric_models.MiriPhotometricModel_CDP5', 'MiriPhotometricModel_CDP5', (['imager_file'], {}), '(imager_file)\n', (4162, 4175), False, 'from... |
import socket
import cv2
import numpy
import os
import win32serviceutil
import win32service
import win32event
import servicemanager
import socket
from datetime import datetime, date, time
class AppServerSvc (win32serviceutil.ServiceFramework):
_svc_name_ = "TestService"
_svc_display_name_ = "Tes... | [
"cv2.imencode",
"socket.socket",
"os.environ.get",
"win32serviceutil.HandleCommandLine",
"servicemanager.LogMsg",
"numpy.array",
"win32serviceutil.ServiceFramework.__init__",
"cv2.VideoCapture",
"win32event.SetEvent",
"socket.gethostname",
"win32event.CreateEvent",
"socket.setdefaulttimeout"
] | [((1049, 1075), 'os.environ.get', 'os.environ.get', (['"""USERNAME"""'], {}), "('USERNAME')\n", (1063, 1075), False, 'import os\n'), ((1088, 1108), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1106, 1108), False, 'import socket\n'), ((1281, 1296), 'socket.socket', 'socket.socket', ([], {}), '()\n', (1... |
from queue import Queue
import socket
import threading
target = "127.0.0.1"
queue = Queue()
open_ports = []
"""
port 80 (HTTP) or port 443 (HTTPS) 21 (FTP), 22 (SSH), 25 (SMTP)
"""
# connect to a target on a specific port
def portscan(port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | [
"threading.Thread",
"queue.Queue",
"socket.socket"
] | [((85, 92), 'queue.Queue', 'Queue', ([], {}), '()\n', (90, 92), False, 'from queue import Queue\n'), ((270, 319), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (283, 319), False, 'import socket\n'), ((1532, 1563), 'threading.Thread', 'threadi... |
import sys
import cv2
from imposters_mark.configs.injection_config import InjectionConfig
from imposters_mark.entities.stats import Stats
ESCAPE_KEY = 27
# noinspection PyUnusedLocal
def t_main(argv):
stats = Stats()
stats.append_location('Admin')
stats.append_location('Reactor')
stats.append_locat... | [
"cv2.setWindowProperty",
"imposters_mark.configs.injection_config.InjectionConfig",
"imposters_mark.entities.stats.Stats",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.waitKey",
"cv2.namedWindow"
] | [((218, 225), 'imposters_mark.entities.stats.Stats', 'Stats', ([], {}), '()\n', (223, 225), False, 'from imposters_mark.entities.stats import Stats\n'), ((483, 525), 'imposters_mark.configs.injection_config.InjectionConfig', 'InjectionConfig', (['"""../resources/config.ini"""'], {}), "('../resources/config.ini')\n", (4... |
import user_site
from user_site.backends import UserSiteBackend
from django.core.exceptions import ImproperlyConfigured
from django.utils.functional import SimpleLazyObject
def get_user(request):
if not hasattr(request, '_cached_user_site'):
request._cached_user_site = user_site.get_user(request)
... | [
"user_site.login",
"user_site.load_backend",
"django.core.exceptions.ImproperlyConfigured",
"user_site.logout",
"user_site.authenticate",
"user_site.get_user"
] | [((283, 310), 'user_site.get_user', 'user_site.get_user', (['request'], {}), '(request)\n', (301, 310), False, 'import user_site\n'), ((2089, 2130), 'user_site.authenticate', 'user_site.authenticate', ([], {'remote_user': 'email'}), '(remote_user=email)\n', (2111, 2130), False, 'import user_site\n'), ((2357, 2392), 'us... |
from rest_framework import serializers
from users.models import User
class UserSerializer(serializers.ModelSerializer):
remote_addr = serializers.SerializerMethodField()
class Meta:
model = User
fields = [
'id',
'username',
'first_name',
'last_... | [
"rest_framework.serializers.SerializerMethodField"
] | [((141, 176), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (174, 176), False, 'from rest_framework import serializers\n')] |
from mijiahygrothermo import MijiaHygrothermo
for device in MijiaHygrothermo.discover():
data = device.get_latest_properties()
print("- {}".format(data['macAddress']))
print(" name: {}".format(data['name']))
print(" firmware: {}".format(data['firmwareVersion']))
print(" battery level: {}%".forma... | [
"mijiahygrothermo.MijiaHygrothermo.discover"
] | [((61, 88), 'mijiahygrothermo.MijiaHygrothermo.discover', 'MijiaHygrothermo.discover', ([], {}), '()\n', (86, 88), False, 'from mijiahygrothermo import MijiaHygrothermo\n')] |
"""Support for interface with a ArrisDCX960 Settopbox."""
import logging
import random
import voluptuous as vol
import time
import homeassistant.helpers.config_validation as cv
from homeassistant.components.media_player import MediaPlayerEntity, BrowseMedia
from homeassistant.config_entries import ConfigEntry
from hom... | [
"logging.getLogger",
"voluptuous.Required",
"homeassistant.components.media_player.BrowseMedia",
"random.randrange",
"time.sleep",
"homeassistant.helpers.config_validation.make_entity_service_schema",
"homeassistant.helpers.config_validation.positive_int"
] | [((1301, 1328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1318, 1328), False, 'import logging\n'), ((1821, 1854), 'homeassistant.helpers.config_validation.make_entity_service_schema', 'cv.make_entity_service_schema', (['{}'], {}), '({})\n', (1850, 1854), True, 'import homeassistant.... |
from magic_repr import make_repr
from .xml_object import XMLObject, ConvertableXML
__all__ = ['xmltuple', 'make_to_xml']
class TextTag:
@classmethod
def from_xml(cls, tag):
return tag.text
def make_to_xml(tag_name, attributes, kws=None):
if kws is None:
kws = []
def to_xml(self):
... | [
"magic_repr.make_repr"
] | [((3125, 3153), 'magic_repr.make_repr', 'make_repr', (['*attributes', '*kws'], {}), '(*attributes, *kws)\n', (3134, 3153), False, 'from magic_repr import make_repr\n')] |
import tensorflow as tf
import numpy as np
import os
import sys
import time
import cv2
from collections import defaultdict
from io import StringIO
from matplotlib import pyplot as plt
from PIL import Image
# Helper code
def load_image_into_numpy_array(image):
(im_width, im_height) = image.size
return np.array(ima... | [
"tensorflow.Graph",
"cv2.imencode",
"tensorflow.Session",
"time.time",
"os.path.join",
"tensorflow.GraphDef",
"numpy.squeeze",
"cv2.putText",
"numpy.array",
"numpy.append",
"cv2.VideoCapture",
"object_detection.utils.label_map_util.convert_label_map_to_categories",
"tensorflow.import_graph_d... | [((723, 746), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video'], {}), '(video)\n', (739, 746), False, 'import cv2\n'), ((830, 851), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (845, 851), False, 'import sys\n'), ((1422, 1485), 'os.path.join', 'os.path.join', (['"""object_detection/data"""', '... |
# 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... | [
"googlecloudsdk.command_lib.compute.instances.flags.AddAddressArgs",
"googlecloudsdk.command_lib.compute.flags.GetDefaultScopeLister",
"googlecloudsdk.api_lib.compute.metadata_utils.AddMetadataArgs",
"googlecloudsdk.api_lib.compute.utils.WarnIfDiskSizeIsTooSmall",
"googlecloudsdk.command_lib.compute.instanc... | [((1275, 1318), 'googlecloudsdk.calliope.base.ReleaseTracks', 'base.ReleaseTracks', (['base.ReleaseTrack.ALPHA'], {}), '(base.ReleaseTrack.ALPHA)\n', (1293, 1318), False, 'from googlecloudsdk.calliope import base\n'), ((1575, 1613), 'googlecloudsdk.api_lib.compute.metadata_utils.AddMetadataArgs', 'metadata_utils.AddMet... |
import flask
import numpy as np
import os
import requests
import sys
from cv2 import cv2 as cv
from socket import AF_INET, SOCK_DGRAM, INADDR_ANY, IPPROTO_IP, IP_ADD_MEMBERSHIP, SOL_SOCKET, SO_REUSEADDR, socket, inet_aton, error as socket_error
import struct
from threading import Thread
import imagehash
from PIL import... | [
"sys.stdout.flush",
"numpy.frombuffer",
"cv2.cv2.threshold",
"PIL.Image.open",
"socket.socket",
"flask.Flask",
"requests.get",
"os.path.isfile",
"cv2.cv2.imdecode",
"flask.send_file",
"socket.inet_aton",
"sys.exit",
"cv2.cv2.Canny",
"threading.Thread",
"cv2.cv2.cvtColor",
"cv2.cv2.imwr... | [((858, 879), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (869, 879), False, 'import flask\n'), ((6565, 6588), 'threading.Thread', 'Thread', ([], {'target': 'serv.run'}), '(target=serv.run)\n', (6571, 6588), False, 'from threading import Thread\n'), ((6723, 6733), 'sys.exit', 'sys.exit', ([], {}),... |
import os
import cv2
import numpy as np
from PIL import Image
from keras.engine.topology import Layer, InputSpec
import keras.utils.conv_utils as conv_utils
import tensorflow as tf
import keras.backend as K
import skimage.io as io
class DenseDepthAnalysis:
def __init__(self, image_id, model, object_at... | [
"keras.engine.topology.InputSpec",
"tensorflow.image.resize_images",
"keras.backend.shape",
"os.getenv",
"numpy.asarray",
"numpy.expand_dims",
"keras.backend.normalize_data_format",
"keras.utils.conv_utils.normalize_tuple"
] | [((1363, 1390), 'numpy.expand_dims', 'np.expand_dims', (['inp'], {'axis': '(0)'}), '(inp, axis=0)\n', (1377, 1390), True, 'import numpy as np\n'), ((2548, 2584), 'keras.backend.normalize_data_format', 'K.normalize_data_format', (['data_format'], {}), '(data_format)\n', (2571, 2584), True, 'import keras.backend as K\n')... |
# Copyright 2016 VMware, 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 a... | [
"sqlalchemy.DateTime"
] | [((2387, 2400), 'sqlalchemy.DateTime', 'sa.DateTime', ([], {}), '()\n', (2398, 2400), True, 'import sqlalchemy as sa\n'), ((2506, 2519), 'sqlalchemy.DateTime', 'sa.DateTime', ([], {}), '()\n', (2517, 2519), True, 'import sqlalchemy as sa\n')] |
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 29 12:37:04 2018
@author: Shubham
"""
import heartbeat as hb
import sys
if __name__ == '__main__':
hrdata = hb.get_data(sys.argv[1]+"/ecg.csv")
measures = hb.process(hrdata, 100.0,windowsize=0.1 , report_time=True)
measures.pop('interp_rr_functi... | [
"heartbeat.process",
"heartbeat.get_data",
"heartbeat.plotter"
] | [((173, 210), 'heartbeat.get_data', 'hb.get_data', (["(sys.argv[1] + '/ecg.csv')"], {}), "(sys.argv[1] + '/ecg.csv')\n", (184, 210), True, 'import heartbeat as hb\n'), ((225, 284), 'heartbeat.process', 'hb.process', (['hrdata', '(100.0)'], {'windowsize': '(0.1)', 'report_time': '(True)'}), '(hrdata, 100.0, windowsize=0... |
# SPDX-License-Identifier: Apache-2.0
# Copyright 2021 EPAM Systems
"""
Wrappers for yaml.Node that provide better API
"""
from typing import Optional, List, Tuple, Iterator, Union
from yaml.nodes import MappingNode, ScalarNode, SequenceNode, Node
from yaml.constructor import SafeConstructor
from yaml.representer imp... | [
"yaml.constructor.SafeConstructor",
"yaml.representer.SafeRepresenter",
"moulin.yaml_helpers.YAMLProcessingError"
] | [((434, 451), 'yaml.constructor.SafeConstructor', 'SafeConstructor', ([], {}), '()\n', (449, 451), False, 'from yaml.constructor import SafeConstructor\n'), ((3435, 3493), 'moulin.yaml_helpers.YAMLProcessingError', 'YAMLProcessingError', (['"""Mapping node is expected"""', 'self.mark'], {}), "('Mapping node is expected... |
# -*- coding: utf-8 -*-
"""Utilities for running REST API."""
from __future__ import print_function
import json
from sys import version_info
from functools import wraps
from collections import Iterable, OrderedDict
from werkzeug.wrappers import Request, Response
from werkzeug.datastructures import Headers
from werkze... | [
"jacoren.machine.machine",
"collections.OrderedDict",
"argparse.ArgumentParser",
"jacoren.cpu.cpu_freq",
"json.dumps",
"functools.wraps",
"jacoren.cpu.cpu_info",
"werkzeug.datastructures.Headers",
"jacoren.machine.machine_users",
"werkzeug.serving.run_simple",
"werkzeug.wrappers.Request",
"jac... | [((806, 817), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (811, 817), False, 'from functools import wraps\n'), ((8090, 8129), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""jacoren"""'}), "(prog='jacoren')\n", (8113, 8129), False, 'import argparse\n'), ((8697, 8737), 'werkzeug.servi... |
from __future__ import with_statement, print_function
import pytest
try:
from unittest import mock
except ImportError:
import mock
from k2catalogue import proposal_urls
@pytest.fixture
def campaign():
return 1
@pytest.fixture
def mapper(campaign):
return proposal_urls.BuildCampaignMapping(campaign)... | [
"mock.Mock",
"mock.patch",
"k2catalogue.proposal_urls.BuildCampaignMapping"
] | [((276, 320), 'k2catalogue.proposal_urls.BuildCampaignMapping', 'proposal_urls.BuildCampaignMapping', (['campaign'], {}), '(campaign)\n', (310, 320), False, 'from k2catalogue import proposal_urls\n'), ((2091, 2132), 'mock.Mock', 'mock.Mock', ([], {'find_all': '(lambda *args: entries)'}), '(find_all=lambda *args: entrie... |
import logging
import os
import click
import click_log
from cli.internal.utils.constants import LOG_PROTOCOL_TRACE
def install_logger(logger: logging.Logger, level):
logger.setLevel(level)
click_log.ClickHandler._use_stderr = False
click_log.basic_config(logger)
return logger
# noinspection PyUnus... | [
"click.BadParameter",
"os.environ.get",
"click_log.basic_config"
] | [((248, 278), 'click_log.basic_config', 'click_log.basic_config', (['logger'], {}), '(logger)\n', (270, 278), False, 'import click_log\n'), ((924, 1001), 'click.BadParameter', 'click.BadParameter', (['"""Must be CRITICAL, ERROR, WARNING, INFO or DEBUG, not {}"""'], {}), "('Must be CRITICAL, ERROR, WARNING, INFO or DEBU... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from braces.views import LoginRequiredMixin, PermissionRequiredMixin
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.urls import reverse
from .forms import NewsFo... | [
"django.shortcuts.get_object_or_404",
"notifications.models.Event.objects.deactivate",
"django.contrib.messages.add_message",
"django.urls.reverse",
"notifications.models.Event.objects.broadcast"
] | [((2579, 2628), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['News'], {'slug': "self.kwargs['slug']"}), "(News, slug=self.kwargs['slug'])\n", (2596, 2628), False, 'from django.shortcuts import get_object_or_404\n'), ((1119, 1197), 'notifications.models.Event.objects.deactivate', 'Event.objects.deactivat... |
# coding: utf-8
# In[ ]:
# 0. 執行指令:
# !python predict.py -c config.json -i /path/to/image/or/video
# 輸入為 圖片: !python predict.py -c config.json -i ./o_input
# 輸入為 影片: !python predict.py -c config.json -i ./o_input/Produce.mp4
# 1. 輸入檔案擺放位置:
# 將要偵測的 影片或圖片 放到 資料夾 o_input (影片必須為mp4格式;圖片可以多張,必須為... | [
"matplotlib.pyplot.imshow",
"numpy.uint8",
"os.listdir",
"keras.models.load_model",
"time.gmtime",
"utils.utils.get_yolo_boxes",
"cv2.imshow",
"utils.bbox.draw_boxes",
"os.path.isdir",
"utils.utils.makedirs",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.destroyAllWindows",
"cv2.waitK... | [((1453, 1474), 'utils.utils.makedirs', 'makedirs', (['output_path'], {}), '(output_path)\n', (1461, 1474), False, 'from utils.utils import get_yolo_boxes, makedirs\n'), ((2241, 2275), 'keras.models.load_model', 'load_model', (['"""kholes_448_an_ne4.h5"""'], {}), "('kholes_448_an_ne4.h5')\n", (2251, 2275), False, 'from... |
from deploy.src.sagemaker_deploy_spec import SageMakerDeploySpec
import unittest
class DeploySpecTestCase(unittest.TestCase):
REQUIRED_ARGS = ["--region", "us-west-2", "--model_name_1", "model-test"]
def test_minimum_required_args(self):
# Will raise if the inputs are incorrect
spec = SageMa... | [
"deploy.src.sagemaker_deploy_spec.SageMakerDeploySpec"
] | [((314, 353), 'deploy.src.sagemaker_deploy_spec.SageMakerDeploySpec', 'SageMakerDeploySpec', (['self.REQUIRED_ARGS'], {}), '(self.REQUIRED_ARGS)\n', (333, 353), False, 'from deploy.src.sagemaker_deploy_spec import SageMakerDeploySpec\n')] |
#!/usr/bin/env python3
######################################################################################################################
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"logs.error",
"signal.signal",
"argparse.ArgumentParser",
"sys.exit"
] | [((1607, 1698), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""eksfedctl"""', 'description': '"""Amazon EKS Federated Clusters"""'}), "(prog='eksfedctl', description=\n 'Amazon EKS Federated Clusters')\n", (1630, 1698), False, 'import argparse\n'), ((3099, 3118), 'logs.error', 'logs.error', ... |
# Copyright 2014 CloudFounders NV
#
# 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 writ... | [
"ovs.extensions.hypervisor.apis.kvm.sdk.Sdk"
] | [((952, 969), 'ovs.extensions.hypervisor.apis.kvm.sdk.Sdk', 'Sdk', (['ip', 'username'], {}), '(ip, username)\n', (955, 969), False, 'from ovs.extensions.hypervisor.apis.kvm.sdk import Sdk\n')] |
from mesa.model import Model
from grid_manager import NodeTypes
from grid_manager import Node, h
from queue import PriorityQueue
def get_nodes_in_path(came_from: dict, current: Node):
path = []
while current in came_from:
path.append((current.row, current.col))
current = came_from[current]
... | [
"queue.PriorityQueue",
"grid_manager.h"
] | [((700, 715), 'queue.PriorityQueue', 'PriorityQueue', ([], {}), '()\n', (713, 715), False, 'from queue import PriorityQueue\n'), ((1032, 1045), 'grid_manager.h', 'h', (['start', 'end'], {}), '(start, end)\n', (1033, 1045), False, 'from grid_manager import Node, h\n'), ((2192, 2208), 'grid_manager.h', 'h', (['neighbor',... |
import pytest
import sheraf
@pytest.fixture
def other_database():
database = None
try:
database = sheraf.Database("memory://?database_name=other_database")
yield database
finally:
if database:
database.close()
@pytest.fixture
def other_nested_database():
database ... | [
"sheraf.Database"
] | [((116, 173), 'sheraf.Database', 'sheraf.Database', (['"""memory://?database_name=other_database"""'], {}), "('memory://?database_name=other_database')\n", (131, 173), False, 'import sheraf\n'), ((355, 434), 'sheraf.Database', 'sheraf.Database', (['"""memory://?database_name=other_nested_database"""'], {'nestable': '(T... |
import mne
import numpy as np
size = (600, 600)
renderer = mne.viz.backends.renderer.create_3d_figure(bgcolor='w', size=size, scene=False)
mne.viz.set_3d_backend('pyvista')
print("Creating image")
renderer.sphere((0, 0, 0), 'k', 1, resolution=1000)
renderer.plotter.camera.enable_parallel_projection(True)
renderer.figur... | [
"mne.viz.set_3d_backend",
"numpy.linspace",
"mne.viz.backends.renderer.create_3d_figure",
"numpy.ones"
] | [((59, 138), 'mne.viz.backends.renderer.create_3d_figure', 'mne.viz.backends.renderer.create_3d_figure', ([], {'bgcolor': '"""w"""', 'size': 'size', 'scene': '(False)'}), "(bgcolor='w', size=size, scene=False)\n", (101, 138), False, 'import mne\n'), ((139, 172), 'mne.viz.set_3d_backend', 'mne.viz.set_3d_backend', (['""... |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
class Post(models.Model):
title = models.CharField(max_length=100)
article = models.TextField()
date = models.DateTimeField(default=timezone.now)
image = models.FileField(upload_to='blog_pics')
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((147, 179), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (163, 179), False, 'from django.db import models\n'), ((194, 212), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (210, 212), False, 'from django.db import models\n'), ((224, 266), '... |
import pytest
from takler.core import Flow
class ObjectContainer:
pass
@pytest.fixture
def simple_flow():
"""
Flow:
|- flow1 [unknown]
|- container1 [unknown]
|- task1 [unknown]
|- container2 [unknown]
|- task2 [unknown]
|- task3 [u... | [
"takler.core.Flow"
] | [((501, 514), 'takler.core.Flow', 'Flow', (['"""flow1"""'], {}), "('flow1')\n", (505, 514), False, 'from takler.core import Flow\n'), ((1640, 1653), 'takler.core.Flow', 'Flow', (['"""flow2"""'], {}), "('flow2')\n", (1644, 1653), False, 'from takler.core import Flow\n')] |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | [
"tests.unit.models.factory_completed_filing",
"legal_api.services.filings.validations.change_of_directors.validate_effective_date",
"datedelta.datedelta",
"copy.deepcopy",
"legal_api.models.Business",
"freezegun.freeze_time",
"legal_api.utils.datetime.datetime"
] | [((1708, 1775), 'legal_api.models.Business', 'Business', ([], {'identifier': 'identifier', 'founding_date': '(now - datedelta.YEAR)'}), '(identifier=identifier, founding_date=now - datedelta.YEAR)\n', (1716, 1775), False, 'from legal_api.models import Business\n'), ((1809, 1837), 'copy.deepcopy', 'copy.deepcopy', (['FI... |
import os
import json
import requests
import time
bloodRuneID = 565
url = "https://secure.runescape.com/m=itemdb_oldschool/api/catalogue/detail.json?item="+str(bloodRuneID)
def getCurrentTime():
t = time.time()
currentTime = time.strftime("%Y-%m-%d %H:%M %Z", time.localtime(t))
return currentTime
def ge... | [
"json.loads",
"time.sleep",
"requests.get",
"os.stat",
"time.localtime",
"time.time"
] | [((206, 217), 'time.time', 'time.time', ([], {}), '()\n', (215, 217), False, 'import time\n'), ((345, 362), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (357, 362), False, 'import requests\n'), ((374, 395), 'json.loads', 'json.loads', (['r.content'], {}), '(r.content)\n', (384, 395), False, 'import json\n'... |
import json
import time
from base64 import b64encode
from http.client import IncompleteRead
from urllib.parse import quote, unquote
from urllib.error import HTTPError
from urllib.request import Request, urlopen
from interpro7dw import logger
URL = "https://en.wikipedia.org/api/rest_v1/page/summary/"
# See https://m... | [
"urllib.request.Request",
"base64.b64encode",
"interpro7dw.logger.error",
"urllib.parse.quote",
"time.sleep",
"urllib.request.urlopen",
"urllib.parse.unquote"
] | [((574, 588), 'urllib.parse.unquote', 'unquote', (['title'], {}), '(title)\n', (581, 588), False, 'from urllib.parse import quote, unquote\n'), ((730, 742), 'urllib.request.Request', 'Request', (['url'], {}), '(url)\n', (737, 742), False, 'from urllib.request import Request, urlopen\n'), ((1579, 1607), 'urllib.request.... |
from django.core.handlers.wsgi import WSGIRequest
from django.http import HttpResponseRedirect
from django.urls import reverse
class AuthRequiredMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request: WSGIRequest):
LOGIN_URL = reverse... | [
"django.http.HttpResponseRedirect",
"django.urls.reverse"
] | [((313, 335), 'django.urls.reverse', 'reverse', (['"""users:login"""'], {}), "('users:login')\n", (320, 335), False, 'from django.urls import reverse\n'), ((598, 629), 'django.http.HttpResponseRedirect', 'HttpResponseRedirect', (['LOGIN_URL'], {}), '(LOGIN_URL)\n', (618, 629), False, 'from django.http import HttpRespon... |
import pystan
import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from pystan_vb_extract import pystan_vb_extract
### Model Name ###
model_name = 'mix'
# model_name = 'mix-dp'
### Use variational inference? ###
# use_vb = True
use_vb = False
# Compile stan model, if needed. Otherwise, load mo... | [
"pickle.dump",
"numpy.ones",
"pystan_vb_extract.pystan_vb_extract",
"numpy.random.seed",
"numpy.random.randn"
] | [((699, 716), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (713, 716), True, 'import numpy as np\n'), ((1186, 1208), 'pystan_vb_extract.pystan_vb_extract', 'pystan_vb_extract', (['fit'], {}), '(fit)\n', (1203, 1208), False, 'from pystan_vb_extract import pystan_vb_extract\n'), ((660, 678), 'pickle.dum... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
WorkflowClientConfig = namedtuple(
'WorkflowClientConfig',
'domain task_list execution_start_to_close_timeout task_start_to_close_timeout',
)
"""An immutable object that s... | [
"collections.namedtuple"
] | [((164, 288), 'collections.namedtuple', 'namedtuple', (['"""WorkflowClientConfig"""', '"""domain task_list execution_start_to_close_timeout task_start_to_close_timeout"""'], {}), "('WorkflowClientConfig',\n 'domain task_list execution_start_to_close_timeout task_start_to_close_timeout'\n )\n", (174, 288), False, ... |
# -*- coding: utf-8 -*-
# parser.py
"""Parses command-line options"""
from __future__ import print_function
import argparse
import os
import re
import sys
from copy import deepcopy
from .print_tools import print_date
from ..notes import RESOURCE_LIST
__author__ = '<NAME>, PhD'
__email__ = '<EMAIL>, <EMAIL>'
__date__... | [
"os.path.exists",
"argparse.ArgumentParser",
"shlex.split",
"re.match",
"os.path.join",
"os.path.dirname",
"os.path.basename",
"copy.deepcopy"
] | [((1406, 1485), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""sff"""', 'description': '"""The EMDB-SFF Toolkit (sfftk)"""'}), "(prog='sff', description='The EMDB-SFF Toolkit (sfftk)')\n", (1429, 1485), False, 'import argparse\n'), ((22492, 22512), 'copy.deepcopy', 'deepcopy', (['segment_id'], ... |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# file: $Id$
# auth: <NAME> <<EMAIL>>
# date: 2016/09/15
# copy: (C) Copyright 2016-EOT Canary Health, Inc., All Rights Reserved.
#------------------------------------------------------------------------------
impor... | [
"jstc.render_assets",
"textwrap.dedent",
"os.makedirs",
"aadict.aadict",
"jstc.compiler.Compiler",
"os.path.dirname",
"os.path.isdir",
"unittest.SkipTest",
"fso.push"
] | [((682, 706), 'jstc.compiler.Compiler', 'jstc.compiler.Compiler', ([], {}), '()\n', (704, 706), False, 'import jstc\n'), ((719, 766), 'aadict.aadict', 'aadict', ([], {'name_transform': 'compiler._name_transform'}), '(name_transform=compiler._name_transform)\n', (725, 766), False, 'from aadict import aadict\n'), ((1423,... |
import numpy as np
from test.util import generate_kernel_test_case
from webdnn.graph.graph import Graph
from webdnn.graph.operators.col2im import Col2Im
from webdnn.graph.order import OrderNHWC
from webdnn.graph.variable import Variable
def generate_data_311():
v_col = np.array([[[[[
[0, 0, 0],
[... | [
"webdnn.graph.variable.Variable",
"numpy.rollaxis",
"numpy.array",
"webdnn.graph.operators.col2im.Col2Im",
"webdnn.graph.graph.Graph"
] | [((1121, 1144), 'numpy.rollaxis', 'np.rollaxis', (['v_im', '(1)', '(4)'], {}), '(v_im, 1, 4)\n', (1132, 1144), True, 'import numpy as np\n'), ((1846, 1869), 'numpy.rollaxis', 'np.rollaxis', (['v_im', '(1)', '(4)'], {}), '(v_im, 1, 4)\n', (1857, 1869), True, 'import numpy as np\n'), ((1977, 2015), 'webdnn.graph.variable... |