code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding:utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "Lic... | [
"ipaddress.ip_address"
] | [((8208, 8234), 'ipaddress.ip_address', 'ipaddress.ip_address', (['name'], {}), '(name)\n', (8228, 8234), False, 'import ipaddress\n')] |
import numpy as np
import torch
from agent.heuristics.util import get_agent_turn, wrapper, get_days, \
get_recent_byr_offers, get_last_norm
from agent.const import DELTA_SLR, NUM_COMMON_CONS
class HeuristicSlr:
def __init__(self, delta=None):
self.patient = np.isclose(delta, DELTA_SLR[-1])
def __... | [
"agent.heuristics.util.get_agent_turn",
"agent.heuristics.util.get_days",
"agent.heuristics.util.get_last_norm",
"numpy.isclose",
"torch.zeros",
"agent.heuristics.util.wrapper",
"agent.heuristics.util.get_recent_byr_offers"
] | [((276, 308), 'numpy.isclose', 'np.isclose', (['delta', 'DELTA_SLR[-1]'], {}), '(delta, DELTA_SLR[-1])\n', (286, 308), True, 'import numpy as np\n'), ((465, 495), 'agent.heuristics.util.get_agent_turn', 'get_agent_turn', ([], {'x': 'x', 'byr': '(False)'}), '(x=x, byr=False)\n', (479, 495), False, 'from agent.heuristics... |
#!/usr/bin/python
'''
VTK engine room for mrMeshPy viewer
The main vtk processing is done by functions here - although some hardcore
processing is handled in subroutines of other imported modules.
A core concept here is the tracking (kepping in scope) or the "targetVTKWindow"
- this is a vtkRenderWindowInteractor... | [
"vtk.util.numpy_support.numpy_to_vtk",
"vtk.vtkPoints",
"vtk.vtkCellPicker",
"time.sleep",
"vtk.vtkActor",
"vtk.vtkSmoothPolyDataFilter",
"vtk.vtkUnsignedCharArray",
"vtk.vtkPolyData",
"vtk.vtkCellArray",
"vtk.vtkPolyDataMapper"
] | [((3370, 3409), 'vtk.util.numpy_support.numpy_to_vtk', 'numpy_support.numpy_to_vtk', (['colorDat', '(0)'], {}), '(colorDat, 0)\n', (3396, 3409), False, 'from vtk.util import numpy_support\n'), ((3429, 3455), 'vtk.vtkUnsignedCharArray', 'vtk.vtkUnsignedCharArray', ([], {}), '()\n', (3453, 3455), False, 'import vtk\n'), ... |
from microbit import*
import gc
import micropython
def mem_stat():
print('MEMORY STATS')
gc.collect()
micropython.mem_info()
print('Initial free: {} allocated: {}'.format(
gc.mem_free(), gc.mem_alloc()))
print('END OF REPORT')
sleep(500)
mem_stat()
# Output will be printed via serial (11... | [
"gc.collect",
"gc.mem_free",
"gc.mem_alloc",
"micropython.mem_info"
] | [((99, 111), 'gc.collect', 'gc.collect', ([], {}), '()\n', (109, 111), False, 'import gc\n'), ((116, 138), 'micropython.mem_info', 'micropython.mem_info', ([], {}), '()\n', (136, 138), False, 'import micropython\n'), ((198, 211), 'gc.mem_free', 'gc.mem_free', ([], {}), '()\n', (209, 211), False, 'import gc\n'), ((213, ... |
# Generated by Django 3.2.9 on 2021-11-25 04:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_alter_blogmodel_slug'),
]
operations = [
migrations.AlterField(
model_name='blogmodel',
name='image',
... | [
"django.db.models.ImageField"
] | [((337, 375), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""uploads"""'}), "(upload_to='uploads')\n", (354, 375), False, 'from django.db import migrations, models\n')] |
import math
def make_readable(seconds):
hh = math.floor(seconds / 3600)
mm = math.floor((seconds - (hh * 3600)) / 60)
ss = math.floor((seconds - (hh * 3600) - (mm * 60)))
readable_time = f'{hh:02}:{mm:02}:{ss:02}'
return readable_time
if __name__ == '__main__':
make_readable(0)
make_r... | [
"math.floor"
] | [((52, 78), 'math.floor', 'math.floor', (['(seconds / 3600)'], {}), '(seconds / 3600)\n', (62, 78), False, 'import math\n'), ((88, 126), 'math.floor', 'math.floor', (['((seconds - hh * 3600) / 60)'], {}), '((seconds - hh * 3600) / 60)\n', (98, 126), False, 'import math\n'), ((138, 179), 'math.floor', 'math.floor', (['(... |
# Copyright 2012 Viewfinder Inc. All Rights Reserved.
"""HTTP request handler for serving viewfinder photo image file
assets.
In case of a local file store, permissions for the current user and
the requested photo are verified and the requester is redirected to
the FileObjectStoreHandler.
For an s3 file store, permi... | [
"logging.error",
"tornado.web.HTTPError",
"viewfinder.backend.base.handler.asynchronous",
"viewfinder.backend.www.base.ViewfinderContext.current",
"base64.b64decode",
"viewfinder.backend.db.post.Post.ConstructPostId",
"tornado.options.define",
"tornado.gen.Task"
] | [((1014, 1130), 'tornado.options.define', 'options.define', (['"""validate_cert"""'], {'default': '(True)', 'help': '"""set to False to allow insecure file obj store for testing"""'}), "('validate_cert', default=True, help=\n 'set to False to allow insecure file obj store for testing')\n", (1028, 1130), False, 'from... |
from maneuvers.strikes.double_touch import DoubleTouch
from maneuvers.dribbling.carry_and_flick import CarryAndFlick
from maneuvers.maneuver import Maneuver
from maneuvers.strikes.aerial_strike import AerialStrike, FastAerialStrike
from maneuvers.strikes.close_shot import CloseShot
from maneuvers.strikes.dodge_str... | [
"maneuvers.strikes.mirror_strike.MirrorStrike",
"tools.vector_math.ground_distance",
"maneuvers.strikes.ground_strike.GroundStrike",
"maneuvers.strikes.double_touch.DoubleTouch",
"tools.vector_math.align",
"maneuvers.strikes.dodge_strike.DodgeStrike",
"maneuvers.strikes.aerial_strike.AerialStrike",
"m... | [((899, 934), 'maneuvers.strikes.dodge_strike.DodgeStrike', 'DodgeStrike', (['car', 'self.info', 'target'], {}), '(car, self.info, target)\n', (910, 934), False, 'from maneuvers.strikes.dodge_strike import DodgeStrike\n'), ((958, 994), 'maneuvers.strikes.ground_strike.GroundStrike', 'GroundStrike', (['car', 'self.info'... |
from abc import abstractmethod
from numpy import random
from rec.base import ParametrizedObject
from rec.dataset.dataset import Dataset
class DatasetSplitter(ParametrizedObject):
@abstractmethod
def split(self, dataset):
assert isinstance(dataset, Dataset)
pass
def _prepare_target_datas... | [
"rec.dataset.dataset.Dataset",
"numpy.random.shuffle"
] | [((356, 377), 'rec.dataset.dataset.Dataset', 'Dataset', (['dataset.name'], {}), '(dataset.name)\n', (363, 377), False, 'from rec.dataset.dataset import Dataset\n'), ((393, 414), 'rec.dataset.dataset.Dataset', 'Dataset', (['dataset.name'], {}), '(dataset.name)\n', (400, 414), False, 'from rec.dataset.dataset import Data... |
import cv2
def split_image_horizontally(path):
img = cv2.imread(path) if type(path) == str else path
height, width = img.shape[:2]
# Let's get the starting pixel coordiantes (top left of cropped top)
start_row, start_col = int(0), int(0)
# Let's get the ending pixel coordinates (bottom right of... | [
"cv2.imread"
] | [((60, 76), 'cv2.imread', 'cv2.imread', (['path'], {}), '(path)\n', (70, 76), False, 'import cv2\n')] |
import math
from binsdpy.utils import operational_taxonomic_units, BinaryFeatureVector
def smc(
x: BinaryFeatureVector, y: BinaryFeatureVector, mask: BinaryFeatureVector = None
) -> float:
"""Sokal-Michener similarity (also called simple matching coefficient)
<NAME>. (1958).
A statistical method for... | [
"binsdpy.utils.operational_taxonomic_units",
"math.log",
"math.sqrt"
] | [((606, 645), 'binsdpy.utils.operational_taxonomic_units', 'operational_taxonomic_units', (['x', 'y', 'mask'], {}), '(x, y, mask)\n', (633, 645), False, 'from binsdpy.utils import operational_taxonomic_units, BinaryFeatureVector\n'), ((1154, 1193), 'binsdpy.utils.operational_taxonomic_units', 'operational_taxonomic_uni... |
import numpy as np
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
from sklearn.model_selection import train_test_split
def down_scale(x, scale=2):
# order 2 -> order 4
h = int(np.sqrt(x.shape[1]))
img = x.astype("float32").reshape(x.shape[0], h, h, 1)
scaled_img = t... | [
"tensorflow.sin",
"sklearn.model_selection.train_test_split",
"tensorflow.reshape",
"tensorflow.nn.avg_pool",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.cos",
"numpy.concatenate",
"numpy.sqrt"
] | [((319, 418), 'tensorflow.nn.avg_pool', 'tf.nn.avg_pool', (['img'], {'ksize': '[1, scale, scale, 1]', 'strides': '[1, scale, scale, 1]', 'padding': '"""VALID"""'}), "(img, ksize=[1, scale, scale, 1], strides=[1, scale, scale, 1\n ], padding='VALID')\n", (333, 418), True, 'import tensorflow as tf\n'), ((506, 550), 't... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | [
"bpy.types.TOPBAR_MT_file_export.remove",
"bpy.types.TOPBAR_MT_file_export.append",
"importlib.reload",
"bpy.utils.unregister_class",
"bpy.utils.register_class"
] | [((1317, 1333), 'importlib.reload', 'reload', (['operator'], {}), '(operator)\n', (1323, 1333), False, 'from importlib import reload\n'), ((1647, 1696), 'bpy.types.TOPBAR_MT_file_export.append', 'bpy.types.TOPBAR_MT_file_export.append', (['menu_func'], {}), '(menu_func)\n', (1685, 1696), False, 'import bpy\n'), ((1828,... |
# -*- coding: utf-8 -*-
from IRCMessage import IRCMessage
from IRCResponse import IRCResponse, ResponseType
from CommandInterface import CommandInterface
import subprocess
class Command(CommandInterface):
triggers = ['lastsaid', 'lastmention', 'lastmentioned']
help = 'lastmention(ed)/lastsaid <text> - checks... | [
"IRCResponse.IRCResponse"
] | [((1054, 1108), 'IRCResponse.IRCResponse', 'IRCResponse', (['ResponseType.Say', 'output', 'message.ReplyTo'], {}), '(ResponseType.Say, output, message.ReplyTo)\n', (1065, 1108), False, 'from IRCResponse import IRCResponse, ResponseType\n'), ((1648, 1702), 'IRCResponse.IRCResponse', 'IRCResponse', (['ResponseType.Say', ... |
"""
This is a pseudo-public API for downstream libraries. We ask that downstream
authors
1) Try to avoid using internals directly altogether, and failing that,
2) Use only functions exposed here (or in core.internals)
"""
from __future__ import annotations
from collections import defaultdict
from typing import Defa... | [
"pandas.core.internals.blocks.extract_pandas_array",
"pandas.core.dtypes.common.pandas_dtype",
"numpy.empty",
"pandas.core.internals.blocks.new_block",
"pandas.core.internals.managers.simple_blockify",
"pandas.core.dtypes.common.is_datetime64tz_dtype",
"pandas.core.internals.managers.BlockManager",
"c... | [((1554, 1595), 'pandas.core.internals.blocks.extract_pandas_array', 'extract_pandas_array', (['values', 'dtype', 'ndim'], {}), '(values, dtype, ndim)\n', (1574, 1595), False, 'from pandas.core.internals.blocks import Block, CategoricalBlock, DatetimeTZBlock, ExtensionBlock, check_ndim, ensure_block_shape, extract_pand... |
import Libraries
#function definitions
def add_wlan_profile():
Libraries.subprocess.run('netsh wlan add profile filename="../Credentials/G5s_Hotspot.xml"', shell=True)
def open_wifi():
Libraries.subprocess.run('start ms-settings:network-wifi', shell=True)
Libraries.time.sleep(15)
def wifi_unsuccessful():
... | [
"Libraries.time.sleep",
"Libraries.subprocess.run",
"Libraries.urllib.request.urlopen"
] | [((68, 181), 'Libraries.subprocess.run', 'Libraries.subprocess.run', (['"""netsh wlan add profile filename="../Credentials/G5s_Hotspot.xml\\""""'], {'shell': '(True)'}), '(\n \'netsh wlan add profile filename="../Credentials/G5s_Hotspot.xml"\',\n shell=True)\n', (92, 181), False, 'import Libraries\n'), ((194, 264... |
import numpy as np
from tensorflow import keras
import matplotlib.pyplot as plt
import os
import cv2
import random
import sklearn.model_selection as model_selection
import datetime
from model import createModel
from contextlib import redirect_stdout
categories = ["NonDemented", "MildDemented", "ModerateDemented", "Ver... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.legend",
"random.shuffle",
"tensorflow.keras.callbacks.ModelCheckpoint",
"model.createModel",
"tensorflow.keras.optimizers.Adam",
"numpy.array",
"matplotl... | [((1254, 1315), 'sklearn.model_selection.train_test_split', 'model_selection.train_test_split', (['data', 'labels'], {'test_size': '(0.2)'}), '(data, labels, test_size=0.2)\n', (1286, 1315), True, 'import sklearn.model_selection as model_selection\n'), ((1367, 1440), 'sklearn.model_selection.train_test_split', 'model_s... |
from gym.envs.registration import register
from heligym.envs import Heli, HeliHover, HeliForwardFlight
register(
id='Heli-v0',
entry_point='heligym.envs:Heli',
max_episode_steps = 5000,
reward_threshold = 0.95,
nondeterministic = False
)
register(
id='HeliHover-v0',
entry_point='heligym... | [
"gym.envs.registration.register"
] | [((105, 236), 'gym.envs.registration.register', 'register', ([], {'id': '"""Heli-v0"""', 'entry_point': '"""heligym.envs:Heli"""', 'max_episode_steps': '(5000)', 'reward_threshold': '(0.95)', 'nondeterministic': '(False)'}), "(id='Heli-v0', entry_point='heligym.envs:Heli', max_episode_steps=\n 5000, reward_threshold... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
Description []
Created by yifei on 2018/2/5.
"""
import control_center
if __name__ == "__main__":
root_url = "http://blog.csdn.net/hustqb/article/list"
spider = control_center.SpiderMain()
spider.start_crawling(root_url) | [
"control_center.SpiderMain"
] | [((219, 246), 'control_center.SpiderMain', 'control_center.SpiderMain', ([], {}), '()\n', (244, 246), False, 'import control_center\n')] |
#!/usr/bin/env python
import sys
import os.path
from os.path import join as PJ
import re
import json
import numpy as np
from tqdm import tqdm
import igraph as ig
import jgf
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
def calcModularity(g):
if("Community" in g.vertex_attributes()):
Ci... | [
"numpy.sum",
"numpy.nan_to_num",
"numpy.mean",
"os.path.join",
"numpy.nanmean",
"numpy.std",
"numpy.power",
"numpy.isfinite",
"json.JSONEncoder.default",
"json.dump",
"tqdm.tqdm",
"numpy.average",
"jgf.igraph.save",
"numpy.percentile",
"matplotlib.use",
"jgf.igraph.load",
"sys.exit",... | [((200, 214), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (207, 214), True, 'import matplotlib as mpl\n'), ((8293, 8331), 'os.path.join', 'PJ', (['outputDirectory', '"""network.json.gz"""'], {}), "(outputDirectory, 'network.json.gz')\n", (8295, 8331), True, 'from os.path import join as PJ\n'), ((8695... |
from django.shortcuts import render
from django.views import generic
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from .models import DesafioInovacao
from .models import InovacaoAberta
# Desafios de Inovação
class DesafioInovacao(generic.ListView):
... | [
"django.urls.reverse_lazy"
] | [((648, 679), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""desafioInovacao"""'], {}), "('desafioInovacao')\n", (660, 679), False, 'from django.urls import reverse_lazy\n'), ((792, 823), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""desafioInovacao"""'], {}), "('desafioInovacao')\n", (804, 823), False, 'from dj... |
from datetime import timedelta
import pytest
from timer_cli.main import _parse_timedelta
timedelta_test_cases = [
("", timedelta(seconds=0)),
(" ", timedelta(seconds=0)),
("0", timedelta(seconds=0)),
("0s", timedelta(seconds=0)),
("0 s", timedelta(seconds=0)),
("10", timedelta(seconds=... | [
"pytest.mark.parametrize",
"timer_cli.main._parse_timedelta",
"datetime.timedelta"
] | [((826, 879), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""s, d"""', 'timedelta_test_cases'], {}), "('s, d', timedelta_test_cases)\n", (849, 879), False, 'import pytest\n'), ((126, 146), 'datetime.timedelta', 'timedelta', ([], {'seconds': '(0)'}), '(seconds=0)\n', (135, 146), False, 'from datetime import... |
from minizinc import Instance, Model, Solver
gecode = Solver.lookup("gecode")
max=0
trivial = Model()
FileName="small"
with open(FileName+".txt") as f:
file=f.readlines()
f.close()
minizinc=""
file = [x.strip() for x in file]
file = [x.split(" ") for x in file]
#file = [x.split("\t") for x in file]
print(file... | [
"minizinc.Instance",
"minizinc.Solver.lookup",
"minizinc.Model"
] | [((55, 78), 'minizinc.Solver.lookup', 'Solver.lookup', (['"""gecode"""'], {}), "('gecode')\n", (68, 78), False, 'from minizinc import Instance, Model, Solver\n'), ((96, 103), 'minizinc.Model', 'Model', ([], {}), '()\n', (101, 103), False, 'from minizinc import Instance, Model, Solver\n'), ((1033, 1058), 'minizinc.Insta... |
from app.assess.data import *
from app.config import APPLICATION_STORE_API_HOST_PUBLIC
from app.config import ASSESSMENT_HUB_ROUTE
from flask import abort
from flask import Blueprint
from flask import render_template
from flask import request
assess_bp = Blueprint(
"assess_bp",
__name__,
url_prefix=ASSESSM... | [
"flask.abort",
"flask.Blueprint",
"flask.render_template",
"flask.request.args.items"
] | [((256, 354), 'flask.Blueprint', 'Blueprint', (['"""assess_bp"""', '__name__'], {'url_prefix': 'ASSESSMENT_HUB_ROUTE', 'template_folder': '"""templates"""'}), "('assess_bp', __name__, url_prefix=ASSESSMENT_HUB_ROUTE,\n template_folder='templates')\n", (265, 354), False, 'from flask import Blueprint\n'), ((543, 585),... |
import networkx as nx
import EoN
from collections import defaultdict
import matplotlib.pyplot as plt
import scipy
import random
colors = ['#5AB3E6','#FF2000','#009A80','#E69A00', '#CD9AB3', '#0073B3','#F0E442']
rho = 0.01
Nbig=500000
Nsmall = 5000
tau =0.4
gamma = 1.
def poisson():
return scipy.random.poisson(5)... | [
"scipy.exp",
"matplotlib.pyplot.plot",
"EoN.fast_SIR",
"matplotlib.pyplot.axis",
"networkx.fast_gnp_random_graph",
"scipy.linspace",
"scipy.random.poisson",
"random.random",
"networkx.configuration_model",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"EoN.subsample",
"matplotlib.p... | [((1586, 1611), 'scipy.linspace', 'scipy.linspace', (['(0)', '(20)', '(41)'], {}), '(0, 20, 41)\n', (1600, 1611), False, 'import scipy\n'), ((2249, 2301), 'networkx.fast_gnp_random_graph', 'nx.fast_gnp_random_graph', (['Nsmall', '(5.0 / (Nsmall - 1))'], {}), '(Nsmall, 5.0 / (Nsmall - 1))\n', (2273, 2301), True, 'import... |
from secml.testing import CUnitTest
from secml.array import CArray
from secml.ml.tests import CModuleTestCases
class CScalerTestCases(CModuleTestCases):
"""Unittests interface for Normalizers."""
def _compare_scalers(self, scaler, scaler_sklearn,
array, convert_to_dense=False):
... | [
"secml.testing.CUnitTest.main"
] | [((2396, 2412), 'secml.testing.CUnitTest.main', 'CUnitTest.main', ([], {}), '()\n', (2410, 2412), False, 'from secml.testing import CUnitTest\n')] |
import os
def disk_usage(path):
total = os.path.getsize(path)
if os.path.isdir(path):
for fileName in os.listdir(path):
childPath = os.path.join(path,fileName)
total += disk_usage(childPath)
print('0:<7'.format(total),path)
return total | [
"os.path.isdir",
"os.path.getsize",
"os.path.join",
"os.listdir"
] | [((46, 67), 'os.path.getsize', 'os.path.getsize', (['path'], {}), '(path)\n', (61, 67), False, 'import os\n'), ((75, 94), 'os.path.isdir', 'os.path.isdir', (['path'], {}), '(path)\n', (88, 94), False, 'import os\n'), ((120, 136), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (130, 136), False, 'import os\n'),... |
####################################################################
# #
# MD_plotting_toolkit, #
# a python package to visualize the results obtained from MD #
# ... | [
"os.path.abspath",
"os.remove",
"MD_plotting_toolkit.data_processing.deduplicate_data",
"MD_plotting_toolkit.data_processing.scale_data",
"MD_plotting_toolkit.data_processing.read_2d_data",
"MD_plotting_toolkit.data_processing.analyze_data",
"os.path.isfile",
"numpy.diff",
"numpy.array",
"numpy.ar... | [((840, 883), 'os.path.join', 'os.path.join', (['current_path', '"""sample_inputs"""'], {}), "(current_path, 'sample_inputs')\n", (852, 883), False, 'import os\n'), ((898, 942), 'os.path.join', 'os.path.join', (['current_path', '"""sample_outputs"""'], {}), "(current_path, 'sample_outputs')\n", (910, 942), False, 'impo... |
from pytrigno import TrignoAccel
from pytrigno import TrignoEMG
from pytrigno import TrignoOrientation
import numpy as np
from scipy.spatial.transform import Rotation as R
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import time
#Reading one sensor accel data:
#t=TrignoAccel(channel_range=(0... | [
"matplotlib.pyplot.show",
"time.time",
"matplotlib.animation.FuncAnimation",
"numpy.shape",
"pytrigno.TrignoOrientation",
"scipy.spatial.transform.Rotation.from_quat",
"matplotlib.pyplot.subplots"
] | [((646, 734), 'pytrigno.TrignoOrientation', 'TrignoOrientation', ([], {'channel_range': '(0, orientation_channels - 1)', 'samples_per_read': '(100)'}), '(channel_range=(0, orientation_channels - 1),\n samples_per_read=100)\n', (663, 734), False, 'from pytrigno import TrignoOrientation\n'), ((943, 958), 'matplotlib.p... |
# Copyright (c) 2001-2022 Aspose Pty Ltd. All Rights Reserved.
#
# This file is part of Aspose.Words. The source code in this file
# is only intended as a supplement to the documentation, and is provided
# "as is", without warranty of any kind, either expressed or implied.
import io
import os
from datetime import date... | [
"aspose.pydrawing.Image.from_file",
"aspose.words.digitalsignatures.CertificateHolder.create",
"io.BytesIO",
"aspose.words.saving.PdfEncryptionDetails",
"aspose.words.DocumentBuilder",
"aspose.words.fonts.FontSettings.default_instance.get_fonts_sources",
"aspose.words.saving.PdfDigitalSignatureTimestamp... | [((781, 794), 'aspose.words.Document', 'aw.Document', ([], {}), '()\n', (792, 794), True, 'import aspose.words as aw\n'), ((813, 836), 'aspose.words.DocumentBuilder', 'aw.DocumentBuilder', (['doc'], {}), '(doc)\n', (831, 836), True, 'import aspose.words as aw\n'), ((2353, 2366), 'aspose.words.Document', 'aw.Document', ... |
"""Initial model again
Revision ID: 0b840782b66f
Revises:
Create Date: 2020-10-27 17:24:10.636183
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0b840782b66f'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands aut... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"alembic.op.f",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Text",
"sqlalchemy.text",
"sqlalchemy.String",
"sqlalchemy.BigInteger"
] | [((3237, 3259), 'alembic.op.drop_table', 'op.drop_table', (['"""track"""'], {}), "('track')\n", (3250, 3259), False, 'from alembic import op\n'), ((3561, 3582), 'alembic.op.drop_table', 'op.drop_table', (['"""page"""'], {}), "('page')\n", (3574, 3582), False, 'from alembic import op\n'), ((1086, 1115), 'sqlalchemy.Prim... |
import os
def add_date_to_md(link, publish_date):
if os.path.exists('./md/dump_' + str(link) + '.md'):
with open('./md/dump_' + str(link) + '.md') as f:
content = f.read()
content = content.split('\n')
for i in range(2, len(content)):
if content[i].find('... | [
"os.path.join",
"os.listdir"
] | [((1566, 1589), 'os.listdir', 'os.listdir', (['"""./tistory"""'], {}), "('./tistory')\n", (1576, 1589), False, 'import os\n'), ((1639, 1670), 'os.path.join', 'os.path.join', (['"""./tistory"""', 'file'], {}), "('./tistory', file)\n", (1651, 1670), False, 'import os\n')] |
from data.models import TestModel
from rest_framework import serializers
class ExampleSerializer(serializers.ModelSerializer):
class Meta:
model = TestModel
fields = ('id', 'created', 'updated', 'method_field')
method_field = serializers.SerializerMethodField()
def get_method_field(self,... | [
"rest_framework.serializers.SerializerMethodField"
] | [((253, 288), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', ([], {}), '()\n', (286, 288), False, 'from rest_framework import serializers\n')] |
# 线程池
from multiprocessing.pool import ThreadPool # 相当于from multiprocessing.dummy import Process
pool = ThreadPool(5)
pool.apply_async(lambda x: x * x, ("args1", 'args2',))
# super函数 https://wiki.jikexueyuan.com/project/explore-python/Class/super.html
# Base
# / \
# / \
# A B
# \ /
... | [
"copy.deepcopy",
"multiprocessing.pool.ThreadPool"
] | [((106, 119), 'multiprocessing.pool.ThreadPool', 'ThreadPool', (['(5)'], {}), '(5)\n', (116, 119), False, 'from multiprocessing.pool import ThreadPool\n'), ((5152, 5178), 'copy.deepcopy', 'copy.deepcopy', (['shadow_copy'], {}), '(shadow_copy)\n', (5165, 5178), False, 'import copy\n')] |
# Generated by Django 3.0.5 on 2020-05-06 16:47
from django.db import migrations
import secrets
def copy_schedule(apps, schema_editor):
Event = apps.get_model('zsolozsma', 'Event')
EventSchedule = apps.get_model('zsolozsma', 'EventSchedule')
events_dict = {}
for event in Event.objects.all()... | [
"django.db.migrations.RunPython",
"secrets.token_hex"
] | [((471, 491), 'secrets.token_hex', 'secrets.token_hex', (['(4)'], {}), '(4)\n', (488, 491), False, 'import secrets\n'), ((1044, 1079), 'django.db.migrations.RunPython', 'migrations.RunPython', (['copy_schedule'], {}), '(copy_schedule)\n', (1064, 1079), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python3
from flask import Flask, render_template, make_response
from common import DatabaseMigrator
from flask_restful import Api
from flask_cors import CORS
from resources import *
import config
import sys
import os
from OpenSSL import SSL
from flask import request
context = SSL.Context(SSL.SSLv23_ME... | [
"flask_restful.Api",
"flask_cors.CORS",
"flask.Flask",
"common.DatabaseMigrator",
"flask.request.environ.get",
"os.path.isfile",
"OpenSSL.SSL.Context",
"flask.render_template",
"os.path.join"
] | [((295, 325), 'OpenSSL.SSL.Context', 'SSL.Context', (['SSL.SSLv23_METHOD'], {}), '(SSL.SSLv23_METHOD)\n', (306, 325), False, 'from OpenSSL import SSL\n'), ((332, 370), 'os.path.join', 'os.path.join', (["config.ssl_config['cer']"], {}), "(config.ssl_config['cer'])\n", (344, 370), False, 'import os\n'), ((377, 415), 'os.... |
import logging
import common
from cliff.command import Command
class FirstMileLogs(Command):
"Retrieve FirstMile sandbox logs"
log = logging.getLogger(__name__)
def _extract_logs(self):
cmd = "sudo docker ps -a | grep firstmile | head -1 | awk '{print $1}'"
err, output = common.exec... | [
"logging.getLogger",
"common.execute_shell_cmd"
] | [((145, 172), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (162, 172), False, 'import logging\n'), ((824, 851), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (841, 851), False, 'import logging\n'), ((309, 338), 'common.execute_shell_cmd', 'common.execute_... |
# non deep learning on bag of words
# load pickles and libraries
from src.utils.eval_metrics import *
from src.utils.initialize import *
from sklearn.model_selection import train_test_split
import pickle
with open('data/processed/movies_with_overviews.pkl','rb') as f:
movies_with_overviews=pickle.load(f)
with ope... | [
"pickle.dump",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.classification_report",
"json.dumps",
"sklearn.metrics.make_scorer",
"pickle.load",
"sklearn.multiclass.OneVsRestClassifier",
"sklearn.svm.SVC"
] | [((697, 761), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'Y', 'indecies'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(X, Y, indecies, test_size=0.2, random_state=42)\n', (713, 761), False, 'from sklearn.model_selection import train_test_split\n'), ((1264, 1291), 'sklearn.multiclass.O... |
#!/usr/bin/env python3
import glob
import re
list_of_py_files = glob.glob('*.py')
py_dict = {}
for py_file in list_of_py_files:
#print(py_file)
with open(py_file) as fil:
py_content = fil.readlines()
py_dict[py_file] = py_content
py_code_dict = {}
for py_file, list_of_lines in py_dict.items():
... | [
"re.sub",
"glob.glob"
] | [((66, 83), 'glob.glob', 'glob.glob', (['"""*.py"""'], {}), "('*.py')\n", (75, 83), False, 'import glob\n'), ((714, 742), 're.sub', 're.sub', (['"""#.*"""', '""""""', 'this_line'], {}), "('#.*', '', this_line)\n", (720, 742), False, 'import re\n'), ((5630, 5660), 're.sub', 're.sub', (['"""\\\\(.*"""', '""""""', 'this_l... |
from signac import init_project
from sacred import Experiment
from flow import FlowProject
ex = Experiment()
project = init_project('signac-sacred-integration')
class SacredProject(FlowProject):
pass
@ex.capture
def func(weights, bar):
return None
@ex.capture
@SacredProject.pre(lambda job: 'bar' not in ... | [
"sacred.Experiment",
"signac.init_project"
] | [((98, 110), 'sacred.Experiment', 'Experiment', ([], {}), '()\n', (108, 110), False, 'from sacred import Experiment\n'), ((121, 162), 'signac.init_project', 'init_project', (['"""signac-sacred-integration"""'], {}), "('signac-sacred-integration')\n", (133, 162), False, 'from signac import init_project\n')] |
# ==============================================================================
# Copyright 2019 - <NAME>
#
# NOTICE: 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, ... | [
"pickle.dump",
"diplomacy_research.utils.tensorflow.tf.data.Iterator.from_structure",
"os.unlink",
"diplomacy_research.utils.tensorflow.tf.device",
"math.ceil",
"os.path.getsize",
"os.path.dirname",
"diplomacy_research.utils.tensorflow.tf.data.TFRecordDataset",
"os.path.exists",
"numpy.zeros",
"... | [((1125, 1152), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1142, 1152), False, 'import logging\n'), ((7732, 7829), 'os.path.join', 'os.path.join', (['self.checkpoint_dir', '"""status"""', "('status-%03d.pkl' % self.cluster_config.task_id)"], {}), "(self.checkpoint_dir, 'status', 'sta... |
import json
from db_config import db
class User(db.Model):
__tablename__ = 'users'
username = db.Column(db.String(80), primary_key=True)
email = db.Column(db.String(120), unique=True, nullable=False)
def json(self):
return{'username': self.username, 'email': self.email}
@staticmethod
... | [
"db_config.db.session.commit",
"db_config.db.session.add",
"json.dumps",
"db_config.db.String"
] | [((115, 128), 'db_config.db.String', 'db.String', (['(80)'], {}), '(80)\n', (124, 128), False, 'from db_config import db\n'), ((170, 184), 'db_config.db.String', 'db.String', (['(120)'], {}), '(120)\n', (179, 184), False, 'from db_config import db\n'), ((661, 685), 'db_config.db.session.add', 'db.session.add', (['new_u... |
################################################################################
# Starlab RNN-compression with factorization method : Lowrank and group-lowrank rnn
#
# Author: <NAME> (<EMAIL>), Seoul National University
# U Kang (<EMAIL>), Seoul National University
#
# Version : 1.0
# Date : Nov 10, 2020
# Ma... | [
"torch.nn.Linear",
"torch.nn.Conv2d",
"compressed_gru.myGRU",
"compressed_lstm.myLSTM"
] | [((1047, 1071), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(64)', '(5, 1)'], {}), '(1, 64, (5, 1))\n', (1056, 1071), True, 'import torch.nn as nn\n'), ((1093, 1118), 'torch.nn.Conv2d', 'nn.Conv2d', (['(64)', '(64)', '(5, 1)'], {}), '(64, 64, (5, 1))\n', (1102, 1118), True, 'import torch.nn as nn\n'), ((1140, 1165), 'tor... |
import numpy as np
import uuid
import os
import pandas as pd
import psutil
import pickle
#import kde_info
#from lanfactory.config import
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.models import load_model
from tensorflow.python.client import device_lib
import warnings
from lanfactory.ut... | [
"pandas.DataFrame",
"numpy.random.choice",
"lanfactory.utils.try_gen_folder",
"numpy.log",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.callbacks.ReduceLROnPlateau",
"numpy.empty",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.keras.losses.Huber",
"uuid.uuid1",
"numpy.arange",
... | [((2206, 2327), 'numpy.arange', 'np.arange', (['(index % self.batches_per_file * self.batch_size)', '((index % self.batches_per_file + 1) * self.batch_size)', '(1)'], {}), '(index % self.batches_per_file * self.batch_size, (index % self.\n batches_per_file + 1) * self.batch_size, 1)\n', (2215, 2327), True, 'import n... |
"""
Service requires credentials (app_id, app_key) to be passed using the Basic Auth
Rewrite ./spec/functional_specs/auth/basic_auth_app_id_spec.rb
"""
import pytest
from threescale_api.resources import Service
from testsuite.utils import basic_auth_string
@pytest.fixture(scope="module")
def service_settings(servi... | [
"testsuite.utils.basic_auth_string",
"pytest.fixture"
] | [((263, 293), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (277, 293), False, 'import pytest\n'), ((477, 507), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (491, 507), False, 'import pytest\n'), ((1163, 1215), 'testsuite.utils.b... |
# coding=utf-8
from __future__ import unicode_literals
from markdown import markdown as markdown_
def dateformat(date):
if not date:
return ""
return date.strftime('%Y-%m-%d')
def datetimeformat(date):
if not date:
return ""
return date.strftime('%Y-%m-%d %I:%M %p')
def markdown(t... | [
"markdown.markdown"
] | [((372, 387), 'markdown.markdown', 'markdown_', (['text'], {}), '(text)\n', (381, 387), True, 'from markdown import markdown as markdown_\n')] |
#!/usr/bin/env python
import pylab as pl
import fluidsim as fls
import os
import h5py
from fluidsim.base.output.spect_energy_budget import cumsum_inv
from base import _index_where, _k_f, _eps, set_figsize, matplotlib_rc, epsetstmax
from paths import paths_sim, exit_if_figure_exists
def fig2_seb(path, fig=None, ax=No... | [
"h5py.File",
"base.set_figsize",
"base._k_f",
"fluidsim.load_sim_for_plot",
"base.epsetstmax",
"fluidsim.base.output.spect_energy_budget.cumsum_inv",
"pylab.savefig",
"pylab.subplots",
"base._index_where",
"base.matplotlib_rc",
"paths.exit_if_figure_exists",
"os.path.join"
] | [((349, 403), 'fluidsim.load_sim_for_plot', 'fls.load_sim_for_plot', (['path'], {'merge_missing_params': '(True)'}), '(path, merge_missing_params=True)\n', (370, 403), True, 'import fluidsim as fls\n'), ((421, 463), 'os.path.join', 'os.path.join', (['path', '"""spect_energy_budg.h5"""'], {}), "(path, 'spect_energy_budg... |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Rickroll(db.Model):
__tablename__ = "rickrolls"
url = db.Column(db.String, primary_key=True)
title = db.Column(db.String, nullable=False)
imgurl = db.Column(db.String, nullable=False)
redirecturl = db.Column(db.String, nullable=False... | [
"flask_sqlalchemy.SQLAlchemy"
] | [((46, 58), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (56, 58), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
import numpy as np
import matplotlib.pyplot as plt
def plot_model(variational_model, X_true, K, M, savename=None):
for k in range(K):
X, mu, x_pre, log_jacobian, epsilon_loss = variational_model.sample_timeseries(M)
plt.plot(np.transpose(X[:, k, :].detach().numpy()), alpha=0.2)
plt.plot(np.... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf"
] | [((526, 536), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (534, 536), True, 'import matplotlib.pyplot as plt\n'), ((615, 624), 'matplotlib.pyplot.clf', 'plt.clf', ([], {}), '()\n', (622, 624), True, 'import matplotlib.pyplot as plt\n')] |
import framework, datetime, os, random
already_sent = False
randomized_images = []
IMAGE_PATH = "./app/images/"
@framework.data_function
def get_data():
global already_sent, randomized_images
datum=datetime.datetime.now()
if datum.hour == 10 and not already_sent:
already_sent = True
... | [
"os.listdir",
"framework.FILE",
"datetime.datetime.now",
"os.path.join"
] | [((211, 234), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (232, 234), False, 'import framework, datetime, os, random\n'), ((810, 831), 'framework.FILE', 'framework.FILE', (['image'], {}), '(image)\n', (824, 831), False, 'import framework, datetime, os, random\n'), ((379, 406), 'os.path.join', 'o... |
# ___________________________________________________________________________
#
# Prescient
# Copyright 2020 National Technology & Engineering Solutions of Sandia, LLC
# (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S.
# Government retains certain rights in this software.
# This software is ... | [
"matplotlib.pyplot.title",
"os.mkdir",
"matplotlib.pyplot.figure",
"pandas.DataFrame",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.close",
"datetime.timedelta",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.axhline",
"json.dump",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.ylabel",
... | [((11595, 11649), 'collections.namedtuple', 'namedtuple', (['"""ScenarioWithPaths"""', "['scenario', 'paths']"], {}), "('ScenarioWithPaths', ['scenario', 'paths'])\n", (11605, 11649), False, 'from collections import OrderedDict, namedtuple\n'), ((4965, 5018), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'data', 'i... |
"""
Sample data files with missing data create ancestors at many different time points,
often only one ancestor in each time point, which can cause difficulties parallelising
the inference. This script takes a sampledata file (usually containing missing data),
calculates the times-as-freq values, then bins them into fr... | [
"argparse.ArgumentParser",
"numpy.around",
"tsinfer.formats.allele_counts",
"tsinfer.load",
"numpy.unique"
] | [((446, 490), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (469, 490), False, 'import argparse\n'), ((1549, 1582), 'numpy.around', 'np.around', (['(times * sd.num_samples)'], {}), '(times * sd.num_samples)\n', (1558, 1582), True, 'import numpy as np\... |
# Generated by Django 3.2 on 2021-05-10 00:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('library_api', '0038_auto_20210510_0054'),
]
operations = [
migrations.AlterField(
model_name='denda',
name='jumlah_har... | [
"django.db.models.IntegerField"
] | [((348, 378), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\n', (367, 378), False, 'from django.db import migrations, models\n')] |
# Generated by Django 2.0.6 on 2018-07-21 09:47
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('jackpot', '0008_jackpot_no'),
]
operations = [
migrations.RemoveField(
model_name='jackpot',
name='away_odds',
),
... | [
"django.db.migrations.RemoveField"
] | [((219, 281), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""jackpot"""', 'name': '"""away_odds"""'}), "(model_name='jackpot', name='away_odds')\n", (241, 281), False, 'from django.db import migrations\n'), ((326, 388), 'django.db.migrations.RemoveField', 'migrations.RemoveField',... |
# Write another variant of the function from the previous exercise that returns those elements
# that have at least one attribute that corresponds to a key-value pair in the dictionary.
import re
def corresponding_elements(xml_path, attrs):
elements = set()
keys = attrs.keys()
try:
f = open(xm... | [
"re.search"
] | [((470, 493), 're.search', 're.search', (['key', 'content'], {}), '(key, content)\n', (479, 493), False, 'import re\n'), ((498, 528), 're.search', 're.search', (['attrs[key]', 'content'], {}), '(attrs[key], content)\n', (507, 528), False, 'import re\n'), ((559, 594), 're.search', 're.search', (['element_pattern', 'cont... |
#!/usr/bin/env python
#
# test_x5.py -
#
# Author: <NAME> <<EMAIL>>
#
import os.path as op
import numpy as np
import pytest
import h5py
import fsl.data.image as fslimage
import fsl.utils.tempdir as tempdir
import fsl.transform.affine as affine
import fsl.transform.fnirt as fnirt
import fsl.tr... | [
"fsl.transform.x5.readLinearX5",
"h5py.File",
"fsl.transform.nonlinear.convertDeformationSpace",
"os.path.dirname",
"fsl.data.image.Image",
"fsl.transform.x5.readNonLinearX5",
"numpy.isclose",
"numpy.random.randint",
"numpy.array",
"fsl.transform.x5.writeLinearX5",
"pytest.raises",
"numpy.rand... | [((646, 671), 'numpy.array', 'np.array', (["group['Matrix']"], {}), "(group['Matrix'])\n", (654, 671), True, 'import numpy as np\n'), ((1145, 1170), 'numpy.array', 'np.array', (["group['Matrix']"], {}), "(group['Matrix'])\n", (1153, 1170), True, 'import numpy as np\n'), ((2301, 2345), 'os.path.join', 'op.join', (['data... |
from System.Windows import Point
from System.Windows.Shapes import *
from System.Windows.Controls import Grid, Canvas
from System.Windows.Media import Brushes, ScaleTransform, TranslateTransform, RotateTransform, TransformGroup, RadialGradientBrush, Color
import math
from animal import Gender
class Renderer(object)... | [
"System.Windows.Media.TransformGroup",
"System.Windows.Media.RadialGradientBrush",
"System.Windows.Media.TranslateTransform",
"System.Windows.Point",
"System.Windows.Media.Color.FromArgb",
"System.Windows.Controls.Canvas",
"math.degrees",
"System.Windows.Media.ScaleTransform"
] | [((2896, 2904), 'System.Windows.Controls.Canvas', 'Canvas', ([], {}), '()\n', (2902, 2904), False, 'from System.Windows.Controls import Grid, Canvas\n'), ((4040, 4048), 'System.Windows.Controls.Canvas', 'Canvas', ([], {}), '()\n', (4046, 4048), False, 'from System.Windows.Controls import Grid, Canvas\n'), ((4181, 4189)... |
import unittest
import pytest
import time
from datetime import datetime, timezone
from bip32utils import BIP32Key
from testcontainers.compose import DockerCompose
from src.origin_ledger_sdk import Ledger, Batch, BatchStatus, MeasurementType, PublishMeasurementRequest, IssueGGORequest, TransferGGORequest, SplitGGOReq... | [
"datetime.datetime",
"src.origin_ledger_sdk.Ledger",
"time.sleep",
"src.origin_ledger_sdk.IssueGGORequest",
"testcontainers.compose.DockerCompose"
] | [((864, 877), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (874, 877), False, 'import time\n'), ((1787, 1810), 'testcontainers.compose.DockerCompose', 'DockerCompose', (['"""./test"""'], {}), "('./test')\n", (1800, 1810), False, 'from testcontainers.compose import DockerCompose\n'), ((1835, 1848), 'time.sleep', ... |
import time
from nvflare.apis.executor import Executor
from nvflare.apis.fl_constant import ReturnCode
from nvflare.apis.fl_context import FLContext
from nvflare.apis.shareable import Shareable
from nvflare.apis.signal import Signal
from nvflare.app_common.app_constant import AppConstants
class NPTrainer(Executor):
... | [
"nvflare.apis.shareable.Shareable",
"time.sleep"
] | [((1934, 1945), 'nvflare.apis.shareable.Shareable', 'Shareable', ([], {}), '()\n', (1943, 1945), False, 'from nvflare.apis.shareable import Shareable\n'), ((2333, 2344), 'nvflare.apis.shareable.Shareable', 'Shareable', ([], {}), '()\n', (2342, 2344), False, 'from nvflare.apis.shareable import Shareable\n'), ((1862, 188... |
import struct
from sqlalchemy import *
from sqlalchemy.orm import relation, relationship
from sqlalchemy.ext.declarative import declarative_base
# DB Declaration
Base = declarative_base()
class KeyName(Base):
__tablename__ = "key_names"
id = Column(Integer, nullable=False, primary_key=True)
name = Colu... | [
"sqlalchemy.ext.declarative.declarative_base",
"struct.unpack",
"sqlalchemy.orm.relation"
] | [((172, 190), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (188, 190), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((840, 857), 'sqlalchemy.orm.relation', 'relation', (['KeyName'], {}), '(KeyName)\n', (848, 857), False, 'from sqlalchemy.orm import relatio... |
"""This is our file to provide our endpoints for our utilities."""
import logging
import os
from drf_yasg.utils import swagger_auto_schema
from maintenancemanagement.models import Equipment, FieldObject
from openCMMS.settings import BASE_DIR
from utils.data_provider import (
DataProviderException,
add_job,
... | [
"utils.data_provider.add_job",
"drf_yasg.utils.swagger_auto_schema",
"utils.models.DataProvider.objects.get",
"utils.serializers.DataProviderDetailsSerializer",
"utils.models.DataProvider.objects.all",
"utils.serializers.DataProviderUpdateSerializer",
"utils.data_provider.scheduler.remove_job",
"utils... | [((771, 798), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (788, 798), False, 'import logging\n'), ((4988, 5201), 'drf_yasg.utils.swagger_auto_schema', 'swagger_auto_schema', ([], {'operation_description': '"""Delete the DataProvider corresponding to the given key."""', 'query_serialize... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import heapq
from math import radians, cos
from functools import total_ordering
from sqlalchemy import select, func, and_
try:
from .data import (
engine, t,
find_province, find_city, find_area_name, fields,
)
from .pkg.nameddict ... | [
"heapq.nsmallest",
"cazipcode.data.find_province",
"cazipcode.data.find_city",
"random.sample",
"sqlalchemy.select",
"math.radians",
"sqlalchemy.and_",
"cazipcode.data.t.c.postalcode.like",
"cazipcode.pkg.geo_search.great_circle",
"heapq.nlargest",
"cazipcode.data.engine.connect",
"cazipcode.d... | [((3106, 3122), 'cazipcode.data.engine.connect', 'engine.connect', ([], {}), '()\n', (3120, 3122), False, 'from cazipcode.data import engine, t, find_province, find_city, find_area_name, fields\n'), ((16931, 16955), 'sqlalchemy.select', 'select', (['[t.c.postalcode]'], {}), '([t.c.postalcode])\n', (16937, 16955), False... |
from itertools import chain
from textwrap import dedent
from .utils import string_types
shared_queries = dict(
datacl=dedent("""\
WITH grants AS (
SELECT
(aclexplode(datacl)).grantee AS grantee,
(aclexplode(datacl)).privilege_type AS priv
FROM pg_catalog.pg_database
WHERE da... | [
"textwrap.dedent"
] | [((125, 788), 'textwrap.dedent', 'dedent', (['""" WITH grants AS (\n SELECT\n (aclexplode(datacl)).grantee AS grantee,\n (aclexplode(datacl)).privilege_type AS priv\n FROM pg_catalog.pg_database\n WHERE datname = current_database()\n UNION\n SELECT q.*\n FROM (VALUES (0, \... |
"""
Copyright (C) 2017 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
softw... | [
"acs.Core.TestStep.TestStepBase.TestStepBase.run",
"acs.ErrorHandling.AcsConfigException.AcsConfigException",
"acs.Core.TestStep.TestStepBase.TestStepBase.__init__"
] | [((1015, 1082), 'acs.Core.TestStep.TestStepBase.TestStepBase.__init__', 'TestStepBase.__init__', (['self', 'tc_conf', 'global_conf', 'ts_conf', 'factory'], {}), '(self, tc_conf, global_conf, ts_conf, factory)\n', (1036, 1082), False, 'from acs.Core.TestStep.TestStepBase import TestStepBase\n'), ((1282, 1313), 'acs.Core... |
import os
import pathlib
import subprocess
import sys
import fuzzywuzzy.fuzz
FUZZY_FIND_THRESHOLD = 75
class _Tool:
def find_cmd(self, directory):
if sys.platform == "win32":
cmd_exts = self.cmd_exts
else:
cmd_exts = [""]
for ext in cmd_exts:
path = p... | [
"os.fspath",
"pathlib.Path",
"subprocess.call",
"os.access"
] | [((2145, 2200), 'subprocess.call', 'subprocess.call', (['command'], {'shell': "(sys.platform == 'win32')"}), "(command, shell=sys.platform == 'win32')\n", (2160, 2200), False, 'import subprocess\n'), ((2963, 2987), 'subprocess.call', 'subprocess.call', (['command'], {}), '(command)\n', (2978, 2987), False, 'import subp... |
#!/usr/bin/env python3
import fileinput
for line in fileinput.input():
try:
host, rest = line.strip().split(")", 1)
host = ".".join(reversed(host.strip(",").split(",")))
print(f"https://{host}{rest or '/'}")
except BrokenPipeError:
break
except:
print(line, end="")
| [
"fileinput.input"
] | [((54, 71), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (69, 71), False, 'import fileinput\n')] |
import numpy as np
import scipy.ndimage as nd
import torch
import torch.nn as nn
from torch.nn import functional as F
from .utils import dequeue_and_enqueue
def compute_rce_loss(predict, target):
from einops import rearrange
predict = F.softmax(predict, dim=1)
with torch.no_grad():
_, num_cls, ... | [
"numpy.partition",
"torch.log",
"torch.nn.CrossEntropyLoss",
"torch.cat",
"torch.nn.functional.cross_entropy",
"torch.nn.functional.softmax",
"torch.softmax",
"scipy.ndimage.zoom",
"torch.FloatTensor",
"torch.clamp",
"einops.rearrange",
"numpy.where",
"numpy.rollaxis",
"torch.zeros",
"to... | [((247, 272), 'torch.nn.functional.softmax', 'F.softmax', (['predict'], {'dim': '(1)'}), '(predict, dim=1)\n', (256, 272), True, 'from torch.nn import functional as F\n'), ((2693, 2720), 'torch.sort', 'torch.sort', (['prob_l', '(1)', '(True)'], {}), '(prob_l, 1, True)\n', (2703, 2720), False, 'import torch\n'), ((2834,... |
import base64
import os
from datastore import DataStore
from emailsender import EmailSender
sendgrid_api_key = os.environ.get('SENDGRID_EMAIL_API_KEY', 'Specified environment variable is not set.')
travel_site_url = os.environ.get('TRAVEL_SITE_URL', 'Specified environment variable is not set.')
sender = os.environ.ge... | [
"os.environ.get",
"base64.b64decode",
"emailsender.EmailSender",
"datastore.DataStore"
] | [((113, 203), 'os.environ.get', 'os.environ.get', (['"""SENDGRID_EMAIL_API_KEY"""', '"""Specified environment variable is not set."""'], {}), "('SENDGRID_EMAIL_API_KEY',\n 'Specified environment variable is not set.')\n", (127, 203), False, 'import os\n'), ((218, 297), 'os.environ.get', 'os.environ.get', (['"""TRAVE... |
"""Tools used by the examples """
import numpy as np
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))+"/../meep_tomo")
from meep_tomo import extract, common
import ex_bpg
def compute_metrices(tomo_path, approx, autofocus=False):
"""Compute RMS and TV metrices for a MEEP-simulat... | [
"os.path.abspath",
"numpy.load",
"numpy.abs",
"os.path.isdir",
"os.path.exists",
"meep_tomo.extract.get_tomo_ri_structure",
"meep_tomo.common.mkdir_p",
"ex_bpg.backpropagate_fdtd_data",
"numpy.arange",
"os.path.join",
"numpy.gradient",
"numpy.sqrt"
] | [((1119, 1145), 'os.path.abspath', 'os.path.abspath', (['tomo_path'], {}), '(tomo_path)\n', (1134, 1145), False, 'import os\n'), ((1154, 1178), 'os.path.isdir', 'os.path.isdir', (['tomo_path'], {}), '(tomo_path)\n', (1167, 1178), False, 'import os\n'), ((1989, 2014), 'os.path.exists', 'os.path.exists', (['metr_file'], ... |
from secml.array import CArray
from secml.figure import CFigure
fig = CFigure(fontsize=14)
fig.title('loglog base 4 on x')
t = CArray.arange(0.01, 20.0, 0.01)
fig.sp.loglog(t, 20 * (-t / 10.0).exp(), basex=2)
fig.sp.grid()
fig.show()
| [
"secml.figure.CFigure",
"secml.array.CArray.arange"
] | [((71, 91), 'secml.figure.CFigure', 'CFigure', ([], {'fontsize': '(14)'}), '(fontsize=14)\n', (78, 91), False, 'from secml.figure import CFigure\n'), ((129, 160), 'secml.array.CArray.arange', 'CArray.arange', (['(0.01)', '(20.0)', '(0.01)'], {}), '(0.01, 20.0, 0.01)\n', (142, 160), False, 'from secml.array import CArra... |
from http import HTTPStatus
import requests
from cleo import Command
from clikit.api.io import flags
from .constants import (
AVAILABLE_MSG,
HTTP_STATUS_CODE_MSG,
NOT_AVAILABLE_MSG,
NPM_BASE_URL,
)
class NpmCommand(Command):
"""
Check the availability of a package name in npm
npm
... | [
"requests.Session",
"http.HTTPStatus"
] | [((507, 525), 'requests.Session', 'requests.Session', ([], {}), '()\n', (523, 525), False, 'import requests\n'), ((667, 690), 'http.HTTPStatus', 'HTTPStatus', (['status_code'], {}), '(status_code)\n', (677, 690), False, 'from http import HTTPStatus\n')] |
import boto3
import argparse
import json
from datetime import timedelta, date
from pprint import pprint
import aws_cost_explorer_converter
def parse_args():
parser = argparse.ArgumentParser(
description='Fetch cost explorer data from AWS and display and/or save it',
usage='%(prog)s [option... | [
"aws_cost_explorer_converter.CostExplorerConverter",
"argparse.ArgumentParser",
"boto3.client",
"datetime.date.today",
"datetime.timedelta",
"pprint.pprint"
] | [((172, 405), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Fetch cost explorer data from AWS and display and/or save it"""', 'usage': '"""%(prog)s [options]"""', 'epilog': '"""Standard environment variables for AWS connection information are supported"""'}), "(description=\n 'Fetch ... |
# 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
# d... | [
"neutron.objects.db.api.get_objects",
"oslo_utils.reflection.get_class_name",
"neutron._i18n._",
"six.add_metaclass",
"itertools.chain",
"neutron.objects.db.api.get_object",
"neutron_lib.exceptions.InvalidInput"
] | [((2185, 2215), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (2202, 2215), False, 'import six\n'), ((3985, 4021), 'six.add_metaclass', 'six.add_metaclass', (['DeclarativeObject'], {}), '(DeclarativeObject)\n', (4002, 4021), False, 'import six\n'), ((945, 1006), 'neutron._i18n._', ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name="AzureStorage",
version="0.0.2",
entry_points={
'console_scripts': [
'AzureCredentials = azure_storage.azure_credentials:cli',
'AzureAutomate = azure_storage.azure_automate:cli',
... | [
"setuptools.find_packages"
] | [((755, 770), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (768, 770), False, 'from setuptools import setup, find_packages\n')] |
from django.urls import path
from base.views.order_views import *
urlpatterns = [
path('', getOrders, name='orders'),
path('add/', addOrderItems, name='orders-add'),
path('gettoken/', getTokenView, name='get-client-token'),
path('myorders/', getMyOrders, name='myorders'),
path('<str:pk>/', getOrder... | [
"django.urls.path"
] | [((87, 121), 'django.urls.path', 'path', (['""""""', 'getOrders'], {'name': '"""orders"""'}), "('', getOrders, name='orders')\n", (91, 121), False, 'from django.urls import path\n'), ((127, 173), 'django.urls.path', 'path', (['"""add/"""', 'addOrderItems'], {'name': '"""orders-add"""'}), "('add/', addOrderItems, name='... |
import flexmock
import pytest
import requests
from argo.workflows.dsl import Workflow
from ._base import TestCase
"""Workflow test suite."""
@pytest.fixture # type: ignore
def url() -> str:
"""Fake URL fixture."""
class TestWorkflow(TestCase):
"""Test Workflow."""
_WORKFLOW_FILE = TestCase.DATA / "... | [
"argo.workflows.dsl.Workflow.from_file",
"argo.workflows.dsl.Workflow.from_url",
"flexmock"
] | [((453, 492), 'argo.workflows.dsl.Workflow.from_file', 'Workflow.from_file', (['self._WORKFLOW_FILE'], {}), '(self._WORKFLOW_FILE)\n', (471, 492), False, 'from argo.workflows.dsl import Workflow\n'), ((1001, 1023), 'argo.workflows.dsl.Workflow.from_url', 'Workflow.from_url', (['url'], {}), '(url)\n', (1018, 1023), Fals... |
from PyQt4 import QtGui
import webbrowser
__author__ = 'postrowski'
# -*-coding: utf-8-*-
class DeezerIcon(object):
def __init__(self, parent):
self.iconLabel = parent.iconLabel
self.timer = parent.timer
def hover_button(self):
if self.iconLabel.underMouse():
self.tim... | [
"PyQt4.QtGui.QPixmap"
] | [((354, 392), 'PyQt4.QtGui.QPixmap', 'QtGui.QPixmap', (['"""images/icon_hover.svg"""'], {}), "('images/icon_hover.svg')\n", (367, 392), False, 'from PyQt4 import QtGui\n'), ((473, 505), 'PyQt4.QtGui.QPixmap', 'QtGui.QPixmap', (['"""images/icon.svg"""'], {}), "('images/icon.svg')\n", (486, 505), False, 'from PyQt4 impor... |
from FileData import FileData
import pandas as pd
import numpy as np
file_data = FileData("F:\\Python Projects\\170622_MDS.txt")
print(file_data.df)
file_data.df.fillna(0)
print(file_data.df)
df = pd.DataFrame([[np.nan, 2, np.nan, 0],
[3, 4, np.nan, 1],
[np.nan, np.nan, np.nan,... | [
"FileData.FileData"
] | [((83, 130), 'FileData.FileData', 'FileData', (['"""F:\\\\Python Projects\\\\170622_MDS.txt"""'], {}), "('F:\\\\Python Projects\\\\170622_MDS.txt')\n", (91, 130), False, 'from FileData import FileData\n')] |
''' Estes exercícios fazem parte do curso de Introdução a Algoritmos, ministrado pelo prof. <NAME> e podem ser encontrados no site https://www.cursoemvideo.com/wp-content/uploads/2019/08/exercicios-algoritmos.pdf
81) Crie um programa que leia a idade de 8 pessoas e guarde-as em um vetor. No final, mostre:
... | [
"tabulate.tabulate",
"random.randint"
] | [((2568, 2589), 'random.randint', 'random.randint', (['(0)', '(99)'], {}), '(0, 99)\n', (2582, 2589), False, 'import random\n'), ((3305, 3320), 'tabulate.tabulate', 'tabulate', (['table'], {}), '(table)\n', (3313, 3320), False, 'from tabulate import tabulate\n'), ((4374, 4389), 'tabulate.tabulate', 'tabulate', (['table... |
from django.urls import re_path
from olympia.addons.urls import ADDON_ID
from olympia.amo.views import frontend_view
from . import views
urlpatterns = [
re_path(r'^$', frontend_view, name='addons.versions'),
re_path(
r'^(?P<version_num>[^/]+)/updateinfo/$',
views.update_info,
name='a... | [
"django.urls.re_path"
] | [((161, 213), 'django.urls.re_path', 're_path', (['"""^$"""', 'frontend_view'], {'name': '"""addons.versions"""'}), "('^$', frontend_view, name='addons.versions')\n", (168, 213), False, 'from django.urls import re_path\n'), ((220, 327), 'django.urls.re_path', 're_path', (['"""^(?P<version_num>[^/]+)/updateinfo/$"""', '... |
import sys, humanize, psutil, GPUtil, time, torch
import torchvision.transforms as tt
from torchvision.datasets import ImageFolder
from torch.utils.data import DataLoader
class DeviceDataLoader():
"""
DeviceDataLoader Class
----------------------
Wraps and sends a pytorch dataloader to current device
... | [
"psutil.virtual_memory",
"GPUtil.getGPUs",
"torch.utils.data.DataLoader",
"torchvision.datasets.ImageFolder",
"torch.cuda.is_available",
"torch.device",
"torchvision.transforms.ToTensor"
] | [((898, 914), 'GPUtil.getGPUs', 'GPUtil.getGPUs', ([], {}), '()\n', (912, 914), False, 'import sys, humanize, psutil, GPUtil, time, torch\n'), ((1166, 1191), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1189, 1191), False, 'import sys, humanize, psutil, GPUtil, time, torch\n'), ((2108, 2147)... |
from random import uniform
from math import hypot
n = int(input('input n:'))
m = 0
for i in range(n):
d = hypot(uniform(0,1),uniform(0,1))
if d < 1:
m+=1
print(float(m*4 /n))
| [
"random.uniform"
] | [((118, 131), 'random.uniform', 'uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (125, 131), False, 'from random import uniform\n'), ((131, 144), 'random.uniform', 'uniform', (['(0)', '(1)'], {}), '(0, 1)\n', (138, 144), False, 'from random import uniform\n')] |
"""Unit tests for ``rhodes.structures``."""
import pytest
from rhodes.structures import ContextPath, Parameters
pytestmark = [pytest.mark.local, pytest.mark.functional]
_VALID_STATIC_CONTEXT_PATHS = (
"$$",
"$$.Execution",
"$$.Execution.Id",
"$$.Execution.StartTime",
"$$.State",
"$$.State.En... | [
"rhodes.structures.ContextPath",
"pytest.param",
"pytest.raises",
"rhodes.structures.Parameters",
"pytest.mark.parametrize"
] | [((848, 912), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""path"""', '_VALID_CONTEXT_PATHS_WITH_INPUT'], {}), "('path', _VALID_CONTEXT_PATHS_WITH_INPUT)\n", (871, 912), False, 'import pytest\n'), ((977, 1041), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""path"""', '_VALID_CONTEXT_PATHS_WIT... |
#!/usr/bin/python3
""" Posts pull request review comments, excluding the existing ones and
the ones not affecting files modified in the current pull_request_id."""
#
# Copyright (C) 2021 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public... | [
"json.loads",
"time.sleep",
"os.environ.get",
"re.findall",
"requests.get",
"requests.post",
"itertools.chain.from_iterable"
] | [((3774, 3806), 'os.environ.get', 'os.environ.get', (['"""GITHUB_API_URL"""'], {}), "('GITHUB_API_URL')\n", (3788, 3806), False, 'import os\n'), ((3826, 3862), 'os.environ.get', 'os.environ.get', (['"""INPUT_GITHUB_TOKEN"""'], {}), "('INPUT_GITHUB_TOKEN')\n", (3840, 3862), False, 'import os\n'), ((1663, 1797), 'request... |
from webob import Request, Response
from parse import parse
import inspect
from requests import Session as RequestsSession
from wsgiadapter import WSGIAdapter as RequestsWSGIAdapter
import os
from jinja2 import Environment, FileSystemLoader
from whitenoise import WhiteNoise
from middleware import Middleware
from stati... | [
"static.cut_static_root",
"os.path.abspath",
"whitenoise.WhiteNoise",
"webob.Response",
"inspect.isclass",
"requests.Session",
"static.request_for_static",
"webob.Request",
"middleware.Middleware",
"wsgiadapter.WSGIAdapter",
"parse.parse"
] | [((637, 679), 'whitenoise.WhiteNoise', 'WhiteNoise', (['self.wsgi_app'], {'root': 'static_dir'}), '(self.wsgi_app, root=static_dir)\n', (647, 679), False, 'from whitenoise import WhiteNoise\n'), ((706, 733), 'os.path.abspath', 'os.path.abspath', (['static_dir'], {}), '(static_dir)\n', (721, 733), False, 'import os\n'),... |
import numpy as np
def apply_cross_fade(clips, cross_fade_ms, sr):
"""Concatenate audio clips with a cross fade."""
num_clips = len(clips)
cross_fade_samples = int(np.floor(cross_fade_ms * sr / 1000))
fade_ramp = np.arange(cross_fade_samples) / cross_fade_samples
# if not is_even(cross_fade_sam... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.floor",
"numpy.zeros",
"numpy.iinfo",
"numpy.arange"
] | [((579, 600), 'numpy.zeros', 'np.zeros', (['num_samples'], {}), '(num_samples)\n', (587, 600), True, 'import numpy as np\n'), ((1363, 1400), 'matplotlib.pyplot.plot', 'plt.plot', (['time_x', 'x'], {'label': '"""Original"""'}), "(time_x, x, label='Original')\n", (1371, 1400), True, 'import matplotlib.pyplot as plt\n'), ... |
import numpy as np
import cv2
import os
from conv import *
import multiprocessing
from multiprocessing import Pool
from itertools import product
from numba import njit
from functools import partial
import math
import sklearn
from sklearn import linear_model
def load_images_from_folder(folder):
image... | [
"functools.partial",
"numpy.asarray",
"numpy.zeros",
"sklearn.linear_model.LogisticRegression",
"numpy.max",
"numpy.array",
"multiprocessing.Pool",
"numpy.random.rand",
"multiprocessing.Process",
"os.path.join",
"os.listdir",
"cv2.resize",
"numpy.sqrt"
] | [((348, 366), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (358, 366), False, 'import os\n'), ((593, 611), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (603, 611), False, 'import os\n'), ((1960, 1967), 'multiprocessing.Pool', 'Pool', (['(4)'], {}), '(4)\n', (1964, 1967), False, 'from multi... |
# use after installing the client to run the client
import sys
import multiprocessing
try:
import pyOHOL
except ImportError as e:
print("Client is not installed")
raise e
def main():
multiprocessing.freeze_support()
pyOHOL.main()
if __name__ == "__main__":
main()
| [
"multiprocessing.freeze_support",
"pyOHOL.main"
] | [((199, 231), 'multiprocessing.freeze_support', 'multiprocessing.freeze_support', ([], {}), '()\n', (229, 231), False, 'import multiprocessing\n'), ((236, 249), 'pyOHOL.main', 'pyOHOL.main', ([], {}), '()\n', (247, 249), False, 'import pyOHOL\n')] |
#
# 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 ... | [
"alembic.op.drop_table",
"datetime.datetime.utcnow",
"sqlalchemy.DateTime",
"airflow.models.LastDeployedTime"
] | [((1151, 1186), 'alembic.op.drop_table', 'op.drop_table', (['"""last_deployed_time"""'], {}), "('last_deployed_time')\n", (1164, 1186), False, 'from alembic import op\n'), ((1110, 1127), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (1125, 1127), False, 'from datetime import datetime\n'), ((1030, 104... |
from django.contrib import admin
from.models import Ticket,Customeuser
# Register your models here.
admin.site.register(Ticket)
admin.site.register(Customeuser) | [
"django.contrib.admin.site.register"
] | [((105, 132), 'django.contrib.admin.site.register', 'admin.site.register', (['Ticket'], {}), '(Ticket)\n', (124, 132), False, 'from django.contrib import admin\n'), ((134, 166), 'django.contrib.admin.site.register', 'admin.site.register', (['Customeuser'], {}), '(Customeuser)\n', (153, 166), False, 'from django.contrib... |
# -*- coding: utf-8 -*-
from uuid import uuid4
from copy import deepcopy
from datetime import timedelta
from openprocurement.auctions.core.utils import calculate_business_date
from openprocurement.auctions.appraisal.models import AppraisalAuction
def check_items_listing(self):
self.app.authorization = ('Basic', ... | [
"openprocurement.auctions.appraisal.models.AppraisalAuction",
"copy.deepcopy",
"uuid.uuid4",
"datetime.timedelta"
] | [((8757, 8781), 'openprocurement.auctions.appraisal.models.AppraisalAuction', 'AppraisalAuction', (['fromdb'], {}), '(fromdb)\n', (8773, 8781), False, 'from openprocurement.auctions.appraisal.models import AppraisalAuction\n'), ((11129, 11161), 'copy.deepcopy', 'deepcopy', (['self.initial_item_data'], {}), '(self.initi... |
# -*- coding: utf-8 -*-
import base64
import json
import scrapy
from scrapy import Request
class ProxyList(scrapy.Spider):
name = "proxy_list"
allowed_domains = ["proxy-list.org"]
def start_requests(self):
for i in range(1, 4):
print(i)
yield Request('https://proxy-list.o... | [
"json.loads",
"scrapy.Request"
] | [((291, 351), 'scrapy.Request', 'Request', (["('https://proxy-list.org/english/index.php?p=%s' % i)"], {}), "('https://proxy-list.org/english/index.php?p=%s' % i)\n", (298, 351), False, 'from scrapy import Request\n'), ((1102, 1174), 'scrapy.Request', 'Request', (['url'], {'callback': 'self.check_available', 'meta': 'm... |
import unittest
import numpy as np
from src.square_matrix_multiply import square_matrix_multiply
class TestStrassenMultiply(unittest.TestCase):
def test_square_1(self):
matrix_a = np.array([[1, 3],
[7, 5]])
matrix_b = np.array([[6, 8],
[4... | [
"numpy.array",
"src.square_matrix_multiply.square_matrix_multiply"
] | [((196, 222), 'numpy.array', 'np.array', (['[[1, 3], [7, 5]]'], {}), '([[1, 3], [7, 5]])\n', (204, 222), True, 'import numpy as np\n'), ((271, 297), 'numpy.array', 'np.array', (['[[6, 8], [4, 2]]'], {}), '([[6, 8], [4, 2]])\n', (279, 297), True, 'import numpy as np\n'), ((347, 377), 'numpy.array', 'np.array', (['[[18, ... |
from setuptools import setup
setup(
name = 'azdevman',
version = '0.0.1',
packages = ['azdevman'],
entry_points = {
'console_scripts': [
'azdevman = azdevman.main:cli'
]
}
)
| [
"setuptools.setup"
] | [((30, 165), 'setuptools.setup', 'setup', ([], {'name': '"""azdevman"""', 'version': '"""0.0.1"""', 'packages': "['azdevman']", 'entry_points': "{'console_scripts': ['azdevman = azdevman.main:cli']}"}), "(name='azdevman', version='0.0.1', packages=['azdevman'], entry_points\n ={'console_scripts': ['azdevman = azdevm... |
# -*- coding: utf-8 -*-
"""
数据库工具.
@author: zhoujiagen
Created on 03/11/2018 10:02 AM
"""
import pymysql
def connect_mysql(host='127.0.0.1',
port=3306,
user='root',
password='<PASSWORD>',
database='pci',
charset='utf8'):
""... | [
"pymysql.connect"
] | [((482, 589), 'pymysql.connect', 'pymysql.connect', ([], {'host': 'host', 'port': 'port', 'user': 'user', 'password': 'password', 'database': 'database', 'charset': 'charset'}), '(host=host, port=port, user=user, password=password,\n database=database, charset=charset)\n', (497, 589), False, 'import pymysql\n')] |
import json
import math
import logging
from pprint import pprint # noqa
from flask import Blueprint, request
from werkzeug.exceptions import BadRequest
from followthemoney import model
from followthemoney.compare import compare
from aleph.core import settings, url_for
from aleph.model import Entity
from aleph.search ... | [
"werkzeug.exceptions.BadRequest",
"aleph.search.SearchQueryParser",
"followthemoney.model.get",
"aleph.index.util.unpack_result",
"json.loads",
"flask.request.args.get",
"followthemoney.compare.compare",
"aleph.search.EntitiesQuery",
"followthemoney.model.get_proxy",
"aleph.core.settings.APP_UI_UR... | [((610, 646), 'flask.Blueprint', 'Blueprint', (['"""reconcile_api"""', '__name__'], {}), "('reconcile_api', __name__)\n", (619, 646), False, 'from flask import Blueprint, request\n'), ((653, 680), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (670, 680), False, 'import logging\n'), ((120... |
from pyforms.terminal.Controls.ControlBase import ControlBase
class ControlProgress(ControlBase):
_min = 0
_max = 100
def __init__(self, label = "%p%", defaultValue = 0, min = 0, max = 100, helptext=None):
self._updateSlider = True
self._min = min
self._max = max
ControlBa... | [
"pyforms.terminal.Controls.ControlBase.ControlBase.__init__"
] | [((311, 358), 'pyforms.terminal.Controls.ControlBase.ControlBase.__init__', 'ControlBase.__init__', (['self', 'label', 'defaultValue'], {}), '(self, label, defaultValue)\n', (331, 358), False, 'from pyforms.terminal.Controls.ControlBase import ControlBase\n')] |
import matplotlib.pyplot as plt
import numpy as np
from numpy.lib.function_base import angle
radius = 100 # curvature radius of the mirror in mm (must be positive)
angle_d = 30 # maximum angle of incidence of the incident beam in degrees
num_rays = 21 # number of rays
source_pos = 80 # source position in mm (mu... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"numpy.isnan",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.array",
"numpy.tan",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.grid",
"n... | [((399, 433), 'numpy.linspace', 'np.linspace', (['(-radius)', 'radius', '(1000)'], {}), '(-radius, radius, 1000)\n', (410, 433), True, 'import numpy as np\n'), ((1428, 1455), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(13, 8)'}), '(figsize=(13, 8))\n', (1438, 1455), True, 'import matplotlib.pyplot as p... |
""" Module including utilities for main algorithms"""
from PIL import Image as PillowImage
from collections import namedtuple
ImageData = namedtuple("ImgData", 'header image')
HSV = namedtuple("HSV", 'h s v')
RGB = namedtuple("RGB", 'r g b')
class Image:
""" Wrapper for Image class for easier usage"""
def __... | [
"PIL.Image.new",
"collections.namedtuple",
"PIL.Image.open"
] | [((139, 176), 'collections.namedtuple', 'namedtuple', (['"""ImgData"""', '"""header image"""'], {}), "('ImgData', 'header image')\n", (149, 176), False, 'from collections import namedtuple\n'), ((183, 209), 'collections.namedtuple', 'namedtuple', (['"""HSV"""', '"""h s v"""'], {}), "('HSV', 'h s v')\n", (193, 209), Fal... |
"""
Tests for the loading of surface maps for the GPROF-NN data processing.
"""
from datetime import datetime
import pytest
import numpy as np
from gprof_nn.data.surface import (read_land_mask,
read_autosnow,
read_emissivity_classes)
from gprof_nn.... | [
"gprof_nn.data.surface.read_land_mask",
"gprof_nn.data.surface.read_emissivity_classes",
"gprof_nn.data.surface.read_autosnow",
"numpy.isclose",
"pytest.mark.skipif",
"gprof_nn.data.preprocessor.has_preprocessor",
"numpy.all"
] | [((383, 401), 'gprof_nn.data.preprocessor.has_preprocessor', 'has_preprocessor', ([], {}), '()\n', (399, 401), False, 'from gprof_nn.data.preprocessor import has_preprocessor\n'), ((405, 477), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not HAS_PREPROCESSOR)'], {'reason': '"""Preprocessor missing."""'}), "(not HAS_... |