code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/06a_models.alexnet.ipynb (unless otherwise specified).
__all__ = ['AlexNet3D']
# Cell
# export
import torch
from torch import nn
# Cell
class AlexNet3D(nn.Module):
def __init__(self, in_channels=3, num_classes=3):
super(AlexNet3D, self).__init__()
... | [
"torch.flatten",
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.AdaptiveAvgPool3d",
"torch.nn.Conv3d",
"torch.nn.Linear",
"torch.nn.MaxPool3d"
] | [((784, 815), 'torch.nn.AdaptiveAvgPool3d', 'nn.AdaptiveAvgPool3d', (['(1, 6, 6)'], {}), '((1, 6, 6))\n', (804, 815), False, 'from torch import nn\n'), ((1767, 1786), 'torch.flatten', 'torch.flatten', (['x', '(1)'], {}), '(x, 1)\n', (1780, 1786), False, 'import torch\n'), ((867, 879), 'torch.nn.Dropout', 'nn.Dropout', ... |
# coding: utf-8
import torch
import torchvision
from torchvision import transforms
from torch.utils.data import Dataset
from PIL import Image
import numpy as np
import util
from augmentations import *
_IMAGENET_PCA = {
'eigval': [0.2175, 0.0188, 0.0045],
'eigvec': [
[-0.5675, 0.7192, ... | [
"torchvision.datasets.SVHN",
"torchvision.datasets.FashionMNIST",
"torchvision.datasets.CIFAR100",
"torchvision.datasets.STL10",
"torchvision.datasets.CIFAR10",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize... | [((3858, 3971), 'torchvision.datasets.MNIST', 'torchvision.datasets.MNIST', ([], {'root': '"""../../datasets/mnist"""', 'train': '(True)', 'transform': 'transform_train', 'download': '(True)'}), "(root='../../datasets/mnist', train=True,\n transform=transform_train, download=True)\n", (3884, 3971), False, 'import to... |
import os
import random
import utils.io as io
from data.hico.hico_constants import HicoConstants
def split(global_ids,val_frac):
# val_frac is num_val / num_train_val
split_ids = {
'train': [],
'val': [],
'train_val': [],
'test': []
}
for global_id in global_ids:
... | [
"random.sample",
"utils.io.dump_json_object",
"data.hico.hico_constants.HicoConstants",
"utils.io.load_json_object",
"os.path.join"
] | [((548, 594), 'random.sample', 'random.sample', (["split_ids['train_val']", 'num_val'], {}), "(split_ids['train_val'], num_val)\n", (561, 594), False, 'import random\n'), ((815, 830), 'data.hico.hico_constants.HicoConstants', 'HicoConstants', ([], {}), '()\n', (828, 830), False, 'from data.hico.hico_constants import Hi... |
# Procedures of script generate-kml.py and generate-set-kml.py
#
# Author: <NAME>
# Date : Mar 26, 2020
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
import flickrapi
import api_credentials
import json
import time
import config
from common import isInSet
from common import hasTag... | [
"flickrapi.FlickrAPI",
"time.sleep"
] | [((467, 529), 'flickrapi.FlickrAPI', 'flickrapi.FlickrAPI', (['api_key', 'api_secret'], {'format': '"""parsed-json"""'}), "(api_key, api_secret, format='parsed-json')\n", (486, 529), False, 'import flickrapi\n'), ((4109, 4131), 'time.sleep', 'time.sleep', (['retry_wait'], {}), '(retry_wait)\n', (4119, 4131), False, 'im... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-03 16:21
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('ApplicationManagement', '0013_score'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((293, 352), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""score"""', 'name': '"""assessor"""'}), "(model_name='score', name='assessor')\n", (315, 352), False, 'from django.db import migrations\n'), ((397, 456), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], ... |
import os
from collections import OrderedDict
from distutils.dir_util import copy_tree
import shutil
import yaml
from .. import definitions as xrsdefs
from .regressor import Regressor
from .classifier import Classifier
_regression_models = {}
_classification_models = {}
_reg_conf = {}
_cl_conf = {}
def get_regress... | [
"yaml.load",
"os.path.exists",
"os.path.splitext",
"collections.OrderedDict",
"os.path.join",
"os.listdir"
] | [((720, 759), 'os.path.join', 'os.path.join', (['models_dir', '"""classifiers"""'], {}), "(models_dir, 'classifiers')\n", (732, 759), False, 'import os\n'), ((773, 811), 'os.path.join', 'os.path.join', (['models_dir', '"""regressors"""'], {}), "(models_dir, 'regressors')\n", (785, 811), False, 'import os\n'), ((1627, 1... |
import datetime as dt
from django.test import TestCase, RequestFactory
from .models import Domain
from .views import PingdomErrorView, PingdomWarningView, PingdomHealthCheckView
def current_time():
return dt.datetime.now(dt.timezone.utc)
def domain_factory(**kwargs):
default = {
'last_checked': cu... | [
"datetime.datetime.now",
"datetime.timedelta",
"django.test.RequestFactory"
] | [((213, 245), 'datetime.datetime.now', 'dt.datetime.now', (['dt.timezone.utc'], {}), '(dt.timezone.utc)\n', (228, 245), True, 'import datetime as dt\n'), ((637, 653), 'django.test.RequestFactory', 'RequestFactory', ([], {}), '()\n', (651, 653), False, 'from django.test import TestCase, RequestFactory\n'), ((333, 353), ... |
#!/usr/bin/env python
import sys
from conans.conan_server import main
main(sys.argv[1:]) | [
"conans.conan_server.main"
] | [((71, 89), 'conans.conan_server.main', 'main', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (75, 89), False, 'from conans.conan_server import main\n')] |
# -*- coding: utf-8 -*-
"""\
Caelus/OpenFOAM Input File Interface
-------------------------------------
"""
import os
import logging
try:
from collections.abc import Mapping
except ImportError: # pragma: no cover
from collections import Mapping
import six
from ..utils import osutils
from . import caelusdi... | [
"os.path.basename",
"os.getcwd",
"os.path.getsize",
"os.path.dirname",
"os.path.exists",
"six.StringIO",
"six.add_metaclass",
"os.path.join",
"logging.getLogger"
] | [((374, 401), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (391, 401), False, 'import logging\n'), ((2956, 2983), 'six.add_metaclass', 'six.add_metaclass', (['DictMeta'], {}), '(DictMeta)\n', (2973, 2983), False, 'import six\n'), ((6587, 6618), 'os.path.basename', 'os.path.basename', ([... |
################################################################################
# The Neural Network (NN) based Speech Synthesis System
# https://github.com/CSTR-Edinburgh/merlin
#
# Centre for Speech Technology Research
# University of Edinburgh, UK
# ... | [
"sys.stdout.write",
"keras_lib.data_utils.drawProgressBar",
"keras_lib.data_utils.get_stateful_input",
"keras_lib.data_utils.get_stateful_data",
"numpy.sum",
"os.path.basename",
"random.shuffle",
"keras_lib.data_utils.denorm_data",
"keras_lib.model.kerasModels.__init__",
"io_funcs.binary_io.Binary... | [((2489, 2623), 'keras_lib.model.kerasModels.__init__', 'kerasModels.__init__', (['self', 'n_in', 'hidden_layer_size', 'n_out', 'hidden_layer_type', 'output_type', 'dropout_rate', 'loss_function', 'optimizer'], {}), '(self, n_in, hidden_layer_size, n_out,\n hidden_layer_type, output_type, dropout_rate, loss_function... |
# Generated by Django 4.0.1 on 2022-01-24 12:39
import datetime
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='DeliveryPoint',
... | [
"django.db.models.ManyToManyField",
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"datetime.datetime"
] | [((358, 454), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (377, 454), False, 'from django.db import migrations, m... |
# Copyright 2021 DeepMind Technologies Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"setuptools.find_namespace_packages"
] | [((1086, 1133), 'setuptools.find_namespace_packages', 'find_namespace_packages', ([], {'exclude': "['examples.*']"}), "(exclude=['examples.*'])\n", (1109, 1133), False, 'from setuptools import find_namespace_packages\n')] |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Over Time"),
"items": [
{
"type": "doctype",
"name": "overtime",
"description": _("For Overtime.")
},
{
"type": "report",
"name": "Monthly Overtime",
"doctype": "o... | [
"frappe._"
] | [((104, 118), 'frappe._', '_', (['"""Over Time"""'], {}), "('Over Time')\n", (105, 118), False, 'from frappe import _\n'), ((214, 232), 'frappe._', '_', (['"""For Overtime."""'], {}), "('For Overtime.')\n", (215, 232), False, 'from frappe import _\n'), ((374, 402), 'frappe._', '_', (['"""Monthly Overtime Report"""'], {... |
__all__ = ['get_closest_topics', 'get_stable_topics']
from typing import List, Tuple, Any
import numpy as np
import tqdm
from ._distance import _dist_klb, _dist_sklb, _dist_jsd, _dist_jef, _dist_hel,\
_dist_bhat, _dist_jac, _dist_tv
from ._helpers import get_phi
dist_funcs = {
"klb": _dist_klb,
"sklb": _di... | [
"tqdm.tqdm",
"numpy.argmax",
"numpy.asarray",
"numpy.zeros",
"numpy.argmin",
"numpy.max",
"numpy.min",
"numpy.arange",
"numpy.delete"
] | [((2460, 2511), 'numpy.zeros', 'np.zeros', ([], {'shape': '(topics_num, models_num)', 'dtype': 'int'}), '(shape=(topics_num, models_num), dtype=int)\n', (2468, 2511), True, 'import numpy as np\n'), ((2541, 2562), 'numpy.arange', 'np.arange', (['topics_num'], {}), '(topics_num)\n', (2550, 2562), True, 'import numpy as n... |
import argparse
import collections
import logging
import numpy as np
import os
import random
import sys
import time
from copy import deepcopy
# BOHB: Robust and Efficient Hyperparameter Optimization at Scale, ICML 2018
import ConfigSpace
from hpbandster.optimizers.bohb import BOHB
import hpbandster.core.nameserver as ... | [
"ConfigSpace.ConfigurationSpace",
"numpy.random.seed",
"ConfigSpace.CategoricalHyperparameter",
"hpbandster.optimizers.bohb.BOHB",
"random.seed",
"hpbandster.core.nameserver.NameServer"
] | [((448, 494), 'ConfigSpace.ConfigurationSpace', 'ConfigSpace.ConfigurationSpace', (['args.rand_seed'], {}), '(args.rand_seed)\n', (478, 494), False, 'import ConfigSpace\n'), ((1750, 1777), 'random.seed', 'random.seed', (['args.rand_seed'], {}), '(args.rand_seed)\n', (1761, 1777), False, 'import random\n'), ((1782, 1812... |
import pyximport; pyximport.install()
from .account import AccountManager
from .classes import *
from .piston import Piston
from .engine import Engine
from . import lattice
from . import simulate
| [
"pyximport.install"
] | [((18, 37), 'pyximport.install', 'pyximport.install', ([], {}), '()\n', (35, 37), False, 'import pyximport\n')] |
from __init__ import get_settings
from base import BaseBackend
try:
from ..postmark import PMMail
except ImportError:
not_available = True
# Backend default settings and meta data
SETTINGS = {
'meta': {
'NAME': 'Postmark Email backend',
'DESCRIPTION': 'Backend which is using postmarkapp.com service to send em... | [
"__init__.get_settings"
] | [((560, 584), '__init__.get_settings', 'get_settings', (['"""postmark"""'], {}), "('postmark')\n", (572, 584), False, 'from __init__ import get_settings\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2020 Aibolit
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, m... | [
"aibolit.utils.ast.AST"
] | [((4904, 4917), 'aibolit.utils.ast.AST', 'AST', (['filename'], {}), '(filename)\n', (4907, 4917), False, 'from aibolit.utils.ast import AST\n')] |
import cv2
import numpy as np
imageWidth = 1280
imageHeight = 720
def onMouseMove(event, x, y, flag, param):
if(event == cv2.EVENT_MOUSEMOVE):
print(f"At ({x}, {y}) the depth is: {param[imageWidth * y + x]}")
def displayImage():
windowTitle = "AzureKinectTest"
bgraBytesCount = 4
# reading files into by... | [
"numpy.count_nonzero",
"cv2.cvtColor",
"numpy.frombuffer",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.setMouseCallback",
"cv2.imshow",
"cv2.namedWindow"
] | [((1051, 1092), 'numpy.frombuffer', 'np.frombuffer', (['imageBytes'], {'dtype': 'np.uint8'}), '(imageBytes, dtype=np.uint8)\n', (1064, 1092), True, 'import numpy as np\n'), ((1183, 1229), 'cv2.cvtColor', 'cv2.cvtColor', (['imageNpArray', 'cv2.COLOR_BGRA2BGR'], {}), '(imageNpArray, cv2.COLOR_BGRA2BGR)\n', (1195, 1229), ... |
import unittest
from hustle import select, Table, h_sum, h_count
from setup import IMPS, PIXELS
from hustle.core.settings import Settings, overrides
class TestBool(unittest.TestCase):
def setUp(self):
overrides['server'] = 'disco://localhost'
overrides['dump'] = False
overrides['nest'] = F... | [
"hustle.select",
"hustle.Table.from_tag",
"hustle.core.settings.Settings",
"hustle.h_sum"
] | [((349, 359), 'hustle.core.settings.Settings', 'Settings', ([], {}), '()\n', (357, 359), False, 'from hustle.core.settings import Settings, overrides\n'), ((442, 462), 'hustle.Table.from_tag', 'Table.from_tag', (['IMPS'], {}), '(IMPS)\n', (456, 462), False, 'from hustle import select, Table, h_sum, h_count\n'), ((477, ... |
# Copyright The PyTorch Lightning 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 agreed to i... | [
"torch.ones_like",
"functools.partial"
] | [((1608, 1675), 'functools.partial', 'partial', (['_log_with_name_and_prog_bar_override', 'adapter.log', 'adapter'], {}), '(_log_with_name_and_prog_bar_override, adapter.log, adapter)\n', (1615, 1675), False, 'from functools import partial\n'), ((1812, 1869), 'functools.partial', 'partial', (['_effdet_validation_step',... |
# Generated by Django 2.0.9 on 2018-12-11 19:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('payway', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='paywaylog',
name='amount',
... | [
"django.db.migrations.RemoveField"
] | [((227, 288), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""paywaylog"""', 'name': '"""amount"""'}), "(model_name='paywaylog', name='amount')\n", (249, 288), False, 'from django.db import migrations\n'), ((337, 396), 'django.db.migrations.RemoveField', 'migrations.RemoveField', (... |
"""Test the functions used to generate sequences."""
import unittest
from itertools import takewhile
import projecteuler.generators as generators
FIBONACCIS = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
TRIANGLES = [1, 3, 6, 10, 15, 21, 28, 36, 45]
PENTAGO... | [
"projecteuler.generators.pythagorean_triples",
"projecteuler.generators.pentagon_numbers",
"projecteuler.generators.next_collatz",
"projecteuler.generators.primes",
"itertools.takewhile",
"projecteuler.generators.triangle_numbers",
"projecteuler.generators.fibonaccis",
"projecteuler.generators.prime_f... | [((1695, 1724), 'projecteuler.generators.triangle_numbers', 'generators.triangle_numbers', ([], {}), '()\n', (1722, 1724), True, 'import projecteuler.generators as generators\n'), ((1961, 1990), 'projecteuler.generators.pentagon_numbers', 'generators.pentagon_numbers', ([], {}), '()\n', (1988, 1990), True, 'import proj... |
# coding=utf-8
from OTLMOW.OEFModel.EMObject import EMObject
from OTLMOW.OEFModel.EMAttribuut import EMAttribuut
from OTLMOW.OTLModel.Datatypes.StringField import StringField
# Generated with OEFClassCreator. To modify: extend, do not edit
class HSCabineLegacy(EMObject):
"""subonderdeel van HS-installatie"""
... | [
"OTLMOW.OEFModel.EMAttribuut.EMAttribuut"
] | [((547, 929), 'OTLMOW.OEFModel.EMAttribuut.EMAttribuut', 'EMAttribuut', ([], {'field': 'StringField', 'naam': '"""alle metalen onderdelen geaard&verbonden"""', 'label': '"""alle metalen onderdelen geaard&verbonden"""', 'objectUri': '"""https://ins.data.wegenenverkeer.be/ns/attribuut#HSCabineLegacy.alleMetalenOnderdelen... |
# Generated by Django 3.2 on 2021-04-14 08:41
import cloudinary.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.BigAutoField",
"django.db.models.CharField",
"django.db.models.EmailField",
"django.db.models.IntegerField"
] | [((270, 327), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (301, 327), False, 'from django.db import migrations, models\n'), ((2446, 2563), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
"rpyc.connect",
"rpyc.utils.server.ThreadedServer"
] | [((873, 900), 'rpyc.connect', 'rpyc.connect', (['address', 'port'], {}), '(address, port)\n', (885, 900), False, 'import rpyc\n'), ((2055, 2112), 'rpyc.utils.server.ThreadedServer', 'ThreadedServer', (['ModNASService', '*args'], {'port': 'port'}), '(ModNASService, *args, port=port, **kwargs)\n', (2069, 2112), False, 'f... |
# Generated by Django 2.1.7 on 2019-04-02 08:41
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('cfp', '0023_auto_20190402_1041'),
('workshops', '0007_workshop_sold_out'),
]
operations = [
migrati... | [
"django.db.models.DateTimeField",
"django.db.models.OneToOneField"
] | [((419, 551), 'django.db.models.OneToOneField', 'models.OneToOneField', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.PROTECT', 'related_name': '"""workshop"""', 'to': '"""cfp.PaperApplication"""'}), "(null=True, on_delete=django.db.models.deletion.PROTECT,\n related_name='workshop', to='cfp.PaperA... |
from .filesystem import write_graph
from rdflib import Graph, Literal, RDF, URIRef, Namespace
from rdflib.namespace import FOAF, SKOS, DC, OWL, XSD, RDFS, DCTERMS
import datetime
from . import __version__
from pathlib import Path
from.config_parser import get_config_data, get_repo_name
def get_empty_prov_graph():
... | [
"rdflib.Graph",
"rdflib.Literal",
"rdflib.URIRef",
"rdflib.Namespace",
"datetime.datetime.now"
] | [((381, 420), 'rdflib.Namespace', 'Namespace', (['"""http://www.w3.org/ns/prov#"""'], {}), "('http://www.w3.org/ns/prov#')\n", (390, 420), False, 'from rdflib import Graph, Literal, RDF, URIRef, Namespace\n'), ((432, 473), 'rdflib.Namespace', 'Namespace', (['"""http://purl.org/dc/dcmitype/"""'], {}), "('http://purl.org... |
# Generated by Django 2.0.2 on 2018-02-21 16:57
from django.db import migrations
def populate_orders_total_gross(apps, schema_editor):
Order = apps.get_model('order', 'Order')
orders_with_total = Order.objects.filter(
total_net__isnull=False).iterator()
for order in orders_with_total:
or... | [
"django.db.migrations.RunPython"
] | [((845, 921), 'django.db.migrations.RunPython', 'migrations.RunPython', (['populate_orders_total_gross', 'populate_orders_total_tax'], {}), '(populate_orders_total_gross, populate_orders_total_tax)\n', (865, 921), False, 'from django.db import migrations\n')] |
import csv
from tqdm import tqdm
import logging
from sklearn.cluster import k_means
from collections import Counter
# Symbols for flosses legend.
SYMBOLS = ['*', '-', '+', 'T', '>', '<', 'V', 'O', 'X', 'U', 'B', 'A', 'X', '||', '^']
def get_text_color(color):
"""Gets color that would be visible on given backgro... | [
"sklearn.cluster.k_means",
"collections.Counter",
"logging.getLogger",
"csv.DictReader"
] | [((921, 948), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (938, 948), False, 'import logging\n'), ((1128, 1153), 'sklearn.cluster.k_means', 'k_means', (['data', 'num_colors'], {}), '(data, num_colors)\n', (1135, 1153), False, 'from sklearn.cluster import k_means\n'), ((1448, 1475), 'lo... |
"""
Support to interact with a ExoPlayer on Android via HTTO and MQTT.
"""
import asyncio
import logging
import json
import homeassistant.util.dt as dt_util
import homeassistant.components.ais_dom.ais_global as ais_global
from homeassistant.components.media_player import (
SUPPORT_NEXT_TRACK,
SUPPORT_PAUSE,
... | [
"homeassistant.util.dt.utcnow",
"json.loads",
"logging.getLogger"
] | [((860, 887), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (877, 887), False, 'import logging\n'), ((12436, 12464), 'json.loads', 'json.loads', (['media_content_id'], {}), '(media_content_id)\n', (12446, 12464), False, 'import json\n'), ((12745, 12761), 'homeassistant.util.dt.utcnow', '... |
# Copyright 2013 <NAME> and individual contributors
#
# 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 agr... | [
"pytest.mark.parametrize",
"pytest.raises"
] | [((770, 1052), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('size', 'password', 'salt', 'opslimit', 'memlimit', 'expected')", "[(32, b'The quick brown fox jumps over the lazy dog.', b'<PASSWORD>', 20000,\n 2 ** 20 * 100,\n b'\\x10e>\\xc8A8\\x11\\xde\\x07\\xf1\\x0f\\x98EG\\xe6}V]\\xd4yN\\xae\\xd3P\\x8... |
# -*- coding: utf-8 -*-
import tensorflow as tf
from distutils.version import StrictVersion
__all__ = ['is_tensorflow_version_higher_or_equal']
def is_tensorflow_version_higher_or_equal(version):
"""Check whether the version of TensorFlow is higher than `version`.
Parameters
----------
version : st... | [
"distutils.version.StrictVersion"
] | [((463, 485), 'distutils.version.StrictVersion', 'StrictVersion', (['version'], {}), '(version)\n', (476, 485), False, 'from distutils.version import StrictVersion\n'), ((489, 518), 'distutils.version.StrictVersion', 'StrictVersion', (['tf.__version__'], {}), '(tf.__version__)\n', (502, 518), False, 'from distutils.ver... |
import numpy as np
import cv2
import scipy.cluster.hierarchy as hcluster
########################################################################################################################
# The parameters below should be adjusted/optimized by the user:
inputVideo = "enemy-approaches-ext.mp4"
outputV... | [
"cv2.VideoWriter_fourcc",
"cv2.bitwise_and",
"cv2.goodFeaturesToTrack",
"cv2.VideoWriter",
"cv2.rectangle",
"cv2.imshow",
"numpy.unique",
"cv2.cvtColor",
"cv2.destroyAllWindows",
"cv2.boundingRect",
"cv2.resize",
"cv2.circle",
"numpy.int0",
"cv2.waitKey",
"cv2.createBackgroundSubtractorK... | [((2265, 2293), 'cv2.VideoCapture', 'cv2.VideoCapture', (['inputVideo'], {}), '(inputVideo)\n', (2281, 2293), False, 'import cv2\n'), ((2395, 2436), 'cv2.resize', 'cv2.resize', (['frame', 'None'], {'fx': 'fsca', 'fy': 'fsca'}), '(frame, None, fx=fsca, fy=fsca)\n', (2405, 2436), False, 'import cv2\n'), ((2568, 2599), 'c... |
from django.test import TestCase
from django.db import IntegrityError
from api.models import MDSInstance
from utils import factories
from nose.tools import assert_equals, raises
class MDSInstanceTest(TestCase):
MDS_URL = 'https://www.yourMdsUrl.com/'
MDS_API_KEY = 'test_mds_api_key'
def setUp(self):
... | [
"nose.tools.raises",
"nose.tools.assert_equals",
"api.models.MDSInstance.objects.create",
"utils.factories.UserFactory"
] | [((754, 776), 'nose.tools.raises', 'raises', (['IntegrityError'], {}), '(IntegrityError)\n', (760, 776), False, 'from nose.tools import assert_equals, raises\n'), ((956, 978), 'nose.tools.raises', 'raises', (['IntegrityError'], {}), '(IntegrityError)\n', (962, 978), False, 'from nose.tools import assert_equals, raises\... |
# 0209.py
import cv2, pafy
url = 'https://www.youtube.com/watch?v=S_0ikqqccJs'
video = pafy.new(url)
print('title = ', video.title)
print('video.rating = ', video.rating)
print('video.duration = ', video.duration)
best = video.getbest(preftype = 'webm') # 'mp4', '3gp'
print('best.resolution', best.resolutio... | [
"cv2.Canny",
"cv2.cvtColor",
"pafy.new",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.WaitKey",
"cv2.destroyAllWindows"
] | [((92, 105), 'pafy.new', 'pafy.new', (['url'], {}), '(url)\n', (100, 105), False, 'import cv2, pafy\n'), ((332, 358), 'cv2.VideoCapture', 'cv2.VideoCapture', (['best.url'], {}), '(best.url)\n', (348, 358), False, 'import cv2, pafy\n'), ((664, 687), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (68... |
from django.shortcuts import render, redirect, reverse
from django.contrib.auth.models import User
from django.db.models import Q
from django.http import HttpResponseRedirect
from datetime import datetime
from ..models import Assignment, AssignmentModule, Course, Submission, Grade
from .. import forms
from .utilitie... | [
"django.shortcuts.redirect",
"django.contrib.auth.models.User.objects.filter",
"django.db.models.Q",
"django.shortcuts.render",
"django.shortcuts.reverse"
] | [((2601, 2653), 'django.shortcuts.render', 'render', (['request', '"""assignments_student.html"""', 'context'], {}), "(request, 'assignments_student.html', context)\n", (2607, 2653), False, 'from django.shortcuts import render, redirect, reverse\n'), ((5336, 5365), 'django.shortcuts.redirect', 'redirect', (['"""forum:a... |
from rlbot.training.training import Grade, Fail
from rlbot.utils.structures.game_data_struct import FieldInfoPacket
from rlbottraining.grading.training_tick_packet import TrainingTickPacket
from rlbottraining.common_graders.compound_grader import CompoundGrader
from rlbottraining.common_graders.goal_grader import PassO... | [
"rlbottraining.common_graders.goal_grader.PassOnGoalForAllyTeam",
"math.sqrt"
] | [((1729, 1749), 'math.sqrt', 'math.sqrt', (['distance2'], {}), '(distance2)\n', (1738, 1749), False, 'import math\n'), ((1906, 1938), 'rlbottraining.common_graders.goal_grader.PassOnGoalForAllyTeam', 'PassOnGoalForAllyTeam', (['ally_team'], {}), '(ally_team)\n', (1927, 1938), False, 'from rlbottraining.common_graders.g... |
#!/usr/env/python
# -*- coding: utf-8 -*-
'''
Script to read in multiple datasets of articles with importance ratings from
WikiProjects and train a Gradient Boost Model to predict article importance
across an entire Wikipedia edition.
Copyright (c) 2017 <NAME>
Permission is hereby granted, free of charge, to any pers... | [
"yaml.load",
"pickle.dump",
"argparse.ArgumentParser",
"sklearn.metrics.classification_report",
"sklearn.metrics.f1_score",
"os.path.join",
"numpy.unique",
"pandas.DataFrame",
"os.path.dirname",
"pandas.merge",
"sklearn.preprocessing.LabelEncoder",
"numpy.log10",
"pandas.concat",
"numpy.mi... | [((17930, 18030), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""script to train a Gradient Boost Model for a WikiProject"""'}), "(description=\n 'script to train a Gradient Boost Model for a WikiProject')\n", (17953, 18030), False, 'import argparse\n'), ((2676, 2704), 'os.path.dirnam... |
import scheme_runner
def test_output():
scheme_runner.run_all_cases("scm_tests")
| [
"scheme_runner.run_all_cases"
] | [((46, 86), 'scheme_runner.run_all_cases', 'scheme_runner.run_all_cases', (['"""scm_tests"""'], {}), "('scm_tests')\n", (73, 86), False, 'import scheme_runner\n')] |
from dict_to_digraph import *
import pytest
def test_empty():
assert dict_to_digraph({}, {}).source == 'digraph {\n}'
assert dict_to_digraph({'a': {'b': 'c'}}, {'edges': ['a']}).source == 'digraph {\n}'
@pytest.fixture
def params():
return {
'edge_keys': ['tables', {'union.*': ['table']}, {'tabl... | [
"pytest.mark.parametrize"
] | [((524, 753), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""test_input,expected"""', "[[{'a': {'tables': 'b'}}, [['b', 'a']]], [{'a': {'union*': {'table': 'b'}}},\n [['b', 'a']]], [{'a': {'union*': ({'table': 'b'}, {'table': 'c'})}}, [[\n 'b', 'a'], ['c', 'a']]]]"], {}), "('test_input,expected', [[{... |
# -*- coding:utf-8 -*-
"""
author: <NAME>
date: 2020/10/28
"""
import os
from configparser import ConfigParser
from io import StringIO
from io import open
from concurrent.futures import ProcessPoolExecutor
from pdfminer.pdfinterp import PDFResourceManager
from pdfminer.pdfinterp import process_pdf
from pdfminer.con... | [
"io.StringIO",
"configparser.ConfigParser",
"pdfminer.layout.LAParams",
"docx.Document",
"pdfminer.pdfinterp.process_pdf",
"os.path.splitext",
"io.open",
"pdfminer.pdfinterp.PDFResourceManager",
"pdfminer.converter.TextConverter",
"os.listdir"
] | [((912, 922), 'docx.Document', 'Document', ([], {}), '()\n', (920, 922), False, 'from docx import Document\n'), ((1368, 1382), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (1380, 1382), False, 'from configparser import ConfigParser\n'), ((452, 473), 'io.open', 'open', (['file_path', '"""rb"""'], {}), ... |
"""
********************************************************************************
* Name: workflow_view.py
* Author: nswain
* Created On: November 21, 2018
* Copyright: (c) Aquaveo 2018
********************************************************************************
"""
import abc
import logging
from django.shortcut... | [
"tethysext.atcore.utilities.grammatically_correct_join",
"tethys_sdk.permissions.has_permission",
"tethysext.atcore.controllers.utilities.get_style_for_status",
"django.shortcuts.redirect",
"django.contrib.messages.error",
"tethysext.atcore.services.resource_workflows.decorators.workflow_step_controller",... | [((991, 1030), 'logging.getLogger', 'logging.getLogger', (["('tethys.' + __name__)"], {}), "('tethys.' + __name__)\n", (1008, 1030), False, 'import logging\n'), ((5351, 5377), 'tethysext.atcore.services.resource_workflows.decorators.workflow_step_controller', 'workflow_step_controller', ([], {}), '()\n', (5375, 5377), ... |
#!/usr/bin/env python3
import socket
import threading
import time
import pickle
import re
from datetime import datetime
from Plate import Plate
from RoboConnect import RoboConnect
from BuildProtocol import BuildProtocol
from RoboRun import RoboRun
from Prioritizer import Prioritizer
class EventServer:
def __in... | [
"threading.Thread",
"RoboRun.RoboRun",
"Plate.Plate",
"RoboConnect.RoboConnect",
"socket.socket",
"time.sleep",
"re.findall",
"Prioritizer.Prioritizer",
"BuildProtocol.BuildProtocol",
"datetime.datetime.now"
] | [((861, 876), 'BuildProtocol.BuildProtocol', 'BuildProtocol', ([], {}), '()\n', (874, 876), False, 'from BuildProtocol import BuildProtocol\n'), ((909, 922), 'RoboConnect.RoboConnect', 'RoboConnect', ([], {}), '()\n', (920, 922), False, 'from RoboConnect import RoboConnect\n'), ((948, 957), 'RoboRun.RoboRun', 'RoboRun'... |
from bs4 import BeautifulSoup as bs
fin = open("michaelis.sbml")
data = bs(fin, 'lxml')
fin.close()
# print (data)
model = data.find('model')
# print (model)
val = model.listofspecies
ele = val.find_all('species')
for e in ele:
# print (e['id'])
# print (e['initialamount'])
print (e)
# e.sort()
# print (e)
ele... | [
"bs4.BeautifulSoup"
] | [((73, 88), 'bs4.BeautifulSoup', 'bs', (['fin', '"""lxml"""'], {}), "(fin, 'lxml')\n", (75, 88), True, 'from bs4 import BeautifulSoup as bs\n')] |
#
# Copyright (c) 2020 Saarland University.
#
# This file is part of AM Parser
# (see https://github.com/coli-saar/am-parser/).
#
# 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://... | [
"graph_dependency_parser.components.dataset_readers.amconll_tools.AMSentence.get_bottom_supertag",
"graph_dependency_parser.components.supertagger.Supertagger.top_k_supertags",
"torch.argsort",
"graph_dependency_parser.components.cle.find_root",
"allennlp.training.metrics.AttachmentScores",
"allennlp.modu... | [((1891, 1918), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1908, 1918), False, 'import logging\n'), ((3602, 3634), 'allennlp.modules.InputVariationalDropout', 'InputVariationalDropout', (['dropout'], {}), '(dropout)\n', (3625, 3634), False, 'from allennlp.modules import InputVariatio... |
#
# test optical
#
# good/bad is printed in json.
# Since thing this does is too simple, I'll do kind of one-off.
#
import os, sys, subprocess, datetime, traceback
from ..lib.util import init_triage_logger, is_block_device, get_test_password
from ..lib.timeutil import in_seconds
tlog = init_triage_logger()
import js... | [
"subprocess.Popen",
"os.path.join",
"os.makedirs",
"os.path.isdir",
"json.dumps",
"sys.stdout.flush",
"traceback.format_exc",
"sys.stderr.write",
"datetime.datetime.now",
"os.listdir",
"sys.exit"
] | [((359, 418), 'json.dumps', 'json.dumps', (["{'event': 'triageupdate', 'runMessage': result}"], {}), "({'event': 'triageupdate', 'runMessage': result})\n", (369, 418), False, 'import json\n'), ((458, 476), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (474, 476), False, 'import os, sys, subprocess, datetime... |
#
# 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
# (the "License"); you may not us... | [
"logging.basicConfig",
"os.path.isdir",
"os.path.exists",
"os.path.join",
"logging.getLogger"
] | [((989, 1016), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1006, 1016), False, 'import logging\n'), ((1171, 1211), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging_level'}), '(level=logging_level)\n', (1190, 1211), False, 'import logging\n'), ((1267, 1287), 'os.pa... |
#!usr/bin/env python3
import sys
from cryptography.fernet import Fernet
import requests
import hashlib
ip = "192.168.1.1" # REPLACE WITH IP OF THE MACHINE RUNNING SERVER.PY
def encrypt(path):
key = Fernet.generate_key()
f = Fernet(key)
with open(str(path), "rb") as file:
content = file.read()
... | [
"hashlib.sha256",
"cryptography.fernet.Fernet",
"cryptography.fernet.Fernet.generate_key"
] | [((204, 225), 'cryptography.fernet.Fernet.generate_key', 'Fernet.generate_key', ([], {}), '()\n', (223, 225), False, 'from cryptography.fernet import Fernet\n'), ((234, 245), 'cryptography.fernet.Fernet', 'Fernet', (['key'], {}), '(key)\n', (240, 245), False, 'from cryptography.fernet import Fernet\n'), ((672, 695), 'h... |
import sys
import pytest
import cv2
sys.path.append("./src")
from visualize.Pitch import *
def putTextJP(img, text, org, fontFace, fontScale, color):
x, y = org
b, g, r = color
colorRGB = (r, g, b)
print(colorRGB)
pilimg = cv2pil(img)
draw = ImageDraw.Draw(pilimg)
font_path... | [
"sys.path.append",
"cv2.imshow",
"cv2.waitKey"
] | [((43, 67), 'sys.path.append', 'sys.path.append', (['"""./src"""'], {}), "('./src')\n", (58, 67), False, 'import sys\n'), ((1293, 1312), 'cv2.imshow', 'cv2.imshow', (['""""""', 'img'], {}), "('', img)\n", (1303, 1312), False, 'import cv2\n'), ((1318, 1332), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (1329, 1... |
# This file is part of Pynguin.
#
# Pynguin is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Pynguin is distributed in the ho... | [
"pynguin.testcase.statements.parametrizedstatements.MethodStatement",
"pynguin.testcase.statements.primitivestatements.IntPrimitiveStatement",
"pytest.fixture",
"pynguin.testcase.statements.parametrizedstatements.FunctionStatement",
"pytest.raises",
"pynguin.testcase.statements.primitivestatements.StringP... | [((2982, 3014), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (2996, 3014), False, 'import pytest\n'), ((1115, 1136), 'pynguin.testcase.defaulttestcase.DefaultTestCase', 'dtc.DefaultTestCase', ([], {}), '()\n', (1134, 1136), True, 'import pynguin.testcase.defaulttestcase... |
import sys
import time
import multiprocessing as mp
import numpy as np
from .exceptions import UnsupportedFormatError
from .lib import generate_random_string
from .paths import strict_extract, to_https_protocol
# NOTE: Plugins are registered in __init__.py
# Set the interpreter bool
try:
INTERACTIVE = bool(sys.ps... | [
"time.strftime",
"numpy.issubdtype",
"multiprocessing.cpu_count"
] | [((963, 977), 'multiprocessing.cpu_count', 'mp.cpu_count', ([], {}), '()\n', (975, 977), True, 'import multiprocessing as mp\n'), ((10927, 10961), 'time.strftime', 'time.strftime', (['"""%Y-%m-%d %H:%M %Z"""'], {}), "('%Y-%m-%d %H:%M %Z')\n", (10940, 10961), False, 'import time\n'), ((10199, 10235), 'numpy.issubdtype',... |
import sanic
from sanic.request import Request
from sanic.response import HTTPResponse
from sanic.log import error_logger, access_logger, logger
from pyweben.utils import n_bytes_json, ok_json, setup_log
app = sanic.Sanic("sanic", configure_logging=False)
@app.route('/sanic/<size>', methods=["GET", "POST"])
async d... | [
"pyweben.utils.setup_log",
"pyweben.utils.n_bytes_json",
"sanic.Sanic",
"pyweben.utils.ok_json"
] | [((212, 257), 'sanic.Sanic', 'sanic.Sanic', (['"""sanic"""'], {'configure_logging': '(False)'}), "('sanic', configure_logging=False)\n", (223, 257), False, 'import sanic\n'), ((589, 598), 'pyweben.utils.ok_json', 'ok_json', ([], {}), '()\n', (596, 598), False, 'from pyweben.utils import n_bytes_json, ok_json, setup_log... |
#****************************************************************************#
#
# LPS33HW - ST Electronics Pressure sensor
#
# Simple Read-out script.
#
# <N... | [
"numpy.float",
"smbus.SMBus"
] | [((698, 712), 'smbus.SMBus', 'smbus.SMBus', (['(1)'], {}), '(1)\n', (709, 712), False, 'import smbus\n'), ((1347, 1363), 'numpy.float', 'np.float', (['p_data'], {}), '(p_data)\n', (1355, 1363), True, 'import numpy as np\n'), ((1575, 1591), 'numpy.float', 'np.float', (['t_data'], {}), '(t_data)\n', (1583, 1591), True, '... |
from matplotlib.pyplot import axis
import numpy
from numpy.core import numeric
from scipy import interpolate
from sph2cart import sph2cart
from cart2sph import cart2sph
from surfacePlot import surfacePlot
def exFacialCurve(vertex: numpy.array, res: int, p: float, rp: numpy.array, npt: int):
nth = rp
qx, qy,... | [
"numpy.isnan",
"surfacePlot.surfacePlot",
"numpy.array",
"numpy.diff",
"numpy.linspace",
"scipy.interpolate.interp1d",
"sph2cart.sph2cart"
] | [((326, 350), 'surfacePlot.surfacePlot', 'surfacePlot', (['vertex', 'res'], {}), '(vertex, res)\n', (337, 350), False, 'from surfacePlot import surfacePlot\n'), ((443, 457), 'numpy.isnan', 'numpy.isnan', (['r'], {}), '(r)\n', (454, 457), False, 'import numpy\n'), ((474, 488), 'numpy.isnan', 'numpy.isnan', (['r'], {}), ... |
from nltk.stem.isri import ISRIStemmer
from nltk.tokenize import word_tokenize
class Stemming:
def __init__(self):
self.st = ISRIStemmer()
def stemWord(self, text):
word_tokens = word_tokenize(text)
filtered_sentence = [self.st.stem(w) + ' ' for w in word_tokens]
return ''.joi... | [
"nltk.stem.isri.ISRIStemmer",
"nltk.tokenize.word_tokenize"
] | [((138, 151), 'nltk.stem.isri.ISRIStemmer', 'ISRIStemmer', ([], {}), '()\n', (149, 151), False, 'from nltk.stem.isri import ISRIStemmer\n'), ((205, 224), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['text'], {}), '(text)\n', (218, 224), False, 'from nltk.tokenize import word_tokenize\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
import numpy as np
from timm.models.densenet import DenseBlock
from timm.models.densenet import DenseTransition
class Bottleneck(nn.Module):
"""
Bottleneck block from ResNet
"""
def __init__(self, inp... | [
"torch.nn.ReLU",
"timm.models.densenet.DenseBlock",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.BatchNorm2d",
"torch.nn.init.constant_",
"timm.models.densenet.DenseTransition",
"torch.nn.MaxPool2d",
"torch.matmul"
] | [((476, 546), 'torch.nn.Conv2d', 'nn.Conv2d', (['inplanes', 'planes'], {'kernel_size': '(1, 1)', 'padding': '(0)', 'bias': '(False)'}), '(inplanes, planes, kernel_size=(1, 1), padding=0, bias=False)\n', (485, 546), True, 'import torch.nn as nn\n'), ((597, 645), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['planes'], {'e... |
# coding=utf-8
from setuptools import setup, find_packages
setup(
name = "git-ftp",
version = "0.2.7",
packages = find_packages(),
scripts = ['GitFTP.py'],
install_requires = ['GitPython'],
entry_points = {
'console_scripts': [
'git-ftp = GitFTP:main'
]
},
... | [
"setuptools.find_packages"
] | [((127, 142), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (140, 142), False, 'from setuptools import setup, find_packages\n')] |
from flask import request
from src import cache
from pathlib import Path
from typing import Any
import pandas as pd
import numpy as np
data_file = Path(__file__).parent / Path(
"../data/NCHS_-_Leading_Causes_of_Death__United_States.csv"
)
def health_check() -> str:
return "pong"
def table_dat... | [
"src.cache.cached",
"pathlib.Path",
"pandas.read_csv",
"flask.request.args.get"
] | [((537, 568), 'src.cache.cached', 'cache.cached', ([], {'query_string': '(True)'}), '(query_string=True)\n', (549, 568), False, 'from src import cache\n'), ((179, 244), 'pathlib.Path', 'Path', (['"""../data/NCHS_-_Leading_Causes_of_Death__United_States.csv"""'], {}), "('../data/NCHS_-_Leading_Causes_of_Death__United_St... |
# -*- coding:utf-8 -*-
import mxnet as mx
import numpy as np
'''
MobileFace for face Identification with ResNet and MobileNetV2, implemented in MXNet.
Reference:
Inverted Residuals and Linear Bottlenecks:
Mobile Networks for Classification, Detection and Segmentation
https://arxiv.org/abs/1801.04381
'''
__author__ = ... | [
"mxnet.sym.Flatten",
"mxnet.viz.print_summary",
"mxnet.sym.Convolution",
"mxnet.viz.plot_network",
"mxnet.sym.FullyConnected",
"mxnet.symbol.Variable",
"mxnet.symbol.L2Normalization",
"mxnet.sym.maximum",
"mxnet.sym.BatchNorm"
] | [((539, 649), 'mxnet.sym.Convolution', 'mx.sym.Convolution', ([], {'data': 'data', 'num_filter': 'num_filter', 'kernel': 'kernel', 'stride': 'stride', 'pad': 'pad', 'no_bias': '(True)'}), '(data=data, num_filter=num_filter, kernel=kernel, stride=\n stride, pad=pad, no_bias=True)\n', (557, 649), True, 'import mxnet a... |
import os
import re
import sys
import webbrowser
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
Base = declarative_base()
# MovieItem class for DB
class MovieItem(Base):
__tablename__ = 'movie_item'
id = Column(Integ... | [
"sqlalchemy.create_engine",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((197, 215), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (213, 215), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((523, 567), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///favoriteMovies.db"""'], {}), "('sqlite:///favoriteMovies.db')\n", ... |
import threading
import typing
import cv2
import imagezmq
from .network import NetworkHandler, Network, NetworkService, ServiceType
MessageHandler = typing.Callable[[str, typing.Any], None]
class Hub(threading.Thread, NetworkHandler):
network_services: typing.List[NetworkService] = []
def __init__(self, ... | [
"imagezmq.ImageHub"
] | [((489, 535), 'imagezmq.ImageHub', 'imagezmq.ImageHub', ([], {'open_port': 'f"""tcp://*:{port}"""'}), "(open_port=f'tcp://*:{port}')\n", (506, 535), False, 'import imagezmq\n')] |
"""Split-Attention"""
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn.modules.utils import _pair
from .dropblock import DropBlock2D
__all__ = ['SplAtConv2d']
class SplAtConv2d(nn.Module):
"""Split-Attention Conv2d
"""
def __init__(self, in_channels, out_channels, kernel_... | [
"torch.nn.Conv2d",
"torch.split",
"rfconv.RFConv2d",
"torch.nn.functional.softmax",
"torch.nn.functional.adaptive_avg_pool2d",
"torch.sigmoid",
"torch.nn.modules.utils._pair"
] | [((618, 632), 'torch.nn.modules.utils._pair', '_pair', (['padding'], {}), '(padding)\n', (623, 632), False, 'from torch.nn.modules.utils import _pair\n'), ((1456, 1513), 'torch.nn.Conv2d', 'nn.Conv2d', (['out_channels', 'inter_channels', '(1)'], {'groups': 'groups'}), '(out_channels, inter_channels, 1, groups=groups)\n... |
from __future__ import division
import torch
import random
import numpy as np
# from PIL import Image
import torch.nn.functional as F
'''Set of tranform random routines that takes list of inputs as arguments,
in order to have random but coherent transformations.'''
class Compose(object):
def __init__(self, tran... | [
"torch.nn.functional.normalize",
"torch.clamp",
"torch.from_numpy"
] | [((1128, 1186), 'torch.nn.functional.normalize', 'F.normalize', (['tensor', 'self.demean', 'self.destd', 'self.inplace'], {}), '(tensor, self.demean, self.destd, self.inplace)\n', (1139, 1186), True, 'import torch.nn.functional as F\n'), ((1249, 1278), 'torch.clamp', 'torch.clamp', (['tensor', '(0.0)', '(1.0)'], {}), '... |
import os
ACCESS_TOKEN = os.environ.get('TWITTER_ACCESS_TOKEN')
ACCESS_TOKEN_SECRET = os.environ.get('TWITTER_ACCESS_TOKEN_SECRET')
CONSUMER_KEY = os.environ.get('TWITTER_CONSUMER_KEY')
CONSUMER_SECRET = os.environ.get('TWITTER_CONSUMER_SECRET')
| [
"os.environ.get"
] | [((28, 66), 'os.environ.get', 'os.environ.get', (['"""TWITTER_ACCESS_TOKEN"""'], {}), "('TWITTER_ACCESS_TOKEN')\n", (42, 66), False, 'import os\n'), ((90, 135), 'os.environ.get', 'os.environ.get', (['"""TWITTER_ACCESS_TOKEN_SECRET"""'], {}), "('TWITTER_ACCESS_TOKEN_SECRET')\n", (104, 135), False, 'import os\n'), ((152,... |
#!/usr/local/bin/python3
import socket
import sys
import itertools
import base64
import argparse
import time
parser = argparse.ArgumentParser(add_help=True)
parser.add_argument('-i', '--ip', help='Specify the target IP address [STRING]')
parser.add_argument('-p', '--port', help='Specify the port [STRING]')
parser.add_... | [
"socket.socket",
"base64.b64encode",
"argparse.ArgumentParser",
"itertools.product"
] | [((119, 157), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(True)'}), '(add_help=True)\n', (142, 157), False, 'import argparse\n'), ((843, 868), 'itertools.product', 'itertools.product', (['*lists'], {}), '(*lists)\n', (860, 868), False, 'import itertools\n'), ((970, 1000), 'base64.b64encode... |
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from haystack.views import SearchView
from pantofola_search.views import AggregateMoviesSearchView
from pantofola_search.forms import MovieSearchByLanguageForm
from pantofola_search.v... | [
"pantofola_search.views.AggregateMoviesSearchView",
"django.contrib.admin.autodiscover",
"django.views.decorators.cache.cache_page",
"django.conf.urls.url"
] | [((454, 474), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (472, 474), False, 'from django.contrib import admin\n'), ((1108, 1172), 'django.conf.urls.url', 'url', (['"""^set/(?P<lang_code>[a-z]{2})/$"""', 'set_lang'], {'name': '"""set_lang"""'}), "('^set/(?P<lang_code>[a-z]{2})/$', set_l... |
# flake8: noqa
import json
import os
import requests
import socket
import time
import urllib3
def mk_rpc(opts={}):
def opt_of(field, envvar, default=None, f=lambda x: x):
opt = f(opts.get(field)) if opts.get(field) is not None \
else f(os.environ.get(envvar)) if os.environ.get(en... | [
"socket.create_connection",
"time.perf_counter",
"json.dumps",
"time.sleep",
"os.environ.get",
"requests.post",
"urllib3.disable_warnings"
] | [((1214, 1233), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (1231, 1233), False, 'import time\n'), ((837, 863), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (861, 863), False, 'import urllib3\n'), ((1792, 1904), 'requests.post', 'requests.post', (["('https://%s:%s%s' % (host... |
# -*- coding: utf-8 -*-
"""
===========================================================================
Crystal cell classes (:mod:`sknano.core.crystallography._xtal_cells`)
===========================================================================
.. currentmodule:: sknano.core.crystallography._xtal_cells
"""
from ... | [
"numpy.diagflat",
"numpy.allclose",
"numpy.ones",
"sknano.core.atoms.BasisAtom",
"numpy.asmatrix",
"numpy.eye",
"sknano.core.atoms.BasisAtoms"
] | [((9488, 9517), 'numpy.asmatrix', 'np.asmatrix', (['value'], {'dtype': 'int'}), '(value, dtype=int)\n', (9499, 9517), True, 'import numpy as np\n'), ((10053, 10065), 'sknano.core.atoms.BasisAtoms', 'BasisAtoms', ([], {}), '()\n', (10063, 10065), False, 'from sknano.core.atoms import BasisAtom, BasisAtoms\n'), ((1369, 1... |
#!/usr/bin/env python3
# MIT License
# Copyright (c) 2018 The University of Michigan
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the r... | [
"single_layer_classification.subparagraph_classification",
"os.path.isdir",
"single_layer_classification.page_classification",
"single_layer_classification.paragraph_classification",
"shutil.copytree",
"os.path.join",
"single_layer_classification.sentence_classification"
] | [((1607, 1649), 'single_layer_classification.page_classification', 'page_classification', (['page_train', 'page_test'], {}), '(page_train, page_test)\n', (1626, 1649), False, 'from single_layer_classification import page_classification, paragraph_classification, subparagraph_classification, sentence_classification\n'),... |
# Copyright 2019 Cortex Labs, Inc.
#
# 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 wri... | [
"yaml.dump",
"yaml.safe_load"
] | [((2005, 2055), 'yaml.dump', 'yaml.dump', (['cli_config', 'f'], {'default_flow_style': '(False)'}), '(cli_config, f, default_flow_style=False)\n', (2014, 2055), False, 'import yaml\n'), ((1059, 1076), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (1073, 1076), False, 'import yaml\n'), ((1537, 1587), 'yaml.d... |
# -*- coding: utf-8 -*-
# -*- coding: utf8 -*-
"""Autogenerated file - DO NOT EDIT
If you spot a bug, please report it on the mailing list and/or change the generator."""
from nipype.interfaces.base import (
CommandLine,
CommandLineInputSpec,
SEMLikeCommandLine,
TraitedSpec,
File,
Directory,
... | [
"nipype.interfaces.base.File"
] | [((474, 510), 'nipype.interfaces.base.File', 'File', ([], {'exists': '(True)', 'argstr': '"""--tfm %s"""'}), "(exists=True, argstr='--tfm %s')\n", (478, 510), False, 'from nipype.interfaces.base import CommandLine, CommandLineInputSpec, SEMLikeCommandLine, TraitedSpec, File, Directory, traits, isdefined, InputMultiPath... |
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"random.sample",
"bot.fuzzers.engine_common.get_hard_timeout",
"os.walk",
"bot.fuzzers.engine_common.select_generator",
"metrics.logs.log_warn",
"python.base.modules.fix_module_search_paths",
"bot.fuzzers.utils.get_temp_dir",
"os.path.join",
"bot.fuzzers.engine_common.get_merge_timeout",
"multipro... | [((1797, 1965), 'collections.namedtuple', 'collections.namedtuple', (['"""StrategiesInfo"""', "['fuzzing_strategies', 'arguments', 'additional_corpus_dirs', 'extra_env',\n 'use_dataflow_tracing', 'is_mutations_run']"], {}), "('StrategiesInfo', ['fuzzing_strategies', 'arguments',\n 'additional_corpus_dirs', 'extra... |
# -*- coding: utf-8 -*-
# Copyright 2016 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that generates and sends CL validation messages."""
from __future__ import print_function
from chromite.lib import con... | [
"chromite.lib.cros_logging.info",
"chromite.lib.gob_util.FetchUrl",
"chromite.lib.patch.GetChangesAsString"
] | [((2644, 2689), 'chromite.lib.patch.GetChangesAsString', 'cros_patch.GetChangesAsString', (['other_suspects'], {}), '(other_suspects)\n', (2673, 2689), True, 'from chromite.lib import patch as cros_patch\n'), ((5839, 5907), 'chromite.lib.gob_util.FetchUrl', 'gob_util.FetchUrl', (['self.helper.host', 'path'], {'reqtype'... |
# -*- coding: utf-8 -*-
# Copyright © 2019 Apple Inc. All rights reserved.
#
# Use of this source code is governed by a BSD-3-clause license that can
# be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
from __future__ import print_function as _
from __future__ import division as _
fro... | [
"six.add_metaclass"
] | [((402, 434), 'six.add_metaclass', '_six.add_metaclass', (['_abc.ABCMeta'], {}), '(_abc.ABCMeta)\n', (420, 434), True, 'import six as _six\n')] |
from .interactions import Interaction
from .types import User
from .types.commands import Command, CommandOption
from sanic.response import json, text
from nacl.signing import VerifyKey
from nacl.exceptions import BadSignatureError
from aiohttp import ClientSession
from importlib import import_module
from os import get... | [
"importlib.import_module",
"asyncio.Event",
"sanic.response.text",
"aiohttp.ClientSession",
"sanic.response.json"
] | [((4292, 4311), 'importlib.import_module', 'import_module', (['name'], {}), '(name)\n', (4305, 4311), False, 'from importlib import import_module\n'), ((1412, 1441), 'aiohttp.ClientSession', 'ClientSession', ([], {'loop': 'self.loop'}), '(loop=self.loop)\n', (1425, 1441), False, 'from aiohttp import ClientSession\n'), ... |
###
# Inspect a site's TLS configuration using sslyze.
#
# If data exists for a domain from `pshtt`, will check results
# and only process domains with valid HTTPS, or broken chains.
#
# Supported options:
#
# --sslyze-serial - If set, will use a synchronous (single-threaded
# in-process) scanner. Defaults to true.
#... | [
"sslyze.plugins.openssl_cipher_suites_plugin.Tlsv10ScanCommand",
"sslyze.plugins.openssl_cipher_suites_plugin.Tlsv11ScanCommand",
"logging.debug",
"utils.utils.domain_mail_servers_that_support_starttls",
"utils.utils.format_last_exception",
"logging.warn",
"utils.utils.domain_doesnt_support_https",
"c... | [((1891, 1953), 'utils.utils.domain_doesnt_support_https', 'utils.domain_doesnt_support_https', (['domain'], {'cache_dir': 'cache_dir'}), '(domain, cache_dir=cache_dir)\n', (1924, 1953), False, 'from utils import utils\n'), ((2583, 2659), 'utils.utils.domain_mail_servers_that_support_starttls', 'utils.domain_mail_serve... |
from setuptools import setup
setup(
name="strapi",
version="0.0.1",
description="Strapi SDK for Python.",
py_modules=["strapi"],
package_dir={"": "src"},
classifiers=[
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :... | [
"setuptools.setup"
] | [((30, 499), 'setuptools.setup', 'setup', ([], {'name': '"""strapi"""', 'version': '"""0.0.1"""', 'description': '"""Strapi SDK for Python."""', 'py_modules': "['strapi']", 'package_dir': "{'': 'src'}", 'classifiers': "['Programming Language :: Python :: 3',\n 'Programming Language :: Python :: 3.6',\n 'Programmi... |
# -*- coding: utf-8 -*-
"""
@author: <NAME> - https://www.linkedin.com/in/adamrvfisher/
"""
#pandas_datareader is deprecated, use YahooGrabber
#This is part of a kth fold optimization tool
#Import module
import numpy as np
import pandas as pd
import time as t
from pandas_datareader import data
#Empty data structure... | [
"pandas.DataFrame",
"pandas_datareader.data.DataReader",
"time.time",
"numpy.where",
"pandas.Series"
] | [((361, 372), 'pandas.Series', 'pd.Series', ([], {}), '()\n', (370, 372), True, 'import pandas as pd\n'), ((390, 404), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (402, 404), True, 'import pandas as pd\n'), ((515, 523), 'time.time', 't.time', ([], {}), '()\n', (521, 523), True, 'import time as t\n'), ((554, 6... |
# -*- coding: utf-8 -*-
import datetime
from classes.ConvertBytes import HumanBytes
from classes.MoviesCommand import DisplayMovieInformation, DisplayTorrentInformation, Options, SendInformation
from classes.OMDbAPI import MovieByName
from classes.YTS import ByIMDb
from providers.OMDbAPI import search_movie_by_name
f... | [
"resources.properties.IMAGE_FORMAT.values",
"src.logger.logger.info",
"classes.ConvertBytes.HumanBytes.format",
"classes.MoviesCommand.DisplayTorrentInformation",
"classes.MoviesCommand.DisplayMovieInformation",
"src.utils.parse_name",
"src.utils.message_exceeds_size",
"providers.OMDbAPI.search_movie_... | [((738, 792), 'src.logger.logger.info', 'logger.info', (['f"""Processing received message: {message}"""'], {}), "(f'Processing received message: {message}')\n", (749, 792), False, 'from src.logger import logger\n'), ((1858, 1921), 'src.logger.logger.info', 'logger.info', (['f"""Finding IMDb movie ID for: {options.movie... |
# Copyright 2020-2021 Hewlett Packard Enterprise Development LP
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, ... | [
"six.iteritems",
"bos.models.generic_metadata.GenericMetadata"
] | [((1994, 2017), 'bos.models.generic_metadata.GenericMetadata', 'GenericMetadata', ([], {}), '(**dikt)\n', (2009, 2017), False, 'from bos.models.generic_metadata import GenericMetadata\n'), ((2320, 2350), 'six.iteritems', 'six.iteritems', (['o.openapi_types'], {}), '(o.openapi_types)\n', (2333, 2350), False, 'import six... |
from marshmallow import Schema, fields, post_load
from rest_client.DomainRest import DomainAPI
class DomainSchema(Schema):
"""
This class map the json into the object Domain
..note:: see marshmallow API
"""
id = fields.Int()
designation = fields.Str()
@post_load
def make_Domain(self,... | [
"marshmallow.fields.Int",
"rest_client.DomainRest.DomainAPI",
"marshmallow.fields.Str"
] | [((235, 247), 'marshmallow.fields.Int', 'fields.Int', ([], {}), '()\n', (245, 247), False, 'from marshmallow import Schema, fields, post_load\n'), ((266, 278), 'marshmallow.fields.Str', 'fields.Str', ([], {}), '()\n', (276, 278), False, 'from marshmallow import Schema, fields, post_load\n'), ((1136, 1147), 'rest_client... |
import numpy
import pytest
import scipy.linalg
from numpy.testing import (
assert_almost_equal,
assert_array_almost_equal,
assert_array_equal,
assert_equal,
)
import krypy
def get_matrix_spd():
a = numpy.linspace(1, 2, 10)
a[-1] = 1e-2
return numpy.diag(a)
def get_matrix_hpd():
a = ... | [
"numpy.isreal",
"krypy.utils.norm",
"krypy.utils.arnoldi",
"numpy.abs",
"krypy.utils.NormalizedRootsPolynomial",
"krypy.utils.MatrixLinearOperator",
"numpy.ones",
"krypy.utils.Projection",
"numpy.linalg.norm",
"krypy.utils.hegedus",
"pytest.mark.parametrize",
"numpy.diag",
"numpy.full",
"k... | [((2046, 2084), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""a"""', '_factors'], {}), "('a', _factors)\n", (2069, 2084), False, 'import pytest\n'), ((2086, 2124), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""b"""', '_factors'], {}), "('b', _factors)\n", (2109, 2124), False, 'import pytest\... |
import numpy as np
import cv2
from scipy.spatial import distance as dist
def order_points_4(points):
# Here points would be the unordered corners of the puzzle border
# Step1) Order the 4 points based on x coordinates
s_points=points[np.argsort(points[:,0]),:]
# Step2) Isolate the 2 left most and right... | [
"scipy.spatial.distance.cdist",
"cv2.warpPerspective",
"cv2.getPerspectiveTransform",
"numpy.argsort",
"numpy.array"
] | [((885, 928), 'numpy.array', 'np.array', (['[tl, tr, br, bl]'], {'dtype': '"""float32"""'}), "([tl, tr, br, bl], dtype='float32')\n", (893, 928), True, 'import numpy as np\n'), ((1556, 1670), 'numpy.array', 'np.array', (['[[0, 0], [max_width - 1, 0], [max_width - 1, max_height - 1], [0, \n max_height - 1]]'], {'dtyp... |
from labeling import Encoding
#import conll18_ud_eval as conll18
from argparse import ArgumentParser
import subprocess as sp
def convertToDependency(multitag, multitask_char):
multitag_dep = multitag.split(multitask_char)
# print(multitag_dep)
#for 6 task
if len(multitag_dep)>3:
return multita... | [
"labeling.Encoding"
] | [((1131, 1141), 'labeling.Encoding', 'Encoding', ([], {}), '()\n', (1139, 1141), False, 'from labeling import Encoding\n'), ((2492, 2502), 'labeling.Encoding', 'Encoding', ([], {}), '()\n', (2500, 2502), False, 'from labeling import Encoding\n')] |
import pandas as pd
def findS():
dataarr = pd.read_csv("ENJOYSPORT.csv", header=None)
dataarr = dataarr.values.tolist()
print(len(dataarr))
h = ["0", "0", "0", "0", "0", "0"]
rows = len(dataarr)
columns = 7
for x in range(1, rows):
t = dataarr[x]
print(t)
if t[colum... | [
"pandas.read_csv"
] | [((49, 91), 'pandas.read_csv', 'pd.read_csv', (['"""ENJOYSPORT.csv"""'], {'header': 'None'}), "('ENJOYSPORT.csv', header=None)\n", (60, 91), True, 'import pandas as pd\n')] |
"""Copyright (C) 2015-2016 Association of Universities for Research in Astronomy, Inc. (AURA)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
... | [
"hashlib.md5",
"logging.info",
"bz2.decompress",
"os.path.splitext",
"tarfile.open",
"StringIO.StringIO",
"os.path.join",
"urllib2.urlopen",
"urllib2.build_opener"
] | [((3116, 3234), 'logging.info', 'logging.info', (['"""\nDownloading data from Gemini public archive to ./rawData. This will take a few minutes."""'], {}), '(\n """\nDownloading data from Gemini public archive to ./rawData. This will take a few minutes."""\n )\n', (3128, 3234), False, 'import logging\n'), ((6621, ... |
import eventlet
import unittest
# import aiounittest # until Python 3.8 is available
import logging
import socket
import sys
import asyncio
# from ryu.lib import hub
# unittest replaces sys.stdout/sys.stderr
logger = logging.getLogger()
logger.level = logging.DEBUG # INFO # DEBUG
stream_handler = logging.StreamHandl... | [
"unittest.main",
"logging.StreamHandler",
"socket.socket",
"logging.info",
"EVPNProxy.EVPNProxy",
"logging.getLogger",
"eventlet.sleep"
] | [((220, 239), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (237, 239), False, 'import logging\n'), ((301, 334), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (322, 334), False, 'import logging\n'), ((5868, 5976), 'unittest.main', 'unittest.main', ([], {'argv': ... |
########################################
# Automatically generated, do not edit.
########################################
from pyvisdk.thirdparty import Enum
VirtualMachineAppHeartbeatStatusType = Enum(
'appStatusGray',
'appStatusGreen',
'appStatusRed',
)
| [
"pyvisdk.thirdparty.Enum"
] | [((201, 256), 'pyvisdk.thirdparty.Enum', 'Enum', (['"""appStatusGray"""', '"""appStatusGreen"""', '"""appStatusRed"""'], {}), "('appStatusGray', 'appStatusGreen', 'appStatusRed')\n", (205, 256), False, 'from pyvisdk.thirdparty import Enum\n')] |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"six.add_metaclass"
] | [((779, 809), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (796, 809), False, 'import six\n')] |
import itertools
from .utils import load_yaml, save_yaml
NOT_A_LIST_ERROR_MSG = """
The value associated with parameter '{key}' must be a list.
"""
class ConfigError(Exception):
pass
class LoadMixin:
@classmethod
def from_file(cls, path):
config_dict = load_yaml(path)
return cls.from_di... | [
"itertools.product"
] | [((1526, 1552), 'itertools.product', 'itertools.product', (['*values'], {}), '(*values)\n', (1543, 1552), False, 'import itertools\n')] |
import json
import os
from urllib.request import urlopen
forecast: str = json.load(
urlopen("https://api.weather.gov/gridpoints/LOX/145,54/forecast"))
def is_day(data: str, pos: int):
"""Check if daytime
Checks if conditions represent the day or night
:param data: JSON string containing weather.gov... | [
"urllib.request.urlopen",
"json.dumps",
"os.path.sep.join"
] | [((90, 155), 'urllib.request.urlopen', 'urlopen', (['"""https://api.weather.gov/gridpoints/LOX/145,54/forecast"""'], {}), "('https://api.weather.gov/gridpoints/LOX/145,54/forecast')\n", (97, 155), False, 'from urllib.request import urlopen\n'), ((2799, 2827), 'json.dumps', 'json.dumps', (['weather_forecast'], {}), '(we... |
#!/usr/bin/env python
### TODO this is a hairy arsed hack!
import yaml
import os
import sqlite3
import re
import sys
def deviceNumFields(fileName):
with open(fileName, 'r') as stream:
try:
dev = yaml.load(stream, Loader=yaml.FullLoader)
return len(dev)
except yaml.YAMLErro... | [
"sys.stdout.flush",
"yaml.load",
"sqlite3.connect",
"os.listdir"
] | [((3282, 3303), 'os.listdir', 'os.listdir', (['"""devices"""'], {}), "('devices')\n", (3292, 3303), False, 'import os\n'), ((3599, 3632), 'sqlite3.connect', 'sqlite3.connect', (['"""devices.sqlite"""'], {}), "('devices.sqlite')\n", (3614, 3632), False, 'import sqlite3\n'), ((5537, 5555), 'sys.stdout.flush', 'sys.stdout... |
import setuptools
import datetime
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="textfile-autoencoding",
version=datetime.datetime.now().strftime("%Y.%m.%d"),
author="<NAME>",
author_email="<EMAIL>",
description="A small wrapper to open files without kn... | [
"datetime.datetime.now",
"setuptools.find_packages"
] | [((505, 546), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': '"""tests"""'}), "(exclude='tests')\n", (529, 546), False, 'import setuptools\n'), ((168, 191), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (189, 191), False, 'import datetime\n')] |
""" A simple periodic controller that executes a given controller on a given plant periodically.
"""
import numpy as np
class Controller:
def __init__(self, model, control):
# the plant model to execute
self.model = model
# the control law to apply
self.control = control
def e... | [
"numpy.vstack"
] | [((1094, 1122), 'numpy.vstack', 'np.vstack', (['[response, state]'], {}), '([response, state])\n', (1103, 1122), True, 'import numpy as np\n')] |
import unittest
from llvm.core import Type
from .support import TestCase, tests
class TestTypeHash(TestCase):
def test_scalar_type(self):
i32a = Type.int(32)
i32b = Type.int(32)
i64a = Type.int(64)
i64b = Type.int(64)
ts = set([i32a, i32b, i64a, i64b])
self.assertTru... | [
"unittest.main",
"llvm.core.Type.int",
"llvm.core.Type.float"
] | [((846, 861), 'unittest.main', 'unittest.main', ([], {}), '()\n', (859, 861), False, 'import unittest\n'), ((158, 170), 'llvm.core.Type.int', 'Type.int', (['(32)'], {}), '(32)\n', (166, 170), False, 'from llvm.core import Type\n'), ((186, 198), 'llvm.core.Type.int', 'Type.int', (['(32)'], {}), '(32)\n', (194, 198), Fal... |
from django.shortcuts import render
from django.views import View
from django.views.generic import TemplateView
from django.shortcuts import render, redirect, get_object_or_404
from django.http import JsonResponse
from heron_upload.forms import UploadForm
from heron_upload.models import UploadedFile
# def home(reque... | [
"heron_upload.forms.UploadForm",
"django.http.JsonResponse",
"django.shortcuts.get_object_or_404",
"heron_upload.models.UploadedFile.objects.all",
"django.shortcuts.render"
] | [((1048, 1074), 'heron_upload.models.UploadedFile.objects.all', 'UploadedFile.objects.all', ([], {}), '()\n', (1072, 1074), False, 'from heron_upload.models import UploadedFile\n'), ((1214, 1252), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['UploadedFile'], {'pk': 'pk'}), '(UploadedFile, pk=pk)\n', (12... |
from util.collatz import collatz_series
def longest_collatz_between(start, end):
answer = (0, [], 0)
for i in range(start, end):
if i % 1000 == 0: print('.', end='', flush=True)
x = list(collatz_series(i))
if len(x) > answer[2]:
answer = (i, x, len(x))
return answer
d... | [
"util.collatz.collatz_series"
] | [((213, 230), 'util.collatz.collatz_series', 'collatz_series', (['i'], {}), '(i)\n', (227, 230), False, 'from util.collatz import collatz_series\n')] |
# Generated by Django 2.2.5 on 2020-09-12 20:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('health', '0002_auto_20200907_1946'),
]
operations = [
migrations.AlterField(
model_name='bodyma... | [
"django.db.models.ForeignKey"
] | [((379, 492), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""employee"""', 'to': '"""users.Employee"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='employee', to='users.Employee')\n", (396, 492), False, 'from djan... |
import numpy as np
from mushroom_rl.utils.parameters import Parameter
from mushroom_rl.utils.table import Table
class VarianceParameter(Parameter):
"""
Abstract class to implement variance-dependent parameters. A ``target``
parameter is expected.
"""
def __init__(self, value, exponential=False, ... | [
"numpy.array",
"numpy.log",
"numpy.var",
"mushroom_rl.utils.table.Table"
] | [((650, 661), 'mushroom_rl.utils.table.Table', 'Table', (['size'], {}), '(size)\n', (655, 661), False, 'from mushroom_rl.utils.table import Table\n'), ((680, 691), 'mushroom_rl.utils.table.Table', 'Table', (['size'], {}), '(size)\n', (685, 691), False, 'from mushroom_rl.utils.table import Table\n'), ((711, 722), 'mushr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.