code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Prime Adam Int Check"""
import math
def prime_check(number: int) -> bool:
"""
A number is prime if it has exactly two dividers: 1 and itself.
Example : 2, 3, 5, 7
"""
if number < 2:
# Numbers less than 2 are not prime.
return False
for i in range(2, int(math.sqrt(number) + 1... | [
"math.sqrt"
] | [((299, 316), 'math.sqrt', 'math.sqrt', (['number'], {}), '(number)\n', (308, 316), False, 'import math\n')] |
from setuptools import setup
setup(
name="ml-lineage-helper",
version="0.1",
description="A wrapper around SageMaker ML Lineage Tracking extending ML Lineage to end-to-end ML lifecycles, including additional capabilities around Feature Store groups, queries, and other relevant artifacts.",
url="https:/... | [
"setuptools.setup"
] | [((30, 576), 'setuptools.setup', 'setup', ([], {'name': '"""ml-lineage-helper"""', 'version': '"""0.1"""', 'description': '"""A wrapper around SageMaker ML Lineage Tracking extending ML Lineage to end-to-end ML lifecycles, including additional capabilities around Feature Store groups, queries, and other relevant artifa... |
# ARZINA: RUNNING THIS CODE IN GEO GIVES YOU A DIFFERENT OUTPUT TO WHAT IS EXPECTED (ON THE TASK IT GIVES EXAMPLE OUTPUT,
# ARZINA: BUT MY OUTPUT IS NOT THE SAME'
# ARZINA: I SUSPECT IT IS THE HAVERSINE FORMULA WHICH I'M USING WRONG
from floodsystem.stationdata import build_station_list
from floodsystem.geo import sta... | [
"floodsystem.stationdata.build_station_list",
"floodsystem.geo.stations_within_radius"
] | [((367, 387), 'floodsystem.stationdata.build_station_list', 'build_station_list', ([], {}), '()\n', (385, 387), False, 'from floodsystem.stationdata import build_station_list\n'), ((455, 498), 'floodsystem.geo.stations_within_radius', 'stations_within_radius', (['stations', 'centre', 'r'], {}), '(stations, centre, r)\n... |
import requests
from requests.auth import HTTPBasicAuth
r = requests.get('http://localhost:5000', auth=HTTPBasicAuth('username', 'password'))
r = requests.get('http://localhost:5000', auth=('username', 'password')) # 简写,默认的东西
print(r.status_code)
from requests_oauthlib import OAuth1
url= ''
auth = OAuth1('APP_key','... | [
"requests_oauthlib.OAuth1",
"requests.auth.HTTPBasicAuth",
"requests.get"
] | [((147, 215), 'requests.get', 'requests.get', (['"""http://localhost:5000"""'], {'auth': "('username', 'password')"}), "('http://localhost:5000', auth=('username', 'password'))\n", (159, 215), False, 'import requests\n'), ((302, 372), 'requests_oauthlib.OAuth1', 'OAuth1', (['"""APP_key"""', '"""App_secret"""', '"""user... |
#!/usr/bin/python
# Google File Finder - Finished in Dec, 2016
# Powered by <NAME> [<EMAIL>]
import os
import googlesearch
""" --------------------------------------------------------------------------- """
def cut_string(text, limit):
i = 0
while i > -1:
s = str(text[i:(i+1)])
i = i + 1
if s == limit:
te... | [
"os.system",
"googlesearch.search_google"
] | [((2334, 2352), 'os.system', 'os.system', (['"""clear"""'], {}), "('clear')\n", (2343, 2352), False, 'import os\n'), ((3254, 3318), 'googlesearch.search_google', 'googlesearch.search_google', (['search', 'amount_results', '(1)', 'file_type'], {}), '(search, amount_results, 1, file_type)\n', (3280, 3318), False, 'import... |
#!/usr/bin/env python2
import vxi11
import time
import argparse
if __name__ == "__main__":
ap = argparse.ArgumentParser()
ap.add_argument("DEVICE", nargs=1, help="Device to connect to")
ap.add_argument("--toggle", "-t",
action="store_const", dest="action", const="toggle",
... | [
"vxi11.Instrument",
"time.sleep",
"argparse.ArgumentParser"
] | [((104, 129), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (127, 129), False, 'import argparse\n'), ((910, 942), 'vxi11.Instrument', 'vxi11.Instrument', (['args.DEVICE[0]'], {}), '(args.DEVICE[0])\n', (926, 942), False, 'import vxi11\n'), ((1474, 1495), 'time.sleep', 'time.sleep', (['args.wai... |
import io
import errno
import types
import importlib
import inspect
from pathlib import Path
from dynaconf import default_settings
from dynaconf.utils.files import find_file
from dynaconf.utils import DynaconfDict, object_merge, raw_logger
def load(obj, settings_module, identifier='py', silent=False, key=None):
"... | [
"importlib.import_module",
"inspect.stack",
"pathlib.Path",
"dynaconf.utils.object_merge",
"dynaconf.utils.raw_logger",
"dynaconf.utils.DynaconfDict"
] | [((1244, 1256), 'dynaconf.utils.raw_logger', 'raw_logger', ([], {}), '()\n', (1254, 1256), False, 'from dynaconf.utils import DynaconfDict, object_merge, raw_logger\n'), ((3508, 3527), 'pathlib.Path', 'Path', (['settings_path'], {}), '(settings_path)\n', (3512, 3527), False, 'from pathlib import Path\n'), ((1334, 1367)... |
# coding = UTF-8
import time
import re
import js2py
import requests
import json
import KuGou
from KuGou.Requirement import Header
class MusicList(object):
"""从酷狗获取要查询的歌曲的结果列表"""
def __init__(self, MusicName: str) -> None:
"""初始化该类:
检查参数正确性,创建时间戳,初始化签名和数据容器,初始化JS命名空间(初始化命名空间并添加签名创建函数)。
... | [
"json.loads",
"KuGou.Requirement.Header.GetHeader",
"js2py.EvalJs",
"KuGou.Music",
"re.match",
"requests.get",
"time.time"
] | [((776, 790), 'js2py.EvalJs', 'js2py.EvalJs', ([], {}), '()\n', (788, 790), False, 'import js2py\n'), ((3798, 3853), 'KuGou.Requirement.Header.GetHeader', 'Header.GetHeader', ([], {'Referrer': 'Header.REFERRER_KUGOU_SEARCH'}), '(Referrer=Header.REFERRER_KUGOU_SEARCH)\n', (3814, 3853), False, 'from KuGou.Requirement imp... |
# --------------
#Importing header files
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#Path of the file
path
#Code starts here
data=pd.read_csv(path)
data.rename(columns={'Total':'Total_Medals'},inplace=True)
data.head(10)
# --------------
#Code starts here
data['Better_E... | [
"matplotlib.pyplot.xticks",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots"
] | [((169, 186), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (180, 186), True, 'import pandas as pd\n'), ((1371, 1389), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {}), '(3, 1)\n', (1383, 1389), True, 'import matplotlib.pyplot as plt\n'), ((2807, 2834), 'matplotlib.pyplot.xlabel', 'plt... |
# Lint as: python3
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
"xls.common.runfiles.get_contents_as_text",
"random.Random",
"absl.testing.absltest.main",
"absl.flags.DEFINE_boolean",
"xls.dslx.fuzzer.ast_generator.AstGeneratorOptions"
] | [((904, 997), 'absl.flags.DEFINE_boolean', 'flags.DEFINE_boolean', (['"""update_golden"""', '(False)', '"""Whether to update golden reference files."""'], {}), "('update_golden', False,\n 'Whether to update golden reference files.')\n", (924, 997), False, 'from absl import flags\n'), ((2509, 2524), 'absl.testing.abs... |
try:
from enum import Enum
from pathlib import Path as path
import os
except ImportError as err:
print("Unable to import: {}".format(err))
exit()
class Directory(Enum):
DEFAULT_WINDOWS_FIREFOX = "{}\\Roaming\\Mozilla\\Firefox\\Profiles".format(
os.getenv('APPDATA'))
DEFAULT_WINDOW... | [
"pathlib.Path.home",
"os.getenv"
] | [((280, 300), 'os.getenv', 'os.getenv', (['"""APPDATA"""'], {}), "('APPDATA')\n", (289, 300), False, 'import os\n'), ((386, 406), 'os.getenv', 'os.getenv', (['"""APPDATA"""'], {}), "('APPDATA')\n", (395, 406), False, 'import os\n'), ((500, 520), 'os.getenv', 'os.getenv', (['"""APPDATA"""'], {}), "('APPDATA')\n", (509, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
from utils.period import todate
from utils.shortcut import (rebuild_html,
render)
class Serializer:
# 一定要传form={}进来
def __init__(self, **kwargs):
self.data = self.serialize(kwargs.get('form'))
self.exclude ... | [
"utils.period.todate",
"utils.shortcut.render",
"time.time"
] | [((1261, 1281), 'utils.shortcut.render', 'render', (["form['text']"], {}), "(form['text'])\n", (1267, 1281), False, 'from utils.shortcut import rebuild_html, render\n'), ((1489, 1529), 'utils.period.todate', 'todate', (["form['created_time']", '"""%b.%d %Y"""'], {}), "(form['created_time'], '%b.%d %Y')\n", (1495, 1529)... |
from numpy import ndarray, array
from electripy.physics.charges import PointCharge
class _ChargesSet:
"""
A _ChargesSet instance is a group of charges. The electric
field at a given point can be calculated as the sum of each
electric field at that point for every charge in the charge
set.
"""
... | [
"numpy.array"
] | [((566, 583), 'numpy.array', 'array', (['[0.0, 0.0]'], {}), '([0.0, 0.0])\n', (571, 583), False, 'from numpy import ndarray, array\n')] |
# -*- coding:utf8 -*-
import logging
from twisted.internet import reactor
from pygps.server.handlers import ProtocalTCPFactory, ProtocalUDPHandler
from pygps.server.pusher import ThreadQueuePusher, DalPusher
from pygps.goodhope.dal import GPSDal
from pygps.protocol.bsj import A5, Km
from pygps.protocol.longhan import L... | [
"logging.getLogger",
"logging.StreamHandler",
"argparse.ArgumentParser",
"logging.Formatter",
"logging.handlers.RotatingFileHandler",
"pygps.server.pusher.DalPusher",
"pygps.goodhope.dal.GPSDal",
"pygps.server.handlers.ProtocalTCPFactory",
"twisted.internet.reactor.run",
"pygps.server.handlers.Pro... | [((725, 810), 'logging.handlers.RotatingFileHandler', 'logging.handlers.RotatingFileHandler', (['file_path'], {'maxBytes': '(1048576)', 'backupCount': '(5)'}), '(file_path, maxBytes=1048576, backupCount=5\n )\n', (761, 810), False, 'import logging\n'), ((1042, 1065), 'logging.StreamHandler', 'logging.StreamHandler',... |
#!/usr/bin/env python
from setuptools import setup, find_packages, Extension
extensions = [
Extension('cyhll.hyperloglog', ['cyhll/hyperloglog.pyx']),
Extension('cyhll.murmer3', ['cyhll/murmer3.pyx']),
]
try:
from Cython.Build import cythonize
extensions = cythonize(extensions,
... | [
"setuptools.Extension",
"Cython.Build.cythonize",
"setuptools.find_packages"
] | [((98, 155), 'setuptools.Extension', 'Extension', (['"""cyhll.hyperloglog"""', "['cyhll/hyperloglog.pyx']"], {}), "('cyhll.hyperloglog', ['cyhll/hyperloglog.pyx'])\n", (107, 155), False, 'from setuptools import setup, find_packages, Extension\n'), ((161, 210), 'setuptools.Extension', 'Extension', (['"""cyhll.murmer3"""... |
import random
square = [[1,2,3],[4,5,6],[7,8,9]]
def get_square():
line =[i for i in range(1,10)]
lst = random.sample(line, 9)
square = [lst[i:i + 3] for i in range(0, len(lst), 3)]
return square
def valid_line(line):
if sorted(line) == [1,2,3,4,5,6,7,8,9]: return True
else: return False
de... | [
"random.sample"
] | [((114, 136), 'random.sample', 'random.sample', (['line', '(9)'], {}), '(line, 9)\n', (127, 136), False, 'import random\n')] |
# Copyright (c) 2016-2020 <NAME>
# Licensed under the zlib/libpng License
# https://opensource.org/licenses/Zlib
import math
__all__ = ('slownie', 'slownie_zl', 'slownie_zl100gr')
ZERO_LITERALLY = "zero"
MINUS_LITERALLY = "minus "
HUNDREDS_LITERALLY = [
"",
"sto ",
"dwie\u015Bcie ",
"trzysta ",
... | [
"math.modf"
] | [((2624, 2641), 'math.modf', 'math.modf', (['amount'], {}), '(amount)\n', (2633, 2641), False, 'import math\n'), ((2917, 2934), 'math.modf', 'math.modf', (['amount'], {}), '(amount)\n', (2926, 2934), False, 'import math\n')] |
#!/usr/bin/env python
import contextlib
import os
import platform
from typing import Iterator
from typing import Optional
import uuid
from absl.testing import absltest
from grr_response_client.client_actions.windows import pipes
if platform.system() == "Windows":
# pylint: disable=g-import-not-at-top
# pytype: d... | [
"absl.testing.absltest.main",
"uuid.uuid4",
"win32pipe.CreateNamedPipe",
"platform.system",
"contextlib.closing",
"os.getpid",
"grr_response_client.client_actions.windows.pipes.ListNamedPipes"
] | [((235, 252), 'platform.system', 'platform.system', ([], {}), '()\n', (250, 252), False, 'import platform\n'), ((5051, 5066), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (5064, 5066), False, 'from absl.testing import absltest\n'), ((458, 475), 'platform.system', 'platform.system', ([], {}), '()\n',... |
from arrays import DynamicArray
import fileinput
import random
class WordController:
'''
Class representation of WordController
'''
def __init__(self, fl):
'''
Creates new WordController
:type fl: str
:param fl: user txt file
'''
self._file = fl
def... | [
"fileinput.FileInput",
"random.choice",
"arrays.DynamicArray"
] | [((565, 579), 'arrays.DynamicArray', 'DynamicArray', ([], {}), '()\n', (577, 579), False, 'from arrays import DynamicArray\n'), ((604, 618), 'arrays.DynamicArray', 'DynamicArray', ([], {}), '()\n', (616, 618), False, 'from arrays import DynamicArray\n'), ((1699, 1741), 'fileinput.FileInput', 'fileinput.FileInput', (['s... |
"""
Created on Tue Mar 17 03:23:32 2019
script: /pyleaves/pyleaves/train/csv_datasets_train.py
@author: JacobARose
"""
def main(experiment_config, experiment_results_dir):
############################################
#TODO: Moving towards defining most or all run parameters in separate config files
##... | [
"pyleaves.config.ExperimentConfig",
"mlflow.set_experiment",
"pyleaves.utils.csv_utils.gather_run_data",
"pyleaves.analysis.mlflow_utils.mlflow_log_params_dict",
"pyleaves.train.csv_trainer.CSVTrainer",
"argparse.ArgumentParser",
"mlflow.set_tracking_uri",
"mlflow.tensorflow.autolog",
"itertools.pro... | [((496, 541), 'pyleaves.data_pipeline.preprocessing.LabelEncoder', 'LabelEncoder', ([], {'filepath': 'label_mapping_filepath'}), '(filepath=label_mapping_filepath)\n', (508, 541), False, 'from pyleaves.data_pipeline.preprocessing import LabelEncoder\n'), ((581, 639), 'pyleaves.train.csv_trainer.CSVTrainer', 'CSVTrainer... |
# Generated by Django 3.1.4 on 2020-12-07 21:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('CustomerApps', '0003_auto_20201207_1922'),
]
operations = [
migrations.RemoveField(
model_name='customerapp',
name='... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((240, 308), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""customerapp"""', 'name': '"""paid_status"""'}), "(model_name='customerapp', name='paid_status')\n", (262, 308), False, 'from django.db import migrations, models\n'), ((457, 504), 'django.db.models.CharField', 'models.Cha... |
import pytest
import time
import xml.etree.ElementTree as etree
import shakedown
import sdk_cmd as cmd
import sdk_hosts as hosts
import sdk_install as install
import sdk_marathon as marathon
import sdk_plan as plan
import sdk_tasks as tasks
import sdk_utils as utils
from tests.config import *
def setup_module(modul... | [
"sdk_tasks.check_tasks_updated",
"sdk_marathon.bump_task_count_config",
"sdk_tasks.check_tasks_not_updated",
"time.sleep",
"sdk_plan.wait_for_completed_recovery",
"sdk_marathon.get_config",
"sdk_utils.out",
"sdk_hosts.system_host",
"sdk_plan.wait_for_completed_deployment",
"sdk_install.uninstall",... | [((2207, 2242), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""HDFS-451"""'}), "(reason='HDFS-451')\n", (2223, 2242), False, 'import pytest\n'), ((2804, 2839), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""HDFS-451"""'}), "(reason='HDFS-451')\n", (2820, 2839), False, 'import pytest\n'), ((328... |
import os
import pathlib
import sys
import subprocess
sys.path.insert(1, str(pathlib.Path(__file__).parent.absolute())+"/../../../../parser")
#sys.path.insert(1, '/usr/workspace/wsa/laguna/fpchecker/FPChecker/parser')
from tokenizer import Tokenizer
source = "compute_inst.cu"
def setup_module(module):
THIS_DIR = o... | [
"os.chdir",
"subprocess.check_output",
"os.path.abspath",
"pathlib.Path"
] | [((364, 382), 'os.chdir', 'os.chdir', (['THIS_DIR'], {}), '(THIS_DIR)\n', (372, 382), False, 'import os\n'), ((451, 517), 'subprocess.check_output', 'subprocess.check_output', (['cmd'], {'stderr': 'subprocess.STDOUT', 'shell': '(True)'}), '(cmd, stderr=subprocess.STDOUT, shell=True)\n', (474, 517), False, 'import subpr... |
#!/usr/bin/env python
import rospy
from geometry_msgs.msg import PoseStamped
from styx_msgs.msg import Lane, TrafficLightArray , TrafficLight
from std_msgs.msg import Int32
import numpy as np
from threading import Thread, Lock
from copy import deepcopy
class GT_TL_Pub(object):
def __init__(self):
rospy.in... | [
"rospy.logerr",
"numpy.uint8",
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_time",
"threading.Lock",
"rospy.Rate",
"rospy.Publisher"
] | [((312, 346), 'rospy.init_node', 'rospy.init_node', (['"""gt_TL_Publisher"""'], {}), "('gt_TL_Publisher')\n", (327, 346), False, 'import rospy\n'), ((356, 416), 'rospy.Subscriber', 'rospy.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {}), "('/current_pose', PoseStamped, self.pose_cb)\n", (372, 4... |
import collections
import datetime
import typing as t
import attr
from .. import targets
from ._base import Rotator, Verdict
class _SupportsLessThan(t.Protocol):
def __lt__(self, __other: t.Any) -> bool: ...
TValue = t.TypeVar("TValue", bound=_SupportsLessThan)
Count = t.Union[int, t.Literal["all"]]
@attr.s... | [
"typing.isocalendar",
"attr.s",
"collections.defaultdict",
"typing.TypeVar",
"attr.ib"
] | [((227, 271), 'typing.TypeVar', 't.TypeVar', (['"""TValue"""'], {'bound': '_SupportsLessThan'}), "('TValue', bound=_SupportsLessThan)\n", (236, 271), True, 'import typing as t\n'), ((314, 353), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)', 'kw_only': '(True)'}), '(auto_attribs=True, kw_only=True)\n', (320, 353), ... |
# Copyright 2019 Google Inc. 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 applicable law or ag... | [
"os.path.exists",
"typ.artifacts.Artifacts",
"os.path.join",
"tempfile.mkdtemp",
"shutil.rmtree"
] | [((979, 999), 'os.path.join', 'os.path.join', (['*parts'], {}), '(*parts)\n', (991, 999), False, 'import os\n'), ((1702, 1735), 'os.path.join', 'os.path.join', (['path', 'file_rel_path'], {}), '(path, file_rel_path)\n', (1714, 1735), False, 'import os\n'), ((2015, 2033), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {})... |
"""
LC 480
Given an array of numbers and a number ‘k’, find the median of all the ‘k’ sized sub-arrays (or windows) of the array.
Example 1:
Input: nums=[1, 2, -1, 3, 5], k = 2
Output: [1.5, 0.5, 1.0, 4.0]
Explanation: Lets consider all windows of size ‘2’:
[1, 2, -1, 3, 5] -> median is 1.5
[1, 2, -1, 3, 5] -> media... | [
"heapq._siftdown",
"heapq._siftup"
] | [((1337, 1359), 'heapq._siftup', 'heapq._siftup', (['heap', 'i'], {}), '(heap, i)\n', (1350, 1359), False, 'import heapq\n'), ((1392, 1419), 'heapq._siftdown', 'heapq._siftdown', (['heap', '(0)', 'i'], {}), '(heap, 0, i)\n', (1407, 1419), False, 'import heapq\n')] |
import pandas as pd
import re
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
#from bokeh.plotting import figure, output_file, show
houses = pd.read_csv("out_4.1.csv",index_col=0)
houses.sort_values('具体日期',inplace=True)
houses = houses.iloc[1:]
print(re.search(r"(\d+-\d+)(-\d+)", houses['具体日期... | [
"re.search",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((165, 204), 'pandas.read_csv', 'pd.read_csv', (['"""out_4.1.csv"""'], {'index_col': '(0)'}), "('out_4.1.csv', index_col=0)\n", (176, 204), True, 'import pandas as pd\n'), ((735, 766), 'matplotlib.pyplot.figure', 'plt.figure', (['(0)'], {'figsize': '(10, 10)'}), '(0, figsize=(10, 10))\n', (745, 766), True, 'import mat... |
import multiprocessing as mp
import os
import subprocess
import time
import pytest
from solarforecastarbiter.io import fetch
def badfun():
raise ValueError
def bad_subprocess():
subprocess.run(['cat', '/nowaythisworks'], check=True, capture_output=True)
@pytest.mark.asyncio
@pytest.mark.parametrize('ba... | [
"os.kill",
"solarforecastarbiter.io.fetch.run_in_executor",
"subprocess.run",
"time.sleep",
"pytest.mark.parametrize",
"pytest.importorskip",
"pytest.raises",
"pytest.mark.timeout",
"multiprocessing.current_process"
] | [((293, 404), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bad,err"""', '[(badfun, ValueError), (bad_subprocess, subprocess.CalledProcessError)]'], {}), "('bad,err', [(badfun, ValueError), (bad_subprocess,\n subprocess.CalledProcessError)])\n", (316, 404), False, 'import pytest\n'), ((744, 783), 'pyte... |
from fastapi import APIRouter, Depends
from fastapi.responses import ORJSONResponse
from di import GetPrizeInteractorFactory
from domain.entity import Prize, PrizeResponse, ValidationErrorResponse, now
from usecase.interactor import GetPrizeInteractor
router = APIRouter()
@router.get(
"/{user_id}",
response... | [
"domain.entity.now",
"fastapi.APIRouter",
"fastapi.Depends"
] | [((263, 274), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (272, 274), False, 'from fastapi import APIRouter, Depends\n'), ((533, 571), 'fastapi.Depends', 'Depends', (['GetPrizeInteractorFactory.get'], {}), '(GetPrizeInteractorFactory.get)\n', (540, 571), False, 'from fastapi import APIRouter, Depends\n'), ((663... |
import webbrowser
import pyautogui as magic
from datetime import datetime
import time
import sys
import yaml
sys.tracebacklimit=0
settings_path="setting.yaml"
with open(settings_path) as f:
settings = yaml.load(f, Loader=yaml.FullLoader)
alltimings = settings['alltimings']
timing = alltimings['s... | [
"pyautogui.hotkey",
"pyautogui.write",
"pyautogui.locateCenterOnScreen",
"pyautogui.press",
"pyautogui.moveTo",
"webbrowser.get",
"yaml.load",
"time.sleep",
"pyautogui.click",
"datetime.datetime.now"
] | [((218, 254), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.FullLoader'}), '(f, Loader=yaml.FullLoader)\n', (227, 254), False, 'import yaml\n'), ((567, 585), 'pyautogui.press', 'magic.press', (['"""tab"""'], {}), "('tab')\n", (578, 585), True, 'import pyautogui as magic\n'), ((591, 609), 'pyautogui.press', 'magic.... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
#
# PlayonCloud recorder
#
# update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
# sudo apt-get install chromium-chromedriver
# sudo apt-get install libxml2-dev libxslt-dev python-dev
# which python3 (make sure that path is /usr/bin/python3)
#
# Fin... | [
"logging.getLogger",
"logging.debug",
"re.compile",
"time.sleep",
"datetime.datetime.today",
"datetime.timedelta",
"logging.info",
"logging.error",
"os.walk",
"os.path.exists",
"os.listdir",
"shutil.move",
"subprocess.run",
"os.mkdir",
"logging.critical",
"logging.Logger.manager.logger... | [((3139, 3178), 'logging.debug', 'logging.debug', (['"""Entering LogInToPlayon"""'], {}), "('Entering LogInToPlayon')\n", (3152, 3178), False, 'import logging, os, configparser\n'), ((3307, 3321), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (3317, 3321), False, 'import os, shutil, re, time\n'), ((3449, 3462),... |
import numpy as np
import torch
class ModuleMixin(object):
"""
Adds convenince functions to a torch module
"""
def number_of_parameters(self, trainable=True):
return number_of_parameters(self, trainable)
def number_of_parameters(model, trainable=True):
"""
Returns number of trainable... | [
"numpy.eye",
"torch.__version__.split",
"torch.eye",
"torch.set_grad_enabled",
"torch.is_grad_enabled"
] | [((5383, 5415), 'numpy.eye', 'np.eye', (['num_classes'], {'dtype': 'dtype'}), '(num_classes, dtype=dtype)\n', (5389, 5415), True, 'import numpy as np\n'), ((5535, 5592), 'torch.eye', 'torch.eye', (['num_classes'], {'device': 'labels.device', 'dtype': 'dtype'}), '(num_classes, device=labels.device, dtype=dtype)\n', (554... |
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 16 22:08:33 2018
@author: <NAME>
"""
import urllib.request
import json
inputType = 'textquery'
endpoint = 'https://maps.googleapis.com/maps/api/place/textsearch/json?'
search_key = input('What do you want to search for?: ').replace('','+')
api_key=input('Enter your API K... | [
"json.loads"
] | [((489, 509), 'json.loads', 'json.loads', (['response'], {}), '(response)\n', (499, 509), False, 'import json\n')] |
from Tokenizer import Tokenizer
from writer import MKDocsWriter
import json
import jsonutils
class Parser:
def run(code, file, path):
Parser.tokens = Tokenizer(code)
Parser.file = file
Parser.writer = MKDocsWriter()
Parser.path = path
ret = Parser.parseDocstring()
re... | [
"jsonutils.make_payload",
"writer.MKDocsWriter",
"json.dumps",
"Tokenizer.Tokenizer",
"json.load"
] | [((163, 178), 'Tokenizer.Tokenizer', 'Tokenizer', (['code'], {}), '(code)\n', (172, 178), False, 'from Tokenizer import Tokenizer\n'), ((230, 244), 'writer.MKDocsWriter', 'MKDocsWriter', ([], {}), '()\n', (242, 244), False, 'from writer import MKDocsWriter\n'), ((4183, 4230), 'jsonutils.make_payload', 'jsonutils.make_p... |
#!/usr/bin/env python3
'''
test all the class and function
'''
import unittest
from StudentList import StudentList, StudentList15
from Textprocessor import Textprocessor
from NetworkSolution import NetworkSolution
class TestStudentList(unittest.TestCase):
'''
Test all
'''
def test_student_list(self):... | [
"Textprocessor.Textprocessor",
"StudentList.StudentList15",
"NetworkSolution.NetworkSolution",
"StudentList.StudentList",
"unittest.main"
] | [((1640, 1655), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1653, 1655), False, 'import unittest\n'), ((372, 385), 'StudentList.StudentList', 'StudentList', ([], {}), '()\n', (383, 385), False, 'from StudentList import StudentList, StudentList15\n'), ((715, 730), 'StudentList.StudentList15', 'StudentList15', (... |
# ******************************************************
## Revision "$LastChangedDate: 2018-07-08 18:08:17 +0200 (zo, 08 jul 2018) $"
## Date "$LastChangedRevision: 1 $"
## Author "$LastChangedBy: arthurbeusen $"
## URL "$HeadURL: https://pbl.sliksvn.com/dgnm/core/make_y0.py $"
## Copyright 2019, PBL Netherlands Envir... | [
"general_func.get_amount"
] | [((566, 598), 'general_func.get_amount', 'general_func.get_amount', (['species'], {}), '(species)\n', (589, 598), False, 'import general_func\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 17:58:56 2020
@author: pmchozas
"""
import nltk
from nltk.stem.snowball import SnowballStemmer
f=open('legal_verbs.txt', 'r', encoding='utf-8')
file=open('estatuto_es.txt', 'r', encoding='utf-8')
read=file.readlines()
new=open('estatuto_es... | [
"nltk.stem.snowball.SnowballStemmer"
] | [((475, 510), 'nltk.stem.snowball.SnowballStemmer', 'SnowballStemmer', ([], {'language': '"""spanish"""'}), "(language='spanish')\n", (490, 510), False, 'from nltk.stem.snowball import SnowballStemmer\n')] |
from parlai.agents.programr.parser.template.nodes.base import TemplateNode
# from parlai.agents.programr.utils.logging.ylogger import YLogger
import parlai.utils.logging as logging
from parlai.agents.programr.utils.text.text import TextUtils
class TemplateListNode(TemplateNode):
def __init__(self):
super... | [
"parlai.agents.programr.utils.text.text.TextUtils.tag_from_text",
"parlai.utils.logging.error"
] | [((1482, 1516), 'parlai.agents.programr.utils.text.text.TextUtils.tag_from_text', 'TextUtils.tag_from_text', (['child.tag'], {}), '(child.tag)\n', (1505, 1516), False, 'from parlai.agents.programr.utils.text.text import TextUtils\n'), ((924, 967), 'parlai.utils.logging.error', 'logging.error', (['f"""Failed to resolve ... |
# After tensorflow 2, keras is being used in Backend
# comment shows an alternative way to run the command
#Documentation:- https://keras.io/api/datasets/cifar10/
# Version for your reference, Downgrade/ Ugrade/ Reinstall Accordingly
import keras
print(keras.__version__) #2.2.4 in my case
from keras.datasets ... | [
"keras.datasets.cifar10.load_data"
] | [((376, 395), 'keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (393, 395), False, 'from keras.datasets import cifar10\n')] |
"""AddreceiptOnRegistrationTable
Revision ID: 1468fd5ca2be
Revises: 3dd<PASSWORD>4<PASSWORD>
Create Date: 2022-02-24 22:33:14.628454
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '1468fd5ca2be'
down_revision = '3dd70974<PASSWORD>'
branch_labels = None
depends... | [
"alembic.op.f",
"alembic.op.drop_column",
"sqlalchemy.VARCHAR"
] | [((877, 934), 'alembic.op.drop_column', 'op.drop_column', (['"""user_registrations"""', '"""receipt_generated"""'], {}), "('user_registrations', 'receipt_generated')\n", (891, 934), False, 'from alembic import op\n'), ((545, 592), 'alembic.op.f', 'op.f', (['"""ix_user_registrations_receipt_generated"""'], {}), "('ix_us... |
# -*- coding: utf-8 -*-
"""Cp2kMultistageDdecWorkChain workchain"""
from aiida.plugins import CalculationFactory, DataFactory, WorkflowFactory
from aiida.common import AttributeDict
from aiida.engine import WorkChain, ToContext
from aiida_lsmo.utils import aiida_dict_merge
# import sub-workchains
Cp2kMultistageWorkCh... | [
"aiida_lsmo.utils.aiida_dict_merge",
"aiida.engine.ToContext",
"aiida.plugins.CalculationFactory",
"aiida.plugins.DataFactory",
"aiida.plugins.WorkflowFactory"
] | [((326, 365), 'aiida.plugins.WorkflowFactory', 'WorkflowFactory', (['"""lsmo.cp2k_multistage"""'], {}), "('lsmo.cp2k_multistage')\n", (341, 365), False, 'from aiida.plugins import CalculationFactory, DataFactory, WorkflowFactory\n'), ((418, 451), 'aiida.plugins.WorkflowFactory', 'WorkflowFactory', (['"""ddec.cp2k_ddec"... |
# This technical data was produced for the U. S. Government under Contract No. W15P7T-13-C-F600, and
# is subject to the Rights in Technical Data-Noncommercial Items clause at DFARS 252.227-7013 (FEB 2012)
from geoevents.core.models import Setting
import json
def app_settings(request):
"""Global values to pass t... | [
"geoevents.core.models.Setting.objects.all",
"json.dumps"
] | [((399, 420), 'geoevents.core.models.Setting.objects.all', 'Setting.objects.all', ([], {}), '()\n', (418, 420), False, 'from geoevents.core.models import Setting\n'), ((635, 655), 'json.dumps', 'json.dumps', (['settings'], {}), '(settings)\n', (645, 655), False, 'import json\n')] |
#!/usr/bin/env python
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests for pyvo.dal.datalink
"""
from functools import partial
from urllib.parse import parse_qsl
from pyvo.dal.adhoc import DatalinkResults
from pyvo.dal.params import find_param_by_keyword, get_converter
from pyvo.dal.exceptions... | [
"pytest.mark.filterwarnings",
"pyvo.dal.params.find_param_by_keyword",
"pyvo.dal.adhoc.DatalinkResults.from_result_url",
"astropy.utils.data.get_pkg_data_contents",
"numpy.array",
"functools.partial",
"pytest.mark.usefixtures",
"pytest.raises",
"pytest.fixture",
"urllib.parse.parse_qsl"
] | [((505, 575), 'functools.partial', 'partial', (['get_pkg_data_contents'], {'package': '__package__', 'encoding': '"""binary"""'}), "(get_pkg_data_contents, package=__package__, encoding='binary')\n", (512, 575), False, 'from functools import partial\n'), ((605, 674), 'functools.partial', 'partial', (['get_pkg_data_file... |
from __future__ import absolute_import
from __future__ import unicode_literals
import six
import yaml
from compose.config import types
def serialize_config_type(dumper, data):
representer = dumper.represent_str if six.PY3 else dumper.represent_unicode
return representer(data.repr())
yaml.SafeDumper.add_re... | [
"yaml.safe_dump",
"yaml.SafeDumper.add_representer"
] | [((298, 374), 'yaml.SafeDumper.add_representer', 'yaml.SafeDumper.add_representer', (['types.VolumeFromSpec', 'serialize_config_type'], {}), '(types.VolumeFromSpec, serialize_config_type)\n', (329, 374), False, 'import yaml\n'), ((375, 447), 'yaml.SafeDumper.add_representer', 'yaml.SafeDumper.add_representer', (['types... |
import os
import sys
import tempfile
import json
if '--key' not in sys.argv or len(sys.argv) < 3:
print('No key specified')
sys.exit(-1)
key_name = sys.argv[2] if sys.argv[1] == '--key' else sys.argv[4]
val = None
if '--val' in sys.argv:
val = sys.argv[2] if sys.argv[1] == '--val' else sys.argv[4]
wanna_s... | [
"os.path.exists",
"json.loads",
"argparse.ArgumentParser",
"json.dumps",
"tempfile.gettempdir",
"sys.exit",
"os.remove"
] | [((433, 461), 'os.path.exists', 'os.path.exists', (['storage_path'], {}), '(storage_path)\n', (447, 461), False, 'import os\n'), ((133, 145), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (141, 145), False, 'import sys\n'), ((376, 397), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (395, 397), Fal... |
#!/usr/bin/env python
import uproot
class DAQFile:
def __init__(self, infpn):
'''
Constructor in charge of loading a data file.
'''
tr_mppc = uproot.open(infpn)['mppc']
self.df = tr_mppc.arrays(library='pd')
# store the input file pathname
self.infpn = infp... | [
"uproot.open"
] | [((180, 198), 'uproot.open', 'uproot.open', (['infpn'], {}), '(infpn)\n', (191, 198), False, 'import uproot\n')] |
from pathlib import Path
from glob import glob
import pickle
from dataclasses import dataclass
import pandas as pd
import numpy as np
from tqdm import tqdm
from db_models import session, Item
@dataclass
class ItemData:
"""Data for Items."""
name: str = ""
item_id: int = 0
type: str = ""
# Detai... | [
"db_models.Item",
"pickle.dump",
"pathlib.Path",
"pathlib.Path.cwd",
"db_models.session.commit",
"tqdm.tqdm",
"pickle.load",
"db_models.session.bulk_save_objects",
"pandas.read_html",
"glob.glob"
] | [((2348, 2358), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (2356, 2358), False, 'from pathlib import Path\n'), ((2374, 2445), 'glob.glob', 'glob', (['f"""{BASE_DIR / \'data/cp.originsro.org/item/view/index.html?id=*\'}"""'], {}), '(f"{BASE_DIR / \'data/cp.originsro.org/item/view/index.html?id=*\'}")\n', (2378, 2... |
"""
Allows manipulation of custom jobs.
Jobs include creating predictions or preferences for a custom sequence.
"""
import uuid
import datetime
from pred.queries.dbutil import update_database, read_database
from pred.webserver.customresult import CustomResultData
class JobStatus(object):
"""
States a job can... | [
"pred.queries.dbutil.read_database",
"datetime.datetime.utcnow",
"pred.webserver.customresult.CustomResultData.delete_for_job",
"pred.queries.dbutil.update_database",
"uuid.uuid1"
] | [((1602, 1711), 'pred.queries.dbutil.update_database', 'update_database', (['db', 'insert_sql', '[self.uuid, self.type, self.model_name, self.sequence_list, self.status]'], {}), '(db, insert_sql, [self.uuid, self.type, self.model_name,\n self.sequence_list, self.status])\n', (1617, 1711), False, 'from pred.queries.d... |
import string
from rt import *
from listener import Listener
import traceback
import pytz
from datetime import datetime
class Ticket:
def __init__(self, client):
self.client = client
Listener.register(self.on_ready, "on_ready")
Listener.register(self.on_message, "on_message")
Liste... | [
"pytz.timezone",
"listener.Listener.register",
"traceback.print_exc"
] | [((205, 249), 'listener.Listener.register', 'Listener.register', (['self.on_ready', '"""on_ready"""'], {}), "(self.on_ready, 'on_ready')\n", (222, 249), False, 'from listener import Listener\n'), ((258, 306), 'listener.Listener.register', 'Listener.register', (['self.on_message', '"""on_message"""'], {}), "(self.on_mes... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 8 12:16:53 2021
@author: M.Tarka
"""
from machinetranslation import translator
from flask import Flask, render_template, request
#import json
app = Flask("Web Translator")
@app.route("/englishToFrench")
def english_to_french():
textToTranslate = r... | [
"flask.render_template",
"flask.request.args.get",
"flask.Flask",
"machinetranslation.translator.english_to_french",
"machinetranslation.translator.french_to_english"
] | [((212, 235), 'flask.Flask', 'Flask', (['"""Web Translator"""'], {}), "('Web Translator')\n", (217, 235), False, 'from flask import Flask, render_template, request\n'), ((319, 354), 'flask.request.args.get', 'request.args.get', (['"""textToTranslate"""'], {}), "('textToTranslate')\n", (335, 354), False, 'from flask imp... |
# -*- coding: utf-8 -*-
"""
SQLpie License (MIT License)
Copyright (c) 2011-2016 <NAME>, http://sqlpie.com
See LICENSE file.
"""
from flask import Response
import json
import sqlpie
class SearchController(sqlpie.BaseController):
@staticmethod
@sqlpie.BaseController.controller_wrapper
def service_index(... | [
"sqlpie.CustomException",
"sqlpie.Indexer.rebuild",
"sqlpie.Util.is_number",
"sqlpie.Searcher",
"sqlpie.Indexer"
] | [((3047, 3069), 'sqlpie.Searcher', 'sqlpie.Searcher', (['query'], {}), '(query)\n', (3062, 3069), False, 'import sqlpie\n'), ((629, 653), 'sqlpie.Indexer.rebuild', 'sqlpie.Indexer.rebuild', ([], {}), '()\n', (651, 653), False, 'import sqlpie\n'), ((662, 678), 'sqlpie.Indexer', 'sqlpie.Indexer', ([], {}), '()\n', (676, ... |
import numpy as np
__copyright__ = 'Copyright (C) 2018 ICTP'
__author__ = '<NAME> <<EMAIL>>'
__credits__ = ["<NAME>", "<NAME>"]
def get_x(lon, clon, cone):
if clon >= 0.0 and lon >= 0.0 or clon < 0.0 and lon < 0.0:
return np.radians(clon - lon) * cone
elif clon >= 0.0:
if abs(clon - lon + 3... | [
"numpy.radians",
"numpy.sqrt",
"numpy.isscalar",
"numpy.cos",
"numpy.sin",
"numpy.vectorize"
] | [((238, 260), 'numpy.radians', 'np.radians', (['(clon - lon)'], {}), '(clon - lon)\n', (248, 260), True, 'import numpy as np\n'), ((829, 844), 'numpy.radians', 'np.radians', (['lat'], {}), '(lat)\n', (839, 844), True, 'import numpy as np\n'), ((860, 875), 'numpy.radians', 'np.radians', (['lon'], {}), '(lon)\n', (870, 8... |
import os
import shutil
def move_files(files, src_prefix, dst_prefix, app_name):
for file_name, attributes in files.items():
file_path = os.path.join(src_prefix, file_name)
dest_path = os.path.join(dst_prefix, file_name)
if attributes["static"]:
shutil.copy(file_path, dest_path... | [
"os.path.join",
"os.getcwd",
"os.mkdir",
"shutil.copy",
"os.path.abspath"
] | [((648, 687), 'os.path.join', 'os.path.join', (['project_path', '"""templates"""'], {}), "(project_path, 'templates')\n", (660, 687), False, 'import os\n'), ((714, 750), 'os.path.join', 'os.path.join', (['project_path', '"""dupgee"""'], {}), "(project_path, 'dupgee')\n", (726, 750), False, 'import os\n'), ((756, 778), ... |
from setuptools import setup, find_packages
import os
setup_dir = os.path.dirname(__file__)
readme_path = os.path.join(setup_dir, 'README.rst')
version_path = os.path.join(setup_dir, 'keyfree/version.py')
requirements_path = os.path.join(setup_dir, "requirements.txt")
requirements_dev_path = os.path.join(setup_dir, "... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((68, 93), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (83, 93), False, 'import os\n'), ((108, 145), 'os.path.join', 'os.path.join', (['setup_dir', '"""README.rst"""'], {}), "(setup_dir, 'README.rst')\n", (120, 145), False, 'import os\n'), ((161, 206), 'os.path.join', 'os.path.join', (['s... |
import logging
import os
import shutil
import tempfile
from urllib import request as request
from urllib.error import HTTPError, URLError
from ase import Atoms
import numpy as np
from schnetpack.data import AtomsData
from schnetpack.environment import SimpleEnvironmentProvider
class MD17(AtomsData):
"""
MD1... | [
"os.path.exists",
"os.makedirs",
"urllib.request.urlretrieve",
"ase.Atoms",
"os.path.join",
"numpy.array",
"tempfile.mkdtemp",
"shutil.rmtree",
"numpy.load",
"logging.info",
"logging.error",
"schnetpack.environment.SimpleEnvironmentProvider"
] | [((2703, 2742), 'os.path.join', 'os.path.join', (['self.dbdir', 'self.database'], {}), '(self.dbdir, self.database)\n', (2715, 2742), False, 'import os\n'), ((2822, 2849), 'schnetpack.environment.SimpleEnvironmentProvider', 'SimpleEnvironmentProvider', ([], {}), '()\n', (2847, 2849), False, 'from schnetpack.environment... |
import sys
import os
sys.path.append( os.path.abspath("../") )
import myhdl
from myhdl import (Signal, intbv, instance, always_comb, delay, always,
StopSimulation, block)
from rhea.system import Global, Clock, Reset, FIFOBus, Signals
from rhea.cores.spi import SPIBus, spi_slave_fifo_async
from rhe... | [
"myhdl.always",
"rhea.cores.spi.SPIBus",
"myhdl.instances",
"myhdl.Signal",
"ser.ser",
"rhea.system.Global",
"pulsegen.pulsegen",
"myhdl.intbv",
"os.path.abspath",
"myhdl.delay",
"ClkDriver.ClkDriver",
"rhea.system.FIFOBus",
"rhea.cores.spi.spi_slave_fifo_async"
] | [((469, 482), 'myhdl.Signal', 'Signal', (['(False)'], {}), '(False)\n', (475, 482), False, 'from myhdl import Signal, intbv, instance, always_comb, delay, always, StopSimulation, block\n'), ((490, 503), 'myhdl.Signal', 'Signal', (['(False)'], {}), '(False)\n', (496, 503), False, 'from myhdl import Signal, intbv, instan... |
#Faça um programa que mostre na tela uma contagem regressiva para
# o estouro de fogos de artifício, indo de 10 até 0, com uma pausa
# de 1 segundo entre eles.
from time import sleep
for i in range(10, -1, -1):
print('{}'.format(i))
sleep(1)
print('Bum, BUM, POW')
| [
"time.sleep"
] | [((242, 250), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (247, 250), False, 'from time import sleep\n')] |
"""adding nodes / edges
Revision ID: eec5a7359447
Revises: <KEY>
Create Date: 2021-11-08 21:43:02.200062
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'eec5a7359447'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### com... | [
"alembic.op.drop_column",
"sqlalchemy.Integer"
] | [((586, 631), 'alembic.op.drop_column', 'op.drop_column', (['"""project_nodes"""', '"""keyword_id"""'], {}), "('project_nodes', 'keyword_id')\n", (600, 631), False, 'from alembic import op\n'), ((432, 444), 'sqlalchemy.Integer', 'sa.Integer', ([], {}), '()\n', (442, 444), True, 'import sqlalchemy as sa\n')] |
#!/usr/bin/env python3
from random import randint
class Caesar(object):
def shift(self, offset):
"""Shifts the alphabet using a random number.
Returns the value of the shift."""
self.alphabet = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', ... | [
"random.randint"
] | [((3178, 3192), 'random.randint', 'randint', (['(0)', '(26)'], {}), '(0, 26)\n', (3185, 3192), False, 'from random import randint\n')] |
from basketapp.models import TrainerBasket
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect, JsonResponse
from django.shortcuts import render
from django.urls import reverse
from mainapp.models import Trainer
@login_required
def index(request):
items = TrainerB... | [
"django.shortcuts.render",
"basketapp.models.TrainerBasket.objects.get_or_create",
"basketapp.models.TrainerBasket.objects.filter",
"basketapp.models.TrainerBasket.objects.get",
"django.http.JsonResponse",
"mainapp.models.Trainer.objects.get",
"django.urls.reverse"
] | [((312, 359), 'basketapp.models.TrainerBasket.objects.filter', 'TrainerBasket.objects.filter', ([], {'user': 'request.user'}), '(user=request.user)\n', (340, 359), False, 'from basketapp.models import TrainerBasket\n'), ((424, 473), 'django.shortcuts.render', 'render', (['request', '"""basketapp/basket.html"""', 'conte... |
import uuid
import requests
from flask import Flask, request
from flask import jsonify
import configFileControl
from cipherOperations import genrateKeys, decryptData, saveKeyinFile
# =============================================================================================================================
NODE_URL... | [
"requests.post",
"configFileControl.setUid",
"flask.Flask",
"requests.get",
"uuid.uuid4",
"cipherOperations.genrateKeys",
"configFileControl.getUid",
"flask.request.get_json",
"cipherOperations.saveKeyinFile",
"cipherOperations.decryptData",
"flask.jsonify"
] | [((807, 822), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (812, 822), False, 'from flask import Flask, request\n'), ((1060, 1090), 'flask.jsonify', 'jsonify', (["{'name': 'Home Test'}"], {}), "({'name': 'Home Test'})\n", (1067, 1090), False, 'from flask import jsonify\n'), ((1176, 1194), 'flask.request.... |
# Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
"collections.namedtuple"
] | [((934, 997), 'collections.namedtuple', 'collections.namedtuple', (['"""VersionedSequence"""', "['version', 'ids']"], {}), "('VersionedSequence', ['version', 'ids'])\n", (956, 997), False, 'import collections\n')] |
import os, shutil
import re
from django.conf import settings
from django.core.files.base import ContentFile
from filemanager import signals
from filemanager.settings import DIRECTORY, STORAGE
from filemanager.utils import sizeof_fmt
class Filemanager(object):
def __init__(self, path=None):
self.update_p... | [
"django.core.files.base.ContentFile",
"filemanager.settings.STORAGE.size",
"filemanager.settings.STORAGE.save",
"os.path.join",
"filemanager.settings.STORAGE.get_valid_name",
"os.path.dirname",
"filemanager.settings.STORAGE.get_modified_time",
"filemanager.settings.STORAGE.delete",
"filemanager.sign... | [((620, 667), 'os.path.join', 'os.path.join', (['settings.MEDIA_ROOT', 'self.abspath'], {}), '(settings.MEDIA_ROOT, self.abspath)\n', (632, 667), False, 'import os, shutil\n'), ((687, 733), 'os.path.join', 'os.path.join', (['settings.MEDIA_URL', 'self.abspath'], {}), '(settings.MEDIA_URL, self.abspath)\n', (699, 733), ... |
"""
Aggregator
====================================
*Aggregators* are used to combine multiple matrices to a single matrix.
This is used to combine similarity and dissimilarity matrices of multiple attributes to a single one.
Thus, an *Aggregator* :math:`\\mathcal{A}` is a mapping of the form
:math:`\\mathcal{A} : \\ma... | [
"numpy.mean",
"numpy.median",
"numpy.min",
"numpy.max"
] | [((3369, 3394), 'numpy.mean', 'np.mean', (['matrices'], {'axis': '(0)'}), '(matrices, axis=0)\n', (3376, 3394), True, 'import numpy as np\n'), ((4191, 4218), 'numpy.median', 'np.median', (['matrices'], {'axis': '(0)'}), '(matrices, axis=0)\n', (4200, 4218), True, 'import numpy as np\n'), ((4816, 4840), 'numpy.max', 'np... |
"""
byceps.blueprints.site.page.views
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:Copyright: 2014-2022 <NAME>
:License: Revised BSD (see `LICENSE` file for details)
"""
from flask import abort, g
from ....services.page import service as page_service
from ....util.framework.blueprint import create_blueprint
from .templating ... | [
"flask.abort"
] | [((784, 794), 'flask.abort', 'abort', (['(404)'], {}), '(404)\n', (789, 794), False, 'from flask import abort, g\n')] |
#!/usr/bin/env python
# coding: utf-8
"""script that generates source data csvs for searchstims experiment figures"""
from argparse import ArgumentParser
from collections import defaultdict
from pathlib import Path
import pandas as pd
import pyprojroot
import searchnets
def main(results_gz_root,
source_dat... | [
"pandas.DataFrame.from_records",
"argparse.ArgumentParser",
"pathlib.Path",
"searchnets.analysis.searchstims.results_gz_to_df",
"pyprojroot.here",
"collections.defaultdict",
"pandas.concat"
] | [((8669, 8686), 'pyprojroot.here', 'pyprojroot.here', ([], {}), '()\n', (8684, 8686), False, 'import pyprojroot\n'), ((2900, 2921), 'pathlib.Path', 'Path', (['results_gz_root'], {}), '(results_gz_root)\n', (2904, 2921), False, 'from pathlib import Path\n'), ((2946, 2968), 'pathlib.Path', 'Path', (['source_data_root'], ... |
""" suggest a sensible tolerance for a matrix and coverage-rate (default 0.6).
"""
from typing import Optional
import numpy as np
from tqdm import trange
from logzero import logger
from .coverage_rate import coverage_rate
# fmt: off
def suggest_tolerance(
mat: np.ndarray,
c_rate: float = 0.66,
... | [
"numpy.asarray",
"logzero.logger.warning",
"logzero.logger.info",
"tqdm.trange",
"logzero.logger.erorr"
] | [((480, 495), 'numpy.asarray', 'np.asarray', (['mat'], {}), '(mat)\n', (490, 495), True, 'import numpy as np\n'), ((804, 836), 'tqdm.trange', 'trange', (['(tolerance + 1)', '(limit + 1)'], {}), '(tolerance + 1, limit + 1)\n', (810, 836), False, 'from tqdm import trange\n'), ((999, 1074), 'logzero.logger.warning', 'logg... |
# Generated by Django 3.1.7 on 2021-03-20 12:50
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='NerSource',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.JSONField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((338, 431), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (354, 431), False, 'from django.db import migrations, models\... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
One off for preparing lesion segmentations for validation by a neuroradiologist
"""
import os
import shutil
import pandas as pd
master_folder = '/Users/manusdonahue/Documents/Sky/segmentations_sci/pt_data/'
to_folder = '/Users/manusdonahue/Documents/Sky/lesion_trai... | [
"shutil.copy",
"os.path.join",
"os.mkdir",
"pandas.read_csv"
] | [((472, 497), 'pandas.read_csv', 'pd.read_csv', (['training_csv'], {}), '(training_csv)\n', (483, 497), True, 'import pandas as pd\n'), ((776, 806), 'os.path.join', 'os.path.join', (['to_folder', 'pt_id'], {}), '(to_folder, pt_id)\n', (788, 806), False, 'import os\n'), ((811, 834), 'os.mkdir', 'os.mkdir', (['target_fol... |
import gym
from gym import spaces
import numpy as np
import os
import sys
from m_gym.envs.createsim import CreateSimulation
from m_gym.envs.meveahandle import MeveaHandle
from time import sleep
from math import exp
class ExcavatorDiggingSparseEnv(gym.Env):
def __init__(self):
super(ExcavatorDiggingSparseEnv, ... | [
"numpy.ones",
"m_gym.envs.meveahandle.MeveaHandle",
"m_gym.envs.createsim.CreateSimulation",
"time.sleep",
"gym.spaces.Box",
"numpy.zeros",
"os.path.abspath"
] | [((754, 783), 'm_gym.envs.createsim.CreateSimulation', 'CreateSimulation', (['self.config'], {}), '(self.config)\n', (770, 783), False, 'from m_gym.envs.createsim import CreateSimulation\n'), ((1156, 1196), 'numpy.zeros', 'np.zeros', (['self.obs_len'], {'dtype': 'np.float32'}), '(self.obs_len, dtype=np.float32)\n', (11... |
#!/usr/bin/env python
"""PyDEC: Software and Algorithms for Discrete Exterior Calculus
"""
DOCLINES = __doc__.split("\n")
import os
import sys
CLASSIFIERS = """\
Development Status :: 5 - Production/Stable
Intended Audience :: Science/Research
Intended Audience :: Developers
Intended Audience :: Education
License :... | [
"os.path.exists",
"sys.path.insert",
"os.path.join",
"numpy.distutils.misc_util.Configuration",
"os.getcwd",
"os.chdir",
"os.path.abspath",
"os.remove"
] | [((762, 788), 'os.path.exists', 'os.path.exists', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (776, 788), False, 'import os\n'), ((790, 811), 'os.remove', 'os.remove', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (799, 811), False, 'import os\n'), ((934, 979), 'numpy.distutils.misc_util.Configuration', 'Configuration', ... |
from src import fastarg
import subprocess
def test_foo():
assert 'foo'.upper() == 'FOO'
def test_fastarg_no_methods():
app = fastarg.Fastarg()
assert len(app.commands) == 0
def test_fastarg_one_method():
app = fastarg.Fastarg()
@app.command()
def foo():
print("foo")
assert len(... | [
"subprocess.run",
"src.fastarg.Fastarg"
] | [((135, 152), 'src.fastarg.Fastarg', 'fastarg.Fastarg', ([], {}), '()\n', (150, 152), False, 'from src import fastarg\n'), ((230, 247), 'src.fastarg.Fastarg', 'fastarg.Fastarg', ([], {}), '()\n', (245, 247), False, 'from src import fastarg\n'), ((379, 396), 'src.fastarg.Fastarg', 'fastarg.Fastarg', ([], {}), '()\n', (3... |
from random import seed, shuffle
import re
import os
from shutil import rmtree
import unicodedata
seed("lol")
def strip_accents(s):
return "".join(
c for c in unicodedata.normalize("NFD", s) if unicodedata.category(c) != "Mn"
)
words = []
with open("./zone.txt") as f:
for word in f.readlines():... | [
"random.shuffle",
"os.makedirs",
"re.match",
"random.seed",
"unicodedata.category",
"unicodedata.normalize",
"shutil.rmtree"
] | [((99, 110), 'random.seed', 'seed', (['"""lol"""'], {}), "('lol')\n", (103, 110), False, 'from random import seed, shuffle\n'), ((764, 778), 'random.shuffle', 'shuffle', (['words'], {}), '(words)\n', (771, 778), False, 'from random import seed, shuffle\n'), ((780, 816), 'shutil.rmtree', 'rmtree', (['"""./mots"""'], {'i... |
import argparse
from PIL import Image
import numpy as np
import onnxruntime as rt
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="StyleTransferONNX")
parser.add_argument('--model', type=str, default=' ', help='ONNX model file', required=True)
parser.add_argument('--input', type=str, d... | [
"numpy.clip",
"PIL.Image.fromarray",
"PIL.Image.open",
"argparse.ArgumentParser",
"numpy.asarray",
"onnxruntime.InferenceSession"
] | [((122, 178), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""StyleTransferONNX"""'}), "(description='StyleTransferONNX')\n", (145, 178), False, 'import argparse\n'), ((504, 535), 'onnxruntime.InferenceSession', 'rt.InferenceSession', (['args.model'], {}), '(args.model)\n', (523, 535), Tr... |
#!/usr/bin/env python
import subprocess
import sys
import os
from pbcommand.engine import run_cmd
def run(args):
output_dir = os.getcwd()
if len(args) == 1:
output_dir = args[0]
assert os.path.isdir(output_dir), "Not a directory: %s"%output_dir
module_dir = os.path.join(os.path.dirname(_... | [
"os.listdir",
"os.getcwd",
"os.path.dirname",
"os.path.isdir",
"pbcommand.engine.run_cmd"
] | [((134, 145), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (143, 145), False, 'import os\n'), ((375, 397), 'os.listdir', 'os.listdir', (['module_dir'], {}), '(module_dir)\n', (385, 397), False, 'import os\n'), ((1010, 1046), 'pbcommand.engine.run_cmd', 'run_cmd', (['cmd', 'sys.stdout', 'sys.stderr'], {}), '(cmd, sys.std... |
from N4Tools.Design import Text,Square,ThreadAnimation,Animation,AnimationTools
import requests as req
import socket,os,time,sys
from threading import Thread as u
A = Animation()
class MA:
def CustomAnimation(min=0,max=5639,**kwargs):
yield A.Prograsse(min=min,max=max,prograsse=['│','\033[1;36m█','\033... | [
"os.get_terminal_size",
"socket.getservbyport",
"socket.socket",
"N4Tools.Design.Animation",
"N4Tools.Design.Text",
"requests.get",
"N4Tools.Design.Square",
"threading.Thread",
"N4Tools.Design.ThreadAnimation"
] | [((167, 178), 'N4Tools.Design.Animation', 'Animation', ([], {}), '()\n', (176, 178), False, 'from N4Tools.Design import Text, Square, ThreadAnimation, Animation, AnimationTools\n'), ((2071, 2116), 'N4Tools.Design.ThreadAnimation', 'ThreadAnimation', ([], {'Animation': 'MA.CustomAnimation'}), '(Animation=MA.CustomAnimat... |
import os
import datetime
import gym
import numpy as np
import matplotlib.pyplot as plt
from es import CMAES
import pandas as pd
import string
def sigmoid(x):
return 1 / (1 + np.exp(-x))
class Agent:
def __init__(self, x, y, layer1_nodes, layer2_nodes):
self.input = np.zeros(x, dtype=np.float128)
... | [
"os.path.exists",
"numpy.reshape",
"es.CMAES",
"numpy.asarray",
"numpy.exp",
"datetime.datetime.today",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.dot",
"matplotlib.pyplot.subplots",
"os.mkdir",
"pandas.DataFrame",
"matplotlib.pyplot.subplot",
"gym.make",
"matplotlib.pyplot.legend... | [((6770, 6784), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (6782, 6784), True, 'import matplotlib.pyplot as plt\n'), ((7360, 7370), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (7368, 7370), True, 'import matplotlib.pyplot as plt\n'), ((286, 316), 'numpy.zeros', 'np.zeros', (['x'], {'dty... |
"""Tests for the Synology DSM config flow."""
import logging
from unittest.mock import MagicMock, Mock, patch
import pytest
from homeassistant import data_entry_flow
from homeassistant.components.synology_dsm.const import (
CONF_VOLUMES,
DEFAULT_NAME,
DEFAULT_PORT,
DEFAULT_PORT_SSL,
DEFAULT_SSL,
... | [
"logging.getLogger",
"unittest.mock.Mock",
"tests.common.MockConfigEntry",
"pytest.fixture",
"unittest.mock.patch"
] | [((662, 689), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (679, 689), False, 'import logging\n'), ((889, 919), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""service"""'}), "(name='service')\n", (903, 919), False, 'import pytest\n'), ((1412, 1455), 'pytest.fixture', 'pytest.fixt... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from ..losses import build_loss
class ConvBNAct(nn.Sequential):
def __init__(self, in_channels: int, out_channels: int):
super().__init__(
nn.Conv2d(in_channels, out_channels, kernel_size=3, padding=1, bias=... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.init.constant_",
"numpy.log",
"torch.nn.init.kaiming_normal_",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.ConvTranspose2d",
"torch.nn.functional.softmax",
"torch.cat"
] | [((1339, 1357), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)', '(2)'], {}), '(2, 2)\n', (1351, 1357), True, 'import torch.nn as nn\n'), ((1385, 1417), 'torch.nn.ConvTranspose2d', 'nn.ConvTranspose2d', (['c5', 'c4', '(2)', '(2)'], {}), '(c5, c4, 2, 2)\n', (1403, 1417), True, 'import torch.nn as nn\n'), ((1445, 1477), 't... |
# -*- coding: utf-8 -*-
import vcr
from django.test import TestCase
from rest_framework import status # noqa: F401
from rest_framework.test import APITestCase
moonshot_vcr = vcr.VCR(
serializer="json",
cassette_library_dir="./fixtures",
record_mode="once",
match_on=["uri", "method"],
filter_heade... | [
"vcr.VCR"
] | [((177, 359), 'vcr.VCR', 'vcr.VCR', ([], {'serializer': '"""json"""', 'cassette_library_dir': '"""./fixtures"""', 'record_mode': '"""once"""', 'match_on': "['uri', 'method']", 'filter_headers': "['authorization', 'x-stripe-client-user-agent']"}), "(serializer='json', cassette_library_dir='./fixtures', record_mode=\n ... |
import numpy as np
import pandas as pd
import unittest
from bdranalytics.sklearn.model_selection import GrowingWindow, IntervalGrowingWindow
def create_time_series_data_set(start_date=pd.datetime(year=2000, month=1, day=1), n_rows=100):
end_date = start_date + pd.Timedelta(days=n_rows-1)
ds = np.random.ran... | [
"numpy.random.rand",
"numpy.arange",
"pandas.Timedelta",
"bdranalytics.sklearn.model_selection.GrowingWindow",
"numpy.random.randint",
"pandas.datetime",
"pandas.date_range"
] | [((187, 225), 'pandas.datetime', 'pd.datetime', ([], {'year': '(2000)', 'month': '(1)', 'day': '(1)'}), '(year=2000, month=1, day=1)\n', (198, 225), True, 'import pandas as pd\n'), ((307, 329), 'numpy.random.rand', 'np.random.rand', (['n_rows'], {}), '(n_rows)\n', (321, 329), True, 'import numpy as np\n'), ((472, 508),... |
import base64
class Pdf:
def __init__(self, fname=None, data=None, width='100%',
height='300px', border=False, log=None):
self.fname = fname
self.data = data
self.width = width
self.height = height
self.border = border
self.log = log
def save(s... | [
"base64.b64encode"
] | [((1147, 1174), 'base64.b64encode', 'base64.b64encode', (['self.data'], {}), '(self.data)\n', (1163, 1174), False, 'import base64\n')] |
import os, sys
sys.path.insert(0, './../Error/')
from .Pattern.Controllers.alternate_page import (KeyError, NotFoundButtonAlternPg )
def ErrorIncorrectParseKey():
raise KeyError("Not indentificaed key persed")
def ErrorButtonAlternate():
raise NotFoundButtonAlternPg("Not Found Button to Alternage Page") | [
"sys.path.insert"
] | [((16, 49), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./../Error/"""'], {}), "(0, './../Error/')\n", (31, 49), False, 'import os, sys\n')] |
"""
POST binaries to alternate storage, create a canonical uri tiddler
pointing to that storage.
"""
from httpexceptor import HTTP400
from uuid import uuid4
from mimetypes import guess_extension
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from tiddlyweb.model.bag import Bag
from tiddlyweb.... | [
"httpexceptor.HTTP400",
"tiddlyweb.util.pseudo_binary",
"boto.s3.connection.S3Connection",
"uuid.uuid4",
"boto.s3.key.Key",
"tiddlyweb.model.tiddler.Tiddler",
"tiddlyweb.web.util.tiddler_url",
"tiddlyweb.web.util.get_route_value",
"tiddlyweb.model.bag.Bag",
"mimetypes.guess_extension",
"tiddlywe... | [((502, 524), 'tiddlywebplugins.utils.require_role', 'require_role', (['"""MEMBER"""'], {}), "('MEMBER')\n", (514, 524), False, 'from tiddlywebplugins.utils import require_role\n'), ((730, 766), 'tiddlyweb.web.util.get_route_value', 'get_route_value', (['environ', '"""bag_name"""'], {}), "(environ, 'bag_name')\n", (745... |
'''ORIGINAL file:https://github.com/neubig/util-scripts/blob/master/syntactic-complexity.py
'''
#!/usr/bin/env python
'''
A program to calculate syntactic complexity of parse trees. (Relies on NLTK)
This is an implementation of some of the methods in:
Syntactic complexity measures for detecting Mild Cognitive Impairm... | [
"nltk.tree.Tree.fromstring",
"sys.exit"
] | [((846, 856), 'sys.exit', 'sys.exit', ([], {}), '()\n', (854, 856), False, 'import sys\n'), ((2196, 2217), 'nltk.tree.Tree.fromstring', 'Tree.fromstring', (['line'], {}), '(line)\n', (2211, 2217), False, 'from nltk.tree import Tree\n')] |
"""Implement 3D image thresholding."""
from typing import List, Optional
import numpy.typing as npt
import numpy as np
from ..image_utils import get_xy_block_coords, get_xy_block
from ..gpu import get_image_method
def get_threshold_otsu(image: npt.ArrayLike, blur_sigma=5):
"""Perform Otsu's thresholding with ... | [
"numpy.count_nonzero"
] | [((1495, 1524), 'numpy.count_nonzero', 'np.count_nonzero', (['binary_tile'], {}), '(binary_tile)\n', (1511, 1524), True, 'import numpy as np\n'), ((1270, 1300), 'numpy.count_nonzero', 'np.count_nonzero', (['binary_image'], {}), '(binary_image)\n', (1286, 1300), True, 'import numpy as np\n')] |
import vlc
import time
import io
import os
from tkinter import *
from tinytag import TinyTag, TinyTagException
from PIL import Image, ImageTk
class check:
i = 0
mname = ''
song = 1
goto = 0
def main(self):
# change to \ for windows
temp_track = TinyTag.... | [
"os.system",
"PIL.Image.open"
] | [((1020, 1067), 'PIL.Image.open', 'Image.open', (['"""/home/lowkey/temp/medusa/temp.jpg"""'], {}), "('/home/lowkey/temp/medusa/temp.jpg')\n", (1030, 1067), False, 'from PIL import Image, ImageTk\n'), ((1209, 1256), 'PIL.Image.open', 'Image.open', (['"""/home/lowkey/temp/medusa/temp.jpg"""'], {}), "('/home/lowkey/temp/m... |
import cv2
import logging
import numpy as np
import nibabel as nib
from skimage.measure import label
from skimage.morphology import binary_closing, cube
from fetal_brain_mask.model import Unet
logger = logging.getLogger(__name__)
class MaskingTool:
def __init__(self):
self.model = Unet()
def mask_t... | [
"logging.getLogger",
"skimage.morphology.cube",
"numpy.squeeze",
"numpy.max",
"numpy.array",
"numpy.zeros",
"fetal_brain_mask.model.Unet",
"numpy.moveaxis",
"cv2.resize",
"numpy.bincount",
"skimage.measure.label"
] | [((204, 231), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (221, 231), False, 'import logging\n'), ((298, 304), 'fetal_brain_mask.model.Unet', 'Unet', ([], {}), '()\n', (302, 304), False, 'from fetal_brain_mask.model import Unet\n'), ((436, 460), 'numpy.moveaxis', 'np.moveaxis', (['data... |
#pip install datetime
import time
import platform
import getpass
machine=str(platform.node())
architecture=str(platform.architecture())
opsys=str(platform.system())
os_vers=str(platform.release())
proces=str(platform.processor())
py_vers=str(platform.python_version())
a='\n'
a1='Machine: '
a2='Architecture:... | [
"platform.node",
"time.strftime",
"getpass.getpass",
"platform.release",
"platform.architecture",
"platform.system",
"platform.processor",
"getpass.getuser",
"platform.python_version"
] | [((81, 96), 'platform.node', 'platform.node', ([], {}), '()\n', (94, 96), False, 'import platform\n'), ((116, 139), 'platform.architecture', 'platform.architecture', ([], {}), '()\n', (137, 139), False, 'import platform\n'), ((152, 169), 'platform.system', 'platform.system', ([], {}), '()\n', (167, 169), False, 'import... |
# -*- coding: utf8 -*-
import click
from fledgling.app.use_case.delete_task import DeleteTaskUseCase, IParams
from fledgling.cli.config import IniFileConfig
from fledgling.cli.repository_factory import RepositoryFactory
class Params(IParams):
def __init__(self, *, task_id):
self.task_id = task_id
de... | [
"click.option",
"click.command",
"fledgling.cli.config.IniFileConfig",
"fledgling.cli.repository_factory.RepositoryFactory"
] | [((379, 394), 'click.command', 'click.command', ([], {}), '()\n', (392, 394), False, 'import click\n'), ((396, 452), 'click.option', 'click.option', (['"""--task-id"""'], {'required': '(True)', 'type': 'click.INT'}), "('--task-id', required=True, type=click.INT)\n", (408, 452), False, 'import click\n'), ((564, 579), 'f... |
#!/usr/bin/env python3
import os
import time
import pytest
import radical.utils as ru
yaml = pytest.importorskip('yaml')
flux = pytest.importorskip('flux')
events = dict()
spec = {
"tasks": [{
"slot": "task",
"count": {
"per_slot": 1
... | [
"radical.utils.FluxHelper",
"pytest.importorskip",
"time.sleep"
] | [((99, 126), 'pytest.importorskip', 'pytest.importorskip', (['"""yaml"""'], {}), "('yaml')\n", (118, 126), False, 'import pytest\n'), ((136, 163), 'pytest.importorskip', 'pytest.importorskip', (['"""flux"""'], {}), "('flux')\n", (155, 163), False, 'import pytest\n'), ((1263, 1278), 'radical.utils.FluxHelper', 'ru.FluxH... |
#!/usr/bin/env python
# coding: utf-8
# # Data EDA
# Author - <NAME>
# Written - December 2017
# This script take cleansed data from a csv file and writes figures to a results folder
# Parameters required -
# 1. Cleansed csv file
# 2. Codebook csv file
# 3. Destination folder for figures
import pandas as pd
import n... | [
"os.path.exists",
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"os.makedirs",
"matplotlib.pyplot.xlabel",
"os.environ.get",
"seaborn.set_style",
"seaborn.barplot"
] | [((573, 594), 'seaborn.set_style', 'sns.set_style', (['"""dark"""'], {}), "('dark')\n", (586, 594), True, 'import seaborn as sns\n'), ((380, 409), 'os.environ.get', 'os.environ.get', (['"""DISPLAY"""', '""""""'], {}), "('DISPLAY', '')\n", (394, 409), False, 'import os\n'), ((483, 497), 'matplotlib.use', 'mpl.use', (['"... |
# ##### BEGIN GPL LICENSE BLOCK #####
# KeenTools for blender is a blender addon for using KeenTools in Blender.
# Copyright (C) 2019 KeenTools
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, ... | [
"logging.getLogger",
"numpy.ones",
"bpy.data.images.new",
"bpy.data.images.find",
"bpy.data.images.load",
"bpy.data.images.remove"
] | [((918, 950), 'bpy.data.images.find', 'bpy.data.images.find', (['image_name'], {}), '(image_name)\n', (938, 950), False, 'import bpy\n'), ((2513, 2540), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2530, 2540), False, 'import logging\n'), ((3189, 3301), 'bpy.data.images.new', 'bpy.data... |
from img_parser import parse
import cv2
import numpy as np
import pandas as pd
import os
protoFile = "models/pose_deploy_linevec.prototxt"
weightsFile = "models/pose_iter_440000.caffemodel"
# Read the network into memory
net = cv2.dnn.readNetFromCaffe(protoFile, weightsFile)
nPoints = 18
# TrainImgNum = len(os.listdi... | [
"pandas.DataFrame",
"img_parser.parse",
"os.listdir",
"cv2.dnn.readNetFromCaffe"
] | [((228, 276), 'cv2.dnn.readNetFromCaffe', 'cv2.dnn.readNetFromCaffe', (['protoFile', 'weightsFile'], {}), '(protoFile, weightsFile)\n', (252, 276), False, 'import cv2\n'), ((1848, 2127), 'pandas.DataFrame', 'pd.DataFrame', (['TestRawList'], {'columns': "['0x', '0y', '1x', '1y', '2x', '2y', '3x', '3y', '4x', '4y', '5x',... |
""" This file contains quantum code in support of Shor's Algorithm
"""
""" Imports from qiskit"""
from qiskit import QuantumCircuit, ClassicalRegister, QuantumRegister
import sys
import math
import numpy as np
""" ********* QFT Functions *** """
""" Function to create QFT """
def create_QFT(circuit,up_reg,n,with_sw... | [
"math.pow",
"numpy.zeros"
] | [((3006, 3019), 'numpy.zeros', 'np.zeros', (['[N]'], {}), '([N])\n', (3014, 3019), True, 'import numpy as np\n'), ((2791, 2812), 'math.pow', 'math.pow', (['(2)', '(-(N - i))'], {}), '(2, -(N - i))\n', (2799, 2812), False, 'import math\n'), ((3132, 3153), 'math.pow', 'math.pow', (['(2)', '(-(j - i))'], {}), '(2, -(j - i... |
import sys
sys.path.append('.')
from sslplay.data.digits import DataDigits
import matplotlib.pyplot as plt
from sklearn.decomposition import PCA
from sklearn.preprocessing import StandardScaler
import numpy as np
obj_data = DataDigits()
obj_data.load()
X = obj_data.X
y = obj_data.y
target_names = np.array(["0", "1"... | [
"matplotlib.pyplot.ylabel",
"sklearn.decomposition.PCA",
"matplotlib.pyplot.xlabel",
"sslplay.data.digits.DataDigits",
"numpy.array",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"matplotlib.pyplot.scatter",
"sys.path.append",
"matplotlib.pyplot.suptit... | [((11, 31), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (26, 31), False, 'import sys\n'), ((227, 239), 'sslplay.data.digits.DataDigits', 'DataDigits', ([], {}), '()\n', (237, 239), False, 'from sslplay.data.digits import DataDigits\n'), ((302, 362), 'numpy.array', 'np.array', (["['0', '1', '2', ... |
# -*- coding: utf-8 -*-
import logging
import click
@click.command(short_help='Fits and saves feature extractors.')
@click.argument('dataset_path', type=click.Path(exists=True))
@click.argument('feature_extractor_path', type=click.Path())
def build_features(dataset_path, feature_extractor_path):
"""Fits and save... | [
"logging.getLogger",
"click.command",
"click.Path"
] | [((56, 118), 'click.command', 'click.command', ([], {'short_help': '"""Fits and saves feature extractors."""'}), "(short_help='Fits and saves feature extractors.')\n", (69, 118), False, 'import click\n'), ((498, 525), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (515, 525), False, 'impo... |
from collider.data.sensor import Sensor
from collider.data.message_package import MessagePackage
from scipy.stats import spearmanr
import numpy as np
class FakeForwardReturn(Sensor):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.lastvalue = None
@property
def output_varia... | [
"numpy.random.normal",
"numpy.array",
"scipy.stats.spearmanr"
] | [((660, 700), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'sigma', 'size': '(4000)'}), '(scale=sigma, size=4000)\n', (676, 700), True, 'import numpy as np\n'), ((1036, 1067), 'numpy.array', 'np.array', (["['fakeForwardReturn']"], {}), "(['fakeForwardReturn'])\n", (1044, 1067), True, 'import numpy as np\n'... |
#!/usr/bin/env python
import aptx
import argparse
import textwrap
import os.path
parser = argparse.ArgumentParser(
description='Print schema version of .aptx files.',
epilog='example: aptx_schemaver.py *.aptx')
parser.add_argument('aptxfiles', nargs='+', help='aptx file specification')
args = parser.parse_arg... | [
"aptx.Proposal",
"argparse.ArgumentParser",
"textwrap.wrap"
] | [((92, 215), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print schema version of .aptx files."""', 'epilog': '"""example: aptx_schemaver.py *.aptx"""'}), "(description='Print schema version of .aptx files.',\n epilog='example: aptx_schemaver.py *.aptx')\n", (115, 215), False, 'impo... |