code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# import the flask library
from flask import Flask
from config import Config
# configure an object of class Flask with __name__
app = Flask(__name__)
app.config.from_object(Config)
# here app is a package not to be confused with directory app
from app import routes
| [
"flask.Flask"
] | [((135, 150), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (140, 150), False, 'from flask import Flask\n')] |
# -*- coding: utf-8 -*-
r""" Manipulate posteriors of Bernoulli/Beta experiments., for discounted Bayesian policies (:class:`Policies.DiscountedBayesianIndexPolicy`).
"""
from __future__ import division, print_function # Python 2 compatibility
__author__ = "<NAME>"
__version__ = "0.9"
# Local imports
try:
from .... | [
"scipy.special.btdtri",
"Beta.bernoulliBinarization",
"random.betavariate"
] | [((2623, 2676), 'random.betavariate', 'betavariate', (['(self._a + self.N[1])', '(self._b + self.N[0])'], {}), '(self._a + self.N[1], self._b + self.N[0])\n', (2634, 2676), False, 'from random import betavariate\n'), ((2906, 2957), 'scipy.special.btdtri', 'btdtri', (['(self._a + self.N[1])', '(self._b + self.N[0])', 'p... |
import turtle as player
wn = player.Screen()
wn.title("disney level animation")
wn.bgcolor("Black")
#create new shapes
wn.register_shape("invader.gif")
wn.register_shape("invader2.gif")
player.shape("invader.gif")
player.frame = 0
#copying the video
player.frames = ["invader.gif", "invader2.gif"]
def playe... | [
"turtle.shape",
"turtle.Screen"
] | [((33, 48), 'turtle.Screen', 'player.Screen', ([], {}), '()\n', (46, 48), True, 'import turtle as player\n'), ((193, 220), 'turtle.shape', 'player.shape', (['"""invader.gif"""'], {}), "('invader.gif')\n", (205, 220), True, 'import turtle as player\n'), ((417, 458), 'turtle.shape', 'player.shape', (['player.frames[playe... |
# Mockup of a plan:
#
# Keyboard buttons:
# get my id
# if in family -> leave family
# if in family and is_family_creator -> invite a person by id | kick a person
# if not in family -> create a family | join a family
#
# Database
# user -> user_id | family_id
# family -> family_id | user_list | creator_id
# bills ->... | [
"aiogram.executor.start_polling",
"markups.single_button",
"aiogram.types.InlineKeyboardMarkup",
"markups.get_markup_start",
"aiogram.contrib.fsm_storage.memory.MemoryStorage",
"state_handler.InviteToFamily.invited_id.set",
"aiogram.Dispatcher",
"state_handler.changeName.name.set",
"user.user_exists... | [((825, 851), 'sqlite3.connect', 'sqlite3.connect', (['"""data.db"""'], {}), "('data.db')\n", (840, 851), False, 'import sqlite3\n'), ((1392, 1407), 'aiogram.contrib.fsm_storage.memory.MemoryStorage', 'MemoryStorage', ([], {}), '()\n', (1405, 1407), False, 'from aiogram.contrib.fsm_storage.memory import MemoryStorage\n... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import socket
from maro.communication import Proxy
def get_random_port():
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as temp_socket:
temp_socket.bind(("", 0))
random_port = temp_socket.getsockname()[1]
retu... | [
"maro.communication.Proxy",
"socket.socket"
] | [((743, 870), 'maro.communication.Proxy', 'Proxy', ([], {'component_type': 'component_type', 'expected_peers': 'component_type_expected_peers_map[component_type]'}), '(component_type=component_type, expected_peers=\n component_type_expected_peers_map[component_type], **proxy_parameters)\n', (748, 870), False, 'from ... |
"""
This code validates the performance of VGG16 after L-OBS prunning
"""
import torch
import torch.backends.cudnn as cudnn
import torchvision.datasets as datasets
import torchvision.transforms as transforms
from models.vgg import vgg16_bn
from utils import validate, adjust_mean_var
import numpy as np
import os
f... | [
"numpy.load",
"torch.cuda.device_count",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torch.load",
"os.path.exists",
"utils.adjust_mean_var",
"torch.FloatTensor",
"torchvision.transforms.CenterCrop",
"datetime.datetime.now",
"models.vgg.vgg16_bn",
"torchvision.transforms... | [((361, 386), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (384, 386), False, 'import torch\n'), ((1590, 1600), 'models.vgg.vgg16_bn', 'vgg16_bn', ([], {}), '()\n', (1598, 1600), False, 'from models.vgg import vgg16_bn\n'), ((1691, 1722), 'torch.load', 'torch.load', (['pretrain_model_path'], ... |
from flask import Flask, render_template, jsonify, request, url_for
from shapely.geometry import Point as Shapely_point, mapping
from geojson import Point as Geoj_point, Polygon as Geoj_polygon, Feature, FeatureCollection
from datetime import datetime
from sqlalchemy import *
import pandas as pd
import geopandas as gpd... | [
"datetime.datetime.strftime",
"pandas.DataFrame",
"netCDF4.Dataset",
"numpy.dstack",
"flask.request.args.get",
"flask.Flask",
"numpy.append",
"datetime.datetime.strptime",
"flask.jsonify",
"numpy.reshape",
"flask.render_template",
"pandas.concat",
"os.listdir"
] | [((2025, 2082), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['updatedDtStr', '"""%Y%m%d_%H%M%S"""'], {}), "(updatedDtStr, '%Y%m%d_%H%M%S')\n", (2051, 2082), False, 'import datetime\n'), ((2101, 2157), 'datetime.datetime.strftime', 'datetime.datetime.strftime', (['updatedDt', '"""%Y-%m-%dT%H%M%S"""'], {... |
# -*- 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 numpy as np
import pandas as pd
from pandapower.shortcircuit.idx_brch import IKSS_F, IKSS_T, IP_F, IP_T, ITH_F, ITH... | [
"pandas.MultiIndex.from_product",
"numpy.nan_to_num"
] | [((5733, 5812), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_product', (['[net.res_line_sc.index, bus]'], {'names': "['line', 'bus']"}), "([net.res_line_sc.index, bus], names=['line', 'bus'])\n", (5759, 5812), True, 'import pandas as pd\n'), ((7392, 7477), 'pandas.MultiIndex.from_product', 'pd.MultiIndex.from_... |
from django.db import models
from app.models.user import User
class Vehicle(models.Model):
user = models.ForeignKey(User, null=True)
plate = models.CharField(max_length=255, blank=False)
brand = models.CharField(max_length=255, blank=False)
name = models.CharField(max_length=255, blank=False)
col... | [
"django.db.models.ForeignKey",
"django.db.models.CharField"
] | [((104, 138), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'null': '(True)'}), '(User, null=True)\n', (121, 138), False, 'from django.db import models\n'), ((152, 197), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(False)'}), '(max_length=255, blank=False)\... |
import threading
import DobotDllType as dType
CON_STR = {
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
dType.DobotConnect.DobotConnect_NotFound: "DobotConnect_NotFound",
dType.DobotConnect.DobotConnect_Occupied: "DobotConnect_Occupied"}
#Load Dll
api = dType.load()
#Connec... | [
"DobotDllType.ConnectDobot",
"DobotDllType.SetHOMECmd",
"DobotDllType.SetPTPCommonParams",
"DobotDllType.dSleep",
"DobotDllType.SetPTPJointParams",
"DobotDllType.GetQueuedCmdCurrentIndex",
"DobotDllType.SetPTPCmd",
"DobotDllType.SetQueuedCmdStartExec",
"DobotDllType.SetQueuedCmdStopExec",
"DobotDl... | [((297, 309), 'DobotDllType.load', 'dType.load', ([], {}), '()\n', (307, 309), True, 'import DobotDllType as dType\n'), ((1431, 1457), 'DobotDllType.DisconnectDobot', 'dType.DisconnectDobot', (['api'], {}), '(api)\n', (1452, 1457), True, 'import DobotDllType as dType\n'), ((337, 372), 'DobotDllType.ConnectDobot', 'dTyp... |
from django.shortcuts import render
from libs.http import render_json
from vip.models import Vip
def info(request):
vip_info = []
for vip in Vip.objects.exclude(level=0).order_by('level'):
v_info = vip.to_dict()
v_info['perms'] = []
for perm in vip.perms:
v_info['perms']... | [
"vip.models.Vip.objects.exclude",
"libs.http.render_json"
] | [((389, 415), 'libs.http.render_json', 'render_json', ([], {'data': 'vip_info'}), '(data=vip_info)\n', (400, 415), False, 'from libs.http import render_json\n'), ((153, 181), 'vip.models.Vip.objects.exclude', 'Vip.objects.exclude', ([], {'level': '(0)'}), '(level=0)\n', (172, 181), False, 'from vip.models import Vip\n'... |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import absolute_import, division, print_function, unicode_literals
import os
from pants.backend.native.config.environment import HostLibcDev
from pants.bac... | [
"pants.backend.native.subsystems.utils.parse_search_dirs.ParseSearchDirs.scoped",
"pants.backend.native.subsystems.utils.parse_search_dirs.ParseSearchDirs.scoped_instance",
"os.path.isfile",
"pants.base.hash_utils.hash_file",
"os.path.join"
] | [((1642, 1679), 'pants.backend.native.subsystems.utils.parse_search_dirs.ParseSearchDirs.scoped_instance', 'ParseSearchDirs.scoped_instance', (['self'], {}), '(self)\n', (1673, 1679), False, 'from pants.backend.native.subsystems.utils.parse_search_dirs import ParseSearchDirs\n'), ((3283, 3344), 'os.path.join', 'os.path... |
import numpy as np
import ipyvolume as ipv
import h5py
import os
import matplotlib.pyplot as plt
import sys
from tqdm import tqdm
kinect_dir = '../dataset/kinect/'
dir = '../dataset/data/'
kinect_files = os.listdir(kinect_dir)
missing_file_count = 0
def get_vibe_dir(x):
x1 = x[16,:] - x[0,:]
x2 = x[17,:] - x... | [
"numpy.save",
"numpy.sum",
"numpy.zeros",
"numpy.cross",
"numpy.array",
"os.path.join",
"os.listdir"
] | [((206, 228), 'os.listdir', 'os.listdir', (['kinect_dir'], {}), '(kinect_dir)\n', (216, 228), False, 'import os\n'), ((337, 353), 'numpy.cross', 'np.cross', (['x1', 'x2'], {}), '(x1, x2)\n', (345, 353), True, 'import numpy as np\n'), ((439, 455), 'numpy.cross', 'np.cross', (['x1', 'x2'], {}), '(x1, x2)\n', (447, 455), ... |
# %% [markdown]
# #
import os
import pickle
import warnings
from operator import itemgetter
from pathlib import Path
from timeit import default_timer as timer
import colorcet as cc
import community as cm
import matplotlib.colors as mplc
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import p... | [
"os.remove",
"numpy.random.seed",
"src.io.savefig",
"src.io.saveskels",
"src.graph.MetaGraph",
"igraph.Graph.Read_GraphML",
"numpy.random.randint",
"numpy.unique",
"src.graph.preprocess",
"matplotlib.pyplot.close",
"seaborn.set_context",
"numpy.vectorize",
"os.path.basename",
"src.visualiz... | [((1392, 1415), 'numpy.random.seed', 'np.random.seed', (['(9812343)'], {}), '(9812343)\n', (1406, 1415), True, 'import numpy as np\n'), ((1416, 1439), 'seaborn.set_context', 'sns.set_context', (['"""talk"""'], {}), "('talk')\n", (1431, 1439), True, 'import seaborn as sns\n'), ((2069, 2118), 'src.data.load_metagraph', '... |
import os
import shutil
import argparse
import datetime
import tensorflow as tf
import model
from get_dataset import get_dataset
from visualizer import Visualizer
tf.enable_eager_execution()
parser = argparse.ArgumentParser(description='Stochastic Gradient Langevin Dynamics')
parser.add_argument('--hparams', type=s... | [
"tensorflow.contrib.summary.scalar",
"tensorflow.contrib.training.HParams",
"datetime.datetime.today",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.isdir",
"tensorflow.convert_to_tensor",
"tensorflow.train.get_or_create_global_step",
"model.SGLD_LR",
"tensorflow.set_random_seed",
"tensorfl... | [((166, 193), 'tensorflow.enable_eager_execution', 'tf.enable_eager_execution', ([], {}), '()\n', (191, 193), True, 'import tensorflow as tf\n'), ((204, 280), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Stochastic Gradient Langevin Dynamics"""'}), "(description='Stochastic Gradient La... |
# Written by <NAME>, Seoul National University (<EMAIL>)
# Some parts of the code were referenced from or inspired by below
# - <NAME>'s code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" MLP model classes and functions """
import torch
import torch.nn as nn
import torch.nn.functional as... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.functional.softmax",
"torch.nn.Linear",
"torch.device"
] | [((506, 529), 'torch.nn.Dropout', 'nn.Dropout', (['cfg.dropout'], {}), '(cfg.dropout)\n', (516, 529), True, 'import torch.nn as nn\n'), ((550, 559), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (557, 559), True, 'import torch.nn as nn\n'), ((695, 735), 'torch.nn.Linear', 'nn.Linear', (['cfg.input_dim', 'cfg.hidden_dim... |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"new_semantic_parsing.utils.set_seed",
"new_semantic_parsing.utils.get_required_example_ids",
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.basename",
"os.makedirs",
"random.shuffle",
"new_semantic_parsing.data.make_dataset",
"os.path.exists",
"new_semantic_parsing.utils.get_model_typ... | [((1135, 1295), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s | %(levelname)s | %(name)s | %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""', 'level': 'logging.INFO', 'stream': 'sys.stdout'}), "(format=\n '%(asctime)s | %(levelname)s | %(name)s | %(message)s', datefmt=\n '%Y-%m... |
import numpy as np
from Redbox_v2 import file_manager as fm
import pandas as pd
from scipy.fftpack import rfft, rfftfreq
import matplotlib.pyplot as plt
import os
import math
def rms_time_dom(signal):
N = len(signal)
return math.sqrt(np.sum(np.power(signal,2))/N)
def rms_freq_dom(amplitude):... | [
"matplotlib.pyplot.title",
"scipy.fftpack.rfft",
"numpy.amin",
"numpy.argmax",
"numpy.logspace",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.pad",
"numpy.fft.fft",
"numpy.power",
"numpy.linspace",
"numpy.fft.ifft",
"numpy.trapz",
"matplotlib.pyplot.show",
"numpy.log... | [((701, 712), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (709, 712), True, 'import numpy as np\n'), ((1015, 1037), 'numpy.delete', 'np.delete', (['maximums', '(0)'], {}), '(maximums, 0)\n', (1024, 1037), True, 'import numpy as np\n'), ((1467, 1483), 'numpy.zeros', 'np.zeros', (['[1, 2]'], {}), '([1, 2])\n', (14... |
# Copyright 2021 The FastEstimator 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 appl... | [
"fastestimator.op.numpyop.univariate.ColorJitter",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.layers.LeakyReLU",
"tensorflow.matmul",
"fastestimator.dataset.data.cifair10.load_data",
"tensorflow.keras.layers.MaxPool2D",
"fastestimator.trace.io.ModelSaver",
"fastestimator.build",
"tensorflow.... | [((2222, 2252), 'tensorflow.keras.layers.Input', 'layers.Input', ([], {'shape': 'input_size'}), '(shape=input_size)\n', (2234, 2252), False, 'from tensorflow.keras import layers\n'), ((3167, 3209), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'inp', 'outputs': 'p_head'}), '(inputs=inp, outputs=p_head)\n'... |
#!/usr/bin/env python
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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
... | [
"apps.jsonapp.JSONApp",
"utils.logger.info",
"argparse.ArgumentParser",
"CHiC.tool.run_chicago.ChicagoTool"
] | [((3062, 3071), 'apps.jsonapp.JSONApp', 'JSONApp', ([], {}), '()\n', (3069, 3071), False, 'from apps.jsonapp import JSONApp\n'), ((3501, 3594), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Chicago algorithm for capture Hi-C peak detection"""'}), "(description=\n 'Chicago algorithm f... |
import asyncio
import beneath
import psycopg2
import json
import yaml
from datetime import datetime
from schemas import get_schema, check_for_and_encode_ts
with open(".development.yaml", "r") as ymlfile:
config = yaml.safe_load(ymlfile)
POLLING_INTERVAL = 5
SCHEMA = """
type Change @schema {
table: String! @k... | [
"schemas.check_for_and_encode_ts",
"json.loads",
"asyncio.sleep",
"beneath.Pipeline",
"schemas.get_schema",
"datetime.datetime.strptime",
"yaml.safe_load",
"psycopg2.connect"
] | [((218, 241), 'yaml.safe_load', 'yaml.safe_load', (['ymlfile'], {}), '(ymlfile)\n', (232, 241), False, 'import yaml\n'), ((448, 639), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': "config['postgres']['database']", 'user': "config['postgres']['username']", 'password': "config['postgres']['password']", 'host'... |
from warnings import warn
warn("pytools.log was moved to https://github.com/illinois-ceesd/logpyle/. "
"I will try to import that for you. If the import fails, say "
"'pip install logpyle', and change your imports from 'pytools.log' "
"to 'logpyle'.", DeprecationWarning)
from logpyle import * ... | [
"warnings.warn"
] | [((27, 273), 'warnings.warn', 'warn', (['"""pytools.log was moved to https://github.com/illinois-ceesd/logpyle/. I will try to import that for you. If the import fails, say \'pip install logpyle\', and change your imports from \'pytools.log\' to \'logpyle\'."""', 'DeprecationWarning'], {}), '(\n "pytools.log was mov... |
# main imports
import sys, os, argparse
import numpy as np
import random
import time
import json
# image processing imports
from PIL import Image
from ipfml.processing import transform, segmentation
from ipfml import utils
# modules imports
sys.path.insert(0, '') # trick to enable import of main folder module
impor... | [
"sys.stdout.write",
"argparse.ArgumentParser",
"ipfml.utils.normalize_arr",
"sys.path.insert",
"data_attributes.get_image_features",
"ipfml.utils.normalize_arr_with_range",
"os.path.join",
"os.listdir"
] | [((244, 266), 'sys.path.insert', 'sys.path.insert', (['(0)', '""""""'], {}), "(0, '')\n", (259, 266), False, 'import sys, os, argparse\n'), ((1296, 1312), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1306, 1312), False, 'import sys, os, argparse\n'), ((1591, 1639), 'os.path.join', 'os.path.join', (['path', ... |
# The MIT License (MIT)
#
# Copyright (c) 2020 ETH Zurich
#
# 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... | [
"exputil.LocalShell",
"time.sleep"
] | [((1254, 1274), 'exputil.LocalShell', 'exputil.LocalShell', ([], {}), '()\n', (1272, 1274), False, 'import exputil\n'), ((2616, 2629), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (2626, 2629), False, 'import time\n'), ((2449, 2462), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (2459, 2462), False, 'impor... |
#!/usr/bin/env python3
import boto3
class EmailSender():
def __init__(self, from_address, session=None):
self._from_address = from_address
self._client = boto3.client('ses', region_name='us-east-1')
def send_email(self, to_address, subject, message):
# type checking
if isin... | [
"boto3.client"
] | [((178, 222), 'boto3.client', 'boto3.client', (['"""ses"""'], {'region_name': '"""us-east-1"""'}), "('ses', region_name='us-east-1')\n", (190, 222), False, 'import boto3\n')] |
import socket
import subprocess
from chatutils import utils
from chatutils.chatio2 import ChatIO
configs = utils.JSONLoader()
HEADER_LEN = configs.dict["system"]["headerLen"]
def commands(client_socket):
# while True:
# breakpoint()
ChatIO().pack_n_send(client_socket, "C", b"<<cmd:#>>")
# client_soc... | [
"chatutils.chatio2.ChatIO.unpack_data",
"chatutils.utils.JSONLoader",
"chatutils.chatio2.ChatIO",
"subprocess.check_output"
] | [((109, 127), 'chatutils.utils.JSONLoader', 'utils.JSONLoader', ([], {}), '()\n', (125, 127), False, 'from chatutils import utils\n'), ((361, 394), 'chatutils.chatio2.ChatIO.unpack_data', 'ChatIO.unpack_data', (['client_socket'], {}), '(client_socket)\n', (379, 394), False, 'from chatutils.chatio2 import ChatIO\n'), ((... |
import json
import os
import shlex
import subprocess
import pytest
@pytest.fixture(scope='session')
def example_dir(tests_dir):
return tests_dir / 'example'
@pytest.fixture(scope='session')
def anisble_inventory(example_dir):
return open(example_dir / 'ansible.json', 'r')
@pytest.fixture(scope='session')... | [
"json.load",
"pytest.fixture"
] | [((71, 102), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (85, 102), False, 'import pytest\n'), ((167, 198), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (181, 198), False, 'import pytest\n'), ((289, 320), 'pytest.fixture', ... |
import os
import pickle
import numpy as np
import sys
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ms2ldaviz.settings")
import django
django.setup()
import jsonpickle
from basicviz.models import Experiment,Document
if __name__ == '__main__':
experiment_name = sys.argv[1]
experiment = Experiment.objects.get(na... | [
"jsonpickle.encode",
"os.environ.setdefault",
"django.setup",
"jsonpickle.decode",
"basicviz.models.Document.objects.filter",
"basicviz.models.Experiment.objects.get"
] | [((54, 123), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""ms2ldaviz.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'ms2ldaviz.settings')\n", (75, 123), False, 'import os\n'), ((139, 153), 'django.setup', 'django.setup', ([], {}), '()\n', (151, 153), False, 'import django\n'),... |
import logging
import inspect
import collections
import random
import torch
logger = logging.getLogger(__name__)
def get_tensors(object_):
""" Get all tensors associated with ``object_``
Args:
object_ (any): Any object to look for tensors.
Returns:
(list of torch.tensor): List of tenso... | [
"torchnlp.datasets.Dataset",
"random.Random",
"torch.equal",
"torch.zeros",
"torch.is_tensor",
"logging.getLogger",
"inspect.getmembers"
] | [((87, 114), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (104, 114), False, 'import logging\n'), ((376, 400), 'torch.is_tensor', 'torch.is_tensor', (['object_'], {}), '(object_)\n', (391, 400), False, 'import torch\n'), ((4468, 4501), 'torch.equal', 'torch.equal', (['tensor', 'tensor_o... |
import warnings
import numpy as np
import scipy.linalg as scplin
import scipy.optimize as scpop
import scipy.sparse as scpsp
dfail = {}
try:
import sksparse as sksp
except Exception as err:
sksp = False
dfail['sksparse'] = "For cholesk factorizations"
try:
import scikits.umfpack as skumf
except E... | [
"scipy.linalg.solve",
"scipy.optimize.minimize",
"numpy.abs",
"numpy.log",
"numpy.sum",
"scipy.linalg.cholesky",
"scipy.sparse.linalg.cg",
"scipy.linalg.cho_solve",
"scipy.sparse.linalg.factorized",
"sksparse.cholmod.cholesky",
"numpy.argmin",
"numpy.argsort",
"numpy.append",
"numpy.max",
... | [((603, 621), 'warnings.warn', 'warnings.warn', (['msg'], {}), '(msg)\n', (616, 621), False, 'import warnings\n'), ((16794, 16809), 'numpy.array', 'np.array', (['[mu0]'], {}), '([mu0])\n', (16802, 16809), True, 'import numpy as np\n'), ((16830, 16847), 'numpy.log', 'np.log', (['chi2n_obj'], {}), '(chi2n_obj)\n', (16836... |
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2020 <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 app... | [
"gettext.translation",
"dataclasses.dataclass"
] | [((947, 985), 'gettext.translation', 'translation', (['"""thespiae"""'], {'fallback': '(True)'}), "('thespiae', fallback=True)\n", (958, 985), False, 'from gettext import translation\n'), ((1021, 1043), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1030, 1043), False, 'from datac... |
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, TextAreaField
from wtforms.validators import DataRequired, ValidationError
from app.models import Book, Author, Category
class AddBook(FlaskForm):
title = StringField("Tytuł książki", validators=[DataRequired()])
author = StringFie... | [
"app.models.Book.query.filter_by",
"wtforms.SubmitField",
"wtforms.StringField",
"wtforms.validators.DataRequired",
"wtforms.validators.ValidationError"
] | [((663, 698), 'wtforms.SubmitField', 'SubmitField', (['"""Dodaj do biblioteki!"""'], {}), "('Dodaj do biblioteki!')\n", (674, 698), False, 'from wtforms import StringField, SubmitField, TextAreaField\n'), ((1179, 1207), 'wtforms.StringField', 'StringField', (['"""Tytuł książki"""'], {}), "('Tytuł książki')\n", (1190, 1... |
#!/usr/bin/env python3
#############
# Libraries #
#############
import random
import math
###########
# Classes #
###########
class person:
"""A person"""
instances = []
def __init__(self):
a = random.random()
self.prefs = [0.5, 0.5]
self.data = [a, 1 - a, 0]
... | [
"random.random"
] | [((230, 245), 'random.random', 'random.random', ([], {}), '()\n', (243, 245), False, 'import random\n')] |
import hpat
def count_array_REPs():
from hpat.distributed import Distribution
vals = hpat.distributed.dist_analysis.array_dists.values()
return sum([v == Distribution.REP for v in vals])
def count_parfor_REPs():
from hpat.distributed import Distribution
vals = hpat.distributed.dist_analysis.parf... | [
"hpat.distributed.dist_analysis.array_dists.values",
"hpat.distributed_api.get_rank",
"hpat.distributed_api.get_start",
"hpat.distributed.dist_analysis.parfor_dists.values",
"hpat.distributed_api.get_size",
"hpat.distributed_api.get_end"
] | [((95, 146), 'hpat.distributed.dist_analysis.array_dists.values', 'hpat.distributed.dist_analysis.array_dists.values', ([], {}), '()\n', (144, 146), False, 'import hpat\n'), ((285, 337), 'hpat.distributed.dist_analysis.parfor_dists.values', 'hpat.distributed.dist_analysis.parfor_dists.values', ([], {}), '()\n', (335, 3... |
from pathlib import Path
from typing import Dict, List, Mapping, Optional, Set
from kolga.utils.general import get_environment_vars_by_prefix, get_project_secret_var
from kolga.utils.models import HelmValues
class Service:
"""
A service is a by Helm deployable software
A service takes care of storing th... | [
"kolga.utils.general.get_project_secret_var"
] | [((2367, 2442), 'kolga.utils.general.get_project_secret_var', 'get_project_secret_var', ([], {'project_name': 'service.name', 'value': 'self.artifact_name'}), '(project_name=service.name, value=self.artifact_name)\n', (2389, 2442), False, 'from kolga.utils.general import get_environment_vars_by_prefix, get_project_secr... |
"""
Departures
http://doc.navitia.io/#departures
Also known as /departures service.
This endpoint retrieves a list of departures from a specific datetime of a selected object. Departures are ordered chronologically in ascending order as:
url Result
/coverage/{region_i... | [
"os.path.join"
] | [((1027, 1091), 'os.path.join', 'os.path.join', (['"""coverage"""', 'coords', '"""coords"""', 'coords', '"""departures"""'], {}), "('coverage', coords, 'coords', coords, 'departures')\n", (1039, 1091), False, 'import os\n'), ((2042, 2121), 'os.path.join', 'os.path.join', (['"""coverage"""', 'used_region', 'collection_n... |
"""Vera tests."""
from unittest.mock import MagicMock
import pytest
import pyvera as pv
from requests.exceptions import RequestException
from homeassistant.components.vera import (
CONF_CONTROLLER,
CONF_EXCLUDE,
CONF_LIGHTS,
DOMAIN,
)
from homeassistant.config_entries import ENTRY_STATE_NOT_LOADED
fro... | [
"unittest.mock.MagicMock",
"tests.common.MockConfigEntry",
"requests.exceptions.RequestException",
"tests.common.mock_registry",
"pytest.mark.parametrize"
] | [((5894, 6074), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['options']", "[[{CONF_LIGHTS: [4, 10, 12, 'AAA'], CONF_EXCLUDE: [1, 'BBB']}], [{\n CONF_LIGHTS: ['4', '10', '12', 'AAA'], CONF_EXCLUDE: ['1', 'BBB']}]]"], {}), "(['options'], [[{CONF_LIGHTS: [4, 10, 12, 'AAA'],\n CONF_EXCLUDE: [1, 'BBB']}],... |
import unittest
from frozendict import frozendict
from src.helpers.music.queue import Queue, QueueIsEmptyError, RemoveOutOfIndexError
class QueueTest(unittest.TestCase):
queue1 = [
frozendict({ 'name' : 'song1' }),
frozendict({ 'name' : 'song2' }),
frozendict({ 'name' : 'song3' })
]
... | [
"src.helpers.music.queue.Queue",
"frozendict.frozendict"
] | [((196, 225), 'frozendict.frozendict', 'frozendict', (["{'name': 'song1'}"], {}), "({'name': 'song1'})\n", (206, 225), False, 'from frozendict import frozendict\n'), ((238, 267), 'frozendict.frozendict', 'frozendict', (["{'name': 'song2'}"], {}), "({'name': 'song2'})\n", (248, 267), False, 'from frozendict import froze... |
from pyvisa import ResourceManager, VisaIOError
from pylabnet.hardware.awg.dio_breakout import Driver
from pylabnet.utils.helper_methods import get_ip, load_device_config
from pylabnet.network.client_server.dio_breakout import Service, Client
from pylabnet.network.core.generic_server import GenericServer
def launch(*... | [
"pylabnet.network.client_server.dio_breakout.Service",
"pylabnet.utils.helper_methods.load_device_config",
"pylabnet.utils.helper_methods.get_ip",
"pylabnet.hardware.awg.dio_breakout.Driver"
] | [((640, 717), 'pylabnet.utils.helper_methods.load_device_config', 'load_device_config', (['"""dio_breakout"""', "kwargs['config']"], {'logger': "kwargs['logger']"}), "('dio_breakout', kwargs['config'], logger=kwargs['logger'])\n", (658, 717), False, 'from pylabnet.utils.helper_methods import get_ip, load_device_config\... |
# Standard Library
import datetime
# Third Party Code
from dateutil.tz import tzutc
# Supercell Code
from supercell.breezometer.pollen.models.pollen_index import PollenIndex
from supercell.breezometer.pollen.models.pollen_index_forecast import (
PollenIndexForecast,
)
from supercell.breezometer.pollen.models.poll... | [
"dateutil.tz.tzutc",
"supercell.breezometer.pollen.models.pollen_index.PollenIndex",
"supercell.breezometer.pollen.models.pollen_index_forecast.PollenIndexForecast.initialize_from_dictionary"
] | [((428, 435), 'dateutil.tz.tzutc', 'tzutc', ([], {}), '()\n', (433, 435), False, 'from dateutil.tz import tzutc\n'), ((6351, 8641), 'supercell.breezometer.pollen.models.pollen_index_forecast.PollenIndexForecast.initialize_from_dictionary', 'PollenIndexForecast.initialize_from_dictionary', ([], {'response_dictionary': "... |
#!/usr/bin/env python
# Cloudeebus
#
# Copyright 2012 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | [
"json.load",
"twisted.python.log.startLogging",
"argparse.ArgumentParser",
"autobahn.wamp.WampCraServerProtocol.connectionLost",
"cloudeebusengine.SERVICELIST.index",
"dbus.glib.init_threads",
"autobahn.wamp.WampCraServerProtocol.onSessionOpen",
"twisted.internet.glib2reactor.install",
"gobject.thre... | [((887, 909), 'twisted.internet.glib2reactor.install', 'glib2reactor.install', ([], {}), '()\n', (907, 909), False, 'from twisted.internet import glib2reactor\n'), ((1117, 1139), 'gobject.threads_init', 'gobject.threads_init', ([], {}), '()\n', (1137, 1139), False, 'import gobject\n'), ((1163, 1182), 'dbus.glib.init_th... |
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from rest_framework.documentation import include_docs_urls
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
from rest_framework import permissi... | [
"drf_yasg.openapi.Info",
"django.conf.urls.static.static",
"django.urls.path",
"django.urls.include"
] | [((455, 572), 'drf_yasg.openapi.Info', 'openapi.Info', ([], {'title': '"""Locaion API"""', 'default_version': '"""v1"""', 'description': '"""A Web API for list of available Locations"""'}), "(title='Locaion API', default_version='v1', description=\n 'A Web API for list of available Locations')\n", (467, 572), False,... |
from pathlib import Path
from datetime import datetime
import time
from subprocess import call
import os
from logzero import logger
import picamera
# Video file path
VIDEO_PATH = str(Path().resolve()) + "/videos/"
IMAGE_PATH = str(Path().resolve()) + "/images/"
class CameraController:
def __init__(self) -> Non... | [
"os.remove",
"logzero.logger.info",
"time.sleep",
"time.time",
"pathlib.Path",
"subprocess.call",
"logzero.logger.warning",
"logzero.logger.error",
"datetime.datetime.now",
"picamera.PiCamera"
] | [((345, 364), 'picamera.PiCamera', 'picamera.PiCamera', ([], {}), '()\n', (362, 364), False, 'import picamera\n'), ((1716, 1747), 'logzero.logger.info', 'logger.info', (['"""Capturing image."""'], {}), "('Capturing image.')\n", (1727, 1747), False, 'from logzero import logger\n'), ((1822, 1835), 'time.sleep', 'time.sle... |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Organization,OrganizationImages
from evelist.models import Event,EventImages
class OrganizationRegisterForm(UserCreationForm):
name=forms.CharField(required=True, label="Org... | [
"django.forms.TextInput",
"django.forms.CharField",
"django.forms.EmailField"
] | [((279, 336), 'django.forms.CharField', 'forms.CharField', ([], {'required': '(True)', 'label': '"""Organization Name"""'}), "(required=True, label='Organization Name')\n", (294, 336), False, 'from django import forms\n'), ((346, 364), 'django.forms.EmailField', 'forms.EmailField', ([], {}), '()\n', (362, 364), False, ... |
"""
Boto S3 Router install script
"""
from setuptools import setup, find_packages
from pathlib import Path
import os
NAME = "boto-s3-router"
this_directory = Path(__file__).parent
LONG_DESCRIPTION = (this_directory / "README.md").read_text()
# To install the library, run the following
#
# python setup.py install
... | [
"pathlib.Path",
"os.getenv",
"setuptools.find_packages"
] | [((164, 178), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (168, 178), False, 'from pathlib import Path\n'), ((470, 499), 'os.getenv', 'os.getenv', (['"""VERSION"""', '"""0.0.1"""'], {}), "('VERSION', '0.0.1')\n", (479, 499), False, 'import os\n'), ((933, 963), 'setuptools.find_packages', 'find_packages'... |
# SJTU EE208
import threading
import queue
import time
def get_page(page):
print('downloading page %s' % page)
time.sleep(0.5)
return g.get(page, [])
def get_all_links(content):
return content
def working():
while True:
print("getting","left:",q.qsize())
page = q.get()
... | [
"threading.Thread",
"time.sleep",
"threading.Lock",
"time.time",
"queue.Queue"
] | [((982, 993), 'time.time', 'time.time', ([], {}), '()\n', (991, 993), False, 'import time\n'), ((1036, 1052), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1050, 1052), False, 'import threading\n'), ((1057, 1070), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (1068, 1070), False, 'import queue\n'), ((1195, 1... |
"""Test runway.cfngin.hooks.awslambda.models.responses."""
# pylint: disable=no-self-use,protected-access
from __future__ import annotations
import pytest
from pydantic import ValidationError
from awslambda.models.responses import AwsLambdaHookDeployResponse
class TestAwsLambdaHookDeployResponse:
"""Test AwsLam... | [
"pytest.raises",
"awslambda.models.responses.AwsLambdaHookDeployResponse"
] | [((427, 457), 'pytest.raises', 'pytest.raises', (['ValidationError'], {}), '(ValidationError)\n', (440, 457), False, 'import pytest\n'), ((482, 610), 'awslambda.models.responses.AwsLambdaHookDeployResponse', 'AwsLambdaHookDeployResponse', ([], {'bucket_name': '"""test-bucket"""', 'code_sha256': '"""sha256"""', 'invalid... |
from sana_pchr.reporting.recommender import *
from datetime import timedelta, date
from dateutil import rrule
import csv
calcs = [DIABETES_CALCULATOR, HYPERTENSION_CALCULATOR, DYSLIPIDEMIA_CALCULATOR]
clinics = [clinic for clinic in Clinic.objects.all() if "Test" not in clinic.name ]
start_date = date(2016,2,14)
end_... | [
"csv.DictWriter",
"datetime.date",
"dateutil.rrule.rrule"
] | [((300, 317), 'datetime.date', 'date', (['(2016)', '(2)', '(14)'], {}), '(2016, 2, 14)\n', (304, 317), False, 'from datetime import timedelta, date\n'), ((327, 345), 'datetime.date', 'date', (['(2016)', '(10)', '(30)'], {}), '(2016, 10, 30)\n', (331, 345), False, 'from datetime import timedelta, date\n'), ((998, 1014),... |
from time import sleep
from org.jointheleague.ecolban.rpirobot import SimpleIRobot, Sonar
robot = SimpleIRobot()
sonar = Sonar()
def setup():
# Initialization code here
pass
def loop():
# Repeating code here
return True
def shutdown():
robot.reset()
robot.stop()
robot.closeConnection()
setup()
while loop... | [
"org.jointheleague.ecolban.rpirobot.SimpleIRobot",
"org.jointheleague.ecolban.rpirobot.Sonar"
] | [((99, 113), 'org.jointheleague.ecolban.rpirobot.SimpleIRobot', 'SimpleIRobot', ([], {}), '()\n', (111, 113), False, 'from org.jointheleague.ecolban.rpirobot import SimpleIRobot, Sonar\n'), ((122, 129), 'org.jointheleague.ecolban.rpirobot.Sonar', 'Sonar', ([], {}), '()\n', (127, 129), False, 'from org.jointheleague.eco... |
# 0702.py
import cv2
import numpy as np
src = cv2.imread('./data/rect.jpg')
gray = cv2.cvtColor(src, cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray, 50, 100)
lines = cv2.HoughLines(edges, rho = 1, theta = np.pi/180.0, threshold = 100)
print('lines.shape = ', lines.shape)
for line in lines:
rho, theta = l... | [
"cv2.line",
"cv2.Canny",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.imread",
"numpy.sin",
"cv2.HoughLines",
"numpy.cos",
"cv2.imshow"
] | [((53, 82), 'cv2.imread', 'cv2.imread', (['"""./data/rect.jpg"""'], {}), "('./data/rect.jpg')\n", (63, 82), False, 'import cv2\n'), ((91, 128), 'cv2.cvtColor', 'cv2.cvtColor', (['src', 'cv2.COLOR_BGR2GRAY'], {}), '(src, cv2.COLOR_BGR2GRAY)\n', (103, 128), False, 'import cv2\n'), ((138, 162), 'cv2.Canny', 'cv2.Canny', (... |
"""
CubicWeb instance request (user mode)
=====================================
Credit: <NAME>
pycaravel is a Python package that enables you to parse various source of data.
In this tutorial you will learn how to parse and search in a CubicWeb instance.
First checks
------------
In order to test if pycaravel packa... | [
"caravel.info",
"caravel.get_parser",
"pprint.pprint"
] | [((1080, 1165), 'caravel.get_parser', 'caravel.get_parser', ([], {'project': '"""herby"""', 'layoutdir': '"""/neurospin/tmp/pycaravel/layout"""'}), "(project='herby', layoutdir='/neurospin/tmp/pycaravel/layout'\n )\n", (1098, 1165), False, 'import caravel\n'), ((1494, 1513), 'pprint.pprint', 'pprint', (['parser.conf... |
# coding = utf-8
import copy
import json
import gatlin.infra.commonUtils as util
import gatlin.infra.print as pt
import gatlin.nodes.parserSelector as ps
# 读取需要进行测试的flow全集
def launch_flows_config(location):
flow_json_file = location
with open(flow_json_file) as fl:
flows_config = json.loads(fl.read()... | [
"copy.deepcopy",
"gatlin.infra.commonUtils.inject_all",
"gatlin.infra.print.print_yellow",
"gatlin.nodes.parserSelector.fetch_parser",
"gatlin.infra.print.print_green",
"gatlin.infra.print.print_red"
] | [((412, 485), 'gatlin.infra.print.print_green', 'pt.print_green', (["('*' * 45 + 'PARSING %s' % flow_name + ' BEGIN' + '*' * 45)"], {}), "('*' * 45 + 'PARSING %s' % flow_name + ' BEGIN' + '*' * 45)\n", (426, 485), True, 'import gatlin.infra.print as pt\n'), ((530, 552), 'copy.deepcopy', 'copy.deepcopy', (['environ'], {... |
import os
import pathlib
import string
import subprocess
from elftools.elf.constants import SH_FLAGS
from elftools.elf.elffile import ELFFile
from elftools.elf.sections import SymbolTableSection
from fuzzware_harness.util import bytes2int
from fuzzware_pipeline.logging_handler import logging_handler
logger = logging_... | [
"os.path.abspath",
"os.stat",
"binascii.hexlify",
"elftools.elf.elffile.ELFFile",
"pathlib.Path",
"fuzzware_pipeline.logging_handler.logging_handler",
"fuzzware_harness.util.bytes2int",
"subprocess.check_call"
] | [((1308, 1380), 'subprocess.check_call', 'subprocess.check_call', (["[OBJCOPY_UTIL, '-O', 'binary', in_path, out_path]"], {}), "([OBJCOPY_UTIL, '-O', 'binary', in_path, out_path])\n", (1329, 1380), False, 'import subprocess\n'), ((13170, 13198), 'os.path.abspath', 'os.path.abspath', (['binary_path'], {}), '(binary_path... |
import unittest
import os
import tempfile
import uuid
from studio import model
from model_test import get_test_experiment
# We are not currently working with HTTP providers.
@unittest.skip
class HTTPProviderHostedTest(unittest.TestCase):
def get_db_provider(self, config_name):
config_file = os.path.join(... | [
"unittest.main",
"os.remove",
"uuid.uuid4",
"model_test.get_test_experiment",
"os.path.realpath",
"tempfile.gettempdir",
"studio.model.get_config"
] | [((3064, 3079), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3077, 3079), False, 'import unittest\n'), ((2011, 2032), 'model_test.get_test_experiment', 'get_test_experiment', ([], {}), '()\n', (2030, 2032), False, 'from model_test import get_test_experiment\n'), ((457, 486), 'studio.model.get_config', 'model.ge... |
"""
##################################################################################################
# Copyright Info : Copyright (c) Davar Lab @ Hikvision Research Institute. All rights reserved.
# Filename : builder.py
# Abstract :
# Current Version: 1.0.0
# Date : 2020-05-31
####... | [
"mmcv.runner.get_dist_info",
"functools.partial",
"copy.deepcopy",
"mmdet.datasets.samplers.DistributedGroupSampler",
"mmcv.utils.build_from_cfg",
"mmdet.datasets.build_dataset",
"resource.getrlimit",
"resource.setrlimit",
"mmcv.utils.Registry",
"mmdet.datasets.samplers.DistributedSampler",
"mmd... | [((1304, 1323), 'mmcv.utils.Registry', 'Registry', (['"""sampler"""'], {}), "('sampler')\n", (1312, 1323), False, 'from mmcv.utils import Registry\n'), ((993, 1010), 'platform.system', 'platform.system', ([], {}), '()\n', (1008, 1010), False, 'import platform\n'), ((1110, 1152), 'resource.getrlimit', 'resource.getrlimi... |
import os
from typing import Dict, Union
import numpy as np
def lenient_makedirs(path: str) -> None:
"""Simple wrapper around makedirs that first checks for existence.
Args:
path (str): path to be created
"""
if not os.path.exists(path):
os.makedirs(path)
def tile_overlapped(image:... | [
"numpy.moveaxis",
"os.makedirs",
"numpy.ceil",
"numpy.empty",
"numpy.zeros",
"numpy.expand_dims",
"os.path.exists",
"numpy.all"
] | [((1779, 1867), 'numpy.empty', 'np.empty', (['(tile_count_h, tile_count_w, tile_h, tile_w, channels)'], {'dtype': 'image.dtype'}), '((tile_count_h, tile_count_w, tile_h, tile_w, channels), dtype=\n image.dtype)\n', (1787, 1867), True, 'import numpy as np\n'), ((3302, 3327), 'numpy.zeros', 'np.zeros', (['image.shape[... |
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Recipe, Tag, Ingredient
from recipe.serializers import RecipeSerializer, RecipeDetailSerializer
RECIPES_... | [
"core.models.Recipe.objects.filter",
"core.models.Tag.objects.create",
"core.models.Recipe.objects.all",
"core.models.Recipe.objects.create",
"recipe.serializers.RecipeDetailSerializer",
"core.models.Recipe.objects.get",
"django.contrib.auth.get_user_model",
"django.urls.reverse",
"core.models.Ingre... | [((326, 355), 'django.urls.reverse', 'reverse', (['"""recipe:recipe-list"""'], {}), "('recipe:recipe-list')\n", (333, 355), False, 'from django.urls import reverse\n'), ((424, 473), 'django.urls.reverse', 'reverse', (['"""recipe:recipe-detail"""'], {'args': '[recipe_id]'}), "('recipe:recipe-detail', args=[recipe_id])\n... |
import json
import torch
import numpy as np
import random
import torch.nn.functional as F
import functools
def cmp_time(a, b):
a_num = int(a.split('_')[1])
b_num = int(b.split('_')[1])
return a_num - b_num
def pad_tensor(vec, pad):
"""
pad tensor to fixed length
:parameter
vec: tensor... | [
"numpy.load",
"json.load",
"torch.FloatTensor",
"torch.zeros",
"torch.tensor"
] | [((824, 837), 'numpy.load', 'np.load', (['path'], {}), '(path)\n', (831, 837), True, 'import numpy as np\n'), ((859, 912), 'torch.tensor', 'torch.tensor', (["ori_data['pssm_arr']"], {'dtype': 'torch.float'}), "(ori_data['pssm_arr'], dtype=torch.float)\n", (871, 912), False, 'import torch\n'), ((945, 998), 'torch.tensor... |
#!/usr/bin/python3
#-*- coding: UTF-8
import fileSplit
fileSplit.合并()
| [
"fileSplit.合并"
] | [((55, 69), 'fileSplit.合并', 'fileSplit.合并', ([], {}), '()\n', (67, 69), False, 'import fileSplit\n')] |
from django.db import models
class Segment(models.Model):
from_stop = models.IntegerField()
to_stop = models.IntegerField()
distance = models.DecimalField(max_digits=6, decimal_places=2)
class Route(models.Model):
segments = models.ManyToManyField(Segment, through='RouteSegment')
class RouteSegmen... | [
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.DecimalField",
"django.db.models.IntegerField",
"django.db.models.DateField"
] | [((76, 97), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (95, 97), False, 'from django.db import models\n'), ((112, 133), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (131, 133), False, 'from django.db import models\n'), ((149, 200), 'django.db.models.DecimalFie... |
import sys
import numpy as np
import math
from JMLUtils import dist2, eprint
from StructureXYZ import StructXYZ
from typing import Sequence
TRIANGLE_TOL = 1E-4
Y_DENOM = 1.0 / math.sqrt(3)
def water(infile: str = 'QM_REF.xyz', delta=4.0):
delta = float(delta)
xyzfi = StructXYZ(infile)
assert len(xyzfi... | [
"numpy.dot",
"StructureXYZ.StructXYZ",
"JMLUtils.eprint",
"math.sqrt"
] | [((179, 191), 'math.sqrt', 'math.sqrt', (['(3)'], {}), '(3)\n', (188, 191), False, 'import math\n'), ((282, 299), 'StructureXYZ.StructXYZ', 'StructXYZ', (['infile'], {}), '(infile)\n', (291, 299), False, 'from StructureXYZ import StructXYZ\n'), ((1575, 1615), 'numpy.dot', 'np.dot', (['bisector_vector', 'bisector_vector... |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os, sys, logging, argparse
from itertools import ifilter as filter
import muz
import muz.frontend
import muz.vfs a... | [
"argparse.ArgumentParser",
"muz.beatmap.load",
"muz.vfs.root.walk",
"muz.frontend.iter",
"muz.vfs.LazyNode",
"muz.vfs.root.clear",
"muz.vfs.applySettings",
"os.path.join",
"os.path.abspath",
"os.path.dirname",
"os.path.exists",
"muz.util.logLevelByName",
"sys.setdefaultencoding",
"argparse... | [((666, 693), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (683, 693), False, 'import os, sys, logging, argparse\n'), ((799, 815), 'muz.vfs.root.clear', 'vfs.root.clear', ([], {}), '()\n', (813, 815), True, 'import muz.vfs as vfs\n'), ((863, 882), 'muz.vfs.applySettings', 'vfs.applySett... |
#!/usr/bin/env python
# Copyright 2017-present Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"zipfile.ZipFile",
"argparse.ArgumentParser",
"shutil.copy"
] | [((1380, 1405), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1403, 1405), False, 'import argparse\n'), ((1837, 1881), 'shutil.copy', 'shutil.copy', (['input_zip_file', 'output_zip_file'], {}), '(input_zip_file, output_zip_file)\n', (1848, 1881), False, 'import shutil\n'), ((2008, 2035), 'zip... |
#!/usr/bin/env python
# Google Code Jam
# Google Code Jam 2017
# Round 1A 2017
# Problem A. Alphabet Cake
# Solve all test sets
from __future__ import print_function
def make_cake(r, c, cake):
assert isinstance(cake, list)
filled_cake = []
for row in cake:
first_cell = '?'
last_cell = '... | [
"os.path.realpath"
] | [((1378, 1404), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1394, 1404), False, 'import os\n'), ((2035, 2061), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (2051, 2061), False, 'import os\n')] |
from script.data_handler.DatasetPackLoader import DatasetPackLoader
from script.model.sklearn_like_model.AE.AE import AE
data_pack = DatasetPackLoader().load_dataset("MNIST")
dataset = data_pack['train']
Xs, Ys = dataset.full_batch(['Xs', 'Ys'])
sample_X = Xs[:2]
sample_Y = Ys[:2]
def AE_total_execute(mode... | [
"script.model.sklearn_like_model.AE.AE.AE",
"script.data_handler.DatasetPackLoader.DatasetPackLoader"
] | [((998, 1002), 'script.model.sklearn_like_model.AE.AE.AE', 'AE', ([], {}), '()\n', (1000, 1002), False, 'from script.model.sklearn_like_model.AE.AE import AE\n'), ((1076, 1095), 'script.model.sklearn_like_model.AE.AE.AE', 'AE', ([], {'with_noise': '(True)'}), '(with_noise=True)\n', (1078, 1095), False, 'from script.mod... |
#encoding:utf-8
'''
Created on 2015-8-27
图片查看窗口
@author: user
'''
from PyQt4 import QtGui, QtCore, uic
from PyQt4.Qt import pyqtSlot
from PyQt4.QtGui import QMessageBox
from shhicparking.server import TSStub
from shhicparking.util import dateutil
import base64
class PictureViewerDlg(QtGui.QDialog):
def __init__(se... | [
"PyQt4.QtGui.QMessageBox.information",
"PyQt4.QtGui.QDialog.show",
"PyQt4.uic.loadUi",
"PyQt4.QtGui.QFileDialog.getSaveFileName",
"PyQt4.QtGui.QMessageBox.warning",
"PyQt4.Qt.pyqtSlot"
] | [((670, 680), 'PyQt4.Qt.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (678, 680), False, 'from PyQt4.Qt import pyqtSlot\n'), ((1028, 1038), 'PyQt4.Qt.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (1036, 1038), False, 'from PyQt4.Qt import pyqtSlot\n'), ((404, 465), 'PyQt4.uic.loadUi', 'uic.loadUi', (['"""shhicparking/ui/uires/pi... |
# Objective: learn a Doc2Vec model
import logging
import multiprocessing
import random
from time import time
import numpy as np
from gensim.models import doc2vec
from benchmark_utils import load_benchmarked_app_ids, print_ranking
from sentence_models import print_most_similar_sentences
from universal_sentence_encode... | [
"benchmark_utils.load_benchmarked_app_ids",
"random.shuffle",
"word_model.compute_similarity_using_word2vec_model",
"sentence_models.print_most_similar_sentences",
"multiprocessing.cpu_count",
"universal_sentence_encoder.prepare_knn_search",
"universal_sentence_encoder.perform_knn_search_with_vectors_as... | [((2425, 2431), 'time.time', 'time', ([], {}), '()\n', (2429, 2431), False, 'from time import time\n'), ((4499, 4592), 'sentence_models.print_most_similar_sentences', 'print_most_similar_sentences', (['similarity_scores'], {'num_items_displayed': 'num_items_displayed'}), '(similarity_scores, num_items_displayed=\n n... |
import os
import sys
import glob
import zipfile
import pandas as pd
import numpy as np
from .context import get_dataset_folder
from .results import *
from automlk.worker import get_search_rounds
from .print import *
import jinja2
import subprocess
jinja_globals = {'print_list': print_list,
'print_sco... | [
"os.makedirs",
"os.path.basename",
"os.path.exists",
"jinja2.FileSystemLoader",
"glob.glob",
"automlk.worker.get_search_rounds"
] | [((1924, 1961), 'automlk.worker.get_search_rounds', 'get_search_rounds', (['dataset.dataset_id'], {}), '(dataset.dataset_id)\n', (1941, 1961), False, 'from automlk.worker import get_search_rounds\n'), ((1402, 1424), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (1416, 1424), False, 'import os\n'),... |
# -*- coding: utf-8 -*-
"""
Copyright 2021, Gradient Zero
All rights reserved
"""
import logging
from dq0.sdk.errors.errors import fatal_error
from dq0.sdk.pipeline import pipeline_config
import pandas as pd
from sklearn import pipeline
logger = logging.getLogger(__name__)
class Pipeline():
def __init__(sel... | [
"pandas.DataFrame",
"dq0.sdk.errors.errors.fatal_error",
"sklearn.pipeline.Pipeline",
"dq0.sdk.pipeline.pipeline_config.PipelineConfig",
"logging.getLogger"
] | [((251, 278), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (268, 278), False, 'import logging\n'), ((902, 926), 'sklearn.pipeline.Pipeline', 'pipeline.Pipeline', (['steps'], {}), '(steps)\n', (919, 926), False, 'from sklearn import pipeline\n'), ((1876, 1917), 'pandas.DataFrame', 'pd.Da... |
import json
import boto3
class IamHelper:
def __init__(self):
self.client = boto3.client("iam")
self.ssm_client = boto3.client('ssm')
def create_or_get_ecs_role(self) -> str:
self.role_name = "spot-bot-ecs-service-role"
print("Check role exist")
try:
res... | [
"boto3.session.Session",
"boto3.client",
"json.dumps"
] | [((92, 111), 'boto3.client', 'boto3.client', (['"""iam"""'], {}), "('iam')\n", (104, 111), False, 'import boto3\n'), ((138, 157), 'boto3.client', 'boto3.client', (['"""ssm"""'], {}), "('ssm')\n", (150, 157), False, 'import boto3\n'), ((829, 1002), 'json.dumps', 'json.dumps', (["{'Version': '2012-10-17', 'Statement': [{... |
# Copyright 2021-present, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from datetime import datetime
import sys
from time import time
from typing import Union
def progress_bar(i: ... | [
"datetime.datetime.now",
"time.time"
] | [((1810, 1816), 'time.time', 'time', ([], {}), '()\n', (1814, 1816), False, 'from time import time\n'), ((1967, 1973), 'time.time', 'time', ([], {}), '()\n', (1971, 1973), False, 'from time import time\n'), ((1915, 1921), 'time.time', 'time', ([], {}), '()\n', (1919, 1921), False, 'from time import time\n'), ((967, 981... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Chatham House Data
------------------
Collects input data for Chatham House.
"""
import logging
from hdx.data.dataset import Dataset
from hdx.data.resource import Resource
from hdx.data.showcase import Showcase
from hdx.utilities.dictandlist import integer_value_convert
... | [
"hdx.data.showcase.Showcase",
"hdx.data.dataset.Dataset",
"hdx.location.country.Country.get_iso3_country_code_fuzzy",
"hdx.utilities.dictandlist.integer_value_convert",
"hdx.location.country.Country.get_iso3_from_iso2",
"hdx.data.resource.Resource",
"logging.getLogger",
"hdx.location.country.Country.g... | [((400, 427), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (417, 427), False, 'import logging\n'), ((1142, 1205), 'hdx.location.country.Country.get_iso3_country_code_fuzzy', 'Country.get_iso3_country_code_fuzzy', (['name'], {'exception': 'ValueError'}), '(name, exception=ValueError)\n',... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
from tornado import gen
from http_client import AAsyncHTTPClient, get_url
class CASHelper(AAsyncHTTPClient):
CA_CERT_PATH = 'XXXXX'
@classmethod
def _base_url(cls):
'''cas server url prefix'''
return 'https://cas.te... | [
"tornado.gen.Return",
"json.loads"
] | [((962, 980), 'tornado.gen.Return', 'gen.Return', (['result'], {}), '(result)\n', (972, 980), False, 'from tornado import gen\n'), ((1948, 1966), 'tornado.gen.Return', 'gen.Return', (['result'], {}), '(result)\n', (1958, 1966), False, 'from tornado import gen\n'), ((2044, 2063), 'json.loads', 'json.loads', (['profile']... |
# coding: utf-8
"""
Snøskredvarsel API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v5.0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
imp... | [
"six.iteritems"
] | [((20009, 20042), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (20022, 20042), False, 'import six\n')] |
import random
def solution(x, y):
m, f, gen = int(x), int(y), 0
while(True):
if(m == 1 and f == 1):
return str(gen);
elif(m < 1 or f < 1 or m==f):
return "impossible"
elif(m == 1 or f == 1):
return str(gen + f * m - 1)
elif(m > f):
... | [
"random.getrandbits"
] | [((465, 489), 'random.getrandbits', 'random.getrandbits', (['(1280)'], {}), '(1280)\n', (483, 489), False, 'import random\n'), ((490, 514), 'random.getrandbits', 'random.getrandbits', (['(1281)'], {}), '(1281)\n', (508, 514), False, 'import random\n')] |
from flask import jsonify
from api import api
import socket
@api.route('/v1/node/who/i/am', methods=['GET'])
def node_who_i_am():
return jsonify({'node_name':str(socket.gethostname())})
@api.route('/v1/node/sync', methods=['POST'])
def node_sync():
return jsonify({'node_name':str(socket.gethostname())})
@api... | [
"socket.gethostname",
"api.api.route"
] | [((62, 109), 'api.api.route', 'api.route', (['"""/v1/node/who/i/am"""'], {'methods': "['GET']"}), "('/v1/node/who/i/am', methods=['GET'])\n", (71, 109), False, 'from api import api\n'), ((193, 237), 'api.api.route', 'api.route', (['"""/v1/node/sync"""'], {'methods': "['POST']"}), "('/v1/node/sync', methods=['POST'])\n"... |
#!/usr/bin/env python
# coding: utf-8
# # Navigation
#
# ---
#
# You are welcome to use this coding environment to train your agent for the project. Follow the instructions below to get started!
#
# ### 1. Start the Environment
#
# Run the next code cell to install a few packages. This line will take a few minut... | [
"numpy.random.randint",
"unityagents.UnityEnvironment"
] | [((674, 742), 'unityagents.UnityEnvironment', 'UnityEnvironment', ([], {'file_name': '"""/data/Banana_Linux_NoVis/Banana.x86_64"""'}), "(file_name='/data/Banana_Linux_NoVis/Banana.x86_64')\n", (690, 742), False, 'from unityagents import UnityEnvironment\n'), ((2258, 2288), 'numpy.random.randint', 'np.random.randint', (... |
#!/usr/bin/python
from __future__ import absolute_import, division, print_function
# Copyright 2019-2020 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the ... | [
"ansible_collections.fortinet.fortimanager.plugins.module_utils.napi.check_parameter_bypass",
"ansible_collections.fortinet.fortimanager.plugins.module_utils.napi.check_galaxy_version",
"ansible.module_utils.connection.Connection",
"ansible_collections.fortinet.fortimanager.plugins.module_utils.napi.NAPIManag... | [((27910, 27947), 'ansible_collections.fortinet.fortimanager.plugins.module_utils.napi.check_galaxy_version', 'check_galaxy_version', (['module_arg_spec'], {}), '(module_arg_spec)\n', (27930, 27947), False, 'from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import check_galaxy_version\n'), ((2816... |
# Intervals Between Identical Elements
from typing import List
from collections import defaultdict
class Solution:
def getDistances(self, arr: List[int]) -> List[int]:
indices = defaultdict(list)
for index, n in enumerate(arr):
indices[n].append(index)
ans = [0] * len(arr)
... | [
"collections.defaultdict"
] | [((192, 209), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (203, 209), False, 'from collections import defaultdict\n')] |
# Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... | [
"boto.compat.json.dumps",
"boto.regioninfo.RegionInfo",
"boto.log.debug",
"boto.compat.json.loads"
] | [((32741, 32770), 'boto.log.debug', 'boto.log.debug', (['response_body'], {}), '(response_body)\n', (32755, 32770), False, 'import boto\n'), ((2488, 2556), 'boto.regioninfo.RegionInfo', 'RegionInfo', (['self', 'self.DefaultRegionName', 'self.DefaultRegionEndpoint'], {}), '(self, self.DefaultRegionName, self.DefaultRegi... |
import numpy as np
import hierarchy as hrcy
def get_stationary_distribution(capacities, r, lmbda, mu):
assert capacities[-1] == 1
matrix = hrcy.transitions.get_transition_matrix(
capacities=capacities, r=r, lmbda=lmbda, mu=mu
)
dimension = matrix.shape[0]
M = np.vstack((matrix.transpose(... | [
"numpy.linalg.lstsq",
"hierarchy.transitions.get_transition_matrix",
"numpy.zeros",
"numpy.ones"
] | [((150, 241), 'hierarchy.transitions.get_transition_matrix', 'hrcy.transitions.get_transition_matrix', ([], {'capacities': 'capacities', 'r': 'r', 'lmbda': 'lmbda', 'mu': 'mu'}), '(capacities=capacities, r=r, lmbda=\n lmbda, mu=mu)\n', (188, 241), True, 'import hierarchy as hrcy\n'), ((323, 341), 'numpy.ones', 'np.o... |
import requests
from bs4 import BeautifulSoup as bs
url = "https://mdn.github.io/beginner-html-site/"
response = requests.get(url) # this is like going to our browser and going to the url
print(response.status_code) # 200 would be good 404 would be bad
print(response.text[:500]) # first 500 characters
# i could ... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((115, 132), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (127, 132), False, 'import requests\n'), ((421, 453), 'bs4.BeautifulSoup', 'bs', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\n", (423, 453), True, 'from bs4 import BeautifulSoup as bs\n')] |
import numpy as np
arr1 = np.array([1, 2, 3])
arr2 = np.array([1, 2, 3])
newarr = np.sum([arr1, arr2])
print(newarr)
| [
"numpy.array",
"numpy.sum"
] | [((27, 46), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (35, 46), True, 'import numpy as np\n'), ((54, 73), 'numpy.array', 'np.array', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (62, 73), True, 'import numpy as np\n'), ((84, 104), 'numpy.sum', 'np.sum', (['[arr1, arr2]'], {}), '([arr1, arr2])\n', (90, 1... |
'''
for i in predictions/test/*; do python visualize_predictions.py $i\/doc.json $i/pred_weights.npy prediction_dir/$i ; done;
'''
import argparse
import numpy as np
import bipartite_utils
import json
import os
import subprocess
import matplotlib.pyplot as plt
from sklearn.metrics import roc_auc_score
def parse_args(... | [
"numpy.load",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.exists",
"matplotlib.pyplot.axis",
"numpy.clip",
"matplotlib.pyplot.figure",
"subprocess.call",
"numpy.array",
"bipartite_utils.generate_fast_hungarian_solving_function",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.savef... | [((336, 361), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (359, 361), False, 'import argparse\n'), ((571, 601), 'subprocess.call', 'subprocess.call', (['x'], {'shell': '(True)'}), '(x, shell=True)\n', (586, 601), False, 'import subprocess\n'), ((655, 680), 'numpy.load', 'np.load', (['args.pr... |
from process import Process
from process import State
class Simulation:
def __init__(self, data, cpu, scheduling):
self.data = data
self.cpu = cpu
self.scheduling = scheduling
self.processes = []
### Initiate all processes at the same time since they all arrive at t = 0
... | [
"process.Process"
] | [((397, 434), 'process.Process', 'Process', (['(i + 1)', 'processSimulationData'], {}), '(i + 1, processSimulationData)\n', (404, 434), False, 'from process import Process\n')] |
import concat.level1.execute
import unittest
import ast
from typing import Dict
class TestExecute(unittest.TestCase):
names = ['to_int', 'to_bool', 'to_complex', 'len', 'getitem', 'to_float',
'decode_bytes', 'to_tuple', 'to_bytes', 'to_list', 'to_bytearray',
'to_set', 'add_to_set', 'to_f... | [
"ast.Module"
] | [((879, 898), 'ast.Module', 'ast.Module', ([], {'body': '[]'}), '(body=[])\n', (889, 898), False, 'import ast\n'), ((1126, 1145), 'ast.Module', 'ast.Module', ([], {'body': '[]'}), '(body=[])\n', (1136, 1145), False, 'import ast\n')] |
"""
Contains TarifpreispositionProOrt class
and corresponding marshmallow schema for de-/serialization
"""
from typing import List
import attr
from marshmallow import fields
from bo4e.com.com import COM, COMSchema
from bo4e.com.tarifpreisstaffelproort import TarifpreisstaffelProOrt, TarifpreisstaffelProOrtSchema
fro... | [
"attr.validators.instance_of",
"attr.s",
"attr.validators.matches_re",
"marshmallow.fields.Str",
"marshmallow.fields.Nested"
] | [((420, 459), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)', 'kw_only': '(True)'}), '(auto_attribs=True, kw_only=True)\n', (426, 459), False, 'import attr\n'), ((1834, 1846), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (1844, 1846), False, 'from marshmallow import fields\n'), ((1857, 1869), 'marshmal... |
# Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | [
"time.time"
] | [((2118, 2129), 'time.time', 'time.time', ([], {}), '()\n', (2127, 2129), False, 'import time\n')] |
import collections
from collections import defaultdict
from typing import List, Dict
from pycrunch_trace.tracing.file_map import FileMap
class ClientTraceIntrospection:
total_events: int
def __init__(self):
self.total_events = 0
self.stats = defaultdict(int)
# file id -> hit count
... | [
"collections.defaultdict",
"pycrunch_trace.tracing.file_map.FileMap.from_reverse",
"collections.OrderedDict"
] | [((270, 286), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (281, 286), False, 'from collections import defaultdict\n'), ((343, 359), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (354, 359), False, 'from collections import defaultdict\n'), ((818, 845), 'pycrunch_trace.tracin... |
import sqlite3
class AI_DB(object):
def __init__(self, db_file_name):
self.conn = sqlite3.connect(db_file_name)
self.cur = self.conn.cursor()
def read_1_data(self, user_id):
query = "SELECT * FROM user WHERE user_id="+str(user_id)
self.cur.execute(query)
row = self.cur.f... | [
"sqlite3.connect"
] | [((95, 124), 'sqlite3.connect', 'sqlite3.connect', (['db_file_name'], {}), '(db_file_name)\n', (110, 124), False, 'import sqlite3\n')] |
# Generated by Django 3.0.8 on 2020-08-05 20:30
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
('CompanyManagement', '0001_initial'),
]
operat... | [
"django.db.models.ForeignKey",
"django.db.models.UUIDField",
"django.db.models.CharField"
] | [((430, 534), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid4', 'editable': '(False)', 'primary_key': '(True)', 'serialize': '(False)', 'unique': '(True)'}), '(default=uuid.uuid4, editable=False, primary_key=True,\n serialize=False, unique=True)\n', (446, 534), False, 'from django.db i... |
import webapp2
import json
from models.user import User
class UpdateUserHandler(webapp2.RequestHandler):
def get(self):
user = User.checkUser()
if not user:
return
update_name = self.request.get('name')
update_car = self.request.get('car')
needCar = False
if update_car == 'true':
ne... | [
"models.user.User.updateInfo",
"models.user.User.checkUser",
"json.dumps",
"webapp2.WSGIApplication"
] | [((566, 640), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/update_user', UpdateUserHandler)]"], {'debug': '(True)'}), "([('/update_user', UpdateUserHandler)], debug=True)\n", (589, 640), False, 'import webapp2\n'), ((137, 153), 'models.user.User.checkUser', 'User.checkUser', ([], {}), '()\n', (151, 153)... |
# Generated by Django 3.2.7 on 2021-10-15 08:15
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('resource_tracker', '0004_alter_resourcepoolattributedefinition_resource_pool'),
]
operations = [
migrations.RenameField(
model_name='res... | [
"django.db.migrations.AlterUniqueTogether",
"django.db.migrations.RenameField"
] | [((269, 407), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""resourcegroupattributedefinition"""', 'old_name': '"""resource_group_definition"""', 'new_name': '"""resource_group"""'}), "(model_name='resourcegroupattributedefinition',\n old_name='resource_group_definition', new_n... |
from setuptools import setup,find_packages
setup(
name='hechmsd',
version='1.0.0',
packages=find_packages(),
url='http://www.curwsl.org/',
license='',
author='hasitha',
author_email='<EMAIL>',
description='HecHms Distributed version',
include_package_data=True,
install_requires=... | [
"setuptools.find_packages"
] | [((105, 120), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (118, 120), False, 'from setuptools import setup, find_packages\n')] |
from datetime import datetime
from flask_login import UserMixin
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class User(UserMixin, db.Model):
id = db.Column(db.String(32), primary_key=True)
username = db.Column(db.String(128), index=True, unique=True, nullable=False)
email = db.Column(db.St... | [
"flask_sqlalchemy.SQLAlchemy"
] | [((111, 123), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (121, 123), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
"""A despicable Hanabi player.
Cheating Idiot never hints. He peeks at his cards. When he has a play, he
picks one randomly. When he doesn't, he discards randomly.
"""
from hanabi_classes import *
from bot_utils import get_plays
class CheatingIdiotPlayer(AIPlayer):
@classmethod
def get_name(cls):
... | [
"bot_utils.get_plays"
] | [((621, 647), 'bot_utils.get_plays', 'get_plays', (['cards', 'progress'], {}), '(cards, progress)\n', (630, 647), False, 'from bot_utils import get_plays\n')] |
import json
def permissions(app_id):
form = {
'f.req': [[[
'xdSrCf',
f'[[null,["{app_id}",7],[]]]',
None,
'1'
]]]
}
form['f.req'] = json.dumps(form['f.req'], separators=(',', ':'))
return form | [
"json.dumps"
] | [((211, 259), 'json.dumps', 'json.dumps', (["form['f.req']"], {'separators': "(',', ':')"}), "(form['f.req'], separators=(',', ':'))\n", (221, 259), False, 'import json\n')] |
import os
import numpy as np
class TupperwearD435_0:
F = np.load(os.path.join(os.path.dirname(__file__), 'v1_data/f_matrix.npy'))
P = np.load(os.path.join(os.path.dirname(__file__), 'v1_data/p_matrix_original.npy'))
class TupperwearD435:
F = np.load(os.path.join(os.path.dirname(__file__), 'v1_data/f_matri... | [
"os.path.dirname"
] | [((83, 108), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (98, 108), False, 'import os\n'), ((164, 189), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (179, 189), False, 'import os\n'), ((277, 302), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__fi... |
# -*- coding: utf-8 -*-
"""Evaluators.
========= =============================================
Name Reference
========= =============================================
rankbased :class:`pykeen.evaluation.RankBasedEvaluator`
sklearn :class:`pykeen.evaluation.SklearnEvaluator`
========= =====================... | [
"dataclasses.fields"
] | [((2749, 2774), 'dataclasses.fields', 'dataclasses.fields', (['value'], {}), '(value)\n', (2767, 2774), False, 'import dataclasses\n')] |
from django.urls import reverse
from django.shortcuts import redirect, render
from django.views.generic import TemplateView
from guardian.mixins import LoginRequiredMixin
from tally_ho.libs.permissions import groups
from tally_ho.apps.tally.models import UserProfile
GROUP_URLS = {
groups.AUDIT_CLERK: "audit",
... | [
"django.shortcuts.render",
"tally_ho.apps.tally.models.UserProfile.objects.get",
"django.shortcuts.redirect",
"django.urls.reverse"
] | [((918, 952), 'django.shortcuts.render', 'render', (['request', '"""errors/403.html"""'], {}), "(request, 'errors/403.html')\n", (924, 952), False, 'from django.shortcuts import redirect, render\n'), ((990, 1024), 'django.shortcuts.render', 'render', (['request', '"""errors/404.html"""'], {}), "(request, 'errors/404.ht... |