code
stringlengths
22
1.05M
apis
listlengths
1
3.31k
extract_api
stringlengths
75
3.25M
import torch from torch import nn # LabelSmoothingLoss from: https://github.com/dreamgonfly/transformer-pytorch/blob/master/losses.py # License: https://github.com/dreamgonfly/transformer-pytorch/blob/master/LICENSE class LabelSmoothingLoss(nn.Module): def __init__(self, classes, smoothing=0.0): super(Labe...
[ "torch.no_grad", "torch.zeros_like", "torch.sum" ]
[((586, 601), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (599, 601), False, 'import torch\n'), ((627, 649), 'torch.zeros_like', 'torch.zeros_like', (['pred'], {}), '(pred)\n', (643, 649), False, 'import torch\n'), ((814, 850), 'torch.sum', 'torch.sum', (['(-true_dist * pred)'], {'dim': '(-1)'}), '(-true_dist *...
# Copyright (C) 2017 <NAME> and <NAME> # # This file is part of WESTPA. # # WESTPA is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ...
[ "logging.getLogger" ]
[((762, 789), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (779, 789), False, 'import logging\n')]
import unittest import numpy as np import prml.nn as nn class TestGaussian(unittest.TestCase): def test_gaussian_draw_forward(self): mu = nn.array(0) sigma = nn.softplus(nn.array(-1)) gaussian = nn.Gaussian(mu, sigma) sample = [] for _ in range(1000): sample.ap...
[ "numpy.mean", "numpy.allclose", "prml.nn.softplus", "prml.nn.optimizer.Gradient", "prml.nn.loss.kl_divergence", "numpy.std", "unittest.main", "prml.nn.Gaussian", "prml.nn.array" ]
[((1156, 1171), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1169, 1171), False, 'import unittest\n'), ((153, 164), 'prml.nn.array', 'nn.array', (['(0)'], {}), '(0)\n', (161, 164), True, 'import prml.nn as nn\n'), ((226, 248), 'prml.nn.Gaussian', 'nn.Gaussian', (['mu', 'sigma'], {}), '(mu, sigma)\n', (237, 248)...
# Generated by Django 2.1.3 on 2018-11-24 13:52 from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('monsterapi', '0022_auto_20181123_2339'), ] operations = [ migrations.CreateMod...
[ "django.db.models.DateTimeField", "django.db.models.ForeignKey", "django.db.models.AutoField", "django.db.models.BooleanField" ]
[((394, 487), '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", (410, 487), False, 'from django.db import migrations, models\...
import sys import argparse import matplotlib.pyplot as plt import numpy as np import pickle def load_obj(name): pkl_path = "" with open(pkl_path + name + ".pkl", 'rb') as f: return pickle.load(f) def load_prun_obj(name): pkl_path = "" with open(pkl_path + name + ".pkl", 'rb') as f: r...
[ "numpy.mean", "argparse.ArgumentParser", "matplotlib.pyplot.ylabel", "numpy.arange", "matplotlib.pyplot.xticks", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.plot", "pickle.load", "matplotlib.pyplot.gca", "matplotlib.pyplot.bar", "matplotlib.pyplot.yticks", "matplotlib.pyplot.subplot", "ma...
[((441, 471), 'matplotlib.pyplot.plot', 'plt.plot', (['results'], {'label': 'label'}), '(results, label=label)\n', (449, 471), True, 'import matplotlib.pyplot as plt\n'), ((1087, 1141), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run figure plot"""'}), "(description='Run figure plot')...
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # # The MIT License (MIT) # # Copyright (c) 2020 # <NAME> (<EMAIL>), # <NAME> (<EMAIL>) and # <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 i...
[ "matplotlib.pyplot.plot", "matplotlib.pyplot.legend", "matplotlib.pyplot.show" ]
[((2294, 2362), 'matplotlib.pyplot.plot', 'plt.plot', (['depot_x', 'depot_y'], {'marker': '"""s"""', 'color': '"""black"""', 'markersize': '(10)'}), "(depot_x, depot_y, marker='s', color='black', markersize=10)\n", (2302, 2362), True, 'from matplotlib import pyplot as plt\n'), ((2366, 2378), 'matplotlib.pyplot.legend',...
#!/usr/bin/env python3 """ This Python script is designed to perform unit testing of Wordhoard's Homophones module. """ __author__ = '<NAME>' __date__ = 'September 20, 2020' __status__ = 'Quality Assurance' __license__ = 'MIT' __copyright__ = "Copyright (C) 2021 <NAME>" import unittest from wordhoard import Homophon...
[ "unittest.main", "wordhoard.Homophones" ]
[((904, 919), 'unittest.main', 'unittest.main', ([], {}), '()\n', (917, 919), False, 'import unittest\n'), ((622, 641), 'wordhoard.Homophones', 'Homophones', (['"""horse"""'], {}), "('horse')\n", (632, 641), False, 'from wordhoard import Homophones\n'), ((863, 882), 'wordhoard.Homophones', 'Homophones', (['"""horse"""'...
from __future__ import annotations from typing import Literal, TypedDict, Union, final from typing_extensions import NotRequired from .asset import AssetData class YoutubeLinkEmbedMetadata(TypedDict): type: Literal["YouTube"] id: str timestamp: NotRequired[str] class TwitchLinkEmbedMetadata(TypedDict...
[ "typing.TypedDict" ]
[((557, 630), 'typing.TypedDict', 'TypedDict', (['"""SoundcloudLinkEmbedMetadata"""', "{'type': Literal['Soundcloud']}"], {}), "('SoundcloudLinkEmbedMetadata', {'type': Literal['Soundcloud']})\n", (566, 630), False, 'from typing import Literal, TypedDict, Union, final\n'), ((2069, 2118), 'typing.TypedDict', 'TypedDict'...
# from collections import deque import numpy as np import random import torch import pickle as pickle from torch.autograd import Variable class rpm(object): # replay memory def __init__(self, buffer_size): self.buffer_size = buffer_size self.buffer = [] self.priorities = [] ...
[ "torch.sum", "torch.Tensor" ]
[((1288, 1322), 'torch.sum', 'torch.sum', (['scaled_priorities_torch'], {}), '(scaled_priorities_torch)\n', (1297, 1322), False, 'import torch\n'), ((1225, 1254), 'torch.Tensor', 'torch.Tensor', (['self.priorities'], {}), '(self.priorities)\n', (1237, 1254), False, 'import torch\n')]
from app import handler from app import line_bot_api, handler from linebot.models import ( MessageEvent, TextMessage, TextSendMessage, ImageSendMessage ) import random import re import urllib def google_isch(q_string): q_string= {'tbm': 'isch' , 'q' : q_string} url = f"http://www.google.com/search?{urllib...
[ "linebot.models.ImageSendMessage", "urllib.request.Request", "app.handler.add", "urllib.parse.urlencode", "linebot.models.TextSendMessage", "urllib.request.urlopen" ]
[((836, 882), 'app.handler.add', 'handler.add', (['MessageEvent'], {'message': 'TextMessage'}), '(MessageEvent, message=TextMessage)\n', (847, 882), False, 'from app import line_bot_api, handler\n'), ((519, 563), 'urllib.request.Request', 'urllib.request.Request', (['url'], {'headers': 'headers'}), '(url, headers=heade...
# -*- coding: utf-8 -*- from flask import flash, make_response, request import json from flask_babel import lazy_gettext, gettext from datetime import datetime from flask_login import current_user from flask_appbuilder.actions import action from flask_appbuilder import expose from flask import redirect from plugins.com...
[ "logging.getLogger", "flask.current_app.appbuilder.get_session", "json.loads", "plugins.models.tightening_controller.TighteningController.add_controller", "os.getenv", "pandas.read_csv", "flask_wtf.csrf.CSRFProtect", "plugins.common.AirflowModelView.CustomSQLAInterface", "flask_appbuilder.fieldwidge...
[((991, 1040), 'os.getenv', 'os.getenv', (['"""FACTORY_CODE"""', '"""DEFAULT_FACTORY_CODE"""'], {}), "('FACTORY_CODE', 'DEFAULT_FACTORY_CODE')\n", (1000, 1040), False, 'import os\n'), ((1052, 1079), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1069, 1079), False, 'import logging\n'), (...
import requests import json from pprint import pprint from pymongo import MongoClient def get_vparis(): url = "https://opendata.paris.fr/api/records/1.0/search/?dataset=velib-disponibilite-en-temps-reel&q=&rows" \ "=251&facet=name&facet=is_installed&facet=is_renting&facet=is_returning&facet=nom_arrondis...
[ "pymongo.MongoClient", "requests.request" ]
[((940, 1025), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb+srv://main:1963<EMAIL>/vlille?retryWrites=true&w=majority"""'], {}), "('mongodb+srv://main:1963<EMAIL>/vlille?retryWrites=true&w=majority'\n )\n", (951, 1025), False, 'from pymongo import MongoClient\n'), ((353, 381), 'requests.request', 'requests.re...
#from twython import Twython from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream import json CONSUMER_KEY = 'pxeqo0ylpUayIIl5Nlc2kBmkb' CONSUMER_SECRET = '<KEY>' ACCESS_TOKEN = '<KEY>' ACCESS_SECRET = '<KEY>' oauth = OAuth(ACCESS_TOKEN, ACCESS_SECRET, CONSUMER_KEY, CONSUMER_SECRET) # Initiate the co...
[ "twitter.OAuth", "twitter.Twitter" ]
[((236, 301), 'twitter.OAuth', 'OAuth', (['ACCESS_TOKEN', 'ACCESS_SECRET', 'CONSUMER_KEY', 'CONSUMER_SECRET'], {}), '(ACCESS_TOKEN, ACCESS_SECRET, CONSUMER_KEY, CONSUMER_SECRET)\n', (241, 301), False, 'from twitter import Twitter, OAuth, TwitterHTTPError, TwitterStream\n'), ((359, 378), 'twitter.Twitter', 'Twitter', ([...
# -*- coding: utf-8 -*- from app.data.DataManager import DataManager from app.model.Simulator import Simulator from app.data.Client import Driver from app.tools.Logger import logger_sensitivity as logger from app.model.ScenarioGenerator import ScenarioGeneratorFactory as SGF from app.config.env import ScenarioGenerat...
[ "app.tools.Logger.logger_sensitivity.info", "app.model.ScenarioGenerator.ScenarioGeneratorFactory.create_scenario_generator", "app.data.Client.Driver", "app.data.DataManager.DataManager" ]
[((485, 498), 'app.data.DataManager.DataManager', 'DataManager', ([], {}), '()\n', (496, 498), False, 'from app.data.DataManager import DataManager\n'), ((1003, 1102), 'app.model.ScenarioGenerator.ScenarioGeneratorFactory.create_scenario_generator', 'SGF.create_scenario_generator', (['ScenarioGeneratorType.SPECIFIC_SCE...
from unittest import TestCase from click.testing import CliRunner, Result from poeditor_sync.cmd import poeditor class CmdReadOnlyTokenTest(TestCase): def setUp(self) -> None: super().setUp() self.runner = CliRunner(env={ 'POEDITOR_CONFIG_FILE': 'tests/test.yml', 'POEDITO...
[ "click.testing.CliRunner" ]
[((230, 345), 'click.testing.CliRunner', 'CliRunner', ([], {'env': "{'POEDITOR_CONFIG_FILE': 'tests/test.yml', 'POEDITOR_TOKEN':\n 'e1fc095d70eba2395fec56c6ad9e61c3'}"}), "(env={'POEDITOR_CONFIG_FILE': 'tests/test.yml', 'POEDITOR_TOKEN':\n 'e1fc095d70eba2395fec56c6ad9e61c3'})\n", (239, 345), False, 'from click.te...
import numpy as np import cv2 import proper from cats.cats_simus import * def vortex(wfo, CAL, charge, f_lens, path, Debug_print): n = int(proper.prop_get_gridsize(wfo)) ofst = 0 # no offset ramp_sign = 1 #sign of charge is positive #sampling = n ramp_oversamp = 11. # vortex is oversampled for a ...
[ "proper.prop_circular_obscuration", "numpy.ones", "proper.prop_lens", "proper.prop_get_gridsize", "proper.prop_multiply", "proper.prop_shift_center", "numpy.exp", "numpy.array", "numpy.zeros", "numpy.outer", "numpy.arctan2", "proper.prop_propagate", "cv2.resize", "numpy.transpose", "nump...
[((146, 175), 'proper.prop_get_gridsize', 'proper.prop_get_gridsize', (['wfo'], {}), '(wfo)\n', (170, 175), False, 'import proper\n'), ((801, 832), 'numpy.ones', 'np.ones', (['(nramp,)'], {'dtype': 'np.int'}), '((nramp,), dtype=np.int)\n', (808, 832), True, 'import numpy as np\n'), ((925, 941), 'numpy.outer', 'np.outer...
import turtle screen = turtle.Screen() # this assures that the size of the screen will always be 400x400 ... screen.setup(400, 400) # ... which is the same size as our image # now set the background to our space image screen.bgpic("game.over") turtle.mainloop()
[ "turtle.mainloop", "turtle.Screen" ]
[((24, 39), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (37, 39), False, 'import turtle\n'), ((248, 265), 'turtle.mainloop', 'turtle.mainloop', ([], {}), '()\n', (263, 265), False, 'import turtle\n')]
#!/usr/bin/env python3 from cryptofeed import FeedHandler from cryptofeed.defines import TRADES from cryptoblotter.exchanges import CoinbaseBlotter from cryptoblotter.trades import SequentialIntegerTradeCallback, ThreshCallback from cryptoblotter.trades.constants import VOLUME async def trades(trade): print(tra...
[ "cryptofeed.FeedHandler", "cryptoblotter.trades.ThreshCallback" ]
[((362, 375), 'cryptofeed.FeedHandler', 'FeedHandler', ([], {}), '()\n', (373, 375), False, 'from cryptofeed import FeedHandler\n'), ((582, 667), 'cryptoblotter.trades.ThreshCallback', 'ThreshCallback', (['trades'], {'thresh_attr': 'VOLUME', 'thresh_value': '(1000)', 'window_seconds': '(60)'}), '(trades, thresh_attr=VO...
#!/usr/bin/env python from setuptools import find_packages, setup with open("README.md", "r", encoding="utf-8") as f: long_description = f.read() setup( name="tplink-wr-api", version="0.2.1", url="https://github.com/n1k0r/tplink-wr-api", author="n1k0r", author_email="<EMAIL>", description=...
[ "setuptools.find_packages" ]
[((1123, 1166), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests', 'tests.*']"}), "(exclude=['tests', 'tests.*'])\n", (1136, 1166), False, 'from setuptools import find_packages, setup\n')]
"""The module contains functions to preprocess input datasets into usable format.""" import gc import gzip import json import logging import multiprocessing as mp import pathlib import sys from itertools import repeat import numpy as np import scipy.sparse as smat logging.basicConfig( stream=sys.stdout, format...
[ "logging.basicConfig", "logging.getLogger", "json.loads", "pathlib.Path", "gzip.open", "multiprocessing.Pool", "gc.collect", "itertools.repeat" ]
[((266, 426), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(stream=sys.stdout, format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', dat...
import logging import pytest from c4.devices.policyengine import PolicyEngineManager from c4.messaging import Router, RouterClient from c4.system.configuration import States, Roles from c4.system.deviceManager import DeviceManager from c4.system.messages import (LocalStartDeviceManager, LocalStopDeviceManager, ...
[ "logging.getLogger", "c4.system.messages.Status", "c4.system.deviceManager.DeviceManager", "c4.system.messages.LocalStartDeviceManager", "c4.system.messages.LocalStopDeviceManager", "pytest.mark.usefixtures", "c4.devices.policyengine.PolicyEngineManager.getOperations", "c4.messaging.RouterClient", "...
[((362, 389), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (379, 389), False, 'import logging\n'), ((404, 447), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""temporaryIPCPath"""'], {}), "('temporaryIPCPath')\n", (427, 447), False, 'import pytest\n'), ((706, 741), 'c4.devic...
#!/usr/bin/env python3 import sys,re,os,re, datetime import requests import json import hashlib import getopt from pprint import pprint from pathlib import Path ################################################################################ ## Hashing large files ####################################################...
[ "re.split", "hashlib.sha256", "datetime.datetime.fromtimestamp", "os.stat", "pathlib.Path", "json.dumps", "os.environ.get", "requests.get", "hashlib.sha224", "hashlib.sha384", "hashlib.sha512", "re.sub", "hashlib.sha1", "pprint.pprint", "sys.argv.pop" ]
[((1696, 1752), 'requests.get', 'requests.get', (['url_filename'], {'timeout': 'timeout', 'stream': '(True)'}), '(url_filename, timeout=timeout, stream=True)\n', (1708, 1752), False, 'import requests\n'), ((3201, 3226), 're.split', 're.split', (['"""\\\\."""', 'filename'], {}), "('\\\\.', filename)\n", (3209, 3226), Fa...
import os pkg_path = os.path.dirname(__file__) static_folder = os.path.join(pkg_path, 'static') template_folder = os.path.join(pkg_path, 'templates')
[ "os.path.dirname", "os.path.join" ]
[((22, 47), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (37, 47), False, 'import os\n'), ((64, 96), 'os.path.join', 'os.path.join', (['pkg_path', '"""static"""'], {}), "(pkg_path, 'static')\n", (76, 96), False, 'import os\n'), ((115, 150), 'os.path.join', 'os.path.join', (['pkg_path', '"""...
import sys import io import time import pprint input_txt = """ 10 0 2 1 1 2 3 1 2 3 3 2 1 2 2 3 1 6 10 3 1 4 1 4 1 7 1 5 2 3 1 6 1 6 2 3 1 8 1 7 2 5 1 8 4 8 1 9 100000 9 0 """ #sys.stdin = open("ALDS1_11_D_in11.txt","r")#io.StringIO(input_txt) #sys.stdin = io.StringIO(input_txt) sys.stdin = ope...
[ "sys.stdin.readlines", "time.time", "collections.defaultdict" ]
[((374, 385), 'time.time', 'time.time', ([], {}), '()\n', (383, 385), False, 'import time\n'), ((1790, 1807), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1801, 1807), False, 'from collections import defaultdict\n'), ((1823, 1844), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n'...
# coding=utf-8 """ Logical permission backends module """ from permission.conf import settings from permission.utils.handlers import registry from permission.utils.permissions import perm_to_permission __all__ = ('PermissionBackend',) class PermissionBackend(object): """ A handler based permission backen...
[ "permission.utils.handlers.registry.get_handlers", "permission.utils.permissions.perm_to_permission" ]
[((1981, 2005), 'permission.utils.permissions.perm_to_permission', 'perm_to_permission', (['perm'], {}), '(perm)\n', (1999, 2005), False, 'from permission.utils.permissions import perm_to_permission\n'), ((2367, 2390), 'permission.utils.handlers.registry.get_handlers', 'registry.get_handlers', ([], {}), '()\n', (2388, ...
import logging import os import sqlalchemy import setproctitle import argparse import yaml from apscheduler.scheduler import Scheduler from cryptokit.rpc_wrapper import CoinRPC from simplecoin_rpc_client.sc_rpc import SCRPCClient logger = logging.getLogger('apscheduler.scheduler') os_root = os.path.abspath(os.path.di...
[ "logging.getLogger", "logging.StreamHandler", "simplecoin_rpc_client.sc_rpc.SCRPCClient", "argparse.ArgumentParser", "logging.Formatter", "setproctitle.setproctitle", "cryptokit.rpc_wrapper.CoinRPC", "os.path.dirname", "apscheduler.scheduler.Scheduler" ]
[((241, 283), 'logging.getLogger', 'logging.getLogger', (['"""apscheduler.scheduler"""'], {}), "('apscheduler.scheduler')\n", (258, 283), False, 'import logging\n'), ((1722, 1785), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""simplecoin rpc client scheduler"""'}), "(prog='simplecoin rpc clien...
bl_info = { "name": "Import Planar Code", "author": "<NAME>", "version": (1, 0), "blender": (2, 80, 0), "location": "File > Import > Planar Code", "description": "Import planar code and construct mesh by assigning vertex positions.", "warning": "", "support": "TESTING", "wik...
[ "bpy.props.StringProperty", "numpy.sqrt", "bpy.data.objects.new", "bmesh.new", "bpy.types.TOPBAR_MT_file_import.remove", "numpy.isfinite", "numpy.linalg.norm", "numpy.sin", "bpy.context.scene.collection.objects.link", "bpy.utils.unregister_class", "bpy.props.BoolProperty", "bpy.types.TOPBAR_MT...
[((7250, 7381), 'bpy.props.StringProperty', 'StringProperty', ([], {'name': '"""File Path"""', 'description': '"""Filepath used for importing the Planar code file"""', 'maxlen': '(1024)', 'default': '""""""'}), "(name='File Path', description=\n 'Filepath used for importing the Planar code file', maxlen=1024, defaul...
import gevent from gevent.queue import Queue, Empty from gevent_subprocess import Popen, PIPE from gsh.plugin import BaseExecutor, BaseInnerExecutor class SshExecutor(BaseExecutor): def __init__(self, args, kwargs): self.ssh_opts = kwargs.get("ssh_opts", []) super(SshExecutor, self).__init__(args,...
[ "gevent_subprocess.Popen", "gevent.joinall", "gevent.spawn", "gevent.queue.Queue" ]
[((475, 482), 'gevent.queue.Queue', 'Queue', ([], {}), '()\n', (480, 482), False, 'from gevent.queue import Queue, Empty\n'), ((1161, 1297), 'gevent_subprocess.Popen', 'Popen', (["(['ssh', '-no', 'PasswordAuthentication=no'] + self.parent.ssh_opts + [self\n .hostname] + self.command)"], {'stdout': 'PIPE', 'stderr': ...
from models.indicators import Indicators import numpy as np import matplotlib.pyplot as plt def plot_prices(ax, prices, line_style): i = np.arange(len(prices)) ax.plot(ax, prices, line_style) return ax def plot_macd(ax, prices, slow_period, fast_period, line_style='k-'): macd = Indicators.macd(price...
[ "models.indicators.Indicators.ema", "models.indicators.Indicators.macd" ]
[((299, 348), 'models.indicators.Indicators.macd', 'Indicators.macd', (['prices', 'slow_period', 'fast_period'], {}), '(prices, slow_period, fast_period)\n', (314, 348), False, 'from models.indicators import Indicators\n'), ((524, 554), 'models.indicators.Indicators.ema', 'Indicators.ema', (['prices', 'period'], {}), '...
""" Unit Test for strings.basic problems """ from unittest import TestCase from strings.basic import alphabetize class TestAlphabetize(TestCase): """ Unit Test for alphabetize method """ def test_should_return_alphabet(self): """ Test alphabetize method using every uppercase and low...
[ "strings.basic.alphabetize" ]
[((405, 447), 'strings.basic.alphabetize', 'alphabetize', (['"""ZyXwVuTsRqPoNmLkJiHgFeDcBba"""'], {}), "('ZyXwVuTsRqPoNmLkJiHgFeDcBba')\n", (416, 447), False, 'from strings.basic import alphabetize\n')]
#!/usr/bin/env python from distutils.core import setup setup( name="python-tdlib", version="1.4.0", author="andrew-ld", license="MIT", url="https://github.com/andrew-ld/python-tdlib", packages=["py_tdlib", "py_tdlib.constructors", "py_tdlib.factory"], install_requires=["werkzeug", "simplej...
[ "distutils.core.setup" ]
[((57, 336), 'distutils.core.setup', 'setup', ([], {'name': '"""python-tdlib"""', 'version': '"""1.4.0"""', 'author': '"""andrew-ld"""', 'license': '"""MIT"""', 'url': '"""https://github.com/andrew-ld/python-tdlib"""', 'packages': "['py_tdlib', 'py_tdlib.constructors', 'py_tdlib.factory']", 'install_requires': "['werkz...
import numpy as np import pandas as pd import scipy.stats as scs import itertools from collections import defaultdict import textwrap import pingouin as pg from statsmodels.stats.multicomp import pairwise_tukeyhsd from sklearn.neighbors import NearestNeighbors from sklearn.decomposition import PCA from sklearn.cluster...
[ "numpy.log10", "numpy.sqrt", "numpy.argsort", "numpy.nanmean", "sklearn.metrics.silhouette_samples", "numpy.array", "scipy.stats.ttest_ind", "umap.UMAP", "seaborn.violinplot", "seaborn.scatterplot", "matplotlib.patheffects.withStroke", "numpy.arange", "numpy.mean", "seaborn.regplot", "sk...
[((1130, 1163), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1153, 1163), False, 'import warnings\n'), ((1164, 1195), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (1185, 1195), False, 'import warnings\n'), ((1725, 1764), 'mat...
from itertools import chain from django.db import models from random import choices class Node(object): def neighbors(self): raise NotImplementedError def graph(self, depth=1): if not depth: return {self: set()} elif depth == 1: return {self: set(self.neighbors...
[ "django.db.models.DateField", "django.db.models.ForeignKey", "django.db.models.IntegerField", "django.db.models.ManyToManyField", "django.db.models.BooleanField", "django.db.models.CharField" ]
[((727, 776), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(22)', 'primary_key': '(True)'}), '(max_length=22, primary_key=True)\n', (743, 776), False, 'from django.db import models\n'), ((794, 824), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'null': '(True)'}), '(null=True)\...
#!/usr/bin/env python3 """ OCR with the Tesseract engine from Google this is a wrapper around pytesser (http://code.google.com/p/pytesser/) """ import config as cfg from lib.process import get_simple_cmd_output def image_file_to_string(fname): """Convert an image file to text using OCR.""" cmd = "{tesseract...
[ "lib.process.get_simple_cmd_output" ]
[((416, 442), 'lib.process.get_simple_cmd_output', 'get_simple_cmd_output', (['cmd'], {}), '(cmd)\n', (437, 442), False, 'from lib.process import get_simple_cmd_output\n')]
"""empty message Revision ID: 0e26a2d71475 Revises: Create Date: 2021-03-19 00:13:23.019330 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '0e26a2d71475' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
[ "alembic.op.drop_constraint", "alembic.op.create_unique_constraint" ]
[((362, 417), 'alembic.op.create_unique_constraint', 'op.create_unique_constraint', (['None', '"""audio_book"""', "['id']"], {}), "(None, 'audio_book', ['id'])\n", (389, 417), False, 'from alembic import op\n'), ((422, 474), 'alembic.op.create_unique_constraint', 'op.create_unique_constraint', (['None', '"""podcast"""'...
import helper from helper import greeting def main(): #print("called hello") helper.greeting("hello") if __name__ == '__main__': main()
[ "helper.greeting" ]
[((80, 104), 'helper.greeting', 'helper.greeting', (['"""hello"""'], {}), "('hello')\n", (95, 104), False, 'import helper\n')]
# команда меню "права пользователей" from aiogram.types import Message, CallbackQuery, ReplyKeyboardRemove from filters import IsAdmin from loader import dp, db, bot from keyboards.inline.callback_data import change_button_data from keyboards.inline.callback_data import set_status_data from keyboards.inline.callback_...
[ "filters.IsAdmin", "loader.db.delete_user", "keyboards.default.admin_keyboard.create_kb_coustom_main_menu", "keyboards.inline.callback_data.set_status_data.parse", "keyboards.inline.callback_data.change_button_data.parse", "loader.db.update_status", "keyboards.inline.callback_data.group_users_data.filte...
[((579, 603), 'keyboards.inline.group_users_buttons.create_kb_groups_users', 'create_kb_groups_users', ([], {}), '()\n', (601, 603), False, 'from keyboards.inline.group_users_buttons import create_kb_groups_users\n'), ((371, 380), 'filters.IsAdmin', 'IsAdmin', ([], {}), '()\n', (378, 380), False, 'from filters import I...
from pageobject import PageObject from homepage import HomePage from locatormap import LocatorMap from robot.api import logger class LoginPage(): PAGE_TITLE = "Login - PageObjectLibrary Demo" PAGE_URL = "/login.html" # these are accessible via dot notaton with self.locator # (eg: self.locator.usernam...
[ "robot.api.logger.console", "homepage.HomePage", "pageobject.PageObject" ]
[((539, 551), 'pageobject.PageObject', 'PageObject', ([], {}), '()\n', (549, 551), False, 'from pageobject import PageObject\n'), ((814, 854), 'robot.api.logger.console', 'logger.console', (['"""Navigating to homepage"""'], {}), "('Navigating to homepage')\n", (828, 854), False, 'from robot.api import logger\n'), ((875...
'''Maps buttons for the Reefbot control.''' import roslib; roslib.load_manifest('reefbot-controller') import rospy class JoystickButtons: DPAD_LR = 4 DPAD_UD = 5 ALOG_LEFT_UD = 1 ALOG_LEFT_LR = 0 ALOG_RIGHT_UD = 3 ALOG_RIGHT_LR = 2 BUTTON_1 = 0 BUTTON_2 = 1 BUTTON_3 = 2 BUTTON_4 = 3 BUTTON_...
[ "rospy.get_param", "roslib.load_manifest" ]
[((60, 102), 'roslib.load_manifest', 'roslib.load_manifest', (['"""reefbot-controller"""'], {}), "('reefbot-controller')\n", (80, 102), False, 'import roslib\n'), ((505, 567), 'rospy.get_param', 'rospy.get_param', (['"""~dive_down_button"""', 'JoystickButtons.BUTTON_7'], {}), "('~dive_down_button', JoystickButtons.BUTT...
import os from datetime import datetime from PIL import Image, ImageDraw, ImageFont from pySmartDL import SmartDL from telethon.tl import functions from uniborg.util import admin_cmd import asyncio import shutil import random, re FONT_FILE_TO_USE = "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf" #Add telegraph ...
[ "uniborg.util.admin_cmd", "PIL.Image.open", "asyncio.sleep", "telethon.tl.functions.photos.UploadProfilePhotoRequest", "PIL.ImageFont.truetype", "datetime.datetime.now", "PIL.ImageDraw.Draw", "shutil.copy", "pySmartDL.SmartDL", "os.remove" ]
[((948, 981), 'uniborg.util.admin_cmd', 'admin_cmd', ([], {'pattern': '"""thordp ?(.*)"""'}), "(pattern='thordp ?(.*)')\n", (957, 981), False, 'from uniborg.util import admin_cmd\n'), ((1221, 1277), 'pySmartDL.SmartDL', 'SmartDL', (['AUTOPP', 'downloaded_file_name'], {'progress_bar': '(True)'}), '(AUTOPP, downloaded_fi...
import random import numpy as np import torch from torch import nn from torchbenchmark.tasks import OTHER from ...util.model import BenchmarkModel torch.manual_seed(1337) random.seed(1337) np.random.seed(1337) # pretend we are using MLP to predict CIFAR images class MLP(nn.Module): def __init__(self): ...
[ "torch.manual_seed", "torch.nn.ReLU", "torch.nn.CrossEntropyLoss", "torch.nn.Softmax", "torch.nn.Flatten", "random.seed", "torch.randint", "numpy.random.seed", "torch.nn.Linear", "torch.no_grad", "torch.randn" ]
[((150, 173), 'torch.manual_seed', 'torch.manual_seed', (['(1337)'], {}), '(1337)\n', (167, 173), False, 'import torch\n'), ((174, 191), 'random.seed', 'random.seed', (['(1337)'], {}), '(1337)\n', (185, 191), False, 'import random\n'), ((192, 212), 'numpy.random.seed', 'np.random.seed', (['(1337)'], {}), '(1337)\n', (2...
from src.uint8 import uint8 def test_constructor1(): assert int(uint8(20)) == 20 def test_constructor2(): assert uint8(256) == uint8(0) assert uint8(260) == uint8(4) assert uint8(-1) == uint8(255) assert uint8(-5) == uint8(251) assert uint8(-5) != uint8(252) def test_add_other(): asser...
[ "src.uint8.uint8" ]
[((976, 985), 'src.uint8.uint8', 'uint8', (['(31)'], {}), '(31)\n', (981, 985), False, 'from src.uint8 import uint8\n'), ((997, 1006), 'src.uint8.uint8', 'uint8', (['(24)'], {}), '(24)\n', (1002, 1006), False, 'from src.uint8 import uint8\n'), ((1144, 1153), 'src.uint8.uint8', 'uint8', (['(31)'], {}), '(31)\n', (1149, ...
""" icons index """ import zoom class MyView(zoom.View): """Index View""" def index(self): """Index page""" zoom.requires('fontawesome4') content = zoom.tools.load('icons.html') subtitle = 'Icons available as part of FontAwesome 4<br><br>' return zoom.page(content,...
[ "zoom.requires", "zoom.dispatch", "zoom.tools.load", "zoom.page" ]
[((616, 637), 'zoom.dispatch', 'zoom.dispatch', (['MyView'], {}), '(MyView)\n', (629, 637), False, 'import zoom\n'), ((139, 168), 'zoom.requires', 'zoom.requires', (['"""fontawesome4"""'], {}), "('fontawesome4')\n", (152, 168), False, 'import zoom\n'), ((187, 216), 'zoom.tools.load', 'zoom.tools.load', (['"""icons.html...
# import the function that will return an instance of a connection from mysqlconnection import connectToMySQL # model the class after the friend table from our database class User: def __init__( self , data ): self.id = data['id'] self.first_name = data['first_name'] self.last_name = data['l...
[ "mysqlconnection.connectToMySQL" ]
[((701, 731), 'mysqlconnection.connectToMySQL', 'connectToMySQL', (['"""users_schema"""'], {}), "('users_schema')\n", (715, 731), False, 'from mysqlconnection import connectToMySQL\n'), ((1371, 1401), 'mysqlconnection.connectToMySQL', 'connectToMySQL', (['"""users_schema"""'], {}), "('users_schema')\n", (1385, 1401), F...
import os import plugin import pluginconf util = plugin.get("util") FILE_COUNTER = "~/.vpn_counter" FILE_VPN_SH = "~/.vpn_sh" EXPECT_SCRIPT = """#!/usr/bin/expect spawn {cmd} expect -exact "Enter Auth Username:" send -- "{user}\\n" expect -exact "Enter Auth Password:" send -- "{password}\\n" interact """ class V...
[ "pluginconf.get", "os.chmod", "os.popen", "plugin.get", "os.system", "os.path.expanduser" ]
[((51, 69), 'plugin.get', 'plugin.get', (['"""util"""'], {}), "('util')\n", (61, 69), False, 'import plugin\n'), ((397, 418), 'pluginconf.get', 'pluginconf.get', (['"""vpn"""'], {}), "('vpn')\n", (411, 418), False, 'import pluginconf\n'), ((613, 645), 'os.path.expanduser', 'os.path.expanduser', (['FILE_COUNTER'], {}), ...
# -*- coding: utf-8 -*- from openprocurement.api.validation import ( validate_json_data, validate_data, validate_accreditation_level, validate_accreditation_level_mode, ) from openprocurement.api.utils import update_logging_context, error_handler, upload_objects_documents from openprocurement.planning.a...
[ "openprocurement.api.utils.upload_objects_documents", "openprocurement.api.utils.update_logging_context", "openprocurement.api.validation.validate_json_data", "openprocurement.api.validation.validate_data", "openprocurement.api.validation.validate_accreditation_level_mode", "openprocurement.api.utils.get_...
[((628, 683), 'openprocurement.api.utils.update_logging_context', 'update_logging_context', (['request', "{'plan_id': '__new__'}"], {}), "(request, {'plan_id': '__new__'})\n", (650, 683), False, 'from openprocurement.api.utils import update_logging_context, error_handler, upload_objects_documents\n'), ((695, 722), 'ope...
# Importando librerías from numpy import array # Listas y arreglos a = array(['h', 101, 'l', 'l', 'o']) x = ['h', 101, 'l', 'l', 'o'] print(a) print(x) print("Tamaño: ", len(x)) # Condicionales if isinstance(x[1], int): x[1] = chr(x[1]) elif isinstance(x[1], str): pass else: raise TypeError("Tipo no sop...
[ "numpy.array" ]
[((72, 104), 'numpy.array', 'array', (["['h', 101, 'l', 'l', 'o']"], {}), "(['h', 101, 'l', 'l', 'o'])\n", (77, 104), False, 'from numpy import array\n')]
import chainer import chainer.functions as F import chainer.links as L class VGGNet(chainer.Chain): """ VGGNet - It takes (224, 224, 3) sized image as imput """ def __init__(self, n_class=1000): super(VGGNet, self).__init__() with self.init_scope(): self.conv1_1 = L.C...
[ "chainer.links.Linear", "chainer.functions.max_pooling_2d", "chainer.links.Convolution2D" ]
[((1481, 1513), 'chainer.functions.max_pooling_2d', 'F.max_pooling_2d', (['h', '(2)'], {'stride': '(2)'}), '(h, 2, stride=2)\n', (1497, 1513), True, 'import chainer.functions as F\n'), ((1599, 1631), 'chainer.functions.max_pooling_2d', 'F.max_pooling_2d', (['h', '(2)'], {'stride': '(2)'}), '(h, 2, stride=2)\n', (1615, ...
import sqlite3 import requests from bs4 import BeautifulSoup from login import keys import config ARTICLE_SEARCH_URL = 'http://api.nytimes.com/svc/search/v2/articlesearch.json?api-key={key}' SUNLIGHT_CONGRESS_URL = 'http://congress.api.sunlightfoundation.com/{method}?{query}&apikey={key}' def get_json(url): ret...
[ "bs4.BeautifulSoup", "sqlite3.connect", "requests.get" ]
[((635, 652), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (647, 652), False, 'import requests\n'), ((1219, 1251), 'sqlite3.connect', 'sqlite3.connect', (['config.DATABASE'], {}), '(config.DATABASE)\n', (1234, 1251), False, 'import sqlite3\n'), ((324, 341), 'requests.get', 'requests.get', (['url'], {}), '(...
#! /usr/bin/env python # -*- coding: utf-8 -*- """docstring""" from __future__ import print_function, unicode_literals import argparse import sys from .settingsdiff import dump_settings, diff_settings def main(): parser = argparse.ArgumentParser() parser.add_argument( "settings_path_1", nar...
[ "argparse.ArgumentParser", "sys.exit" ]
[((231, 256), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (254, 256), False, 'import argparse\n'), ((1185, 1196), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1193, 1196), False, 'import sys\n')]
import torch import torch.nn as nn from ..utils.torch import pack_forward from .pooling import GatherLastLayer class CharEncoder(nn.Module): FORWARD_BACKWARD_AGGREGATION_METHODS = ["cat", "linear_sum"] def __init__( self, char_embedding_dim, hidden_size, char_fw_bw_agg_method...
[ "torch.nn.LSTM", "torch.mul", "torch.abs", "torch.nn.Linear" ]
[((1073, 1193), 'torch.nn.LSTM', 'nn.LSTM', (['self.char_embedding_dim', 'self.char_hidden_dim', 'self.n_layers'], {'bidirectional': 'self.bidirectional', 'dropout': '(0.0)'}), '(self.char_embedding_dim, self.char_hidden_dim, self.n_layers,\n bidirectional=self.bidirectional, dropout=0.0)\n', (1080, 1193), True, 'im...
import json import uuid from dataclasses import dataclass from typing import Callable, Sequence, Any, Optional, Tuple, Union, List, Generic, TypeVar from serflag import SerFlag from handlers.graphql.graphql_handler import ContextProtocol from handlers.graphql.utils.string import camelcase from xenadapter.task import ge...
[ "constants.re.db.table", "xenadapter.task.get_userids", "json.dumps", "uuid.uuid4", "functools.partial", "typing.TypeVar", "constants.re.r.now", "sentry_sdk.capture_exception" ]
[((1695, 1711), 'typing.TypeVar', 'TypeVar', (['"""Input"""'], {}), "('Input')\n", (1702, 1711), False, 'from typing import Callable, Sequence, Any, Optional, Tuple, Union, List, Generic, TypeVar\n'), ((1732, 1756), 'typing.TypeVar', 'TypeVar', (['"""InputArgument"""'], {}), "('InputArgument')\n", (1739, 1756), False, ...
from django import template from django.utils import timezone register = template.Library() @register.filter def sold(oil, delta_months='12'): total = 0 curTime = timezone.localtime(timezone.now()) from_time = curTime - timezone.timedelta(days=int(delta_months)*30) for t in oil.trades.filter(dateTime...
[ "django.utils.timezone.now", "django.template.Library" ]
[((74, 92), 'django.template.Library', 'template.Library', ([], {}), '()\n', (90, 92), False, 'from django import template\n'), ((193, 207), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (205, 207), False, 'from django.utils import timezone\n')]
from datetime import datetime import py42.util as util def test_convert_timestamp_to_str_returns_expected_str(): assert util.convert_timestamp_to_str(235123656) == "1977-06-14T08:07:36.000Z" def test_convert_datetime_to_timestamp_str_returns_expected_str(): d = datetime(2020, 4, 19, 13, 3, 2, 3) assert...
[ "datetime.datetime", "py42.util.convert_timestamp_to_str", "py42.util.convert_datetime_to_timestamp_str" ]
[((275, 309), 'datetime.datetime', 'datetime', (['(2020)', '(4)', '(19)', '(13)', '(3)', '(2)', '(3)'], {}), '(2020, 4, 19, 13, 3, 2, 3)\n', (283, 309), False, 'from datetime import datetime\n'), ((127, 167), 'py42.util.convert_timestamp_to_str', 'util.convert_timestamp_to_str', (['(235123656)'], {}), '(235123656)\n', ...
import argparse import collections import os import cv2 import numpy as np import pandas as pd import pretrainedmodels import torch import torch.optim as optim import torchsummary from torch.optim import lr_scheduler from torch.utils.data import DataLoader from torchvision import datasets, models, transforms from tqdm...
[ "pandas.read_csv", "utils.CosineAnnealingLRWithRestarts", "numpy.mean", "argparse.ArgumentParser", "numpy.diff", "numpy.concatenate", "triplet_dataset.TripletDatasetUpdate", "torchvision.transforms.ToTensor", "logger.Logger", "torch.save", "numpy.std", "torch.nn.functional.relu", "torchvisio...
[((1957, 2000), 'os.makedirs', 'os.makedirs', (['checkpoints_dir'], {'exist_ok': '(True)'}), '(checkpoints_dir, exist_ok=True)\n', (1968, 2000), False, 'import os\n'), ((2005, 2048), 'os.makedirs', 'os.makedirs', (['tensorboard_dir'], {'exist_ok': '(True)'}), '(tensorboard_dir, exist_ok=True)\n', (2016, 2048), False, '...
import functools import numpy as np def dft2(f, alpha, npix=None, shift=(0, 0), offset=(0, 0), unitary=True, out=None): """Compute the 2-dimensional discrete Fourier Transform. This function allows independent control over input shape, output shape, and output sampling by implementing the matrix triple p...
[ "numpy.abs", "numpy.arange", "numpy.conj", "numpy.asarray", "numpy.floor", "numpy.can_cast", "numpy.outer", "functools.lru_cache", "numpy.divide" ]
[((3906, 3937), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (3925, 3937), False, 'import functools\n'), ((4251, 4282), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': '(32)'}), '(maxsize=32)\n', (4270, 4282), False, 'import functools\n'), ((3198, 3211), 'num...
# coding: utf-8 # Copyright (c) Pymatgen Development Team. # Distributed under the terms of the MIT License. import math import random import numpy as np import matplotlib.pyplot as plt from scipy.constants import N_A from numba import jit import copy __author__ = "<NAME>, <NAME>, <NAME>" __email__ = "<EMAIL>" __copy...
[ "math.floor", "numpy.log", "numpy.count_nonzero", "numpy.array", "copy.deepcopy", "numpy.mean", "numpy.multiply", "numpy.where", "numpy.diff", "numpy.vstack", "matplotlib.pyplot.savefig", "numpy.ones", "numba.jit", "numpy.std", "matplotlib.pyplot.cm.get_cmap", "matplotlib.pyplot.show",...
[((6251, 6284), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'parallel': '(True)'}), '(nopython=True, parallel=True)\n', (6254, 6284), False, 'from numba import jit\n'), ((9817, 9835), 'numba.jit', 'jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (9820, 9835), False, 'from numba import jit\n'), ((11607, 116...
''' Created on 2018-12-21 Copyright (c) 2018 <NAME> Generate code from a model and a jinja2 template. ''' import logging from pathlib import Path from jinja2 import FileSystemLoader, Environment from jinja2.exceptions import TemplateNotFound from munch import munchify from fashion.mirror import Mirror # Module l...
[ "jinja2.FileSystemLoader", "munch.munchify", "pathlib.Path" ]
[((1345, 1369), 'pathlib.Path', 'Path', (['mirCfg.projectPath'], {}), '(mirCfg.projectPath)\n', (1349, 1369), False, 'from pathlib import Path\n'), ((1371, 1394), 'pathlib.Path', 'Path', (['mirCfg.mirrorPath'], {}), '(mirCfg.mirrorPath)\n', (1375, 1394), False, 'from pathlib import Path\n'), ((1519, 1536), 'munch.munch...
from multiprocessing.dummy import Value from agents.Base_Agent import Base_Agent import copy import numpy as np import torch import torch.nn.functional as F from torch.optim import Adam class RunningMeanStd(object): # https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm def _...
[ "torch.mean", "torch.unsqueeze", "torch.sqrt", "torch.square", "torch.cat", "copy.deepcopy", "torch.zeros", "agents.Base_Agent.Base_Agent.__init__", "torch.std", "torch.var", "torch.where", "torch.ones" ]
[((580, 601), 'torch.mean', 'torch.mean', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (590, 601), False, 'import torch\n'), ((622, 642), 'torch.var', 'torch.var', (['x'], {'axis': '(0)'}), '(x, axis=0)\n', (631, 642), False, 'import torch\n'), ((1532, 1604), 'agents.Base_Agent.Base_Agent.__init__', 'Base_Agent.__init__'...
from collections import OrderedDict, defaultdict from contextlib import contextmanager from datetime import datetime import torch.cuda from ..viz.plot import plot_timeline def time(name=None, sync=False): return Task(name=name, sync=sync, log=True) class Task: __slots__ = ('name', 'start_time', 'end_time', 'met...
[ "datetime.datetime.now" ]
[((820, 834), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (832, 834), False, 'from datetime import datetime\n'), ((1106, 1120), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1118, 1120), False, 'from datetime import datetime\n')]
#!/usr/bin/env python3 import sys import os.path import re from datetime import date, datetime, time, timedelta # helper def is_timeformat(s): p = re.compile('^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}$') if p.match(s) is None: return False else: return True def is_time_line(l): p = re.c...
[ "datetime.datetime.strptime", "datetime.timedelta", "datetime.date.today", "re.compile" ]
[((155, 206), 're.compile', 're.compile', (['"""^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}$"""'], {}), "('^[0-9]{2}:[0-9]{2}:[0-9]{2},[0-9]{3}$')\n", (165, 206), False, 'import re\n'), ((316, 340), 're.compile', 're.compile', (['"""^[0-9]{2}:"""'], {}), "('^[0-9]{2}:')\n", (326, 340), False, 'import re\n'), ((457, 492), 'dat...
import argparse from typing import Optional import annofabcli import annofabcli.common.cli import annofabcli.filesystem.draw_annotation import annofabcli.filesystem.filter_annotation import annofabcli.filesystem.mask_user_info import annofabcli.filesystem.merge_annotation import annofabcli.filesystem.write_annotation_...
[ "annofabcli.filesystem.merge_annotation.add_parser", "annofabcli.filesystem.filter_annotation.add_parser", "annofabcli.filesystem.write_annotation_image.add_parser", "annofabcli.filesystem.mask_user_info.add_parser", "annofabcli.filesystem.draw_annotation.add_parser", "annofabcli.common.cli.add_parser" ]
[((440, 500), 'annofabcli.filesystem.draw_annotation.add_parser', 'annofabcli.filesystem.draw_annotation.add_parser', (['subparsers'], {}), '(subparsers)\n', (488, 500), False, 'import annofabcli\n'), ((505, 567), 'annofabcli.filesystem.filter_annotation.add_parser', 'annofabcli.filesystem.filter_annotation.add_parser'...
import getpass import os import sys VER = '1.0.1.7' VERSION = 'Version=%s' % VER MANUFACTURER = 'Manufacturer=<NAME>' X86 = 'Platform=x86' X64 = 'Platform=x64' TOWIN = 'ToWindows' def main(): signpwd = getpass.getpass('Password for signing:') import builddoc builddoc.main() os.environ['...
[ "builddoc.main", "getpass.getpass", "makemsi.main" ]
[((220, 260), 'getpass.getpass', 'getpass.getpass', (['"""Password for signing:"""'], {}), "('Password for signing:')\n", (235, 260), False, 'import getpass\n'), ((287, 302), 'builddoc.main', 'builddoc.main', ([], {}), '()\n', (300, 302), False, 'import builddoc\n'), ((365, 458), 'makemsi.main', 'makemsi.main', (["['-o...
from setuptools import setup, Extension # Compile parts of `freq.cpp` into a shared library so we can call it from Python setup( #... ext_modules=[Extension('gof_test', ['freq.cpp'],),], )
[ "setuptools.Extension" ]
[((156, 191), 'setuptools.Extension', 'Extension', (['"""gof_test"""', "['freq.cpp']"], {}), "('gof_test', ['freq.cpp'])\n", (165, 191), False, 'from setuptools import setup, Extension\n')]
""" This Module defines the main the main component of the Agent service, a bridge that listens to UDP messages from the LoRa gateway's Packet Forwarder and encapsulates and sends them using the AMQP protocol to the Test Application Server (TAS). """ #####################################################################...
[ "logging.getLogger", "message_queueing.MqInterface", "socket.socket", "lorawan.user_agent.bridge.udp_listener.UDPListener.create_semaphore", "os.environ.get", "lorawan.parsing.flora_messages.GatewayMessage", "struct.pack", "lorawan.user_agent.bridge.udp_listener.UDPListener", "time.time", "random....
[((2026, 2053), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2043, 2053), False, 'import logging\n'), ((2090, 2136), 'os.environ.get', 'os.environ.get', (['"""PACKET_FORWARDER_VERSION_INT"""'], {}), "('PACKET_FORWARDER_VERSION_INT')\n", (2104, 2136), False, 'import os\n'), ((3328, 3351...
from abc import ABC, abstractmethod from typing import TypeVar, Generic T = TypeVar("T") class AbstractResourceResolver(Generic[T], ABC): """ The resolver takes care of creating fully qualified names from resource keys. For instance, when working with files this would be the file path, when working w...
[ "typing.TypeVar" ]
[((77, 89), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (84, 89), False, 'from typing import TypeVar, Generic\n')]
__author__ = '<NAME>' from odm.document import BaseDocument from odm.fields import StringField, ObjectIdField, ListField, IntegerField MAX_NUMBER_OF_LOG_ENTRIES = 32 TIMEPERIOD = 'timeperiod' PROCESS_NAME = 'process_name' START_OBJ_ID = 'start_obj_id' END_OBJ_ID = 'end_obj_id' STATE = 'state' RELATED_UNIT_OF_WORK = '...
[ "odm.fields.IntegerField", "odm.fields.StringField", "odm.fields.ListField", "odm.fields.ObjectIdField" ]
[((1792, 1823), 'odm.fields.ObjectIdField', 'ObjectIdField', (['"""_id"""'], {'null': '(True)'}), "('_id', null=True)\n", (1805, 1823), False, 'from odm.fields import StringField, ObjectIdField, ListField, IntegerField\n'), ((1843, 1868), 'odm.fields.StringField', 'StringField', (['PROCESS_NAME'], {}), '(PROCESS_NAME)\...
import pandas as pd import os from pathlib import Path import warnings warnings.filterwarnings('ignore') DATA_PATH = os.path.join( os.fspath(Path(__file__).parents[1]), "data") IMDB_DATA_PATH = os.path.join(DATA_PATH, "imdb_category.csv") EXPORT_PATH = os.path.join(DATA_PATH, "imdb_category_binary.csv") ca...
[ "pandas.read_csv", "pathlib.Path", "os.path.join", "pandas.get_dummies", "warnings.filterwarnings" ]
[((72, 105), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (95, 105), False, 'import warnings\n'), ((205, 249), 'os.path.join', 'os.path.join', (['DATA_PATH', '"""imdb_category.csv"""'], {}), "(DATA_PATH, 'imdb_category.csv')\n", (217, 249), False, 'import os\n'), ((264, ...
from functools import wraps import numpy as np import SimpleITK as sitk from ..utils import array_to_image, image_to_array def accepts_segmentations(f): @wraps(f) def wrapper(img, *args, **kwargs): result = f(img, *args, **kwargs) if isinstance(img, Segmentation): result = sit...
[ "SimpleITK.Compose", "SimpleITK.GetArrayViewFromImage", "functools.wraps", "SimpleITK.VectorIndexSelectionCast", "SimpleITK.Cast" ]
[((162, 170), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (167, 170), False, 'from functools import wraps\n'), ((317, 356), 'SimpleITK.Cast', 'sitk.Cast', (['result', 'sitk.sitkVectorUInt8'], {}), '(result, sitk.sitkVectorUInt8)\n', (326, 356), True, 'import SimpleITK as sitk\n'), ((889, 917), 'SimpleITK.Cast', '...
""" Wrapper for epi_reg command """ import fsl.utils.assertions as asrt from fsl.wrappers import wrapperutils as wutils @wutils.fileOrImage('data', 'roi', outprefix='out') @wutils.fileOrArray('veslocs', 'encdef', 'modmat') @wutils.fileOrText(' ') @wutils.fslwrapper def veaslc(data, roi, veslocs, encdef, imlist, modm...
[ "fsl.wrappers.wrapperutils.fileOrArray", "fsl.utils.assertions.assertIsNifti", "fsl.wrappers.wrapperutils.fileOrImage", "fsl.wrappers.wrapperutils.fileOrText", "fsl.wrappers.wrapperutils.applyArgStyle" ]
[((124, 174), 'fsl.wrappers.wrapperutils.fileOrImage', 'wutils.fileOrImage', (['"""data"""', '"""roi"""'], {'outprefix': '"""out"""'}), "('data', 'roi', outprefix='out')\n", (142, 174), True, 'from fsl.wrappers import wrapperutils as wutils\n'), ((176, 225), 'fsl.wrappers.wrapperutils.fileOrArray', 'wutils.fileOrArray'...
import torchaudio.transforms from torch import nn from hw_asr.augmentations.base import AugmentationBase from hw_asr.augmentations.random_apply import RandomApply class SpecAug(AugmentationBase): def __init__(self, freq_mask: int, time_mask: int, prob: float, *args, **kwargs): self.augmentation = nn.Sequ...
[ "hw_asr.augmentations.random_apply.RandomApply" ]
[((512, 553), 'hw_asr.augmentations.random_apply.RandomApply', 'RandomApply', (['self.augmentation', 'self.prob'], {}), '(self.augmentation, self.prob)\n', (523, 553), False, 'from hw_asr.augmentations.random_apply import RandomApply\n')]
# -*- coding: utf-8 -*- """ Created on Fri Apr 23 17:18:39 2021 @author: Koustav """ import os import glob import matplotlib.pyplot as plt import seaborn as sea import numpy as np import pandas as pan import math import collections import matplotlib.ticker as mtick from mpl_toolkits import mplot3d from matplotlib.col...
[ "numpy.log10", "powerlaw.Fit", "matplotlib.pyplot.ylabel", "numpy.array", "seaborn.scatterplot", "math.exp", "numpy.genfromtxt", "matplotlib.pyplot.xlabel", "matplotlib.pyplot.close", "numpy.exp", "numpy.linspace", "os.path.isdir", "os.mkdir", "numpy.concatenate", "pandas.DataFrame", "...
[((627, 713), 'numpy.genfromtxt', 'np.genfromtxt', (['"""PissingAbout15+16.csv"""'], {'delimiter': '""","""', 'comments': '"""#"""', 'skip_header': '(1)'}), "('PissingAbout15+16.csv', delimiter=',', comments='#',\n skip_header=1)\n", (640, 713), True, 'import numpy as np\n'), ((7089, 7175), 'numpy.genfromtxt', 'np.g...
import streamlit as st import numpy as np import pandas as pd import requests import re import altair as alt # Find all available data def find_all_spreadsheets(): available_data = {} r = requests.get('https://www.football-data.co.uk/downloadm.php') if r.status_code != 200: print('Oh dear. Error {}...
[ "streamlit.markdown", "numpy.ceil", "pandas.read_csv", "pandas.merge", "streamlit.write", "requests.get", "streamlit.sidebar.checkbox", "streamlit.text", "numpy.linspace", "pandas.read_excel", "streamlit.sidebar.selectbox", "streamlit.selectbox", "pandas.DataFrame", "re.findall", "pandas...
[((24432, 24443), 'streamlit.text', 'st.text', (['""""""'], {}), "('')\n", (24439, 24443), True, 'import streamlit as st\n'), ((24732, 24772), 'streamlit.sidebar.checkbox', 'st.sidebar.checkbox', (['"""Order specific"""', '(1)'], {}), "('Order specific', 1)\n", (24751, 24772), True, 'import streamlit as st\n'), ((24831...
import json import requests import tempfile import shutil import subprocess import os import logging import urllib.request from multiprocessing import Pool import app.easyCI.docker as docker from contextlib import contextmanager LOG = logging.getLogger(__name__) CONFIG = "config.json" PASSWORDS = "<PASSWORD>" MAX_COM...
[ "logging.getLogger", "subprocess.check_call", "os.path.join", "tempfile.mkdtemp", "multiprocessing.Pool", "os.mkdir", "shutil.rmtree", "json.load", "os.path.abspath" ]
[((237, 264), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (254, 264), False, 'import logging\n'), ((3765, 3786), 'multiprocessing.Pool', 'Pool', ([], {'processes': 'PROCS'}), '(processes=PROCS)\n', (3769, 3786), False, 'from multiprocessing import Pool\n'), ((647, 679), 'tempfile.mkdte...
from django.contrib.gis.geos import Point from data_collection.management.commands import BaseShpStationsShpDistrictsImporter class Command(BaseShpStationsShpDistrictsImporter): srid = 27700 council_id = "W06000021" districts_name = "polling_district" stations_name = "polling_station.shp" election...
[ "django.contrib.gis.geos.Point" ]
[((1143, 1176), 'django.contrib.gis.geos.Point', 'Point', (['(335973)', '(206322)'], {'srid': '(27700)'}), '(335973, 206322, srid=27700)\n', (1148, 1176), False, 'from django.contrib.gis.geos import Point\n')]
# -*- coding: UTF-8 -*- ####################################################################### # ---------------------------------------------------------------------------- # "THE BEER-WARE LICENSE" (Revision 42): # @Daddy_Blamo wrote this file. As long as you retain this notice you # can do whatever you want wi...
[ "urlparse.urljoin", "json.loads", "urlparse.parse_qs", "resources.lib.modules.source_utils.is_host_valid", "urllib.urlencode", "re.sub" ]
[((1876, 1898), 'urlparse.parse_qs', 'urlparse.parse_qs', (['url'], {}), '(url)\n', (1893, 1898), False, 'import urlparse\n'), ((2058, 2080), 'urllib.urlencode', 'urllib.urlencode', (['data'], {}), '(data)\n', (2074, 2080), False, 'import urllib\n'), ((2198, 2214), 'json.loads', 'json.loads', (['data'], {}), '(data)\n'...
import cv2 import numpy as np import argparse def main(image_file_path): img = cv2.imread(image_file_path) img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) name_window_1 = "original" name_window_2 = "grayscale" while True: cv2.imshow(name_window_1, img) cv2.imshow(name_window_2, im...
[ "argparse.ArgumentParser", "cv2.imshow", "cv2.waitKey", "cv2.destroyAllWindows", "cv2.cvtColor", "cv2.imread" ]
[((84, 111), 'cv2.imread', 'cv2.imread', (['image_file_path'], {}), '(image_file_path)\n', (94, 111), False, 'import cv2\n'), ((127, 164), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2GRAY'], {}), '(img, cv2.COLOR_BGR2GRAY)\n', (139, 164), False, 'import cv2\n'), ((475, 498), 'cv2.destroyAllWindows', 'cv2.de...
"""Update maritime data using update modules""" from __future__ import annotations from argparse import ArgumentParser import base64 import hashlib import os import shelve import toml from .modules import get_update_module def main(): parser = ArgumentParser(description=__doc__) parser.add_argument('config...
[ "argparse.ArgumentParser", "base64.urlsafe_b64encode", "os.path.realpath", "shelve.open", "toml.load" ]
[((253, 288), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (267, 288), False, 'from argparse import ArgumentParser\n'), ((395, 421), 'toml.load', 'toml.load', (['args.configfile'], {}), '(args.configfile)\n', (404, 421), False, 'import toml\n'), ((507, 540), ...
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-15 08:30 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('review', '0003_auto_20170314_2217'), ] operations ...
[ "django.db.models.OneToOneField", "django.db.models.FloatField", "django.db.models.TextField", "django.db.models.ForeignKey", "django.db.models.AutoField", "django.db.models.DateTimeField", "django.db.models.PositiveSmallIntegerField", "django.db.models.CharField" ]
[((1885, 1951), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'blank': '(True)', 'verbose_name': '"""End of this phase"""'}), "(blank=True, verbose_name='End of this phase')\n", (1905, 1951), False, 'from django.db import migrations, models\n'), ((2076, 2144), 'django.db.models.DateTimeField', 'models...
from ..helpers import IFPTestCase from intficpy.things import Thing, Container, Liquid class TestDropVerb(IFPTestCase): def test_verb_func_drops_item(self): item = Thing(self.game, self._get_unique_noun()) item.invItem = True self.me.addThing(item) self.assertIn(item.ix, self.me.c...
[ "intficpy.things.Liquid", "intficpy.things.Container", "intficpy.things.Thing" ]
[((679, 703), 'intficpy.things.Thing', 'Thing', (['self.game', '"""shoe"""'], {}), "(self.game, 'shoe')\n", (684, 703), False, 'from intficpy.things import Thing, Container, Liquid\n'), ((1014, 1041), 'intficpy.things.Container', 'Container', (['self.game', '"""cup"""'], {}), "(self.game, 'cup')\n", (1023, 1041), False...
from django.contrib.auth.models import User from django.core.urlresolvers import reverse from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render from woot.apps.catalog.models.forum import Question, Answer from woot.apps.catalog.models.core import Makey, Comment from woot.ap...
[ "django.shortcuts.render", "woot.apps.catalog.forms.CommentForm", "woot.apps.catalog.models.forum.Question", "django.shortcuts.get_object_or_404", "django.core.urlresolvers.reverse", "woot.apps.catalog.models.forum.Answer", "woot.apps.catalog.forms.QuestionForm", "woot.apps.catalog.forms.AnswerForm", ...
[((438, 481), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Question'], {'id': 'question_id'}), '(Question, id=question_id)\n', (455, 481), False, 'from django.shortcuts import get_object_or_404, render\n'), ((1083, 1137), 'django.shortcuts.render', 'render', (['request', '"""catalog/question_page.html"...
"""计算分位数""" from scipy import stats import numpy as np S = 47 N = 100 a = S + 1 b = (N -S) + 1 alpha = 0.05 lu = stats.beta.ppf([alpha/2, 1-alpha/2], a, b) print(lu) ## MC方法 S = 1000 X = stats.beta.rvs(a, b, size=S) X = np.sort(X, axis=0) l = X[round(S*alpha/2)] u = X[round(S*(1-alpha)/2)] print(l,u)
[ "numpy.sort", "scipy.stats.beta.rvs", "scipy.stats.beta.ppf" ]
[((115, 163), 'scipy.stats.beta.ppf', 'stats.beta.ppf', (['[alpha / 2, 1 - alpha / 2]', 'a', 'b'], {}), '([alpha / 2, 1 - alpha / 2], a, b)\n', (129, 163), False, 'from scipy import stats\n'), ((190, 218), 'scipy.stats.beta.rvs', 'stats.beta.rvs', (['a', 'b'], {'size': 'S'}), '(a, b, size=S)\n', (204, 218), False, 'fro...
from re_calc.config import * from re_calc.exceptions import CalcException from re_calc.util import is_number import re_calc.meta_containers as meta_containers def peek(stack): return stack[-1] def should_move_to_queue(stack, c_token_prc): ''' Checks token's precedence and associativity to decide if it should...
[ "re_calc.util.is_number", "re_calc.meta_containers.set_meta_indices", "re_calc.exceptions.CalcException", "re_calc.meta_containers.pack_list" ]
[((1709, 1749), 're_calc.meta_containers.set_meta_indices', 'meta_containers.set_meta_indices', (['tokens'], {}), '(tokens)\n', (1741, 1749), True, 'import re_calc.meta_containers as meta_containers\n'), ((4315, 4362), 're_calc.meta_containers.pack_list', 'meta_containers.pack_list', (['output_queue', 'tokens'], {}), '...
# Copyright (c) 2021 PPViT Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable l...
[ "numpy.clip", "numpy.sqrt", "paddle.matmul", "paddle.nn.Sequential", "paddle.nn.LayerNorm", "paddle.nn.LayerList", "fold.fold", "paddle.nn.AvgPool2D", "numpy.random.beta", "paddle.nn.initializer.XavierUniform", "paddle.nn.Softmax", "paddle.nn.Unfold", "paddle.nn.Linear", "paddle.nn.initial...
[((20249, 20267), 'numpy.sqrt', 'np.sqrt', (['(1.0 - lam)'], {}), '(1.0 - lam)\n', (20256, 20267), True, 'import numpy as np\n'), ((20279, 20298), 'numpy.int', 'np.int', (['(W * cut_rat)'], {}), '(W * cut_rat)\n', (20285, 20298), True, 'import numpy as np\n'), ((20311, 20330), 'numpy.int', 'np.int', (['(H * cut_rat)'],...
#!env python3 """ Introducing static object in the world. Tasks: 1. File got really long - move all classes to library file and import them here. """ import pygame from pygame import K_ESCAPE, K_LEFT, K_RIGHT, K_UP, K_DOWN, QUIT class Game(): def __init__(self): """ Set basic configura...
[ "pygame.init", "pygame.event.get", "pygame.display.set_mode", "pygame.display.flip", "pygame.time.Clock", "pygame.image.load" ]
[((3352, 3370), 'pygame.event.get', 'pygame.event.get', ([], {}), '()\n', (3368, 3370), False, 'import pygame\n'), ((4695, 4708), 'pygame.init', 'pygame.init', ([], {}), '()\n', (4706, 4708), False, 'import pygame\n'), ((4957, 5027), 'pygame.display.set_mode', 'pygame.display.set_mode', (["[game.screen['width'], game.s...
# -*- coding: utf-8 -*- """ Created on Wed Nov 29 00:56:43 2017 @author: roshi """ import pandas as pd import matplotlib.pyplot as plt import dash import dash_core_components as dcc import dash_html_components as html import plotly.graph_objs as go from app import app data = pd.read_csv('./data/youth_to...
[ "pandas.read_csv", "dash.dependencies.Output", "dash.dependencies.Input", "dash_core_components.Dropdown", "plotly.graph_objs.Layout", "dash_core_components.Graph" ]
[((292, 340), 'pandas.read_csv', 'pd.read_csv', (['"""./data/youth_tobacco_analysis.csv"""'], {}), "('./data/youth_tobacco_analysis.csv')\n", (303, 340), True, 'import pandas as pd\n'), ((534, 569), 'pandas.read_csv', 'pd.read_csv', (['"""./data/question2.csv"""'], {}), "('./data/question2.csv')\n", (545, 569), True, '...
from phc.easy.patients.name import expand_name_value def test_name(): assert expand_name_value( [{"text": "ARA251 LO", "given": ["ARA251"], "family": "LO"}] ) == {"name_given_0": "ARA251", "name_family": "LO"} def test_name_with_multiple_values(): # NOTE: Official names are preferred first and t...
[ "phc.easy.patients.name.expand_name_value" ]
[((83, 162), 'phc.easy.patients.name.expand_name_value', 'expand_name_value', (["[{'text': 'ARA251 LO', 'given': ['ARA251'], 'family': 'LO'}]"], {}), "([{'text': 'ARA251 LO', 'given': ['ARA251'], 'family': 'LO'}])\n", (100, 162), False, 'from phc.easy.patients.name import expand_name_value\n'), ((384, 558), 'phc.easy.p...
import argparse import datetime import errno import json import logging import os import random import re import shutil import subprocess import sys import time import traceback import zipfile import zlib from functools import wraps from types import SimpleNamespace import psutil import py7zr from artifactory import A...
[ "logging.getLogger", "logging.StreamHandler", "iss_templates.uninstall_iss.format", "zipfile.ZipFile", "py7zr.SevenZipFile", "time.sleep", "artifactory_du.artifactory_du.prepare_aql", "random.getrandbits", "artifactory.ArtifactoryPath", "logging.info", "logging.error", "os.walk", "os.remove"...
[((60795, 60824), 'os.path.dirname', 'os.path.dirname', (['logging_file'], {}), '(logging_file)\n', (60810, 60824), False, 'import os\n'), ((61038, 61189), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'logging_file', 'format': '"""%(asctime)s (%(levelname)s) %(message)s"""', 'level': 'logging.INFO', ...
import unittest from dmLibrary import create_app from dmLibrary.external.googleBook import GoogleBook import time import logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) class TestClass(unittest.TestCase): def setUp(self): app = create_app() self.ctx = app.app_c...
[ "logging.basicConfig", "dmLibrary.create_app", "logging.getLogger", "dmLibrary.external.googleBook.GoogleBook" ]
[((130, 169), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (149, 169), False, 'import logging\n'), ((179, 206), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (196, 206), False, 'import logging\n'), ((279, 291), 'dmLibrary.create...
# pylint: disable=global-statement """ Module providing unittest test discovery hook for our Doctest testcases Copyright (C) 2015, 2016 ERT Inc. """ import unittest import doctest from time import sleep from api import app_module as app from api import ( config_loader ,aes ,json ,resource_util ) __au...
[ "time.sleep", "doctest.DocTestSuite", "api.app_module.pentaho_controller.stop", "api.app_module.pentaho_controller.status" ]
[((926, 951), 'doctest.DocTestSuite', 'doctest.DocTestSuite', (['app'], {}), '(app)\n', (946, 951), False, 'import doctest\n'), ((581, 612), 'api.app_module.pentaho_controller.status', 'app.pentaho_controller.status', ([], {}), '()\n', (610, 612), True, 'from api import app_module as app\n'), ((718, 726), 'time.sleep',...
from __future__ import absolute_import from __future__ import print_function import unittest from aiida.manage.fixtures import PluginTestCase import subprocess, os def backend_obj_users(): """Test if aiida accesses users through backend object.""" backend_obj_flag = False try: from aiida.backends...
[ "aiida_yambo.calculations.gw.YamboCalculation", "subprocess.check_output", "aiida.orm.computer.Computer", "aiida.orm.nodes.remote.RemoteData", "aiida.work.set_runner", "aiida.orm.nodes.structure.StructureData", "aiida.load_profile", "aiida.work.Runner", "os.environ.copy", "aiida_quantumespresso.ca...
[((1206, 1220), 'aiida.load_profile', 'load_profile', ([], {}), '()\n', (1218, 1220), False, 'from aiida import load_profile\n'), ((754, 773), 'aiida.orm.backend.construct_backend', 'construct_backend', ([], {}), '()\n', (771, 773), False, 'from aiida.orm.backend import construct_backend\n'), ((962, 982), 'aiida.backen...
#!/usr/bin/env python # -*- coding:utf-8 -*- # @FileName : knn.py # @Time : 2020/9/25 12:29 # @Author : 陈嘉昕 # @Demand : k-临近算法,和训练的模型作比较 import csv import math import operator from random import shuffle import matplotlib.pyplot as plt # 数据集 training_set = [] # 测试集 test_set = [] def cross_validation(fil...
[ "matplotlib.pyplot.savefig", "random.shuffle", "matplotlib.pyplot.ylabel", "matplotlib.pyplot.xlabel", "math.sqrt", "operator.itemgetter", "csv.reader", "matplotlib.pyplot.show" ]
[((885, 909), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Value of K"""'], {}), "('Value of K')\n", (895, 909), True, 'import matplotlib.pyplot as plt\n'), ((914, 936), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Accuracy"""'], {}), "('Accuracy')\n", (924, 936), True, 'import matplotlib.pyplot as plt\n'), ((941...
# -*- coding: UTF-8 -*- import cv2 import numpy as np # 仿射变换(图像位置校正) def img_three(imgPath): # ---------------------------三点得到一个变换矩阵 --------------------------- """ 三点确定一个平面,通过确定三个点的关系来得到转换矩阵 然后再通过warpAffine来进行变换 """ img = cv2.imread(imgPath) rows,cols,_ = img.shape points1 ...
[ "cv2.warpAffine", "cv2.getPerspectiveTransform", "cv2.imshow", "cv2.waitKey", "cv2.warpPerspective", "cv2.destroyAllWindows", "cv2.getAffineTransform", "cv2.imread", "numpy.float32" ]
[((260, 279), 'cv2.imread', 'cv2.imread', (['imgPath'], {}), '(imgPath)\n', (270, 279), False, 'import cv2\n'), ((322, 366), 'numpy.float32', 'np.float32', (['[[50, 50], [200, 50], [50, 200]]'], {}), '([[50, 50], [200, 50], [50, 200]])\n', (332, 366), True, 'import numpy as np\n'), ((376, 422), 'numpy.float32', 'np.flo...
import os from pathlib import Path from shutil import copyfile def stu_activities(rootDir): # set the rootDir where the search will start # that is in home dorectory #rootDir = "Downloads" # build rootDir from rootDir with the base as home "~" rootDir = os.path.join(Path.home(),rootDir) ...
[ "os.path.exists", "os.makedirs", "pathlib.Path.home", "os.path.join", "shutil.copyfile", "os.walk" ]
[((549, 579), 'os.path.join', 'os.path.join', (['curDir', '"""target"""'], {}), "(curDir, 'target')\n", (561, 579), False, 'import os\n'), ((740, 756), 'os.walk', 'os.walk', (['rootDir'], {}), '(rootDir)\n', (747, 756), False, 'import os\n'), ((295, 306), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (304, 306), ...
import matplotlib.pyplot as plt import numpy as np def plot(ac): ac=np.array(ac) ac=ac.reshape((28,28)) ac=[[int(ac2+0.48) for ac2 in ac1] for ac1 in ac] plt.imshow(ac) f=np.load("model.npz",allow_pickle=True) f2=np.load("model2.npz",allow_pickle=True) f3=np.load("model3.npz",allow_pickle=True) f4=np.load...
[ "matplotlib.pyplot.imshow", "numpy.mean", "numpy.where", "numpy.array", "numpy.dot", "numpy.maximum", "numpy.load" ]
[((185, 224), 'numpy.load', 'np.load', (['"""model.npz"""'], {'allow_pickle': '(True)'}), "('model.npz', allow_pickle=True)\n", (192, 224), True, 'import numpy as np\n'), ((227, 267), 'numpy.load', 'np.load', (['"""model2.npz"""'], {'allow_pickle': '(True)'}), "('model2.npz', allow_pickle=True)\n", (234, 267), True, 'i...
import logging import threading import time from datetime import datetime, timedelta from sqlalchemy import column, func, select from sqlalchemy.orm import SessionTransaction from actions.discord import Discord from actions.telegram import Telegram from common.database import session from common.models import Event, ...
[ "sqlalchemy.func.count", "logging.debug", "sqlalchemy.column", "datetime.datetime.utcnow", "common.database.session.begin", "time.sleep", "actions.discord.Discord", "sqlalchemy.select", "threading.Thread", "datetime.timedelta", "logging.info", "actions.telegram.Telegram" ]
[((388, 398), 'actions.telegram.Telegram', 'Telegram', ([], {}), '()\n', (396, 398), False, 'from actions.telegram import Telegram\n'), ((418, 427), 'actions.discord.Discord', 'Discord', ([], {}), '()\n', (425, 427), False, 'from actions.discord import Discord\n'), ((552, 593), 'logging.info', 'logging.info', (['"""Eve...
from math import sqrt, ceil def isPrime(x): """Primality test. Param x: int. Returns True if x is prime, False otherwise. """ if x <= 0: return False elif x == 2 or x == 3: return True else: for i in range(2, ceil(sqrt(x)) + 1): if x % i == 0: ...
[ "math.sqrt" ]
[((270, 277), 'math.sqrt', 'sqrt', (['x'], {}), '(x)\n', (274, 277), False, 'from math import sqrt, ceil\n')]
import sys, os import shutil def SilentMkdir(theDir): try: os.mkdir(theDir) except: pass return 0 def Run_00_CameraInit(baseDir, binDir, srcImageDir): # SilentMkdir(baseDir + "/00_CameraInit") binName = binDir + "\\aliceVision_cameraInit" # .exe" dstDir = baseDir + "/" # ...
[ "os.mkdir", "sys.exit" ]
[((73, 89), 'os.mkdir', 'os.mkdir', (['theDir'], {}), '(theDir)\n', (81, 89), False, 'import sys, os\n'), ((12981, 12992), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (12989, 12992), False, 'import sys, os\n')]
from django import forms from . import widgets from .models import Ticket, TicketItem #Creating html forms. # Each class interacts with a model. Fields for a form are chosen in 'fields' class TicketForm(forms.ModelForm): #setting timeDue to have specific formatting timeDue = forms.DateTimeField( input_...
[ "django.forms.BooleanField" ]
[((679, 723), 'django.forms.BooleanField', 'forms.BooleanField', ([], {'required': '(False)', 'label': '""""""'}), "(required=False, label='')\n", (697, 723), False, 'from django import forms\n')]
from django.test import TestCase from django.contrib.auth import get_user_model class ModelTests(TestCase): def test_create_user_with_emamil_successful(self): """Test creating a new user with an email is successful""" email = '<EMAIL>' password = '<PASSWORD>' user = get_user_model().objects.create_...
[ "django.contrib.auth.get_user_model" ]
[((288, 304), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (302, 304), False, 'from django.contrib.auth import get_user_model\n')]