code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# admin_tools/urls.py
# Brought to you by We Vote. Be good.
# -*- coding: UTF-8 -*-
from django.conf.urls import re_path
from . import views
urlpatterns = [
re_path(r'^$', views.admin_home_view, name='admin_home',),
re_path(r'^data_cleanup/$', views.data_cleanup_view, name='data_cleanup'),
re_path(r'^dat... | [
"django.conf.urls.re_path"
] | [((164, 219), 'django.conf.urls.re_path', 're_path', (['"""^$"""', 'views.admin_home_view'], {'name': '"""admin_home"""'}), "('^$', views.admin_home_view, name='admin_home')\n", (171, 219), False, 'from django.conf.urls import re_path\n'), ((227, 299), 'django.conf.urls.re_path', 're_path', (['"""^data_cleanup/$"""', '... |
from .zero import zero
from main_module._unittester import UnitTester
test = UnitTester(__name__)
del UnitTester | [
"main_module._unittester.UnitTester"
] | [((78, 98), 'main_module._unittester.UnitTester', 'UnitTester', (['__name__'], {}), '(__name__)\n', (88, 98), False, 'from main_module._unittester import UnitTester\n')] |
import numpy as np
import numpy.random as npr
import scipy.optimize as spo
import tomo_challenge.metrics as tcm
# custom data type, could be replaced with/tie in to tree.py class
# cut_vals is (nfeat, nbins - 1) numpy array, float
# tree_ids is ((nbins,) * nfeat) numpy array, int
TreePars = namedtuple('TreePars', ['cu... | [
"numpy.unique",
"tomo_challenge.metrics.metric",
"numpy.random.random_integers",
"scipy.optimize.minimize",
"numpy.linspace",
"numpy.concatenate",
"numpy.flatten",
"numpy.shape"
] | [((529, 558), 'numpy.flatten', 'np.flatten', (['treepars.cut_vals'], {}), '(treepars.cut_vals)\n', (539, 558), True, 'import numpy as np\n'), ((569, 598), 'numpy.flatten', 'np.flatten', (['treepars.tree_ids'], {}), '(treepars.tree_ids)\n', (579, 598), True, 'import numpy as np\n'), ((609, 636), 'numpy.concatenate', 'np... |
import glob
import numpy as np
X = np.empty((0, 193))
y = np.empty((0, 10))
groups = np.empty((0, 1))
npz_files = glob.glob('./urban_sound_?.npz')
for fn in npz_files:
print(fn)
data = np.load(fn)
X = np.append(X, data['X'], axis=0)
y = np.append(y, data['y'], axis=0)
groups = np.append(groups, dat... | [
"numpy.savez",
"numpy.append",
"numpy.sum",
"numpy.empty",
"numpy.load",
"glob.glob"
] | [((36, 54), 'numpy.empty', 'np.empty', (['(0, 193)'], {}), '((0, 193))\n', (44, 54), True, 'import numpy as np\n'), ((59, 76), 'numpy.empty', 'np.empty', (['(0, 10)'], {}), '((0, 10))\n', (67, 76), True, 'import numpy as np\n'), ((86, 102), 'numpy.empty', 'np.empty', (['(0, 1)'], {}), '((0, 1))\n', (94, 102), True, 'im... |
import os
import errno
import sys
def mock_directory_tree(tree):
tree = dict([(os.path.join(*key), value) \
for key, value in tree.iteritems()])
def listdir(path):
try:
names = tree[path]
except KeyError:
raise OSError(errno.ENOENT, os.strerror(err... | [
"os.strerror",
"os.path.join",
"sys.meta_path.remove"
] | [((84, 102), 'os.path.join', 'os.path.join', (['*key'], {}), '(*key)\n', (96, 102), False, 'import os\n'), ((406, 432), 'os.strerror', 'os.strerror', (['errno.ENOTDIR'], {}), '(errno.ENOTDIR)\n', (417, 432), False, 'import os\n'), ((3873, 3899), 'sys.meta_path.remove', 'sys.meta_path.remove', (['item'], {}), '(item)\n'... |
import sys
import unittest
try:
from unittest import mock
except ImportError:
import mock
import argparse
from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser
from .common_setup import *
commandname = 'createsiteusers'
class CreateSiteUsersParserTest(unittest.TestCase):
@classmethod... | [
"tabcmd.parsers.create_site_users_parser.CreateSiteUsersParser.create_site_user_parser",
"mock.mock_open"
] | [((445, 513), 'tabcmd.parsers.create_site_users_parser.CreateSiteUsersParser.create_site_user_parser', 'CreateSiteUsersParser.create_site_user_parser', (['manager', 'mock_command'], {}), '(manager, mock_command)\n', (490, 513), False, 'from tabcmd.parsers.create_site_users_parser import CreateSiteUsersParser\n'), ((612... |
import os
from setuptools import setup, find_packages
import versioneer
if __name__ == "__main__":
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
meta = {}
base_dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(base_dir, 'gammy', '_m... | [
"setuptools.find_packages",
"os.path.join",
"versioneer.get_version",
"os.path.dirname",
"os.path.abspath",
"versioneer.get_cmdclass"
] | [((244, 269), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (259, 269), False, 'import os\n'), ((285, 328), 'os.path.join', 'os.path.join', (['base_dir', '"""gammy"""', '"""_meta.py"""'], {}), "(base_dir, 'gammy', '_meta.py')\n", (297, 328), False, 'import os\n'), ((435, 459), 'versioneer.ge... |
# python 3.7
"""Predicts the scene category, attribute."""
import numpy as np
from PIL import Image
import torch
import torch.nn.functional as F
import torchvision.transforms as transforms
from .base_predictor import BasePredictor
from .scene_wideresnet import resnet18
__all__ = ['ScenePredictor']
N... | [
"torch.nn.functional.softmax",
"PIL.Image.fromarray",
"torch.load",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor",
"numpy.load",
"torch.cuda.empty_cache",
"torch.cat"
] | [((1996, 2067), 'torch.load', 'torch.load', (['self.weight_path'], {'map_location': '(lambda storage, loc: storage)'}), '(self.weight_path, map_location=lambda storage, loc: storage)\n', (2006, 2067), False, 'import torch\n'), ((2492, 2538), 'numpy.load', 'np.load', (['self.attribute_additional_weight_path'], {}), '(se... |
from collections import deque
def solution(N, bus_stop):
answer = [[1300 for _ in range(N)] for _ in range(N)]
bus_stop = [(x-1, y-1) for x,y in bus_stop]
q = deque(bus_stop)
for x,y in bus_stop:
answer[x][y] = 0
while q:
x, y = q.popleft()
for nx, ny in ((x-1, y), (x+1, y)... | [
"collections.deque"
] | [((172, 187), 'collections.deque', 'deque', (['bus_stop'], {}), '(bus_stop)\n', (177, 187), False, 'from collections import deque\n')] |
import numpy as np
import torch
from torch.nn import functional as F
from rltoolkit.acm.off_policy import AcMOffPolicy
from rltoolkit.algorithms import DDPG
from rltoolkit.algorithms.ddpg.models import Actor, Critic
class DDPG_AcM(AcMOffPolicy, DDPG):
def __init__(
self, unbiased_update: bool = False, cu... | [
"torch.nn.functional.mse_loss",
"rltoolkit.algorithms.ddpg.models.Critic",
"rltoolkit.algorithms.ddpg.models.Actor",
"torch.mean",
"torch.Tensor",
"numpy.exp",
"torch.tensor",
"torch.nn.functional.softplus",
"torch.sum",
"rltoolkit.algorithms.DDPG.save_model",
"torch.no_grad",
"torch.randn",
... | [((1132, 1206), 'rltoolkit.algorithms.ddpg.models.Actor', 'Actor', (['self.ob_dim'], {'ac_lim': 'self.actor_ac_lim', 'ac_dim': 'self.actor_output_dim'}), '(self.ob_dim, ac_lim=self.actor_ac_lim, ac_dim=self.actor_output_dim)\n', (1137, 1206), False, 'from rltoolkit.algorithms.ddpg.models import Actor, Critic\n'), ((601... |
import io
import sys
from textnn.utils import ProgressIterator
#inspired by https://stackoverflow.com/a/34738440
def capture_sysout(cmd):
capturedOutput = io.StringIO() # Create StringIO object
sys.stdout = capturedOutput # and redirect stdout.
cmd() ... | [
"io.StringIO",
"textnn.utils.ProgressIterator"
] | [((161, 174), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (172, 174), False, 'import io\n'), ((575, 630), 'textnn.utils.ProgressIterator', 'ProgressIterator', (['[1, 2, 3]'], {'interval': '(0)', 'description': '""""""'}), "([1, 2, 3], interval=0, description='')\n", (591, 630), False, 'from textnn.utils import Prog... |
# -*- coding: utf-8 -*-
"""Highlevel wrapper of the VISA Library.
:copyright: 2014-2020 by PyVISA-py Authors, see AUTHORS for more details.
:license: MIT, see LICENSE for more details.
"""
import random
from collections import OrderedDict
from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, cast
fr... | [
"pyvisa.typing.VISASession",
"collections.OrderedDict",
"pyvisa.rname.filter",
"pyvisa.rname.parse_resource_name",
"pyvisa.util.LibraryPath",
"typing.cast",
"random.randint"
] | [((2771, 2784), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2782, 2784), False, 'from collections import OrderedDict\n'), ((15966, 15996), 'pyvisa.rname.filter', 'rname.filter', (['resources', 'query'], {}), '(resources, query)\n', (15978, 15996), False, 'from pyvisa import constants, highlevel, rname\... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import cv2
import numpy as np
import os
import math
from PIL import Image, ImageDraw, ImageFont
from caffe2.python import workspace
from detectron.core.config import cf... | [
"cv2.rectangle",
"os.path.exists",
"cv2.imwrite",
"numpy.abs",
"os.makedirs",
"math.floor",
"numpy.where",
"detectron.core.config.get_output_dir",
"os.path.join",
"PIL.ImageFont.truetype",
"numpy.asarray",
"cv2.putText",
"numpy.argsort",
"numpy.sum",
"PIL.ImageDraw.Draw",
"numpy.true_d... | [((602, 651), 'detectron.core.config.get_output_dir', 'get_output_dir', (['cfg.TRAIN.DATASETS'], {'training': '(True)'}), '(cfg.TRAIN.DATASETS, training=True)\n', (616, 651), False, 'from detectron.core.config import get_output_dir\n'), ((669, 709), 'os.path.join', 'os.path.join', (['output_dir', '"""webly_sample"""'],... |
# -*- coding: utf-8 -*-
'''
Execute salt convenience routines
'''
# Import python libs
from __future__ import print_function
from __future__ import absolute_import
import collections
import logging
import time
import sys
import multiprocessing
# Import salt libs
import salt.exceptions
import salt.loader
import salt.m... | [
"logging.getLogger",
"salt.utils.event.tagify",
"multiprocessing.Process",
"time.sleep",
"salt.ext.six.iteritems",
"salt.utils.error.raise_error",
"sys.exit",
"time.time"
] | [((572, 599), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (589, 599), False, 'import logging\n'), ((5758, 5773), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (5768, 5773), False, 'import time\n'), ((9665, 9695), 'salt.utils.event.tagify', 'tagify', (['"""ret"""'], {'base': "... |
# For usage of lark with PyInstaller. See https://pyinstaller-sample-hook.readthedocs.io/en/latest/index.html
import os
def get_hook_dirs():
return [os.path.dirname(__file__)] | [
"os.path.dirname"
] | [((160, 185), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (175, 185), False, 'import os\n')] |
import click
from arbol.arbol import aprint, asection
from dexp.cli.defaults import DEFAULT_CLEVEL, DEFAULT_CODEC, DEFAULT_STORE
from dexp.cli.parsing import _get_output_path, _parse_channels, _parse_chunks
from dexp.datasets.open_dataset import glob_datasets
from dexp.datasets.operations.crop import dataset_crop
@c... | [
"click.argument",
"dexp.cli.parsing._parse_chunks",
"arbol.arbol.aprint",
"click.option",
"dexp.datasets.open_dataset.glob_datasets",
"dexp.datasets.operations.crop.dataset_crop",
"arbol.arbol.asection",
"dexp.cli.parsing._get_output_path",
"click.command",
"dexp.cli.parsing._parse_channels"
] | [((319, 334), 'click.command', 'click.command', ([], {}), '()\n', (332, 334), False, 'import click\n'), ((336, 375), 'click.argument', 'click.argument', (['"""input_paths"""'], {'nargs': '(-1)'}), "('input_paths', nargs=-1)\n", (350, 375), False, 'import click\n'), ((401, 436), 'click.option', 'click.option', (['"""--o... |
import sys
from matplotlib import image as mpimg
import numpy as np
import os
DIPHA_CONST = 8067171840
DIPHA_IMAGE_TYPE_CONST = 1
DIM = 3
input_dir = os.path.join(os.getcwd(), sys.argv[1])
dipha_output_filename = sys.argv[2]
vert_filename = sys.argv[3]
input_filenames = [name
for nam... | [
"os.listdir",
"numpy.int64",
"numpy.float64",
"matplotlib.image.imread",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"numpy.zeros",
"sys.stdout.flush"
] | [((638, 660), 'numpy.zeros', 'np.zeros', (['[nx, ny, nz]'], {}), '([nx, ny, nz])\n', (646, 660), True, 'import numpy as np\n'), ((174, 185), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (183, 185), False, 'import os\n'), ((488, 531), 'os.path.join', 'os.path.join', (['input_dir', 'input_filenames[0]'], {}), '(input_dir,... |
import numpy as np
import matplotlib.pyplot as plt
import math
def normal(mu,sigma,x): #normal distribution
return 1/(math.pi*2)**0.5/sigma*np.exp(-(x-mu)**2/2/sigma**2)
def eval(x):
return normal(-4,1,x) + normal(4,1,x)
#return 0.3*np.exp(-0.2*x**2)+0.7*np.exp(-0.2*(x-10)**2)
def ref(x_star,x): #normal... | [
"numpy.random.normal",
"matplotlib.pyplot.savefig",
"numpy.random.rand",
"numpy.hstack",
"numpy.exp",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.show"
] | [((396, 408), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (406, 408), True, 'import matplotlib.pyplot as plt\n'), ((1126, 1170), 'matplotlib.pyplot.savefig', 'plt.savefig', (['"""MetropolisNormal.png"""'], {'dpi': '(100)'}), "('MetropolisNormal.png', dpi=100)\n", (1137, 1170), True, 'import matplotlib.p... |
import os
from typing import Any, Dict, List, Optional
import carla
from core.simulators.carla_simulator import CarlaSimulator
from core.simulators.carla_data_provider import CarlaDataProvider
from .srunner.scenarios.route_scenario import RouteScenario, SCENARIO_CLASS_DICT
from .srunner.scenariomanager.scenario_mana... | [
"core.simulators.carla_data_provider.CarlaDataProvider.request_new_actor",
"core.simulators.carla_data_provider.CarlaDataProvider.get_map",
"core.simulators.carla_data_provider.CarlaDataProvider.set_world",
"core.simulators.carla_data_provider.CarlaDataProvider.get_hero_vehicle_route",
"core.simulators.carl... | [((4290, 4332), 'core.simulators.carla_data_provider.CarlaDataProvider.set_client', 'CarlaDataProvider.set_client', (['self._client'], {}), '(self._client)\n', (4318, 4332), False, 'from core.simulators.carla_data_provider import CarlaDataProvider\n'), ((4345, 4385), 'core.simulators.carla_data_provider.CarlaDataProvid... |
import myproject
myproject.logs(show_level='debug')
myproject.mymod.do_something()
| [
"myproject.mymod.do_something",
"myproject.logs"
] | [((18, 52), 'myproject.logs', 'myproject.logs', ([], {'show_level': '"""debug"""'}), "(show_level='debug')\n", (32, 52), False, 'import myproject\n'), ((55, 85), 'myproject.mymod.do_something', 'myproject.mymod.do_something', ([], {}), '()\n', (83, 85), False, 'import myproject\n')] |
# -*- coding: utf-8 -*-
#
# Helper Script for Mass-Invitation of Participant Organisations
#
# RLPPTM Template Version 1.0
#
# Execute in web2py folder after code upgrade like:
# python web2py.py -S eden -M -R applications/eden/modules/templates/RLPPTM/tools/mis.py
#
import os
import sys
from core import s3_format_dat... | [
"sys.stderr.write",
"os.path.join",
"core.s3_format_datetime"
] | [((1031, 1071), 'core.s3_format_datetime', 's3_format_datetime', ([], {'dtfmt': '"""%Y%m%d%H%M%S"""'}), "(dtfmt='%Y%m%d%H%M%S')\n", (1049, 1071), False, 'from core import s3_format_datetime\n'), ((1082, 1146), 'os.path.join', 'os.path.join', (['request.folder', '"""private"""', "('mis_%s.log' % timestmp)"], {}), "(requ... |
import json
import logging
from django.core.management.base import BaseCommand
from django.db import transaction
from paprika_sync.core.models import PaprikaAccount
from paprika_sync.core.serializers import RecipeSerializer, CategorySerializer
from paprika_sync.core.utils import log_start_end
logger = logging.getLo... | [
"logging.getLogger",
"django.db.transaction.atomic",
"paprika_sync.core.utils.log_start_end",
"paprika_sync.core.models.PaprikaAccount.objects.get",
"paprika_sync.core.serializers.RecipeSerializer",
"paprika_sync.core.serializers.CategorySerializer",
"json.load"
] | [((307, 334), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (324, 334), False, 'import logging\n'), ((1089, 1110), 'paprika_sync.core.utils.log_start_end', 'log_start_end', (['logger'], {}), '(logger)\n', (1102, 1110), False, 'from paprika_sync.core.utils import log_start_end\n'), ((1469... |
from dataclasses import dataclass, field
@dataclass
class FooTest:
class Meta:
name = "fooTest"
value: str = field(
init=False,
default="Hello"
)
@dataclass
class Root:
class Meta:
name = "root"
foo_test: str = field(
init=False,
default="Hello",... | [
"dataclasses.field"
] | [((128, 162), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': '"""Hello"""'}), "(init=False, default='Hello')\n", (133, 162), False, 'from dataclasses import dataclass, field\n'), ((269, 374), 'dataclasses.field', 'field', ([], {'init': '(False)', 'default': '"""Hello"""', 'metadata': "{'name': 'fooTe... |
import json
import os
from collections import OrderedDict
from copy import deepcopy
import SimpleITK as sitk
from batchgenerators.augmentations.utils import resize_segmentation # resize_softmax_output
from skimage.transform import resize
from torch.optim import lr_scheduler
from torch import nn
import numpy as np
impor... | [
"numpy.prod",
"torch.nn.init.constant_",
"torch.exp",
"numpy.array",
"copy.deepcopy",
"torch.nn.Sigmoid",
"os.listdir",
"numpy.where",
"torch.nn.ModuleList",
"torch.nn.init.kaiming_normal_",
"SimpleITK.GetArrayFromImage",
"batchgenerators.augmentations.utils.resize_segmentation",
"numpy.max"... | [((4533, 4572), 'numpy.pad', 'np.pad', (['image', 'pad_list', 'mode'], {}), '(image, pad_list, mode, **kwargs)\n', (4539, 4572), True, 'import numpy as np\n'), ((13081, 13101), 'torch.exp', 'torch.exp', (['(x - x_max)'], {}), '(x - x_max)\n', (13090, 13101), False, 'import torch\n'), ((16372, 16387), 'numpy.unique', 'n... |
import os
import shutil
import tempfile
import zipfile
def archive_write(archivepath, data, filename, compression, compressionlevel):
"""
Create a file named filename in the archive and write data to it
:param archivepath: The path to the zip-archive
:type archivepath: str
:param data: The data t... | [
"os.path.exists",
"tempfile.TemporaryDirectory",
"zipfile.ZipFile",
"os.path.isfile",
"os.path.dirname",
"os.path.abspath"
] | [((696, 795), 'zipfile.ZipFile', 'zipfile.ZipFile', (['archivepath'], {'mode': '"""a"""', 'compression': 'compression', 'compresslevel': 'compressionlevel'}), "(archivepath, mode='a', compression=compression,\n compresslevel=compressionlevel)\n", (711, 795), False, 'import zipfile\n'), ((1491, 1518), 'os.path.isfile... |
import argparse
import sys
from cliquet.scripts import cliquet
from pyramid.scripts import pserve
from pyramid.paster import bootstrap
def main(args=None):
"""The main routine."""
if args is None:
args = sys.argv[1:]
parser = argparse.ArgumentParser(description="Kinto commands... | [
"cliquet.scripts.cliquet.init_schema",
"pyramid.paster.bootstrap",
"argparse.ArgumentParser",
"pyramid.scripts.pserve.main"
] | [((269, 322), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Kinto commands"""'}), "(description='Kinto commands')\n", (292, 322), False, 'import argparse\n'), ((1148, 1177), 'pyramid.paster.bootstrap', 'bootstrap', (['"""config/kinto.ini"""'], {}), "('config/kinto.ini')\n", (1157, 1177)... |
from django.contrib import admin
from django.contrib.auth.models import User
from .models import Vegetable, Harvest, Transaction, Merchandise, MerchandisePrice
from .models import PurchasedItem, UserProfile, VegetablePrice, StockedVegetable
from .models import MerchandisePhotos
admin.site.register(Vegetable)
admin.sit... | [
"django.contrib.admin.site.register"
] | [((280, 310), 'django.contrib.admin.site.register', 'admin.site.register', (['Vegetable'], {}), '(Vegetable)\n', (299, 310), False, 'from django.contrib import admin\n'), ((311, 348), 'django.contrib.admin.site.register', 'admin.site.register', (['StockedVegetable'], {}), '(StockedVegetable)\n', (330, 348), False, 'fro... |
'''
Summary: Program that implements a routing deamon based on the
RIP version 2 protocol from RFC2453.
Usage: python3 Router.py <router_config_file>
Configuration File:
The user supplies a router configuration file of the format:
[Setting... | [
"struct.calcsize",
"configparser.ConfigParser",
"socket.socket",
"random.randrange",
"threading.Timer",
"time.strftime",
"struct.pack",
"datetime.datetime.now",
"struct.unpack",
"sys.exit",
"random.randint"
] | [((15093, 15116), 'struct.calcsize', 'struct.calcsize', (['FORMAT'], {}), '(FORMAT)\n', (15108, 15116), False, 'import struct\n'), ((16427, 16450), 'struct.calcsize', 'struct.calcsize', (['FORMAT'], {}), '(FORMAT)\n', (16442, 16450), False, 'import struct\n'), ((6336, 6363), 'configparser.ConfigParser', 'configparser.C... |
from django.db import models
class SiteSettings(models.Model):
site_name = models.CharField(max_length=200 , verbose_name='Site Name')
site_url = models.CharField(max_length=200 , verbose_name='Site URL')
site_address = models.CharField(max_length=300 , verbose_name='Site Address')
site_phone = mode... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((83, 141), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'verbose_name': '"""Site Name"""'}), "(max_length=200, verbose_name='Site Name')\n", (99, 141), False, 'from django.db import models\n'), ((158, 215), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'... |
# -*- coding: utf-8 -*-
# vispy: gallery 10
# Copyright (c) Vispy Development Team. All Rights Reserved.
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
import sys
import numpy as np
from vispy import app, gloo, visuals
from vispy.visuals.filters import Clipper, ColorFilter
from vispy.visual... | [
"vispy.app.Canvas",
"numpy.random.normal",
"vispy.gloo.VertexBuffer",
"vispy.visuals.CompoundVisual.__init__",
"vispy.visuals.filters.Clipper",
"vispy.visuals.Visual.__init__",
"vispy.scene.SceneCanvas",
"vispy.scene.visuals.create_visual_node",
"numpy.exp",
"vispy.visuals.shaders.MultiProgram",
... | [((5805, 5891), 'vispy.app.Canvas', 'app.Canvas', ([], {'keys': '"""interactive"""', 'size': '(900, 600)', 'show': '(True)', 'title': '"""Visual Canvas"""'}), "(keys='interactive', size=(900, 600), show=True, title=\n 'Visual Canvas')\n", (5815, 5891), False, 'from vispy import app, gloo, visuals\n'), ((6096, 6141),... |
from unittest import TestCase
from datetime import datetime
import pyarrow as pa
import numpy as np
import pandas as pd
from h1st.schema import SchemaInferrer
class SchemaInferrerTestCase(TestCase):
def test_infer_python(self):
inferrer = SchemaInferrer()
self.assertEqual(inferrer.infer_schema(1)... | [
"pandas.Series",
"pyarrow.date64",
"pyarrow.string",
"numpy.random.random",
"pyarrow.binary",
"h1st.schema.SchemaInferrer",
"numpy.array",
"datetime.datetime.now",
"pyarrow.int64",
"pandas.DataFrame",
"pyarrow.array",
"pyarrow.float64"
] | [((253, 269), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (267, 269), False, 'from h1st.schema import SchemaInferrer\n'), ((1286, 1302), 'h1st.schema.SchemaInferrer', 'SchemaInferrer', ([], {}), '()\n', (1300, 1302), False, 'from h1st.schema import SchemaInferrer\n'), ((1708, 1724), 'h1st.schema.S... |
"""Auxiliary methods."""
import os
import json
from errno import EEXIST
import numpy as np
import seaborn as sns
import cPickle as pickle
import matplotlib.pyplot as plt
sns.set()
DEFAULT_LOG_DIR = 'log'
ATOB_WEIGHTS_FILE = 'atob_weights.h5'
D_WEIGHTS_FILE = 'd_weights.h5'
class MyDict(dict):
"""
Dictionar... | [
"matplotlib.pyplot.imshow",
"seaborn.set",
"numpy.repeat",
"os.makedirs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.clf",
"os.path.join",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.zeros",
"os.path.isdir",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"matplo... | [((172, 181), 'seaborn.set', 'sns.set', ([], {}), '()\n', (179, 181), True, 'import seaborn as sns\n'), ((1798, 1822), 'numpy.zeros', 'np.zeros', (['(h, 2 * w, ch)'], {}), '((h, 2 * w, ch))\n', (1806, 1822), True, 'import numpy as np\n'), ((2920, 2946), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 4)... |
from github import Github
def parseGithubURL(url):
splitURL = url.split('/')
owner = splitURL[3]
repo = splitURL[4]
return {
"owner": owner,
"repo": repo
}
def fetchRepoFiles(owner, repo):
files = []
g = Github('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')
repo = g.get_rep... | [
"github.Github"
] | [((249, 299), 'github.Github', 'Github', (['"""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"""'], {}), "('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')\n", (255, 299), False, 'from github import Github\n')] |
import types
import django.test.testcases
from django.conf import settings
from facetools.models import TestUser
from facetools.common import _create_signed_request
from facetools.test import TestUserNotLoaded
from facetools.signals import sync_facebook_test_user, setup_facebook_test_client
from facetools.common impor... | [
"facetools.models.TestUser.objects.get",
"facetools.common._get_facetools_test_fixture_name",
"facetools.test.TestUserNotLoaded",
"facetools.signals.sync_facebook_test_user.send",
"facetools.common._create_signed_request",
"facetools.models.TestUser.objects.all"
] | [((1433, 1475), 'facetools.common._get_facetools_test_fixture_name', '_get_facetools_test_fixture_name', (['app_name'], {}), '(app_name)\n', (1465, 1475), False, 'from facetools.common import _get_facetools_test_fixture_name\n'), ((947, 1054), 'facetools.common._create_signed_request', '_create_signed_request', (['sett... |
# ---------------------------------
# Prepare the data etc.
# ----------------------------------
import numpy as np
import pandas as pd
# train_x is the training data, train_y is the target values, and test_x is the test data
# stored in pandas DataFrames and Series (numpy arrays also used)
train = pd.read_csv('../in... | [
"numpy.clip",
"pandas.read_csv",
"sklearn.model_selection.TimeSeriesSplit"
] | [((302, 360), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/train_preprocessed.csv"""'], {}), "('../input/sample-data/train_preprocessed.csv')\n", (313, 360), True, 'import pandas as pd\n'), ((437, 494), 'pandas.read_csv', 'pd.read_csv', (['"""../input/sample-data/test_preprocessed.csv"""'], {}), "('../i... |
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client
# Your Account Sid and Auth Token from twilio.com/console
api_key_sid = 'SKXXXX'
api_key_secret = 'your_api_key_secret'
client = Client(api_key_sid, api_key_secret)
did_delete = client.video\
.c... | [
"twilio.rest.Client"
] | [((234, 269), 'twilio.rest.Client', 'Client', (['api_key_sid', 'api_key_secret'], {}), '(api_key_sid, api_key_secret)\n', (240, 269), False, 'from twilio.rest import Client\n')] |
from time import sleep
debug_mode = False
time_to_exit = False
exiting = False
exit_code = 0
def get_debug_mode():
return debug_mode
def trigger_exit(_exit_code):
global time_to_exit, exit_code
exit_code = _exit_code
time_to_exit = True
sleep(0.1)
| [
"time.sleep"
] | [((263, 273), 'time.sleep', 'sleep', (['(0.1)'], {}), '(0.1)\n', (268, 273), False, 'from time import sleep\n')] |
from __future__ import absoulte_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from data import data_utils
data = data_utils
class SequenceWrapperTest(tf.test.TestCase):
def testDefaultTimesteps(self):
seq = data.SequenceWrapper()
t1 = seq.... | [
"tensorflow.test.main"
] | [((6909, 6923), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (6921, 6923), True, 'import tensorflow as tf\n')] |
from collections import OrderedDict
from random import Random
from typing import Set
from .._types import Dataset, Split, LabelIndices
from .._util import per_label
from ._RandomSplitter import RandomSplitter
from ._Splitter import Splitter
class StratifiedSplitter(Splitter):
"""
TODO
"""
def __init_... | [
"random.Random",
"collections.OrderedDict"
] | [((386, 394), 'random.Random', 'Random', ([], {}), '()\n', (392, 394), False, 'from random import Random\n'), ((894, 907), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (905, 907), False, 'from collections import OrderedDict\n'), ((909, 922), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (92... |
""" Module containing the RetryingClient wrapper class. """
from time import sleep
def _ensure_tuple_argument(argument_name, argument_value):
"""
Helper function to ensure the given arguments are tuples of Exceptions (or
subclasses), or can at least be converted to such.
Args:
argument_name: s... | [
"time.sleep"
] | [((5561, 5585), 'time.sleep', 'sleep', (['self._retry_delay'], {}), '(self._retry_delay)\n', (5566, 5585), False, 'from time import sleep\n')] |
# Generated by Django 2.2.2 on 2019-08-25 09:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('classroom', '0024_auto_20190825_1723'),
]
operations = [
migrations.AddField(
model_name='myfile',
name='file',
... | [
"django.db.models.CharField"
] | [((334, 378), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(100)'}), '(blank=True, max_length=100)\n', (350, 378), False, 'from django.db import migrations, models\n')] |
# -*- encoding: utf-8 -*-
from flask import request
from lazyblacksmith.utils.request import is_xhr
import logging
logger = logging.getLogger('lb.ajax')
def is_not_ajax():
"""
Return True if request is not ajax
This function is used in @cache annotation
to not cache direct call (http 40... | [
"logging.getLogger",
"lazyblacksmith.utils.request.is_xhr"
] | [((132, 160), 'logging.getLogger', 'logging.getLogger', (['"""lb.ajax"""'], {}), "('lb.ajax')\n", (149, 160), False, 'import logging\n'), ((348, 363), 'lazyblacksmith.utils.request.is_xhr', 'is_xhr', (['request'], {}), '(request)\n', (354, 363), False, 'from lazyblacksmith.utils.request import is_xhr\n')] |
import os
class Traces:
def __init__(self, positive = set(), negative = set()):
self.positive = positive
self.negative = negative
"""
IG: at the moment we are adding a trace only if it ends up in an event.
should we be more restrictive, e.g. consider xxx, the same as xxxxxxxxxx (wher... | [
"os.path.dirname",
"os.makedirs"
] | [((5457, 5482), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (5472, 5482), False, 'import os\n'), ((5491, 5530), 'os.makedirs', 'os.makedirs', (['parent_path'], {'exist_ok': '(True)'}), '(parent_path, exist_ok=True)\n', (5502, 5530), False, 'import os\n')] |
import django
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
if django.VERSION[:2] > (1, 9):
from django.views.i18n import JavaScriptCatalog
else:
from django.views.i18n import javas... | [
"django.conf.urls.url",
"comp.views.HomepageView.as_view",
"django_comments_xtd.LatestCommentFeed",
"django.conf.urls.include",
"django.views.i18n.JavaScriptCatalog.as_view",
"django_comments_xtd.views.XtdCommentListView.as_view",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.cont... | [((472, 492), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (490, 492), False, 'from django.contrib import admin\n'), ((1626, 1651), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (1649, 1651), False, 'from django.contrib.staticfile... |
import pytest
from katana.dynamic_bitset import DynamicBitset
__all__ = []
SIZE = 50
@pytest.fixture
def dbs():
return DynamicBitset(SIZE)
def test_set(dbs):
dbs[10] = 1
assert dbs[10]
def test_set_invalid_type(dbs):
try:
dbs[2.3] = 0
assert False
except TypeError:
p... | [
"katana.dynamic_bitset.DynamicBitset"
] | [((128, 147), 'katana.dynamic_bitset.DynamicBitset', 'DynamicBitset', (['SIZE'], {}), '(SIZE)\n', (141, 147), False, 'from katana.dynamic_bitset import DynamicBitset\n')] |
import unittest
import astar
class BasicTests(unittest.TestCase):
def test_bestpath(self):
"""ensure that we take the shortest path, and not the path with less elements.
the path with less elements is A -> B with a distance of 100
the shortest path is A -> C -> D -> B with a distanc... | [
"unittest.main",
"astar.find_path"
] | [((1010, 1025), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1023, 1025), False, 'import unittest\n'), ((719, 841), 'astar.find_path', 'astar.find_path', (['"""A"""', '"""B"""'], {'neighbors_fnct': 'neighbors', 'heuristic_cost_estimate_fnct': 'cost', 'distance_between_fnct': 'distance'}), "('A', 'B', neighbors_... |
#!/bin/env python3
import csv
def intersect(list1,list2):
list3 = [ value for value in list1 if value in list2]
return list3
def category(list1,effects):
cat = 'Good'
good = 0
bad = 0
for ing in list1:
if effects[ing]=='Good':
good += 1
else:
bad += 1
... | [
"csv.writer",
"csv.reader"
] | [((550, 584), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (560, 584), False, 'import csv\n'), ((755, 789), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (765, 789), False, 'import csv\n'), ((2176, 2215), 'csv.wri... |
# coding: utf-8
"""
Control-M Services
Provides access to BMC Control-M Services # noqa: E501
OpenAPI spec version: 9.20.215
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from clients.ctm_api_client.conf... | [
"clients.ctm_api_client.configuration.Configuration",
"six.iteritems"
] | [((4101, 4134), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (4114, 4134), False, 'import six\n'), ((1428, 1443), 'clients.ctm_api_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1441, 1443), False, 'from clients.ctm_api_client.configuration import C... |
# -*- coding: utf-8 -*-
"""
Pytorch models
__author__ = 'Jamie (<EMAIL>)'
__copyright__ = 'No copyright. Just copyleft!'
"""
# pylint: disable=no-member
# pylint: disable=invalid-name
###########
# imports #
###########
import torch
import torch.nn as nn
from embedder import Embedder
from pos_models import PosTag... | [
"torch.nn.MaxPool1d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"sru.SRU",
"torch.nn.Sequential",
"torch.nn.LSTM",
"torch.nn.BatchNorm1d",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.nn.Conv1d",
"torch.cat",
"torch.nn.GRU"
] | [((1774, 1799), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1797, 1799), False, 'import torch\n'), ((1871, 1896), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1894, 1896), False, 'import torch\n'), ((2117, 2142), 'torch.cuda.is_available', 'torch.cuda.is_availabl... |
# coding: utf-8
import os.path
try:
from setuptools import setup
extras = dict(zip_safe=False, test_suite='nose.collector', tests_require=['nose'])
except ImportError:
from distutils.core import setup
extras = {}
import apscheduler
here = os.path.dirname(__file__)
readme_path = os.path.join(here, 'R... | [
"distutils.core.setup"
] | [((367, 1185), 'distutils.core.setup', 'setup', ([], {'name': '"""APScheduler"""', 'version': 'apscheduler.release', 'description': '"""In-process task scheduler with Cron-like capabilities"""', 'long_description': 'readme', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://pypi.python.org/py... |
import os
import sys
import random
def get_next_wallpaper(curr_path):
lst_dir = os.listdir()
rand_index = random.randint(0, len(lst_dir) - 1)
return lst_dir[rand_index]
def get_wall_dir():
return "/Users/MYOUNG/Pictures/mmt"
def main():
script = "osascript -e 'tell application \"Finder\" to s... | [
"os.system",
"os.listdir"
] | [((86, 98), 'os.listdir', 'os.listdir', ([], {}), '()\n', (96, 98), False, 'import os\n'), ((514, 531), 'os.system', 'os.system', (['script'], {}), '(script)\n', (523, 531), False, 'import os\n')] |
"""Automated CI tools to run with Nox"""
import nox
from nox import Session
locations = "src", "noxfile.py", "docs/conf.py"
nox.options.sessions = "lint", "tests"
@nox.session(python="3.9")
def tests(session: Session) -> None:
"""Run tests with nox"""
session.run("poetry", "install", external=True)
sessi... | [
"nox.session"
] | [((167, 192), 'nox.session', 'nox.session', ([], {'python': '"""3.9"""'}), "(python='3.9')\n", (178, 192), False, 'import nox\n'), ((349, 374), 'nox.session', 'nox.session', ([], {'python': '"""3.9"""'}), "(python='3.9')\n", (360, 374), False, 'import nox\n'), ((728, 753), 'nox.session', 'nox.session', ([], {'python': ... |
__version__ = "2.1.1"
# Work around to update TensorFlow's absl.logging threshold which alters the
# default Python logging output behavior when present.
# see: https://github.com/abseil/abseil-py/issues/99
# and: https://github.com/tensorflow/tensorflow/issues/26691#issuecomment-500369493
try:
import absl.logging... | [
"logging.getLogger"
] | [((494, 521), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (511, 521), False, 'import logging\n')] |
#!/usr/bin/env python
"""
Info: This script loads the model trained in the cnn-asl.py script and enables the user to use it for classifying unseen ASL letters. It also visualizes the feature map of the last convolutional layer of the network to enable the user to get an insight into exactly which parts of the original ... | [
"numpy.uint8",
"tensorflow.multiply",
"tensorflow.GradientTape",
"os.listdir",
"tensorflow.keras.backend.mean",
"argparse.ArgumentParser",
"numpy.max",
"tensorflow.keras.models.Model",
"numpy.maximum",
"tensorflow.keras.preprocessing.image.img_to_array",
"tensorflow.keras.preprocessing.image.loa... | [((960, 978), 'os.path.join', 'os.path.join', (['""".."""'], {}), "('..')\n", (972, 978), False, 'import os\n'), ((1486, 1511), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1509, 1511), False, 'import argparse\n'), ((2663, 2737), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""', '"... |
from Algorithmia import ADK
# API calls will begin at the apply() method, with the request body passed as 'input'
# For more details, see algorithmia.com/developers/algorithm-development/languages
def apply(input):
# If your apply function uses state that's loaded into memory via load, you can pass that loaded s... | [
"Algorithmia.ADK"
] | [((677, 687), 'Algorithmia.ADK', 'ADK', (['apply'], {}), '(apply)\n', (680, 687), False, 'from Algorithmia import ADK\n')] |
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
"logging.getLogger",
"autogluon.tabular.TabularPredictor",
"gluonts.time_feature.time_features_from_frequency_str",
"gluonts.time_feature.get_lags_for_frequency",
"gluonts.dataset.util.to_pandas",
"pandas.concat",
"gluonts.core.component.validated"
] | [((1145, 1172), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1162, 1172), False, 'import logging\n'), ((2824, 2835), 'gluonts.core.component.validated', 'validated', ([], {}), '()\n', (2833, 2835), False, 'from gluonts.core.component import validated\n'), ((3622, 3655), 'gluonts.time_f... |
from XDR_iocs import *
import pytest
from freezegun import freeze_time
Client.severity = 'INFO'
client = Client({'url': 'test'})
def d_sort(in_dict):
return sorted(in_dict.items())
class TestGetHeaders:
@freeze_time('2020-06-01T00:00:00Z')
def test_sanity(self, mocker):
"""
Given:
... | [
"pytest.mark.parametrize",
"freezegun.freeze_time"
] | [((218, 253), 'freezegun.freeze_time', 'freeze_time', (['"""2020-06-01T00:00:00Z"""'], {}), "('2020-06-01T00:00:00Z')\n", (229, 253), False, 'from freezegun import freeze_time\n'), ((2243, 2330), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""res, expected_output"""', 'data_test_http_request_error_codes'],... |
from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal
from math import ceil, floor, log2
from typing import Union
import torch
from ppq.core import RoundingPolicy
def ppq_numerical_round(value: float,
policy: RoundingPolicy=RoundingPolicy.ROUND_HALF_EVEN) -> int:
"""
reference... | [
"math.ceil",
"math.floor",
"torch.floor",
"math.log2",
"torch.sign",
"torch.ceil",
"decimal.Decimal"
] | [((1397, 1411), 'decimal.Decimal', 'Decimal', (['value'], {}), '(value)\n', (1404, 1411), False, 'from decimal import ROUND_HALF_DOWN, ROUND_HALF_EVEN, ROUND_HALF_UP, Decimal\n'), ((1425, 1435), 'decimal.Decimal', 'Decimal', (['(1)'], {}), '(1)\n', (1432, 1435), False, 'from decimal import ROUND_HALF_DOWN, ROUND_HALF_E... |
from django.conf.urls import patterns, url
from roomsensor import views
urlpatterns = patterns('',
url(r'^$', views.index, name='roomsensor'),
# ex: /roomsensor/name/
url(r'^(?P<roomsensor_name>\w+)/$', views.display, name='roomsensor_display'),
url(r'^(?P<roomsensor_name>\w+)/read/$', views.read, na... | [
"django.conf.urls.url"
] | [((105, 146), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""roomsensor"""'}), "('^$', views.index, name='roomsensor')\n", (108, 146), False, 'from django.conf.urls import patterns, url\n'), ((182, 259), 'django.conf.urls.url', 'url', (['"""^(?P<roomsensor_name>\\\\w+)/$"""', 'views.display']... |
import numpy as np
from collections import defaultdict, Counter
import random
import json
from tqdm import tqdm
def transX(dataset):
rel2id = json.load(open(dataset + '/relation2ids'))
ent2id = json.load(open(dataset + '/ent2ids'))
with open('../Fast-TransX/' + dataset + '_base/entity2id.txt', 'w') as... | [
"tqdm.tqdm"
] | [((874, 885), 'tqdm.tqdm', 'tqdm', (['lines'], {}), '(lines)\n', (878, 885), False, 'from tqdm import tqdm\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""The setup script."""
from setuptools import setup, find_packages
with open("README.rst") as readme_file:
readme = readme_file.read()
with open("HISTORY.rst") as history_file:
history = history_file.read()
requirements = ["Click>=6.0", "suds2==0.7.1"]
setup_... | [
"setuptools.find_packages"
] | [((769, 800), 'setuptools.find_packages', 'find_packages', ([], {'include': "['runa']"}), "(include=['runa'])\n", (782, 800), False, 'from setuptools import setup, find_packages\n')] |
import time
import board
import displayio
import busio
from analogio import AnalogIn
import neopixel
import adafruit_adt7410
from adafruit_bitmap_font import bitmap_font
from adafruit_display_text.label import Label
from adafruit_button import Button
import adafruit_touchscreen
from adafruit_pyportal import PyPortal
#... | [
"adafruit_bitmap_font.bitmap_font.load_font",
"busio.I2C",
"analogio.AnalogIn",
"adafruit_button.Button",
"board.DISPLAY.show",
"displayio.Group",
"adafruit_touchscreen.Touchscreen",
"time.sleep",
"displayio.ColorConverter",
"neopixel.NeoPixel",
"adafruit_adt7410.ADT7410",
"adafruit_pyportal.P... | [((417, 448), 'busio.I2C', 'busio.I2C', (['board.SCL', 'board.SDA'], {}), '(board.SCL, board.SDA)\n', (426, 448), False, 'import busio\n'), ((455, 500), 'adafruit_adt7410.ADT7410', 'adafruit_adt7410.ADT7410', (['i2c_bus'], {'address': '(72)'}), '(i2c_bus, address=72)\n', (479, 500), False, 'import adafruit_adt7410\n'),... |
from astropy import coordinates as coord
from astropy import wcs
from astropy.io import fits
from astropy import units as u
from misc import bcolors
import numpy as np
import os
def convert_hms_dd(RA, DEC):
'''
Convert HMS to DD system
'''
if (':' in RA) and (':' in DEC):
Coord_dd = coord.SkyCoord(RA, DEC... | [
"astropy.io.fits.getheader",
"astropy.coordinates.SkyCoord",
"numpy.array",
"os.popen",
"astropy.io.fits.open",
"os.system",
"astropy.wcs.WCS",
"astropy.wcs.utils.proj_plane_pixel_scales"
] | [((736, 756), 'astropy.io.fits.getheader', 'fits.getheader', (['FILE'], {}), '(FILE)\n', (750, 756), False, 'from astropy.io import fits\n'), ((841, 856), 'astropy.io.fits.open', 'fits.open', (['FITS'], {}), '(FITS)\n', (850, 856), False, 'from astropy.io import fits\n'), ((999, 1014), 'astropy.wcs.WCS', 'wcs.WCS', (['... |
import math
from torch.optim.lr_scheduler import _LRScheduler
from torch.optim.optimizer import Optimizer
class PolyLR(_LRScheduler):
"""
Sets the learning rate of each parameter group according to poly learning rate policy
"""
def __init__(self, optimizer, max_iter=90000, power=0.9, last_epoch=-1):... | [
"math.cos"
] | [((657, 709), 'math.cos', 'math.cos', (['(step * math.pi / (total_epoch * len_epoch))'], {}), '(step * math.pi / (total_epoch * len_epoch))\n', (665, 709), False, 'import math\n')] |
import json
import logging
logger = logging.getLogger(__name__)
with open('configuration.json') as f:
config = json.load(f)
TELEGRAM_TOKEN = config["telegram-bot-token"]
NOTION_TOKEN = config["notion-token"]
NOTION_TABLE_URL = config["inbox_table"]["table_url"]
def check_allowed_user(user_id):
"""
chec... | [
"logging.getLogger",
"json.load"
] | [((37, 64), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (54, 64), False, 'import logging\n'), ((117, 129), 'json.load', 'json.load', (['f'], {}), '(f)\n', (126, 129), False, 'import json\n')] |
from time import time
from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union
import arrow
import datetime
import math
from datapipelines import DataSource, PipelineContext, Query, NotFoundError, validate_query
from .common import RiotAPIService, APINotFoundError
from ...data import Platform... | [
"math.ceil",
"arrow.now",
"arrow.get",
"datapipelines.Query.has",
"datetime.timedelta",
"datapipelines.validate_query",
"time.time",
"typing.TypeVar"
] | [((477, 489), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (484, 489), False, 'from typing import Type, TypeVar, MutableMapping, Any, Iterable, Generator, Union\n'), ((1103, 1172), 'datapipelines.validate_query', 'validate_query', (['_validate_get_match_query', 'convert_region_to_platform'], {}), '(_valid... |
"""
This caching is very important for speed and memory optimizations. There's
nothing really spectacular, just some decorators. The following cache types are
available:
- module caching (`load_parser` and `save_parser`), which uses pickle and is
really important to assure low load times of modules like ``numpy``.
-... | [
"os.path.exists",
"pickle.dump",
"gc.enable",
"os.makedirs",
"jedi.debug.dbg",
"gc.disable",
"os.path.join",
"re.match",
"inspect.isgenerator",
"pickle.load",
"json.load",
"os.path.getmtime",
"jedi.common.splitlines",
"time.time",
"json.dump"
] | [((3207, 3232), 'jedi.common.splitlines', 'common.splitlines', (['source'], {}), '(source)\n', (3224, 3232), False, 'from jedi import common\n'), ((3404, 3439), 're.match', 're.match', (['""".*\\\\("""', 'whole', 're.DOTALL'], {}), "('.*\\\\(', whole, re.DOTALL)\n", (3412, 3439), False, 'import re\n'), ((5956, 5978), '... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'PrestamoDeLibros.ui'
#
# Created by: PyQt4 UI code generator 4.11.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromU... | [
"PyQt4.QtGui.QApplication",
"PyQt4.QtGui.QWidget",
"PyQt4.QtCore.QMetaObject.connectSlotsByName",
"PyQt4.QtGui.QPushButton",
"PyQt4.QtGui.QApplication.translate",
"PyQt4.QtCore.QRect"
] | [((1541, 1569), 'PyQt4.QtGui.QApplication', 'QtGui.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (1559, 1569), False, 'from PyQt4 import QtCore, QtGui\n'), ((1581, 1596), 'PyQt4.QtGui.QWidget', 'QtGui.QWidget', ([], {}), '()\n', (1594, 1596), False, 'from PyQt4 import QtCore, QtGui\n'), ((458, 522), 'PyQt4.QtGui.Q... |
from hwtest.shell_utils import run_command
def test_linux_usb3hub():
"""
Test for Linux Foundation 3.0 root hub in `lsusb` output
"""
resp = run_command(["lsusb"])
assert "1d6b:0003" in resp
| [
"hwtest.shell_utils.run_command"
] | [((160, 182), 'hwtest.shell_utils.run_command', 'run_command', (["['lsusb']"], {}), "(['lsusb'])\n", (171, 182), False, 'from hwtest.shell_utils import run_command\n')] |
# Copyright 2012-2014 The Meson development team
# 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 agree... | [
"mesonlib.is_windows",
"re.compile",
"environment.detect_ninja",
"environment.find_valgrind",
"os.remove",
"mlog.red",
"os.path.split",
"subprocess.check_output",
"os.path.isabs",
"shutil.which",
"coredata.MesonException",
"os.path.splitext",
"pickle.dump",
"environment.find_coverage_tools... | [((875, 896), 'mesonlib.is_windows', 'mesonlib.is_windows', ([], {}), '()\n', (894, 896), False, 'import environment, mesonlib\n'), ((5495, 5565), 'coredata.MesonException', 'MesonException', (['"""Could not determine vs dep dependency prefix string."""'], {}), "('Could not determine vs dep dependency prefix string.')\... |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
"mock.Mock",
"oslo_messaging.MessagingTimeout",
"heat.rpc.listener_client.EngineListenerClient"
] | [((1108, 1119), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1117, 1119), False, 'import mock\n'), ((1147, 1192), 'heat.rpc.listener_client.EngineListenerClient', 'rpc_client.EngineListenerClient', (['"""engine-007"""'], {}), "('engine-007')\n", (1178, 1192), True, 'from heat.rpc import listener_client as rpc_client\n'... |
import os
from subprocess import call
from . import glob2
pwd = os.path.dirname(__file__)
def get_files_from_path(path, ext):
# use set to remove duplicate files. weird...but it happens
if os.path.isfile(path): return set([os.path.abspath(path)])
else: # i.e., folder
files = glob2.glob(os.path.a... | [
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"subprocess.call",
"os.path.abspath"
] | [((66, 91), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((200, 220), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (214, 220), False, 'import os\n'), ((3502, 3523), 'subprocess.call', 'call', (['cmd'], {'shell': '(True)'}), '(cmd, shell=Tr... |
"""
Patches views.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
from copy import deepcopy
import eta.core.utils as etau
import fiftyone.core.aggregations as foa
import fiftyone.core.dataset as fod
import fiftyone.core.fields as fof
import fiftyone.core.labels as fol
import fifty... | [
"eta.core.utils.is_str",
"copy.deepcopy",
"fiftyone.core.aggregations.Values",
"fiftyone.core.dataset.Dataset"
] | [((13620, 13652), 'fiftyone.core.dataset.Dataset', 'fod.Dataset', (['name'], {'_patches': '(True)'}), '(name, _patches=True)\n', (13631, 13652), True, 'import fiftyone.core.dataset as fod\n'), ((17000, 17032), 'fiftyone.core.dataset.Dataset', 'fod.Dataset', (['name'], {'_patches': '(True)'}), '(name, _patches=True)\n',... |
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"zope.publisher.browser.TestRequest",
"zope.publisher.publish.publish",
"time.clock",
"urllib.unquote",
"zope.app.appsetup.database",
"base64.b64encode",
"io.BytesIO",
"zope.app.appsetup.config",
"zope.publisher.browser.setDefaultSkin",
"time.time"
] | [((1749, 1761), 'zope.app.appsetup.database', 'database', (['db'], {}), '(db)\n', (1757, 1761), False, 'from zope.app.appsetup import config, database\n'), ((2873, 2905), 'urllib.unquote', 'urllib.unquote', (["env['PATH_INFO']"], {}), "(env['PATH_INFO'])\n", (2887, 2905), False, 'import urllib\n'), ((3936, 3953), 'zope... |
"""
Unit Tests for the pydisque module.
Currently, most of these tests require a fresh instance of
Disque to be valid and pass.
"""
import unittest
import json
import time
import random
import six
from pydisque.client import Client
from redis.exceptions import ResponseError
class TestDisque(unittest.TestCase):
... | [
"six.b",
"pydisque.client.Client",
"unittest.main",
"time.time",
"random.randint"
] | [((6670, 6685), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6683, 6685), False, 'import unittest\n'), ((450, 476), 'pydisque.client.Client', 'Client', (["['localhost:7711']"], {}), "(['localhost:7711'])\n", (456, 476), False, 'from pydisque.client import Client\n'), ((2895, 2906), 'time.time', 'time.time', ([]... |
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ runner.py ]
# Synopsis [ main program that runs the 'Naive Bayes' and 'Decision Tree' training / testing ]
# Author [ <NAME> (Andi611) ]
# Copyright [ Copyl... | [
"classifiers.naive_bayes_runner",
"argparse.ArgumentParser",
"data_loader.data_loader",
"csv.writer",
"os.path.isfile",
"classifiers.decision_tree_runner"
] | [((766, 816), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""descrip_msg"""'}), "(description='descrip_msg')\n", (789, 816), False, 'import argparse\n'), ((5092, 5109), 'data_loader.data_loader', 'data_loader', (['args'], {}), '(args)\n', (5103, 5109), False, 'from data_loader import dat... |
import copy
import numpy as np
import pybullet as p
from igibson.metrics.metric_base import MetricBase
class BehaviorRobotMetric(MetricBase):
def __init__(self):
self.initialized = False
self.state_cache = {}
self.next_state_cache = {}
self.agent_pos = {part: [] for part in ["l... | [
"numpy.clip",
"numpy.abs",
"pybullet.getContactPoints",
"copy.deepcopy",
"pybullet.getConstraintState",
"numpy.array",
"numpy.linalg.norm"
] | [((3877, 3913), 'copy.deepcopy', 'copy.deepcopy', (['self.next_state_cache'], {}), '(self.next_state_cache)\n', (3890, 3913), False, 'import copy\n'), ((5886, 5903), 'numpy.abs', 'np.abs', (['delta_pos'], {}), '(delta_pos)\n', (5892, 5903), True, 'import numpy as np\n'), ((6072, 6179), 'numpy.linalg.norm', 'np.linalg.n... |
import argparse
import operator
import os
import re
import shutil
import spacy
import tempfile
from nerds.utils import spans_to_tokens, get_logger
def segment_text_to_sentences(text_file, sentence_splitter):
""" Segment text into sentences. Text is provided by BRAT in .txt
file.
Args:
... | [
"os.listdir",
"nerds.utils.spans_to_tokens",
"argparse.ArgumentParser",
"spacy.load",
"os.path.join",
"tempfile.mkdtemp",
"nerds.utils.get_logger",
"shutil.rmtree"
] | [((5767, 5868), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Script to convert BRAT annotations to IOB (NERDS) format."""'}), "(description=\n 'Script to convert BRAT annotations to IOB (NERDS) format.')\n", (5790, 5868), False, 'import argparse\n'), ((6168, 6180), 'nerds.utils.get_... |
"""
Ocropus's magic PIL-numpy array conversion routines. They express slightly
different behavior from PIL.Image.toarray().
"""
import unicodedata
import numpy as np
from PIL import Image
__all__ = ['pil2array', 'array2pil']
def pil2array(im: Image.Image, alpha: int = 0) -> np.array:
if im.mode == '1':
... | [
"unicodedata.name",
"numpy.array",
"numpy.dtype",
"unicodedata.category"
] | [((364, 376), 'numpy.array', 'np.array', (['im'], {}), '(im)\n', (372, 376), True, 'import numpy as np\n'), ((434, 447), 'numpy.dtype', 'np.dtype', (['"""B"""'], {}), "('B')\n", (442, 447), True, 'import numpy as np\n'), ((1891, 1917), 'unicodedata.category', 'unicodedata.category', (['char'], {}), '(char)\n', (1911, 1... |
import sys
sys.path.insert(0,'..')
from data.whale_data import exchnage_accounts
from data.html_helper import check_if_address_name_exists
from data.whale_eth_tx_data import *
from data.whale_token_tx_data import identify_investor_type_token
holding_account = "holding_account"
deposit_account = 'deposit_account'
withd... | [
"data.whale_token_tx_data.identify_investor_type_token",
"sys.path.insert"
] | [((11, 35), 'sys.path.insert', 'sys.path.insert', (['(0)', '""".."""'], {}), "(0, '..')\n", (26, 35), False, 'import sys\n'), ((1185, 1218), 'data.whale_token_tx_data.identify_investor_type_token', 'identify_investor_type_token', (['out'], {}), '(out)\n', (1213, 1218), False, 'from data.whale_token_tx_data import ident... |
# @Time : 2020/11/14
# @Author : <NAME>, <NAME>
# @Email : <EMAIL>
# UPDATE:
# @Time : 2020/12/2, 2020/11/27, 2020/12/3, 2020/12/26
# @Author : <NAME>, <NAME>, <NAME>, <NAME>
# @Email : <EMAIL>, <EMAIL>, <EMAIL>, <EMAIL>
r"""
textbox.trainer.trainer
################################
"""
import os
import torch
i... | [
"logging.getLogger",
"textbox.utils.early_stopping",
"torch.nn.CrossEntropyLoss",
"matplotlib.pyplot.ylabel",
"textbox.evaluator.TranslationEvaluator",
"copy.deepcopy",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.exp",
"torch.optim.RMSprop",
"textbox.evaluator.SummarizationEvalu... | [((14204, 14219), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (14217, 14219), False, 'import torch\n'), ((32618, 32633), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (32631, 32633), False, 'import torch\n'), ((2571, 2582), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (2580, 2582), False, 'from log... |
import pandas as pd
# Define our header
col_names = [
"year",
"num_males_with_income",
"male_median_income_curr_dollars",
"male_median_income_2019_dollars",
"num_females_with_income",
"female_median_income_curr_dollars",
"female_median_income_2019_dollars",
]
# Load Asian census data XLS, ... | [
"pandas.concat",
"pandas.read_excel"
] | [((347, 415), 'pandas.read_excel', 'pd.read_excel', (['"""p08a.xlsx"""'], {'skiprows': '(8)', 'header': 'None', 'names': 'col_names'}), "('p08a.xlsx', skiprows=8, header=None, names=col_names)\n", (360, 415), True, 'import pandas as pd\n'), ((569, 637), 'pandas.read_excel', 'pd.read_excel', (['"""p08w.xlsx"""'], {'skip... |
from AndroidSpider import url_manager, html_downloader, html_parser, html_output
'''
爬取百度百科 Android 关键词相关词及简介并输出为一个HTML tab网页
Extra module:
BeautifulSoup
'''
class SpiderMain(object):
def __init__(self):
self.urls = url_manager.UrlManager()
self.downloader = html_downloader.HtmlDownLoader()
... | [
"AndroidSpider.url_manager.UrlManager",
"AndroidSpider.html_downloader.HtmlDownLoader",
"AndroidSpider.html_output.HtmlOutput",
"AndroidSpider.html_parser.HtmlParser"
] | [((230, 254), 'AndroidSpider.url_manager.UrlManager', 'url_manager.UrlManager', ([], {}), '()\n', (252, 254), False, 'from AndroidSpider import url_manager, html_downloader, html_parser, html_output\n'), ((281, 313), 'AndroidSpider.html_downloader.HtmlDownLoader', 'html_downloader.HtmlDownLoader', ([], {}), '()\n', (31... |
import boto
import boto3
from config import Config
dynamodb = boto3.resource('dynamodb',
aws_access_key_id=Config.AWS_KEY,
aws_secret_access_key=Config.AWS_SECRET_KEY,
region_name=Config.REGION)
table = dynamodb.Table('user_details')
tables... | [
"boto3.resource"
] | [((63, 199), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {'aws_access_key_id': 'Config.AWS_KEY', 'aws_secret_access_key': 'Config.AWS_SECRET_KEY', 'region_name': 'Config.REGION'}), "('dynamodb', aws_access_key_id=Config.AWS_KEY,\n aws_secret_access_key=Config.AWS_SECRET_KEY, region_name=Config.REGION)\n... |
from logging import warning
from requests import get
from .info import Info
from .provider import Provider
from .providers import get_provider
class Parser:
def __init__(self, args: dict):
self.params = args
def init_provider(
self,
chapter_progress: callable = None,
... | [
"requests.get"
] | [((1827, 1865), 'requests.get', 'get', (['url'], {'stream': '(True)', 'proxies': 'proxies'}), '(url, stream=True, proxies=proxies)\n', (1830, 1865), False, 'from requests import get\n')] |
"""Holds configurations to read and write with Spark to AWS S3."""
import os
from typing import Any, Dict, List, Optional
from pyspark.sql import DataFrame
from butterfree.configs import environment
from butterfree.configs.db import AbstractWriteConfig
from butterfree.dataframe_service import extract_partition_value... | [
"butterfree.dataframe_service.extract_partition_values",
"butterfree.configs.environment.get_variable",
"os.path.join"
] | [((2995, 3074), 'butterfree.dataframe_service.extract_partition_values', 'extract_partition_values', (['dataframe'], {'partition_columns': "['year', 'month', 'day']"}), "(dataframe, partition_columns=['year', 'month', 'day'])\n", (3019, 3074), False, 'from butterfree.dataframe_service import extract_partition_values\n'... |
#!/usr/bin/env python3
import sys
sys.path.append('..')
import specrel.geom as geom
import specrel.spacetime.physical as phy
import specrel.visualize as vis
# Shared parameters
include_grid = True
include_legend = True
tlim = (0, 2)
xlim = (-2, 2)
# A stationary point object
stationary = phy.MovingObject(0, draw_opt... | [
"specrel.visualize.stplot",
"specrel.spacetime.physical.MovingObject",
"specrel.visualize.stanimate_with_worldline",
"specrel.geom.Collection",
"specrel.visualize.stanimate",
"sys.path.append"
] | [((34, 55), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (49, 55), False, 'import sys\n'), ((292, 346), 'specrel.spacetime.physical.MovingObject', 'phy.MovingObject', (['(0)'], {'draw_options': "{'label': '$v = 0$'}"}), "(0, draw_options={'label': '$v = 0$'})\n", (308, 346), True, 'import specr... |
from __future__ import absolute_import
from six.moves.urllib.parse import urlencode
from django.test import RequestFactory
from django.contrib.auth.models import AnonymousUser
from sentry.auth.helper import handle_new_user
from sentry.models import AuthProvider, InviteStatus, OrganizationMember
from sentry.testutils ... | [
"django.test.RequestFactory",
"sentry.models.OrganizationMember.objects.create",
"sentry.utils.compat.mock.call",
"django.contrib.auth.models.AnonymousUser",
"sentry.models.AuthProvider.objects.create",
"sentry.models.OrganizationMember.objects.get",
"sentry.utils.compat.mock.patch",
"six.moves.urllib... | [((415, 452), 'sentry.utils.compat.mock.patch', 'mock.patch', (['"""sentry.analytics.record"""'], {}), "('sentry.analytics.record')\n", (425, 452), False, 'from sentry.utils.compat import mock\n'), ((597, 612), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (610, 612), False, 'from djang... |
import datetime
import requests
from mbta_python.models import Stop, Direction, Schedule, Mode, \
TripSchedule, Alert, StopWithMode, Prediction
HOST = "http://realtime.mbta.com/developer/api/v2"
def datetime_to_epoch(dt):
epoch = datetime.datetime.utcfromtimestamp(0)
return int((dt - epoch).total_second... | [
"datetime.datetime.utcfromtimestamp",
"mbta_python.models.Stop",
"mbta_python.models.TripSchedule",
"mbta_python.models.Mode",
"mbta_python.models.Direction",
"mbta_python.models.Schedule",
"requests.get",
"mbta_python.models.StopWithMode",
"mbta_python.models.Prediction"
] | [((242, 279), 'datetime.datetime.utcfromtimestamp', 'datetime.datetime.utcfromtimestamp', (['(0)'], {}), '(0)\n', (276, 279), False, 'import datetime\n'), ((579, 611), 'requests.get', 'requests.get', (['url'], {'params': 'params'}), '(url, params=params)\n', (591, 611), False, 'import requests\n'), ((1986, 2004), 'mbta... |
"""Computation of ensemble anomalies based on a desired value."""
import os
import numpy as np
from scipy import stats
# User-defined packages
from read_netcdf import read_iris, save_n_2d_fields
from sel_season_area import sel_area, sel_season
def ens_anom(filenames, dir_output, name_outputs, varname, numens, seaso... | [
"numpy.mean",
"numpy.nanstd",
"numpy.nanpercentile",
"sel_season_area.sel_area",
"read_netcdf.save_n_2d_fields",
"numpy.array",
"numpy.nanmean",
"read_netcdf.read_iris",
"numpy.nanmax",
"numpy.empty",
"sel_season_area.sel_season"
] | [((3510, 3534), 'numpy.array', 'np.array', (['varextreme_ens'], {}), '(varextreme_ens)\n', (3518, 3534), True, 'import numpy as np\n'), ((4015, 4092), 'read_netcdf.save_n_2d_fields', 'save_n_2d_fields', (['lat_area', 'lon_area', 'ens_anomalies', 'varsave', 'varunits', 'ofile'], {}), '(lat_area, lon_area, ens_anomalies,... |
import csv
from testdata import SOCIALHISTORY_FILE
from testdata import rndDate
from patient import Patient
SMOKINGCODES = {
'428041000124106': 'Current some day smoker',
'266919005' : 'Never smoker',
'449868002' : 'Current every day smoker',
'266927001' : 'Unknown if ever smoked',
'... | [
"testdata.rndDate"
] | [((2604, 2617), 'testdata.rndDate', 'rndDate', (['(2016)'], {}), '(2016)\n', (2611, 2617), False, 'from testdata import rndDate\n')] |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import pytest
from llnl.util.filesystem import mkdirp, touch
import spack.config
from spack.fetch_strategy im... | [
"llnl.util.filesystem.touch",
"os.path.join",
"pytest.mark.parametrize",
"spack.stage.Stage",
"pytest.raises",
"spack.fetch_strategy.CacheURLFetchStrategy",
"llnl.util.filesystem.mkdirp"
] | [((394, 454), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""_fetch_method"""', "['curl', 'urllib']"], {}), "('_fetch_method', ['curl', 'urllib'])\n", (417, 454), False, 'import pytest\n'), ((875, 935), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""_fetch_method"""', "['curl', 'urllib']"], {}... |
from typing_extensions import Required
#from sqlalchemy.sql.sqltypes import Boolean
from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int
from models.EventsRelated.EventModel import EventModel
from graphqltypes.Utils import extractSession
class EventType(ObjectType):
id = ID(... | [
"graphene.String",
"graphene.List",
"graphqltypes.Utils.extractSession",
"graphene.ID",
"graphene.DateTime"
] | [((317, 321), 'graphene.ID', 'ID', ([], {}), '()\n', (319, 321), False, 'from graphene import ObjectType, String, Field, ID, List, DateTime, Mutation, Boolean, Int\n'), ((333, 341), 'graphene.String', 'String', ([], {}), '()\n', (339, 341), False, 'from graphene import ObjectType, String, Field, ID, List, DateTime, Mut... |
from django.shortcuts import render
from .models import Disk
import os
def index(request):
context = {}
disk_list = Disk.objects.all()
context['disk_list'] = disk_list
return render(request, 'index.html', context)
#def index(request):
# module_dir = os.path.dirname(__file__)
# file_path = os.p... | [
"django.shortcuts.render"
] | [((193, 231), 'django.shortcuts.render', 'render', (['request', '"""index.html"""', 'context'], {}), "(request, 'index.html', context)\n", (199, 231), False, 'from django.shortcuts import render\n')] |
# Copyright (c) 2021-Present (<NAME>)
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writ... | [
"requests.post",
"infapy.log.error",
"infapy.log.exception",
"infapy.log.info"
] | [((1238, 1286), 'infapy.log.info', 'infapy.log.info', (["('agentService API URL - ' + url)"], {}), "('agentService API URL - ' + url)\n", (1253, 1286), False, 'import infapy\n'), ((1963, 1995), 'infapy.log.info', 'infapy.log.info', (["data['message']"], {}), "(data['message'])\n", (1978, 1995), False, 'import infapy\n'... |
# Copyright 2021 Google LLC. 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 a... | [
"absl.testing.absltest.mock.create_autospec",
"tfx.orchestration.experimental.core.service_jobs.ExceptionHandlingServiceJobManagerWrapper",
"absl.testing.absltest.mock.Mock",
"tensorflow.test.main"
] | [((3178, 3192), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (3190, 3192), True, 'import tensorflow as tf\n'), ((998, 1065), 'absl.testing.absltest.mock.create_autospec', 'mock.create_autospec', (['service_jobs.ServiceJobManager'], {'instance': '(True)'}), '(service_jobs.ServiceJobManager, instance=True)\n... |
from api import get_result
import os
import shutil
from glob import glob
from PIL import Image
if __name__ == '__main__':
image_files = glob('./test_images/*.*')
result_dir = './test_results'
if os.path.exists(result_dir):
shutil.rmtree(result_dir)
os.mkdir(result_dir)
txt_file = os.path.j... | [
"os.path.exists",
"PIL.Image.open",
"os.path.join",
"os.mkdir",
"shutil.rmtree",
"glob.glob"
] | [((141, 166), 'glob.glob', 'glob', (['"""./test_images/*.*"""'], {}), "('./test_images/*.*')\n", (145, 166), False, 'from glob import glob\n'), ((208, 234), 'os.path.exists', 'os.path.exists', (['result_dir'], {}), '(result_dir)\n', (222, 234), False, 'import os\n'), ((274, 294), 'os.mkdir', 'os.mkdir', (['result_dir']... |
# Copyright 2020 Curtin University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writi... | [
"mag_archiver.mag.hide_if_not_none",
"mag_archiver.mag.make_mag_query",
"mag_archiver.mag.MagRelease.from_entity",
"mag_archiver.azure.create_table",
"os.getenv",
"pendulum.utcnow",
"azure.storage.blob.ContainerProperties",
"azure.cosmosdb.table.tableservice.TableService",
"pendulum.datetime",
"ma... | [((5764, 5793), 'pendulum.datetime', 'pendulum.datetime', (['(1601)', '(1)', '(1)'], {}), '(1601, 1, 1)\n', (5781, 5793), False, 'import pendulum\n'), ((5964, 6014), 'pendulum.datetime', 'pendulum.datetime', ([], {'year': 'year', 'month': 'month', 'day': 'day'}), '(year=year, month=month, day=day)\n', (5981, 6014), Fal... |
'''
Created on Mar 22, 2018
Edited on Jan 11, 2019
@author: npvance2
@author: curtisd2
Variables that will need to be edited/personalized:
monitorID in Variables() (line 27)
projectStartDate in Variables() (line 28)
projectEndDate in Variables() (line 29)
authToken in getAuthToken() (... | [
"json.loads",
"csv.writer",
"tweepy.API",
"datetime.timedelta",
"tweepy.OAuthHandler"
] | [((2155, 2198), 'tweepy.OAuthHandler', 'OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (2167, 2198), False, 'from tweepy import OAuthHandler\n'), ((2264, 2337), 'tweepy.API', 'tweepy.API', (['auth'], {'wait_on_rate_limit': '(True)', 'wait_on_rate_limit_notify': '(True)'})... |
#! /opt/cloud_sdk/bin/python
import asyncio
import logging
import subprocess
import sys
import citc_cloud
def handle_exception(exc_type, exc_value, exc_traceback):
if issubclass(exc_type, KeyboardInterrupt):
sys.__excepthook__(exc_type, exc_value, exc_traceback)
return
log.critical("Uncaugh... | [
"logging.getLogger",
"logging.Formatter",
"subprocess.run",
"logging.FileHandler",
"citc_cloud.start_node",
"citc_cloud.get_nodespace",
"asyncio.get_event_loop",
"sys.__excepthook__"
] | [((425, 451), 'citc_cloud.get_nodespace', 'citc_cloud.get_nodespace', ([], {}), '()\n', (449, 451), False, 'import citc_cloud\n'), ((887, 917), 'logging.getLogger', 'logging.getLogger', (['"""startnode"""'], {}), "('startnode')\n", (904, 917), False, 'import logging\n'), ((963, 1012), 'logging.FileHandler', 'logging.Fi... |