code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import copy
from dlgo.gotypes import Player, Point
from dlgo.scoring import compute_game_result
from dlgo import zobrist
neighbor_tables = {}
corner_tables = {}
def init_neighbor_table(dim):
rows, cols = dim
new_table = {}
for r in range(1, rows + 1):
for c in range(1, cols + 1):
p =... | [
"copy.copy",
"dlgo.scoring.compute_game_result",
"dlgo.gotypes.Point",
"copy.deepcopy"
] | [((35493, 35514), 'copy.copy', 'copy.copy', (['self._grid'], {}), '(self._grid)\n', (35502, 35514), False, 'import copy\n'), ((35543, 35569), 'copy.copy', 'copy.copy', (['self._liberties'], {}), '(self._liberties)\n', (35552, 35569), False, 'import copy\n'), ((35598, 35628), 'copy.deepcopy', 'copy.deepcopy', (['self._c... |
import asyncio
def main():
print("Creating our event loop")
loop = asyncio.get_event_loop()
loop.run_forever()
print("Our Loop will now run forever, this will never execute")
if __name__ == '__main__':
main() | [
"asyncio.get_event_loop"
] | [((72, 96), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (94, 96), False, 'import asyncio\n')] |
from functools import wraps
from django.http.response import HttpResponse
from atlassian_jwt_auth.frameworks.django.decorators import with_asap
def validate_asap(issuers=None, subjects=None, required=True):
"""Decorator to allow endpoint-specific ASAP authorization, assuming ASAP
authentication has already ... | [
"django.http.response.HttpResponse",
"atlassian_jwt_auth.frameworks.django.decorators.with_asap",
"functools.wraps"
] | [((1952, 2065), 'atlassian_jwt_auth.frameworks.django.decorators.with_asap', 'with_asap', ([], {'func': 'func', 'required': '(True)', 'issuers': 'issuers', 'subject_should_match_issuer': 'subject_should_match_issuer'}), '(func=func, required=True, issuers=issuers,\n subject_should_match_issuer=subject_should_match_i... |
#from frm_generate_data_np import *
import numpy as np
from numpy import pi,sqrt
model_folder="models/freq_2019_07_02_2/"
from frm_modulations import mod_list,cont_phase_mod_list,linear_mod_const
# import tensorflow as tf
import datetime
import pickle
import sys
import copy
from frm_dataset_creator import *
from num... | [
"frm_modulations_fast.modulate_symbols_fast",
"frm_modulations_fast.modulate_symbols",
"numpy.array",
"copy.deepcopy",
"numpy.imag",
"numpy.arange",
"numpy.repeat",
"numpy.diff",
"numpy.real",
"numpy.random.seed",
"sys.stdout.flush",
"numpy.random.choice",
"numba.jit",
"pickle.dump",
"nu... | [((9567, 9585), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (9570, 9585), False, 'from numba import jit\n'), ((2796, 2830), 'numpy.zeros', 'np.zeros', (['(n_samples, pkt_size, 2)'], {}), '((n_samples, pkt_size, 2))\n', (2804, 2830), True, 'import numpy as np\n'), ((2845, 2879), 'numpy.zeros',... |
from JumpScale import j
def cb():
from .CodeTools import CodeTools
return CodeTools()
j._register('codetools', cb)
| [
"JumpScale.j._register"
] | [((96, 124), 'JumpScale.j._register', 'j._register', (['"""codetools"""', 'cb'], {}), "('codetools', cb)\n", (107, 124), False, 'from JumpScale import j\n')] |
import tensorflow as tf
import os
import numpy as np
import logging
logger = logging.getLogger("detect")
class Step1CNN:
def __init__(self, step1_model_dir):
self.model_dir = step1_model_dir
self.model_path = os.path.join(self.model_dir, 'frozen_inference_graph.pb')
self._graph = None
... | [
"logging.getLogger",
"tensorflow.Graph",
"tensorflow.Session",
"os.path.join",
"tensorflow.GraphDef",
"numpy.expand_dims",
"tensorflow.import_graph_def",
"tensorflow.gfile.GFile"
] | [((78, 105), 'logging.getLogger', 'logging.getLogger', (['"""detect"""'], {}), "('detect')\n", (95, 105), False, 'import logging\n'), ((232, 289), 'os.path.join', 'os.path.join', (['self.model_dir', '"""frozen_inference_graph.pb"""'], {}), "(self.model_dir, 'frozen_inference_graph.pb')\n", (244, 289), False, 'import os... |
from base.base_sql import Sql
import excel.excel_parse as ep
from excel.excel_base import *
from excel.excel_sql import *
def load_lep_table(answers, comp_id):
col_num_pp = None
col_name_lep = None
col_god_vvoda = None
col_disp_name = None
col_napr = None
col_colcep = None
col_dlpotr = Non... | [
"excel.excel_parse.parse_all_table",
"base.base_sql.Sql.exec"
] | [((16517, 16541), 'excel.excel_parse.parse_all_table', 'ep.parse_all_table', (['file'], {}), '(file)\n', (16535, 16541), True, 'import excel.excel_parse as ep\n'), ((16448, 16469), 'base.base_sql.Sql.exec', 'Sql.exec', ([], {'query': 'query'}), '(query=query)\n', (16456, 16469), False, 'from base.base_sql import Sql\n'... |
# coding=utf-8
import argparse
from ..molPred.molPred_datas import *
from hyperopt import tpe
from ..toolPack.tools_hpOpt import fmin_multiProcess, Fmin_process, file_progress
from ..toolPack import tools_log
from ..toolPack.tools_metric import metric_betters
from ..toolPack import tools_data_io
from ..toolPack import ... | [
"argparse.Namespace"
] | [((1284, 1315), 'argparse.Namespace', 'argparse.Namespace', ([], {}), '(**args_dict)\n', (1302, 1315), False, 'import argparse\n')] |
from django.core.exceptions import ValidationError
from django import forms
from form_helper import FormOrderMixin
from survey.models import (Answer, MultiChoiceAnswer, MultiSelectAnswer, DateAnswer, QuestionFlow,
Question, TextArgument, NumericalAnswer, TextAnswer, TemplateOption)
from surve... | [
"survey.models.DateAnswer.choice_name",
"django.core.exceptions.ValidationError",
"survey.models.MultiSelectAnswer.choice_name",
"survey.models.MultiChoiceAnswer.choice_name",
"survey.models.QuestionFlow.objects.create",
"survey.models.Answer.get_class",
"survey.models.Question.get",
"survey.models.Fi... | [((9500, 9528), 'survey.models.FixedLoopCount.choice_name', 'FixedLoopCount.choice_name', ([], {}), '()\n', (9526, 9528), False, 'from survey.models import ResponseValidation, QuestionLoop, FixedLoopCount, PreviousAnswerCount\n'), ((9557, 9590), 'survey.models.PreviousAnswerCount.choice_name', 'PreviousAnswerCount.choi... |
import os
import json
import aiofiles
from database.jsonio import *
# items
# user's owned items:
# kokemans
# user's owned kokemans
# property (余额)
# items (物品)
# kokemans(kokeman)
# 好感度(不急)
# 成就系统(不急)
from config import *
async def get_info(user_id):
filename = str(user_id) + '.json'
filepath = os.path.joi... | [
"os.path.exists",
"os.path.join"
] | [((309, 346), 'os.path.join', 'os.path.join', (['USER_DATAPATH', 'filename'], {}), '(USER_DATAPATH, filename)\n', (321, 346), False, 'import os\n'), ((725, 762), 'os.path.join', 'os.path.join', (['USER_DATAPATH', 'filename'], {}), '(USER_DATAPATH, filename)\n', (737, 762), False, 'import os\n'), ((358, 382), 'os.path.e... |
import os
import typing
class MetadataToPsvTransformer:
"""
Abstract class for transforming DSS metadata to PSV rows.
"""
PSV_EXT = ".psv"
OUTPUT_DIRNAME = "output"
LOG_DIRNAME = "logs"
def __init__(self, staging_dir):
self.staging_dir = staging_dir
self.output_dir = os.pa... | [
"os.path.join"
] | [((315, 381), 'os.path.join', 'os.path.join', (['staging_dir', 'MetadataToPsvTransformer.OUTPUT_DIRNAME'], {}), '(staging_dir, MetadataToPsvTransformer.OUTPUT_DIRNAME)\n', (327, 381), False, 'import os\n'), ((1898, 1975), 'os.path.join', 'os.path.join', (['self.output_dir', '(table.value + MetadataToPsvTransformer.PSV_... |
# Import
from discord.ext import commands
import discord
import asyncio
# Utils
import Utils
# Cog Initialising
class EventHandler(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_member_remove(self, user: discord.Member):
try:
... | [
"discord.ext.commands.Cog.listener",
"Utils.YamlContainerManagement.GET_yamlAttr",
"discord.Colour",
"asyncio.sleep",
"Utils.DBPreconditioning.DEL_Uccount"
] | [((219, 242), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (240, 242), False, 'from discord.ext import commands\n'), ((422, 445), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (443, 445), False, 'from discord.ext import commands\n'), ((1912, 1935), 'd... |
from micropython import const
from trezor import log, wire
from trezor.crypto import base58, hashlib
from trezor.crypto.curve import ed25519
from trezor.messages.CardanoSignedTx import CardanoSignedTx
from trezor.messages.CardanoTxRequest import CardanoTxRequest
from trezor.messages.MessageType import CardanoTxAck
fr... | [
"trezor.wire.ProcessError",
"apps.cardano.address.derive_address_and_node",
"apps.cardano.layout.progress.advance",
"micropython.const",
"apps.common.paths.validate_path",
"apps.cardano.cbor.IndefiniteLengthArray",
"trezor.crypto.base58.decode",
"apps.cardano.address.is_safe_output_address",
"apps.c... | [((885, 899), 'micropython.const', 'const', (['(1000000)'], {}), '(1000000)\n', (890, 899), False, 'from micropython import const\n'), ((923, 931), 'micropython.const', 'const', (['(2)'], {}), '(2)\n', (928, 931), False, 'from micropython import const\n'), ((2174, 2227), 'apps.cardano.layout.progress.init', 'progress.i... |
import json
import requests
import os
import logging
logging.basicConfig(filename='install-error-log.log', filemode='a', level=logging.DEBUG)
CONNECTOR_NAME = "kibana_index_alert_tool_connect"
def connector_exists():
url: str = os.getenv('KIBANA_HOST') + '/api/actions'
res = requests.get(url,
... | [
"logging.basicConfig",
"json.loads",
"logging.error",
"os.getenv"
] | [((54, 147), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""install-error-log.log"""', 'filemode': '"""a"""', 'level': 'logging.DEBUG'}), "(filename='install-error-log.log', filemode='a', level=\n logging.DEBUG)\n", (73, 147), False, 'import logging\n'), ((581, 604), 'json.loads', 'json.loads', ... |
'''
@name: analysis.py
@brief: Analysis of evaluation data
@author: <NAME>
@version: 3.5
@date: 2019/04/05
'''
import os
home = os.path.expanduser("~")
import rospkg
from rl_agent.evaluation.Analysis_eval import Analysis
import pickle
import configparser
def analyse(complexity, ... | [
"pickle.dump",
"configparser.ConfigParser",
"rl_agent.evaluation.Analysis_eval.Analysis",
"rospkg.RosPack",
"os.path.expanduser"
] | [((167, 190), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (185, 190), False, 'import os\n'), ((387, 397), 'rl_agent.evaluation.Analysis_eval.Analysis', 'Analysis', ([], {}), '()\n', (395, 397), False, 'from rl_agent.evaluation.Analysis_eval import Analysis\n'), ((2008, 2024), 'rospkg.RosPa... |
from sys import stdin, stdout
from fractions import gcd
import math
t = int(stdin.readline())
s = [int(x) for x in stdin.read().strip().split()]
for tc in range(1, t+1):
a, b = s[2*tc - 2], s[2*tc - 1]
if a == 0 or b == 0:
stdout.write('Case {}: {}\n'.format(tc, 1))
else:
g = gcd(a, b)
... | [
"sys.stdin.readline",
"sys.stdin.read",
"fractions.gcd"
] | [((76, 92), 'sys.stdin.readline', 'stdin.readline', ([], {}), '()\n', (90, 92), False, 'from sys import stdin, stdout\n'), ((305, 314), 'fractions.gcd', 'gcd', (['a', 'b'], {}), '(a, b)\n', (308, 314), False, 'from fractions import gcd\n'), ((115, 127), 'sys.stdin.read', 'stdin.read', ([], {}), '()\n', (125, 127), Fals... |
from queue import Queue
from collections import namedtuple
from tornado.platform.asyncio import AnyThreadEventLoopPolicy
import asyncio
import aiohttp
import itertools
import threading
# todo remove
import simplestopwatch as sw
# todo check out aiodns resolver
# https://stackoverflow.com/a/45169094/1102470
Response... | [
"aiohttp.ClientSession",
"itertools.islice",
"simplestopwatch.Timer",
"collections.namedtuple",
"tornado.platform.asyncio.AnyThreadEventLoopPolicy",
"asyncio.Task.all_tasks",
"asyncio.gather",
"threading.Thread",
"queue.Queue",
"asyncio.get_event_loop"
] | [((323, 386), 'collections.namedtuple', 'namedtuple', (['"""Response"""', "['request', 'status', 'reason', 'text']"], {}), "('Response', ['request', 'status', 'reason', 'text'])\n", (333, 386), False, 'from collections import namedtuple\n'), ((2706, 2730), 'queue.Queue', 'Queue', (['concurrency_limit'], {}), '(concurre... |
# coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# 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 applicab... | [
"tensorflow.compat.v2.reduce_sum",
"tensorflow.compat.v2.nn.sigmoid_cross_entropy_with_logits",
"tensorflow.compat.v2.one_hot",
"tensorflow.compat.v2.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.compat.v2.keras.backend.ones",
"tensorflow.compat.v2.shape",
"tensorflow.compat.v2.cast",
"ten... | [((4067, 4118), 'tensorflow.compat.v2.cast', 'tf.cast', (['(neg_sample_mask > self.gamma)', 'logits.dtype'], {}), '(neg_sample_mask > self.gamma, logits.dtype)\n', (4074, 4118), True, 'import tensorflow.compat.v2 as tf\n'), ((4366, 4424), 'tensorflow.compat.v2.one_hot', 'tf.one_hot', (['labels'], {'depth': 'self.n_item... |
import datetime
from sqlalchemy.ext.hybrid import hybrid_property
from marshmallow import Schema, fields, pre_load, validate
from flask_marshmallow import Marshmallow
from flask_sqlalchemy import SQLAlchemy
from flask_bcrypt import Bcrypt
import jwt
from app.config import key
flask_bcrypt = Bcrypt()
ma = Marshmallo... | [
"jwt.decode",
"datetime.datetime.utcnow",
"flask_marshmallow.Marshmallow",
"flask_bcrypt.Bcrypt",
"datetime.datetime.now",
"flask_sqlalchemy.SQLAlchemy",
"datetime.timedelta",
"jwt.encode"
] | [((296, 304), 'flask_bcrypt.Bcrypt', 'Bcrypt', ([], {}), '()\n', (302, 304), False, 'from flask_bcrypt import Bcrypt\n'), ((310, 323), 'flask_marshmallow.Marshmallow', 'Marshmallow', ([], {}), '()\n', (321, 323), False, 'from flask_marshmallow import Marshmallow\n'), ((329, 341), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlch... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | [
"backend.utils.client.KubectlClient",
"backend.bcs_web.audit_log.audit.decorators.log_audit"
] | [((2312, 2341), 'backend.bcs_web.audit_log.audit.decorators.log_audit', 'log_audit', (['TemplatesetAuditor'], {}), '(TemplatesetAuditor)\n', (2321, 2341), False, 'from backend.bcs_web.audit_log.audit.decorators import log_audit\n'), ((1180, 1290), 'backend.utils.client.KubectlClient', 'KubectlClient', (['user.token.acc... |
from abc import ABC, abstractmethod
from typing import Callable, Union
import torch
from torch import nn
from .utils import run_lstm_on_variable_length_seqs
# TODO: Specify types in signatures
class EdgeStateEncoder(nn.Module, ABC):
def __init__(
self,
edge_type,
input_size... | [
"torch.nn.Dropout",
"torch.nn.LSTM",
"torch.stack",
"torch.zeros",
"torch.cat"
] | [((1074, 1171), 'torch.nn.LSTM', 'nn.LSTM', ([], {'input_size': 'self.combiner_output_size', 'hidden_size': 'self.output_size', 'batch_first': '(True)'}), '(input_size=self.combiner_output_size, hidden_size=self.output_size,\n batch_first=True)\n', (1081, 1171), False, 'from torch import nn\n'), ((1237, 1255), 'torc... |
# Copyright 2015 <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 law or agreed to in writing, s... | [
"itertools.islice",
"random.sample",
"collections.deque",
"itertools.groupby",
"heapq.heappushpop",
"random.choice",
"random.randrange",
"itertools.zip_longest",
"itertools.filterfalse",
"itertools.combinations",
"itertools.chain.from_iterable",
"heapq.heappop",
"itertools.count",
"itertoo... | [((2417, 2449), 'itertools.chain.from_iterable', 'chain.from_iterable', (['listOfLists'], {}), '(listOfLists)\n', (2436, 2449), False, 'from itertools import chain, combinations, count, cycle, groupby, islice, repeat, starmap, tee\n'), ((2805, 2818), 'itertools.tee', 'tee', (['iterable'], {}), '(iterable)\n', (2808, 28... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from base import BaseModel
# functions of initializing layers
def init_layer(layer):
"""Initialize a Linear or Convolutional layer."""
nn.init.xavier_uniform_(layer.weight)
if hasattr(layer, 'bias'):
if layer.bias is not None:
... | [
"torch.nn.BatchNorm2d",
"torch.nn.Softmax",
"torch.nn.init.constant_",
"torch.nn.init.xavier_uniform_",
"torch.nn.LSTM",
"torch.nn.functional.dropout",
"torch.nn.Conv2d",
"torch.nn.functional.avg_pool2d",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.nn.functional.max_pool2d",
"torch.nn.Ad... | [((211, 248), 'torch.nn.init.xavier_uniform_', 'nn.init.xavier_uniform_', (['layer.weight'], {}), '(layer.weight)\n', (234, 248), True, 'import torch.nn as nn\n'), ((1500, 1528), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channel', '(16)', '(3)'], {}), '(in_channel, 16, 3)\n', (1509, 1528), True, 'import torch.nn as nn\n'),... |
# Visualize Reults with MatPlotlib etc...
import matplotlib.pyplot as plt
import numpy as np
class Visualization(object):
def __init__(self, dataset):
super().__init__()
self.dataset = dataset
self.estimated_state = None
self.estimated_varf = None
def getEstimatedValu... | [
"matplotlib.pyplot.title",
"numpy.sqrt",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1034, 1068), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(8, 6)'}), '(1, 1, figsize=(8, 6))\n', (1046, 1068), True, 'import matplotlib.pyplot as plt\n'), ((1105, 1132), 'matplotlib.pyplot.title', 'plt.title', (['"""GPS trajactory"""'], {}), "('GPS trajactory')\n", (1114, 1132), True, ... |
from typing import Dict, Type
import bpy
from bpy.app.handlers import persistent
from bpy.props import (BoolProperty, FloatProperty, IntProperty,
PointerProperty, StringProperty)
from bpy.types import Operator, PropertyGroup, UILayout, UIList
# Globals
XFBIN_LISTS = list()
XFBIN_CLIPBOARD: Dict... | [
"bpy.props.IntProperty",
"bpy.props.BoolProperty",
"bpy.props.PointerProperty",
"bpy.props.StringProperty",
"bpy.props.FloatProperty",
"bpy.data.objects.new",
"bpy.props.EnumProperty"
] | [((2045, 2058), 'bpy.props.IntProperty', 'IntProperty', ([], {}), '()\n', (2056, 2058), False, 'from bpy.props import BoolProperty, FloatProperty, IntProperty, PointerProperty, StringProperty\n'), ((2113, 2128), 'bpy.props.FloatProperty', 'FloatProperty', ([], {}), '()\n', (2126, 2128), False, 'from bpy.props import Bo... |
import pymc3 as pm
import matplotlib.pyplot as pl
from matplotlib import dates
import numpy as np
import pandas as pd
from . import ephem, MPLSTYLE, PACKAGEDIR
from .cobs import read_cobs
class CometModel():
def __init__(self, comet="2019 Y4", cobs_id=None, horizons_id=None,
start="2020-01-01",... | [
"numpy.log10",
"numpy.nanpercentile",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.nanmean",
"numpy.array",
"pymc3.sample",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.max",
"matplotlib.pyplot.close",
"matplotlib.pyplot.scatter",
"numpy.datetime64",
"pandas.DataFr... | [((8380, 8423), 'pandas.read_csv', 'pd.read_csv', (["(PACKAGEDIR / 'data/comets.csv')"], {}), "(PACKAGEDIR / 'data/comets.csv')\n", (8391, 8423), True, 'import pandas as pd\n'), ((9033, 9053), 'pandas.DataFrame', 'pd.DataFrame', (['result'], {}), '(result)\n', (9045, 9053), True, 'import pandas as pd\n'), ((10161, 1018... |
"""
Serve as a convenient wrapper for validate.py.
"""
import gc
import os
import timeit
import IPython
import torch
import numpy as np
import scipy.misc as misc
import yaml
from torch.utils import data
from ptsemseg.loader import get_loader
from ptsemseg.utils import get_logger
from utils import test_parser
from ... | [
"numpy.log",
"torch.from_numpy",
"numpy.ascontiguousarray",
"numpy.array",
"scipy.misc.imresize",
"ptsemseg.loader.get_loader",
"pydensecrf.densecrf.DenseCRF2D",
"os.path.exists",
"utils.test_parser",
"numpy.where",
"ptsemseg.utils.get_logger",
"scipy.misc.imsave",
"validate_from_file.final_... | [((679, 693), 'os.chdir', 'os.chdir', (['ROOT'], {}), '(ROOT)\n', (687, 693), False, 'import os\n'), ((2340, 2377), 'scipy.misc.imsave', 'misc.imsave', (['img_path_target', 'decoded'], {}), '(img_path_target, decoded)\n', (2351, 2377), True, 'import scipy.misc as misc\n'), ((10122, 10155), 'ptsemseg.utils.get_logger', ... |
# -*- coding: utf-8 -*-
"""
@author: <NAME> <<EMAIL>>
Date: Oct 2017
"""
import numba as nb
from numba import jit, njit, float64, int32
import numpy as np
nb.NUMBA_DISABLE_JIT = 0
GLOB_NOGIL = True
GLOB_PARALLEL = True
# %% Simulation environment processing
# f.i. port and part flow processing, material properties ... | [
"numpy.log10",
"numpy.log",
"numpy.roots",
"numpy.equal",
"numpy.array",
"numba.prange",
"numpy.greater",
"numpy.less",
"numpy.where",
"numpy.max",
"numpy.exp",
"numpy.dot",
"numpy.empty",
"numpy.maximum",
"numpy.abs",
"numpy.ones",
"numpy.full",
"numba.njit",
"numpy.any",
"num... | [((363, 411), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'nogil': 'GLOB_NOGIL', 'cache': '(True)'}), '(nopython=True, nogil=GLOB_NOGIL, cache=True)\n', (366, 411), False, 'from numba import jit, njit, float64, int32\n'), ((931, 965), 'numba.njit', 'njit', ([], {'nogil': 'GLOB_NOGIL', 'cache': '(True)'}), '(nogil=G... |
from activfuncs import plot, x
import numpy as np
def softplus(x):
return np.log(1+np.exp(x))
plot(softplus, yaxis=(-0.4, 1.4))
| [
"numpy.exp",
"activfuncs.plot"
] | [((100, 133), 'activfuncs.plot', 'plot', (['softplus'], {'yaxis': '(-0.4, 1.4)'}), '(softplus, yaxis=(-0.4, 1.4))\n', (104, 133), False, 'from activfuncs import plot, x\n'), ((88, 97), 'numpy.exp', 'np.exp', (['x'], {}), '(x)\n', (94, 97), True, 'import numpy as np\n')] |
# Dash basics with more coloring
import dash
import dash_core_components as dcc
import dash_html_components as html
app=dash.Dash()
colors = {'background':'#111111', 'text':'#7FDBFF'}
app.layout = html.Div(children=[
html.H1('Hello Dash!', style={'textAlign':'center',
... | [
"dash_core_components.Graph",
"dash.Dash",
"dash_html_components.H1"
] | [((126, 137), 'dash.Dash', 'dash.Dash', ([], {}), '()\n', (135, 137), False, 'import dash\n'), ((246, 324), 'dash_html_components.H1', 'html.H1', (['"""Hello Dash!"""'], {'style': "{'textAlign': 'center', 'color': colors['text']}"}), "('Hello Dash!', style={'textAlign': 'center', 'color': colors['text']})\n", (253, 324... |
import sys
import time
import matlab.engine
from shutil import copyfile
eng = matlab.engine.start_matlab()
def execute_service(in_path, out_path, viz_out_path, nw=2):
model = out_path.partition('_')[0]
out_file = out_path.partition('/')[2]
viz_out_file = viz_out_path.partition('/')[2]
if model == "7... | [
"shutil.copyfile",
"time.sleep"
] | [((360, 432), 'shutil.copyfile', 'copyfile', (["('./Data/spectrogram_outputs/' + out_file)", "('./Data/' + out_path)"], {}), "('./Data/spectrogram_outputs/' + out_file, './Data/' + out_path)\n", (368, 432), False, 'from shutil import copyfile\n'), ((441, 526), 'shutil.copyfile', 'copyfile', (["('./Data/spectrogram_outp... |
# Generated by Django 3.1.7 on 2021-03-26 21:59
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="Project",
fields=[
(
... | [
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.UUIDField"
] | [((351, 442), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid4', 'editable': '(False)', 'primary_key': '(True)', 'serialize': '(False)'}), '(default=uuid.uuid4, editable=False, primary_key=True,\n serialize=False)\n', (367, 442), False, 'from django.db import migrations, models\n'), ((6... |
import gym
import numpy as np
import os
import random
import time
import pandas
from tqdm import tqdm
import matplotlib.pyplot as plt
from sklearn.model_selection import ParameterGrid
np.random.seed(42)
random.seed(42)
def print_state_values_tabular(Q, size=8):
# Get the max value for state
V = [max(q_s) fo... | [
"sklearn.model_selection.ParameterGrid",
"random.choice",
"matplotlib.pyplot.ylabel",
"numpy.random.random",
"numpy.random.choice",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"random.seed",
"time.sleep",
"numpy.random.seed",
"pandas.DataFrame",
"os.system",
"time.time",
"gym.mak... | [((184, 202), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (198, 202), True, 'import numpy as np\n'), ((203, 218), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (214, 218), False, 'import random\n'), ((1651, 1672), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Episode"""'], {}), "('Episo... |
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from PIL import Image
from sklearn.model_selection import train_test_split, GroupShuffleSplit, StratifiedKFold, StratifiedGroupKFold
path_data_train = '/home/Behrendt/data/LUMEN/Node21/cxr_images/proccessed_data/metadata.csv'
... | [
"sklearn.model_selection.StratifiedGroupKFold",
"pandas.read_csv"
] | [((759, 787), 'pandas.read_csv', 'pd.read_csv', (['path_data_train'], {}), '(path_data_train)\n', (770, 787), True, 'import pandas as pd\n'), ((833, 857), 'pandas.read_csv', 'pd.read_csv', (['mappingpath'], {}), '(mappingpath)\n', (844, 857), True, 'import pandas as pd\n'), ((869, 894), 'pandas.read_csv', 'pd.read_csv'... |
import os
import sys
ROOT_DIR = os.path.dirname(sys.modules['__main__'].__file__)
IMAGES_DIR = os.path.join(ROOT_DIR, "assets/images")
WIN_TITLE = "Help MacGyver escape"
WIN_BACKGROUND_COLOR = (0, 0, 0)
WIN_ICON = os.path.join(IMAGES_DIR, "logo.png")
MAZE_CELLS_NUMBER = (15, 15)
MAZE_CELLS_SIZE = (40, 40)
MAZE_START... | [
"os.path.dirname",
"os.path.join"
] | [((33, 82), 'os.path.dirname', 'os.path.dirname', (["sys.modules['__main__'].__file__"], {}), "(sys.modules['__main__'].__file__)\n", (48, 82), False, 'import os\n'), ((96, 135), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""assets/images"""'], {}), "(ROOT_DIR, 'assets/images')\n", (108, 135), False, 'import os\n')... |
# -*- coding: utf-8 -*-
"""
Copyright (C) 2021 <NAME> (script.appcast)
Functions for starting the script service
SPDX-License-Identifier: MIT
See LICENSES/MIT.md for more information.
"""
import threading
import xbmc
import resources.lib.servers.dial_server as dial_server
import resources.lib.servers... | [
"resources.lib.globals.G.init_globals",
"traceback.format_exc",
"resources.lib.servers.dial_server.DialTCPServer",
"resources.lib.servers.ssdp_server.SSDPUDPServer",
"xbmc.Monitor",
"resources.lib.helpers.logging.LOG.info",
"threading.Thread"
] | [((2746, 2762), 'resources.lib.globals.G.init_globals', 'G.init_globals', ([], {}), '()\n', (2760, 2762), False, 'from resources.lib.globals import G\n'), ((1593, 1633), 'resources.lib.helpers.logging.LOG.info', 'LOG.info', (['"""[DialServer] service started"""'], {}), "('[DialServer] service started')\n", (1601, 1633)... |
"""Multinet uploader for nested JSON files."""
from flasgger import swag_from
import itertools
import json
from multinet import util
from multinet.db.models.workspace import Workspace
from multinet.auth.util import require_writer
from multinet.errors import AlreadyExists
from flask import Blueprint, request
from typ... | [
"flasgger.swag_from",
"json.loads",
"multinet.errors.AlreadyExists",
"flask.request.data.decode",
"multinet.db.models.workspace.Workspace",
"itertools.count",
"flask.Blueprint"
] | [((354, 388), 'flask.Blueprint', 'Blueprint', (['"""nested_json"""', '__name__'], {}), "('nested_json', __name__)\n", (363, 388), False, 'from flask import Blueprint, request\n'), ((2276, 2313), 'flasgger.swag_from', 'swag_from', (['"""swagger/nested_json.yaml"""'], {}), "('swagger/nested_json.yaml')\n", (2285, 2313), ... |
# -*- coding: utf-8 -*-
from drf_yasg.utils import swagger_auto_schema
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.views import APIView
from gcloud.contrib.function.models import FunctionTask
from gcloud.contrib.function.serializers import FunctionTaskC... | [
"gcloud.contrib.function.serializers.FunctionTaskClaimantTransferRequestSerializer",
"drf_yasg.utils.swagger_auto_schema",
"gcloud.core.api_adapter.user_role.is_user_role",
"rest_framework.response.Response",
"gcloud.contrib.function.models.FunctionTask.objects.filter",
"rest_framework.decorators.action"
... | [((549, 735), 'drf_yasg.utils.swagger_auto_schema', 'swagger_auto_schema', ([], {'method': '"""POST"""', 'operation_summary': '"""职能转交"""', 'request_body': 'FunctionTaskClaimantTransferRequestSerializer', 'responses': '{(200): FunctionTaskClaimantTransferResponse}'}), "(method='POST', operation_summary='职能转交', request_... |
from cryptography.fernet import Fernet
import os
import re
import sys
import bcrypt
import boto3
from dulwich import client as _mod_client
from dulwich.contrib.paramiko_vendor import ParamikoSSHVendor
from app import templating
SECRET_PATH = "/serverless-wiki/id_rsa"
secrets_manager = boto3.client("secretsmanager")... | [
"dulwich.porcelain.commit",
"os.listdir",
"boto3.client",
"dulwich.porcelain.fetch",
"re.compile",
"dulwich.porcelain.push",
"dulwich.porcelain.clone",
"os.environ.get",
"pyhocon.ConfigFactory.parse_file",
"boto3.resource",
"os.path.isdir",
"dulwich.porcelain.pull",
"dulwich.porcelain.add"
] | [((290, 320), 'boto3.client', 'boto3.client', (['"""secretsmanager"""'], {}), "('secretsmanager')\n", (302, 320), False, 'import boto3\n'), ((953, 982), 're.compile', 're.compile', (['"""^[a-zA-Z0-9_]+$"""'], {}), "('^[a-zA-Z0-9_]+$')\n", (963, 982), False, 'import re\n'), ((989, 1009), 'boto3.resource', 'boto3.resourc... |
import os
import json
from easydict import EasyDict
from pprint import pprint
from utils.dirs import create_dirs
def get_config_from_json(json_file):
"""
Get the config from a json file
:param json_file: the path of the config file
:return: config(namespace), config(dictionary)
"""
# parse ... | [
"os.path.join",
"easydict.EasyDict",
"json.load",
"pprint.pprint",
"utils.dirs.create_dirs"
] | [((689, 710), 'easydict.EasyDict', 'EasyDict', (['config_dict'], {}), '(config_dict)\n', (697, 710), False, 'from easydict import EasyDict\n'), ((1096, 1110), 'pprint.pprint', 'pprint', (['config'], {}), '(config)\n', (1102, 1110), False, 'from pprint import pprint\n'), ((1204, 1262), 'os.path.join', 'os.path.join', ([... |
from name_function import get_formated_name
print("Enter Q at any time to quit.")
while True:
first = input("\nPlease give me a first name: ")
if first == 'q':
print("---- FIM DA EXECUÇÃO----")
break
last = input("Please give me a last name: ")
if last == 'q':
print("---- FIM DA... | [
"name_function.get_formated_name"
] | [((372, 402), 'name_function.get_formated_name', 'get_formated_name', (['first', 'last'], {}), '(first, last)\n', (389, 402), False, 'from name_function import get_formated_name\n')] |
# https://asecuritysite.com/encryption/rsa12
from Crypto.Util.number import bytes_to_long, long_to_bytes
from Crypto.Random import get_random_bytes
import Crypto
import libnum
import sys
def encrypt(msg):
bits = 60
if (len(sys.argv) > 1):
msg = str(sys.argv[1])
if (len(sys.argv) > 2):
bit... | [
"libnum.invmod",
"Crypto.Util.number.getPrime",
"Crypto.Util.number.long_to_bytes"
] | [((350, 410), 'Crypto.Util.number.getPrime', 'Crypto.Util.number.getPrime', (['bits'], {'randfunc': 'get_random_bytes'}), '(bits, randfunc=get_random_bytes)\n', (377, 410), False, 'import Crypto\n'), ((419, 479), 'Crypto.Util.number.getPrime', 'Crypto.Util.number.getPrime', (['bits'], {'randfunc': 'get_random_bytes'}),... |
"""
Models
======
"""
import tensorflow as tf
from tensorflow.keras.layers import Input, Dense, Concatenate
def get_actor(state_shape, upper_bound=2.0, verbose=False):
# Initialize weights between -3e-3 and 3-e3
last_init = tf.random_uniform_initializer(minval=-0.003, maxval=0.003)
inputs = Input(shape... | [
"tensorflow.keras.layers.Input",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Model",
"tensorflow.random_uniform_initializer"
] | [((236, 294), 'tensorflow.random_uniform_initializer', 'tf.random_uniform_initializer', ([], {'minval': '(-0.003)', 'maxval': '(0.003)'}), '(minval=-0.003, maxval=0.003)\n', (265, 294), True, 'import tensorflow as tf\n'), ((309, 339), 'tensorflow.keras.layers.Input', 'Input', ([], {'shape': '(state_shape[0],)'}), '(sha... |
import itertools
from pytorch_metric_learning.utils import common_functions as pml_cf
from ..utils import common_functions as c_f
from .base_validator import BaseValidator
class MultipleValidators(BaseValidator):
def __init__(self, validators, weights=None, return_sub_scores=False, **kwargs):
super().__... | [
"itertools.chain",
"pytorch_metric_learning.utils.common_functions.add_to_recordable_attributes"
] | [((599, 667), 'pytorch_metric_learning.utils.common_functions.add_to_recordable_attributes', 'pml_cf.add_to_recordable_attributes', (['self'], {'list_of_names': "['weights']"}), "(self, list_of_names=['weights'])\n", (634, 667), True, 'from pytorch_metric_learning.utils import common_functions as pml_cf\n'), ((790, 814... |
import os
import inspect
from interpret_segmentation.rise import SegmentationRISE
import matplotlib.pyplot as plt
import torch
from testnet.unet import UNet
from testnet.dataset import TestnetDataset
from torchvision import transforms
from pathlib import Path
path = Path(os.path.dirname(os.path.abspath(inspect.getfile... | [
"matplotlib.pyplot.savefig",
"interpret_segmentation.rise.SegmentationRISE",
"pathlib.Path",
"testnet.unet.UNet",
"torch.load",
"inspect.currentframe",
"torch.cuda.is_available",
"testnet.dataset.TestnetDataset",
"torchvision.transforms.Normalize",
"torch.set_grad_enabled",
"matplotlib.pyplot.su... | [((429, 464), 'testnet.unet.UNet', 'UNet', ([], {'in_channels': '(1)', 'out_channels': '(1)'}), '(in_channels=1, out_channels=1)\n', (433, 464), False, 'from testnet.unet import UNet\n'), ((478, 543), 'torch.load', 'torch.load', (["(path / 'testnet' / 'testnet.pth')"], {'map_location': 'device'}), "(path / 'testnet' / ... |
import discord
import aiohttp
import asyncio
import re
from datetime import date, datetime
from functools import partial
from discord.ext import commands
from random import choice
from bs4 import BeautifulSoup
def find_question(text):
soup = BeautifulSoup(text, 'html.parser')
headers = soup.find_all('h3')
... | [
"aiohttp.ClientSession",
"random.choice",
"re.compile",
"bs4.BeautifulSoup",
"functools.partial",
"datetime.date.today",
"asyncio.get_event_loop",
"discord.Embed",
"discord.ext.commands.command"
] | [((247, 281), 'bs4.BeautifulSoup', 'BeautifulSoup', (['text', '"""html.parser"""'], {}), "(text, 'html.parser')\n", (260, 281), False, 'from bs4 import BeautifulSoup\n'), ((331, 346), 'random.choice', 'choice', (['headers'], {}), '(headers)\n', (337, 346), False, 'from random import choice\n'), ((2205, 2223), 'discord.... |
# (C) Copyright 2018-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
"traits.api.Instance",
"traits.api.Str",
"traits.api.observe",
"fizz_buzz_task.submit_fizz_buzz",
"traits_futures.api.TraitsExecutor",
"traits.api.Button",
"traits.api.Bool",
"traitsui.api.UItem"
] | [((829, 853), 'traits.api.Instance', 'Instance', (['TraitsExecutor'], {}), '(TraitsExecutor)\n', (837, 853), False, 'from traits.api import Bool, Button, HasStrictTraits, Instance, observe, Property, Str\n'), ((922, 946), 'traits.api.Instance', 'Instance', (['FizzBuzzFuture'], {}), '(FizzBuzzFuture)\n', (930, 946), Fal... |
from huobi import RequestClient
request_client = RequestClient()
trade_statistics = request_client.get_24h_trade_statistics("btcusdt")
print("---- Statistics ----")
print("Timestamp: " + str(trade_statistics.timestamp))
print("High: " + str(trade_statistics.high))
print("Low: " + str(trade_statistics.low))
print("Ope... | [
"huobi.RequestClient"
] | [((50, 65), 'huobi.RequestClient', 'RequestClient', ([], {}), '()\n', (63, 65), False, 'from huobi import RequestClient\n')] |
#!/usr/bin/env python
#
import unittest
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from iteratorext import *
class IteratorExtTest(unittest.TestCase):
def test_pairwise(self):
it = pairwise([1,2,3,4])
self.assertEqual(next(it), (1,2))
self.assert... | [
"unittest.main",
"os.path.dirname"
] | [((1519, 1545), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1532, 1545), False, 'import unittest\n'), ((92, 117), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n')] |
import logging
import os, sys
sys.path.append(os.getcwd())
import json
from loader.loader import *
from loader.clsfactory import *
import re, glob
logging.basicConfig(level=logging.INFO)
class test(object):
pass
def build_map():
LOCATION = "C:/Users/vaideeswaran_ganesan/work/GitHub/pyopenapi/"
bmap = {}
... | [
"logging.basicConfig",
"os.path.exists",
"json.dumps",
"os.path.join",
"re.match",
"os.getcwd",
"os.path.basename",
"json.load"
] | [((148, 187), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (167, 187), False, 'import logging\n'), ((46, 57), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (55, 57), False, 'import os, sys\n'), ((327, 360), 'os.path.exists', 'os.path.exists', (['"""output/map.js... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 22 15:58:57 2021
@author: javier
"""
import numpy as np
def abs_v(x, y):
return np.abs(x - y)
def quadratic(x, y):
return (x-y) * (x-y)
def square(x, y):
return np.sqrt(abs_v(x, y))
def squarewise(x, y):
return np.abs(np.sqrt(x) ... | [
"numpy.abs",
"numpy.sqrt"
] | [((156, 169), 'numpy.abs', 'np.abs', (['(x - y)'], {}), '(x - y)\n', (162, 169), True, 'import numpy as np\n'), ((368, 389), 'numpy.abs', 'np.abs', (['(x * x - y * y)'], {}), '(x * x - y * y)\n', (374, 389), True, 'import numpy as np\n'), ((309, 319), 'numpy.sqrt', 'np.sqrt', (['x'], {}), '(x)\n', (316, 319), True, 'im... |
import numpy as np
from scipy.spatial import Voronoi
from scipy.spatial import Delaunay
from ..graph import Graph
from ...core.utils import as_id_array
class VoronoiGraph(Graph):
"""Graph of a voronoi grid.
Examples
--------
>>> from landlab.graph import VoronoiGraph
"""
def __init__(self,... | [
"numpy.ptp",
"numpy.where",
"numpy.asarray",
"numpy.count_nonzero",
"numpy.array",
"numpy.empty"
] | [((2043, 2082), 'numpy.array', 'np.array', (['delaunay.simplices'], {'dtype': 'int'}), '(delaunay.simplices, dtype=int)\n', (2051, 2082), True, 'import numpy as np\n'), ((2112, 2151), 'numpy.array', 'np.array', (['delaunay.neighbors'], {'dtype': 'int'}), '(delaunay.neighbors, dtype=int)\n', (2120, 2151), True, 'import ... |
# Created by <NAME> at 2019-07-23
# All right reserved
# Department of Computer Science
# the University of Warwick
# <EMAIL>
import pandas as pd
from dbestclient.io.reservoir import ReservoirSampling
from dbestclient.io.stratifiedreservoir import StratifiedReservoir
class DBEstSampling:
def __init__(self, heade... | [
"dbestclient.io.reservoir.ReservoirSampling",
"dbestclient.io.stratifiedreservoir.StratifiedReservoir"
] | [((1281, 1320), 'dbestclient.io.reservoir.ReservoirSampling', 'ReservoirSampling', ([], {'headers': 'self.headers'}), '(headers=self.headers)\n', (1298, 1320), False, 'from dbestclient.io.reservoir import ReservoirSampling\n'), ((1836, 1875), 'dbestclient.io.reservoir.ReservoirSampling', 'ReservoirSampling', ([], {'hea... |
from rest_framework import status
from rest_framework.response import Response
from account.api.serializers.register_serializers import ChangePasswordSerializer
from utils.general_permissions import NotAuthenticated
from rest_framework.generics import CreateAPIView, UpdateAPIView
from django.contrib.auth import get_use... | [
"django.contrib.auth.get_user_model",
"rest_framework.response.Response",
"django.contrib.auth.update_session_auth_hash"
] | [((472, 488), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (486, 488), False, 'from django.contrib.auth import get_user_model, update_session_auth_hash\n'), ((2398, 2461), 'rest_framework.response.Response', 'Response', (['serializer.errors'], {'status': 'status.HTTP_400_BAD_REQUEST'}), '(s... |
from ciri.utils import ciri_cmd, eor
@ciri_cmd(pattern="ck")
async def chk(e):
await eor(e, "rex gei")
| [
"ciri.utils.ciri_cmd",
"ciri.utils.eor"
] | [((40, 62), 'ciri.utils.ciri_cmd', 'ciri_cmd', ([], {'pattern': '"""ck"""'}), "(pattern='ck')\n", (48, 62), False, 'from ciri.utils import ciri_cmd, eor\n'), ((91, 108), 'ciri.utils.eor', 'eor', (['e', '"""rex gei"""'], {}), "(e, 'rex gei')\n", (94, 108), False, 'from ciri.utils import ciri_cmd, eor\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 25 13:53:40 2017
@author: ratnadeepb
@License: MIT
"""
# System Imports
import numpy as np
import sys
# Local imports
from InnerProductSpaces.dot import dot
from InnerProductSpaces.norm import norm
def angle(u, v, op="radians"):
n_u = norm(u)... | [
"InnerProductSpaces.dot.dot",
"InnerProductSpaces.norm.norm",
"numpy.isnan",
"sys.exit",
"numpy.round"
] | [((313, 320), 'InnerProductSpaces.norm.norm', 'norm', (['u'], {}), '(u)\n', (317, 320), False, 'from InnerProductSpaces.norm import norm\n'), ((331, 338), 'InnerProductSpaces.norm.norm', 'norm', (['v'], {}), '(v)\n', (335, 338), False, 'from InnerProductSpaces.norm import norm\n'), ((839, 852), 'numpy.isnan', 'np.isnan... |
from datetime import datetime
class CurrentMonth:
CURRENT_MONTH = datetime.now().strftime('%B')
CURRENT_MONTH_INT = int(datetime.now().strftime('%m')) | [
"datetime.datetime.now"
] | [((71, 85), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (83, 85), False, 'from datetime import datetime\n'), ((129, 143), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (141, 143), False, 'from datetime import datetime\n')] |
from django.conf import settings
from django.http import JsonResponse, HttpResponseNotFound, HttpResponseRedirect
from django.views.decorators.http import require_GET, require_POST
from urlshortening.models import Url, get_short_url, invalidate_url
@require_POST
def get_short_link(request):
full_url = request.PO... | [
"urlshortening.models.get_short_url",
"django.http.HttpResponseRedirect",
"django.http.JsonResponse",
"django.http.HttpResponseNotFound",
"urlshortening.models.Url._meta.get_field",
"urlshortening.models.invalidate_url",
"urlshortening.models.Url.objects.get"
] | [((607, 630), 'urlshortening.models.get_short_url', 'get_short_url', (['full_url'], {}), '(full_url)\n', (620, 630), False, 'from urlshortening.models import Url, get_short_url, invalidate_url\n'), ((642, 752), 'django.http.JsonResponse', 'JsonResponse', (["{'error': '', 'data': {'short_id': url.short_id, 'short_url_pa... |
from django.urls import path
from . import views
urlpatterns = [
path('', views.news, name='news'),
]
| [
"django.urls.path"
] | [((74, 107), 'django.urls.path', 'path', (['""""""', 'views.news'], {'name': '"""news"""'}), "('', views.news, name='news')\n", (78, 107), False, 'from django.urls import path\n')] |
import os
import json
try:
pyWrkspLoc = os.environ["PYWRKSP"]
except KeyError:
pyWrkspLoc = os.environ["HOME"] + input('Since you do not have the PYWRSKP env var '
'\nPlease enter the pwd for the pyWrskp repo not including the '
... | [
"json.load",
"json.dump"
] | [((3198, 3230), 'json.dump', 'json.dump', (['self.options', 'outfile'], {}), '(self.options, outfile)\n', (3207, 3230), False, 'import json\n'), ((3291, 3326), 'json.dump', 'json.dump', (['self.atturbites', 'outfile'], {}), '(self.atturbites, outfile)\n', (3300, 3326), False, 'import json\n'), ((2153, 2173), 'json.load... |
from glitter.blockadmin import blocks
from .models import SampleModelWithInlinesBlock, SampleInline
class SampleInlineAdmin(blocks.StackedInline):
model = SampleInline
class SampleModelWithInlinesBlockAdmin(blocks.BlockAdmin):
inlines = [SampleInlineAdmin]
blocks.site.register(SampleModelWithInlinesBlock... | [
"glitter.blockadmin.blocks.site.register_block",
"glitter.blockadmin.blocks.site.register"
] | [((272, 359), 'glitter.blockadmin.blocks.site.register', 'blocks.site.register', (['SampleModelWithInlinesBlock', 'SampleModelWithInlinesBlockAdmin'], {}), '(SampleModelWithInlinesBlock,\n SampleModelWithInlinesBlockAdmin)\n', (292, 359), False, 'from glitter.blockadmin import blocks\n'), ((356, 428), 'glitter.block... |
import argparse #to pass location
from threading import Thread
from PIL import Image, ImageDraw, ImageFont
from pathlib import Path
import random
ap = argparse.ArgumentParser(description="Create low-res copies of our data and add random noise to it") #Argument object
ap.add_argument("-l","--location", required = True... | [
"PIL.Image.open",
"argparse.ArgumentParser",
"pathlib.Path",
"PIL.ImageDraw.Draw",
"threading.Thread",
"random.randint"
] | [((153, 257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create low-res copies of our data and add random noise to it"""'}), "(description=\n 'Create low-res copies of our data and add random noise to it')\n", (176, 257), False, 'import argparse\n'), ((1653, 1675), 'pathlib.Path',... |
import unittest
from flask import url_for
from coco import create_app, db
from coco.models.article import Article
from coco.models.comment import Comment
from coco.utils.testing_utils import create_fake_data
class TestCase(unittest.TestCase):
def setUp(self):
self.app = create_app('test')
self.a... | [
"coco.db.create_all",
"coco.db.session.remove",
"coco.models.comment.Comment.get_by_id",
"coco.models.article.Article.get_by_id",
"time.sleep",
"flask.url_for",
"coco.utils.testing_utils.create_fake_data",
"coco.models.comment.Comment.get_latest_by_article_id",
"coco.create_app",
"coco.db.drop_all... | [((287, 305), 'coco.create_app', 'create_app', (['"""test"""'], {}), "('test')\n", (297, 305), False, 'from coco import create_app, db\n'), ((405, 420), 'coco.db.create_all', 'db.create_all', ([], {}), '()\n', (418, 420), False, 'from coco import create_app, db\n'), ((490, 508), 'coco.utils.testing_utils.create_fake_da... |
import json
import typing
import jsonrpcclient as rpc_client
from pycspr.api import constants
from pycspr.client import NodeConnectionInfo
from pycspr.serialisation.json.encoder.deploy import encode_deploy
from pycspr.types import Deploy
def execute(connection_info: NodeConnectionInfo, deploy: Deploy) -> str:
... | [
"pycspr.serialisation.json.encoder.deploy.encode_deploy"
] | [((676, 697), 'pycspr.serialisation.json.encoder.deploy.encode_deploy', 'encode_deploy', (['deploy'], {}), '(deploy)\n', (689, 697), False, 'from pycspr.serialisation.json.encoder.deploy import encode_deploy\n')] |
from cStringIO import StringIO
from ceph_deploy.hosts import remotes
class TestObjectGrep(object):
def setup(self):
self.file_object = StringIO('foo\n')
self.file_object.seek(0)
def test_finds_term(self):
assert remotes.object_grep('foo', self.file_object)
def test_does_not_fin... | [
"ceph_deploy.hosts.remotes.object_grep",
"cStringIO.StringIO"
] | [((151, 168), 'cStringIO.StringIO', 'StringIO', (['"""foo\n"""'], {}), "('foo\\n')\n", (159, 168), False, 'from cStringIO import StringIO\n'), ((249, 293), 'ceph_deploy.hosts.remotes.object_grep', 'remotes.object_grep', (['"""foo"""', 'self.file_object'], {}), "('foo', self.file_object)\n", (268, 293), False, 'from cep... |
from sqlalchemy import Float, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from database import Base
class Courier(Base):
__tablename__ = "couriers"
courier_id = Column(Integer, primary_key=True)
courier_type = Column(String)
regions = Column(String)
working_hours ... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((205, 238), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (211, 238), False, 'from sqlalchemy import Float, Column, ForeignKey, Integer, String\n'), ((258, 272), 'sqlalchemy.Column', 'Column', (['String'], {}), '(String)\n', (264, 272), False, 'from sqlalche... |
import os
def get_fusion(num):
return " --fusion-threshold-mb " + str(int(num)) + " "
def get_ctime(num):
return " --cycle-time-ms " + str(int(num)) + " "
def get_parameter(cycle, fusion):
para_str = ""
if cycle != 0:
para_str = para_str + get_ctime(cycle)
if fusion != 0:
para_str = para_str + ge... | [
"os.system"
] | [((533, 551), 'os.system', 'os.system', (['command'], {}), '(command)\n', (542, 551), False, 'import os\n'), ((688, 706), 'os.system', 'os.system', (['command'], {}), '(command)\n', (697, 706), False, 'import os\n'), ((892, 910), 'os.system', 'os.system', (['command'], {}), '(command)\n', (901, 910), False, 'import os\... |
# 如何利用decimal库来处理小数点问题
# 学习如何使用decimal库来处理小数点
# 文档地址: https://docs.python.org/zh-cn/3/library/decimal.html
value1 = 0.0000223233
print(value1)
value2 =str("0.0000223233")
print(value2)
## 四则运算
from decimal import Decimal, ROUND_UP, ROUND_DOWN
a = Decimal(10)
print(a, type(a))
b = Decimal(10.12) # 二进制方式存储的
prin... | [
"decimal.Decimal"
] | [((255, 266), 'decimal.Decimal', 'Decimal', (['(10)'], {}), '(10)\n', (262, 266), False, 'from decimal import Decimal, ROUND_UP, ROUND_DOWN\n'), ((290, 304), 'decimal.Decimal', 'Decimal', (['(10.12)'], {}), '(10.12)\n', (297, 304), False, 'from decimal import Decimal, ROUND_UP, ROUND_DOWN\n'), ((587, 601), 'decimal.Dec... |
import unittest
M = None
MN = None
MN2 = None
class NestedTest(unittest.TestCase):
"""
Verifies we can create instance from nested proto file.
https://github.com/appnexus/pyrobuf/issues/55
"""
@classmethod
def setUpClass(cls):
global M
global MN
global MN2
fro... | [
"unittest.main",
"test_nested_issue55_proto.M",
"test_nested_issue55_proto.MN2",
"test_nested_issue55_proto.MN"
] | [((606, 621), 'unittest.main', 'unittest.main', ([], {}), '()\n', (619, 621), False, 'import unittest\n'), ((517, 520), 'test_nested_issue55_proto.M', 'M', ([], {}), '()\n', (518, 520), False, 'from test_nested_issue55_proto import M, MN, MN2\n'), ((541, 545), 'test_nested_issue55_proto.MN', 'MN', ([], {}), '()\n', (54... |
from functools import lru_cache
import numpy as np
from .geometry import Circle, Point, Rectangle
def bbox_center(region):
"""Return the center of the bounding box of an scikit-image region.
Parameters
----------
region
A scikit-image region as calculated by skimage.measure.regionprops().
... | [
"numpy.copy",
"numpy.nanstd",
"numpy.nanmedian",
"numpy.deg2rad",
"numpy.nanmax",
"numpy.nanmin",
"functools.lru_cache"
] | [((2158, 2178), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': '(1)'}), '(maxsize=1)\n', (2167, 2178), False, 'from functools import lru_cache\n'), ((1958, 1982), 'numpy.nanmedian', 'np.nanmedian', (['masked_img'], {}), '(masked_img)\n', (1970, 1982), True, 'import numpy as np\n'), ((2130, 2151), 'numpy.nanstd', ... |
import logging
import operator
import random
import requests
import requests.auth
import requests.exceptions
import six.moves.urllib.parse
import threading
import zeep
import zeep.exceptions
import zeep.xsd.elements
import zeep.xsd.elements.indicators
import zeit.content.author.interfaces
import zeit.vgwort.interfaces
... | [
"logging.getLogger",
"requests.auth.HTTPBasicAuth",
"requests.Session",
"zeep.Transport",
"threading.Lock",
"zeep.Client",
"operator.itemgetter",
"random.randint"
] | [((421, 448), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (438, 448), False, 'import logging\n'), ((1132, 1148), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1146, 1148), False, 'import threading\n'), ((1167, 1185), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1... |
from __future__ import division
import unittest
import warnings
import networkx as nx
import dwave_networkx as dnx
alpha_map = dict(enumerate('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'))
class TestPegasusGraph(unittest.TestCase):
def test_p2(self):
G = dnx.pegasus_graph(2, fabric_only=False... | [
"dwave_networkx.pegasus_graph",
"dwave_networkx.elimination_order_width",
"warnings.catch_warnings",
"dwave_networkx.generators.pegasus.pegasus_elimination_order",
"networkx.connected_components",
"warnings.simplefilter",
"dwave_networkx.generators.pegasus.pegasus_coordinates"
] | [((282, 321), 'dwave_networkx.pegasus_graph', 'dnx.pegasus_graph', (['(2)'], {'fabric_only': '(False)'}), '(2, fabric_only=False)\n', (299, 321), True, 'import dwave_networkx as dnx\n'), ((1628, 1667), 'dwave_networkx.pegasus_graph', 'dnx.pegasus_graph', (['(4)'], {'fabric_only': '(False)'}), '(4, fabric_only=False)\n'... |
from datetime import datetime, date
import django.test
from contracts.models import Contract, Entity, ProcedureType
from contracts.views_data import *
from contracts.views_analysis import ANALYSIS
class TestAnalysis(django.test.TestCase):
def test_contracts_price_histogram(self):
Contract.objects.creat... | [
"contracts.models.Entity.objects.create",
"datetime.datetime",
"contracts.models.ProcedureType.objects.create",
"datetime.date.today",
"contracts.models.Contract.objects.all"
] | [((1855, 1912), 'contracts.models.Entity.objects.create', 'Entity.objects.create', ([], {'name': '"""test1"""', 'base_id': '(1)', 'nif': '"""nif"""'}), "(name='test1', base_id=1, nif='nif')\n", (1876, 1912), False, 'from contracts.models import Contract, Entity, ProcedureType\n'), ((1926, 1983), 'contracts.models.Entit... |
import operator
import unittest
import cyordereddict
class TestOrderedDict(unittest.TestCase):
def setUp(self):
data = [('x', 0), ('y', 1), ('z', 2)]
self.dicts = []
try:
import collections
self.dicts.append(collections.OrderedDict(data))
except AttributeEr... | [
"collections.OrderedDict",
"cyordereddict.OrderedDict"
] | [((393, 424), 'cyordereddict.OrderedDict', 'cyordereddict.OrderedDict', (['data'], {}), '(data)\n', (418, 424), False, 'import cyordereddict\n'), ((263, 292), 'collections.OrderedDict', 'collections.OrderedDict', (['data'], {}), '(data)\n', (286, 292), False, 'import collections\n')] |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY') or 'somesecretkey'
LAZYLOAD_LDA = False
ALLOW_ANON = True
DEFAULT_LDA_MODEL = 'Demo'
DEFAULT_DB = 'Demo Keyword-based Model'
# Flask-Uploads configs - used in /app/__init__.p... | [
"os.path.join",
"os.path.dirname",
"os.environ.get"
] | [((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import os\n'), ((96, 124), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (110, 124), False, 'import os\n'), ((423, 461), 'os.environ.get', 'os.environ.get', (['"""UPLOADED_PAPERS... |
"""
Contains application edit handlers.
"""
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.urls import reverse
from django.contrib.admin.utils import quote
from django.utils.translation import ugettext... | [
"wagtail.wagtailimages.edit_handlers.ImageChooserPanel",
"django.utils.translation.ugettext_lazy",
"django.template.loader.render_to_string",
"django.contrib.admin.utils.quote"
] | [((3237, 3260), 'django.utils.translation.ugettext_lazy', 'ugettext_lazy', (['"""Images"""'], {}), "('Images')\n", (3250, 3260), False, 'from django.utils.translation import ugettext_lazy\n'), ((2255, 2295), 'django.template.loader.render_to_string', 'render_to_string', (['self.template', 'context'], {}), '(self.templa... |
import tkinter.ttk
from PIL import Image, ImageTk
import PIL.Image
from resizeimage import resizeimage
from tkinter import *
from tkinter import filedialog
# make Windows
root = Tk()
root.geometry('320x480')
root.title('Image Converter')
root.config(bg="#ffffff")
# set image on background
image = PIL.Im... | [
"tkinter.filedialog.askopenfilename",
"resizeimage.resizeimage.resize_cover",
"PIL.ImageTk.PhotoImage"
] | [((349, 374), 'PIL.ImageTk.PhotoImage', 'ImageTk.PhotoImage', (['image'], {}), '(image)\n', (367, 374), False, 'from PIL import Image, ImageTk\n'), ((1677, 1805), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'initialdir': '"""/"""', 'title': '"""Select a File"""', 'filetypes': "(('JPG File'... |
import json
import pathlib
import posixpath
import airflow
import requests
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator
from airflow.hooks.base_hook import BaseHook
from airflow.operators.bash_operator import BaseOperator
from airflow.contrib.hooks.gcs_hook import GoogleCl... | [
"posixpath.join",
"pathlib.Path",
"requests.get",
"airflow.contrib.hooks.gcs_hook.GoogleCloudStorageHook",
"airflow.utils.dates.days_ago",
"airflow.models.DAG"
] | [((423, 588), 'airflow.models.DAG', 'DAG', ([], {'dag_id': '"""download_rocket_launches"""', 'default_args': 'args', 'description': '"""DAG downloading rocket launches from Launch Library."""', 'schedule_interval': '"""0 0 * * *"""'}), "(dag_id='download_rocket_launches', default_args=args, description=\n 'DAG downl... |
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--model", type=str)
parser.add_argument("--data_dir", type=str)
args = parser.parse_args()
for file in os.listdir(args.data_dir):
cmd = 'python scripts/evaluate_feats.py '
if 'test' in file:
cmd += ' --reference ' + os.p... | [
"os.listdir",
"os.path.join",
"argparse.ArgumentParser"
] | [((36, 61), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (59, 61), False, 'import argparse\n'), ((187, 212), 'os.listdir', 'os.listdir', (['args.data_dir'], {}), '(args.data_dir)\n', (197, 212), False, 'import os\n'), ((316, 349), 'os.path.join', 'os.path.join', (['args.data_dir', 'file'], {}... |
"""
mem_check.py
functions for getting memoroy use of the current python process
Downloaded from: http://pythonchb.github.io/PythonTopics/weak_references.html
Windows and *nix versions
USAGE:
amount = get_mem_use(units='MB') # options are KB, MB, GB
"""
import sys
div = {'GB': 1024*1024*1024,
... | [
"ctypes.WinError",
"ctypes.byref",
"ctypes.POINTER",
"resource.getrusage",
"sys.platform.startswith",
"ctypes.sizeof"
] | [((380, 410), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (403, 410), False, 'import sys\n'), ((1668, 1710), 'ctypes.POINTER', 'ctypes.POINTER', (['PROCESS_MEMORY_COUNTERS_EX'], {}), '(PROCESS_MEMORY_COUNTERS_EX)\n', (1682, 1710), False, 'import ctypes\n'), ((2196, 2218), 'ct... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('smsbillables', '0010_gateway_fee_amount_null'),
]
operations = [
migrations.AlterField(
model_name='smsbillable',
name='date_created',
field=models.DateT... | [
"django.db.models.DateTimeField"
] | [((308, 347), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (328, 347), False, 'from django.db import migrations, models\n'), ((512, 534), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (532, 534), False, 'from django.db... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
###AWG
sys.path.append('/home/pulseepr/Sources/AWG/Examples/python')
###sys.path.append('/home/anatoly/AWG/spcm_examples/python')
##sys.path.append('/home/anatoly/awg_files/python')
#sys.path.append('C:/Users/User/Desktop/Examples/python')
import nump... | [
"numpy.average",
"os.path.join",
"os.getcwd",
"os.path.dirname",
"numpy.zeros",
"numpy.sum",
"atomize.general_modules.general_functions.message",
"sys.exit",
"sys.path.append",
"atomize.device_modules.config.config_utils.read_specific_parameters"
] | [((76, 137), 'sys.path.append', 'sys.path.append', (['"""/home/pulseepr/Sources/AWG/Examples/python"""'], {}), "('/home/pulseepr/Sources/AWG/Examples/python')\n", (91, 137), False, 'import sys\n'), ((651, 676), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (666, 676), False, 'import os\n'), ... |
import json
from lib.components import shared
from lib.components.data import shared as shared_data
class _CPUFrequencyData(shared_data.MonitoringShim):
UNIT = 'hz'
def FromEngine(self) -> shared.ConfigType:
query = sum([
[
'DEF:cpu{core}={root}/cpufreq/cpufreq-{core}.rrd:value:AVERAGE'.f... | [
"lib.components.data.shared.get_core_count"
] | [((486, 514), 'lib.components.data.shared.get_core_count', 'shared_data.get_core_count', ([], {}), '()\n', (512, 514), True, 'from lib.components.data import shared as shared_data\n')] |
import hashlib
import pdb
from django.template import TemplateDoesNotExist
from django.template.loaders.cached import Loader as DjangoCachedLoader
from django.utils.encoding import force_bytes
from django_mobile import get_flavour
from django_mobile.compat import BaseLoader, template_from_string, template_loader
from... | [
"django_mobile.get_flavour",
"django_mobile.compat.template_loader"
] | [((2464, 2477), 'django_mobile.get_flavour', 'get_flavour', ([], {}), '()\n', (2475, 2477), False, 'from django_mobile import get_flavour\n'), ((1428, 1441), 'django_mobile.get_flavour', 'get_flavour', ([], {}), '()\n', (1439, 1441), False, 'from django_mobile import get_flavour\n'), ((1828, 1856), 'django_mobile.compa... |
import dash_html_components as html
TEXT = html.Div(
[
html.P(
"We used two kinds of attention maps: saliency maps and Grad-RAM (Gradient-weighted Regression Activation Mapping) to identify which regions and features were driving the prediction for each image."
)
],
style={
... | [
"dash_html_components.P"
] | [((69, 285), 'dash_html_components.P', 'html.P', (['"""We used two kinds of attention maps: saliency maps and Grad-RAM (Gradient-weighted Regression Activation Mapping) to identify which regions and features were driving the prediction for each image."""'], {}), "(\n 'We used two kinds of attention maps: saliency ma... |
from django.conf.urls import url
from django.conf.urls import include
from django.urls import path
from rest_framework.routers import DefaultRouter
from . import views
router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
#In case of ModelSerializer, no need to pass ... | [
"django.conf.urls.include",
"rest_framework.routers.DefaultRouter"
] | [((179, 194), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (192, 194), False, 'from rest_framework.routers import DefaultRouter\n'), ((535, 555), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (542, 555), False, 'from django.conf.urls import include\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.4'
# jupytext_version: 1.1.5
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# # s_ga... | [
"scipy.stats.gamma.cdf",
"matplotlib.pyplot.grid",
"scipy.stats.gamma.rvs",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xticks",
"numpy.ones",
"arpym.tools.add_logo",
"numpy.log",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.yticks",
... | [((1087, 1121), 'scipy.stats.gamma.rvs', 'stats.gamma.rvs', (['k', 'theta'], {'size': 'j_'}), '(k, theta, size=j_)\n', (1102, 1121), True, 'import scipy.stats as stats\n'), ((1266, 1294), 'scipy.stats.gamma.cdf', 'stats.gamma.cdf', (['x', 'k', 'theta'], {}), '(x, k, theta)\n', (1281, 1294), True, 'import scipy.stats as... |
import pandas as pd
from re import findall
from sklearn.utils import shuffle
data = pd.read_csv('Trafficking_Data.csv')
urls = data['url'].tolist()
regional_data = []
category_data = []
def extract_region(list_of_urls):
for strings in list_of_urls:
regdata = findall('http://([A-Za-z]+).', strings)[0]
region... | [
"sklearn.utils.shuffle",
"re.findall",
"pandas.read_csv"
] | [((87, 122), 'pandas.read_csv', 'pd.read_csv', (['"""Trafficking_Data.csv"""'], {}), "('Trafficking_Data.csv')\n", (98, 122), True, 'import pandas as pd\n'), ((641, 654), 'sklearn.utils.shuffle', 'shuffle', (['data'], {}), '(data)\n', (648, 654), False, 'from sklearn.utils import shuffle\n'), ((269, 308), 're.findall',... |
import uuid
from django.db import models
FLAVOR_TYPES = (
('ovh.ssd.eg', 'ovh.ssd.eg'),
('ovh.ssd.cpu', 'ovh.ssd.cpu'),
('ovh.ceph.eg', 'ovh.ceph.eg'),
('ovh.cpu', 'ovh.cpu'),
('ovh.ssd.ram', 'ovh.ssd.ram'),
('ovh.vps-ssd', 'ovh.vps-ssd'),
('ovh.ram', 'ovh.ram'),
)
OS_TYPES = (
('linux'... | [
"django.db.models.GenericIPAddressField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.CharField",
"django.db.models.DateTimeField",
"django.db.models.PositiveSmallIn... | [((683, 732), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)', 'primary_key': '(True)'}), '(max_length=30, primary_key=True)\n', (699, 732), False, 'from django.db import models\n'), ((773, 822), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(32)', 'primary_key': '(... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-17 15:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0001_initial'),
]
operations = [
migrations.AlterField(
... | [
"django.db.models.DateField",
"django.db.models.CharField"
] | [((392, 431), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (408, 431), False, 'from django.db import migrations, models\n'), ((569, 623), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(20)', 'null'... |
# Copyright (C) 2020 Georgia Tech Center for Experimental Research in Computer
# Systems
import random
import string
import time
import unittest
from buzzblog.gen.ttypes import *
from buzzblog.account_client import Client as AccountClient
from buzzblog.follow_client import Client as FollowClient
IP_ADDRESS = "local... | [
"random.choice",
"time.sleep",
"buzzblog.account_client.Client",
"unittest.main",
"buzzblog.follow_client.Client",
"time.time"
] | [((9386, 9401), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9399, 9401), False, 'import unittest\n'), ((452, 472), 'random.choice', 'random.choice', (['chars'], {}), '(chars)\n', (465, 472), False, 'import random\n'), ((606, 645), 'buzzblog.account_client.Client', 'AccountClient', (['IP_ADDRESS', 'ACCOUNT_PORT... |
import math
import os
import random
import re
import sys
from dateutil import parser
# Complete the time_delta function below.
def time_delta(t1, t2):
t1 = parser.parse(t1)
t2 = parser.parse(t2)
return str(int(abs((t1 - t2).total_seconds())))
if __name__ == '__main__':
fptr = open(os.environ['OUTPUT_... | [
"dateutil.parser.parse"
] | [((162, 178), 'dateutil.parser.parse', 'parser.parse', (['t1'], {}), '(t1)\n', (174, 178), False, 'from dateutil import parser\n'), ((188, 204), 'dateutil.parser.parse', 'parser.parse', (['t2'], {}), '(t2)\n', (200, 204), False, 'from dateutil import parser\n')] |
#!/bin/env python
# -*- coding: utf-8 -*-
##
# test_solvers.py: Checks correctness of azure.quantum.optimization module.
##
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
##
import pytest
from asyncmock import AsyncMock, patch, Mock
from azure.quantum.aio.optimization imp... | [
"numpy.savez",
"common.expected_terms",
"asyncmock.Mock",
"os.path.isfile",
"azure.quantum.aio.optimization.Problem",
"numpy.array",
"azure.quantum.optimization.Term",
"asyncmock.AsyncMock",
"asyncmock.patch",
"pytest.raises",
"pytest.fixture",
"numpy.load",
"os.remove"
] | [((685, 701), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (699, 701), False, 'import pytest\n'), ((564, 575), 'asyncmock.AsyncMock', 'AsyncMock', ([], {}), '()\n', (573, 575), False, 'from asyncmock import AsyncMock, patch, Mock\n'), ((608, 660), 'asyncmock.AsyncMock', 'AsyncMock', ([], {'return_value': '"""m... |
from django.db import models
from djorm_pgarray.fields import ArrayField
from .base import CommonBase, LinkBase
from .divisions import Division
class Jurisdiction(CommonBase):
id = models.CharField(max_length=500, primary_key=True)
name = models.CharField(max_length=300)
url = models.URLField()
featu... | [
"djorm_pgarray.fields.ArrayField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((188, 238), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(500)', 'primary_key': '(True)'}), '(max_length=500, primary_key=True)\n', (204, 238), False, 'from django.db import models\n'), ((250, 282), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)'}), '(max_length... |
import logging
import tkinter as tk
logger = logging.getLogger(__name__)
class Chronometer(tk.Label):
'''Class which implements a chronometer'''
def __init__(self, root, controller):
self.root = root
self.controller = controller
self.time_displayed = tk.StringVar(value='0') # the d... | [
"logging.getLogger",
"tkinter.StringVar"
] | [((49, 76), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (66, 76), False, 'import logging\n'), ((288, 311), 'tkinter.StringVar', 'tk.StringVar', ([], {'value': '"""0"""'}), "(value='0')\n", (300, 311), True, 'import tkinter as tk\n')] |
# Copyright (c) 2013 - 2019 <NAME> and Contributors.
# This file is part of YAWAST which is released under the MIT license.
# See the LICENSE file or go to https://yawast.org/license/ for full license details.
from unittest import TestCase
from tests import utils
from yawast.scanner.plugins.dns import dnssec
from ... | [
"yawast.shared.output.setup",
"yawast.scanner.plugins.dns.dnssec.get_dnskey",
"tests.utils.capture_sys_output"
] | [((425, 458), 'yawast.shared.output.setup', 'output.setup', (['(False)', '(False)', '(False)'], {}), '(False, False, False)\n', (437, 458), False, 'from yawast.shared import output\n'), ((796, 829), 'yawast.shared.output.setup', 'output.setup', (['(False)', '(False)', '(False)'], {}), '(False, False, False)\n', (808, 8... |
from datetime import datetime, date, timedelta
import pytest
from track.selectors import (
get_active_record,
get_elapsed_time,
get_elapsed_time_per_category,
get_entries_per_day,
get_entries_per_week,
)
from . import factories
@pytest.mark.django_db
def test_get_active_record_all_stopped():
... | [
"datetime.datetime",
"track.selectors.get_elapsed_time_per_category",
"track.selectors.get_entries_per_week",
"track.selectors.get_active_record",
"pytest.mark.parametrize",
"datetime.datetime.now",
"datetime.datetime.timestamp",
"datetime.date",
"track.selectors.get_elapsed_time",
"datetime.timed... | [((9411, 9466), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""with_category"""', '[False, True]'], {}), "('with_category', [False, True])\n", (9434, 9466), False, 'import pytest\n'), ((376, 395), 'track.selectors.get_active_record', 'get_active_record', ([], {}), '()\n', (393, 395), False, 'from track.sel... |
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
"""
Basic imageload example script
adapted for use on MagTag.
"""
import time
import board
import displayio
import adafruit_imageload
# use built in display (PyPortal, PyGamer, PyBadge, CLUE, etc.)
# see guide for setting up... | [
"displayio.Group",
"displayio.TileGrid",
"time.sleep",
"adafruit_imageload.load"
] | [((540, 575), 'time.sleep', 'time.sleep', (['display.time_to_refresh'], {}), '(display.time_to_refresh)\n', (550, 575), False, 'import time\n'), ((594, 647), 'adafruit_imageload.load', 'adafruit_imageload.load', (['"""images/magtag_2x2_test.bmp"""'], {}), "('images/magtag_2x2_test.bmp')\n", (617, 647), False, 'import a... |
# Author: <NAME>
# Purpose: Return the uploded data with some basic preprocessing
import pandas as pd
from sklearn.preprocessing import LabelEncoder, StandardScaler, OrdinalEncoder
def retProcessedData(df):
#df=pd.read_csv('insurance.csv')
# ************ Drop rows and columns with null values ***... | [
"sklearn.preprocessing.OrdinalEncoder"
] | [((582, 598), 'sklearn.preprocessing.OrdinalEncoder', 'OrdinalEncoder', ([], {}), '()\n', (596, 598), False, 'from sklearn.preprocessing import LabelEncoder, StandardScaler, OrdinalEncoder\n')] |
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# 같은 경로에 chromedriver.exe가 위치해야 함
driver = webdriver.Chrome('chromedriver.exe')
driver.get('http://investing.com/indices/us... | [
"selenium.webdriver.Chrome",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.support.expected_conditions.presence_of_element_located"
] | [((240, 276), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""chromedriver.exe"""'], {}), "('chromedriver.exe')\n", (256, 276), False, 'from selenium import webdriver\n'), ((440, 464), 'selenium.webdriver.support.ui.WebDriverWait', 'WebDriverWait', (['driver', '(3)'], {}), '(driver, 3)\n', (453, 464), False, 'fr... |