code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# This script merges and consolidates the beacons and sessions datasets into 1 dataset
from pandarallel import pandarallel
import pandas as pd
import datetime
import sys
import os
pandarallel.initialize(progress_bar=False, nb_workers=4)
base_path = os.path.dirname(os.path.realpath(__file__))
def df_in... | [
"datetime.datetime.strptime",
"os.path.join",
"os.path.realpath",
"datetime.datetime.now",
"pandarallel.pandarallel.initialize",
"pandas.DataFrame"
] | [((192, 248), 'pandarallel.pandarallel.initialize', 'pandarallel.initialize', ([], {'progress_bar': '(False)', 'nb_workers': '(4)'}), '(progress_bar=False, nb_workers=4)\n', (214, 248), False, 'from pandarallel import pandarallel\n'), ((280, 306), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\... |
"""
==========================================================================
bitstruct.py
==========================================================================
APIs to generate a bitstruct type. Using decorators and type annotations
to create bit struct is much inspired by python3 dataclass implementation.
Note ... | [
"warnings.warn",
"keyword.iskeyword",
"py.code.Source"
] | [((23064, 23084), 'warnings.warn', 'warnings.warn', (['w_msg'], {}), '(w_msg)\n', (23077, 23084), False, 'import warnings\n'), ((25838, 25861), 'keyword.iskeyword', 'keyword.iskeyword', (['name'], {}), '(name)\n', (25855, 25861), False, 'import keyword\n'), ((3751, 3770), 'py.code.Source', 'py.code.Source', (['src'], {... |
import platform
"""
[Note for Windows]
- Use '\\' or '/' in path
Ex) gitStoragePath = "D:\\Source\\gitrepos"
- Install 'Git for Windows'
- Windows version of VUDDY use its own JRE
[Note for POSIX]
- Use '/' for path
Ex) gitStoragePath = "/home/ubuntu/gitrepos/"
- Java binary is only needed in POSIX
"""
gitStoragePat... | [
"platform.platform"
] | [((355, 374), 'platform.platform', 'platform.platform', ([], {}), '()\n', (372, 374), False, 'import platform\n')] |
from math import sqrt, pow
def std_asym_ostap(n1,n2):
return (VE(n1,n1).asym(VE(n2,n2))).error()
def std_asym_calc(n1,n2):
return 2.*n1*sqrt(1./n1+1./n2) /( n2*pow(n1/n2+1.,2))
print("n=100")
print(" ostap = " + str(std_asym_ostap(100,100)))
print(" calc. = " + str(std_asym_calc (100,100)))
| [
"math.pow",
"math.sqrt"
] | [((146, 171), 'math.sqrt', 'sqrt', (['(1.0 / n1 + 1.0 / n2)'], {}), '(1.0 / n1 + 1.0 / n2)\n', (150, 171), False, 'from math import sqrt, pow\n'), ((170, 191), 'math.pow', 'pow', (['(n1 / n2 + 1.0)', '(2)'], {}), '(n1 / n2 + 1.0, 2)\n', (173, 191), False, 'from math import sqrt, pow\n')] |
#!/usr/bin/env python3
# vim: set fileencoding=utf-8 fileformat=unix expandtab :
"""struct.py -- Point and Rect
Copyright (C) 2010 <NAME> <<EMAIL>> All rights reserved.
This software is subject to the provisions of the Zope Public License,
Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
THI... | [
"collections.namedtuple",
"math.pow",
"math.cos",
"doctest.testmod",
"math.sin"
] | [((693, 719), 'collections.namedtuple', 'namedtuple', (['"""Point"""', '"""x y"""'], {}), "('Point', 'x y')\n", (703, 719), False, 'from collections import namedtuple\n'), ((3505, 3549), 'collections.namedtuple', 'namedtuple', (['"""_Rect"""', '"""left top right bottom"""'], {}), "('_Rect', 'left top right bottom')\n",... |
import os
from pathlib import Path
def menpo3d_src_dir_path():
r"""The path to the top of the menpo3d Python package.
Useful for locating where the data folder is stored.
Returns
-------
path : str
The full path to the top of the Menpo3d package
"""
return Path(os.path.abspath(__... | [
"os.path.abspath"
] | [((302, 327), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (317, 327), False, 'import os\n')] |
# Generated by Django 3.0.4 on 2022-03-02 19:32
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('page_edits', '0014_delete_whatsappnumber'),
]
operations = [
migrations.DeleteModel(
name='HowWeWorkText',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((233, 277), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""HowWeWorkText"""'}), "(name='HowWeWorkText')\n", (255, 277), False, 'from django.db import migrations\n')] |
# (C) Copyright 2021 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmenta... | [
"logging.getLogger",
"climetlab.vocabularies.aliases.unalias"
] | [((506, 533), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (523, 533), False, 'import logging\n'), ((2155, 2183), 'climetlab.vocabularies.aliases.unalias', 'unalias', (['self.aliases', 'value'], {}), '(self.aliases, value)\n', (2162, 2183), False, 'from climetlab.vocabularies.aliases im... |
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, permissions
from rest_framework.decorators import detail_route, list_route
from rest_framework.response import Response
from account.models import User
from account.serializers import UserSerializer, SimpleUserSerializer, FullUserSeria... | [
"account.models.User.objects.all"
] | [((489, 507), 'account.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (505, 507), False, 'from account.models import User\n')] |
# This file is part of MaixUI
# Copyright (c) sipeed.com
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
import time, gc
from core import agent
from ui_canvas import ui, print_mem_free
from ui_system_info import system_info
#from ui_catch import catch
#from ui_taskbar impo... | [
"ui_canvas.ui.warp_template",
"wdt.protect.keep",
"ui_canvas.ui.display",
"ui_canvas.print_mem_free",
"wdt.protect.stop",
"core.agent"
] | [((379, 386), 'core.agent', 'agent', ([], {}), '()\n', (384, 386), False, 'from core import agent\n'), ((393, 424), 'ui_canvas.ui.warp_template', 'ui.warp_template', (['ui.blank_draw'], {}), '(ui.blank_draw)\n', (409, 424), False, 'from ui_canvas import ui, print_mem_free\n'), ((430, 460), 'ui_canvas.ui.warp_template',... |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
"language.orqa.ops.reader_inputs",
"tensorflow.compat.v1.test.main",
"language.orqa.ops.has_answer"
] | [((2237, 2251), 'tensorflow.compat.v1.test.main', 'tf.test.main', ([], {}), '()\n', (2249, 2251), True, 'import tensorflow.compat.v1 as tf\n'), ((809, 1086), 'language.orqa.ops.reader_inputs', 'orqa_ops.reader_inputs', ([], {'question_token_ids': '[0, 1]', 'block_token_ids': '[[2, 3, 4], [5, 6, 0]]', 'block_lengths': '... |
from common.numpy_fast import clip, interp
from selfdrive.car.tesla.values import CruiseButtons
from selfdrive.config import Conversions as CV
import time
from common.params import Params
from cereal import car
ACCEL_MAX = 0.6 #0.6m/s2 * 36 = ~ 0 -> 50mph in 6 seconds
ACCEL_MIN = -3.5
_DT = 0.05 # 20Hz in our case,... | [
"common.numpy_fast.clip",
"common.params.Params",
"time.time",
"common.numpy_fast.interp"
] | [((3564, 3572), 'common.params.Params', 'Params', ([], {}), '()\n', (3570, 3572), False, 'from common.params import Params\n'), ((11650, 11696), 'common.numpy_fast.interp', 'interp', (['CS.out.vEgo', 'MAX_PEDAL_BP', 'MAX_PEDAL_V'], {}), '(CS.out.vEgo, MAX_PEDAL_BP, MAX_PEDAL_V)\n', (11656, 11696), False, 'from common.n... |
# Ising Model in Python.
# 28-03-2019.
# Written by <NAME>.
# Python 3.7.
# NumPy has been installed and used in this project.
# Numba has been installed and used in this project.
# Tools used: Visual Studio Code, GitHub Desktop.
from Input_param_reader import Ising_input # Python Function in... | [
"Path.Output_Path_Set",
"random.uniform",
"time.ctime",
"numpy.ones",
"Montecarlo.Monte_Carlo",
"csv.writer",
"Input_param_reader.Ising_input",
"time.perf_counter",
"numpy.sum",
"numba.jit"
] | [((806, 825), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (823, 825), False, 'import time\n'), ((3146, 3159), 'Input_param_reader.Ising_input', 'Ising_input', ([], {}), '()\n', (3157, 3159), False, 'from Input_param_reader import Ising_input\n'), ((3604, 3657), 'numpy.ones', 'numpy.ones', (['(nlayers, i... |
from concat.level1.typecheck.types import (
IndividualType,
SequenceVariable,
StackItemType,
)
from hypothesis.strategies import (
SearchStrategy,
booleans,
composite,
from_type,
iterables,
lists,
register_type_strategy,
sampled_from,
)
from typing import (
Iterable,
... | [
"hypothesis.strategies.from_type",
"hypothesis.strategies.sampled_from",
"hypothesis.strategies.register_type_strategy",
"hypothesis.strategies.booleans"
] | [((1203, 1255), 'hypothesis.strategies.register_type_strategy', 'register_type_strategy', (['Iterable', '_iterable_strategy'], {}), '(Iterable, _iterable_strategy)\n', (1225, 1255), False, 'from hypothesis.strategies import SearchStrategy, booleans, composite, from_type, iterables, lists, register_type_strategy, sample... |
'''
===============================================================================
ENGR 133 Program Description
This function takes an image array, a size number and a blur value and returns an array that contains a blurred image
Assignment Information
Assignment: Python Group Project
Author: <NAME>, ... | [
"math.exp",
"numpy.multiply",
"numpy.zeros"
] | [((2771, 2821), 'math.exp', 'math.exp', (['(-(x * x + y * y) / (2 * stddev * stddev))'], {}), '(-(x * x + y * y) / (2 * stddev * stddev))\n', (2779, 2821), False, 'import math\n'), ((1129, 1151), 'numpy.zeros', 'np.zeros', (['channelCount'], {}), '(channelCount)\n', (1137, 1151), True, 'import numpy as np\n'), ((2109, ... |
from .. import db
from app.main.model.token_blacklist_model import TokenBlackList
from .. import jwt
from app.main.schema.token_blacklist_schema import tokens_blacklist_schema
from datetime import datetime
@jwt.token_in_blocklist_loader
def check_if_token_revoked(jwt_header, jwt_payload):
""" Callback function to ... | [
"app.main.schema.token_blacklist_schema.tokens_blacklist_schema.dump",
"app.main.model.token_blacklist_model.TokenBlackList.query.all",
"datetime.datetime.utcnow",
"datetime.datetime.strptime",
"app.main.model.token_blacklist_model.TokenBlackList.query.filter_by"
] | [((580, 606), 'app.main.model.token_blacklist_model.TokenBlackList.query.all', 'TokenBlackList.query.all', ([], {}), '()\n', (604, 606), False, 'from app.main.model.token_blacklist_model import TokenBlackList\n'), ((629, 669), 'app.main.schema.token_blacklist_schema.tokens_blacklist_schema.dump', 'tokens_blacklist_sche... |
import math
import re
import subprocess
# from math import *
import sys
with open('response.plot', "r") as f:
plotTemplate = f.read()
with open('response_multi.plot', "r") as f:
plotTemplateMulti = f.read()
indexhtml = '<head></head><body>'
def mathDict():
d = {
"pow": math.pow, "cos": math.cos,... | [
"math.pow",
"math.fabs",
"subprocess.call",
"sys.exit"
] | [((7199, 7210), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (7207, 7210), False, 'import sys\n'), ((3466, 3514), 'subprocess.call', 'subprocess.call', (['"""gnuplot temp.plot"""'], {'shell': '(True)'}), "('gnuplot temp.plot', shell=True)\n", (3481, 3514), False, 'import subprocess\n'), ((6182, 6230), 'subprocess.ca... |
import os
from typing import Dict, Optional
import numpy as np
import pandas as pd
from scipy.signal import correlate
from . import ShakeExtractor, helpers
from .abstract_extractor import AbstractExtractor
from .helpers import normalize, get_equidistant_signals
from .log import logger
from .synchronization_errors imp... | [
"pandas.Timedelta",
"pandas.SparseDtype",
"os.path.join",
"scipy.signal.correlate",
"numpy.argmax",
"numpy.max",
"pandas.DataFrame"
] | [((4212, 4226), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (4224, 4226), True, 'import pandas as pd\n'), ((5964, 5993), 'scipy.signal.correlate', 'correlate', (['ref_data', 'sig_data'], {}), '(ref_data, sig_data)\n', (5973, 5993), False, 'from scipy.signal import correlate\n'), ((13268, 13304), 'os.path.join... |
from collections import deque, defaultdict
num_snacks = int(input())
snacks = deque([int(num) for num in input().split(" ")])
other_sizes = defaultdict(bool)
while snacks:
sizes_to_print = []
if snacks:
current_size = snacks.popleft()
#print(current_size)
if current_size == num_snacks:
... | [
"collections.defaultdict"
] | [((141, 158), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (152, 158), False, 'from collections import deque, defaultdict\n')] |
#!/usr/bin/env python3
# Copyright 2022 Johns Hopkins University (authors: <NAME>)
#
# See ../../../../LICENSE for clarification regarding multiple authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"pathlib.Path",
"lhotse.load_manifest_lazy",
"torch.set_num_threads",
"lhotse.features.kaldifeat.KaldifeatMelOptions",
"logging.info",
"lhotse.features.kaldifeat.KaldifeatFrameOptions",
"torch.set_num_interop_threads"
] | [((1404, 1428), 'torch.set_num_threads', 'torch.set_num_threads', (['(1)'], {}), '(1)\n', (1425, 1428), False, 'import torch\n'), ((1429, 1461), 'torch.set_num_interop_threads', 'torch.set_num_interop_threads', (['(1)'], {}), '(1)\n', (1458, 1461), False, 'import torch\n'), ((1493, 1518), 'argparse.ArgumentParser', 'ar... |
# ! /usr/bin/python3
"""### Provides tools for maps and heightmaps
This module contains functions to:
* Calculate a heightmap ideal for building
* Visualise numpy arrays
"""
__all__ = ['calcGoodHeightmap']
# __version__
import cv2
import matplotlib.pyplot as plt
import numpy as np
def calcGoodHeightmap(worldSlice):... | [
"matplotlib.pyplot.imshow",
"numpy.minimum",
"matplotlib.pyplot.figure",
"cv2.cvtColor",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((1790, 1800), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1798, 1800), True, 'import matplotlib.pyplot as plt\n'), ((1153, 1190), 'numpy.minimum', 'np.minimum', (['hm_mbnl', 'heightmapNoTrees'], {}), '(hm_mbnl, heightmapNoTrees)\n', (1163, 1190), True, 'import numpy as np\n'), ((1627, 1639), 'matplotlib.... |
"""Wrapper around project converter to convert a project"""
from vb2py import projectconverter
if __name__ == '__main__':
projectconverter.main() | [
"vb2py.projectconverter.main"
] | [((129, 152), 'vb2py.projectconverter.main', 'projectconverter.main', ([], {}), '()\n', (150, 152), False, 'from vb2py import projectconverter\n')] |
import torch
from torch.optim import Optimizer
from torch.optim.optimizer import required
#Depending on PyTorch version, the name of the functional module
#May either have an underscore or not!
oldversion = False
try:
import torch.optim._functional as F
except:
import torch.optim.functional as F
oldversion... | [
"torch.enable_grad",
"torch.set_printoptions",
"torch.mean",
"torch.optim.functional.adam",
"torch.sum",
"torch.linspace",
"torch.clone",
"torch.no_grad",
"torch.zeros_like",
"tpstorch.dist.all_reduce",
"torch.bucketize",
"torch.zeros",
"torch.inverse"
] | [((1804, 1819), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1817, 1819), False, 'import torch\n'), ((6107, 6122), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (6120, 6122), False, 'import torch\n'), ((10112, 10127), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (10125, 10127), False, 'import torch... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"os.path.isdir",
"time.time",
"os.makedirs"
] | [((852, 863), 'time.time', 'time.time', ([], {}), '()\n', (861, 863), False, 'import time\n'), ((2677, 2688), 'time.time', 'time.time', ([], {}), '()\n', (2686, 2688), False, 'import time\n'), ((1442, 1484), 'os.path.isdir', 'os.path.isdir', (['(trian_save_path + file_name)'], {}), '(trian_save_path + file_name)\n', (1... |
from pathlib import Path
def phase1(values):
total, prev = 0, values[0]
for curr in values:
if curr > prev:
total = total +1
prev = curr
return total
def phase2(values):
return phase1([values[i] + values[i+1] + values[i+2] for i in range(0,len(values)-2)])
if __name__ == "... | [
"pathlib.Path"
] | [((340, 354), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (344, 354), False, 'from pathlib import Path\n')] |
# Copyright (c) 2017 DataCore Software Corp. 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... | [
"mock.Mock",
"cinder.volume.drivers.datacore.fc.FibreChannelVolumeDriver",
"cinder.tests.unit.volume.drivers.datacore.test_datacore_driver.VOLUME.copy"
] | [((952, 1095), 'mock.Mock', 'mock.Mock', ([], {'Id': '"""initiator_port_id1"""', 'PortType': '"""FibreChannel"""', 'PortMode': '"""Initiator"""', 'PortName': '"""AA-AA-AA-AA-AA-AA-AA-AA"""', 'HostId': '"""client_id1"""'}), "(Id='initiator_port_id1', PortType='FibreChannel', PortMode=\n 'Initiator', PortName='AA-AA-A... |
from celery import task
from django.core.mail import send_mail
@task
def send_email(subject, message, from_email, recipient_list):
"""Send email async using a celery worker
args: Take sames args as django send_mail function.
"""
send_mail(subject, message, from_email, recipient_list)
@task
def u... | [
"django.core.mail.send_mail"
] | [((252, 307), 'django.core.mail.send_mail', 'send_mail', (['subject', 'message', 'from_email', 'recipient_list'], {}), '(subject, message, from_email, recipient_list)\n', (261, 307), False, 'from django.core.mail import send_mail\n')] |
"""General project util functions"""
from typing import Callable
import inspect
import time
from functools import wraps
from sys import getsizeof
def timeit(method: Callable) -> Callable:
"""timeit is a wrapper for performance analysis which should
return the time taken for a function to run. Alters `log_time... | [
"sys.getsizeof",
"inspect.isgetsetdescriptor",
"time.perf_counter",
"functools.wraps",
"inspect.ismemberdescriptor"
] | [((1020, 1033), 'functools.wraps', 'wraps', (['method'], {}), '(method)\n', (1025, 1033), False, 'from functools import wraps\n'), ((2874, 2888), 'sys.getsizeof', 'getsizeof', (['obj'], {}), '(obj)\n', (2883, 2888), False, 'from sys import getsizeof\n'), ((1075, 1094), 'time.perf_counter', 'time.perf_counter', ([], {})... |
#!/usr/bin/env python3
import sqlite3
db = sqlite3.connect('taginfo-db.db')
c = db.cursor()
mapost = ""
whitelist = ""
keyvals = []
for r in c.execute("select key,value from tags where key='shop' order by count_all desc limit 50"):
key, value = r
# no need for these
if value in ['yes', 'no']:
c... | [
"sqlite3.connect"
] | [((45, 77), 'sqlite3.connect', 'sqlite3.connect', (['"""taginfo-db.db"""'], {}), "('taginfo-db.db')\n", (60, 77), False, 'import sqlite3\n')] |
#!/usr/bin/env python
"""
Generate sample olfactory model stimulus.
"""
import numpy as np
import h5py
osn_num = 1375
dt = 1e-4 # time step
Ot = 2000 # number of data point during reset period
Rt = 1000 # number of data point during odor delivery period
#Nt = 4*Ot + 3*Rt # number of data points in time
#Nt = 10000... | [
"numpy.zeros",
"numpy.ones",
"numpy.concatenate",
"h5py.File"
] | [((412, 437), 'numpy.zeros', 'np.zeros', (['(500)', 'np.float64'], {}), '(500, np.float64)\n', (420, 437), True, 'import numpy as np\n'), ((478, 504), 'numpy.zeros', 'np.zeros', (['(4500)', 'np.float64'], {}), '(4500, np.float64)\n', (486, 504), True, 'import numpy as np\n'), ((543, 569), 'numpy.zeros', 'np.zeros', (['... |
# tag::MYMAX_TYPES[]
from typing import Protocol, Any, TypeVar, overload, Callable, Iterable, Union
class _Comparable(Protocol):
def __lt__(self, other: Any) -> bool: ...
_T = TypeVar('_T')
_CT = TypeVar('_CT', bound=_Comparable)
_DT = TypeVar('_DT')
MISSING = object()
EMPTY_MSG = 'max() arg is an empty sequence... | [
"typing.TypeVar"
] | [((182, 195), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (189, 195), False, 'from typing import Protocol, Any, TypeVar, overload, Callable, Iterable, Union\n'), ((202, 235), 'typing.TypeVar', 'TypeVar', (['"""_CT"""'], {'bound': '_Comparable'}), "('_CT', bound=_Comparable)\n", (209, 235), False, 'from... |
from django.db import models
import datetime
from django.contrib.auth.models import (
BaseUserManager, AbstractBaseUser, Group, PermissionsMixin
)
class MyUserManager(BaseUserManager):
def create_user(self, username, password = None):
user = self.model(
username = username,
)
user.set_password(password)
... | [
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((618, 662), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)', 'unique': '(True)'}), '(max_length=20, unique=True)\n', (634, 662), False, 'from django.db import models\n'), ((682, 716), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n'... |
import pytest
from numpy.testing import assert_almost_equal, assert_array_equal, \
assert_array_almost_equal
from ctapipe.calib.camera.r1 import (
CameraR1CalibratorFactory,
HESSIOR1Calibrator,
TargetIOR1Calibrator,
NullR1Calibrator
)
from ctapipe.io.eventsource import EventSource
from ctapipe.io.s... | [
"ctapipe.utils.get_dataset_path",
"numpy.testing.assert_array_almost_equal",
"ctapipe.calib.camera.r1.CameraR1CalibratorFactory.produce",
"ctapipe.calib.camera.r1.TargetIOR1Calibrator",
"numpy.testing.assert_almost_equal",
"pytest.importorskip",
"ctapipe.io.simteleventsource.SimTelEventSource",
"ctapi... | [((549, 569), 'ctapipe.calib.camera.r1.HESSIOR1Calibrator', 'HESSIOR1Calibrator', ([], {}), '()\n', (567, 569), False, 'from ctapipe.calib.camera.r1 import CameraR1CalibratorFactory, HESSIOR1Calibrator, TargetIOR1Calibrator, NullR1Calibrator\n'), ((660, 703), 'numpy.testing.assert_almost_equal', 'assert_almost_equal', ... |
from __future__ import annotations
from copy import deepcopy
from dataclasses import dataclass, field
from typing import Optional
from models.backyard import Backyard
from models.heater import Heater
@dataclass
class Room:
id: int
name: str
title: str
coldThreshold: list[float]
optimalThreshold:... | [
"dataclasses.field",
"copy.deepcopy"
] | [((739, 766), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (744, 766), False, 'from dataclasses import dataclass, field\n'), ((839, 866), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (844, 866), False, 'from dataclasses impo... |
"""
"""
import os.path as op
from glob import glob
from os import mkdir
from shutil import copyfile
def make_image_file():
design_file = "design.fsf"
# Each file
gp_mem = "# Group membership for input {0}\nset fmri(groupmem.{0}) 1\n"
hi_thing = "# Higher-level EV value for EV 1 and input {0}\nset fmr... | [
"os.mkdir",
"os.path.isdir",
"os.path.join",
"os.path.basename"
] | [((765, 785), 'os.path.join', 'op.join', (['in_dir', '"""*"""'], {}), "(in_dir, '*')\n", (772, 785), True, 'import os.path as op\n'), ((803, 817), 'os.path.basename', 'op.basename', (['s'], {}), '(s)\n', (814, 817), True, 'import os.path as op\n'), ((958, 984), 'os.path.join', 'op.join', (['in_dir', 's', 'subdir'], {})... |
####
#
# The MIT License (MIT)
#
# Copyright 2021 <NAME> <<EMAIL>>
#
# 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, cop... | [
"logging.getLogger",
"logging.StreamHandler",
"sqlite3.connect",
"argparse.ArgumentParser",
"gzip.open",
"logging.Formatter",
"os.path.join",
"pandas.DataFrame",
"numpy.random.RandomState"
] | [((1309, 1351), 'logging.getLogger', 'logging.getLogger', (['"""Get CFM-ID Candidates"""'], {}), "('Get CFM-ID Candidates')\n", (1326, 1351), False, 'import logging\n'), ((1413, 1436), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (1434, 1436), False, 'import logging\n'), ((1476, 1535), 'logging.F... |
from collections import Counter, namedtuple
def print_freqs(freqs):
"""
Prints an easy to read format of the frequencies extracted from the corpus
to the file frequencies.txt
:return: None
"""
with open('frequencies.txt', 'w') as f:
for t, c in freqs.items():
print(str(t), ... | [
"collections.Counter",
"collections.namedtuple"
] | [((506, 544), 'collections.namedtuple', 'namedtuple', (['"""Arc"""', '"""dep_POS, head_POS"""'], {}), "('Arc', 'dep_POS, head_POS')\n", (516, 544), False, 'from collections import Counter, namedtuple\n'), ((686, 806), 'collections.namedtuple', 'namedtuple', (['"""Conll"""', '"""index, word, lemma, pos, og_pos, ignore, ... |
# -*- coding: utf-8 -*-
'''Module that defines classes and functions for Brillouin zone sampling
'''
import os
import re
from copy import deepcopy
import numpy as np
from mykit.core._control import (build_tag_map_obj, extract_from_tagdict,
parse_to_tagdict, prog_mapper, tags_mapping)
... | [
"numpy.isclose",
"re.compile",
"mykit.core._control.build_tag_map_obj",
"mykit.core._control.extract_from_tagdict",
"re.match",
"mykit.core._control.tags_mapping",
"numpy.array",
"numpy.sum",
"os.path.dirname",
"numpy.linalg.norm",
"mykit.core._control.parse_to_tagdict",
"numpy.shape"
] | [((777, 818), 'mykit.core._control.build_tag_map_obj', 'build_tag_map_obj', (['_meta', '"""mykit"""', '"""json"""'], {}), "(_meta, 'mykit', 'json')\n", (794, 818), False, 'from mykit.core._control import build_tag_map_obj, extract_from_tagdict, parse_to_tagdict, prog_mapper, tags_mapping\n'), ((3609, 3634), 're.compile... |
from pathlib import Path
from tqdm.auto import tqdm
import numpy as np
import pickle
import os
from astropy.table import Table
import pickle as pkl
from multiprocessing import Pool, Manager
from threading import Lock
from .cones import make_cone_density
from .utils import load_data
from .cones import make_cone
from .c... | [
"os.listdir",
"pickle.dump",
"pathlib.Path",
"threading.Lock",
"pickle.load",
"multiprocessing.Pool",
"numpy.concatenate",
"multiprocessing.Manager"
] | [((1710, 1719), 'multiprocessing.Manager', 'Manager', ([], {}), '()\n', (1717, 1719), False, 'from multiprocessing import Pool, Manager\n'), ((1797, 1803), 'threading.Lock', 'Lock', ([], {}), '()\n', (1801, 1803), False, 'from threading import Lock\n'), ((964, 992), 'pickle.dump', 'pickle.dump', (['self.data', 'file'],... |
from sklearn.model_selection import GridSearchCV
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.svm import SVC
import numpy as np
import pandas as pd
impo... | [
"sklearn.model_selection.GridSearchCV",
"numpy.mean",
"sklearn.neural_network.MLPClassifier",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.neighbors.KNeighborsClassifier",
"sklearn.ensemble.RandomForestClassifier",
"numpy.linspace",
"sklearn.svm.SVC"
] | [((1092, 1127), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': '(7)'}), '(n_neighbors=7)\n', (1112, 1127), False, 'from sklearn.neighbors import KNeighborsClassifier\n'), ((832, 867), 'sklearn.neighbors.KNeighborsClassifier', 'KNeighborsClassifier', ([], {'n_neighbors': 'i'}), '(... |
def brute_force_root_finder(f, a, b, n):
from numpy import linspace
x = linspace(a, b, n)
y = f(x)
roots = []
for i in range(n-1):
if y[i]*y[i+1] < 0:
root = x[i] - (x[i+1] - x[i])/(y[i+1] - y[i])*y[i]
roots.append(root)
elif y[i] == 0:
... | [
"numpy.exp",
"numpy.linspace",
"numpy.cos"
] | [((82, 99), 'numpy.linspace', 'linspace', (['a', 'b', 'n'], {}), '(a, b, n)\n', (90, 99), False, 'from numpy import linspace\n'), ((491, 503), 'numpy.exp', 'exp', (['(-x ** 2)'], {}), '(-x ** 2)\n', (494, 503), False, 'from numpy import exp, cos\n'), ((502, 512), 'numpy.cos', 'cos', (['(4 * x)'], {}), '(4 * x)\n', (505... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
# Генерация списка
items = ['KMS1.kmch.pos.out_dE_%s.mx' % i for i in range(20)]
# Перемешивание элементов списка
import random
random.shuffle(items)
print(items)
# Обычная сортировка не работает
print(sorted(items))
print()
def get_number_1... | [
"random.shuffle",
"re.search"
] | [((203, 224), 'random.shuffle', 'random.shuffle', (['items'], {}), '(items)\n', (217, 224), False, 'import random\n'), ((422, 468), 're.search', 're.search', (['"""KMS1.kmch.pos.out_dE_(\\\\d+).mx"""', 'x'], {}), "('KMS1.kmch.pos.out_dE_(\\\\d+).mx', x)\n", (431, 468), False, 'import re\n')] |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('djangocms_charts', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='chartjsbarmodel',
name='chart_position',
field=models.CharField(... | [
"django.db.models.CharField"
] | [((303, 378), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'verbose_name': '"""Chart Position"""', 'blank': '(True)'}), "(max_length=100, verbose_name='Chart Position', blank=True)\n", (319, 378), False, 'from django.db import migrations, models\n'), ((520, 595), 'django.db.models.Char... |
import geo.geo_utils
import geo.raster_lookup
from progress.null_callback import NullCallback
from progress.progress import Progress
import glob
import numpy as np
class Heightmap:
def __init__(self):
self.pixels = []
self.heightmap = None
self.nodata_fillin = 0
self.out_of_bounds... | [
"progress.null_callback.NullCallback",
"numpy.array",
"numpy.load",
"progress.progress.Progress",
"numpy.save"
] | [((557, 571), 'progress.null_callback.NullCallback', 'NullCallback', ([], {}), '()\n', (569, 571), False, 'from progress.null_callback import NullCallback\n'), ((2163, 2181), 'numpy.load', 'np.load', (['file_name'], {}), '(file_name)\n', (2170, 2181), True, 'import numpy as np\n'), ((2466, 2500), 'numpy.save', 'np.save... |
#!/usr/bin/env python
# coding: utf_8
import os
import csv, sqlite3
import unicodedata
import pdb
# 0 全国地方公共団体コード
# 1 旧郵便番号
# 2 郵便番号
# 3 都道府県名
# 4 市区町村名
# 5 町域名
# 6 都道府県名
# 7 市区町村名
# 8 町域名
# 9 一町域が二以上の郵便番号で表される場合の表示 (注3) (「1」は該当、「0」は該当せず)
# 10 小字毎に番地が起番されている町域の表示 (注4) (「1」は該当、「0」は該当せず)
# 11 丁目を有する町域の場合の表示 (「1」は該当、「0」は... | [
"csv.DictWriter",
"csv.DictReader",
"sqlite3.connect",
"os.path.isfile",
"unicodedata.normalize",
"csv.reader",
"os.remove"
] | [((665, 699), 'os.path.isfile', 'os.path.isfile', (['postalcode_sqlite3'], {}), '(postalcode_sqlite3)\n', (679, 699), False, 'import os\n'), ((795, 830), 'sqlite3.connect', 'sqlite3.connect', (['postalcode_sqlite3'], {}), '(postalcode_sqlite3)\n', (810, 830), False, 'import csv, sqlite3\n'), ((713, 742), 'os.remove', '... |
from distutils.core import setup
from Cython.Build import cythonize
setup(
name = "tax",
ext_modules = cythonize('tax.pyx'),
script_name = 'setup.py',
script_args = ['build_ext', '--inplace']
)
import tax
import numpy as np
print(tax.tax(np.ones(10)))
| [
"Cython.Build.cythonize",
"numpy.ones"
] | [((112, 132), 'Cython.Build.cythonize', 'cythonize', (['"""tax.pyx"""'], {}), "('tax.pyx')\n", (121, 132), False, 'from Cython.Build import cythonize\n'), ((255, 266), 'numpy.ones', 'np.ones', (['(10)'], {}), '(10)\n', (262, 266), True, 'import numpy as np\n')] |
from i3pystatus import IntervalModule
from i3pystatus.core.util import internet, require
from datetime import datetime
from urllib.request import urlopen
import json
import re
GEOLOOKUP_URL = 'http://api.wunderground.com/api/%s/geolookup%s/q/%s.json'
STATION_QUERY_URL = 'http://api.wunderground.com/api/%s/%s/q/%s.jso... | [
"i3pystatus.core.util.require",
"datetime.datetime.fromtimestamp",
"urllib.request.urlopen",
"re.search"
] | [((3024, 3041), 'i3pystatus.core.util.require', 'require', (['internet'], {}), '(internet)\n', (3031, 3041), False, 'from i3pystatus.core.util import internet, require\n'), ((3690, 3707), 'i3pystatus.core.util.require', 'require', (['internet'], {}), '(internet)\n', (3697, 3707), False, 'from i3pystatus.core.util impor... |
#!/usr/bin/python
"""
Train multihead-classifier with triplet loss
"""
from __future__ import print_function, division
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from tensorflow.contrib.layers import fully_connected
from tensorflow.contrib.rnn im... | [
"words_encoder.WordsEncoder",
"tensorflow.equal",
"tensorflow.shape",
"pandas.read_csv",
"tensorflow.boolean_mask",
"tensorflow.logical_not",
"tensorflow.contrib.rnn.GRUCell",
"tensorflow.nn.softmax",
"tensorflow.GPUOptions",
"tensorflow.nn.embedding_lookup",
"utils.batch_generator",
"tensorfl... | [((820, 845), 'pandas.read_csv', 'pd.read_csv', (['"""tweets.csv"""'], {}), "('tweets.csv')\n", (831, 845), True, 'import pandas as pd\n'), ((1299, 1313), 'words_encoder.WordsEncoder', 'WordsEncoder', ([], {}), '()\n', (1311, 1313), False, 'from words_encoder import WordsEncoder\n'), ((1443, 1471), 'utils.get_vocabular... |
from .utils import *
def test_g2p():
output = get_tmp_out()
input = os.path.join(dir_path, 'test_data', 'ex2.bcf')
test_args = dict(
no_warnings=True,
input=input,
output=output,
ped=os.path.join(dir_path, "test_data", "test.ped"),
de_novo=True,
biallelic=Tr... | [
"nose.run"
] | [((1341, 1371), 'nose.run', 'nose.run', ([], {'defaultTest': '__name__'}), '(defaultTest=__name__)\n', (1349, 1371), False, 'import nose\n')] |
import turtle
wn=turtle.Screen()
alex=turtle.Turtle()
alex.forward(50)
alex.left(90)
alex.forward(30)
wn.mainloop() | [
"turtle.Screen",
"turtle.Turtle"
] | [((17, 32), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (30, 32), False, 'import turtle\n'), ((38, 53), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (51, 53), False, 'import turtle\n')] |
import datetime
from django.core.management.base import BaseCommand
from data_import.models import DataFileKey
class Command(BaseCommand):
"""
A management command for expunging expired keys
"""
help = "Expunge expired keys"
def handle(self, *args, **options):
self.stdout.write("Expung... | [
"datetime.timedelta",
"data_import.models.DataFileKey.objects.filter",
"datetime.datetime.utcnow"
] | [((353, 379), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (377, 379), False, 'import datetime\n'), ((561, 615), 'data_import.models.DataFileKey.objects.filter', 'DataFileKey.objects.filter', ([], {'created__lte': 'six_hours_ago'}), '(created__lte=six_hours_ago)\n', (587, 615), False, 'from... |
import getpass
import telnetlib
port_num = str(input("Enter the Number of Port and type: "))
HOST = "10.1.1.1"
user = input("\nEnter The Username: ")
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until(b"Username: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn... | [
"getpass.getpass",
"telnetlib.Telnet"
] | [((175, 192), 'getpass.getpass', 'getpass.getpass', ([], {}), '()\n', (190, 192), False, 'import getpass\n'), ((202, 224), 'telnetlib.Telnet', 'telnetlib.Telnet', (['HOST'], {}), '(HOST)\n', (218, 224), False, 'import telnetlib\n')] |
import argparse
import os
argparser = argparse.ArgumentParser()
argparser.add_argument("--dataset_names", default="all", type=str) # "all" or names joined by comma
argparser.add_argument("--dataset_path", default="DATASET/odinw", type=str)
args = argparser.parse_args()
root = "https://vlpdatasets.blob.core.windows.ne... | [
"os.system",
"argparse.ArgumentParser"
] | [((39, 64), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (62, 64), False, 'import argparse\n'), ((1195, 1304), 'os.system', 'os.system', (["('wget ' + root + '/' + dataset + '.zip' + ' -O ' + args.dataset_path + '/' +\n dataset + '.zip')"], {}), "('wget ' + root + '/' + dataset + '.zip' + ... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from iso3166 import countries
import pycountry_convert as pc
import pycountry
import re
from datetime import datetime
from statsmodels.distributions.empirical_distribution import ECDF
FINAL_DATAFRAME = '../aggregate_data/final_dataframe.csv'
PATH_R... | [
"matplotlib.pyplot.hist",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"datetime.datetime.today",
"pycountry.countries.get",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"pycountry_convert.country_alpha2_to_continent_code",
"pandas.DataFrame",
"matplotlib.pyplot.ylim",
"pycountry_conve... | [((690, 741), 'pandas.read_json', 'pd.read_json', (['PATH_RIPE_RIS_PEERS'], {'typ': '"""dictionary"""'}), "(PATH_RIPE_RIS_PEERS, typ='dictionary')\n", (702, 741), True, 'import pandas as pd\n'), ((895, 952), 'pandas.DataFrame', 'pd.DataFrame', (['list_of_uniques_ripe_peers'], {'columns': "['ASn']"}), "(list_of_uniques_... |
import os, pdb
# ______________________________________NLPDV____________________________________
# _______________________________________________________________________
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from transformers import *
import _pickle as pkl
import shutil
import numpy... | [
"os.path.exists",
"os.makedirs",
"matplotlib.use",
"os.path.join",
"numpy.random.seed",
"os.system"
] | [((191, 212), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (205, 212), False, 'import matplotlib\n'), ((3438, 3458), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (3452, 3458), True, 'import numpy as np\n'), ((22098, 22116), 'os.system', 'os.system', (['command'], {}), '(co... |
# -*- coding: utf-8 -*-
from azureml.core import Environment, Experiment, ScriptRunConfig, Workspace
from azureml.core.conda_dependencies import CondaDependencies
def main():
# Create a Python environment for the experiment
# env = Environment("experiment_test_env")
env = Environment("experiment-test-MLFl... | [
"azureml.core.Workspace.from_config",
"azureml.core.Experiment",
"azureml.core.conda_dependencies.CondaDependencies.create",
"azureml.core.Environment",
"azureml.core.ScriptRunConfig"
] | [((287, 328), 'azureml.core.Environment', 'Environment', (['"""experiment-test-MLFlow-env"""'], {}), "('experiment-test-MLFlow-env')\n", (298, 328), False, 'from azureml.core import Environment, Experiment, ScriptRunConfig, Workspace\n'), ((434, 529), 'azureml.core.conda_dependencies.CondaDependencies.create', 'CondaDe... |
import pandas as pd
import time
import sys
class AverageMeter(object):
"""Sum values to compute the mean."""
def __init__(self):
self.reset()
def reset(self):
self.count = 0
self.sum = 0
def update(self, val):
self.count += 1
self.sum += val
... | [
"pandas.DataFrame",
"sys.stdout.flush",
"time.time"
] | [((577, 591), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (589, 591), True, 'import pandas as pd\n'), ((966, 977), 'time.time', 'time.time', ([], {}), '()\n', (975, 977), False, 'import time\n'), ((1802, 1813), 'time.time', 'time.time', ([], {}), '()\n', (1811, 1813), False, 'import time\n'), ((1922, 1940), '... |
import unittest
from sys import argv
import numpy as np
import torch
from objective.logistic import Logistic_Gradient
from .utils import Container, assert_all_close, assert_all_close_dict
class TestObj_Logistic_Gradient(unittest.TestCase):
def setUp(self):
np.random.seed(1234)
torch.manual_seed(... | [
"torch.manual_seed",
"objective.logistic.Logistic_Gradient",
"torch.tensor",
"numpy.random.seed",
"unittest.main",
"torch.randn"
] | [((1628, 1652), 'unittest.main', 'unittest.main', ([], {'argv': 'argv'}), '(argv=argv)\n', (1641, 1652), False, 'import unittest\n'), ((273, 293), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (287, 293), True, 'import numpy as np\n'), ((302, 325), 'torch.manual_seed', 'torch.manual_seed', (['(12... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-08-31 22:49
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('lemlit', '0012_remove_suratizinpenelitianmahasiswa_dosen'),
]
operations = [
... | [
"django.db.models.CharField"
] | [((450, 504), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""Nama Kantor"""', 'max_length': '(80)'}), "(default='Nama Kantor', max_length=80)\n", (466, 504), False, 'from django.db import migrations, models\n'), ((687, 778), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""... |
from datasets.dataset_processors import ExtendedDataset
from models.model import IdentificationModel, ResNet50
from models.siamese import SiameseNet, MssNet
from base import BaseExecutor
from utils.utilities import type_error_msg, value_error_msg, timer, load_model
import torch
from torch.utils.data import DataLoader
f... | [
"scipy.io.savemat",
"models.siamese.MssNet",
"numpy.linalg.norm",
"utils.utilities.load_model",
"os.path.exists",
"numpy.mean",
"numpy.repeat",
"numpy.flatnonzero",
"numpy.asarray",
"torchvision.transforms.ToTensor",
"os.path.dirname",
"torch.norm",
"models.model.ResNet50",
"torchvision.tr... | [((5047, 5142), 'utils.utilities.load_model', 'load_model', (['self.model', "(self.config[self.name.value]['model_format'] % (model_name, epoch))"], {}), "(self.model, self.config[self.name.value]['model_format'] % (\n model_name, epoch))\n", (5057, 5142), False, 'from utils.utilities import type_error_msg, value_er... |
from datetime import timedelta
import app_config
import dateutil.parser
from googleapiclient.discovery import build
from injector import inject
from models import AllDayCalendarEntry, CalendarEntry
from google_api import GoogleAuthenication
class GoogleCalendar:
@inject
def __init__(self, auth: GoogleAuthe... | [
"googleapiclient.discovery.build",
"models.CalendarEntry",
"datetime.timedelta"
] | [((473, 538), 'googleapiclient.discovery.build', 'build', (['"""calendar"""', '"""v3"""'], {'credentials': 'creds', 'cache_discovery': '(False)'}), "('calendar', 'v3', credentials=creds, cache_discovery=False)\n", (478, 538), False, 'from googleapiclient.discovery import build\n'), ((1134, 1279), 'models.CalendarEntry'... |
from django.db import models
# Create your models here.
class Profile(models.Model):
pic=models.ImageField(upload_to='images/')
pub_date=models.DateTimeField(auto_now=True)
obj=models.TextField(blank=True)
# ctime() method is for converting datetime string into a string
def __str__(self):
... | [
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.db.models.SmallIntegerField",
"django.db.models.ImageField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((94, 132), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""images/"""'}), "(upload_to='images/')\n", (111, 132), False, 'from django.db import models\n'), ((146, 181), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (166, 181), Fa... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 29 20:53:21 2020
@author: asherhensley
"""
import dash
import dash_core_components as dcc
import dash_html_components as html
import plotly.express as px
import pandas as pd
import yulesimon as ys
from plotly.subplots import make_subplots
import plo... | [
"dash_html_components.Button",
"dash.dependencies.Input",
"numpy.arange",
"dash_html_components.Div",
"yulesimon.TimeSeries",
"numpy.mean",
"numpy.histogram",
"dash.Dash",
"dash.dependencies.Output",
"dash_html_components.Br",
"plotly.graph_objects.Scatter",
"yulesimon.GetYahooFeed",
"dash_h... | [((545, 607), 'dash.Dash', 'dash.Dash', (['__name__'], {'external_stylesheets': 'external_stylesheets'}), '(__name__, external_stylesheets=external_stylesheets)\n', (554, 607), False, 'import dash\n'), ((681, 696), 'plotly.subplots.make_subplots', 'make_subplots', ([], {}), '()\n', (694, 696), False, 'from plotly.subpl... |
# coding:utf-8
from gensim.models import word2vec
class LoadModelFlag(object):
def __init__(self, fname, folder_word):
self.fname = fname
self.folder_word = folder_word
def load_model_similar_flag(self):
# 分かち書きしてmodelファイルを生成する。
load = word2vec.Word2Vec.load(self.fname)
... | [
"gensim.models.word2vec.Word2Vec.load"
] | [((278, 312), 'gensim.models.word2vec.Word2Vec.load', 'word2vec.Word2Vec.load', (['self.fname'], {}), '(self.fname)\n', (300, 312), False, 'from gensim.models import word2vec\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from .common import Base, session_scope
from sqlalchemy import and_, or_
from sqlalchemy.sql.expression import func
class Team(Base):
__tablename__ = 'teams'
__autoload__ = True
HUMAN_READABLE = 'team'
def __init__(self, team_data):
self.team_i... | [
"sqlalchemy.sql.expression.func.lower"
] | [((846, 867), 'sqlalchemy.sql.expression.func.lower', 'func.lower', (['Team.abbr'], {}), '(Team.abbr)\n', (856, 867), False, 'from sqlalchemy.sql.expression import func\n'), ((905, 931), 'sqlalchemy.sql.expression.func.lower', 'func.lower', (['Team.orig_abbr'], {}), '(Team.orig_abbr)\n', (915, 931), False, 'from sqlalc... |
"""Main module with image processing pipeline with several stages:
1. Processing: simplyfy image to get better results.
Here we do color clustering and similar image transformations.
2. Select shapes: find similar shapes on image
3. Classify shapes
4. Connect shapes: find lines on image and make connections between sh... | [
"processors.LineExtractor",
"os.path.exists",
"processors.LineClusterizer",
"renderers.NetworkxRenderer",
"os.makedirs",
"detectors.SimpleTemplateDetector",
"renderers.PlotlyNodeRenderer",
"processors.NodeConnector",
"cv2.imread",
"renderers.ImageRenderer"
] | [((1426, 1448), 'cv2.imread', 'cv2.imread', (['image_path'], {}), '(image_path)\n', (1436, 1448), False, 'import cv2\n'), ((713, 736), 'os.path.exists', 'os.path.exists', (['tempdir'], {}), '(tempdir)\n', (727, 736), False, 'import os\n'), ((750, 770), 'os.makedirs', 'os.makedirs', (['tempdir'], {}), '(tempdir)\n', (76... |
# ======================================================================================================================
# File: GUI/MainWindow.py
# Project: AlphaBrew
# Description: Extensions and functionality for the main GUI window.
# Author: <NAME> <<EMAIL>>
# Copyright: (c) 2020 <NAME>... | [
"GUI.TabMash.TabMash",
"GUI.Base.MainWindow.Ui_MainWindow",
"GUI.TabMiscellaneous.TabMiscellaneous",
"importlib_metadata.version",
"GUI.TabFermentables.TabFermentables",
"GUI.TabHops.TabHops",
"PySide2.QtWidgets.QFileDialog.getOpenFileName",
"GUI.TabWaters.TabWaters",
"PySide2.QtWidgets.QMessageBox.... | [((2977, 2992), 'GUI.Base.MainWindow.Ui_MainWindow', 'Ui_MainWindow', ([], {}), '()\n', (2990, 2992), False, 'from GUI.Base.MainWindow import Ui_MainWindow\n'), ((3082, 3121), 'importlib_metadata.version', 'importlib_metadata.version', (['"""alphabrew"""'], {}), "('alphabrew')\n", (3108, 3121), False, 'import importlib... |
from django.contrib.auth import authenticate, login
from django.contrib.auth.models import User
from django.shortcuts import render, HttpResponseRedirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import views as auth_views
def crear_cuenta(request):
if request.user.is_authent... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"django.contrib.auth.views.login",
"django.contrib.auth.login",
"django.shortcuts.HttpResponseRedirect",
"django.contrib.auth.forms.UserCreationForm",
"django.contrib.auth.models.User.objects.create_user"
] | [((918, 977), 'django.shortcuts.render', 'render', (['request', '"""registration/signup.html"""', "{'form': form}"], {}), "(request, 'registration/signup.html', {'form': form})\n", (924, 977), False, 'from django.shortcuts import render, HttpResponseRedirect\n'), ((1240, 1265), 'django.contrib.auth.views.login', 'auth_... |
import argparse
import os
import sys
import time
import warnings
from ast import literal_eval
warnings.filterwarnings("ignore")
import IPython
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import torch
import context
from context import utils
import uti... | [
"utils.db.upload_directory",
"time.sleep",
"numpy.equal",
"utils.plotting.timeseries_median",
"utils.misc.get_equal_dicts",
"os.path.exists",
"utils.filesystem.get_parent",
"argparse.ArgumentParser",
"utils.plotting.timeseries_mean_grouped",
"numpy.where",
"data_analysis.invert_signs",
"matplo... | [((94, 127), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (117, 127), False, 'import warnings\n'), ((169, 183), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (176, 183), True, 'import matplotlib as mpl\n'), ((7860, 7894), 'data_analysis.get_checkpoint_di... |
import tensorrt as trt
import pycuda.driver as cuda
import cv2
import numpy as np
class TrtPacknet(object):
"""TrtPacknet class encapsulates things needed to run TRT Packnet (depth inference)."""
def _load_engine(self):
TRTbin = 'trt_%s.trt' % self.model
with open(TRTbin, 'rb') as f, trt.Runt... | [
"pycuda.driver.mem_alloc",
"pycuda.driver.pagelocked_empty",
"pycuda.driver.Stream",
"tensorrt.Logger",
"tensorrt.Runtime"
] | [((1527, 1554), 'tensorrt.Logger', 'trt.Logger', (['trt.Logger.INFO'], {}), '(trt.Logger.INFO)\n', (1537, 1554), True, 'import tensorrt as trt\n'), ((312, 340), 'tensorrt.Runtime', 'trt.Runtime', (['self.trt_logger'], {}), '(self.trt_logger)\n', (323, 340), True, 'import tensorrt as trt\n'), ((734, 773), 'pycuda.driver... |
# analyzing each point forecast and selecting the best, day by day, saving forecasts and making final forecast
import os
import sys
import datetime
import logging
import logging.handlers as handlers
import json
import itertools as it
import pandas as pd
import numpy as np
# open local settings
with open('./settings.js... | [
"logging.basicConfig",
"logging.getLogger",
"numpy.shape",
"sys.path.insert",
"numpy.abs",
"numpy.dtype",
"logging.handlers.RotatingFileHandler",
"stochastic_model_obtain_results.stochastic_simulation_results_analysis",
"numpy.array",
"datetime.datetime.now",
"os.path.basename",
"save_forecast... | [((612, 742), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'log_path_filename', 'level': 'logging.DEBUG', 'format': '"""%(asctime)s %(levelname)s %(name)s %(message)s"""'}), "(filename=log_path_filename, level=logging.DEBUG, format\n ='%(asctime)s %(levelname)s %(name)s %(message)s')\n", (631, 742... |
from random import randint
from typing import Any
from typing import Dict
from retrying import retry
import apysc as ap
from apysc._event.mouse_up_interface import MouseUpInterface
from apysc._expression import expression_data_util
from apysc._type.variable_name_interface import VariableNameInterface
cl... | [
"apysc._expression.expression_data_util.empty_expression",
"apysc._expression.expression_data_util.get_current_expression",
"apysc._expression.expression_data_util.get_current_event_handler_scope_expression",
"apysc._event.mouse_up_interface.MouseUpInterface",
"random.randint"
] | [((1416, 1434), 'apysc._event.mouse_up_interface.MouseUpInterface', 'MouseUpInterface', ([], {}), '()\n', (1432, 1434), False, 'from apysc._event.mouse_up_interface import MouseUpInterface\n'), ((1805, 1844), 'apysc._expression.expression_data_util.empty_expression', 'expression_data_util.empty_expression', ([], {}), '... |
from ipywidgets import interact
import ipywidgets as widgets
from IPython.display import display
class SimpleWidgets():
def __init__(self):
self._int_slider_widget = None
self._clicked_next_widget = None
self._button = None
def do_stuff_on_click(self, b):
if self._clicked_next... | [
"IPython.display.display",
"ipywidgets.IntSlider",
"ipywidgets.Dropdown",
"ipywidgets.Button",
"ipywidgets.Checkbox"
] | [((1102, 1141), 'ipywidgets.Button', 'widgets.Button', ([], {'description': '"""Click Me!"""'}), "(description='Click Me!')\n", (1116, 1141), True, 'import ipywidgets as widgets\n'), ((1150, 1171), 'IPython.display.display', 'display', (['self._button'], {}), '(self._button)\n', (1157, 1171), False, 'from IPython.displ... |
import alsaaudio, wave
mixer = alsaaudio.Mixer(control='Mic', cardindex=0)
mixer.setrec(1)
mixer.setvolume(80, 0, alsaaudio.PCM_CAPTURE)
inp = alsaaudio.PCM(type=alsaaudio.PCM_CAPTURE, device='sysdefault:CARD=Headset')
inp.setchannels(1)
inp.setrate(44100)
inp.setformat(alsaaudio.PCM_FORMAT_S16_LE)
inp.setperiodsize(1... | [
"alsaaudio.Mixer",
"wave.open",
"alsaaudio.PCM"
] | [((31, 74), 'alsaaudio.Mixer', 'alsaaudio.Mixer', ([], {'control': '"""Mic"""', 'cardindex': '(0)'}), "(control='Mic', cardindex=0)\n", (46, 74), False, 'import alsaaudio, wave\n'), ((144, 219), 'alsaaudio.PCM', 'alsaaudio.PCM', ([], {'type': 'alsaaudio.PCM_CAPTURE', 'device': '"""sysdefault:CARD=Headset"""'}), "(type=... |
"""Provides functions for working with legacy session cookies."""
from typing import Tuple
from base64 import b64encode, b64decode
import hashlib
from datetime import datetime, timedelta
from .exceptions import InvalidCookie
from . import util
def unpack(cookie: str) -> Tuple[str, str, str, datetime, str]:
"""
... | [
"hashlib.sha1"
] | [((2503, 2524), 'hashlib.sha1', 'hashlib.sha1', (['to_sign'], {}), '(to_sign)\n', (2515, 2524), False, 'import hashlib\n')] |
import argparse
import csv
import os
import signal
import logging
from datetime import datetime
from decimal import Decimal
import pandas as pd
import progressbar
import sqlite3
import sys
import time
from pathlib import Path
from dhalsim.parser.file_generator import BatchReadmeGenerator, GeneralReadmeGenerator
from ... | [
"logging.getLogger",
"dhalsim.py3_logger.get_logger",
"pandas.read_csv",
"time.sleep",
"sys.exit",
"progressbar.ProgressBar",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
"dhalsim.parser.file_generator.BatchReadmeGenerator",
"dhalsim.parser.file_generator.GeneralReadmeGenerator",... | [((16637, 16694), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run the simulation"""'}), "(description='Run the simulation')\n", (16660, 16694), False, 'import argparse\n'), ((637, 681), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'self.interrupt'], {}), '(signal.SIGINT, self.... |
"""
Utility functions for running NEB calculations
"""
import numpy as np
from aiida.orm import StructureData
from aiida.engine import calcfunction
from ase.neb import NEB
@calcfunction
def neb_interpolate(init_structure, final_strucrture, nimages):
"""
Interplate NEB frames using the starting and the final s... | [
"numpy.argmin",
"aiida.orm.StructureData",
"numpy.asarray"
] | [((828, 845), 'numpy.asarray', 'np.asarray', (['disps'], {}), '(disps)\n', (838, 845), True, 'import numpy as np\n'), ((1098, 1130), 'aiida.orm.StructureData', 'StructureData', ([], {'ase': 'neb.images[0]'}), '(ase=neb.images[0])\n', (1111, 1130), False, 'from aiida.orm import StructureData\n'), ((1199, 1232), 'aiida.o... |
import os
import random
# Fullscreen meshlab on right monitor for this to work
for k in range(100, 200):
n_objects = random.randint(5, 10)
os.system("python kuka_pydrake_sim.py -T 60 --seed %d --hacky_save_video -N %d" % (k, n_objects))
| [
"os.system",
"random.randint"
] | [((119, 140), 'random.randint', 'random.randint', (['(5)', '(10)'], {}), '(5, 10)\n', (133, 140), False, 'import random\n'), ((142, 248), 'os.system', 'os.system', (["('python kuka_pydrake_sim.py -T 60 --seed %d --hacky_save_video -N %d' % (k,\n n_objects))"], {}), "(\n 'python kuka_pydrake_sim.py -T 60 --seed %d... |
# Create your views here.
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated
from article.models import Product
from article.serializers import ProductSerializer
class ProductListCreateView(generics.ListCreateAPIView):
"""Create Product"""
permission_classes = [IsAu... | [
"article.models.Product.objects.order_by",
"article.models.Product.objects.all"
] | [((348, 390), 'article.models.Product.objects.order_by', 'Product.objects.order_by', (['"""-date_modified"""'], {}), "('-date_modified')\n", (372, 390), False, 'from article.models import Product\n'), ((768, 789), 'article.models.Product.objects.all', 'Product.objects.all', ([], {}), '()\n', (787, 789), False, 'from ar... |
# -*- coding: utf-8 -*-
# @Author: TD21forever
# @Date: 2019-05-26 12:14:07
# @Last Modified by: TD21forever
# @Last Modified time: 2019-06-17 23:11:15
import numpy as np
'''
dp[item][cap]的意思是 从前item个物品中拿东西 放到容量为cap 的背包中 能拿到的最大价值
'''
def solution(num,waste,value,capacity):
dp = np.zeros([num+5,capacity+... | [
"numpy.zeros"
] | [((295, 328), 'numpy.zeros', 'np.zeros', (['[num + 5, capacity + 2]'], {}), '([num + 5, capacity + 2])\n', (303, 328), True, 'import numpy as np\n')] |
# coding=utf-8
# Copyright 2018 The DisentanglementLib 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
#
# Un... | [
"matplotlib.pyplot.ylabel",
"seaborn.set_style",
"matplotlib.pyplot.GridSpec",
"seaborn.color_palette",
"pathlib.Path",
"matplotlib.pyplot.xlabel",
"numpy.max",
"numpy.linspace",
"os.path.isdir",
"pandas.DataFrame",
"matplotlib.use",
"seaborn.set_context",
"numpy.around",
"matplotlib.pyplo... | [((838, 859), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (852, 859), False, 'import matplotlib\n'), ((1703, 1773), 'seaborn.set_context', 'sns.set_context', (['"""notebook"""'], {'font_scale': '(1.5)', 'rc': "{'lines.linewidth': 2}"}), "('notebook', font_scale=1.5, rc={'lines.linewidth': 2})\... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 18 09:17:23 2018
@author: Manuel
the pentaton logic go around II
"""
import random
random.seed(0)
print(random.getrandbits(5))
# =============================================================================
#
# Variables
# =====================... | [
"random.sample",
"random.getrandbits",
"random.seed",
"random.randrange"
] | [((149, 163), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (160, 163), False, 'import random\n'), ((171, 192), 'random.getrandbits', 'random.getrandbits', (['(5)'], {}), '(5)\n', (189, 192), False, 'import random\n'), ((1893, 1914), 'random.sample', 'random.sample', (['pos', '(2)'], {}), '(pos, 2)\n', (1906, 1... |
import scrapy
from aroay_cloudscraper import CloudScraperRequest
class JavdbSpider(scrapy.Spider):
name = 'javdb'
allowed_domains = ['javdb.com']
headers = {"Accept-Language": "zh-cn;q=0.8,en-US;q=0.6"}
def start_requests(self):
yield CloudScraperRequest("https://javdb.com/v/BOeQO", callback=... | [
"aroay_cloudscraper.CloudScraperRequest"
] | [((262, 331), 'aroay_cloudscraper.CloudScraperRequest', 'CloudScraperRequest', (['"""https://javdb.com/v/BOeQO"""'], {'callback': 'self.parse'}), "('https://javdb.com/v/BOeQO', callback=self.parse)\n", (281, 331), False, 'from aroay_cloudscraper import CloudScraperRequest\n')] |
# *=========================================================================
# *
# * Copyright Erasmus MC Rotterdam and contributors
# * This software is licensed under the Apache 2 license, quoted below.
# * Copyright 2019 Erasmus MC Rotterdam.
# * Copyright 2019 <NAME> <<EMAIL>>
# * Licensed under the Apache L... | [
"os.path.realpath",
"ExpSettings.Dataset.SyntheticImages.Environment.Environment",
"Parameter.Parameter.Parameter"
] | [((1142, 1168), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1158, 1168), False, 'import os\n'), ((1309, 1350), 'Parameter.Parameter.Parameter', 'Par', (['"""Metric1Weight"""', '"""Gauss"""', '(4.12)', '(2.65)'], {}), "('Metric1Weight', 'Gauss', 4.12, 2.65)\n", (1312, 1350), True, 'from ... |
import argparse
import cv2
import numpy as np
from inference import Network
from openvino.inference_engine import IENetwork, IECore
import pylab as plt
import math
import matplotlib
from scipy.ndimage.filters import gaussian_filter
INPUT_STREAM = "emotion.mp4"
CPU_EXTENSION = "C:\\Program Files (x86)\\IntelSWTools\\o... | [
"numpy.dstack",
"argparse.ArgumentParser",
"numpy.argmax",
"cv2.VideoWriter",
"numpy.sum",
"numpy.zeros",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"inference.Network",
"cv2.resize",
"cv2.waitKey"
] | [((1115, 1173), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Run inference on an input video"""'], {}), "('Run inference on an input video')\n", (1138, 1173), False, 'import argparse\n'), ((2370, 2410), 'cv2.resize', 'cv2.resize', (['input_image', '(width, height)'], {}), '(input_image, (width, height))\... |
# Copyright 2014 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"warehouse.utils.vary_by",
"hmac.compare_digest",
"functools.wraps",
"warehouse.utils.random_token",
"werkzeug.exceptions.SecurityError"
] | [((3637, 3656), 'functools.wraps', 'functools.wraps', (['fn'], {}), '(fn)\n', (3652, 3656), False, 'import functools\n'), ((6356, 6370), 'warehouse.utils.random_token', 'random_token', ([], {}), '()\n', (6368, 6370), False, 'from warehouse.utils import random_token, vary_by\n'), ((963, 1026), 'werkzeug.exceptions.Secur... |
"""Checks if any of the latests tests has performed considerably different than
the previous ones. Takes the log directory as an argument."""
import os
import sys
from testsuite_common import Result, processLogLine, bcolors, getLastTwoLines
LOGDIR = sys.argv[1] #Get the log directory as an argument
PERCENTAGE = 5 #De... | [
"testsuite_common.Result",
"os.listdir",
"testsuite_common.processLogLine",
"testsuite_common.getLastTwoLines"
] | [((1688, 1706), 'os.listdir', 'os.listdir', (['LOGDIR'], {}), '(LOGDIR)\n', (1698, 1706), False, 'import os\n'), ((1882, 1914), 'testsuite_common.getLastTwoLines', 'getLastTwoLines', (['logfile', 'LOGDIR'], {}), '(logfile, LOGDIR)\n', (1897, 1914), False, 'from testsuite_common import Result, processLogLine, bcolors, g... |
import functools
from spaceone.api.repository.v1 import schema_pb2
from spaceone.core.pygrpc.message_type import *
from spaceone.repository.model.schema_model import Schema
from spaceone.repository.info.repository_info import RepositoryInfo
__all__ = ['SchemaInfo', 'SchemasInfo']
def SchemaInfo(schema_vo: Schema, mi... | [
"spaceone.api.repository.v1.schema_pb2.SchemasInfo",
"functools.partial",
"spaceone.api.repository.v1.schema_pb2.SchemaInfo",
"spaceone.repository.info.repository_info.RepositoryInfo"
] | [((1340, 1369), 'spaceone.api.repository.v1.schema_pb2.SchemaInfo', 'schema_pb2.SchemaInfo', ([], {}), '(**info)\n', (1361, 1369), False, 'from spaceone.api.repository.v1 import schema_pb2\n'), ((1492, 1556), 'spaceone.api.repository.v1.schema_pb2.SchemasInfo', 'schema_pb2.SchemasInfo', ([], {'results': 'results', 'tot... |
############################################################
# Dev: <NAME>
# Class: Machine Learning
# Date: 2/23/2022
# file: utils.py
# Description: utility functions for artificial neural
# network learning
#############################################################
import random
class Data:
'''c... | [
"random.choice",
"random.shuffle"
] | [((7894, 7916), 'random.choice', 'random.choice', (['classes'], {}), '(classes)\n', (7907, 7916), False, 'import random\n'), ((1179, 1208), 'random.shuffle', 'random.shuffle', (['self.training'], {}), '(self.training)\n', (1193, 1208), False, 'import random\n'), ((8056, 8078), 'random.choice', 'random.choice', (['class... |
# Copyright FMR LLC <<EMAIL>>
# SPDX-License-Identifier: Apache-2.0
"""
The script generates variations for the parameters using configuration file and stores them in respective named tuple
"""
import math
import random
from collections import namedtuple
import numpy as np
# configuration parameters
scene_options = [... | [
"random.choices",
"random.choice",
"math.radians",
"numpy.random.uniform"
] | [((1896, 1992), 'numpy.random.uniform', 'np.random.uniform', (["configs[variable]['range'][0]", "configs[variable]['range'][1]", 'variations'], {}), "(configs[variable]['range'][0], configs[variable]['range']\n [1], variations)\n", (1913, 1992), True, 'import numpy as np\n'), ((2421, 2500), 'random.choices', 'random... |
import sys
import setuptools
sys.path.insert(0, "src")
import pytorch_adapt
with open("README.md", "r") as fh:
long_description = fh.read()
extras_require_ignite = ["pytorch-ignite == 0.5.0.dev20220221"]
extras_require_lightning = ["pytorch-lightning"]
extras_require_record_keeper = ["record-keeper >= 0.9.31"]... | [
"sys.path.insert",
"setuptools.find_packages"
] | [((31, 56), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""src"""'], {}), "(0, 'src')\n", (46, 56), False, 'import sys\n'), ((966, 1003), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (990, 1003), False, 'import setuptools\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
class SoftAttention(nn.Module):
"""
Soft Attention module
"""
def __init__(self, rnn_hidden_size, attn_hidden_size, temp=1):
super(SoftAttention, self).__init__()
self.softmax = nn.Softmax(dim=1)
self.h2attn ... | [
"torch.tanh",
"torch.bmm",
"torch.nn.Linear",
"torch.nn.Softmax"
] | [((281, 298), 'torch.nn.Softmax', 'nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (291, 298), True, 'import torch.nn as nn\n'), ((322, 366), 'torch.nn.Linear', 'nn.Linear', (['rnn_hidden_size', 'attn_hidden_size'], {}), '(rnn_hidden_size, attn_hidden_size)\n', (331, 366), True, 'import torch.nn as nn\n'), ((3083, 3100... |
import torch
import torchvision
import torch.nn as nn
import numpy as np
import torchvision.transforms as transforms
# ================================================================== #
# 目录 #
# ===========================================================... | [
"torch.load",
"torchvision.models.resnet18",
"torch.from_numpy",
"numpy.array",
"torch.tensor",
"torch.nn.MSELoss",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.save",
"torchvision.transforms.ToTensor",
"torch.randn"
] | [((953, 990), 'torch.tensor', 'torch.tensor', (['(1.0)'], {'requires_grad': '(True)'}), '(1.0, requires_grad=True)\n', (965, 990), False, 'import torch\n'), ((994, 1031), 'torch.tensor', 'torch.tensor', (['(2.0)'], {'requires_grad': '(True)'}), '(2.0, requires_grad=True)\n', (1006, 1031), False, 'import torch\n'), ((10... |
from flask import Flask
from lambdarado import start
def get_app():
app = Flask(__name__)
@app.route('/a')
def get_a():
return 'AAA'
@app.route('/b')
def get_b():
return 'BBB'
return app
print("RUNNING main.py")
start(get_app)
| [
"lambdarado.start",
"flask.Flask"
] | [((260, 274), 'lambdarado.start', 'start', (['get_app'], {}), '(get_app)\n', (265, 274), False, 'from lambdarado import start\n'), ((80, 95), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'from flask import Flask\n')] |
"""A module containing tests for the pyIATI representation of Standard metadata."""
import copy
import math
import operator
import pytest
import iati.tests.utilities
from iati.tests.fixtures.versions import iativer, semver, split_decimal, split_iativer, split_semver
class TestVersionInit:
"""A container for tests... | [
"iati.tests.fixtures.versions.split_semver",
"iati.tests.fixtures.versions.iativer",
"iati.tests.fixtures.versions.semver",
"pytest.mark.latest_version",
"pytest.mark.parametrize",
"pytest.raises",
"iati.tests.fixtures.versions.split_decimal",
"copy.deepcopy",
"pytest.fixture",
"iati.tests.fixture... | [((4555, 5267), 'pytest.fixture', 'pytest.fixture', ([], {'params': "[('1.01', '1.01', '='), ('1.0.0', '1.0.0', '='), ('1.01', '1.0.0', '='), (\n '1.0.0', '1.01', '='), ('1.02', '1.02', '='), ('1.1.0', '1.1.0', '='),\n ('1.02', '1.1.0', '='), ('1.1.0', '1.02', '='), ('1.01', '1.02', '<'),\n ('1.0.0', '1.1.0', ... |
"""Console script for r_freeze."""
import argparse
import sys
from r_freeze.r_freeze import get_packages, write_package_file
def main():
"""Console script for r_freeze."""
parser = argparse.ArgumentParser()
parser.add_argument("dir", type=str, help="Directory to look for")
parser.add_argument(
... | [
"r_freeze.r_freeze.get_packages",
"r_freeze.r_freeze.write_package_file",
"argparse.ArgumentParser"
] | [((191, 216), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (214, 216), False, 'import argparse\n'), ((868, 890), 'r_freeze.r_freeze.get_packages', 'get_packages', (['args.dir'], {}), '(args.dir)\n', (880, 890), False, 'from r_freeze.r_freeze import get_packages, write_package_file\n'), ((899,... |
import sqlalchemy
from application import metadata
Token = sqlalchemy.Table(
"tokens",
metadata,
sqlalchemy.Column("user_id", sqlalchemy.ForeignKey(
'_ps_users.id', ondelete="CASCADE"), primary_key=True),
sqlalchemy.Column("token", sqlalchemy.String(length=1000),
nullable... | [
"sqlalchemy.String",
"sqlalchemy.ForeignKey"
] | [((140, 197), 'sqlalchemy.ForeignKey', 'sqlalchemy.ForeignKey', (['"""_ps_users.id"""'], {'ondelete': '"""CASCADE"""'}), "('_ps_users.id', ondelete='CASCADE')\n", (161, 197), False, 'import sqlalchemy\n'), ((258, 288), 'sqlalchemy.String', 'sqlalchemy.String', ([], {'length': '(1000)'}), '(length=1000)\n', (275, 288), ... |
import astropy.units as u
import numpy as np
from ..utils import cone_solid_angle
#: Unit of the background rate IRF
BACKGROUND_UNIT = u.Unit('s-1 TeV-1 sr-1')
def background_2d(events, reco_energy_bins, fov_offset_bins, t_obs):
"""
Calculate background rates in radially symmetric bins in the field of view.... | [
"numpy.diff",
"astropy.units.Unit"
] | [((137, 161), 'astropy.units.Unit', 'u.Unit', (['"""s-1 TeV-1 sr-1"""'], {}), "('s-1 TeV-1 sr-1')\n", (143, 161), True, 'import astropy.units as u\n'), ((1738, 1763), 'numpy.diff', 'np.diff', (['reco_energy_bins'], {}), '(reco_energy_bins)\n', (1745, 1763), True, 'import numpy as np\n')] |
import pymysql
import pandas as pd
import logging
import traceback
logger = logging.getLogger(__name__)
TABLE_CANDLE_PATTERN = "CREATE TABLE IF NOT EXISTS {table}(" \
" id int(11) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, " \
" time DATETIME UNIQUE," \
... | [
"logging.getLogger",
"traceback.print_exc",
"pymysql.connect",
"pandas.DataFrame"
] | [((77, 104), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (94, 104), False, 'import logging\n'), ((727, 900), 'pymysql.connect', 'pymysql.connect', ([], {'host': '"""127.0.0.1"""', 'user': '"""root"""', 'password': '"""<PASSWORD>"""', 'db': '"""hourly_ohlc"""', 'charset': '"""utf8mb4"""... |
import json
import requests
from requests_toolbelt import MultipartEncoder
from pymessenger.graph_api import FacebookGraphApi
import pymessenger.utils as utils
class Bot(FacebookGraphApi):
def __init__(self, *args, **kwargs):
super(Bot, self).__init__(*args, **kwargs)
def send_text_message(self, r... | [
"json.dumps",
"requests_toolbelt.MultipartEncoder",
"requests.post"
] | [((4093, 4118), 'requests_toolbelt.MultipartEncoder', 'MultipartEncoder', (['payload'], {}), '(payload)\n', (4109, 4118), False, 'from requests_toolbelt import MultipartEncoder\n'), ((6174, 6242), 'requests.post', 'requests.post', (['request_endpoint'], {'params': 'self.auth_args', 'json': 'payload'}), '(request_endpoi... |