code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from ecc import EC
from exceptions_ecc.signatureerror import SignatureError
from utils.inversion import Inverse
class DSA(object):
"""ECDSA
- ec: elliptic curve
- g: a point on ec
"""
def __init__(self, ec, g):
self.ec = ec
self.g = g
self.n = ec.order(g)
pass
d... | [
"utils.inversion.Inverse",
"exceptions_ecc.signatureerror.SignatureError"
] | [((1415, 1452), 'exceptions_ecc.signatureerror.SignatureError', 'SignatureError', (['(p[0] % self.n)', 'sig[0]'], {}), '(p[0] % self.n, sig[0])\n', (1429, 1452), False, 'from exceptions_ecc.signatureerror import SignatureError\n'), ((1154, 1163), 'utils.inversion.Inverse', 'Inverse', ([], {}), '()\n', (1161, 1163), Fal... |
import typing
import numpy as np
import numba as nb
@nb.njit
def uf_build(n: int) -> np.ndarray:
return np.full(n, -1, np.int64)
@nb.njit
def uf_find(uf: np.ndarray, u: int) -> int:
if uf[u] < 0: return u
uf[u] = uf_find(uf, uf[u])
return uf[u]
@nb.njit
def uf_unite(
uf: np.ndarray,
u: int,
... | [
"numpy.full"
] | [((112, 136), 'numpy.full', 'np.full', (['n', '(-1)', 'np.int64'], {}), '(n, -1, np.int64)\n', (119, 136), True, 'import numpy as np\n')] |
# Standard Library
import logging
# Third-Party
import pydf
from rest_framework_json_api.filters import OrderingFilter
from rest_framework_json_api.django_filters import DjangoFilterBackend
from django_fsm import TransitionNotAllowed
from dry_rest_permissions.generics import DRYPermissions
from rest_framework import ... | [
"logging.getLogger",
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((1682, 1709), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1699, 1709), False, 'import logging\n'), ((2730, 2766), 'rest_framework.decorators.action', 'action', ([], {'methods': "['get']", 'detail': '(True)'}), "(methods=['get'], detail=True)\n", (2736, 2766), False, 'from rest_frame... |
import logging
from Top import Top
log = logging.getLogger(__name__)
if __name__ == "__main__":
import sys
sys.path.append('..')
class AtomicProps(Top):
"""
This is a container for atomic properties.
Expected functionality:
1. Provide data structure to store atomic properties,
2.... | [
"logging.getLogger",
"sys.path.append",
"Settings.Settings"
] | [((42, 69), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (59, 69), False, 'import logging\n'), ((117, 138), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (132, 138), False, 'import sys\n'), ((2577, 2587), 'Settings.Settings', 'Settings', ([], {}), '()\n', (2585, ... |
from poli.sublime.edit import call_with_edit
from poli.sublime.misc import push_to_jump_history
def set_selection(view, to=None, to_all=None, show=False):
assert (to is None) != (to_all is None)
view.sel().clear()
if to_all is not None:
view.sel().add_all(to_all)
else:
view.sel().add(... | [
"poli.sublime.misc.push_to_jump_history",
"poli.sublime.edit.call_with_edit"
] | [((423, 449), 'poli.sublime.misc.push_to_jump_history', 'push_to_jump_history', (['view'], {}), '(view)\n', (443, 449), False, 'from poli.sublime.misc import push_to_jump_history\n'), ((535, 559), 'poli.sublime.edit.call_with_edit', 'call_with_edit', (['view', 'go'], {}), '(view, go)\n', (549, 559), False, 'from poli.s... |
import namespace_override as override
def _(methods, address, class_name):
ret = []
post = []
if 'using.cs' in methods:
add_to = [ret]
for line in methods['using.cs']:
if '---;' not in line:
add_to[0] += [line]
else:
add_to = [post]
... | [
"namespace_override._"
] | [((407, 420), 'namespace_override._', 'override._', (['s'], {}), '(s)\n', (417, 420), True, 'import namespace_override as override\n')] |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask("{{cookiecutter.project_slug}}")
app.config.from_pyfile('configs/config.py')
# Init db
db = SQLAlchemy(app)
| [
"flask_sqlalchemy.SQLAlchemy",
"flask.Flask"
] | [((71, 109), 'flask.Flask', 'Flask', (['"""{{cookiecutter.project_slug}}"""'], {}), "('{{cookiecutter.project_slug}}')\n", (76, 109), False, 'from flask import Flask\n'), ((170, 185), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (180, 185), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
#!/usr/bin/env python3
from aws_cdk import core
from asg_alb_webservers.asg_alb_webservers_stack import AsgAlbWebserversStack
app = core.App()
AsgAlbWebserversStack(app, "asg-alb-webservers")
app.synth()
| [
"asg_alb_webservers.asg_alb_webservers_stack.AsgAlbWebserversStack",
"aws_cdk.core.App"
] | [((136, 146), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (144, 146), False, 'from aws_cdk import core\n'), ((147, 195), 'asg_alb_webservers.asg_alb_webservers_stack.AsgAlbWebserversStack', 'AsgAlbWebserversStack', (['app', '"""asg-alb-webservers"""'], {}), "(app, 'asg-alb-webservers')\n", (168, 195), False, 'fro... |
# Generated by Django 3.2.5 on 2021-10-17 12:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Car',
fields=[
... | [
"django.db.models.FloatField",
"django.db.models.ForeignKey",
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((4167, 4269), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'to': '"""accounts.category"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n to='accounts.category')\n", (4184, 4269), False, 'from django.db import migrat... |
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
import math
def nn_layer(X, input_dim, output_dim, layer_name, act=tf.nn.relu):
with tf.name_scope(layer_name):
with tf.name_scope('weights'):
W = tf.Variable(tf.truncated_normal([input_dim, output_dim], stddev=... | [
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"tensorflow.reduce_mean",
"math.exp",
"tensorflow.set_random_seed",
"tensorflow.cast",
"tensorflow.summary.image",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"tensorflow.matmul"... | [((3751, 3819), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data/"""'], {'one_hot': '(True)', 'reshape': '(True)'}), "('MNIST_data/', one_hot=True, reshape=True)\n", (3776, 3819), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((3824... |
#!/usr/bin/env python3
"""Graph Viewer demo.
Renders a phonebot into an OpenGL-based window, looping through joint
angles; i.e., we construct a PhonebotGraph and update the transforms of
the legs.
"""
import time
import numpy as np
from phonebot.core.common.math.utils import anorm
from phonebot.core.common.config im... | [
"phonebot.core.common.config.PhonebotSettings",
"phonebot.core.frame_graph.graph_utils.solve_knee_angle",
"phonebot.core.frame_graph.graph_utils.get_graph_geometries",
"phonebot.core.common.math.utils.anorm",
"numpy.linspace",
"phonebot.core.frame_graph.phonebot_graph.PhonebotGraph",
"phonebot.vis.viewe... | [((705, 723), 'phonebot.core.common.config.PhonebotSettings', 'PhonebotSettings', ([], {}), '()\n', (721, 723), False, 'from phonebot.core.common.config import PhonebotSettings\n'), ((868, 889), 'phonebot.core.frame_graph.phonebot_graph.PhonebotGraph', 'PhonebotGraph', (['config'], {}), '(config)\n', (881, 889), False,... |
from webui.settings import ConfigFile
from ocw.lib.azure import Azure
from ocw.lib.EC2 import EC2
from ocw.lib.gce import GCE
from ocw.lib.emailnotify import send_mail
from ocw.lib.emailnotify import send_cluster_notification
import logging
import traceback
from ocw.apps import getScheduler
logger = logging.getLogger(... | [
"logging.getLogger",
"traceback.format_exc",
"webui.settings.ConfigFile",
"ocw.lib.azure.Azure",
"ocw.lib.emailnotify.send_cluster_notification",
"ocw.lib.gce.GCE",
"ocw.apps.getScheduler",
"ocw.lib.EC2.EC2"
] | [((302, 329), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (319, 329), False, 'import logging\n'), ((361, 373), 'webui.settings.ConfigFile', 'ConfigFile', ([], {}), '()\n', (371, 373), False, 'from webui.settings import ConfigFile\n'), ((1357, 1369), 'webui.settings.ConfigFile', 'Config... |
# Python Turtle Triangle
# Code by <NAME>
# https://yaozeye.github.io
# 05 March, 2020
# under the MIT License https://github.com/yaozeye/python/raw/master/LICENSE
import turtle
turtle.fd(100)
turtle.seth(120)
turtle.fd(100)
turtle.seth(240)
turtle.fd(100)
turtle.seth(0)
turtle.done()
| [
"turtle.done",
"turtle.seth",
"turtle.fd"
] | [((181, 195), 'turtle.fd', 'turtle.fd', (['(100)'], {}), '(100)\n', (190, 195), False, 'import turtle\n'), ((196, 212), 'turtle.seth', 'turtle.seth', (['(120)'], {}), '(120)\n', (207, 212), False, 'import turtle\n'), ((213, 227), 'turtle.fd', 'turtle.fd', (['(100)'], {}), '(100)\n', (222, 227), False, 'import turtle\n'... |
from PIL import ImageGrab,Image
import cv2
import numpy
from Tkinter import *
from pyrobot import Robot, Keys
def go():
toClick=[0]*70
i,j=0,0
for txt10 in txtbox:
for txt7 in txt10:
try:
nr=int(txt7.get())
if nr>0 and nr<71:
toClick[n... | [
"cv2.minMaxLoc",
"PIL.ImageGrab.grab",
"cv2.matchTemplate",
"pyrobot.Robot"
] | [((1078, 1085), 'pyrobot.Robot', 'Robot', ([], {}), '()\n', (1083, 1085), False, 'from pyrobot import Robot, Keys\n'), ((798, 846), 'cv2.matchTemplate', 'cv2.matchTemplate', (['img', 'tmp', 'cv2.TM_CCORR_NORMED'], {}), '(img, tmp, cv2.TM_CCORR_NORMED)\n', (815, 846), False, 'import cv2\n'), ((890, 908), 'cv2.minMaxLoc'... |
"""Test class for metrics that don't use a reference.
"""
import unittest
class TestReferenceLessMetric(object):
pass
if __name__ == '__main__':
unittest.main()
| [
"unittest.main"
] | [((156, 171), 'unittest.main', 'unittest.main', ([], {}), '()\n', (169, 171), False, 'import unittest\n')] |
import datetime
import functools
import operator
import random
import time
from functools import reduce
INCOMING_DATE_FORMAT = "%Y-%m-%dT%H:%M:%S"
DEFAULT_OUTGOING_FORMAT = "%d-%m-%Y"
def delayed(seconds):
def decorator(f):
def wrapper(*args, **kargs):
time.sleep(seconds)
return ... | [
"functools.reduce",
"google.cloud.error_reporting.Client",
"time.sleep"
] | [((1542, 1566), 'google.cloud.error_reporting.Client', 'error_reporting.Client', ([], {}), '()\n', (1564, 1566), False, 'from google.cloud import error_reporting\n'), ((666, 709), 'functools.reduce', 'reduce', (['operator.getitem', 'mapList', 'dataDict'], {}), '(operator.getitem, mapList, dataDict)\n', (672, 709), Fals... |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# CHNetworkSegment datasource
# ----------------------------------------------------------------------
# Copyright (C) 2007-2017 The NOC Project
# See LICENSE for details
# --------------------------------------------------... | [
"noc.sa.models.managedobjectprofile.ManagedObjectProfile.objects.filter"
] | [((646, 683), 'noc.sa.models.managedobjectprofile.ManagedObjectProfile.objects.filter', 'ManagedObjectProfile.objects.filter', ([], {}), '()\n', (681, 683), False, 'from noc.sa.models.managedobjectprofile import ManagedObjectProfile\n')] |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2020-2021 Alibaba Group Holding Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LI... | [
"logging.getLogger",
"vineyard.ObjectMeta",
"vineyard.io.deserialize",
"numpy.testing.assert_array_almost_equal",
"numpy.ones",
"pytest.mark.skip",
"os.environ.get",
"vineyard.connect",
"shutil.rmtree",
"pytest.fixture",
"vineyard.io.serialize"
] | [((770, 799), 'logging.getLogger', 'logging.getLogger', (['"""vineyard"""'], {}), "('vineyard')\n", (787, 799), False, 'import logging\n'), ((803, 833), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (817, 833), False, 'import pytest\n'), ((2838, 2869), 'pytest.mark.skip', 'p... |
# /usr/bin/env python3.6
# -*- mode: python -*-
# =============================================================================
# @@-COPYRIGHT-START-@@
#
# Copyright (c) 2021, Qualcomm Innovation Center, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification,... | [
"tensorflow.math.squared_difference",
"tensorflow.add",
"tensorflow.sigmoid",
"tensorflow.constant",
"numpy.cos"
] | [((3562, 3623), 'tensorflow.math.squared_difference', 'tf.math.squared_difference', (['ada_quantized_output', 'orig_output'], {}), '(ada_quantized_output, orig_output)\n', (3588, 3623), True, 'import tensorflow as tf\n'), ((5067, 5101), 'tensorflow.constant', 'tf.constant', (['(0.0)'], {'dtype': 'tf.float32'}), '(0.0, ... |
import os.path
from notes_manager import NotesManager
from util import app, validate
class Channel:
DIRECTION_LEFT = -1
DIRECTION_MIDDLE = 0
DIRECTION_RIGHT = 1
notes_on = []
__notes_manager = None
__start_note = 48
def __init__(self, instrument, volume, direction, keymap_file_path):
... | [
"util.validate.integer",
"notes_manager.NotesManager",
"util.validate.midi_range"
] | [((626, 668), 'util.validate.integer', 'validate.integer', (['instrument', '"""Instrument"""'], {}), "(instrument, 'Instrument')\n", (642, 668), False, 'from util import app, validate\n'), ((677, 722), 'util.validate.midi_range', 'validate.midi_range', (['instrument', '"""Instrument"""'], {}), "(instrument, 'Instrument... |
import unittest
from Backlog_scripts.login_without_credentials import login_no_credentials
from Data.parameters import Data
from reuse_func import GetData
class cQube_login_page_test(unittest.TestCase):
@classmethod
def setUpClass(self):
self.data = GetData()
self.driver = self.data.get_drive... | [
"reuse_func.GetData",
"Backlog_scripts.login_without_credentials.login_no_credentials"
] | [((269, 278), 'reuse_func.GetData', 'GetData', ([], {}), '()\n', (276, 278), False, 'from reuse_func import GetData\n'), ((3452, 3485), 'Backlog_scripts.login_without_credentials.login_no_credentials', 'login_no_credentials', (['self.driver'], {}), '(self.driver)\n', (3472, 3485), False, 'from Backlog_scripts.login_wit... |
import paramiko
class FortiGate:
STATUS_OFFLINE = "offline"
STATUS_ONLINE = "online"
def __init__(self, ip, user="admin", password="", ssh_port=22):
self.ip = ip
self.user = user
self.password = password
self.ssh_port = ssh_port
self.ssh_status = self.STATUS_OFFLINE
self.ssh = No... | [
"paramiko.SSHClient",
"paramiko.AutoAddPolicy"
] | [((394, 414), 'paramiko.SSHClient', 'paramiko.SSHClient', ([], {}), '()\n', (412, 414), False, 'import paramiko\n'), ((452, 476), 'paramiko.AutoAddPolicy', 'paramiko.AutoAddPolicy', ([], {}), '()\n', (474, 476), False, 'import paramiko\n')] |
# uses the full pipeline functions from patch_classification
# and does end-to-end detection using just the images as the input
# it needs the path to the input tif/png images as input and outputs the segmented grids
from __future__ import print_function
from __future__ import division
import os
import argparse as ... | [
"patch_classification.run_model.restore_model",
"os.path.exists",
"os.listdir",
"matplotlib.rcParams.update",
"matplotlib.pyplot.ylabel",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.path.join",
"patch_classification.png_to_pickle",
"matplotlib.pyplot.axis... | [((884, 916), 'os.path.join', 'os.path.join', (['save_dir', '"""images"""'], {}), "(save_dir, 'images')\n", (896, 916), False, 'import os\n'), ((934, 966), 'os.path.join', 'os.path.join', (['save_dir', '"""labels"""'], {}), "(save_dir, 'labels')\n", (946, 966), False, 'import os\n'), ((1115, 1161), 'patch_classificatio... |
import os
import numpy as np
import pickle
import time
from collections import deque
from mpi4py import MPI
import tensorflow as tf
from stable_baselines import logger
from stable_baselines.common import tf_util, SetVerbosity, TensorboardWriter
from stable_baselines import DDPG
from stable_baselines.common.buffers i... | [
"stable_baselines.common.math_util.scale_action",
"numpy.random.rand",
"stable_baselines.logger.record_tabular",
"stable_baselines.common.buffers.ReplayBuffer",
"mpi4py.MPI.COMM_WORLD.Get_size",
"numpy.array",
"tensorflow.RunMetadata",
"os.remove",
"os.path.exists",
"numpy.mean",
"collections.de... | [((3704, 3764), 'numpy.random.uniform', 'np.random.uniform', (['(-1.5)', '(1.5)', 'self.env.action_space.shape[0]'], {}), '(-1.5, 1.5, self.env.action_space.shape[0])\n', (3721, 3764), True, 'import numpy as np\n'), ((3814, 3839), 'mpi4py.MPI.COMM_WORLD.Get_rank', 'MPI.COMM_WORLD.Get_rank', ([], {}), '()\n', (3837, 383... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2018, Anaconda, Inc. and Intake contributors
# All rights reserved.
#
# The full license is in the LICENSE file, distributed with this software.
#------------------------------------------------------------------------... | [
"os.path.samefile",
"os.path.exists",
"posixpath.join",
"intake.utils.no_duplicate_yaml",
"os.makedirs",
"yaml.dump",
"os.path.dirname",
"pytest.mark.parametrize",
"shutil.copyfile",
"yaml.safe_load",
"intake.utils.make_path_posix"
] | [((810, 881), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""path"""', "['~/fake.file', 'https://example.com']"], {}), "('path', ['~/fake.file', 'https://example.com'])\n", (833, 881), False, 'import pytest\n'), ((539, 560), 'intake.utils.make_path_posix', 'make_path_posix', (['path'], {}), '(path)\n', (55... |
__author__ = '<NAME>'
from hzclient.clientmessage import ClientMessage
from hzclient.clientmessage import AuthenticationMessage
import unittest,ctypes
class ClientMessageTests(unittest.TestCase):
def testHeaderNormal(self):
msg=ClientMessage()
self.assertEqual(len(msg.encodeMessage()),msg.FRAME_S... | [
"hzclient.clientmessage.ClientMessage.decodeMessage",
"ctypes.c_uint32",
"ctypes.c_int32",
"ctypes.c_uint16",
"hzclient.clientmessage.AuthenticationMessage.decodeMessage",
"unittest.main",
"hzclient.clientmessage.AuthenticationMessage",
"ctypes.c_uint8",
"hzclient.clientmessage.ClientMessage"
] | [((4746, 4761), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4759, 4761), False, 'import unittest, ctypes\n'), ((243, 258), 'hzclient.clientmessage.ClientMessage', 'ClientMessage', ([], {}), '()\n', (256, 258), False, 'from hzclient.clientmessage import ClientMessage\n'), ((366, 381), 'hzclient.clientmessage.Cl... |
import numpy as np
import os,sys,time
import torch
import torch.nn.functional as torch_F
from easydict import EasyDict as edict
from . import base
import camera
import util
# ============================ main engine for training and evaluation ============================
class Model(base.Model):
def __init__(s... | [
"camera.get_3D_points_from_depth",
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torch.nn.Sequential",
"torch.nn.LSTMCell",
"camera.get_depth_from_3D_points",
"easydict.EasyDict",
"torch.arange",
"util.get_layer_dims",
"torch.nn.Linear",
"camera.get_center_and_ray",
"torch.empty",
"torch.cat"
] | [((1414, 1435), 'torch.nn.ModuleList', 'torch.nn.ModuleList', ([], {}), '()\n', (1433, 1435), False, 'import torch\n'), ((1821, 1848), 'util.get_layer_dims', 'util.get_layer_dims', (['layers'], {}), '(layers)\n', (1840, 1848), False, 'import util\n'), ((2592, 2634), 'util.get_layer_dims', 'util.get_layer_dims', (['opt.... |
import random
import pandas as pd
import numpy as np
def intermediate_model():
# Reading entire grid cells.
df = pd.read_csv('..\\cells_ny.csv')
# storing individual columns
cell_ids = df['cell_id']
cell_names = df['cell_names']
max_row = 0
max_col = 0
# getting max row and column
... | [
"numpy.array",
"random.choice",
"random.shuffle",
"pandas.read_csv"
] | [((123, 154), 'pandas.read_csv', 'pd.read_csv', (['"""..\\\\cells_ny.csv"""'], {}), "('..\\\\cells_ny.csv')\n", (134, 154), True, 'import pandas as pd\n'), ((670, 688), 'numpy.array', 'np.array', (['cell_ids'], {}), '(cell_ids)\n', (678, 688), True, 'import numpy as np\n'), ((3080, 3102), 'random.choice', 'random.choic... |
"""
coral_mostoel - environment
@author: <NAME>
@contributor: <NAME>
"""
from datetime import datetime
from pathlib import Path
from typing import Iterable, Optional, Union
import numpy as np
import pandas as pd
from pydantic import validator
from src.core.base_model import BaseModel
EnvInputAttr = Union[pd.DataFr... | [
"pandas.read_csv",
"pydantic.validator",
"pathlib.Path",
"pandas.DateOffset",
"pandas.date_range",
"pandas.DataFrame",
"pandas.to_datetime"
] | [((644, 721), 'pydantic.validator', 'validator', (['"""light"""', '"""light_attenuation"""', '"""temperature"""', '"""aragonite"""'], {'pre': '(True)'}), "('light', 'light_attenuation', 'temperature', 'aragonite', pre=True)\n", (653, 721), False, 'from pydantic import validator\n'), ((2225, 2262), 'pydantic.validator',... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@author: liangjie02
@file: crawl_thread.py.py
@time: 2019-06-30 10:00
"""
import time
import threading
from spider import webpage_downloador
from spider import webpage_parse
from spider import log
logger = log.logger
# logger = log.init_log("./log/mini_spider",
# ... | [
"threading.Event",
"spider.webpage_parse.WebpageParse",
"spider.webpage_downloador.WebpageDownloador",
"time.sleep"
] | [((984, 1001), 'threading.Event', 'threading.Event', ([], {}), '()\n', (999, 1001), False, 'import threading\n'), ((1197, 1253), 'spider.webpage_downloador.WebpageDownloador', 'webpage_downloador.WebpageDownloador', (['self.crawl_timeout'], {}), '(self.crawl_timeout)\n', (1233, 1253), False, 'from spider import webpage... |
#!/usr/bin/python2
import sys
import os
import nibabel as nib
import numpy as np
from nilearn.input_data import NiftiMasker
from scipy.stats import ttest_rel
from fg_constants import *
def load_cv_map(regressors, subj, masker):
img = os.path.join(MAPS_DIR, regressors, subj, 'corr_cv.nii.gz')
return masker.tr... | [
"nibabel.save",
"nibabel.load",
"os.path.join",
"scipy.stats.ttest_rel",
"numpy.vstack"
] | [((241, 299), 'os.path.join', 'os.path.join', (['MAPS_DIR', 'regressors', 'subj', '"""corr_cv.nii.gz"""'], {}), "(MAPS_DIR, regressors, subj, 'corr_cv.nii.gz')\n", (253, 299), False, 'import os\n'), ((522, 537), 'numpy.vstack', 'np.vstack', (['maps'], {}), '(maps)\n', (531, 537), True, 'import numpy as np\n'), ((870, 8... |
# coding: utf-8
"""
Python InsightVM API Client
OpenAPI spec version: 3
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class PolicyRule(object):
"""NOTE: This class is auto generated by the swagger code ge... | [
"six.iteritems"
] | [((11025, 11058), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (11038, 11058), False, 'import six\n')] |
import glob
import numpy as np
import pandas as pd
from collections import OrderedDict
#from . import metrics
import metrics
from .csv_reader import csv_node
__all__ = ['tune_threshold',
'assemble_node',
'assemble_dev_threshold',
'metric_reading',
'Ensemble']
def tune_thres... | [
"numpy.mean",
"collections.OrderedDict",
"numpy.arange",
"numpy.round",
"numpy.array",
"metrics.classification_summary",
"numpy.std",
"pandas.DataFrame",
"glob.glob"
] | [((453, 477), 'numpy.arange', 'np.arange', (['(0.01)', '(1)', '(0.01)'], {}), '(0.01, 1, 0.01)\n', (462, 477), True, 'import numpy as np\n'), ((1194, 1210), 'numpy.array', 'np.array', (['probas'], {}), '(probas)\n', (1202, 1210), True, 'import numpy as np\n'), ((574, 629), 'numpy.array', 'np.array', (['[(1 if p > thres... |
import mbuild as mb
from mbuild.lib.moieties import CH2
from mbuild.lib.moieties import CH3
class Alkane(mb.Compound):
"""An alkane which may optionally end with a hydrogen or a Port."""
def __init__(self, n=3, cap_front=True, cap_end=True):
"""Initialize an Alkane Compound.
Args:
... | [
"mbuild.lib.moieties.CH2",
"mbuild.force_overlap",
"mbuild.lib.moieties.CH3"
] | [((809, 814), 'mbuild.lib.moieties.CH2', 'CH2', ([], {}), '()\n', (812, 814), False, 'from mbuild.lib.moieties import CH2\n'), ((963, 1086), 'mbuild.force_overlap', 'mb.force_overlap', ([], {'move_this': "self['chain']", 'from_positions': "self['chain']['up']", 'to_positions': "self['methyl_front']['up']"}), "(move_thi... |
from django.test import TestCase
from trimet_stop_event_api.models import TrimetStopEvents, TotalOnsByHour, DisturbanceStops
from rest_framework.test import APIClient, RequestsClient
class TrimetStopEventsTest(TestCase):
""" Test for Crash model """
def setUp(self):
pass
class TrimetStopEventsListEnd... | [
"rest_framework.test.APIClient"
] | [((389, 400), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (398, 400), False, 'from rest_framework.test import APIClient, RequestsClient\n'), ((981, 992), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (990, 992), False, 'from rest_framework.test import APIClient, RequestsClient\n')] |
# Training a Dueling Double DQN agent to play break-out
import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import utils
import gym
import numpy as np
from gym.core import ObservationWrapper
from gym.spaces import Box
import cv2
import os
import atari_wrappers # adju... | [
"torch.nn.ReLU",
"replay_buffer.ReplayBuffer",
"torch.cuda.is_available",
"gym.make",
"utils.linear_decay",
"numpy.mean",
"os.path.exists",
"numpy.where",
"numpy.max",
"atari_wrappers.MaxAndSkipEnv",
"atari_wrappers.FireResetEnv",
"numpy.random.choice",
"atari_wrappers.ClipRewardEnv",
"ata... | [((496, 514), 'gym.make', 'gym.make', (['ENV_NAME'], {}), '(ENV_NAME)\n', (504, 514), False, 'import gym\n'), ((11607, 11628), 'replay_buffer.ReplayBuffer', 'ReplayBuffer', (['(10 ** 4)'], {}), '(10 ** 4)\n', (11619, 11628), False, 'from replay_buffer import ReplayBuffer\n'), ((2128, 2169), 'atari_wrappers.MaxAndSkipEn... |
from flask import Flask, request
from flask import render_template
import numpy as np
import pickle
import os
import matplotlib.pyplot as plt
app = Flask(__name__)
## function to check whether board is its terminal state
def check_winner(game):
winner = ''
checkfor = [[0, 1, 2], [3, 4, 5], [6, 7, 8], [0, 3, 6... | [
"flask.render_template",
"pickle.dump",
"flask.Flask",
"pickle.load",
"flask.request.form.get",
"numpy.zeros",
"numpy.random.uniform"
] | [((149, 164), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (154, 164), False, 'from flask import Flask, request\n'), ((7943, 7976), 'flask.render_template', 'render_template', (['"""tictactoe.html"""'], {}), "('tictactoe.html')\n", (7958, 7976), False, 'from flask import render_template\n'), ((8075, 8105... |
from simupy.block_diagram import BlockDiagram
import simupy_flight
import numpy as np
from nesc_testcase_helper import plot_nesc_comparisons, int_opts, benchmark
from nesc_testcase_helper import ft_per_m, kg_per_slug
Ixx = 3.6*kg_per_slug/(ft_per_m**2) #slug-ft2
Iyy = 3.6*kg_per_slug/(ft_per_m**2) #slug-ft2
Izz = 3.6... | [
"simupy_flight.get_constant_aero",
"simupy.block_diagram.BlockDiagram",
"simupy_flight.get_constant_winds",
"nesc_testcase_helper.benchmark",
"nesc_testcase_helper.plot_nesc_comparisons",
"simupy_flight.Planetodetic",
"numpy.arange"
] | [((1585, 1614), 'simupy.block_diagram.BlockDiagram', 'BlockDiagram', (['planet', 'vehicle'], {}), '(planet, vehicle)\n', (1597, 1614), False, 'from simupy.block_diagram import BlockDiagram\n'), ((2179, 2211), 'nesc_testcase_helper.plot_nesc_comparisons', 'plot_nesc_comparisons', (['res', '"""10"""'], {}), "(res, '10')\... |
#!/usr/bin/python
#------------------------------------------------------------------------------
# Name: plotUpperLimits.py
# Author: <NAME>, 20150212
# Last Modified: 20150212
#This is to read upper limits files and plot them so another Python script
# createHTML.py, can display them at the end of... | [
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"math.pow",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"numpy.array",
"matplotlib.pyplot.figure",
"os.path.isdir",
"matplotlib.pyplot.yticks",
"os.mkdir",
"... | [((583, 597), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (590, 597), True, 'import matplotlib as mpl\n'), ((1851, 1890), 'os.path.isfile', 'os.path.isfile', (['"""upper_limit_bands.xml"""'], {}), "('upper_limit_bands.xml')\n", (1865, 1890), False, 'import os\n'), ((2319, 2334), 'numpy.array', 'np.ar... |
from examples.wmt_2020.common.util.download import download_from_google_drive
from examples.wmt_2020.ro_en.transformer_nmt_config import MODEL_TYPE, transformer_nmt_config, DRIVE_FILE_ID, \
MODEL_NAME, GOOGLE_DRIVE, TEMP_DIRECTORY, RESULT_FILE
from transquest.algo.transformers.run_model import QuestModel
import tor... | [
"os.path.exists",
"tarfile.open",
"os.makedirs",
"os.path.join",
"torch.cuda.is_available",
"examples.wmt_2020.common.util.download.download_from_google_drive"
] | [((808, 853), 'tarfile.open', 'tarfile.open', (['"""training_ro-en.tar.gz"""', '"""r:gz"""'], {}), "('training_ro-en.tar.gz', 'r:gz')\n", (820, 853), False, 'import tarfile\n'), ((379, 409), 'os.path.exists', 'os.path.exists', (['TEMP_DIRECTORY'], {}), '(TEMP_DIRECTORY)\n', (393, 409), False, 'import os\n'), ((415, 442... |
#!/usr/bin/env python3
import argparse
import json
from typing import Dict, List
import vlq
class Decoder:
def __init__(self) -> None:
self.line_delimiter = ";"
# Can specify rules on how the raw string could be decoded
# or inherit rules from this class.
def decode_int_value(self, ... | [
"json.load",
"vlq.base64vlq_decode",
"argparse.ArgumentParser"
] | [((2875, 2973), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Python script to parse and decode a source map in TEAL"""'}), "(description=\n 'Python script to parse and decode a source map in TEAL')\n", (2898, 2973), False, 'import argparse\n'), ((364, 391), 'vlq.base64vlq_decode', '... |
# Siconos solvers
import siconos.numerics as sn
# fclib interface
import siconos.fclib as fcl
# h5py
import h5py
import numpy as np
import scipy.linalg as la
# --- Create a friction contact problem ---
# Case 1 : from scratch
# Number of contacts
nc = 3
# W matrix
w_shape = (3 * nc, 3 * nc)
W = np.zeros(w_shape, dty... | [
"siconos.numerics.FrictionContactProblem",
"siconos.numerics.fc3d_driver",
"siconos.numerics.SolverOptions",
"numpy.zeros",
"numpy.finfo",
"numpy.zeros_like"
] | [((299, 334), 'numpy.zeros', 'np.zeros', (['w_shape'], {'dtype': 'np.float64'}), '(w_shape, dtype=np.float64)\n', (307, 334), True, 'import numpy as np\n'), ((610, 644), 'numpy.zeros', 'np.zeros', (['(3 * nc)'], {'dtype': 'np.float64'}), '(3 * nc, dtype=np.float64)\n', (618, 644), True, 'import numpy as np\n'), ((732, ... |
# -----------------------------------------------------------------------------
#
# Copyright 2013-2019 lispers.net - <NAME> <<EMAIL>>
#
# 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 Licen... | [
"lisp.lisp_ipv6_input",
"lisp.lisp_glean_map_cache",
"lispconfig.lisp_itr_rtr_show_command",
"lisp.lisp_is_macos",
"binascii.hexlify",
"lisp.lisp_print_banner",
"lispconfig.lisp_show_crypto_list",
"lisp.lisp_reassemble",
"lispconfig.lisp_xtr_command",
"lispconfig.lisp_itr_rtr_show_rloc_probe_comma... | [((1540, 1570), 'lisp.lisp_get_ephemeral_port', 'lisp.lisp_get_ephemeral_port', ([], {}), '()\n', (1568, 1570), False, 'import lisp\n'), ((16919, 16967), 'lisp.lisp_address', 'lisp.lisp_address', (['lisp.LISP_AFI_IPV4', '""""""', '(32)', '(0)'], {}), "(lisp.LISP_AFI_IPV4, '', 32, 0)\n", (16936, 16967), False, 'import l... |
# Standard library imports
from pprint import pprint
# Local application imports
from gym_snape.game import Game
from gym_snape.game.pets import Pet
from gym_snape.game.food import Food
# Third-party imports
import gym
from gym import spaces
import numpy as np
class Snape(gym.Env):
metadata = {'render.modes': [... | [
"gym_snape.game.Game",
"numpy.iinfo",
"gym.spaces.Discrete",
"pprint.pprint"
] | [((461, 482), 'gym_snape.game.Game', 'Game', ([], {'display': 'display'}), '(display=display)\n', (465, 482), False, 'from gym_snape.game import Game\n'), ((2785, 2826), 'gym.spaces.Discrete', 'spaces.Discrete', (['(self.end_turn_action + 1)'], {}), '(self.end_turn_action + 1)\n', (2800, 2826), False, 'from gym import ... |
# -*- encoding: utf-8 -*-
import os
import sys
import shutil
from django.core.management import BaseCommand
from django.db import transaction
from bpp.reports.opi_2012 import make_report_zipfile
class Command(BaseCommand):
help = 'Eksportuje raporty OPI 2009-2012'
@transaction.atomic
def handle(self, *... | [
"bpp.reports.opi_2012.make_report_zipfile",
"os.getenv"
] | [((402, 440), 'bpp.reports.opi_2012.make_report_zipfile', 'make_report_zipfile', ([], {'wydzialy': 'wydzialy'}), '(wydzialy=wydzialy)\n', (421, 440), False, 'from bpp.reports.opi_2012 import make_report_zipfile\n'), ((557, 581), 'os.getenv', 'os.getenv', (['"""USERPROFILE"""'], {}), "('USERPROFILE')\n", (566, 581), Fal... |
# Licensed under the Unlicense (http://unlicense.org)
# Made by <EMAIL>
# Chat Program
import socket
import threading
# Config
MODE = "SERVER" # Modes can either be SERVER or CLIENT
HOST = "" # Symbolic name meaning all available interfaces
PORT = 1337 # Arbitrary non-privileged port... | [
"threading.Thread",
"socket.socket"
] | [((1880, 1909), 'threading.Thread', 'threading.Thread', ([], {'target': 'recv'}), '(target=recv)\n', (1896, 1909), False, 'import threading\n'), ((1932, 1961), 'threading.Thread', 'threading.Thread', ([], {'target': 'send'}), '(target=send)\n', (1948, 1961), False, 'import threading\n'), ((867, 916), 'socket.socket', '... |
from django.contrib import admin
from .models import (
Account,
AccountEvent,
Exchange,
ExchangeIdentifier,
Position,
Asset,
Transaction,
TransactionImport,
TransactionImportRecord,
EventImportRecord,
)
admin.site.register(Account)
admin.site.register(AccountEvent)
admin.site.r... | [
"django.contrib.admin.site.register"
] | [((245, 273), 'django.contrib.admin.site.register', 'admin.site.register', (['Account'], {}), '(Account)\n', (264, 273), False, 'from django.contrib import admin\n'), ((274, 307), 'django.contrib.admin.site.register', 'admin.site.register', (['AccountEvent'], {}), '(AccountEvent)\n', (293, 307), False, 'from django.con... |
from __future__ import print_function
import subprocess
import tempfile
import numpy as np
import warnings
import astropy.units as u
_quantity = u.Quantity
from collections import defaultdict
import os
import sys
from . import utils
from . import synthspec
from .utils import QuantityOff,ImmutableDict,unitless,grouper
... | [
"numpy.array",
"os.path.exists",
"numpy.where",
"numpy.exp",
"astropy.units.brightness_temperature",
"subprocess.call",
"tempfile.NamedTemporaryFile",
"warnings.warn",
"os.path.expanduser",
"astropy.log.warn",
"numpy.abs",
"numpy.allclose",
"numpy.any",
"os.getenv",
"collections.defaultd... | [((1695, 1772), 'warnings.warn', 'warnings.warn', (['"""pyradex is deprecated: Use pyradex.Radex instead if you can."""'], {}), "('pyradex is deprecated: Use pyradex.Radex instead if you can.')\n", (1708, 1772), False, 'import warnings\n'), ((3675, 3736), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([... |
from Calculator.addition import addition
from Calculator.subtraction import subtraction
from Calculator.multiplication import multiplication
from Calculator.division import division
from Calculator.square import square
from Calculator.squareroot import squareroot
class Calculator:
result = 0
def __init__(sel... | [
"Calculator.multiplication.multiplication",
"Calculator.addition.addition",
"Calculator.division.division",
"Calculator.subtraction.subtraction",
"Calculator.squareroot.squareroot",
"Calculator.square.square"
] | [((385, 399), 'Calculator.addition.addition', 'addition', (['a', 'b'], {}), '(a, b)\n', (393, 399), False, 'from Calculator.addition import addition\n'), ((480, 497), 'Calculator.subtraction.subtraction', 'subtraction', (['a', 'b'], {}), '(a, b)\n', (491, 497), False, 'from Calculator.subtraction import subtraction\n')... |
"""
Building
========
The building module contains functions related to building acoustics.
"""
from __future__ import division
import numpy as np
#from acoustics.utils import w
def rw_curve(tl):
"""
Calculate the curve of :math:`Rw` from a NumPy array `tl` with third
octave data between 100 Hz and 3.... | [
"numpy.log10",
"numpy.any",
"numpy.array",
"numpy.deg2rad",
"numpy.sum",
"numpy.cos",
"numpy.min"
] | [((395, 465), 'numpy.array', 'np.array', (['[0, 3, 6, 9, 12, 15, 18, 19, 20, 21, 22, 23, 23, 23, 23, 23]'], {}), '([0, 3, 6, 9, 12, 15, 18, 19, 20, 21, 22, 23, 23, 23, 23, 23])\n', (403, 465), True, 'import numpy as np\n'), ((1078, 1167), 'numpy.array', 'np.array', (['[-29, -26, -23, -21, -19, -17, -15, -13, -12, -11, ... |
from datetime import datetime, timedelta, timezone
def utc_now() -> datetime:
return datetime.now(timezone.utc)
def datetime_dump(dt: datetime) -> str:
return str(dt.timestamp())
def datetime_load(raw: str) -> datetime:
return datetime.fromtimestamp(float(raw), timezone.utc)
def timedelta_dump(td: t... | [
"datetime.datetime.now"
] | [((91, 117), 'datetime.datetime.now', 'datetime.now', (['timezone.utc'], {}), '(timezone.utc)\n', (103, 117), False, 'from datetime import datetime, timedelta, timezone\n')] |
from django.db import models
from datetime import datetime
# Create your models here.
class Images(models.Model):
CATEGORY_TYPE = (
(100, "班级头像"),
(101, "班级logo"),
(200, "活动"),
)
image = models.ImageField(upload_to="", verbose_name="图片")
add_time = models.DateField(default=d... | [
"django.db.models.ImageField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((228, 278), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '""""""', 'verbose_name': '"""图片"""'}), "(upload_to='', verbose_name='图片')\n", (245, 278), False, 'from django.db import models\n'), ((294, 354), 'django.db.models.DateField', 'models.DateField', ([], {'default': 'datetime.now', 'verbo... |
import pandas
class Error(Exception):
pass
def file_read(path):
with open(path) as f:
contents = f.readlines()
return contents
def create_df(data):
df = pandas.DataFrame(data)
return df
def parse_csv(contents, separator=","):
contents = [c.replace("\n", "") for c in contents]
... | [
"pandas.DataFrame"
] | [((185, 207), 'pandas.DataFrame', 'pandas.DataFrame', (['data'], {}), '(data)\n', (201, 207), False, 'import pandas\n')] |
"""
Tests for CaseVersion admin.
"""
from mock import patch
from tests import case
class CaseVersionAdminTest(case.admin.AdminTestCase):
app_label = "library"
model_name = "caseversion"
def test_changelist(self):
"""CaseVersion changelist page loads without error, contains name."""
se... | [
"mock.patch",
"tests.case.versions.get"
] | [((1995, 2055), 'mock.patch', 'patch', (['"""moztrap.model.library.admin.CaseStepInline.extra"""', '(1)'], {}), "('moztrap.model.library.admin.CaseStepInline.extra', 1)\n", (2000, 2055), False, 'from mock import patch\n'), ((2846, 2906), 'mock.patch', 'patch', (['"""moztrap.model.library.admin.CaseStepInline.extra"""',... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: pogoprotos/networking/requests/social/delete_gift_from_inventory_message.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import mes... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((545, 571), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (569, 571), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1285, 1652), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""giftbox_id"""', 'fu... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: go.chromium.org/luci/buildbucket/proto/builder_service.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impor... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.MethodDescriptor",
"google.protobuf.descriptor.FileDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((459, 485), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (483, 485), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((730, 2100), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""go.chromium.org/luci/b... |
import six
import multiprocessing
import pytest
from .run_functions import log_observation, upload_artifact
from operator import itemgetter
from functools import partial
class TestConcurrency:
def test_multiple_runs_log_obs(self, client):
client.set_project()
client.set_experiment()
pool... | [
"operator.itemgetter",
"functools.partial",
"multiprocessing.Pool"
] | [((323, 347), 'multiprocessing.Pool', 'multiprocessing.Pool', (['(36)'], {}), '(36)\n', (343, 347), False, 'import multiprocessing\n'), ((834, 858), 'multiprocessing.Pool', 'multiprocessing.Pool', (['(36)'], {}), '(36)\n', (854, 858), False, 'import multiprocessing\n'), ((374, 406), 'functools.partial', 'partial', (['l... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from tdameritrade_ext.client import TDClient
import time
if __name__ == '__main__':
c = TDClient()
data = c.options('AAPL', fromDate=time.strftime("%Y-%m-%d"))
print(data)
| [
"tdameritrade_ext.client.TDClient",
"time.strftime"
] | [((203, 213), 'tdameritrade_ext.client.TDClient', 'TDClient', ([], {}), '()\n', (211, 213), False, 'from tdameritrade_ext.client import TDClient\n'), ((252, 277), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d"""'], {}), "('%Y-%m-%d')\n", (265, 277), False, 'import time\n')] |
#!/usr/bin/env python3
#
# system_rereg.py
#
# (c) 2018 SUSE Linux GmbH, Germany.
# GNU Public License. No warranty. No Support
#
# Version: 2020-06-30
#
# Created by: SUSE <NAME>
#
# This script will re-register a system against a proxy.
#
# Releases:
# 2019-12-11 M.Brookhuis - Initial release
# 2020-04-02 M.Brookhuis... | [
"os.path.exists",
"smtools.SMTools",
"argparse.ArgumentParser",
"time.sleep",
"datetime.datetime.now"
] | [((4285, 4424), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'RawTextHelpFormatter', 'description': '""" Usage:\n system_update.py \n """'}), '(formatter_class=RawTextHelpFormatter, description=\n """ Usage:\n system_update.py \n """... |
import numpy as np
from collections import defaultdict
from .loss import compute_rre, compute_rte
class Logger:
def __init__(self):
self.store = defaultdict(list)
def reset(self):
self.store = defaultdict(list)
def add(self, key, value):
self.store[key].append(valu... | [
"numpy.mean",
"numpy.max",
"numpy.sum",
"collections.defaultdict",
"numpy.min"
] | [((168, 185), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (179, 185), False, 'from collections import defaultdict\n'), ((232, 249), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (243, 249), False, 'from collections import defaultdict\n'), ((370, 394), 'numpy.mean', 'np.... |
## Main entrance for the universal energy management (UEMS).
# Documentation for the UMES.
# \author: <NAME>
# \mail: <EMAIL>
# \date: 20 November 2017
# The following packages are required to deploy UEMS
# 1) Python 3.6+
# 2) MySQL
# 3) Zeromq
# 4) APScheduler
# 5) Gurobi*(academic use only)
# 6) Mosek*(academic use ... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"modelling.dynamic_operation_pb2.local_sources",
"utils.Logger",
"apscheduler.schedulers.blocking.BlockingScheduler",
"modelling.information_exchange_pb2.informaiton_exchange",
"zmq.Context"
] | [((2098, 2126), 'utils.Logger', 'Logger', (['"""Universal_ems_main"""'], {}), "('Universal_ems_main')\n", (2104, 2126), False, 'from utils import Logger\n'), ((2256, 2289), 'sqlalchemy.create_engine', 'create_engine', (['db_str'], {'echo': '(False)'}), '(db_str, echo=False)\n', (2269, 2289), False, 'from sqlalchemy imp... |
"""MIT License
Copyright (c) 2019, <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... | [
"stuett.data.MHDSLRFilenames",
"numpy.abs",
"stuett.DirectoryStore",
"pathlib.Path",
"stuett.global_config.get_setting",
"io.BytesIO",
"stuett.ABSStore",
"stuett.global_config.setting_exists",
"numpy.array",
"torch.is_tensor",
"numpy.isnan",
"stuett.data.CsvSource",
"pandas.to_datetime"
] | [((4891, 4956), 'stuett.data.CsvSource', 'stuett.data.CsvSource', (['rock_temperature_file_mh10'], {'store': 'ts_store'}), '(rock_temperature_file_mh10, store=ts_store)\n', (4912, 4956), False, 'import stuett\n'), ((5060, 5113), 'stuett.data.CsvSource', 'stuett.data.CsvSource', (['radiation_file'], {'store': 'ts_store'... |
import singlelink as singlelink
import numpy as numpy
from matplotlib import pyplot
import pandas as pd
from sklearn.metrics import adjusted_rand_score
def main():
auxiliar = input(
"Qual o arquivo que deseja inserir?\n 1 = c2ds1-2sp\n 2 = c2ds3-2g\n 3 = monkey\n 4 = m\n")
if auxiliar == "1":
... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"sklearn.metrics.adjusted_rand_score",
"singlelink.singleLinkClustering",
"matplotlib.pyplot.scatter"
] | [((546, 573), 'pandas.read_csv', 'pd.read_csv', (['path'], {'sep': '"""\t"""'}), "(path, sep='\\t')\n", (557, 573), True, 'import pandas as pd\n'), ((676, 728), 'singlelink.singleLinkClustering', 'singlelink.singleLinkClustering', (['kMin', 'kMax', 'data', 'p'], {}), '(kMin, kMax, data, p)\n', (707, 728), True, 'import... |
import unittest
from expand_region_handler import *
class UndoRedoTest(unittest.TestCase):
def test_dont_crash_with_blank_json (self):
settingsJson = ''
newSettingsJson = add_to_stack(settingsJson, "teststring", 2, 3, 1, 1);
newSettings = json.loads(newSettingsJson)
self.assertEqual(newSettings.get... | [
"unittest.main"
] | [((6574, 6589), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6587, 6589), False, 'import unittest\n')] |
import numpy as np
import torch
import math
def TLift(in_score, gal_cam_id, gal_time, prob_cam_id, prob_time, num_cams, tau=100, sigma=200, K=10, alpha=0.2):
"""Function for the Temporal Lifting (TLift) method
TLift is a model-free temporal cooccurrence based score weighting method proposed in
<NAME> and ... | [
"numpy.where",
"math.pow",
"numpy.sort",
"numpy.zeros_like",
"torch.pow",
"numpy.random.randint",
"torch.cuda.is_available",
"numpy.transpose",
"numpy.random.randn"
] | [((2196, 2221), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (2219, 2221), False, 'import torch\n'), ((4259, 4283), 'numpy.random.randn', 'np.random.randn', (['(50)', '(100)'], {}), '(50, 100)\n', (4274, 4283), True, 'import numpy as np\n'), ((4301, 4329), 'numpy.random.randint', 'np.random.r... |
from .coord_transform import CoordTransform
class Cylindrical2Cartesian(CoordTransform):
def __init__(self, syms=None):
from sympy import symbols, cos, sin
if syms is None:
syms = (symbols('R', positive=True), *symbols('Z, phi', real=True))
R, Z, phi = syms[0], syms[1], syms[2]
... | [
"sympy.sin",
"sympy.cos",
"sympy.sqrt",
"sympy.symbols",
"sympy.atan2"
] | [((565, 594), 'sympy.symbols', 'symbols', (['"""x, y, z"""'], {'real': '(True)'}), "('x, y, z', real=True)\n", (572, 594), False, 'from sympy import symbols, sqrt, atan2\n'), ((214, 241), 'sympy.symbols', 'symbols', (['"""R"""'], {'positive': '(True)'}), "('R', positive=True)\n", (221, 241), False, 'from sympy import s... |
import numbers
import pytest
from ddd import Attr, ValueObject, Entity
class TestValueObject:
def test_correct_instantiation(self):
class AVO(ValueObject):
a = Attr()
b = Attr()
c = Attr()
d = Attr()
e = Attr()
f = Attr()
... | [
"ddd.Attr",
"pytest.raises"
] | [((188, 194), 'ddd.Attr', 'Attr', ([], {}), '()\n', (192, 194), False, 'from ddd import Attr, ValueObject, Entity\n'), ((211, 217), 'ddd.Attr', 'Attr', ([], {}), '()\n', (215, 217), False, 'from ddd import Attr, ValueObject, Entity\n'), ((234, 240), 'ddd.Attr', 'Attr', ([], {}), '()\n', (238, 240), False, 'from ddd imp... |
import itertools
from typing import List, Tuple
from hit_analysis.commons.classify import classify_by_lambda
from hit_analysis.commons.consts import X, Y, ARTIFACT_NEAR_HOT_PIXEL2
from hit_analysis.commons.utils import point_to_point_distance, get_and_set
def near_hot_pixel2(detections: List[dict], often: int = 3, d... | [
"hit_analysis.commons.utils.get_and_set",
"itertools.combinations_with_replacement",
"hit_analysis.commons.utils.point_to_point_distance"
] | [((1728, 1782), 'itertools.combinations_with_replacement', 'itertools.combinations_with_replacement', (['detections', '(2)'], {}), '(detections, 2)\n', (1767, 1782), False, 'import itertools\n'), ((1910, 1953), 'hit_analysis.commons.utils.get_and_set', 'get_and_set', (['d', 'ARTIFACT_NEAR_HOT_PIXEL2', '(0)'], {}), '(d,... |
import os
import sys
import spacy
import string
import json
import numpy as np
from Levenshtein import distance
from collections import defaultdict
from argparse import ArgumentParser
def lev_dist(source, target):
if source == target:
return 0
# Prepare a matrix
slen, tlen = len(source), len(targ... | [
"json.loads",
"argparse.ArgumentParser",
"json.dumps",
"Levenshtein.distance",
"collections.defaultdict",
"sys.stdout.flush",
"sys.stdout.write"
] | [((6942, 6964), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (6958, 6964), False, 'import sys\n'), ((7056, 7073), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (7067, 7073), False, 'from collections import defaultdict\n'), ((7345, 7361), 'argparse.ArgumentParser', 'Ar... |
#!/usr/bin/env python
# coding:utf-8
import time
import serial
import struct
from RS30X.RS30X import RS304MD as RS30X
if __name__ == '__main__':
rs = RS30X()
for i in range(1,6):
rs.setTorque(i, True)
time.sleep(0.1)
for i in range(1,6):
rs.setAngleInTime(i, 0, 1)
time.sleep... | [
"RS30X.RS30X.RS304MD",
"time.sleep"
] | [((156, 163), 'RS30X.RS30X.RS304MD', 'RS30X', ([], {}), '()\n', (161, 163), True, 'from RS30X.RS30X import RS304MD as RS30X\n'), ((310, 323), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (320, 323), False, 'import time\n'), ((228, 243), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (238, 243), False, '... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016-2022 by University of Kassel and Fraunhofer Institute for Energy Economics
# and Energy System Technology (IEE), Kassel. All rights reserved.
import pytest
import gc
import copy
import numpy as np
import pandas as pd
try:
import geopandas as gpd
import shapely.geo... | [
"pandas.isnull",
"pandas.DataFrame",
"pandapower.create_empty_network",
"pandapower.control.ConstControl",
"pandapower.toolbox.get_gc_objects_dict",
"pandas.Int64Dtype",
"pandapower.auxiliary.get_indices",
"pytest.main",
"numpy.array_equal",
"pytest.raises",
"gc.collect",
"copy.deepcopy",
"p... | [((1568, 1619), 'pandapower.auxiliary.get_indices', 'get_indices', (['[102, 107]', 'lookup'], {'fused_indices': '(True)'}), '([102, 107], lookup, fused_indices=True)\n', (1579, 1619), False, 'from pandapower.auxiliary import get_indices\n'), ((1631, 1661), 'numpy.array_equal', 'np.array_equal', (['result', '[2, 7]'], {... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 KuraLabs S.R.L
#
# 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 applicabl... | [
"logging.getLogger",
"pprintpp.pformat"
] | [((791, 810), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (800, 810), False, 'from logging import getLogger\n'), ((2550, 2565), 'pprintpp.pformat', 'pformat', (['values'], {}), '(values)\n', (2557, 2565), False, 'from pprintpp import pformat\n'), ((2698, 2715), 'pprintpp.pformat', 'pformat', (... |
from datetime import datetime
import logging
import json
import requests
from will import settings
from will.utils import Bunch
logger = logging.getLogger(__name__)
V1_TOKEN_URL = "https://%(server)s/v1/rooms/list?auth_token=%(token)s"
V2_TOKEN_URL = "https://%(server)s/v2/room?auth_token=%(token)s&expand=items"
... | [
"logging.getLogger",
"json.loads",
"datetime.datetime.strptime",
"requests.get"
] | [((140, 167), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (157, 167), False, 'import logging\n'), ((979, 1004), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (989, 1004), False, 'import json\n'), ((1067, 1125), 'datetime.datetime.strptime', 'datetime.strptim... |
#!/usr/bin/env python3
# Copyright 2019 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
"logging.basicConfig",
"common.generate_bb_testdata",
"simplediskimage.DiskImage"
] | [((694, 734), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (713, 734), False, 'import logging\n'), ((777, 799), 'common.generate_bb_testdata', 'generate_bb_testdata', ([], {}), '()\n', (797, 799), False, 'from common import generate_bb_testdata\n'), ((832, 9... |
import pytest
from allennlp.data.dataset_readers import TextClassificationJsonReader
from allennlp.common.util import ensure_list
from allennlp.common.testing import AllenNlpTestCase
class TestTextClassificationJsonReader:
@pytest.mark.parametrize("lazy", (True, False))
def test_set_skip_indexing_true(self, ... | [
"pytest.mark.skip",
"pytest.mark.parametrize",
"pytest.raises",
"allennlp.common.util.ensure_list",
"allennlp.data.dataset_readers.TextClassificationJsonReader"
] | [((231, 277), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lazy"""', '(True, False)'], {}), "('lazy', (True, False))\n", (254, 277), False, 'import pytest\n'), ((1615, 1661), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""lazy"""', '(True, False)'], {}), "('lazy', (True, False))\n", (1638, 1... |
import pytest
from streamsets.testframework.decorators import stub
@stub
def test_admin_operation_timeout_in_milliseconds(sdc_builder, sdc_executor):
pass
@stub
@pytest.mark.parametrize('stage_attributes', [{'change_log_format': 'MSSQL'},
{'change_log_format': 'Mon... | [
"pytest.mark.parametrize"
] | [((171, 404), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""stage_attributes"""', "[{'change_log_format': 'MSSQL'}, {'change_log_format': 'MongoDBOpLog'}, {\n 'change_log_format': 'MySQLBinLog'}, {'change_log_format': 'NONE'}, {\n 'change_log_format': 'OracleCDC'}]"], {}), "('stage_attributes', [{'c... |
# template matching
import cv2
import numpy as np
from scipy import signal
from pprint import pprint
from matplotlib import pyplot as plt
def show_img(title, img):
cv2.namedWindow(f"{title}", cv2.WINDOW_NORMAL)
cv2.imshow(f"{title}", img)
cv2.waitKey(0)
# 需要處理成透明背景 應該就可以找到對的物體進行辨識
path1 = "... | [
"cv2.rectangle",
"cv2.imwrite",
"cv2.namedWindow",
"cv2.normalize",
"numpy.sqrt",
"numpy.where",
"cv2.imshow",
"cv2.minMaxLoc",
"cv2.waitKey",
"cv2.matchTemplate",
"cv2.imread",
"numpy.float32"
] | [((362, 382), 'cv2.imread', 'cv2.imread', (['path1', '(0)'], {}), '(path1, 0)\n', (372, 382), False, 'import cv2\n'), ((397, 417), 'cv2.imread', 'cv2.imread', (['path2', '(0)'], {}), '(path2, 0)\n', (407, 417), False, 'import cv2\n'), ((476, 506), 'numpy.where', 'np.where', (['(template > 0)', '(100)', '(0)'], {}), '(t... |
import xmlrpc.client as xc
# only one api server so we'll use the deutschland mirror for downloading
client = xc.ServerProxy('https://pypi.python.org/pypi')
packages = client.list_packages()
import os
import tarfile, re, requests, csv, json
from base64 import b64encode
from IPython.utils.path import ensure_dir_exists... | [
"tarfile.open",
"IPython.utils.path.ensure_dir_exists",
"requests.get",
"xmlrpc.client.ServerProxy",
"json.dump"
] | [((110, 156), 'xmlrpc.client.ServerProxy', 'xc.ServerProxy', (['"""https://pypi.python.org/pypi"""'], {}), "('https://pypi.python.org/pypi')\n", (124, 156), True, 'import xmlrpc.client as xc\n'), ((1801, 1830), 'IPython.utils.path.ensure_dir_exists', 'ensure_dir_exists', (['"""packages"""'], {}), "('packages')\n", (181... |
# Copyright (c) 2021, Technische Universität Kaiserslautern (TUK) & National University of Sciences and Technology (NUST).
# All rights reserved.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import print_function
from __fut... | [
"os.path.exists",
"torchnet.meter.ConfusionMeter",
"torch.device",
"sklearn.metrics.classification_report",
"torch.Tensor",
"os.path.join",
"dataset.get_dataloaders_generated_data",
"matplotlib.colors.ListedColormap",
"torch.argmax",
"numpy.array",
"numpy.asarray",
"collections.defaultdict",
... | [((800, 825), 'matplotlib.pyplot.switch_backend', 'plt.switch_backend', (['"""agg"""'], {}), "('agg')\n", (818, 825), True, 'import matplotlib.pyplot as plt\n'), ((6495, 6510), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6508, 6510), False, 'import torch\n'), ((14746, 14761), 'torch.no_grad', 'torch.no_grad', ... |
from pathlib import Path
from fhir.resources.codesystem import CodeSystem
from oops_fhir.utils import CodeSystemConcept
__all__ = ["AssertionDirectionType"]
_resource = CodeSystem.parse_file(Path(__file__).with_suffix(".json"))
class AssertionDirectionType:
"""
AssertionDirectionType
The type of dir... | [
"oops_fhir.utils.CodeSystemConcept",
"pathlib.Path"
] | [((477, 635), 'oops_fhir.utils.CodeSystemConcept', 'CodeSystemConcept', (["{'code': 'response', 'definition':\n 'The assertion is evaluated on the response. This is the default value.',\n 'display': 'response'}"], {}), "({'code': 'response', 'definition':\n 'The assertion is evaluated on the response. This is ... |
import datetime
import random
import threading
import time
from selenium import webdriver
from selenium.common.exceptions import TimeoutException, WebDriverException
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.ui import WebDrive... | [
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.support.expected_conditions.presence_of_all_elements_located",
"selenium.webdriver.Firefox",
"time.sleep",
"datetime.datetime.now",
"threading.Thread",
"random.random"
] | [((523, 542), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (540, 542), False, 'from selenium import webdriver\n'), ((704, 719), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (714, 719), False, 'import time\n'), ((795, 810), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (805, ... |
from django.shortcuts import render,redirect,HttpResponse
# used for user authentication
from .forms import CreateUserForm
from django.contrib.auth import authenticate,login,logout
from django.contrib import messages
#restricting site
from django.contrib.auth.decorators import login_required
from .decorator import al... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"django.shortcuts.HttpResponse",
"django.contrib.auth.login",
"django.contrib.messages.info",
"django.shortcuts.redirect",
"django.contrib.auth.decorators.login_required",
"django.contrib.auth.logout"
] | [((888, 920), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_url': '"""home"""'}), "(login_url='home')\n", (902, 920), False, 'from django.contrib.auth.decorators import login_required\n'), ((2285, 2317), 'django.contrib.auth.decorators.login_required', 'login_required', ([], {'login_ur... |
from datetime import datetime
ADMIN_ROLE = "SpellBot Admin"
CREATE_ENDPOINT = "https://us-central1-magic-night-30324.cloudfunctions.net/createGame"
THUMB_URL = (
"https://raw.githubusercontent.com/lexicalunit/spellbot/master/spellbot.png"
f"?{datetime.today().strftime('%Y-%m-%d')}" # workaround over-eager cac... | [
"datetime.datetime.today"
] | [((252, 268), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (266, 268), False, 'from datetime import datetime\n')] |
from bs4 import BeautifulSoup
from chp1.advanced_link_crawler import download
broken_html = '<ul class=country_or_district><li>Area<li>Population</ul>'
soup = BeautifulSoup(broken_html, 'html.parser')
fixed_html = soup.prettify()
print(fixed_html)
# still broken, so try a different parser
soup = BeautifulSoup(broke... | [
"bs4.BeautifulSoup"
] | [((161, 202), 'bs4.BeautifulSoup', 'BeautifulSoup', (['broken_html', '"""html.parser"""'], {}), "(broken_html, 'html.parser')\n", (174, 202), False, 'from bs4 import BeautifulSoup\n'), ((301, 339), 'bs4.BeautifulSoup', 'BeautifulSoup', (['broken_html', '"""html5lib"""'], {}), "(broken_html, 'html5lib')\n", (314, 339), ... |
#!/usr/bin/env python
#############################################################################
##
## Copyright (C) 2013 Riverbank Computing Limited.
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
##
## This file is part of the examples of PyQt.
##
## $QT_BEGIN_LICENS... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextBrowser",
"PyQt5.QtCore.QDate.longMonthName",
"PyQt5.QtCore.QDate.longDayName",
"PyQt5.QtWidgets.QSpinBox",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtCore.QDate.currentDate",
"PyQt5.QtGui.QColor",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtGui.QTextLength"... | [((6946, 6968), 'PyQt5.QtWidgets.QApplication', 'QApplication', (['sys.argv'], {}), '(sys.argv)\n', (6958, 6968), False, 'from PyQt5.QtWidgets import QApplication, QComboBox, QDateTimeEdit, QHBoxLayout, QLabel, QMainWindow, QSpinBox, QTextBrowser, QVBoxLayout, QWidget\n'), ((2483, 2502), 'PyQt5.QtCore.QDate.currentDate... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | [
"numpy.where",
"es_agent.ESAgent",
"numpy.any",
"numpy.max",
"powernet_model.PowerNetModel",
"numpy.isnan",
"utils.process",
"numpy.load",
"es.ES"
] | [((1829, 1844), 'powernet_model.PowerNetModel', 'PowerNetModel', ([], {}), '()\n', (1842, 1844), False, 'from powernet_model import PowerNetModel\n'), ((1865, 1874), 'es.ES', 'ES', (['model'], {}), '(model)\n', (1867, 1874), False, 'from es import ES\n'), ((1899, 1917), 'es_agent.ESAgent', 'ESAgent', (['algorithm'], {}... |
import stackless
class MyChannel:
def __init__(self):
self.queue = []
self.balance = 0
self.temp = None
def send(self, data):
if self.balance < 0:
receiver = self.queue.pop(0)
self.temp = data
receiver.insert()
self.balance += 1... | [
"stackless.tasklet",
"stackless.schedule_remove",
"stackless.run"
] | [((1253, 1268), 'stackless.run', 'stackless.run', ([], {}), '()\n', (1266, 1268), False, 'import stackless\n'), ((1188, 1209), 'stackless.tasklet', 'stackless.tasklet', (['f2'], {}), '(f2)\n', (1205, 1209), False, 'import stackless\n'), ((1223, 1244), 'stackless.tasklet', 'stackless.tasklet', (['f1'], {}), '(f1)\n', (1... |
"""
Copyright 2014 Rackspace
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
dist... | [
"cloudcafe.bare_metal.ports.models.requests.CreatePort"
] | [((3147, 3208), 'cloudcafe.bare_metal.ports.models.requests.CreatePort', 'CreatePort', ([], {'node_uuid': 'node_uuid', 'address': 'address', 'extra': 'extra'}), '(node_uuid=node_uuid, address=address, extra=extra)\n', (3157, 3208), False, 'from cloudcafe.bare_metal.ports.models.requests import CreatePort\n')] |
from distutils.core import setup
with open('README.md', encoding='utf-8') as f:
long_description = f.read()
setup(
name='pytago',
version='0.0.12',
packages=['pytago', 'pytago.go_ast'],
url='https://github.com/nottheswimmer/pytago',
license='',
author='<NAME>',
author_email='<EMAIL>',
... | [
"distutils.core.setup"
] | [((114, 802), 'distutils.core.setup', 'setup', ([], {'name': '"""pytago"""', 'version': '"""0.0.12"""', 'packages': "['pytago', 'pytago.go_ast']", 'url': '"""https://github.com/nottheswimmer/pytago"""', 'license': '""""""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Transpiles some Py... |
import datetime
from airflow import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.contrib.operators.aws_athena_operator import AWSAthenaOperator
import googleapiclient.discovery
from jinja2 import PackageLoader
from kite_airflow.plugins.google import GoogleSheetsRangeOperator
from kite... | [
"kite_airflow.plugins.google.GoogleSheetsRangeOperator",
"kite_airflow.youtube_dashboard.files.write_channels_on_file",
"kite_airflow.youtube_dashboard.files.get_cached_urls_from_file",
"kite_airflow.youtube_dashboard.api.get_all_activity_list",
"kite_airflow.youtube_dashboard.utils.get_id_of_video_item",
... | [((3281, 3468), 'kite_airflow.plugins.google.GoogleSheetsRangeOperator', 'GoogleSheetsRangeOperator', ([], {'gcp_conn_id': '"""google_cloud_kite_dev"""', 'spreadsheet_id': '"""XXXXXXX-J0"""', 'range': '"""\'List of Channels\'!A:C"""', 'task_id': '"""get_channels_sheet"""', 'dag': 'kite_link_stats_dag'}), '(gcp_conn_id=... |
# This is the module facade, importing classes from the src dir/module.
import logging
# from .decorators import rest_add, rest_collection, rest_delete, \
# rest_detail, rest_update
from pyservices.data_descriptors.entity_codecs import JSON, Codec
from pyservices.service_descriptors import frameworks, http_c... | [
"logging.getLogger"
] | [((342, 372), 'logging.getLogger', 'logging.getLogger', (['__package__'], {}), '(__package__)\n', (359, 372), False, 'import logging\n')] |
from sys import stdin
def main():
print('Número de enteros a procesar')
n = stdin.readline().strip()
f = []
print('Secuencia de consultas')
cont = 1
for i in range(int(n)):
x = stdin.readline().strip().split(' ')
if x in f:
print('2')
elif x[0] in f:
... | [
"sys.stdin.readline"
] | [((84, 100), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (98, 100), False, 'from sys import stdin\n'), ((209, 225), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (223, 225), False, 'from sys import stdin\n')] |
import pytest
from django.http import HttpResponse
from cookie_consent_authenticateduser.middleware import (
CheckAuthenticatedUserCookieContentMiddleware,
)
pytestmark = pytest.mark.django_db
def dummy_middleware(request):
response = HttpResponse()
response.status_code = 200
return response
clas... | [
"cookie_consent_authenticateduser.middleware.CheckAuthenticatedUserCookieContentMiddleware",
"django.http.HttpResponse"
] | [((248, 262), 'django.http.HttpResponse', 'HttpResponse', ([], {}), '()\n', (260, 262), False, 'from django.http import HttpResponse\n'), ((484, 541), 'cookie_consent_authenticateduser.middleware.CheckAuthenticatedUserCookieContentMiddleware', 'CheckAuthenticatedUserCookieContentMiddleware', (['"""response"""'], {}), "... |
import streamlit as st
import matplotlib.pyplot as plt
import seaborn as sns
# @st.cache
def app():
if 'data' not in st.session_state:
st.markdown("Please upload data through `Upload Data` page!")
else:
df = st.session_state.data
st.markdown('# Explore Data')
st.write(df)
... | [
"matplotlib.pyplot.boxplot",
"streamlit.markdown",
"streamlit.pyplot",
"seaborn.diverging_palette",
"streamlit.write",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.subplots"
] | [((149, 210), 'streamlit.markdown', 'st.markdown', (['"""Please upload data through `Upload Data` page!"""'], {}), "('Please upload data through `Upload Data` page!')\n", (160, 210), True, 'import streamlit as st\n'), ((264, 293), 'streamlit.markdown', 'st.markdown', (['"""# Explore Data"""'], {}), "('# Explore Data')\... |
# -*- coding: utf-8 -*-
from PySide2 import QtCore, QtGui, QtWidgets
import json
import core_functions as cf
from loading_window import LoadingWindow
from costum_widgets import ToggleSwitch, HumbleDoubleSpinBox
class Ui_Settings(object):
def setupUi(self, Settings, parent=None):
# Note: this is not how... | [
"PySide2.QtWidgets.QGridLayout",
"PySide2.QtWidgets.QPushButton",
"PySide2.QtCore.QMetaObject.connectSlotsByName",
"PySide2.QtWidgets.QFrame",
"PySide2.QtWidgets.QHBoxLayout",
"PySide2.QtCore.QSize",
"PySide2.QtWidgets.QLabel",
"costum_widgets.ToggleSwitch",
"PySide2.QtWidgets.QLineEdit",
"costum_... | [((2299, 2330), 'PySide2.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['Settings'], {}), '(Settings)\n', (2320, 2330), False, 'from PySide2 import QtCore, QtGui, QtWidgets\n'), ((2513, 2539), 'PySide2.QtWidgets.QLabel', 'QtWidgets.QLabel', (['Settings'], {}), '(Settings)\n', (2529, 2539), False, 'from PySide2 impo... |
""" A playful implementation of the famous "German Tank Problem" in statistics.
First, the random number generator populates a list of "tanks", represented
by sequential serial numbers. The numbers are added to the list in random
order until they run out.
We then choose the sample size, representi... | [
"random.sample"
] | [((1066, 1099), 'random.sample', 'sample', (['serialnumbers', 'samplesize'], {}), '(serialnumbers, samplesize)\n', (1072, 1099), False, 'from random import sample\n')] |
import json
import os
from flask import Flask, send_from_directory, render_template, request
from werkzeug.exceptions import HTTPException, NotFound
from src.server.api.v1.routes import api as api_routes
from src.server.renderer import render_ssr
from src.server.utils.RegexConverter import RegexConverter
from dotenv im... | [
"flask.render_template",
"flask.send_from_directory",
"os.getenv",
"flask.Flask",
"json.dumps",
"dotenv.load_dotenv",
"os.path.abspath",
"src.server.renderer.render_ssr"
] | [((338, 359), 'dotenv.load_dotenv', 'load_dotenv', (['"""./.env"""'], {}), "('./.env')\n", (349, 359), False, 'from dotenv import load_dotenv\n'), ((364, 387), 'os.getenv', 'os.getenv', (['"""DEV"""', '(False)'], {}), "('DEV', False)\n", (373, 387), False, 'import os\n'), ((404, 429), 'os.path.abspath', 'os.path.abspat... |
#!/usr/bin/python2.7
#
# Copyright Quip 2016
"""Opens a websocket and listens for updates from Quip
This is a sample app for the Quip API - https://quip.com/api/.
"""
import argparse
import json
import quip
import sys
import time
import websocket
PY3 = sys.version_info > (3,)
if PY3:
import _thread as thread
el... | [
"json.loads",
"argparse.ArgumentParser",
"quip.QuipClient",
"json.dumps",
"websocket.WebSocketApp",
"time.sleep",
"thread.start_new_thread"
] | [((962, 1054), 'websocket.WebSocketApp', 'websocket.WebSocketApp', (['url'], {'on_message': 'on_message', 'on_error': 'on_error', 'on_close': 'on_close'}), '(url, on_message=on_message, on_error=on_error,\n on_close=on_close)\n', (984, 1054), False, 'import websocket\n'), ((1133, 1197), 'argparse.ArgumentParser', 'a... |
import time
import gluoncv as gcv
from gluoncv.utils import try_import_cv2
cv2 = try_import_cv2()
import mxnet as mx
# Load the model
net = gcv.model_zoo.get_model('ssd_512_mobilenet1.0_voc', pretrained=True)
# Compile the model for faster speed
net.hybridize()
# Load the webcam handler
cap = cv2.VideoCapture(0)
tim... | [
"gluoncv.utils.try_import_cv2",
"gluoncv.utils.viz.cv_plot_bbox",
"gluoncv.utils.viz.cv_plot_image",
"gluoncv.data.transforms.presets.ssd.transform_test",
"gluoncv.model_zoo.get_model",
"time.sleep"
] | [((82, 98), 'gluoncv.utils.try_import_cv2', 'try_import_cv2', ([], {}), '()\n', (96, 98), False, 'from gluoncv.utils import try_import_cv2\n'), ((142, 210), 'gluoncv.model_zoo.get_model', 'gcv.model_zoo.get_model', (['"""ssd_512_mobilenet1.0_voc"""'], {'pretrained': '(True)'}), "('ssd_512_mobilenet1.0_voc', pretrained=... |
from PyQt5 import QtWidgets
from xldigest.widgets.base_import_wizard_ui import Ui_base_import_wizard
from xldigest.widgets.dialogs import (AddPortfolioDialog, AddProjectDialog,
AddSeriesDialog, AddSeriesItemDialog)
class BaseImportWizard(QtWidgets.QWizard, Ui_base_import_wizard)... | [
"xldigest.widgets.dialogs.AddProjectDialog",
"xldigest.widgets.dialogs.AddPortfolioDialog",
"xldigest.widgets.dialogs.AddSeriesDialog",
"PyQt5.QtWidgets.QTableWidgetItem",
"xldigest.widgets.dialogs.AddSeriesItemDialog"
] | [((1634, 1654), 'xldigest.widgets.dialogs.AddPortfolioDialog', 'AddPortfolioDialog', ([], {}), '()\n', (1652, 1654), False, 'from xldigest.widgets.dialogs import AddPortfolioDialog, AddProjectDialog, AddSeriesDialog, AddSeriesItemDialog\n'), ((1948, 1966), 'xldigest.widgets.dialogs.AddProjectDialog', 'AddProjectDialog'... |