code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import torch
from .ops import flatten
__all__ = ['jac_at_x', 'lin_at_x', 'jacobian', 'linearize']
def jac_at_x(func, at, x, eps=1e-3):
'''Computes `Ax` where `A` is the Jacobian of `func` at `at`.
This implementation doesn't need to compute `A` to return `Ax`.
We can numerically approximate `Ax` with `... | [
"torch.no_grad",
"torch.autograd.Variable",
"torch.empty_like",
"torch.enable_grad"
] | [((3035, 3054), 'torch.enable_grad', 'torch.enable_grad', ([], {}), '()\n', (3052, 3054), False, 'import torch\n'), ((3073, 3120), 'torch.autograd.Variable', 'torch.autograd.Variable', (['at'], {'requires_grad': '(True)'}), '(at, requires_grad=True)\n', (3096, 3120), False, 'import torch\n'), ((3171, 3186), 'torch.no_g... |
import gdb
class GetFrameSizesCommand(gdb.Command):
"""Gets the size of each frame, and of the whole stack.
Useful debugging tool to find out which functions have a fat stackframe.
"""
def __init__(self):
super(GetFrameSizesCommand, self).__init__(
"get-frame-sizes",
... | [
"gdb.newest_frame"
] | [((445, 463), 'gdb.newest_frame', 'gdb.newest_frame', ([], {}), '()\n', (461, 463), False, 'import gdb\n')] |
import pathlib
from collections import namedtuple
from PIL import Image
import warnings
Image.MAX_IMAGE_PIXELS = 100000000000
class Slide:
'''
A slide object
'''
def __init__(self, path, img_requirements=None, stain_type='Unknown'):
'''
Creates a slide object with all possible data ... | [
"warnings.warn",
"collections.namedtuple",
"PIL.Image.open",
"pathlib.Path"
] | [((624, 640), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (634, 640), False, 'from PIL import Image\n'), ((738, 769), 'collections.namedtuple', 'namedtuple', (['"""Coordinate"""', '"""x y"""'], {}), "('Coordinate', 'x y')\n", (748, 769), False, 'from collections import namedtuple\n'), ((1553, 1584), 'co... |
# Code generated by moonworm : https://github.com/bugout-dev/moonworm
# Moonworm version : 0.1.15
import argparse
import json
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Union
from brownie import Contract, network, project
from brownie.network.contract import ContractContainer
fro... | [
"brownie.network.accounts.load",
"brownie.network.contract.ContractContainer",
"argparse.ArgumentParser",
"pathlib.Path",
"brownie.Contract.from_abi",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"brownie.network.connect",
"json.load"
] | [((463, 516), 'os.path.join', 'os.path.join', (['PROJECT_DIRECTORY', '"""build"""', '"""contracts"""'], {}), "(PROJECT_DIRECTORY, 'build', 'contracts')\n", (475, 516), False, 'import os\n'), ((1146, 1195), 'os.path.join', 'os.path.join', (['BUILD_DIRECTORY', 'f"""{abi_name}.json"""'], {}), "(BUILD_DIRECTORY, f'{abi_nam... |
import sys
sys.path.append("..")
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import Parameter
import utils
import metrics
import config_bayesian as cfg
from .misc import ModuleWrapper
class BBBConv2d(ModuleWrapper):
def __init__(self, in_channels, out_channe... | [
"torch.nn.functional.conv2d",
"math.sqrt",
"torch.Tensor",
"torch.exp",
"metrics.calculate_kl",
"sys.path.append"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((794, 852), 'torch.Tensor', 'torch.Tensor', (['out_channels', 'in_channels', '*self.kernel_size'], {}), '(out_channels, in_channels, *self.kernel_size)\n', (806, 852), False, 'import torch\n'), ((1065, 1... |
from django.db import models
import uuid
from django.db.models.deletion import CASCADE
from django.utils.translation import ugettext_lazy as _
from registry.models import Aircraft, Contact
class AerobridgeCredential(models.Model):
''' A class to store tokens from Digital Sky '''
KEY_ENVIRONMENT = ((0, _('... | [
"django.utils.translation.ugettext_lazy",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.BinaryField",
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.UUIDField"
] | [((580, 650), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(primary_key=True, default=uuid.uuid4, editable=False)\n', (596, 650), False, 'from django.db import models\n'), ((662, 775), 'django.db.models.CharField', 'models.CharField'... |
import sys
from charts.GanttChart import GanttChart
REDDIT_CSV_ROUTE = "../../output/reddit/reddit.csv"
REDDIT_CSV_OUTLIERS_ROUTE = "../../output/reddit/reddit_filtered.csv"
REDDIT_CSV_LIVEVARS_ROUTE = "../../output/reddit/reddit.csv"
SOF_CSV_ROUTE = "../../output/stackoverflow/stackoverflow.csv"
SOF_CSV_OUTLIERS_ROUT... | [
"charts.GanttChart.GanttChart"
] | [((492, 520), 'charts.GanttChart.GanttChart', 'GanttChart', (['REDDIT_CSV_ROUTE'], {}), '(REDDIT_CSV_ROUTE)\n', (502, 520), False, 'from charts.GanttChart import GanttChart\n')] |
import os
from shutil import copyfileobj
import urllib3
from urllib3.util import parse_url
from checksumming_io.checksumming_io import ChecksummingSink
from .parallel_logger import logger
from .utils import sizeof_fmt, measure_duration_and_rate
from .s3 import S3Location, S3Agent, S3ObjectTagger
from bundle_tools imp... | [
"urllib3.util.parse_url",
"shutil.copyfileobj",
"os.path.isfile",
"urllib3.PoolManager",
"bundle_tools.SubmissionInfo",
"os.stat",
"checksumming_io.checksumming_io.ChecksummingSink",
"os.remove"
] | [((673, 694), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (692, 694), False, 'import urllib3\n'), ((6829, 6848), 'urllib3.util.parse_url', 'parse_url', (['location'], {}), '(location)\n', (6838, 6848), False, 'from urllib3.util import parse_url\n'), ((1014, 1061), 'bundle_tools.SubmissionInfo', 'Sub... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"paddle.io.BatchSampler",
"random.sample",
"paddle.io.DistributedBatchSampler",
"paddlenlp.datasets.MapDataset",
"paddle.io.DataLoader"
] | [((1363, 1475), 'paddle.io.DataLoader', 'paddle.io.DataLoader', ([], {'dataset': 'dataset', 'batch_sampler': 'batch_sampler', 'collate_fn': 'batchify_fn', 'return_list': '(True)'}), '(dataset=dataset, batch_sampler=batch_sampler,\n collate_fn=batchify_fn, return_list=True)\n', (1383, 1475), False, 'import paddle\n')... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import uuid
from django.db import models
from seaserv import seafile_api
from seahub.utils.timeutils import timestamp_to_isoformat_timestr, datetime_to_isoformat_timestr
from seahub.base.templatetags.seahub_tags import email2nickname
class WorkspacesM... | [
"django.db.models.ForeignKey",
"seahub.utils.timeutils.timestamp_to_isoformat_timestr",
"seaserv.seafile_api.get_repo",
"seahub.base.templatetags.seahub_tags.email2nickname",
"seahub.utils.timeutils.datetime_to_isoformat_timestr",
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.... | [((1343, 1386), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'null': '(True)'}), '(max_length=255, null=True)\n', (1359, 1386), False, 'from django.db import models\n'), ((1399, 1444), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)'}), ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `click_demo` package."""
import os
import unittest
from click.testing import CliRunner
from click_demo import click_demo
from click_demo import cli
class TestClick_demo(unittest.TestCase):
"""Tests for `click_demo` package."""
def setUp(self):
... | [
"click.testing.CliRunner"
] | [((580, 591), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (589, 591), False, 'from click.testing import CliRunner\n'), ((1166, 1177), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (1175, 1177), False, 'from click.testing import CliRunner\n'), ((1764, 1775), 'click.testing.CliRunner', 'CliRunne... |
from torch.nn import Module
from torch.nn import functional as F
from torch import zeros, mean, tensor
class CrossEntropyLossPlus(Module):
def __init__(self, recurrent_flag=True, topdown_flag=True,
lambda_recognition=0.5, lambda_recurrent=0.25, lambda_topdown=0.25,
reduction='me... | [
"torch.mean",
"torch.tensor",
"torch.zeros",
"torch.nn.functional.cross_entropy"
] | [((534, 560), 'torch.tensor', 'tensor', (['lambda_recognition'], {}), '(lambda_recognition)\n', (540, 560), False, 'from torch import zeros, mean, tensor\n'), ((593, 617), 'torch.tensor', 'tensor', (['lambda_recurrent'], {}), '(lambda_recurrent)\n', (599, 617), False, 'from torch import zeros, mean, tensor\n'), ((648, ... |
import random
class Especificaciones():
def craft_lista(self, l, minimol, maximol, minimos, maximos): #crea la lista aleatoria con los segmentos correspondientes
self.lista = []
for i in range(l):
self.lista.append(int(random.randint(minimol, maximol))) #lista aleatoria
print("Esta es la lista ini... | [
"random.randint"
] | [((237, 269), 'random.randint', 'random.randint', (['minimol', 'maximol'], {}), '(minimol, maximol)\n', (251, 269), False, 'import random\n')] |
from entities.entity import Entity
import random
#An entity that receives ticks
class TickingTrait(Entity):
delta_time = 0.0 #Time passed per frame, secs
time = 0.0 #time passed since simulation start, secs
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.at_most_fun... | [
"random.random"
] | [((808, 823), 'random.random', 'random.random', ([], {}), '()\n', (821, 823), False, 'import random\n')] |
# -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Brief:
import sys
sys.path.append("../")
import os
from pycorrector.utils.eval import eval_bcmi_data, get_bcmi_corpus, eval_sighan_corpus
pwd_path = os.path.abspath(os.path.dirname(__file__))
bcmi_path = os.path.join(pwd_path, '../pycorrector/data/cn/bcmi.txt')
clp... | [
"pycorrector.utils.eval.get_bcmi_corpus",
"os.path.join",
"pycorrector.utils.eval.eval_bcmi_data",
"os.path.dirname",
"pycorrector.utils.eval.eval_sighan_corpus",
"sys.path.append"
] | [((72, 94), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (87, 94), False, 'import sys\n'), ((259, 316), 'os.path.join', 'os.path.join', (['pwd_path', '"""../pycorrector/data/cn/bcmi.txt"""'], {}), "(pwd_path, '../pycorrector/data/cn/bcmi.txt')\n", (271, 316), False, 'import os\n'), ((328, 389... |
import os
import io
import glob
import matplotlib.pyplot as plt
import imageio
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
SIZE_GUIDANCE = {
'images': 20
}
def plot_alignment(log_dir, save_dir):
tf_event = glob.glob(os.path.join(log_dir, "events.*"))[0]
event_acc... | [
"tensorboard.backend.event_processing.event_accumulator.EventAccumulator",
"matplotlib.pyplot.imshow",
"os.listdir",
"os.makedirs",
"matplotlib.pyplot.imread",
"os.path.join",
"io.BytesIO",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.tight_layout",
"imageio.imread",
"... | [((323, 378), 'tensorboard.backend.event_processing.event_accumulator.EventAccumulator', 'EventAccumulator', (['tf_event'], {'size_guidance': 'SIZE_GUIDANCE'}), '(tf_event, size_guidance=SIZE_GUIDANCE)\n', (339, 378), False, 'from tensorboard.backend.event_processing.event_accumulator import EventAccumulator\n'), ((926... |
import unittest
from enum import Enum
from typing import List, Optional, Tuple, Union, Callable
import torch
import torch.nn as nn
from torch import Tensor
import alpa.torch.optim as torchoptim
from alpa.torch.trainer import train_torch_module
import alpa
# Copied from timm
# https://github.com/rwightman/pytorch-ima... | [
"torch.nn.Dropout",
"alpa.set_seed",
"torch.bmm",
"unittest.TextTestRunner",
"torch.nn.functional.linear",
"unittest.TestSuite",
"alpa.torch.optim.adam",
"torch.nn.ModuleList",
"torch.nn.LayerNorm",
"torch.relu",
"torch.nn.functional.mse_loss",
"alpa.torch.trainer.train_torch_module",
"torch... | [((21201, 21221), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (21219, 21221), False, 'import unittest\n'), ((21399, 21424), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {}), '()\n', (21422, 21424), False, 'import unittest\n'), ((806, 844), 'torch.nn.Linear', 'nn.Linear', (['dim', '(dim *... |
"""
Data handling for images and reflectance
"""
from gzopen import gzopen
import logging
import logging.config
import yaml
import copy as cp
import re
import ntpath
import h5py
import datetime
import numpy as np
import time
import io
import glob
import pandas as pd
import matplotlib.pyplot as plt
class wafer():
... | [
"logging.getLogger",
"ntpath.basename",
"pandas.read_csv",
"numpy.average",
"numpy.fft.rfft",
"numpy.array",
"numpy.linspace",
"gzopen.gzopen",
"numpy.savetxt",
"copy.deepcopy",
"io.StringIO",
"time.time"
] | [((480, 506), 'logging.getLogger', 'logging.getLogger', (['"""Wafer"""'], {}), "('Wafer')\n", (497, 506), False, 'import logging\n'), ((772, 786), 'numpy.fft.rfft', 'np.fft.rfft', (['d'], {}), '(d)\n', (783, 786), True, 'import numpy as np\n'), ((1052, 1081), 'logging.getLogger', 'logging.getLogger', (['"""WaferLSA"""'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
import logging
import functools
import pyhash
from bitset import MmapBitSet
from hash_tools import hashes
class BloomFilter(object):
"""
A bloom filter implementation,
which use Murmur hash and Spooky hash
"""
def __init__(self, capacity,... | [
"pyhash.murmur3_x64_128",
"bitset.MmapBitSet",
"math.log",
"functools.partial",
"math.exp",
"logging.info",
"pyhash.spooky_128"
] | [((372, 396), 'pyhash.murmur3_x64_128', 'pyhash.murmur3_x64_128', ([], {}), '()\n', (394, 396), False, 'import pyhash\n'), ((401, 420), 'pyhash.spooky_128', 'pyhash.spooky_128', ([], {}), '()\n', (418, 420), False, 'import pyhash\n'), ((902, 930), 'bitset.MmapBitSet', 'MmapBitSet', (['self.num_of_bits'], {}), '(self.nu... |
"""
utils.py
Python utils functionalities.
Handles the primary functions
"""
import argparse
from maxsmi.augmentation_strategies import (
no_augmentation,
augmentation_with_duplication,
augmentation_without_duplication,
augmentation_with_reduced_duplication,
augmentation_maximum_estimation,
)
d... | [
"argparse.ArgumentTypeError"
] | [((760, 819), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['"""Choose between \'yes\' or \'no\'."""'], {}), '("Choose between \'yes\' or \'no\'.")\n', (786, 819), False, 'import argparse\n'), ((1614, 1831), 'argparse.ArgumentTypeError', 'argparse.ArgumentTypeError', (['"""Choose between \'no_augmentati... |
import pytest
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.pipeline import make_pipeline
from catboost import CatBoostClassifier
from pydrift import DataDriftChecker, ModelDriftChecker, DriftCheckerEstimator
from pydrift.exceptions import (ColumnsNotMatchException,
... | [
"pydrift.models.cat_features_fillna",
"pydrift.DataDriftChecker",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"pytest.raises",
"catboost.CatBoostClassifier",
"pandas.concat",
"pydrift.ModelDriftChecker"
] | [((502, 540), 'pandas.read_csv', 'pd.read_csv', (["(PATH_DATA / 'titanic.csv')"], {}), "(PATH_DATA / 'titanic.csv')\n", (513, 540), True, 'import pandas as pd\n'), ((746, 822), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'test_size': '(0.5)', 'random_state': 'RANDOM_STATE', 'stratify':... |
import pytest
from cryptotik import Hitbtc
from decimal import Decimal
from cryptotik.exceptions import APIError
private = pytest.mark.skipif(
not pytest.config.getoption("--apikey"),
reason="needs --apikey option to run."
)
hit = Hitbtc(pytest.config.getoption("--apikey"),
pytest.config.getoptio... | [
"pytest.config.getoption",
"pytest.raises"
] | [((248, 283), 'pytest.config.getoption', 'pytest.config.getoption', (['"""--apikey"""'], {}), "('--apikey')\n", (271, 283), False, 'import pytest\n'), ((298, 333), 'pytest.config.getoption', 'pytest.config.getoption', (['"""--secret"""'], {}), "('--secret')\n", (321, 333), False, 'import pytest\n'), ((152, 187), 'pytes... |
import cv2 as cv2
import numpy as np
def main():
img = cv2.imread('1.jpg', 0)
ret,thresh1 = cv2.threshold(img,127,255,cv2.THRESH_BINARY)
ret,thresh3 = cv2.threshold(img,127,255,cv2.THRESH_TRUNC)
ret,thresh5 = cv2.threshold(img,127,255,cv2.THRESH_TOZERO_INV)
cv2.imshow("Image", img)
cv2.imshow("... | [
"cv2.threshold",
"cv2.waitKey",
"cv2.imread",
"cv2.imshow"
] | [((60, 82), 'cv2.imread', 'cv2.imread', (['"""1.jpg"""', '(0)'], {}), "('1.jpg', 0)\n", (70, 82), True, 'import cv2 as cv2\n'), ((101, 148), 'cv2.threshold', 'cv2.threshold', (['img', '(127)', '(255)', 'cv2.THRESH_BINARY'], {}), '(img, 127, 255, cv2.THRESH_BINARY)\n', (114, 148), True, 'import cv2 as cv2\n'), ((164, 21... |
"""
=================================
Find Photodiode On and Off Events
=================================
In this example, we use ``pd-parser`` to find photodiode events and
align both the onset of the deflection and the cessation to
to behavior.
"""
# Authors: <NAME> <<EMAIL>>
#
# License: BSD (3-clause)
###########... | [
"mne.utils._TempDir",
"mne.create_info",
"pd_parser.parse_pd._load_data",
"pd_parser.add_pd_off_events",
"pd_parser.simulate_pd_data",
"numpy.random.random",
"os.path.join",
"mne.events_from_annotations",
"numpy.array",
"numpy.random.seed",
"matplotlib.pyplot.subplots",
"numpy.random.randn",
... | [((835, 845), 'mne.utils._TempDir', '_TempDir', ([], {}), '()\n', (843, 845), False, 'from mne.utils import _TempDir\n'), ((874, 892), 'numpy.random.seed', 'np.random.seed', (['(29)'], {}), '(29)\n', (888, 892), True, 'import numpy as np\n'), ((1099, 1200), 'pd_parser.simulate_pd_data', 'pd_parser.simulate_pd_data', ([... |
from typing import NamedTuple
from hashkernel.ake import NULL_CAKE, Cake
from hashkernel.logic import DagMeta, EdgeMold, Task
def fn(n: Cake, i: int) -> Cake:
print(f"n:{n} i:{i}")
return n
class Worker(NamedTuple):
name: str
id: int
x: Cake
def fn2() -> Worker:
e = Worker("Guido", 5, NUL... | [
"hashkernel.logic.EdgeMold",
"hashkernel.logic.Task"
] | [((481, 491), 'hashkernel.logic.EdgeMold', 'EdgeMold', ([], {}), '()\n', (489, 491), False, 'from hashkernel.logic import DagMeta, EdgeMold, Task\n'), ((504, 513), 'hashkernel.logic.Task', 'Task', (['fn2'], {}), '(fn2)\n', (508, 513), False, 'from hashkernel.logic import DagMeta, EdgeMold, Task\n'), ((526, 563), 'hashk... |
# Copyright (c) 2017 Red Hat, Inc
from django.urls import path
from . import views
app_name = 'network_ui_dev'
urlpatterns = [
path(r'tests', views.tests),
path(r'upload_test', views.upload_test),
path(r'download_coverage/<int:pk>', views.download_coverage),
path(r'download_trace', views.download_trac... | [
"django.urls.path"
] | [((133, 159), 'django.urls.path', 'path', (['"""tests"""', 'views.tests'], {}), "('tests', views.tests)\n", (137, 159), False, 'from django.urls import path\n'), ((166, 204), 'django.urls.path', 'path', (['"""upload_test"""', 'views.upload_test'], {}), "('upload_test', views.upload_test)\n", (170, 204), False, 'from dj... |
import feedparser as fp
import re
from bs4 import BeautifulSoup, Comment
import os.path as path
from nonebot import on_command, CommandSession, on_startup
from nonebot.message import unescape
import asyncio
import asyncpg
from datetime import datetime
import nonebot
import pytz
from aiocqhttp.exceptions import Error as... | [
"feedparser.parse",
"bs4.BeautifulSoup",
"nonebot.get_bot",
"db.db.pool.acquire"
] | [((601, 618), 'nonebot.get_bot', 'nonebot.get_bot', ([], {}), '()\n', (616, 618), False, 'import nonebot\n'), ((1887, 1939), 'feedparser.parse', 'fp.parse', (['"""http://172.18.0.1:1200/mihoyo/bh3/latest"""'], {}), "('http://172.18.0.1:1200/mihoyo/bh3/latest')\n", (1895, 1939), True, 'import feedparser as fp\n'), ((635... |
import unittest
import os
import numpy as np
from astropy import constants
import lal
import matplotlib.pyplot as plt
import bilby
from bilby.core import utils
class TestConstants(unittest.TestCase):
def test_speed_of_light(self):
self.assertEqual(utils.speed_of_light, lal.C_SI)
self.assertLess(... | [
"bilby.core.utils.get_sampling_frequency_and_duration_from_time_array",
"bilby.core.utils.infer_args_from_method",
"bilby.core.utils.reflect",
"numpy.array",
"bilby.core.utils.infft",
"numpy.sin",
"unittest.main",
"os.remove",
"numpy.random.random",
"numpy.linspace",
"numpy.random.normal",
"nu... | [((12385, 12400), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12398, 12400), False, 'import unittest\n'), ((1445, 1504), 'bilby.core.utils.create_time_series', 'utils.create_time_series', (['self.sampling_frequency', 'duration'], {}), '(self.sampling_frequency, duration)\n', (1469, 1504), False, 'from bilby.co... |
# -*- coding: utf-8 -*-
from knapsack_unwind import calculate_used_items_in_knapsack
from item_unwind import Item
import sys
def main():
items_count, weight = map(int, input().split())
items = []
for _i in range(items_count):
item_weight, item_value = map(int, input().split())
... | [
"knapsack_unwind.calculate_used_items_in_knapsack",
"item_unwind.Item"
] | [((385, 432), 'knapsack_unwind.calculate_used_items_in_knapsack', 'calculate_used_items_in_knapsack', (['items', 'weight'], {}), '(items, weight)\n', (417, 432), False, 'from knapsack_unwind import calculate_used_items_in_knapsack\n'), ((334, 363), 'item_unwind.Item', 'Item', (['item_weight', 'item_value'], {}), '(item... |
# pylint: skip-file
import base64
# pylint: disable=too-many-arguments
class Secret(OpenShiftCLI):
''' Class to wrap the oc command line tools
'''
def __init__(self,
namespace,
secret_name=None,
decode=False,
kubeconfig='/etc/origin/maste... | [
"base64.decodestring"
] | [((1136, 1162), 'base64.decodestring', 'base64.decodestring', (['value'], {}), '(value)\n', (1155, 1162), False, 'import base64\n')] |
import databases
import sqlalchemy
from fastapi_users.db import SQLAlchemyBaseUserTable, SQLAlchemyUserDatabase
from sqlalchemy.ext.declarative import DeclarativeMeta, declarative_base
from .models import UserDB
DATABASE_URL = "postgresql://postgres:example@db/postgres"
database = databases.Database(DATABASE_URL)
Bas... | [
"fastapi_users.db.SQLAlchemyUserDatabase",
"sqlalchemy.create_engine",
"databases.Database",
"sqlalchemy.ext.declarative.declarative_base"
] | [((284, 316), 'databases.Database', 'databases.Database', (['DATABASE_URL'], {}), '(DATABASE_URL)\n', (302, 316), False, 'import databases\n'), ((341, 359), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (357, 359), False, 'from sqlalchemy.ext.declarative import DeclarativeMeta, de... |
"""
Support for kenaan service installation and management.
"""
import os
from fabric.api import execute, run, settings, env, cd, abort, puts, put
from fabric.contrib import files
from twisted.python.filepath import FilePath
from twisted.python.util import sibpath
from braid import cron
from braid.twisted import serv... | [
"fabric.contrib.files.exists",
"fabric.api.env.get",
"fabric.api.cd",
"twisted.python.filepath.FilePath",
"os.path.join",
"fabric.api.puts",
"twisted.python.util.sibpath",
"fabric.api.run",
"os.path.dirname",
"fabric.api.settings",
"fabric.api.execute",
"fabric.api.abort"
] | [((1762, 1793), 'twisted.python.util.sibpath', 'sibpath', (['__file__', '"""private.py"""'], {}), "(__file__, 'private.py')\n", (1769, 1793), False, 'from twisted.python.util import sibpath\n'), ((650, 681), 'fabric.api.settings', 'settings', ([], {'user': 'self.serviceUser'}), '(user=self.serviceUser)\n', (658, 681), ... |
from django import forms
from django.http import HttpResponseBadRequest, HttpResponseRedirect, Http404
from django.shortcuts import render
from django.urls import reverse
from .models import Task, TeamMember
def index(request):
return render(request, "projects/index.html", {
"projects": Task.objects.all()... | [
"django.urls.reverse"
] | [((824, 856), 'django.urls.reverse', 'reverse', (['"""task"""'], {'args': '(task_id,)'}), "('task', args=(task_id,))\n", (831, 856), False, 'from django.urls import reverse\n')] |
# pylint: disable=too-many-arguments, line-too-long
"""
The functions in this module generate cloud formation scripts that install common AWS environments and components
"""
from troposphere import Ref, Tags, Join, Base64, GetAtt
from troposphere.autoscaling import AutoScalingGroup, LaunchConfiguration, Tag
import ... | [
"troposphere.autoscaling.LaunchConfiguration",
"troposphere.GetAtt",
"troposphere.Ref",
"troposphere.elasticloadbalancing.Listener",
"troposphere.elasticloadbalancing.HealthCheck",
"troposphere.Base64"
] | [((7531, 7577), 'troposphere.GetAtt', 'GetAtt', (['source_security_group.title', '"""GroupId"""'], {}), "(source_security_group.title, 'GroupId')\n", (7537, 7577), False, 'from troposphere import Ref, Tags, Join, Base64, GetAtt\n'), ((8502, 8553), 'troposphere.GetAtt', 'GetAtt', (['destination_security_group.title', '"... |
from milkman import *
from testapp.models import *
import unittest
import types
from django.db import models
MODELS = [Root, Child]
class ModelTest(unittest.TestCase):
def tearDown(self):
for m in MODELS:
m._default_manager.all().delete()
def test_create(self):
r = milkman.de... | [
"django.db.models.EmailField"
] | [((1921, 1940), 'django.db.models.EmailField', 'models.EmailField', ([], {}), '()\n', (1938, 1940), False, 'from django.db import models\n')] |
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pandas as pd
import scipy as sc
import pickle
import os
from . import preprocess
from scipy.sparse import vstack, csr_matrix, csc_matrix, lil_matrix
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.preprocessing import no... | [
"pandas.Series",
"numpy.sqrt",
"numpy.union1d",
"pandas.read_csv",
"scipy.sparse.vstack",
"numpy.where",
"sklearn.metrics.pairwise.cosine_similarity",
"numpy.argsort",
"numpy.array",
"numpy.dot",
"numpy.zeros",
"pandas.DataFrame",
"scipy.sparse.csr_matrix"
] | [((8274, 8286), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (8282, 8286), True, 'import numpy as np\n'), ((8301, 8313), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (8309, 8313), True, 'import numpy as np\n'), ((12314, 12375), 'pandas.DataFrame', 'pd.DataFrame', (['dataset.target_playlists[:pred_matrix.sha... |
# -*- coding: utf-8 -*-
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"google.cloud.bigquery.datatransfer_v1.proto.datasource_pb2.FinishRunRequest",
"google.cloud.bigquery.datatransfer_v1.gapic.transports.data_source_service_grpc_transport.DataSourceServiceGrpcTransport",
"google.oauth2.service_account.Credentials.from_service_account_file",
"google.cloud.bigquery.datatransfer_... | [((1689, 1756), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['"""google-cloud-bigquerydatatransfer"""'], {}), "('google-cloud-bigquerydatatransfer')\n", (1719, 1756), False, 'import pkg_resources\n'), ((2926, 2989), 'google.oauth2.service_account.Credentials.from_service_account_file', 'service... |
"""
Common maths functions and datatypes for solving Advent of Code problems
"""
import functools
import operator
def saturate(value):
"""
Saturates a value, so it is only ever between 0 and 1
:param float value: the value to saturate
:return float: the value, but clamped between 0 and 1
"""
... | [
"functools.reduce"
] | [((961, 1004), 'functools.reduce', 'functools.reduce', (['operator.mul', 'iterable', '(1)'], {}), '(operator.mul, iterable, 1)\n', (977, 1004), False, 'import functools\n')] |
from __future__ import absolute_import
from django.test import TestCase
from hashids import Hashids
from tests import models
TEST_HASH_IDS = Hashids(salt='testing')
class SerializerMixinTestCase(TestCase):
"""
Base test case to provide common functionality for serializer mixin tests.
"""
fixtures ... | [
"tests.models.Organization.objects.get",
"tests.models.CarModel.objects.get",
"tests.models.Manufacturer.objects.get",
"tests.models.Owner.objects.get",
"hashids.Hashids",
"tests.models.Sku.objects.get"
] | [((145, 168), 'hashids.Hashids', 'Hashids', ([], {'salt': '"""testing"""'}), "(salt='testing')\n", (152, 168), False, 'from hashids import Hashids\n'), ((450, 483), 'tests.models.Manufacturer.objects.get', 'models.Manufacturer.objects.get', ([], {}), '()\n', (481, 483), False, 'from tests import models\n'), ((516, 545)... |
"""Elasticsearch database utils.
References
-----------
https://www.elastic.co/guide/en/elasticsearch/reference/7.14/index.html
https://opendistro.github.io/for-elasticsearch-docs/docs/elasticsearch/aggregations/
https://github.com/oliver006/elasticsearch-gmail
Query DSL:
https://github.com/elastic/elasticsearch-dsl-... | [
"elasticsearch_dsl.query.MultiMatch",
"elasticsearch.helpers.bulk",
"elasticsearch.Elasticsearch",
"elasticsearch_dsl.Search",
"pandas.DataFrame"
] | [((819, 905), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {'hosts': "['http://localhost:9200']", 'timeout': '(60)', 'retry_on_timeout': '(True)'}), "(hosts=['http://localhost:9200'], timeout=60, retry_on_timeout\n =True)\n", (832, 905), False, 'from elasticsearch import Elasticsearch\n'), ((1574, 1607), 'el... |
import hashlib
import json
import os
import wormhole.errors
from PyQt5.QtCore import QObject
from twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError
from twisted.protocols.basic import FileSender
from wormhole import create
from wormhole.cli.cmd_send import APPID
from wormhole.cli.public_relay im... | [
"wormhole.transit.TransitReceiver",
"hashlib.sha256",
"os.path.exists",
"wormhole.transit.TransitSender",
"twisted.internet.defer.returnValue",
"twisted.protocols.basic.FileSender",
"json.dumps",
"wormhole.create",
"os.path.basename",
"os.stat"
] | [((3791, 3808), 'twisted.internet.defer.returnValue', 'returnValue', (['code'], {}), '(code)\n', (3802, 3808), False, 'from twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError\n'), ((4404, 4421), 'twisted.internet.defer.returnValue', 'returnValue', (['code'], {}), '(code)\n', (4415, 4421), False, '... |
import datetime
import os
import requests
def lambda_handler(event, context):
current_time = datetime.datetime.now()
current_time += datetime.timedelta(hours=5, minutes=30)
if current_time.strftime("%H") >= "08":
current_time += datetime.timedelta(days=1)
date = str(current_time.strftime('%d'... | [
"datetime.datetime.now",
"datetime.timedelta",
"requests.post",
"requests.request"
] | [((100, 123), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (121, 123), False, 'import datetime\n'), ((144, 183), 'datetime.timedelta', 'datetime.timedelta', ([], {'hours': '(5)', 'minutes': '(30)'}), '(hours=5, minutes=30)\n', (162, 183), False, 'import datetime\n'), ((252, 278), 'datetime.timede... |
# -*- coding: utf-8 -*-
__version__ = '0.9.2'
__author__ = '<NAME> <<EMAIL>>'
__license__ = "Apache 2"
import os
import sys
import copy
import uuid
import hashlib
import argparse
import functools
import pkg_resources
import sphinx
from sphinx.util.osutil import copyfile
try:
from sphinx.util import logging
... | [
"argparse.ArgumentParser",
"sphinx.util.osutil.copyfile",
"pkg_resources.iter_entry_points",
"os.path.join",
"functools.wraps",
"uuid.uuid4",
"os.path.isfile",
"os.path.dirname",
"docutils.nodes.Text",
"sphinx.util.logging.getLogger",
"requests.get",
"copy.deepcopy",
"os.path.abspath",
"do... | [((330, 357), 'sphinx.util.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (347, 357), False, 'from sphinx.util import logging\n'), ((6272, 6322), 'os.path.join', 'os.path.join', (['app.builder.outdir', 'STATICS_DIR_NAME'], {}), '(app.builder.outdir, STATICS_DIR_NAME)\n', (6284, 6322), Fals... |
import numpy as np
from math import sin, cos, atan2, tan, sqrt, pi
import matplotlib.pyplot as plt
import time
from bdsim.components import TransferBlock, FunctionBlock
from bdsim.graphics import GraphicsBlock
class MultiRotor(TransferBlock):
"""
:blockname:`MULTIROTOR`
.. table::
:align: le... | [
"numpy.clip",
"numpy.sqrt",
"numpy.cross",
"numpy.any",
"math.cos",
"numpy.array",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.linspace",
"math.atan2",
"numpy.sum",
"matplotlib.pyplot.draw",
"math.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((29901, 29935), 'numpy.sqrt', 'np.sqrt', (['((900 ** 2 + 700 ** 2) / 2)'], {}), '((900 ** 2 + 700 ** 2) / 2)\n', (29908, 29935), True, 'import numpy as np\n'), ((7082, 7109), 'numpy.zeros', 'np.zeros', (['(3, self.nrotors)'], {}), '((3, self.nrotors))\n', (7090, 7109), True, 'import numpy as np\n'), ((7130, 7155), 'n... |
import tkinter
import tkinter.ttk as ttk
import jpype as jp
import numpy as np
import datetime as dt
import ConnectionManager as cm
import DownloadManager as dm
from tkinter import filedialog
class MyApp(tkinter.Frame):
def __init__(self, master):
super().__init__(master)
self.pack(fill='both', exp... | [
"tkinter.Menu",
"tkinter.filedialog.askdirectory",
"DownloadManager.DownloadManager",
"tkinter.Toplevel",
"tkinter.Button",
"tkinter.ttk.Scrollbar",
"tkinter.Tk",
"jpype.JBoolean",
"jpype.JString",
"tkinter.Label",
"tkinter.filedialog.askopenfilename",
"ConnectionManager.ConnectionManager",
... | [((7699, 7711), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (7709, 7711), False, 'import tkinter\n'), ((371, 391), 'tkinter.Menu', 'tkinter.Menu', (['master'], {}), '(master)\n', (383, 391), False, 'import tkinter\n'), ((573, 619), 'tkinter.filedialog.askdirectory', 'filedialog.askdirectory', ([], {'title': '"""Selec... |
import json
import numpy
from RecomandEngine.restrictions.RestrictionConflicts import RestrictionConflict, RestrictionAlphaOrBeta
from RecomandEngine.restrictions.RestrictionDependences import RestrictionOneToOneDependency, \
RestrictionOneToManyDependency, RestrictionManyToManyDependency, RestrictionManyToManyDepe... | [
"RecomandEngine.exactsolvers.nonlinear.SMT_Solver_Z3_RealBool.Z3_Solver",
"RecomandEngine.exactsolvers.nonlinear.SMT_Solver_Z3_RealReal.Z3_Solver",
"RecomandEngine.exactsolvers.linear.SMT_Solver_Z3_RealPBC.Z3_Solver",
"RecomandEngine.problem.Component.Component",
"RecomandEngine.exactsolvers.linear.IntIntOr... | [((1320, 1376), 'numpy.zeros', 'numpy.zeros', (['(self.nrComp, self.nrComp)'], {'dtype': 'numpy.int'}), '((self.nrComp, self.nrComp), dtype=numpy.int)\n', (1331, 1376), False, 'import numpy\n'), ((1412, 1468), 'numpy.zeros', 'numpy.zeros', (['(self.nrComp, self.nrComp)'], {'dtype': 'numpy.int'}), '((self.nrComp, self.n... |
# Copyright 2017 The Forseti Security 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 ap... | [
"re.compile"
] | [((1496, 1549), 're.compile', 're.compile', (['"""(?:^[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?$)"""'], {}), "('(?:^[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?$)')\n", (1506, 1549), False, 'import re\n')] |
from kivy.utils import platform
if platform != "android":
from glob import glob
import serial
else:
from usb4a import usb
from usbserial4a import serial4a
class USBdevice():
def get_usb_devices(self):
try:
self.usb_device = usb.get_usb_device_list()[0]
except NameError:
... | [
"serial.Serial",
"usb4a.usb.get_usb_device_list",
"usbserial4a.serial4a.get_serial_port",
"glob.glob"
] | [((265, 290), 'usb4a.usb.get_usb_device_list', 'usb.get_usb_device_list', ([], {}), '()\n', (288, 290), False, 'from usb4a import usb\n'), ((1233, 1280), 'usbserial4a.serial4a.get_serial_port', 'serial4a.get_serial_port', (['port', '(9600)', '(8)', '"""N"""', '(1)'], {}), "(port, 9600, 8, 'N', 1)\n", (1257, 1280), Fals... |
import tempfile
import os
import shutil
import time
import threading
import multiprocessing
from mapproxy.util.lock import FileLock
from nose.tools import eq_
lock_dir = tempfile.mkdtemp()
lock_file = os.path.join(lock_dir, 'lock.lck')
count_file = os.path.join(lock_dir, 'count.txt')
open(count_file, 'w').write('0')... | [
"os.path.join",
"time.sleep",
"mapproxy.util.lock.FileLock",
"tempfile.mkdtemp",
"multiprocessing.Pool",
"shutil.rmtree",
"threading.Thread"
] | [((173, 191), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (189, 191), False, 'import tempfile\n'), ((204, 238), 'os.path.join', 'os.path.join', (['lock_dir', '"""lock.lck"""'], {}), "(lock_dir, 'lock.lck')\n", (216, 238), False, 'import os\n'), ((252, 287), 'os.path.join', 'os.path.join', (['lock_dir', '"... |
from django.contrib import admin
# Register your models here.
from .models import Test
admin.site.register(Test) | [
"django.contrib.admin.site.register"
] | [((90, 115), 'django.contrib.admin.site.register', 'admin.site.register', (['Test'], {}), '(Test)\n', (109, 115), False, 'from django.contrib import admin\n')] |
from collections import defaultdict
from braces.views import LoginRequiredMixin
from django.contrib import messages
from django.contrib.auth.context_processors import PermWrapper
from django.db.models import Count, F, Q
from django.forms.utils import timezone
from django.http import HttpResponseRedirect, JsonResponse
... | [
"django.db.models.Count",
"django.utils.translation.gettext_lazy",
"qatrack.parts.forms.PartStorageCollectionFormset",
"django.urls.reverse",
"qatrack.parts.models.Storage.objects.create",
"qatrack.attachments.models.Attachment.objects.filter",
"qatrack.attachments.views.listable_attachment_tags",
"dj... | [((7816, 7831), 'django.utils.translation.gettext_lazy', '_l', (['"""All Parts"""'], {}), "('All Parts')\n", (7818, 7831), True, 'from django.utils.translation import gettext_lazy as _l\n'), ((12170, 12195), 'django.utils.translation.gettext_lazy', '_l', (['"""Low Inventory Parts"""'], {}), "('Low Inventory Parts')\n",... |
"""Common functions for accessing the HTS Workflow REST API
"""
from __future__ import unicode_literals
import base64
import six
from six.moves import configparser
import random
import requests
import logging
import os
from six.moves import urllib
LOGGER = logging.getLogger(__name__)
def add_auth_options(parser):
... | [
"logging.getLogger",
"six.moves.configparser.SafeConfigParser",
"optparse.OptionParser",
"requests.get",
"six.int2byte",
"random.random",
"six.moves.urllib.parse.urljoin",
"random.SystemRandom",
"os.path.expanduser"
] | [((260, 287), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'import logging\n'), ((445, 476), 'six.moves.configparser.SafeConfigParser', 'configparser.SafeConfigParser', ([], {}), '()\n', (474, 476), False, 'from six.moves import configparser\n'), ((2514, 2558), 'six.m... |
"""
Homomorphisms Between Matrix Groups
Deprecated May, 2018; use :class:`sage.groups.libgap_morphism` instead.
"""
#*****************************************************************************
# Copyright (C) 2006 <NAME> and <NAME> <<EMAIL>>
#
# Distributed under the terms of the GNU General Public License (... | [
"sage.libs.gap.libgap.libgap",
"sage.misc.lazy_import.lazy_import",
"sage.misc.superseded.deprecation"
] | [((1520, 1640), 'sage.misc.lazy_import.lazy_import', 'lazy_import', (['"""sage.groups.libgap_morphism"""', '"""GroupMorphism_libgap"""', '"""MatrixGroupMorphism_im_gens"""'], {'deprecation': '(25444)'}), "('sage.groups.libgap_morphism', 'GroupMorphism_libgap',\n 'MatrixGroupMorphism_im_gens', deprecation=25444)\n", ... |
import os
import numpy as np
from ..model.model_zoo import *
from ..model.ssd import SSDLearner
from ..dataset.pascal_voc import PascalVOCObjectDataset
from ..dataset.coco import COCOObjectDataset
from ..model.configs import cfg
def set_up_pascalvoc_detection(config, output_dir, logger, device=0, queries_name='quer... | [
"os.path.join",
"numpy.arange",
"os.getenv"
] | [((541, 583), 'numpy.arange', 'np.arange', (["config['dataset']['train_size']"], {}), "(config['dataset']['train_size'])\n", (550, 583), True, 'import numpy as np\n'), ((601, 642), 'numpy.arange', 'np.arange', (["config['dataset']['test_size']"], {}), "(config['dataset']['test_size'])\n", (610, 642), True, 'import nump... |
from typing import Dict
from unittest import TestCase
from bib_models import DocID
from main.query_utils import get_docid_struct_for_search, get_primary_docid
class QueryTestCase(TestCase):
"""
Test cases for query_utils.py
"""
def test_get_docid_struct_for_search(self):
id_value = "ID"
... | [
"bib_models.DocID",
"main.query_utils.get_docid_struct_for_search",
"main.query_utils.get_primary_docid"
] | [((360, 409), 'bib_models.DocID', 'DocID', ([], {'id': 'id_value', 'type': 'type_value', 'primary': '(True)'}), '(id=id_value, type=type_value, primary=True)\n', (365, 409), False, 'from bib_models import DocID\n'), ((427, 461), 'main.query_utils.get_docid_struct_for_search', 'get_docid_struct_for_search', (['docid'], ... |
def loadWordSet():
s = set()
try:
with open('/usr/share/dict/american-english', 'r') as f:
for line in f:
#print(line)
s.add(line.strip())
except:
print("Sorry! This only words on a linux machine currently.")
return s
def getPlaintext(url):
... | [
"requests.get"
] | [((346, 363), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (358, 363), False, 'import requests\n')] |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (t... | [
"logging.getLogger",
"formencode.validators.StringBool",
"formencode.validators.UnicodeString",
"pkg_resources.resource_filename",
"allura.lib.widgets.search.SearchHelp",
"allura.app.Application.__init__",
"allura.lib.widgets.search.SearchResults",
"allura.lib.search.search_app",
"six.moves.map",
... | [((1383, 1410), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1400, 1410), False, 'import logging\n'), ((2309, 2359), 'tg.expose', 'expose', (['"""jinja:allura:templates/search_index.html"""'], {}), "('jinja:allura:templates/search_index.html')\n", (2315, 2359), False, 'from tg import e... |
import numpy as np
import unittest
import os
import shutil
# Data from Geradin
# time[s] theta[rad]
geradin_FoR0 = np.array([[-0.0117973, 1.56808],
[0.0816564, 1.5394],
[0.171988, 1.41698],
[0.235203, 1.31521],
[0.307327, 1... | [
"sharpy.utils.generate_cases.LagrangeConstraint",
"sharpy.utils.generate_cases.BodyInformation",
"sharpy.utils.generate_cases.clean_test_files",
"numpy.ones",
"sharpy.utils.generate_cases.SimulationInformation",
"sharpy.utils.generate_cases.generate_multibody_file",
"sharpy.utils.generate_cases.Aeroelas... | [((116, 1209), 'numpy.array', 'np.array', (['[[-0.0117973, 1.56808], [0.0816564, 1.5394], [0.171988, 1.41698], [0.235203,\n 1.31521], [0.307327, 1.09265], [0.427399, 0.601124], [0.526338, \n 0.0899229], [0.646417, -0.394903], [0.748531, -0.765465], [0.868959, -\n 0.94209], [0.905131, -0.956217], [0.965504, -0.... |
import time
import hmac
import hashlib
import urllib
import urllib.request
import json
from decimal import *
from ccas.models import exchanges
def get_balances(public_key, secret_key):
return_reposne = {}
try:
req = {}
req['command'] = "returnBalances"
req['nonce'] = int(time.time() * ... | [
"hmac.new",
"json.loads",
"urllib.request.Request",
"urllib.parse.urlencode",
"time.time",
"urllib.request.urlopen",
"ccas.models.exchanges.get_btc_price"
] | [((1841, 1915), 'urllib.request.urlopen', 'urllib.request.urlopen', (['"""https://poloniex.com/public?command=returnTicker"""'], {}), "('https://poloniex.com/public?command=returnTicker')\n", (1863, 1915), False, 'import urllib\n'), ((564, 641), 'urllib.request.Request', 'urllib.request.Request', (['"""https://poloniex... |
import datetime
from typing import Dict
from typing import List
from typing import Optional
import winter
@winter.controller
@winter.route('with-query-parameter')
class ControllerWithQueryParameters:
@winter.map_query_parameter('string', to='mapped_string')
@winter.route_get('/{?date,boolean,optional_boole... | [
"winter.map_query_parameter",
"winter.route_get",
"winter.route"
] | [((130, 166), 'winter.route', 'winter.route', (['"""with-query-parameter"""'], {}), "('with-query-parameter')\n", (142, 166), False, 'import winter\n'), ((210, 266), 'winter.map_query_parameter', 'winter.map_query_parameter', (['"""string"""'], {'to': '"""mapped_string"""'}), "('string', to='mapped_string')\n", (236, 2... |
# Once for All: Train One Network and Specialize it for Efficient Deployment
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# International Conference on Learning Representations (ICLR), 2020.
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
def make_divisible(v, divi... | [
"torch.nn.functional.conv2d",
"torch.nn.ReLU",
"torch.nn.Sigmoid",
"torch.nn.Tanh",
"torch.nn.LeakyReLU",
"torch.nn.PixelShuffle",
"torch.nn.functional.relu6",
"torch.transpose",
"torch.nn.Conv2d",
"torch.nn.PReLU",
"torch.nn.ReLU6",
"torch.zeros"
] | [((3403, 3449), 'torch.nn.PixelShuffle', 'nn.PixelShuffle', ([], {'upscale_factor': 'upscale_factor'}), '(upscale_factor=upscale_factor)\n', (3418, 3449), True, 'import torch.nn as nn\n'), ((5585, 5708), 'torch.zeros', 'torch.zeros', ([], {'size': '[downscale_factor * downscale_factor * c, 1, downscale_factor, downscal... |
'''
CodonGenie (c) University of Liverpool 2020
CodonGenie is licensed under the MIT License.
To view a copy of this license, visit <http://opensource.org/licenses/MIT/>.
@author: neilswainston
'''
from codon_genie.client import CodonGenieClient
def seq_from_alignment(alignment, tax_id):
'''Generates a DNA se... | [
"codon_genie.client.CodonGenieClient"
] | [((397, 415), 'codon_genie.client.CodonGenieClient', 'CodonGenieClient', ([], {}), '()\n', (413, 415), False, 'from codon_genie.client import CodonGenieClient\n'), ((1177, 1195), 'codon_genie.client.CodonGenieClient', 'CodonGenieClient', ([], {}), '()\n', (1193, 1195), False, 'from codon_genie.client import CodonGenieC... |
from django.urls import path
from django.views.decorators.cache import cache_page
# from .views import, get_category, view_news, add_news
from .views import HomeNews, NewsByCategory, ViewNews, CreateNews, contact, \
register, user_login, user_logout
urlpatterns = [
path('register/', register, name='register')... | [
"django.urls.path"
] | [((276, 320), 'django.urls.path', 'path', (['"""register/"""', 'register'], {'name': '"""register"""'}), "('register/', register, name='register')\n", (280, 320), False, 'from django.urls import path\n'), ((326, 366), 'django.urls.path', 'path', (['"""login/"""', 'user_login'], {'name': '"""login"""'}), "('login/', use... |
import os
from brownie import accounts, config, network, Contract, RarePizzas
from brownie.network import web3
from scripts.helpers import get_account, deploy_mocks, LOCAL_BLOCKCHAIN_ENVIRONMENTS
def mint_pizza():
owner = get_account()
rarepizzas_address = os.environ.get('RAREPIZZAS_RINKEBY_PROXY_ADDRESS')
... | [
"os.environ.get",
"brownie.RarePizzas.at",
"scripts.helpers.get_account"
] | [((227, 240), 'scripts.helpers.get_account', 'get_account', ([], {}), '()\n', (238, 240), False, 'from scripts.helpers import get_account, deploy_mocks, LOCAL_BLOCKCHAIN_ENVIRONMENTS\n'), ((267, 317), 'os.environ.get', 'os.environ.get', (['"""RAREPIZZAS_RINKEBY_PROXY_ADDRESS"""'], {}), "('RAREPIZZAS_RINKEBY_PROXY_ADDRE... |
import numpy as np
import random
import os
import datetime
def str_list_to_float(str_list):
return [float(item) for item in str_list]
def str_list_to_int(str_list):
return [int(item) for item in str_list]
def read_embeddings(filename, n_node, n_embed):
with open(filename, "r") as f:
embedding... | [
"numpy.clip",
"os.path.exists",
"numpy.random.rand",
"random.shuffle",
"os.makedirs",
"numpy.exp",
"os.path.dirname",
"datetime.datetime.now",
"numpy.isnan"
] | [((1046, 1070), 'numpy.clip', 'np.clip', (['agm_x', '(1e-06)', '(1)'], {}), '(agm_x, 1e-06, 1)\n', (1053, 1070), True, 'import numpy as np\n'), ((1179, 1203), 'numpy.clip', 'np.clip', (['agm_x', '(1e-06)', '(1)'], {}), '(agm_x, 1e-06, 1)\n', (1186, 1203), True, 'import numpy as np\n'), ((1877, 1896), 'random.shuffle', ... |
# Copyright 2017 Bloomberg Finance L.P.
# 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... | [
"warnings.catch_warnings",
"rdflib.Graph",
"warnings.simplefilter",
"rdflib.Namespace",
"pycsvw.CSVW"
] | [((909, 1029), 'pycsvw.CSVW', 'CSVW', ([], {'csv_path': '"""tests/examples/events-listing.csv"""', 'metadata_path': '"""tests/examples/events-listing.csv-metadata.json"""'}), "(csv_path='tests/examples/events-listing.csv', metadata_path=\n 'tests/examples/events-listing.csv-metadata.json')\n", (913, 1029), False, 'f... |
"""ws-create-user script.
Create a new site user from command line.
"""
# Standard Library
import getpass
import os
import sys
import typing as t
# Websauna
from websauna.system.devop.cmdline import init_websauna
from websauna.system.devop.scripts import feedback_and_exit
from websauna.system.devop.scripts import get... | [
"websauna.system.devop.scripts.feedback_and_exit",
"websauna.system.user.utils.get_user_registry",
"websauna.system.user.utils.get_user_class",
"websauna.system.devop.cmdline.init_websauna",
"websauna.system.user.events.UserCreated",
"getpass.getpass",
"websauna.utils.time.now",
"websauna.system.devop... | [((799, 824), 'os.path.basename', 'os.path.basename', (['argv[0]'], {}), '(argv[0])\n', (815, 824), False, 'import os\n'), ((1004, 1063), 'websauna.system.devop.scripts.feedback_and_exit', 'feedback_and_exit', (['msg'], {'status_code': '(1)', 'display_border': '(False)'}), '(msg, status_code=1, display_border=False)\n'... |
"""
Signal processing.
"""
import collections.abc
import logging
from typing import Tuple
import numpy as np
from ridge_detection.helper import displayContours, save_to_disk
from ridge_detection.lineDetector import LineDetector
from ridge_detection.params import Params
from scipy import ndimage as ndi
from skimage.fil... | [
"numpy.sqrt",
"ridge_detection.params.Params",
"logging.error",
"numpy.imag",
"numpy.mean",
"numpy.max",
"alsa.image_proc.open_image",
"ridge_detection.helper.displayContours",
"numpy.linspace",
"numpy.real",
"numpy.min",
"scipy.ndimage.convolve",
"alsa.image_proc.img_binmat_line_segment",
... | [((1977, 2009), 'numpy.linspace', 'np.linspace', (['theta_0', 'theta_n', 'n'], {}), '(theta_0, theta_n, n)\n', (1988, 2009), True, 'import numpy as np\n'), ((2576, 2587), 'numpy.min', 'np.min', (['mat'], {}), '(mat)\n', (2582, 2587), True, 'import numpy as np\n'), ((2602, 2613), 'numpy.max', 'np.max', (['mat'], {}), '(... |
import pandas as pd
# Load in the csv named "position_frequencies.csv" you made in exercise 24
# Save it as position_freq
position_freq = pd.read_csv('data/position_freq_df.csv', index_col=0)
position_freq
# Use plot.bar() with position_freq
# Assign a color as Teal and set opacity to 0.5
# Don't forget to add ... | [
"pandas.read_csv"
] | [((141, 194), 'pandas.read_csv', 'pd.read_csv', (['"""data/position_freq_df.csv"""'], {'index_col': '(0)'}), "('data/position_freq_df.csv', index_col=0)\n", (152, 194), True, 'import pandas as pd\n')] |
# Generated by Django 2.0.3 on 2018-06-19 21:13
from django.db import migrations, models
import django.db.models.manager
import django_prices.models
class Migration(migrations.Migration):
dependencies = [
('product', '0064_productvariant_handle_stock'),
]
operations = [
migrations.Alter... | [
"django.db.models.CharField"
] | [((592, 637), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(123)', 'max_length': '(128)'}), '(default=123, max_length=128)\n', (608, 637), False, 'from django.db import migrations, models\n'), ((792, 837), 'django.db.models.CharField', 'models.CharField', ([], {'default': '(123)', 'max_length': '... |
from numpy import genfromtxt
from matplotlib.pyplot import figure, legend, loglog, savefig, xlabel, ylabel,show
from sys import argv
input_file = str(argv[1])
output_file = str(argv[2])
data = genfromtxt(input_file, skip_header=1, delimiter=',')
N = data[:,0]
err = data[:,1]
fig=figure()
loglog(N,1/N, '--', label='s... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.loglog",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"numpy.genfromtxt",
"matplotlib.pyplot.legend"
] | [((195, 247), 'numpy.genfromtxt', 'genfromtxt', (['input_file'], {'skip_header': '(1)', 'delimiter': '""","""'}), "(input_file, skip_header=1, delimiter=',')\n", (205, 247), False, 'from numpy import genfromtxt\n'), ((283, 291), 'matplotlib.pyplot.figure', 'figure', ([], {}), '()\n', (289, 291), False, 'from matplotlib... |
#/usr/bin/env python
from math import log2
from typing import List
def get_primes(n: int) -> List[int]:
"""Return a list of all prime numbers less than n.
This function determines if each integer is prime with efficiency
O(sqrt(n)). Memory consumption for each prime is O(1).
Arguments:
... | [
"math.log2"
] | [((2125, 2136), 'math.log2', 'log2', (['(n - 1)'], {}), '(n - 1)\n', (2129, 2136), False, 'from math import log2\n')] |
"""
Entry point for Inspector UI.
"""
import os
import utils
from elevate import elevate
import webbrowser
import server_config
import ui
from host_state import HostState
from packet_processor import PacketProcessor
from arp_scan import ArpScan
from packet_capture import PacketCapture
from arp_spoof import ArpSpoof
fr... | [
"utils.log",
"data_upload.DataUploader",
"utils.get_default_route",
"ui.start_main_ui",
"os.getuid",
"server_config.REPORT_URL.format",
"elevate.elevate",
"packet_processor.PacketProcessor",
"arp_scan.ArpScan",
"subprocess.call",
"utils.get_user_config",
"utils.is_ipv4_addr",
"arp_spoof.ArpS... | [((544, 567), 'utils.get_user_config', 'utils.get_user_config', ([], {}), '()\n', (565, 567), False, 'import utils\n'), ((613, 678), 'server_config.REPORT_URL.format', 'server_config.REPORT_URL.format', ([], {'user_key': "config_dict['user_key']"}), "(user_key=config_dict['user_key'])\n", (644, 678), False, 'import ser... |
###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: <NAME>
# Modified by <NAME> (@jiwoncpark) for joint reconstruction for
# multiple filters and parameter regression
###########################
from functools import partial
import torch
import magnify.latent_ode.lib.utils as utils
... | [
"torch.sort",
"magnify.latent_ode.drw_utils.get_drw_datasets",
"torch.stack",
"torch.Tensor",
"magnify.latent_ode.periodic_utils.Periodic1dDataset",
"magnify.latent_ode.lib.utils.inf_generator",
"magnify.latent_ode.periodic_utils.Periodic_1d",
"functools.partial",
"magnify.latent_ode.lib.utils.split... | [((5598, 5645), 'magnify.latent_ode.lib.utils.split_train_test', 'utils.split_train_test', (['dataset'], {'train_frac': '(0.8)'}), '(dataset, train_frac=0.8)\n', (5620, 5645), True, 'import magnify.latent_ode.lib.utils as utils\n'), ((5663, 5689), 'magnify.latent_ode.periodic_utils.Periodic1dDataset', 'Periodic1dDatase... |
import binascii
import json
from sqlalchemy import TypeDecorator, Text
class Json(TypeDecorator):
impl = Text
def process_bind_param(self, value, dialect):
if value is not None:
value = json.dumps(value)
return value
def process_result_value(self, value, dialect):
if... | [
"json.loads",
"json.dumps",
"binascii.unhexlify",
"binascii.hexlify"
] | [((218, 235), 'json.dumps', 'json.dumps', (['value'], {}), '(value)\n', (228, 235), False, 'import json\n'), ((360, 377), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (370, 377), False, 'import json\n'), ((1053, 1076), 'binascii.hexlify', 'binascii.hexlify', (['value'], {}), '(value)\n', (1069, 1076), Fals... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, shutil, argparse, re, json, traceback
from codecs import open
from configparser import RawConfigParser
from collections import defaultdict
import boto
from boto.mturk.connection import MTurkRequestError
from boto.mturk.price import Price
from boto.mturk.qu... | [
"os.path.exists",
"json.loads",
"boto.connect_mturk",
"os.path.join",
"os.path.realpath",
"boto.mturk.qualification.Qualifications",
"traceback.print_exc",
"os.path.isdir",
"collections.defaultdict",
"sys.exit",
"json.load",
"codecs.open",
"configparser.RawConfigParser",
"json.dump"
] | [((13976, 13998), 'os.path.isdir', 'os.path.isdir', (['basedir'], {}), '(basedir)\n', (13989, 13998), False, 'import sys, os, shutil, argparse, re, json, traceback\n'), ((14170, 14228), 'os.path.join', 'os.path.join', (['self.basedir', "(self.dirname + '.' + extension)"], {}), "(self.basedir, self.dirname + '.' + exten... |
import numpy as np
from scipy.interpolate import interp2d,interp1d
from .params import default_params
import camb
from camb import model
import scipy.interpolate as si
import scipy.constants as constants
"""
This module will (eventually) abstract away the choice of boltzmann codes.
However, it does it stupidly by simp... | [
"numpy.log10",
"camb.set_params",
"numpy.trapz",
"numpy.sqrt",
"scipy.interpolate.dfitpack.bispeu",
"numpy.log",
"numpy.asarray",
"numpy.sinc",
"scipy.interpolate.interp1d",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.linspace",
"camb.get_background",
"numpy.zeros_like",
"scipy.i... | [((16320, 16340), 'numpy.zeros', 'np.zeros', (['ells.shape'], {}), '(ells.shape)\n', (16328, 16340), True, 'import numpy as np\n'), ((2508, 2916), 'camb.set_params', 'camb.set_params', ([], {'ns': "params['ns']", 'As': "params['As']", 'H0': 'H0', 'cosmomc_theta': 'theta', 'ombh2': "params['ombh2']", 'omch2': "params['o... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 The Project U-Ray Authors.
#
# Use of this source code is governed by a ISC-style
# license that can be found in the LICENSE file or at
# https://opensource.org/licenses/ISC
#
# SPDX-License-Identifier: ISC
'''
Take bitstream .bit files and decode t... | [
"fasm.fasm_tuple_to_string",
"db.Database",
"argparse.ArgumentParser",
"os.getenv",
"fasm_disassembler.FasmDisassembler",
"os.path.join",
"bitstream.load_bitdata",
"contextlib.ExitStack",
"tempfile.NamedTemporaryFile"
] | [((1164, 1187), 'db.Database', 'Database', (['db_root', 'part'], {}), '(db_root, part)\n', (1172, 1187), False, 'from db import Database\n'), ((1228, 1266), 'fasm_disassembler.FasmDisassembler', 'fasm_disassembler.FasmDisassembler', (['db'], {}), '(db)\n', (1262, 1266), False, 'import fasm_disassembler\n'), ((2108, 220... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import picmodels.models.care_advisors.navigator_models
class Migration(migrations.Migration):
dependencies = [
('picmodels', '0034_auto_20170609_1624'),
]
operations = [
migrations.A... | [
"django.db.models.ImageField"
] | [((414, 542), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': 'picmodels.models.care_advisors.navigator_models.get_staff_pic_file_path', 'blank': '(True)', 'null': '(True)'}), '(upload_to=picmodels.models.care_advisors.navigator_models\n .get_staff_pic_file_path, blank=True, null=True)\n', (43... |
import pickle
import sys
import zlib
from scrapy.crawler import Crawler
from scrapy.utils.conf import build_component_list
from scrapy.utils.project import get_project_settings
from .utils import get_spider_class
class Cassette:
"""
Helper class to store request, response and output data.
"""
FIXTUR... | [
"pickle.dumps",
"scrapy.utils.project.get_project_settings",
"zlib.decompress",
"scrapy.crawler.Crawler"
] | [((2335, 2357), 'scrapy.utils.project.get_project_settings', 'get_project_settings', ([], {}), '()\n', (2355, 2357), False, 'from scrapy.utils.project import get_project_settings\n'), ((2585, 2614), 'scrapy.crawler.Crawler', 'Crawler', (['spider_cls', 'settings'], {}), '(spider_cls, settings)\n', (2592, 2614), False, '... |
from typing import Dict
from pyspark.sql import SparkSession, Column, DataFrame
from spark_auto_mapper.automappers.automapper import AutoMapper
from spark_auto_mapper.data_types.list import AutoMapperList
from spark_auto_mapper.helpers.automapper_helpers import AutoMapperHelpers as A
from tests.conftest import clean_s... | [
"spark_auto_mapper.automappers.automapper.AutoMapper",
"tests.conftest.clean_spark_session",
"spark_auto_mapper.helpers.automapper_helpers.AutoMapperHelpers.column",
"spark_auto_mapper.data_types.list.AutoMapperList"
] | [((425, 467), 'tests.conftest.clean_spark_session', 'clean_spark_session', ([], {'session': 'spark_session'}), '(session=spark_session)\n', (444, 467), False, 'from tests.conftest import clean_spark_session\n'), ((821, 871), 'spark_auto_mapper.automappers.automapper.AutoMapper', 'AutoMapper', ([], {'view': '"""members"... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2017-01-19 16:53
from __future__ import unicode_literals
from django.db import migrations
from django.utils.text import slugify
def create_identifier(apps, schema_editor):
Catalog = apps.get_model('questions', 'Catalog')
Section = apps.get_model('question... | [
"django.utils.text.slugify",
"django.db.migrations.RunPython"
] | [((1127, 1166), 'django.db.migrations.RunPython', 'migrations.RunPython', (['create_identifier'], {}), '(create_identifier)\n', (1147, 1166), False, 'from django.db import migrations\n'), ((546, 567), 'django.utils.text.slugify', 'slugify', (['obj.title_en'], {}), '(obj.title_en)\n', (553, 567), False, 'from django.uti... |
import os
from unittest import TestCase
from checkov.common.graph.db_connectors.networkx.networkx_db_connector import NetworkxConnector
from checkov.terraform.graph_builder.local_graph import TerraformLocalGraph
from checkov.terraform.parser import Parser
TEST_DIRNAME = os.path.dirname(os.path.realpath(__file__))
c... | [
"os.path.join",
"os.path.realpath",
"checkov.common.graph.db_connectors.networkx.networkx_db_connector.NetworkxConnector",
"checkov.terraform.parser.Parser",
"checkov.terraform.graph_builder.local_graph.TerraformLocalGraph"
] | [((289, 315), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (305, 315), False, 'import os\n'), ((517, 525), 'checkov.terraform.parser.Parser', 'Parser', ([], {}), '()\n', (523, 525), False, 'from checkov.terraform.parser import Parser\n'), ((648, 698), 'checkov.terraform.graph_builder.loca... |
#!/usr/bin/env python
import getopt
import os
import subprocess
import sys
CPPLINT_PY = os.path.dirname(os.path.abspath(__file__)) + '/cpplint.py'
CPPLINT_EXTENSIONS = ['cpp', 'hpp', 'tpp']
CPPLINT_FILTERS = ['-whitespace/indent', '-runtime/references', '+build/include_alpha', '-build/c++11', '-legal/copyright', '-r... | [
"subprocess.check_output",
"getopt.getopt",
"os.getenv",
"os.chdir",
"os.path.abspath",
"os.system"
] | [((553, 581), 'os.getenv', 'os.getenv', (['"""HUSKY_ROOT"""', '"""."""'], {}), "('HUSKY_ROOT', '.')\n", (562, 581), False, 'import os\n'), ((582, 602), 'os.chdir', 'os.chdir', (['husky_root'], {}), '(husky_root)\n', (590, 602), False, 'import os\n'), ((2348, 2366), 'os.system', 'os.system', (['run_cmd'], {}), '(run_cmd... |
import threading
import time
import ctypes
class CmdThread(threading.Thread):
def __init__(self, app, commands):
threading.Thread.__init__(self)
self.app = app
self.commands = commands
def run(self):
import subprocess
import os
os.chdir(self.app['path'])
... | [
"ctypes.py_object",
"threading.Thread.__init__",
"threading._active.items",
"os.chdir",
"subprocess.call",
"ctypes.pythonapi.PyThreadState_SetAsyncExc"
] | [((129, 160), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (154, 160), False, 'import threading\n'), ((293, 319), 'os.chdir', 'os.chdir', (["self.app['path']"], {}), "(self.app['path'])\n", (301, 319), False, 'import os\n'), ((797, 822), 'threading._active.items', 'threading._ac... |
import aiohttp_apispec
from aiohttp import web
from app.api.v2.handlers.base_object_api import BaseObjectApi
from app.api.v2.managers.agent_api_manager import AgentApiManager
from app.api.v2.schemas.deploy_command_schemas import DeployCommandsSchema
from app.api.v2.schemas.base_schemas import BaseGetAllQuerySchema, Ba... | [
"app.objects.c_agent.AgentSchema",
"aiohttp_apispec.request_schema",
"aiohttp_apispec.querystring_schema",
"app.api.v2.managers.agent_api_manager.AgentApiManager",
"aiohttp_apispec.docs",
"aiohttp.web.json_response",
"aiohttp_apispec.response_schema",
"aiohttp.web.HTTPNoContent"
] | [((1346, 1383), 'aiohttp_apispec.docs', 'aiohttp_apispec.docs', ([], {'tags': "['agents']"}), "(tags=['agents'])\n", (1366, 1383), False, 'import aiohttp_apispec\n'), ((1389, 1446), 'aiohttp_apispec.querystring_schema', 'aiohttp_apispec.querystring_schema', (['BaseGetAllQuerySchema'], {}), '(BaseGetAllQuerySchema)\n', ... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
sbpy Bibliography Tracking Module
sbpy classes and functions can automatically report citations to the
user through a bibliography registry.
"""
__all__ = [
'register',
'reset',
'status',
'stop',
'track',
'Tracking',
'cite... | [
"warnings.catch_warnings",
"collections.defaultdict",
"functools.wraps",
"ads.SearchQuery"
] | [((1769, 1785), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (1780, 1785), False, 'from collections import OrderedDict, defaultdict\n'), ((1892, 1933), 'collections.defaultdict', 'defaultdict', (['_bibliography_task_generator'], {}), '(_bibliography_task_generator)\n', (1903, 1933), False, 'from ... |
#!/usr/bin/env python3
"""
This is an example of how the pytradfri-library can be used.
To run the script, do the following:
$ pip3 install pytradfri
$ Download this file (example_sync.py)
$ python3 test_pytradfri.py <IP> <KEY>
Where <IP> is the address to your IKEA gateway and
<KEY> is found on the back of your IKEA... | [
"pytradfri.Gateway",
"threading.Thread",
"time.sleep",
"pytradfri.api.libcoap_api.api_factory"
] | [((866, 879), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (876, 879), False, 'import time\n'), ((1000, 1037), 'pytradfri.api.libcoap_api.api_factory', 'api_factory', (['sys.argv[1]', 'sys.argv[2]'], {}), '(sys.argv[1], sys.argv[2])\n', (1011, 1037), False, 'from pytradfri.api.libcoap_api import api_factory\n'),... |
# -*- coding: utf-8 -*-
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk
from .popup import PopUp
class Mechanic:
def __init__(self, conndb):
self.conn = conndb
mechanik_builder = Gtk.Builder()
mechanik_builder.add_from_file("glade/mechanic.glade")
self.... | [
"gi.repository.Gtk.Builder",
"gi.repository.Gtk.main_quit",
"gi.require_version"
] | [((35, 67), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (53, 67), False, 'import gi\n'), ((229, 242), 'gi.repository.Gtk.Builder', 'Gtk.Builder', ([], {}), '()\n', (240, 242), False, 'from gi.repository import Gtk\n'), ((2696, 2711), 'gi.repository.Gtk.main_quit', '... |
from django.conf.urls import url
from cart import views
app_name = 'cart'
urlpatterns = [
url("^add_cart$", views.AddCartView.as_view(), name="add_cart"),
url("^$", views.ShowCartView.as_view(), name="show_cart"),
url("^update_cart$", views.UpdateCartView.as_view(), name="update_cart"),
url("^delete_c... | [
"cart.views.DeleteCartView.as_view",
"cart.views.UpdateCartView.as_view",
"cart.views.AddCartView.as_view",
"cart.views.ShowCartView.as_view"
] | [((114, 141), 'cart.views.AddCartView.as_view', 'views.AddCartView.as_view', ([], {}), '()\n', (139, 141), False, 'from cart import views\n'), ((175, 203), 'cart.views.ShowCartView.as_view', 'views.ShowCartView.as_view', ([], {}), '()\n', (201, 203), False, 'from cart import views\n'), ((249, 279), 'cart.views.UpdateCa... |
# coding: utf-8
"""
PassHub API
PassHub API documentation # noqa: E501
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Address(object):
"""NOTE: This class is auto generated by the swa... | [
"six.iteritems"
] | [((8088, 8121), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (8101, 8121), False, 'import six\n')] |
from setuptools import find_packages, setup
requirements = open('requirements.txt').read().split("\n")
version = "0.2"
setup(
name='pyeix',
version=version,
author='<NAME>',
author_email='<EMAIL>',
description='eix schema tools',
license='MIT',
scripts=['scripts/eix'],
classifiers=[
... | [
"setuptools.find_packages"
] | [((574, 589), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (587, 589), False, 'from setuptools import find_packages, setup\n')] |
#!/usr/bin/env python3
from unittest import TestCase
from public.shop import Shop
from public.clothing_store import ClothingStore
from public.bakery import Bakery
class TestShops(TestCase):
def test_bakery_loan(self):
bakery = Bakery(1000)
bakery.take_loan(0.1, 1000)
actual = bakery.pay_r... | [
"public.bakery.Bakery"
] | [((242, 254), 'public.bakery.Bakery', 'Bakery', (['(1000)'], {}), '(1000)\n', (248, 254), False, 'from public.bakery import Bakery\n'), ((442, 454), 'public.bakery.Bakery', 'Bakery', (['(1000)'], {}), '(1000)\n', (448, 454), False, 'from public.bakery import Bakery\n')] |
import cv2
img = cv2.imread('../Images/jurassicworld.jpg',cv2.IMREAD_COLOR)
res = cv2.resize(img,None,fx=3, fy=3, interpolation = cv2.INTER_LINEAR)
#OR
# height, width = img.shape[:2]
# res = cv.resize(img,(2*width, 2*height), interpolation = cv.INTER_LINEAR
cv2.imwrite('../Images/8scaling.jpg', res)
cv2.i... | [
"cv2.imwrite",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.resize",
"cv2.waitKey",
"cv2.imread"
] | [((20, 79), 'cv2.imread', 'cv2.imread', (['"""../Images/jurassicworld.jpg"""', 'cv2.IMREAD_COLOR'], {}), "('../Images/jurassicworld.jpg', cv2.IMREAD_COLOR)\n", (30, 79), False, 'import cv2\n'), ((88, 153), 'cv2.resize', 'cv2.resize', (['img', 'None'], {'fx': '(3)', 'fy': '(3)', 'interpolation': 'cv2.INTER_LINEAR'}), '(... |
# test annotation bboxes with extracted midframes and clips
import cv2
import os
import json
import numpy as np
AVA_FOLDER = os.environ['AVA_DIR'] + '/AVA'
segments_folder = AVA_FOLDER + '/segments/segments/'
annotations_folder = AVA_FOLDER + '/annotations/'
data_folder = AVA_FOLDER + '/data/'
objects_folder = AVA_... | [
"cv2.rectangle",
"numpy.copy",
"os.path.join",
"cv2.imshow",
"cv2.putText",
"numpy.random.randint",
"cv2.waitKey",
"os._exit",
"numpy.concatenate",
"json.load",
"cv2.imread"
] | [((2418, 2453), 'numpy.random.randint', 'np.random.randint', (['(0)', '(255)', '[100, 3]'], {}), '(0, 255, [100, 3])\n', (2435, 2453), True, 'import numpy as np\n'), ((555, 568), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (564, 568), False, 'import json\n'), ((945, 1030), 'os.path.join', 'os.path.join', (['segme... |
# standard library
from datetime import datetime
from datetime import timedelta
import time
# Django
from django.conf import settings
# 3rd party library
from celery.decorators import task
from celery.utils.log import get_task_logger
from slackclient import SlackClient
# my models here
from .models import Menu
log... | [
"celery.utils.log.get_task_logger",
"slackclient.SlackClient",
"datetime.datetime.now",
"datetime.timedelta",
"celery.decorators.task"
] | [((326, 351), 'celery.utils.log.get_task_logger', 'get_task_logger', (['__name__'], {}), '(__name__)\n', (341, 351), False, 'from celery.utils.log import get_task_logger\n'), ((355, 378), 'celery.decorators.task', 'task', ([], {'name': '"""daily_menu"""'}), "(name='daily_menu')\n", (359, 378), False, 'from celery.decor... |
import pandas as pd
import tensorflow as tf
def get_top_5(pred):
_, indexes = tf.math.top_k(pred, k=5)
indexes = indexes.numpy().astype(str)
parsed = " ".join(indexes)
return parsed
def _decode_predictions(predictions):
preds = [get_top_5(pred) for pred in predictions]
return preds
def generate_submiss... | [
"tensorflow.math.top_k"
] | [((81, 105), 'tensorflow.math.top_k', 'tf.math.top_k', (['pred'], {'k': '(5)'}), '(pred, k=5)\n', (94, 105), True, 'import tensorflow as tf\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | [
"pulumi.getter",
"pulumi.set",
"pulumi.ResourceOptions",
"pulumi.get"
] | [((2314, 2352), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""incidentTemplate"""'}), "(name='incidentTemplate')\n", (2327, 2352), False, 'import pulumi\n'), ((3082, 3115), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""chatChannel"""'}), "(name='chatChannel')\n", (3095, 3115), False, 'import pulumi\n'), ((3... |
from datetime import date
def retirement_calculator(current_age, retirement_age):
current_year = date.today().year
retirement_years = retirement_age - current_age
return f"""You have {retirement_years} years left until you can retire.
It's {current_year}, so you can retire in {current_year + retirement_ye... | [
"datetime.date.today"
] | [((103, 115), 'datetime.date.today', 'date.today', ([], {}), '()\n', (113, 115), False, 'from datetime import date\n')] |
import commands, yaml
with open("config.yml", "r") as f:
params = yaml.load(f)
f.close()
ftpsParams = params['ftps_webserver']
def upload_catalog(file_name = 'catalog.pdf'):
"""Uploading catalog to ftp server using TLS.
All valid system certificates will be accepted.
"""
cmd = 'curl --ssl-reqd --ftp-creat... | [
"commands.getstatusoutput",
"yaml.load"
] | [((71, 83), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (80, 83), False, 'import commands, yaml\n'), ((471, 500), 'commands.getstatusoutput', 'commands.getstatusoutput', (['cmd'], {}), '(cmd)\n', (495, 500), False, 'import commands, yaml\n')] |