code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
We consider a randomly generated svf v in the Lie algebra.
We then consider its inverse in the lie Algebra: -v
The composition in the Lie algebra does not exist. But we apply the numerical method anyway to see what may happen.
v dot (-v) and (-v) dot v does not return the approximated identity (in green).
Afterwa... | [
"matplotlib.pyplot.show",
"numpy.copy",
"calie.fields.generate.generate_random",
"calie.visualisations.fields.fields_at_the_window.see_field",
"calie.operations.lie_exp.LieExp",
"calie.visualisations.fields.fields_at_the_window.see_2_fields",
"calie.fields.compose.lagrangian_dot_lagrangian"
] | [((770, 815), 'calie.fields.generate.generate_random', 'gen.generate_random', (['omega'], {'parameters': '(2, 2)'}), '(omega, parameters=(2, 2))\n', (789, 815), True, 'from calie.fields import generate as gen\n'), ((832, 851), 'numpy.copy', 'np.copy', (['(-1 * svf_v)'], {}), '(-1 * svf_v)\n', (839, 851), True, 'import ... |
from unittest.mock import call, patch, MagicMock
import pytest
from controlpanel.api import cluster
from controlpanel.api.models.user import User
def test_iam_role_name(users):
assert cluster.User(users['normal_user']).iam_role_name == 'test_user_bob'
def test_create(aws, helm, settings, users):
user = us... | [
"controlpanel.api.cluster.User",
"unittest.mock.MagicMock",
"unittest.mock.patch",
"controlpanel.api.models.user.User.objects.get",
"unittest.mock.call"
] | [((4175, 4199), 'controlpanel.api.cluster.User', 'cluster.User', (['user_model'], {}), '(user_model)\n', (4187, 4199), False, 'from controlpanel.api import cluster\n'), ((4222, 4233), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (4231, 4233), False, 'from unittest.mock import call, patch, MagicMock\n'), ((... |
'''
创建缩略图
from __future__ import print_function
import os, sys
from PIL import Image
size = (128, 128)
for infile in sys.argv[1:]:
outfile = os.path.splitext(infile)[0] + ".thumbnail"
if infile != outfile:
try:
im = Image.open(infile)
im.thumbnail(size)
im.save(out... | [
"os.getcwd",
"os.path.splitext",
"os.listdir",
"PIL.Image.open"
] | [((593, 604), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (602, 604), False, 'import os, sys\n'), ((616, 631), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (626, 631), False, 'import os, sys\n'), ((671, 695), 'os.path.splitext', 'os.path.splitext', (['infile'], {}), '(infile)\n', (687, 695), False, 'import os,... |
from pwn import *
import ctypes
glibc = ctypes.cdll.LoadLibrary('/lib/x86_64-linux-gnu/libc-2.27.so')
#sock = process("./seed_spring")
sock = remote("2019shell1.picoctf.com", 47241)
glibc.srand(glibc.time(0))
for i in range(30):
print(i)
sock.sendlineafter("height: ", str(glibc.rand() & 0xf))
print(sock.r... | [
"ctypes.cdll.LoadLibrary"
] | [((41, 102), 'ctypes.cdll.LoadLibrary', 'ctypes.cdll.LoadLibrary', (['"""/lib/x86_64-linux-gnu/libc-2.27.so"""'], {}), "('/lib/x86_64-linux-gnu/libc-2.27.so')\n", (64, 102), False, 'import ctypes\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from node.node import Node
from code import Code
from node.message import Message
""" 構文木選択肢クラス """
class Select(Node):
def __init__(self, questionList, selectList, bodyList):
self.questionList = questionList
self.selectList = selectList
self.bodyList = bodyL... | [
"node.message.Message"
] | [((384, 413), 'node.message.Message', 'Message', (['self.questionList[0]'], {}), '(self.questionList[0])\n', (391, 413), False, 'from node.message import Message\n')] |
import logging, logging.config
logging.config.fileConfig('logging.conf')
log = logging.getLogger('agents')
import enforce
import unittest
from engine import BaseAgent, SimState, SimStrategy
from engine.Agents import *
from util.constants import S_PER_DAY, S_PER_WEEK, S_PER_MONTH
@enforce.runtime_validation
class Age... | [
"engine.SimState.SimState",
"logging.config.fileConfig",
"logging.getLogger",
"engine.SimStrategy.SimStrategy"
] | [((31, 72), 'logging.config.fileConfig', 'logging.config.fileConfig', (['"""logging.conf"""'], {}), "('logging.conf')\n", (56, 72), False, 'import logging, logging.config\n'), ((79, 106), 'logging.getLogger', 'logging.getLogger', (['"""agents"""'], {}), "('agents')\n", (96, 106), False, 'import logging, logging.config\... |
import codecs
import gzip
import json
import logging
from typing import Tuple, Optional, Any, Dict
from botocore.client import BaseClient
from botocore.response import StreamingBody
from redis import StrictRedis
from s3_log_shipper.parsers import ParserManager, Parser
log: logging.Logger = logging.getLogger(__name__... | [
"codecs.getreader",
"gzip.open",
"logging.getLogger",
"json.dumps"
] | [((294, 321), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (311, 321), False, 'import logging\n'), ((2235, 2284), 'gzip.open', 'gzip.open', (['streaming_body', '"""rt"""'], {'encoding': '"""utf-8"""'}), "(streaming_body, 'rt', encoding='utf-8')\n", (2244, 2284), False, 'import gzip\n'),... |
import time
import cv2
import numpy as np
from test.screenUtils import grabscreen
def make_coordinates(image, line_parameters):
slope, intercept = line_parameters
y1 = image.shape[0]
y2 = int(y1 * (33 / 80))
x1 = int((y1 - intercept) / slope)
x2 = int((y2 - intercept) / slope)
return np.arra... | [
"cv2.line",
"cv2.GaussianBlur",
"cv2.Canny",
"numpy.zeros_like",
"numpy.average",
"cv2.bitwise_and",
"numpy.polyfit",
"cv2.cvtColor",
"cv2.waitKey",
"test.screenUtils.grabscreen.printWindow",
"cv2.imshow",
"time.sleep",
"cv2.fillPoly",
"cv2.addWeighted",
"numpy.array",
"test.screenUtil... | [((2254, 2267), 'time.sleep', 'time.sleep', (['(4)'], {}), '(4)\n', (2264, 2267), False, 'import time\n'), ((2268, 2292), 'test.screenUtils.grabscreen.printWindow', 'grabscreen.printWindow', ([], {}), '()\n', (2290, 2292), False, 'from test.screenUtils import grabscreen\n'), ((2941, 2964), 'cv2.destroyAllWindows', 'cv2... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import time
import cv2 as cv
from cvfpscalc import CvFpsCalc
def main():
fps = 15
cap = cv.VideoCapture(0)
# create CvFpsCalc instance
cvFpsCalc = CvFpsCalc()
while True:
start_time = time.time()
# calculate fps
fps_result ... | [
"cvfpscalc.CvFpsCalc",
"cv2.waitKey",
"cv2.imshow",
"time.time",
"cv2.VideoCapture",
"time.sleep",
"cv2.destroyAllWindows"
] | [((146, 164), 'cv2.VideoCapture', 'cv.VideoCapture', (['(0)'], {}), '(0)\n', (161, 164), True, 'import cv2 as cv\n'), ((214, 225), 'cvfpscalc.CvFpsCalc', 'CvFpsCalc', ([], {}), '()\n', (223, 225), False, 'from cvfpscalc import CvFpsCalc\n'), ((722, 744), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n'... |
import pathlib
from setuptools import setup, find_packages
NAME = "AWSOM"
URL = f'https://github.com/pfython/{NAME}'
HERE = pathlib.Path(__file__).parent
VERSION = "0.14"
setup(name = NAME,
packages = find_packages(),
version = VERSION,
license='MIT',
description = 'Desktop automation tools f... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((125, 147), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (137, 147), False, 'import pathlib\n'), ((210, 225), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (223, 225), False, 'from setuptools import setup, find_packages\n')] |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"functools.partial",
"numpy.minimum",
"numpy.maximum",
"argparse.ArgumentParser",
"shapely.geometry.Polygon",
"numpy.min",
"numpy.max",
"numpy.array",
"re.findall",
"numpy.where",
"os.path.split",
"os.path.join",
"re.compile"
] | [((1412, 1423), 'numpy.array', 'np.array', (['g'], {}), '(g)\n', (1420, 1423), True, 'import numpy as np\n'), ((1432, 1443), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (1440, 1443), True, 'import numpy as np\n'), ((1971, 2000), 'numpy.min', 'np.min', (['obbs[:, 0::2]'], {'axis': '(1)'}), '(obbs[:, 0::2], axis=1)\... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 26 23:30:13 2018
@author: luyfc
"""
# python onlinetrain2_2.py
import numpy as np
import csv
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import Dataset,DataLoader,TensorDataset
#from model import SimpleNet
from mode... | [
"game2048.expectimax.board_to_move",
"numpy.empty",
"game2048.game.Game",
"torch.utils.data.TensorDataset",
"torch.device",
"torch.utils.data.DataLoader",
"numpy.append",
"numpy.swapaxes",
"numpy.loadtxt",
"numpy.random.shuffle",
"tqdm.tqdm",
"modelv3_0.SimpleNet3",
"torch.cuda.is_available"... | [((801, 848), 'numpy.zeros', 'np.zeros', ([], {'shape': '(OUT_SHAPE + (CAND,))', 'dtype': 'bool'}), '(shape=OUT_SHAPE + (CAND,), dtype=bool)\n', (809, 848), True, 'import numpy as np\n'), ((973, 995), 'numpy.swapaxes', 'np.swapaxes', (['ret', '(0)', '(2)'], {}), '(ret, 0, 2)\n', (984, 995), True, 'import numpy as np\n'... |
# -*- coding: utf-8 -*-
# pylint: disable=line-too-long
"""Add logical documentation here later TODO."""
import collections
import json
import pathlib
import re
import sys
from typing import Union, List, Dict
ENCODING = 'utf-8'
# '3 . 1 . 42 * A KEY OR SO THEY SAY A_KEY A/N 4\n'
# '3 . 2 . 142 A ... | [
"json.dump",
"collections.namedtuple",
"re.compile"
] | [((554, 698), 're.compile', 're.compile', (['"""(?P<t>\\\\d+?)\\\\s\\\\.\\\\s(?P<v>\\\\d+?)\\\\s\\\\.\\\\s(?P<f>\\\\d+?)(?P<k>[ *]+)(?P<c>.*)\\\\s(?P<n>[^ ]+)\\\\s(?P<d>[^ ]+)\\\\s(?P<b>[^ ]+)"""'], {}), "(\n '(?P<t>\\\\d+?)\\\\s\\\\.\\\\s(?P<v>\\\\d+?)\\\\s\\\\.\\\\s(?P<f>\\\\d+?)(?P<k>[ *]+)(?P<c>.*)\\\\s(?P<n>[^ ... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def... | [
"_shfetraderapi.CShfeFtdcTraderApi_ReqQryTopic",
"_shfetraderapi.new_CShfeFtdcQryExecOrderField",
"_shfetraderapi.new_CShfeFtdcDisseminationField",
"_shfetraderapi.new_CShfeFtdcQuoteDemandNotifyField",
"_shfetraderapi.CShfeFtdcTraderSpi_OnRspQryBulletin",
"_shfetraderapi.CShfeFtdcTraderApi_OpenResponseLog... | [((466964, 467024), '_shfetraderapi.CShfeFtdcTraderApi_CreateFtdcTraderApi', '_shfetraderapi.CShfeFtdcTraderApi_CreateFtdcTraderApi', (['*args'], {}), '(*args)\n', (467017, 467024), False, 'import _shfetraderapi\n'), ((467201, 467275), '_shfetraderapi.CShfeFtdcTraderApi_GetVersion', '_shfetraderapi.CShfeFtdcTraderApi_G... |
# tell.py
from collections import defaultdict
# Metadata
NAME = 'tell'
PATTERN = r''
ENABLE = True
USAGE = '''Usage: !tell <user> <message>
This queues a message to send to a user the next time they are active (ie.
the next time they send a message).
'''
MAILBOX = defaultdict(list)
# Command
async def tell(b... | [
"collections.defaultdict"
] | [((274, 291), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (285, 291), False, 'from collections import defaultdict\n')] |
import collections
from collections import defaultdict, Counter
import functools
import itertools
from itertools import product, permutations, combinations
import bisect
import math
import argparse
from rich import print
import parse
import operator
from heapq import heappop, heappush
debug = set("0")
de... | [
"functools.reduce",
"parse.search",
"rich.print",
"argparse.ArgumentParser"
] | [((567, 592), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (590, 592), False, 'import argparse\n'), ((1327, 1369), 'functools.reduce', 'functools.reduce', (['operator.mul', 'factors', '(1)'], {}), '(operator.mul, factors, 1)\n', (1343, 1369), False, 'import functools\n'), ((1823, 1850), 'pars... |
"""
Copyright 2018, Oath Inc.
Licensed under the terms of the Apache 2.0 license. See LICENSE file in project root for terms.
"""
import re
import sys
import os
import unittest
from mock import patch
from testfixtures import LogCapture
from yahoo_panoptes.framework.context import PanoptesContext
from yahoo_panoptes.... | [
"sys.modules.keys",
"os.path.realpath",
"re.match",
"mock.patch",
"testfixtures.LogCapture",
"yahoo_panoptes.framework.plugins.manager.PanoptesPluginManager",
"os.path.split",
"os.path.join"
] | [((1314, 1375), 'mock.patch', 'patch', (['"""redis.StrictRedis"""', 'panoptes_mock_redis_strict_client'], {}), "('redis.StrictRedis', panoptes_mock_redis_strict_client)\n", (1319, 1375), False, 'from mock import patch\n'), ((1381, 1442), 'mock.patch', 'patch', (['"""kazoo.client.KazooClient"""', 'panoptes_mock_kazoo_cl... |
from django.contrib import admin
from .models import CertContent
from .models import ProductContent
from .models import UsesContent
from .models import ProductButton
from home.admin import ContentAdmin
# Register your models here.
admin.site.register(CertContent,ContentAdmin)
admin.site.register(ProductContent,Content... | [
"django.contrib.admin.site.register"
] | [((232, 278), 'django.contrib.admin.site.register', 'admin.site.register', (['CertContent', 'ContentAdmin'], {}), '(CertContent, ContentAdmin)\n', (251, 278), False, 'from django.contrib import admin\n'), ((278, 327), 'django.contrib.admin.site.register', 'admin.site.register', (['ProductContent', 'ContentAdmin'], {}),... |
import importlib
from typing import Union
from torch import optim
from super_gradients.common.factories.base_factory import AbstractFactory
from super_gradients.training.utils.optimizers.rmsprop_tf import RMSpropTF
from super_gradients.training.utils.optimizers.lamb import Lamb
class OptimizersTypeFactory(AbstractF... | [
"importlib.import_module"
] | [((1488, 1516), 'importlib.import_module', 'importlib.import_module', (['lib'], {}), '(lib)\n', (1511, 1516), False, 'import importlib\n')] |
# -*- coding: utf-8 -*-
"""Evaluate m-file and collect the results. A simple MATLAB script is
located in my_script.m
"""
from __future__ import division, print_function, absolute_import
from __future__ import unicode_literals
import matlab_wrapper
import sys
IMAGE_DIR = "public/uploads/api/"
def main():
matlab... | [
"matlab_wrapper.MatlabSession"
] | [((323, 353), 'matlab_wrapper.MatlabSession', 'matlab_wrapper.MatlabSession', ([], {}), '()\n', (351, 353), False, 'import matlab_wrapper\n')] |
# This replicates downloading Observations like #03, but here we use the
# '$select' query to limit the data coming from the server into a
# smaller package, saving some bandwidth.
#
# #03, no optimization: 250 KB
# #06, limiting fields: 41 KB
# #06, limiting fields and using CSV: 18 KB
#
# These bandwid... | [
"requests.get",
"math.ceil"
] | [((1296, 1411), 'requests.get', 'requests.get', (['download_url'], {'params': "[('$orderby', 'phenomenonTime desc'), ('$select', 'phenomenonTime,result')]"}), "(download_url, params=[('$orderby', 'phenomenonTime desc'), (\n '$select', 'phenomenonTime,result')])\n", (1308, 1411), False, 'import requests\n'), ((2343, ... |
import json
import logging
import os
import traceback
import random
from typing import Any, Optional, Tuple
from dataclasses import dataclass
from aiohttp import web, ClientSession
from aiohttp.typedefs import Handler
import ptvsd
from .utils import log_msg
ptvsd.enable_attach()
LOGGER = logging.getLogger(__name__... | [
"aiohttp.web.post",
"aiohttp.web.Response",
"traceback.print_exc",
"ptvsd.enable_attach",
"random.randint",
"aiohttp.web.delete",
"json.dumps",
"aiohttp.web.TCPSite",
"aiohttp.ClientSession",
"aiohttp.web.get",
"aiohttp.web.AppRunner",
"os.getenv",
"aiohttp.web.Application",
"logging.getLo... | [((262, 283), 'ptvsd.enable_attach', 'ptvsd.enable_attach', ([], {}), '()\n', (281, 283), False, 'import ptvsd\n'), ((294, 321), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (311, 321), False, 'import logging\n'), ((511, 531), 'os.getenv', 'os.getenv', (['"""RUNMODE"""'], {}), "('RUNMOD... |
"""
zipcode
=======
Zipcode (postnr) of the location
It's a common pitfall to convert to a number, but there is a possibility of a leading zero. This is very rare and only applies to old zipcodes and some military installations. [reference](https://da.wikipedia.org/wiki/Postnumre_i_Danmark)
To be certain, this should... | [
"ml_tooling.transformers.Select"
] | [((780, 797), 'ml_tooling.transformers.Select', 'Select', (['"""zipcode"""'], {}), "('zipcode')\n", (786, 797), False, 'from ml_tooling.transformers import Select\n')] |
import setuptools
import pathlib
def read_readme():
with open(pathlib.Path(__file__).parent / "README.md") as f:
return f.read()
setuptools.setup(
name="cofense_triage",
version="0.1.0",
author="<NAME>",
author_email="<EMAIL>",
maintainer="Cofense, Inc.",
maintainer_email="<EMAIL... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((934, 960), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (958, 960), False, 'import setuptools\n'), ((68, 90), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (80, 90), False, 'import pathlib\n')] |
# -*- coding: UTF-8 -*-
import spotdl
import os
raw_song = "Tony's Videos VERY SHORT VIDEO 28.10.2016"
for x in os.listdir(spotdl.args.folder):
os.remove(os.path.join(spotdl.args.folder, x))
def test_youtube_url():
expect_url = 'youtube.com/watch?v=qOOcy2-tmbk'
url = spotdl.generate_youtube_url(raw_song... | [
"spotdl.convert.song",
"spotdl.download_song",
"spotdl.check_exists",
"spotdl.generate_youtube_url",
"spotdl.generate_metadata",
"spotdl.misc.sanitize_title",
"spotdl.go_pafy",
"spotdl.get_youtube_title",
"os.path.join",
"os.listdir"
] | [((115, 145), 'os.listdir', 'os.listdir', (['spotdl.args.folder'], {}), '(spotdl.args.folder)\n', (125, 145), False, 'import os\n'), ((284, 321), 'spotdl.generate_youtube_url', 'spotdl.generate_youtube_url', (['raw_song'], {}), '(raw_song)\n', (311, 321), False, 'import spotdl\n'), ((475, 499), 'spotdl.go_pafy', 'spotd... |
# The Purpose of this script is to parse the domain elements from a SHOP3
# planning domain file (with .lisp extension) and represent it the domain in
# json format. Requires the filename of the
# .lisp to be parsed and the name of the output file (preferably a JSON).
# Imports
import json
import re
import sys
def ... | [
"json.dump"
] | [((7698, 7740), 'json.dump', 'json.dump', (['domain_def', 'json_file'], {'indent': '(4)'}), '(domain_def, json_file, indent=4)\n', (7707, 7740), False, 'import json\n')] |
from setuptools import setup, find_packages
from codecs import open
import ruamel.yaml as yaml
def load_yaml(file: str, keep_order: bool = False) -> dict:
with open(file, 'r') as stream:
if keep_order:
return yaml.load(stream.read(), Loader=yaml.RoundTripLoader)
else:
retur... | [
"codecs.open",
"setuptools.find_packages"
] | [((359, 376), 'codecs.open', 'open', (['"""README.md"""'], {}), "('README.md')\n", (363, 376), False, 'from codecs import open\n'), ((166, 181), 'codecs.open', 'open', (['file', '"""r"""'], {}), "(file, 'r')\n", (170, 181), False, 'from codecs import open\n'), ((1087, 1141), 'setuptools.find_packages', 'find_packages',... |
# This code is part of Mthree.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | [
"qiskit.QuantumCircuit",
"qiskit.test.mock.FakeAthens",
"numpy.allclose",
"numpy.ones",
"scipy.sparse.linalg.LinearOperator",
"numpy.arange",
"qiskit.execute",
"mthree.M3Mitigation"
] | [((833, 845), 'qiskit.test.mock.FakeAthens', 'FakeAthens', ([], {}), '()\n', (843, 845), False, 'from qiskit.test.mock import FakeAthens\n'), ((856, 873), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['(5)'], {}), '(5)\n', (870, 873), False, 'from qiskit import QuantumCircuit, execute\n'), ((1042, 1070), 'mthree.M3Mitig... |
import numpy as np
import math
def spatial_accuracy(ps1, ps2, thresh):
'''
Args) ps1, ps2 : normalized point sets
Retern) acc: spatial accuracy
'''
assert len(ps1) == len(ps2), \
f"length of given point sets are differenct: len(ps1)={len(ps1)}, len(ps2)={len(ps2)}"
dists = (ps... | [
"numpy.mean",
"numpy.sum",
"numpy.sqrt"
] | [((346, 368), 'numpy.sum', 'np.sum', (['dists'], {'axis': '(-1)'}), '(dists, axis=-1)\n', (352, 368), True, 'import numpy as np\n'), ((381, 395), 'numpy.sqrt', 'np.sqrt', (['dists'], {}), '(dists)\n', (388, 395), True, 'import numpy as np\n'), ((407, 431), 'numpy.mean', 'np.mean', (['(dists <= thresh)'], {}), '(dists <... |
import pstats
import os
from hatchet.util.profiler import Profiler
def f():
for i in range(1000):
for j in range(1000):
i * j
def test_start():
prf = Profiler()
prf.start()
prf.end()
t_1 = prf.getRuntime()
prf.start()
f()
prf.end()
t_2 = p... | [
"hatchet.util.profiler.Profiler",
"os.path.exists",
"pstats.Stats",
"os.remove"
] | [((194, 204), 'hatchet.util.profiler.Profiler', 'Profiler', ([], {}), '()\n', (202, 204), False, 'from hatchet.util.profiler import Profiler\n'), ((391, 401), 'hatchet.util.profiler.Profiler', 'Profiler', ([], {}), '()\n', (399, 401), False, 'from hatchet.util.profiler import Profiler\n'), ((608, 618), 'hatchet.util.pr... |
from omegaconf import DictConfig, OmegaConf
import hydra
import jax
from jax import random, numpy as np, value_and_grad, jit, tree_util
from optax import (
chain,
clip_by_global_norm,
scale_by_adam,
scale,
apply_updates,
add_decayed_weights,
masked,
)
from clap.models import CLAP
# data
... | [
"clap.models.CLAP",
"omegaconf.OmegaConf.to_yaml",
"jax.tree_util.tree_map",
"optax.add_decayed_weights",
"optax.scale",
"optax.apply_updates",
"jax.random.PRNGKey",
"hydra.main",
"optax.clip_by_global_norm",
"clap.datasets.PairTextSpectrogramTFRecords",
"optax.scale_by_adam",
"hydra.utils.get... | [((378, 411), 'hydra.main', 'hydra.main', ([], {'config_path': '"""configs"""'}), "(config_path='configs')\n", (388, 411), False, 'import hydra\n'), ((509, 542), 'jax.random.PRNGKey', 'random.PRNGKey', (['cfg.training.seed'], {}), '(cfg.training.seed)\n', (523, 542), False, 'from jax import random, numpy as np, value_a... |
import aiomonitor
import asyncio
def main():
"""
Functions that launches the asynchronous REPL.
"""
# Get the current event loop
loop = asyncio.get_event_loop()
# While the moonitor is running
with aiomonitor.start_monitor(loop=loop):
# Keep the loop working
loop.run_foreve... | [
"aiomonitor.start_monitor",
"asyncio.get_event_loop"
] | [((158, 182), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (180, 182), False, 'import asyncio\n'), ((228, 263), 'aiomonitor.start_monitor', 'aiomonitor.start_monitor', ([], {'loop': 'loop'}), '(loop=loop)\n', (252, 263), False, 'import aiomonitor\n')] |
import numpy as np
from math import pi,asin,sin
import lattice_utils as lu
from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear
from mpl_toolkits.axes_grid.axislines import Subplot
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
def dynamic_range(Efixed,E,E_max,th... | [
"matplotlib.pyplot.title",
"math.asin",
"numpy.empty",
"lattice_utils.lattice",
"mpl_toolkits.axes_grid.axislines.Subplot",
"matplotlib.pyplot.figure",
"numpy.arange",
"lattice_utils.dspacing",
"numpy.round",
"mpl_toolkits.axes_grid.grid_helper_curvelinear.GridHelperCurveLinear",
"numpy.linspace... | [((230, 251), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (244, 251), False, 'import matplotlib\n'), ((474, 500), 'numpy.linspace', 'np.linspace', (['(0)', 'E_max', '(100)'], {}), '(0, E_max, 100)\n', (485, 500), True, 'import numpy as np\n'), ((513, 606), 'numpy.arange', 'np.arange', (['(thet... |
import argparse
from learning_model_goods import GoodsLearningModel
from learning_model_towns import TownsLearningModel
from learning_model_rates import RatesLearningModel
from learning_model_arrows import ArrowsLearningModel
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-... | [
"argparse.ArgumentParser",
"learning_model_goods.GoodsLearningModel",
"learning_model_rates.RatesLearningModel",
"learning_model_towns.TownsLearningModel",
"learning_model_arrows.ArrowsLearningModel"
] | [((268, 293), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (291, 293), False, 'import argparse\n'), ((616, 683), 'learning_model_goods.GoodsLearningModel', 'GoodsLearningModel', (['args.input_dir', 'args.model_dir', 'args.label_path'], {}), '(args.input_dir, args.model_dir, args.label_path)\n... |
import sys
from pprint import pprint
from silk import Silk, ValidationError
from silk.mixed import Monitor, SilkBackend, MixedObject
def reset_backend(sb=None):
if sb is None:
sb = silk_backend
sb._data = None
sb._form = None
sb._storage = None
sb._silk = None
def adder(self, other):
r... | [
"numpy.sum",
"math.sqrt",
"silk.mixed.SilkBackend",
"silk.mixed.Monitor",
"numpy.array",
"pprint.pprint",
"silk.Silk",
"silk.mixed.MixedObject"
] | [((357, 370), 'silk.mixed.SilkBackend', 'SilkBackend', ([], {}), '()\n', (368, 370), False, 'from silk.mixed import Monitor, SilkBackend, MixedObject\n'), ((381, 402), 'silk.mixed.Monitor', 'Monitor', (['silk_backend'], {}), '(silk_backend)\n', (388, 402), False, 'from silk.mixed import Monitor, SilkBackend, MixedObjec... |
import os
import click
from flask import Flask
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
db_url = os.environ.get("DATABASE_URL")
if db_url is None:
db_... | [
"os.makedirs",
"flask.Flask",
"click.echo",
"application.videos.models.Video",
"click.command",
"os.environ.get",
"flask_sqlalchemy.SQLAlchemy",
"os.path.join"
] | [((133, 145), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', ([], {}), '()\n', (143, 145), False, 'from flask_sqlalchemy import SQLAlchemy\n'), ((1821, 1845), 'click.command', 'click.command', (['"""init-db"""'], {}), "('init-db')\n", (1834, 1845), False, 'import click\n'), ((193, 239), 'flask.Flask', 'Flask', (['__name_... |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import numpy as np
import tensorflow as tf
from tensorflow_deeplab_resnet.deeplab_resnet.model import DeepLabResNetModel as deeplab101
from util.processing_tools import *
from util import loss
class CBCENet(object):
def __init__(self, batch_size = 1,
... | [
"tensorflow.reduce_sum",
"tensorflow.compat.v1.train.polynomial_decay",
"tensorflow.trainable_variables",
"tensorflow.nn.tanh",
"tensorflow.constant_initializer",
"tensorflow.reshape",
"tensorflow.nn.l2_normalize",
"tensorflow.compat.v1.get_variable_scope",
"tensorflow.sigmoid",
"tensorflow.matmul... | [((1952, 2028), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[self.batch_size, self.phrase_num, self.num_steps]'], {}), '(tf.int32, [self.batch_size, self.phrase_num, self.num_steps])\n', (1966, 2028), True, 'import tensorflow as tf\n'), ((2047, 2111), 'tensorflow.placeholder', 'tf.placeholder', (['tf.flo... |
import numpy as np
from collections import OrderedDict
import logging
import astropy.units as apu
from astropy import table
from astropy.extern import six
from astropy import coordinates
from astropyp.utils import misc
logger = logging.getLogger('astropyp.catalog')
class Catalog(object):
"""
Wrapper for `~as... | [
"numpy.ones",
"astropy.table.Table",
"numpy.sum",
"numpy.zeros",
"numpy.isfinite",
"logging.getLogger",
"astropyp.utils.misc.update_ma_idx",
"numpy.argsort",
"numpy.ma.array",
"numpy.fliplr",
"numpy.where",
"numpy.array",
"numpy.hstack",
"numpy.ma.vstack",
"collections.OrderedDict",
"n... | [((230, 267), 'logging.getLogger', 'logging.getLogger', (['"""astropyp.catalog"""'], {}), "('astropyp.catalog')\n", (247, 267), False, 'import logging\n'), ((5558, 5573), 'numpy.argsort', 'np.argsort', (['idx'], {}), '(idx)\n', (5568, 5573), True, 'import numpy as np\n'), ((8984, 8999), 'numpy.isfinite', 'np.isfinite',... |
# -*- coding: utf-8 -*-
# Copyright (c) Ezcad Development Team. All Rights Reserved.
"""
How to run? pytest this.py or python -m pytest this.py
"""
from qtpy.QtCore import Qt
from gopoint.tool.zoep_dialog import Dialog
def test_zoep_dialog(qtbot):
dialog = Dialog()
dialog.sig_start.connect(print)
dialog... | [
"gopoint.tool.zoep_dialog.Dialog"
] | [((265, 273), 'gopoint.tool.zoep_dialog.Dialog', 'Dialog', ([], {}), '()\n', (271, 273), False, 'from gopoint.tool.zoep_dialog import Dialog\n')] |
from sys import stdout
from annoying.functions import get_object_or_None
from django.core.management import BaseCommand
from pixelpuncher.item.models import ItemType, ItemDrop, DropTable
class Command(BaseCommand):
help = "Create item drops based on item_type level_requirements"
def handle(self, *args, **o... | [
"pixelpuncher.item.models.ItemDrop",
"pixelpuncher.item.models.DropTable.objects.filter",
"pixelpuncher.item.models.ItemType.objects.filter",
"annoying.functions.get_object_or_None"
] | [((375, 425), 'pixelpuncher.item.models.DropTable.objects.filter', 'DropTable.objects.filter', ([], {'name__startswith': '"""Level"""'}), "(name__startswith='Level')\n", (399, 425), False, 'from pixelpuncher.item.models import ItemType, ItemDrop, DropTable\n'), ((491, 562), 'pixelpuncher.item.models.ItemType.objects.fi... |
import pyqtgraph as pg
app = pg.mkQApp()
def test_ArrowItem_parent():
parent = pg.GraphicsObject()
a = pg.ArrowItem(parent=parent, pos=(10, 10))
assert a.parentItem() is parent
assert a.pos() == pg.Point(10, 10)
| [
"pyqtgraph.mkQApp",
"pyqtgraph.GraphicsObject",
"pyqtgraph.Point",
"pyqtgraph.ArrowItem"
] | [((30, 41), 'pyqtgraph.mkQApp', 'pg.mkQApp', ([], {}), '()\n', (39, 41), True, 'import pyqtgraph as pg\n'), ((85, 104), 'pyqtgraph.GraphicsObject', 'pg.GraphicsObject', ([], {}), '()\n', (102, 104), True, 'import pyqtgraph as pg\n'), ((113, 154), 'pyqtgraph.ArrowItem', 'pg.ArrowItem', ([], {'parent': 'parent', 'pos': '... |
#!/usr/bin/env python
# Copyright (C) 2017 SignalFx, Inc. All rights reserved.
# This script is used to update the versions of all the artifacts, the
# User-Agent version of the library, and the documented version in the README
# file, all at once, as part of the release process.
import logging
import os
import re
i... | [
"subprocess.Popen",
"logging.basicConfig",
"os.path.basename",
"os.getcwd",
"sys.stderr.write",
"os.chdir",
"sys.exit",
"re.compile"
] | [((377, 435), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.INFO'}), '(stream=sys.stdout, level=logging.INFO)\n', (396, 435), False, 'import logging\n'), ((463, 489), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (479, 489), False, 'import os... |
import datetime
from flask_login.mixins import UserMixin
from sqlalchemy import LargeBinary
from app import db
from app.crypto.pw_hashing import global_salt_hash, indiv_salt_hash
from app.data_access.user_controller_errors import UserAlreadyActive
class User(UserMixin, db.Model):
id = db.Column(db.Integer, prim... | [
"app.db.TIMESTAMP",
"app.crypto.pw_hashing.indiv_salt_hash",
"sqlalchemy.LargeBinary",
"app.db.func.current_timestamp",
"app.crypto.pw_hashing.global_salt_hash",
"app.data_access.user_controller_errors.UserAlreadyActive",
"app.db.Column",
"app.db.String"
] | [((294, 333), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (303, 333), False, 'from app import db\n'), ((362, 373), 'app.db.String', 'db.String', ([], {}), '()\n', (371, 373), False, 'from app import db\n'), ((431, 442), 'app.db.String', 'db.String', ([]... |
from __future__ import annotations
import logging
from typing import (
Optional,
Union,
NewType,
List,
Any,
Callable
)
import numpy as np # type: ignore
import numba # type: ignore
from numba.core.typing import cffi_utils # type: ignore
from sunode import _cvodes
__all__ = [
"lib", ... | [
"numba.core.typing.cffi_utils.register_module",
"numpy.frombuffer",
"numpy.dtype",
"numba.types.Opaque",
"typing.NewType",
"logging.getLogger"
] | [((423, 456), 'logging.getLogger', 'logging.getLogger', (['"""sunode.basic"""'], {}), "('sunode.basic')\n", (440, 456), False, 'import logging\n'), ((505, 540), 'numba.core.typing.cffi_utils.register_module', 'cffi_utils.register_module', (['_cvodes'], {}), '(_cvodes)\n', (531, 540), False, 'from numba.core.typing impo... |
import time
from unittest.mock import MagicMock
import pytest
from tuxdroid.head import Head
from tuxdroid.mouth import Mouth
from tuxdroid.gpio import GPIO
from tuxdroid.errors import TuxDroidMouthError
class TestTuxMouth(object):
def test_mouth_01(self):
# Defining callbacks
self.mouth_opened... | [
"unittest.mock.MagicMock",
"tuxdroid.gpio.GPIO.set_config_",
"tuxdroid.head.Head",
"pytest.raises",
"tuxdroid.mouth.Mouth"
] | [((1159, 1193), 'tuxdroid.gpio.GPIO.set_config_', 'GPIO.set_config_', (["{'head': config}"], {}), "({'head': config})\n", (1175, 1193), False, 'from tuxdroid.gpio import GPIO\n'), ((1209, 1221), 'tuxdroid.head.Head', 'Head', (['config'], {}), '(config)\n', (1213, 1221), False, 'from tuxdroid.head import Head\n'), ((318... |
from base_loader import BaseLoader
import json
import os
class TeamsDCLoader(BaseLoader):
def _init(self):
self.url = 'https://media.itfdataservices.com/nations/dc/en'
self.LOGFILE_NAME = os.path.splitext(os.path.basename(__file__))[0] + '.log'
self.CSVFILE_NAME = ''
self.TABLE_NAM... | [
"json.loads",
"os.path.basename"
] | [((553, 582), 'json.loads', 'json.loads', (['self.responce_str'], {}), '(self.responce_str)\n', (563, 582), False, 'import json\n'), ((227, 253), 'os.path.basename', 'os.path.basename', (['__file__'], {}), '(__file__)\n', (243, 253), False, 'import os\n')] |
"""
This script demonstrates initialisation, training, evaluation, and forecasting of ForecastNet. The dataset used for the
time-invariance test in section 6.1 of the ForecastNet paper is used for this demonstration.
Paper:
"ForecastNet: A Time-Variant Deep Feed-Forward Neural Network Architecture for Multi-Step-Ahead... | [
"forecastNet.forecastnet",
"numpy.random.seed",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.std",
"numpy.zeros",
"demoDataset.generate_data",
"evaluate.evaluate",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"train.train"
] | [((656, 673), 'numpy.random.seed', 'np.random.seed', (['(1)'], {}), '(1)\n', (670, 673), True, 'import numpy as np\n'), ((742, 774), 'demoDataset.generate_data', 'generate_data', ([], {'T': '(2750)', 'period': '(50)'}), '(T=2750, period=50)\n', (755, 774), False, 'from demoDataset import generate_data\n'), ((993, 1194)... |
from flask import Flask
from app.models import Users, Products, User_Reviews
from rake_nltk import Rake
import nltk
from nltk.corpus import stopwords
import psycopg2
def getText(product_name):
# texts = User_Reviews.query.filter_by(product_name=product_name).all()
# test using:
texts = User_Reviews.q... | [
"app.models.User_Reviews.query.filter_by",
"nltk.wordpunct_tokenize",
"app.models.Products.query.all",
"nltk.corpus.stopwords.words",
"nltk.corpus.words.words",
"psycopg2.connect"
] | [((2737, 2757), 'app.models.Products.query.all', 'Products.query.all', ([], {}), '()\n', (2755, 2757), False, 'from app.models import Users, Products, User_Reviews\n'), ((2964, 2984), 'app.models.Products.query.all', 'Products.query.all', ([], {}), '()\n', (2982, 2984), False, 'from app.models import Users, Products, U... |
from importlib._bootstrap import spec_from_loader
import requests, sys
class PysnipImporter:
"""
`from pysnip import hello_world` will search through pysnip.marcusweinberger.repl.co's db and attempt to download and import hello_world
"""
API_URL = "https://pysnip.marcusweinberger.repl.co"
@classm... | [
"importlib._bootstrap.spec_from_loader",
"requests.get"
] | [((399, 445), 'importlib._bootstrap.spec_from_loader', 'spec_from_loader', (['fullname', 'cls'], {'origin': '"""hell"""'}), "(fullname, cls, origin='hell')\n", (415, 445), False, 'from importlib._bootstrap import spec_from_loader\n'), ((1688, 1705), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1700, 1705)... |
import random
from django.apps import apps
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
from django.db.models.manager import Manager
from django.utils.timezone import now
from core.models.base import NationChoiceMode, GameStatus, Deadli... | [
"django.db.models.ManyToManyField",
"django.apps.apps.get_model",
"django.db.models.manager.Manager.from_queryset",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.utils.timezone.now",
"random.shuffle",
"django.db.models.BooleanField",
... | [((991, 1026), 'django.db.models.manager.Manager.from_queryset', 'Manager.from_queryset', (['GameQuerySet'], {}), '(GameQuerySet)\n', (1012, 1026), False, 'from django.db.models.manager import Manager\n'), ((1081, 1173), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Variant"""'], {'null': '(False)', 'on_del... |
import sys
import notify2
from notify2 import Notification
notify2.init(sys.argv[0])
def send(process=None, subject_format='{executable} process {pid} ended',
timeout=notify2.EXPIRES_NEVER):
"""Display a Desktop Notification via DBUS (notify2)
:param process: information about process. (.info() i... | [
"notify2.init"
] | [((62, 87), 'notify2.init', 'notify2.init', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (74, 87), False, 'import notify2\n')] |
"""
This is the main class for the NARPS analysis
There are three classes defined here:
Narps: this is a class that wraps the entire dataset
NarpsTeam: this class is instantiated for each team
NarpsDirs: This class contains info about all
of the directories that are needed for this and
subsequent analyses
The code und... | [
"os.mkdir",
"os.remove",
"pickle.dump",
"numpy.sum",
"numpy.nan_to_num",
"numpy.abs",
"pandas.read_csv",
"numpy.ones",
"numpy.isnan",
"pickle.load",
"numpy.mean",
"shutil.rmtree",
"nipype.interfaces.fsl.model.SmoothEstimate",
"os.path.join",
"shutil.copy",
"pandas.DataFrame",
"utils.... | [((3282, 3333), 'os.path.join', 'os.path.join', (["os.environ['FSLDIR']", '"""data/standard"""'], {}), "(os.environ['FSLDIR'], 'data/standard')\n", (3294, 3333), False, 'import os\n'), ((3598, 3642), 'os.path.join', 'os.path.join', (["self.dirs['logs']", '"""narps.txt"""'], {}), "(self.dirs['logs'], 'narps.txt')\n", (3... |
#!/usr/bin/env python3
#
# Author: jon4hz
# Date: 02.03.20201
# Desc: Building a board in pygame
#
#######################################################################################################################
import sys, pygame
# pylint: disable=no-name-in-module
from pygame.constants import (
QUIT,
... | [
"pygame.quit",
"pygame.mouse.set_visible",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Rect",
"pygame.draw.rect",
"pygame.init",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption",
"sys.exit"
] | [((580, 593), 'pygame.init', 'pygame.init', ([], {}), '()\n', (591, 593), False, 'import sys, pygame\n'), ((645, 674), 'pygame.display.set_mode', 'pygame.display.set_mode', (['SIZE'], {}), '(SIZE)\n', (668, 674), False, 'import sys, pygame\n'), ((679, 712), 'pygame.display.set_caption', 'pygame.display.set_caption', ([... |
import asyncio
import re
import struct
QUERY_HEADER_FORMAT = '=IB'
QUERY = struct.pack(QUERY_HEADER_FORMAT, 0xffffffff, 0x54) + b'Source Engine Query' + struct.pack('=B', 0x00)
RESPONSE_HEADER_FORMAT = '=IBB'
RESPONSE_DATA_FORMAT = '=HBBBBBBB'
class SteamProtocol(asyncio.DatagramProtocol):
def __init__(self, fut... | [
"struct.unpack_from",
"asyncio.sleep",
"struct.pack",
"asyncio.get_running_loop",
"struct.calcsize",
"re.compile"
] | [((154, 174), 'struct.pack', 'struct.pack', (['"""=B"""', '(0)'], {}), "('=B', 0)\n", (165, 174), False, 'import struct\n'), ((2169, 2206), 'struct.unpack_from', 'struct.unpack_from', (['data_format', 'data'], {}), '(data_format, data)\n', (2187, 2206), False, 'import struct\n'), ((3185, 3211), 'asyncio.get_running_loo... |
from flask_wtf import Form
from werkzeug.datastructures import MultiDict
from wtforms import TextField
from wtforms.validators import DataRequired
class SendMessageForm(Form):
message = TextField('Message', validators=[DataRequired(message="Message is required")])
imageUrl = TextField('Image URL', validators=... | [
"wtforms.validators.DataRequired",
"werkzeug.datastructures.MultiDict"
] | [((403, 449), 'werkzeug.datastructures.MultiDict', 'MultiDict', (["[('message', ''), ('imageUrl', '')]"], {}), "([('message', ''), ('imageUrl', '')])\n", (412, 449), False, 'from werkzeug.datastructures import MultiDict\n'), ((225, 268), 'wtforms.validators.DataRequired', 'DataRequired', ([], {'message': '"""Message is... |
import json
import requests
import pandas as pd
import datetime
from datetime import datetime
from requests.auth import HTTPBasicAuth
#from static.src.utils import *
#from static.src.utils import return_limit, dizionario_limite,\
# centraline
def return_limit(x):
"""Returns the stand... | [
"datetime.datetime.strptime",
"requests.auth.HTTPBasicAuth",
"json.loads"
] | [((1382, 1400), 'json.loads', 'json.loads', (['r.text'], {}), '(r.text)\n', (1392, 1400), False, 'import json\n'), ((1168, 1208), 'requests.auth.HTTPBasicAuth', 'HTTPBasicAuth', (["auth['user']", "auth['psw']"], {}), "(auth['user'], auth['psw'])\n", (1181, 1208), False, 'from requests.auth import HTTPBasicAuth\n'), ((2... |
import random
from vedmath import VInteger, VMul, VDiv, VProp
random.seed(0)
class Test_VMul:
def test_vert_cross(self):
for _ in range (100):
i1 = random.randint(-999999999, 999999999)
i2 = random.randint(-999999999, 999999999)
v1 = VInteger(i1)
v2 = VInte... | [
"vedmath.VInteger.fromints",
"vedmath.VMul.under_base",
"random.randint",
"vedmath.VDiv.nikhilam_by_9_three_digit",
"vedmath.VMul.over_base",
"vedmath.VProp.from_vinculum",
"vedmath.VInteger",
"random.seed",
"vedmath.VMul.vert_cross",
"vedmath.VDiv.nikhilam_by_9_many_digit"
] | [((64, 78), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (75, 78), False, 'import random\n'), ((175, 212), 'random.randint', 'random.randint', (['(-999999999)', '(999999999)'], {}), '(-999999999, 999999999)\n', (189, 212), False, 'import random\n'), ((230, 267), 'random.randint', 'random.randint', (['(-9999999... |
import optmod
import unittest
import numpy as np
class TestAdd(unittest.TestCase):
def test_contruction(self):
x = optmod.variable.VariableScalar(name='x')
f = optmod.function.add([x, optmod.expression.make_Expression(1.)])
self.assertEqual(f.name, 'add')
self.assertEqual(len(f.a... | [
"numpy.matrix",
"optmod.utils.repr_number",
"optmod.variable.VariableMatrix",
"optmod.variable.VariableScalar",
"optmod.constant.Constant",
"numpy.random.random",
"optmod.expression.make_Expression",
"numpy.array"
] | [((130, 170), 'optmod.variable.VariableScalar', 'optmod.variable.VariableScalar', ([], {'name': '"""x"""'}), "(name='x')\n", (160, 170), False, 'import optmod\n'), ((702, 731), 'optmod.constant.Constant', 'optmod.constant.Constant', (['(4.0)'], {}), '(4.0)\n', (726, 731), False, 'import optmod\n'), ((743, 772), 'optmod... |
from rbac.models import Role
def is_permission(user_obj, request):
permissions_list = []
permissions_names = []
permissions_menu_dict = {}
ret = Role.objects.filter(userinfo=user_obj).values('permissions__url',
'permissions__title',
... | [
"rbac.models.Role.objects.filter"
] | [((163, 201), 'rbac.models.Role.objects.filter', 'Role.objects.filter', ([], {'userinfo': 'user_obj'}), '(userinfo=user_obj)\n', (182, 201), False, 'from rbac.models import Role\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
import tkinter as tk
from pymarc import Field, Record
def output_to_text(output_text, doc_year, doc_num, non_filing, doc_title,
doc_iss_year, num_pages, welcomes, this_res, date_field_008,
time_field_590, field_710, ti... | [
"random.randint",
"pymarc.Field",
"pymarc.Record"
] | [((1407, 1415), 'pymarc.Record', 'Record', ([], {}), '()\n', (1413, 1415), False, 'from pymarc import Field, Record\n'), ((1446, 1477), 'pymarc.Field', 'Field', ([], {'tag': '"""000"""', 'data': '"""im 0c"""'}), "(tag='000', data='im 0c')\n", (1451, 1477), False, 'from pymarc import Field, Record\n'), ((1544, 1620), ... |
import basetest
import unittest
import os
class StashTest(basetest.HookTestCase):
STASH_REGEX = "(^|\n)Stashing local changes"
UNSTASH_REGEX = "(^|\n)Unstashing local changes"
def setUp(self):
super(StashTest, self).setUp()
self.createAndCommitFiles({
"existing1.txt": "file ex... | [
"unittest.main",
"os.remove",
"os.path.join"
] | [((2512, 2527), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2525, 2527), False, 'import unittest\n'), ((455, 495), 'os.path.join', 'os.path.join', (['self.root', '"""existing1.txt"""'], {}), "(self.root, 'existing1.txt')\n", (467, 495), False, 'import os\n'), ((524, 564), 'os.path.join', 'os.path.join', (['sel... |
import flask
import webbrowser
import threading
import subprocess
from .__init__ import CompuTradeEngine
def start_server():
app = flask.Flask(__name__)
@app.route("/")
def home():
return flask.render_template('index.html')
@app.route("/run_script")
def run():
subprocess.run(["ls -l... | [
"subprocess.run",
"webbrowser.open",
"flask.Flask",
"flask.render_template"
] | [((135, 156), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (146, 156), False, 'import flask\n'), ((208, 243), 'flask.render_template', 'flask.render_template', (['"""index.html"""'], {}), "('index.html')\n", (229, 243), False, 'import flask\n'), ((298, 347), 'subprocess.run', 'subprocess.run', (["[... |
__all__ = ['ANTsImage',
'LabelImage',
'copy_image_info',
'set_origin',
'get_origin',
'set_direction',
'get_direction',
'set_spacing',
'get_spacing',
'image_physical_space_consistency',
'image_type_cast',
... | [
"numpy.stack",
"pandas.DataFrame",
"functools.partialmethod",
"numpy.asarray",
"numpy.allclose",
"numpy.sort",
"numpy.rollaxis",
"os.path.expanduser",
"numpy.unique"
] | [((11412, 11440), 'os.path.expanduser', 'os.path.expanduser', (['filename'], {}), '(filename)\n', (11430, 11440), False, 'import os\n'), ((31292, 31351), 'numpy.allclose', 'np.allclose', (['img1.direction', 'img2.direction'], {'atol': 'tolerance'}), '(img1.direction, img2.direction, atol=tolerance)\n', (31303, 31351), ... |
"""
Tests for all functions in cost_function.py
"""
import numpy as np
from pyquil.quil import (QubitPlaceholder,
get_default_qubit_mapping)
from pyquil.api import WavefunctionSimulator
from pyquil import get_qc, Program
from pyquil.gates import RX, RY, X
from pyquil.paulis import PauliSum, Pa... | [
"pyquil.quil.QubitPlaceholder",
"entropica_qaoa.vqe.cost_function.PrepareAndMeasureOnQVM",
"pyquil.paulis.PauliTerm",
"numpy.allclose",
"pyquil.get_qc",
"entropica_qaoa.vqe.cost_function.PrepareAndMeasureOnWFSim",
"pyquil.api.WavefunctionSimulator",
"pyquil.gates.RY",
"pyquil.gates.RX",
"pyquil.Pr... | [((518, 527), 'pyquil.Program', 'Program', ([], {}), '()\n', (525, 527), False, 'from pyquil import get_qc, Program\n'), ((791, 808), 'pyquil.paulis.PauliTerm', 'PauliTerm', (['"""Z"""', '(0)'], {}), "('Z', 0)\n", (800, 808), False, 'from pyquil.paulis import PauliSum, PauliTerm\n'), ((821, 838), 'pyquil.paulis.PauliTe... |
import logging
import sys
from aiohttp import web
from scorebot.api import api_utils
from scorebot.db import db_api
from scorebot.triggers.check import check_triggers_for_score
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
LOG = logging.getLogger(__name__)
async def _handle_score_request(score_db_api... | [
"aiohttp.web.Response",
"logging.basicConfig",
"scorebot.triggers.check.check_triggers_for_score",
"scorebot.api.api_utils.validate_score",
"scorebot.api.api_utils.get_player_team",
"aiohttp.web.Application",
"logging.getLogger"
] | [((180, 239), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.DEBUG'}), '(stream=sys.stdout, level=logging.DEBUG)\n', (199, 239), False, 'import logging\n'), ((246, 273), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (263, 273), False, 'impor... |
import pytest
from pymongo import MongoClient
import sparta as flask_app
# test_database_name = 'sparta'
# client = MongoClient('localhost', 27017)
# db = client.get_database(test_database_name)
@pytest.fixture
def app():
test_app = flask_app.create_app()
yield test_app
# # 모든 테스트를 마치고 정리하는 부분
# cl... | [
"sparta.create_app"
] | [((240, 262), 'sparta.create_app', 'flask_app.create_app', ([], {}), '()\n', (260, 262), True, 'import sparta as flask_app\n')] |
"""
Program to test the riverProblem implementation.
BOILERPLATE, DO NOT EDIT THIS FILE. If you wish to test your implementation
differently during development, add a main() function to the riverProblem
module itself.
"""
from riverProblem import River_problem
from searchGeneric import AStarSearcher
def smoke_test()... | [
"riverProblem.River_problem",
"searchGeneric.AStarSearcher"
] | [((471, 486), 'riverProblem.River_problem', 'River_problem', ([], {}), '()\n', (484, 486), False, 'from riverProblem import River_problem\n'), ((824, 839), 'riverProblem.River_problem', 'River_problem', ([], {}), '()\n', (837, 839), False, 'from riverProblem import River_problem\n'), ((848, 867), 'searchGeneric.AStarSe... |
from flask import Flask,request
from flask_restful import Resource
from models import Order,orders
class SpecificOrder(Resource):
def get(self,id):
order = Order().get_by_id(id)
if order:
return {"order":order.serialize()},200
return {"message":"order not found"},404
def ... | [
"models.orders.remove",
"models.orders.append",
"flask.request.get_json",
"models.Order"
] | [((830, 848), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (846, 848), False, 'from flask import Flask, request\n'), ((865, 920), 'models.Order', 'Order', (["data['name']", "data['description']", "data['price']"], {}), "(data['name'], data['description'], data['price'])\n", (870, 920), False, 'from m... |
import sys
import numpy as np
from pprint import pprint
import time
import os
import argparse as argparse
import json
import queue
OBSTACLE = 100
INIT_VAL = 10000
DESTINATION = -1
def loadProject(projectFile):
with open(projectFile) as f:
return json.load(f)
def searchPath(curLoc, weight=0):
global ... | [
"numpy.full",
"json.load",
"argparse.ArgumentParser",
"json.loads",
"numpy.savetxt",
"numpy.reshape",
"pprint.pprint"
] | [((3556, 3594), 'numpy.reshape', 'np.reshape', (['rawMap', '(numRows, numCols)'], {}), '(rawMap, (numRows, numCols))\n', (3566, 3594), True, 'import numpy as np\n'), ((3614, 3660), 'numpy.full', 'np.full', (['rawMap.shape', 'INIT_VAL'], {'dtype': '"""int16"""'}), "(rawMap.shape, INIT_VAL, dtype='int16')\n", (3621, 3660... |
import pandas as pd
import h5py
import numpy as np
tng = 300
if tng==100:
extension = 'L75n1820'
elif tng == 300:
extension = 'L205n2500'
else:
extension = 'NotFound'
data_path = '/cosma5/data/dp004/hvrn44/HOD/'
if tng==100:
matching_file = f'MatchedHaloes_{extension}TNG.dat'
else:
matching_file... | [
"pandas.DataFrame",
"h5py.File",
"pandas.read_csv",
"pandas.merge",
"numpy.vstack"
] | [((616, 742), 'pandas.read_csv', 'pd.read_csv', (['(data_path + matching_file)'], {'delimiter': '""" """', 'skiprows': '(1)', 'names': "['ID_DMO', 'ID_HYDRO', 'M200_DMO', 'M200_HYDRO']"}), "(data_path + matching_file, delimiter=' ', skiprows=1, names=[\n 'ID_DMO', 'ID_HYDRO', 'M200_DMO', 'M200_HYDRO'])\n", (627, 742... |
#!C:\Users\Personal\AppData\Local\Programs\Python\Python37
print("Content-Type:text/html")
print()
import cgi
print("<h1>Welcome to Python<h1>")
print("<hr/>")
print("<h1>Using input tag</h1>")
print("<body bgcolor='red'>")
form=cgi.FieldStorage()
name=form.getvalue("name")
email=form.getvalue("email")
... | [
"cgi.FieldStorage"
] | [((241, 259), 'cgi.FieldStorage', 'cgi.FieldStorage', ([], {}), '()\n', (257, 259), False, 'import cgi\n')] |
"""WebSockets for gevent."""
# parts borrowed from trio-websocket
# Copyright (c) 2018 <NAME>
import collections
import enum
import logging
import secrets
import struct
import sys
import time
import gevent
import gevent.event
import gevent.lock
import gevent.pywsgi
import gevent.queue
import gevent.socket
import wsp... | [
"secrets.randbits",
"wsproto.events.CloseConnection",
"gevent.queue.Queue",
"gevent.getcurrent",
"wsproto.events.BytesMessage",
"gevent.timeout.Timeout",
"gevent.queue.Channel",
"time.monotonic",
"gevent.lock.BoundedSemaphore",
"collections.namedtuple",
"sys.exc_info",
"collections.OrderedDict... | [((581, 631), 'collections.namedtuple', 'collections.namedtuple', (['"""Proposal"""', '"""subprotocols"""'], {}), "('Proposal', 'subprotocols')\n", (603, 631), False, 'import collections\n'), ((5633, 5665), 'wsproto.H11Handshake', 'wsproto.H11Handshake', (['self._type'], {}), '(self._type)\n', (5653, 5665), False, 'imp... |
#-*-coding:Utf-8 -*
"""Launch this script to merge two rating imports with eachother."""
import numpy as np
import os
import pickle
import re
from scipy.sparse import csc_matrix
def sorted_search(ar, x, get_closest=False):#ar array x
if len(ar) == 0:
return 0 if get_closest else None
if len(ar) == 1:
if ar[0]... | [
"re.match",
"os.mkdir",
"scipy.sparse.csc_matrix",
"os.listdir"
] | [((1093, 1109), 'os.listdir', 'os.listdir', (['base'], {}), '(base)\n', (1103, 1109), False, 'import os\n'), ((6292, 6315), 'os.mkdir', 'os.mkdir', (['(base + output)'], {}), '(base + output)\n', (6300, 6315), False, 'import os\n'), ((1143, 1174), 're.match', 're.match', (['"""[0-9]+_to_[0-9]+"""', 'f'], {}), "('[0-9]+... |
def write_into(origina_address, table_abs_path):
import pandas as pd
from . import get_distance
df = pd.read_csv(table_abs_path)
df['distance_to_'+origina_address] = df.address
df['distance_to_'+origina_address] = df['distance_to_'+origina_address].map(lambda a: get_distance(origina_address, a)... | [
"pandas.read_csv",
"argparse.ArgumentParser"
] | [((115, 142), 'pandas.read_csv', 'pd.read_csv', (['table_abs_path'], {}), '(table_abs_path)\n', (126, 142), True, 'import pandas as pd\n'), ((419, 444), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (442, 444), False, 'import argparse\n')] |
# <NAME> <<EMAIL>>
import logging
import time
from operator import itemgetter
from .WorkingArea import WorkingArea
##__________________________________________________________________||
class TaskPackageDropbox(object):
"""A drop box for task packages.
It puts task packages in a working area and dispatches r... | [
"operator.itemgetter",
"logging.getLogger",
"time.sleep"
] | [((1123, 1150), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1140, 1150), False, 'import logging\n'), ((1471, 1498), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1488, 1498), False, 'import logging\n'), ((3375, 3402), 'logging.getLogger', 'logging.getL... |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import Joy
from std_msgs.msg import String
from std_msgs.msg import Float32
def subpub():
#sub = rospy.Subscriber('joy', Joy, callback_function1)
sub = rospy.Subscriber('joy', Joy, callback_axis)
sub = rospy.Subscriber('joy', Joy, callback_button)... | [
"rospy.Subscriber",
"rospy.Publisher",
"rospy.Rate",
"rospy.loginfo",
"rospy.init_node",
"rospy.spin",
"std_msgs.msg.Float32"
] | [((220, 263), 'rospy.Subscriber', 'rospy.Subscriber', (['"""joy"""', 'Joy', 'callback_axis'], {}), "('joy', Joy, callback_axis)\n", (236, 263), False, 'import rospy\n'), ((275, 320), 'rospy.Subscriber', 'rospy.Subscriber', (['"""joy"""', 'Joy', 'callback_button'], {}), "('joy', Joy, callback_button)\n", (291, 320), Fal... |
import pandas as pd
class Security():
'''
Generic Class that initializes an object to hold price and volume
data on a particular financial security.
'''
def __init__(self, dataframe, security_name, ticker):
'''
Arguments
---------
dataframe Pandas Dataframe. Co... | [
"pandas.to_datetime"
] | [((868, 906), 'pandas.to_datetime', 'pd.to_datetime', (['dataframe.index.values'], {}), '(dataframe.index.values)\n', (882, 906), True, 'import pandas as pd\n')] |
from __future__ import absolute_import
import pytest
import numpy as np
from . import (
get_standard_values_images_box,
get_tensor_decomposition_images_box,
assert_output_properties_box,
assert_output_properties_box_linear,
)
import tensorflow.python.keras.backend as K
from tensorflow.keras.layers impor... | [
"tensorflow.keras.layers.Reshape",
"decomon.layers.decomon_layers.to_monotonic",
"decomon.layers.decomon_reshape.DecomonReshape",
"numpy.transpose",
"tensorflow.keras.layers.Permute",
"tensorflow.python.keras.backend.epsilon",
"tensorflow.python.keras.backend.function",
"numpy.reshape",
"decomon.lay... | [((471, 758), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""odd, m_0, m_1, mode, floatx"""', "[(0, 0, 1, 'hybrid', 32), (0, 0, 1, 'forward', 32), (0, 0, 1, 'ibp', 32), (\n 0, 0, 1, 'hybrid', 64), (0, 0, 1, 'forward', 64), (0, 0, 1, 'ibp', 64),\n (0, 0, 1, 'hybrid', 16), (0, 0, 1, 'forward', 16), (0,... |
# -*- coding: utf-8 -*-
# Copyright (c) St. Anne's University Hospital in Brno. International Clinical
# Research Center, Biomedical Engineering. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
# Std imports
from math import isclose
# Third pary imports
# Local imports... | [
"epycom.bivariate.LinearCorrelation",
"epycom.bivariate.RelativeEntropy",
"epycom.bivariate.PhaseSynchrony",
"math.isclose",
"epycom.bivariate.PhaseConsistency",
"epycom.bivariate.SpectraMultiplication",
"epycom.bivariate.PhaseLagIndex"
] | [((684, 703), 'epycom.bivariate.LinearCorrelation', 'LinearCorrelation', ([], {}), '()\n', (701, 703), False, 'from epycom.bivariate import LinearCorrelation, SpectraMultiplication, RelativeEntropy, PhaseSynchrony, PhaseConsistency, PhaseLagIndex\n'), ((955, 992), 'math.isclose', 'isclose', (['res[0][0]', '(0)'], {'abs... |
import functions as fun
import exceptions as exc
import matplotlib.pyplot as plt
import numpy as np
"""This file tests multiple functions used in the algorithm."""
def testStdevAndMeanOfWholeImage(image,area):
'''Calculates the mean and the standard deviation of an image in a sampling window from 0 to the value ente... | [
"numpy.absolute",
"functions.stdevAndMeanWholeImage",
"exceptions.areValuesEqual",
"numpy.zeros",
"functions.absSumAllPixels",
"functions.image"
] | [((740, 756), 'functions.image', 'fun.image', (['image'], {}), '(image)\n', (749, 756), True, 'import functions as fun\n'), ((1061, 1093), 'numpy.zeros', 'np.zeros', ([], {'shape': '(shape1, shape2)'}), '(shape=(shape1, shape2))\n', (1069, 1093), True, 'import numpy as np\n'), ((1423, 1453), 'functions.absSumAllPixels'... |
#!/usr/bin/python
import cv2
import os
def captureVideo(stop_thread):
#Capture video from webcam
vid_capture = cv2.VideoCapture(0)
vid_cod = cv2.VideoWriter_fourcc(*'XVID')
try:
vid_path = os.environ["appdata"] + "\\Vid.mp4"
except:
vid_path = os.environ["HOME"] + "/Vid.mp4"
output = cv2.VideoWriter(v... | [
"cv2.VideoWriter_fourcc",
"cv2.imwrite",
"cv2.VideoCapture",
"cv2.VideoWriter",
"cv2.destroyAllWindows"
] | [((118, 137), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (134, 137), False, 'import cv2\n'), ((149, 180), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (171, 180), False, 'import cv2\n'), ((303, 355), 'cv2.VideoWriter', 'cv2.VideoWriter', (['vid_path', 'vid_c... |
"""
Enable ```reapy_boost`` distant API.
Running this ReaScript from inside REAPER allows to import ``reapy_boost``
from outside. It creates a persistent Web Interface inside REAPER and
adds the ReaScript ``reapy_boost.reascripts.activate_reapy_server`` to the
Actions list. Importing ``reapy_boost`` from outside REAPE... | [
"reapy_boost.core._JS_generator.generate_js_api",
"reapy_boost.get_resource_path",
"reapy_boost.config.enable_dist_api",
"reapy_boost.generate_imgui",
"sys.exc_info"
] | [((619, 655), 'reapy_boost.config.enable_dist_api', 'reapy_boost.config.enable_dist_api', ([], {}), '()\n', (653, 655), False, 'import reapy_boost\n'), ((824, 876), 'reapy_boost.core._JS_generator.generate_js_api', '_JS_generator.generate_js_api', (['bin_dir', 'api_filename'], {}), '(bin_dir, api_filename)\n', (853, 87... |
import pytest
from conftest import vcf_file, sample_5kb_fasta_file
from cyvcf2 import VCF
from pyfaidx import Sequence
from kipoiseq.dataclasses import Variant, Interval
from kipoiseq.extractors.vcf_seq import IntervalSeqBuilder, \
VariantSeqExtractor, SingleSeqVCFSeqExtractor, SingleVariantVCFSeqExtractor, FastaSt... | [
"kipoiseq.dataclasses.Interval",
"kipoiseq.dataclasses.Variant.from_cyvcf",
"kipoiseq.extractors.vcf_seq.FastaStringExtractor",
"kipoiseq.extractors.vcf_seq.SingleVariantVCFSeqExtractor",
"pytest.raises",
"cyvcf2.VCF",
"kipoiseq.extractors.vcf_seq.VariantSeqExtractor",
"pyfaidx.Sequence",
"kipoiseq.... | [((389, 412), 'kipoiseq.dataclasses.Interval', 'Interval', (['"""chr1"""', '(4)', '(10)'], {}), "('chr1', 4, 10)\n", (397, 412), False, 'from kipoiseq.dataclasses import Variant, Interval\n'), ((418, 441), 'kipoiseq.dataclasses.Interval', 'Interval', (['"""chr1"""', '(5)', '(30)'], {}), "('chr1', 5, 30)\n", (426, 441),... |
from contextlib import wraps
from sqlalchemy import Column, Integer, BigInteger, Boolean, String, Text, ForeignKey, UniqueConstraint, or_
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relationship, backref
from dim import db
from dim.errors import PermissionDeniedError, Inva... | [
"dim.models.get_session_tool",
"dim.db.session.add",
"dim.util.is_reverse_zone",
"sqlalchemy.ext.associationproxy.association_proxy",
"dim.errors.InvalidAccessRightError",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"sqlalchemy.UniqueConstraint",
"inspect.getargspec",
"sqlalchemy.Colum... | [((916, 947), 'sqlalchemy.Column', 'Column', (['Boolean'], {'nullable': '(False)'}), '(Boolean, nullable=False)\n', (922, 947), False, 'from sqlalchemy import Column, Integer, BigInteger, Boolean, String, Text, ForeignKey, UniqueConstraint, or_\n'), ((1384, 1436), 'sqlalchemy.Column', 'Column', (['BigInteger'], {'prima... |
from collections import namedtuple
from contextlib import contextmanager
from typing import Iterable
from sqlalchemy import Column, String
from sqlalchemy.exc import IntegrityError
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class TokenMa... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.sessionmaker",
"collections.namedtuple",
"sqlalchemy.Column"
] | [((286, 304), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (302, 304), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((648, 708), 'collections.namedtuple', 'namedtuple', (['"""TokenMapping"""', "['user_address', 'client_token']"], {}), "('TokenMapping', ['u... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author : <NAME>
# @Email : <EMAIL>
# @Time : 19-9-3 下午2:53
# @Version : 1.0
# @File : forms
# @Software : PyCharm
from django import forms
from captcha.fields import CaptchaField
from django.contrib.auth.forms import Au... | [
"captcha.fields.CaptchaField",
"django.utils.translation.gettext_lazy"
] | [((897, 911), 'captcha.fields.CaptchaField', 'CaptchaField', ([], {}), '()\n', (909, 911), False, 'from captcha.fields import CaptchaField\n'), ((472, 485), 'django.utils.translation.gettext_lazy', '_', (['"""Username"""'], {}), "('Username')\n", (473, 485), True, 'from django.utils.translation import gettext_lazy as _... |
import pathlib
import unittest
from white_brush.commands.enhance_command import EnhanceCommand
from white_brush.entities.color_configuration import ColorConfiguration
from white_brush.entities.enhancement_configuration import EnhancementConfiguration
class TestEnhanceCommand(unittest.TestCase):
# region execute... | [
"unittest.main",
"white_brush.commands.enhance_command.EnhanceCommand",
"white_brush.entities.enhancement_configuration.EnhancementConfiguration",
"pathlib.Path",
"white_brush.entities.color_configuration.ColorConfiguration"
] | [((9907, 9922), 'unittest.main', 'unittest.main', ([], {}), '()\n', (9920, 9922), False, 'import unittest\n'), ((777, 815), 'white_brush.commands.enhance_command.EnhanceCommand', 'EnhanceCommand', (['mocked_enhance_service'], {}), '(mocked_enhance_service)\n', (791, 815), False, 'from white_brush.commands.enhance_comma... |
"""document parents
Revision ID: 6d68a2c945cc
Revises: 83dd3cee52da
Create Date: 2017-06-10 17:25:37.811806
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6d68a2c945cc'
down_revision = '83dd3cee52da'
def upgrade():
op.add_column('document', sa.Column('pa... | [
"alembic.op.drop_index",
"alembic.op.drop_column",
"sqlalchemy.BigInteger",
"alembic.op.f"
] | [((385, 428), 'alembic.op.drop_column', 'op.drop_column', (['"""document"""', '"""error_details"""'], {}), "('document', 'error_details')\n", (399, 428), False, 'from alembic import op\n'), ((513, 565), 'alembic.op.drop_index', 'op.drop_index', (['"""role_reset_token"""'], {'table_name': '"""role"""'}), "('role_reset_t... |
import numpy
num = int(input('Digite um número para calcular seu fatorial: '))
print('Calculando {}! = {}'.format(num, num), end = ' x ')
list = [num, ]
while num != 1:
num = num - 1
list.append(num)
print(num, end=' ')
print(' x' if num > 1 else ' = ', end = ' ')
resultado = numpy.prod(list)
... | [
"numpy.prod"
] | [((302, 318), 'numpy.prod', 'numpy.prod', (['list'], {}), '(list)\n', (312, 318), False, 'import numpy\n')] |
import sys
import unittest
from fool_sketch import Table, Deck
class TestTable(unittest.TestCase):
def setUp(self):
self.game = Table(4)
print()
print('Start test!')
pass
def tearDown(self):
print()
print(f'Test completed!')
# Проверка инициализации началь... | [
"fool_sketch.Table",
"sys.getsizeof"
] | [((142, 150), 'fool_sketch.Table', 'Table', (['(4)'], {}), '(4)\n', (147, 150), False, 'from fool_sketch import Table, Deck\n'), ((1272, 1302), 'sys.getsizeof', 'sys.getsizeof', (['self.game.pl[1]'], {}), '(self.game.pl[1])\n', (1285, 1302), False, 'import sys\n'), ((1383, 1413), 'sys.getsizeof', 'sys.getsizeof', (['se... |
# Copyright 2021 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, ... | [
"os.mkdir",
"logging.error",
"argparse.ArgumentParser",
"logging.warning",
"google.cloud.bigquery.Client",
"logging.StreamHandler",
"google.cloud.bigquery.Dataset",
"logging.info",
"google.cloud.bigquery.LoadJobConfig",
"google.cloud.storage.Client",
"wget.download",
"pandas.read_excel",
"sh... | [((1058, 1074), 'google.cloud.storage.Client', 'storage.Client', ([], {}), '()\n', (1072, 1074), False, 'from google.cloud import storage\n'), ((2594, 2611), 'google.cloud.bigquery.Client', 'bigquery.Client', ([], {}), '()\n', (2609, 2611), False, 'from google.cloud import bigquery\n'), ((2679, 2725), 'logging.info', '... |
from django.conf.urls import url
urlpatterns = [
url(r'^forge/$', 'add_new_relationship', prefix='cripts.relationships.views'),
url(r'^breakup/$', 'break_relationship', prefix='cripts.relationships.views'),
url(r'^get_dropdown/$', 'get_relationship_type_dropdown', prefix='cripts.relationships.views'),
... | [
"django.conf.urls.url"
] | [((54, 130), 'django.conf.urls.url', 'url', (['"""^forge/$"""', '"""add_new_relationship"""'], {'prefix': '"""cripts.relationships.views"""'}), "('^forge/$', 'add_new_relationship', prefix='cripts.relationships.views')\n", (57, 130), False, 'from django.conf.urls import url\n'), ((137, 213), 'django.conf.urls.url', 'ur... |
# Despy: A discrete event simulation framework for Python
# Version 0.1
# Released under the MIT License (MIT)
# Copyright (c) 2015, <NAME>
"""
*********************
despy.model.simulation
*********************
.. autosummary::
Simulation
FutureEvent
NoEventsRemainingError
.. todo
... | [
"numpy.random.seed",
"datetime.datetime.today",
"despy.model.trigger.TimeTrigger",
"itertools.count",
"heapq.heappop",
"despy.output.results.Results",
"despy.output.console.display_header",
"collections.namedtuple",
"random.seed",
"despy.output.console.display_message",
"collections.OrderedDict"... | [((1539, 1600), 'collections.namedtuple', 'namedtuple', (['"""FutureEventTuple"""', "['time', 'event', 'priority']"], {}), "('FutureEventTuple', ['time', 'event', 'priority'])\n", (1549, 1600), False, 'from collections import namedtuple, OrderedDict\n'), ((4493, 4502), 'despy.session.Session', 'Session', ([], {}), '()\... |
import datetime
from .base import View, require_permission
from .mixins import VotingMixin, CommentMixin, CommentValidation
from nthuion.validation import body_schema, Optional
from nthuion.models import Comment
from pyramid.httpexceptions import HTTPNotFound
class CommentContextMixin:
@staticmethod
def fac... | [
"nthuion.validation.Optional",
"datetime.datetime.now"
] | [((994, 1017), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1015, 1017), False, 'import datetime\n'), ((714, 733), 'nthuion.validation.Optional', 'Optional', (['"""content"""'], {}), "('content')\n", (722, 733), False, 'from nthuion.validation import body_schema, Optional\n')] |
# Generated by Django 3.1.1 on 2020-10-26 17:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("events", "0005_auto_20201026_1647"),
]
operations = [
migrations.AlterField(
model_name="category",
name="name",
... | [
"django.db.models.CharField"
] | [((335, 379), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(64)', 'unique': '(True)'}), '(max_length=64, unique=True)\n', (351, 379), False, 'from django.db import migrations, models\n')] |
""" General helper functions. """
import functools
from typing import Iterable, Dict
import yaml
def flatten(i: Iterable) -> Iterable:
""" Flatten an irregular iterable. """
for i in i:
if isinstance(i, Iterable):
yield from i
else:
yield i
def negate(function):
... | [
"yaml.load",
"functools.wraps"
] | [((381, 406), 'functools.wraps', 'functools.wraps', (['function'], {}), '(function)\n', (396, 406), False, 'import functools\n'), ((620, 659), 'yaml.load', 'yaml.load', (['file'], {'Loader': 'yaml.FullLoader'}), '(file, Loader=yaml.FullLoader)\n', (629, 659), False, 'import yaml\n')] |
# coding: utf-8
# # Sampling High-Dimensional Vectors
# <NAME> (January 15, 2016)
# In[ ]:
import numpy as np
import pylab
try:
import seaborn as sns # optional; prettier graphs
except ImportError:
sns = None
import nengo
from nengolib.compat import get_activities
from nengolib.stats import ScatteredHype... | [
"seaborn.kdeplot",
"numpy.empty",
"nengo.utils.numpy.norm",
"pylab.subplots",
"numpy.mean",
"pylab.figure",
"nengolib.stats.Sobol",
"nengo.Simulator",
"nengolib.stats.ScatteredHypersphere",
"pylab.title",
"nengo.Node",
"nengo.dists.UniformHypersphere",
"numpy.random.RandomState",
"pylab.yl... | [((351, 396), 'nengo.dists.UniformHypersphere', 'nengo.dists.UniformHypersphere', ([], {'surface': '(False)'}), '(surface=False)\n', (381, 396), False, 'import nengo\n'), ((414, 458), 'nengo.dists.UniformHypersphere', 'nengo.dists.UniformHypersphere', ([], {'surface': '(True)'}), '(surface=True)\n', (444, 458), False, ... |
"""
aero_csm_component.py
Created by NWTC Systems Engineering Sub-Task on 2012-08-01.
Copyright (c) NREL. All rights reserved.
"""
import numpy as np
from math import pi, gamma, exp
from wisdem.commonse.utilities import smooth_abs, smooth_min, hstack
from wisdem.nrelcsm.csmPPI import PPI
# Initialize ref and current... | [
"wisdem.commonse.utilities.smooth_min",
"math.exp",
"wisdem.nrelcsm.csmPPI.PPI",
"numpy.zeros",
"wisdem.commonse.utilities.smooth_abs",
"math.gamma",
"numpy.array",
"numpy.diag",
"numpy.sqrt"
] | [((462, 501), 'wisdem.nrelcsm.csmPPI.PPI', 'PPI', (['ref_yr', 'ref_mon', 'curr_yr', 'curr_mon'], {}), '(ref_yr, ref_mon, curr_yr, curr_mon)\n', (465, 501), False, 'from wisdem.nrelcsm.csmPPI import PPI\n'), ((2518, 2531), 'numpy.zeros', 'np.zeros', (['(161)'], {}), '(161)\n', (2526, 2531), True, 'import numpy as np\n')... |
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | [
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.lisp.router.lispinstance.lispinstance.LispInstance",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.lisp.router.mapservercacheinfo.mapservercacheinfo.MapServerCacheInfo",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.... | [((2357, 2384), 'ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.lisp.router.eidtorlocmapcacheinfo.eidtorlocmapcacheinfo.EidToRlocMapCacheInfo', 'EidToRlocMapCacheInfo', (['self'], {}), '(self)\n', (2378, 2384), False, 'from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.lisp.router.e... |
import subprocess
import shutil
import os
import build
# This Python script assumes that asm6809.exe, CMake.exe, MSBuild.exe are in the PATH-pointing directory.
fm7Code=True
winCode=True
makeZip=True
clearBuild=True
build.makeD77=True
build.makeWAV=True
THISFILE=os.path.realpath(__file__)
THISDIR=os.path.dirnam... | [
"shutil.make_archive",
"os.path.isdir",
"build.BuildForWin",
"os.path.realpath",
"os.path.dirname",
"build.UpdateWinSource",
"build.RunCMakeAndDeleteExe",
"os.path.splitext",
"shutil.rmtree",
"os.path.join",
"os.listdir"
] | [((271, 297), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (287, 297), False, 'import os\n'), ((306, 331), 'os.path.dirname', 'os.path.dirname', (['THISFILE'], {}), '(THISFILE)\n', (321, 331), False, 'import os\n'), ((362, 393), 'os.path.join', 'os.path.join', (['THISDIR', '"""python"""']... |