code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import torch
from torch import nn as nn
from basicsr.archs.arch_util import ResidualBlockNoBN, Upsample, make_layer
from basicsr.utils.registry import ARCH_REGISTRY
@ARCH_REGISTRY.register()
class EDSR(nn.Module):
"""EDSR network structure.
Paper: Enhanced Deep Residual Networks for Single Image Super-Resol... | [
"torch.Tensor",
"basicsr.utils.registry.ARCH_REGISTRY.register",
"basicsr.archs.arch_util.Upsample",
"torch.nn.Conv2d",
"basicsr.archs.arch_util.make_layer"
] | [((169, 193), 'basicsr.utils.registry.ARCH_REGISTRY.register', 'ARCH_REGISTRY.register', ([], {}), '()\n', (191, 193), False, 'from basicsr.utils.registry import ARCH_REGISTRY\n'), ((1494, 1533), 'torch.nn.Conv2d', 'nn.Conv2d', (['num_in_ch', 'num_feat', '(3)', '(1)', '(1)'], {}), '(num_in_ch, num_feat, 3, 1, 1)\n', (1... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
"networkx.DiGraph",
"decyclify.node_iterators.TasksIterator",
"pytest.fail",
"decyclify.functions.decyclify",
"decyclify.node_iterators.CycleIterator",
"pytest.raises"
] | [((1140, 1168), 'decyclify.functions.decyclify', 'decyclify', (['sample_graph', '"""a"""'], {}), "(sample_graph, 'a')\n", (1149, 1168), False, 'from decyclify.functions import decyclify\n'), ((1185, 1215), 'decyclify.node_iterators.CycleIterator', 'CycleIterator', (['graph'], {'cycles': '(2)'}), '(graph, cycles=2)\n', ... |
import json
import xmltodict
with open("data.xml") as xml_file:
data_dict = xmltodict.parse(xml_file.read())
print(data_dict)
xml_file.close()
json_data = json.dumps(data_dict, indent=4)
with open("xml_data.json", "w") as json_file:
json_file.write(json_data)
json_file.close()
| [
"json.dumps"
] | [((164, 195), 'json.dumps', 'json.dumps', (['data_dict'], {'indent': '(4)'}), '(data_dict, indent=4)\n', (174, 195), False, 'import json\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from distutils.core import setup
setup(name='arpy',
version='0.1.1',
description='Library for accessing "ar" files',
author=u'<NAME>',
author_email='<EMAIL>',
url='http://bitbucket.org/viraptor/arpy',
py_modules=['arpy'],
license="Simplified BSD",
)
| [
"distutils.core.setup"
] | [((81, 310), 'distutils.core.setup', 'setup', ([], {'name': '"""arpy"""', 'version': '"""0.1.1"""', 'description': '"""Library for accessing "ar" files"""', 'author': 'u"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""http://bitbucket.org/viraptor/arpy"""', 'py_modules': "['arpy']", 'license': '"""Simplified ... |
# =============================================================================
# PROJECT CHRONO - http://projectchrono.org
#
# Copyright (c) 2014 projectchrono.org
# All rights reserved.
#
# Use of this source code is governed by a BSD-style license that can be found
# in the LICENSE file at the top level of the distr... | [
"pychrono.fea.CastToChNodeFEAxyzD",
"pychrono.ChVisualShapeFEA",
"pychrono.ChTimestepperHHT",
"pychrono.GetChronoDataFile",
"pychrono.ChVectorD",
"pychrono.fea.CastToChNodeFEAbase",
"pychrono.fea.ChMaterialShellANCF",
"pychrono.irrlicht.ChVisualSystemIrrlicht",
"pychrono.ChSolverMINRES",
"pychrono... | [((1346, 1366), 'pychrono.ChSystemSMC', 'chrono.ChSystemSMC', ([], {}), '()\n', (1364, 1366), True, 'import pychrono as chrono\n'), ((1796, 1808), 'pychrono.fea.ChMesh', 'fea.ChMesh', ([], {}), '()\n', (1806, 1808), True, 'import pychrono.fea as fea\n'), ((2842, 2875), 'pychrono.fea.CastToChNodeFEAbase', 'fea.CastToChN... |
# encoding: utf-8
import json
import yaml
import click
import googleanalytics as ga
from googleanalytics import utils
from .common import cli
# TODO: the blueprint stuff can probably be simplified so that
# it's little more than just a call to ga.describe
def from_blueprint(scope, src):
description = yaml.load(... | [
"click.Choice",
"click.argument",
"googleanalytics.authenticate",
"click.IntRange",
"click.option",
"click.File",
"yaml.load",
"click.echo",
"googleanalytics.query.describe",
"googleanalytics.Blueprint",
"googleanalytics.utils.cut"
] | [((1697, 1722), 'click.argument', 'click.argument', (['"""metrics"""'], {}), "('metrics')\n", (1711, 1722), False, 'import click\n'), ((1724, 1752), 'click.option', 'click.option', (['"""--dimensions"""'], {}), "('--dimensions')\n", (1736, 1752), False, 'import click\n'), ((1754, 1828), 'click.option', 'click.option', ... |
from config import *
from utils import make_bb
from utils import sed_integ
from mdwarf_interp import *
def initialize():
global bb10k
bb10k = make_bb(WAVELENGTH, 10000)
global BBnorm
BBnorm = 1 / sed_integ(WAVELENGTH[WMIN:WMAX], bb10k[WMIN:WMAX])
global MDarea
mdinterp = mdwarf_interp(MDSPEC... | [
"utils.make_bb",
"utils.sed_integ"
] | [((152, 178), 'utils.make_bb', 'make_bb', (['WAVELENGTH', '(10000)'], {}), '(WAVELENGTH, 10000)\n', (159, 178), False, 'from utils import make_bb\n'), ((390, 426), 'utils.sed_integ', 'sed_integ', (['WAVELENGTH[WMIN:WMAX]', 'md'], {}), '(WAVELENGTH[WMIN:WMAX], md)\n', (399, 426), False, 'from utils import sed_integ\n'),... |
from microbit import *
import neopixel
np = neopixel.NeoPixel(pin1 ,32)
def np_rainbow(np, num, bright=32, offset = 0):
rb = ((255,0,0), (255,127,0), (255,255,0), (0,255,0), (0,255,255),(0,0,255),(136,0,255), (255,0,0))
for i in range(num):
t = 7*i/num
t0 = int(t)
r = round((rb[t0][0] ... | [
"neopixel.NeoPixel"
] | [((45, 72), 'neopixel.NeoPixel', 'neopixel.NeoPixel', (['pin1', '(32)'], {}), '(pin1, 32)\n', (62, 72), False, 'import neopixel\n')] |
# Created byMartin.cz
# Copyright (c) <NAME>. All rights reserved.
from pero.properties import *
from pero import StraitAxis
from pero import Scale, ContinuousScale, LinScale, LogScale, OrdinalScale
from pero import Ticker, LinTicker, LogTicker, FixTicker, TimeTicker
from pero import Formatter, IndexFormatter
from ... | [
"pero.LogScale",
"pero.LinTicker",
"pero.LinScale",
"pero.OrdinalScale",
"pero.StraitAxis",
"pero.LogTicker",
"pero.TimeTicker",
"pero.IndexFormatter"
] | [((8132, 8144), 'pero.StraitAxis', 'StraitAxis', ([], {}), '()\n', (8142, 8144), False, 'from pero import StraitAxis\n'), ((23212, 23321), 'pero.OrdinalScale', 'OrdinalScale', ([], {'in_range': 'self.labels', 'out_range': 'mapper_values', 'default': 'UNDEF', 'implicit': '(False)', 'recycle': '(False)'}), '(in_range=sel... |
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
from collections.abc import Sequence
from types import ModuleType
from typing import Any, Optional
from arti.formats import Format
from arti.internal.utils import dispatch, import_submodules
from arti.storage import StoragePartition, _StoragePartition
f... | [
"arti.internal.utils.import_submodules"
] | [((540, 577), 'arti.internal.utils.import_submodules', 'import_submodules', (['__path__', '__name__'], {}), '(__path__, __name__)\n', (557, 577), False, 'from arti.internal.utils import dispatch, import_submodules\n')] |
import binascii
import os
from typing import Any, Callable, Generator, Iterator, NewType, Optional
import requests
from apk_patcher.lib.progress import ProgressCallback, ProgressCancelled, ProgressData, ProgressStage, ProgressType
DownloadMiddleware = NewType('DownloadMiddleware', Callable[[Iterator], Genera... | [
"apk_patcher.lib.progress.ProgressData",
"requests.get",
"typing.NewType",
"os.path.dirname",
"apk_patcher.lib.progress.ProgressCancelled",
"os.path.basename",
"binascii.a2b_base64"
] | [((263, 348), 'typing.NewType', 'NewType', (['"""DownloadMiddleware"""', 'Callable[[Iterator], Generator[bytes, None, None]]'], {}), "('DownloadMiddleware', Callable[[Iterator], Generator[bytes, None,\n None]])\n", (270, 348), False, 'from typing import Any, Callable, Generator, Iterator, NewType, Optional\n'), ((66... |
#%% Import modules
import numpy as np
import torch
def train(A, ss, epoch, single_model, single_optim, loss_MSE):
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
FR_ORDER_TRAIN = A["FR_ORDER_TRAIN"]
POS_NOR_ORDER_TRAIN = A["POS_NOR_ORDER_TRAIN"]
VEL_NOR_ORDER_TRAIN = A["VEL_NOR_OR... | [
"torch.utils.data.DataLoader",
"torch.utils.data.TensorDataset",
"torch.from_numpy",
"torch.cuda.is_available",
"torch.save",
"numpy.concatenate",
"torch.no_grad"
] | [((501, 604), 'numpy.concatenate', 'np.concatenate', (['(POS_NOR_ORDER_TRAIN[ss], VEL_NOR_ORDER_TRAIN[ss], ACC_NOR_ORDER_TRAIN[ss])'], {'axis': '(2)'}), '((POS_NOR_ORDER_TRAIN[ss], VEL_NOR_ORDER_TRAIN[ss],\n ACC_NOR_ORDER_TRAIN[ss]), axis=2)\n', (515, 604), True, 'import numpy as np\n'), ((706, 768), 'torch.utils.da... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2018-08-18 22:32
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migratio... | [
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.AutoField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((312, 369), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (343, 369), False, 'from django.db import migrations, models\n'), ((1550, 1604), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': ... |
import torch
import math
import gpytorch
from torch import nn
from gpytorch.random_variables import GaussianRandomVariable
from .likelihood import Likelihood
class GaussianLikelihood(Likelihood):
def __init__(self, log_noise_bounds=(-1000, 1000)):
super(GaussianLikelihood, self).__init__()
self.re... | [
"gpytorch.random_variables.GaussianRandomVariable",
"torch.zeros",
"math.log"
] | [((617, 652), 'gpytorch.random_variables.GaussianRandomVariable', 'GaussianRandomVariable', (['mean', 'noise'], {}), '(mean, noise)\n', (639, 652), False, 'from gpytorch.random_variables import GaussianRandomVariable\n'), ((363, 377), 'torch.zeros', 'torch.zeros', (['(1)'], {}), '(1)\n', (374, 377), False, 'import torc... |
import sys
import math
from collections import defaultdict, deque
sys.setrecursionlimit(10 ** 6)
stdin = sys.stdin
INF = float('inf')
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().strip()
sx, sy, gx, gy, T, V = na()
N = ni()
for _ in range(N):
x, y = ... | [
"sys.setrecursionlimit",
"math.sqrt"
] | [((67, 97), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 6)'], {}), '(10 ** 6)\n', (88, 97), False, 'import sys\n'), ((335, 375), 'math.sqrt', 'math.sqrt', (['((sx - x) ** 2 + (sy - y) ** 2)'], {}), '((sx - x) ** 2 + (sy - y) ** 2)\n', (344, 375), False, 'import math\n'), ((387, 427), 'math.sqrt', 'math.... |
from comment.models import Comment
from django.contrib.contenttypes.fields import GenericRelation
from django.db.models.signals import post_save
from django.conf import settings
from django.db import models
from django.db.models import Sum
from django.shortcuts import reverse
from django_countries.fields import Country... | [
"django.db.models.OneToOneField",
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.shortcuts.reverse",
"django.db.models.ImageField",
"django.db.models... | [((559, 589), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (578, 589), False, 'from django.db import models\n'), ((636, 708), 'django.db.models.OneToOneField', 'models.OneToOneField', (['settings.AUTH_USER_MODEL'], {'on_delete': 'models.CASCADE'}), '(settings.AUTH_U... |
#!/usr/bin/env python
# Copyright 2018 Kubos Corporation
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
"""
Wrapper for creating a UDP based Kubos service
"""
import socket
import json
import logging
def start(logger, config, schema, context={}):
logger.info("{} starting on {... | [
"json.dumps",
"socket.socket"
] | [((382, 430), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (395, 430), False, 'import socket\n'), ((1075, 1116), 'json.dumps', 'json.dumps', (["{'data': msg, 'errors': errs}"], {}), "({'data': msg, 'errors': errs})\n", (1085, 1116), False, 'im... |
from __future__ import annotations
import ast
from typing import (
TYPE_CHECKING,
Any,
Awaitable,
Callable,
List,
Optional,
Type,
Union,
cast,
)
from ....utils.logging import LoggingDescriptor
from ....utils.uri import Uri
from ...common.language import language_id
from ...common.t... | [
"typing.cast"
] | [((4773, 4796), 'typing.cast', 'cast', (['KeywordCall', 'node'], {}), '(KeywordCall, node)\n', (4777, 4796), False, 'from typing import TYPE_CHECKING, Any, Awaitable, Callable, List, Optional, Type, Union, cast\n'), ((6086, 6105), 'typing.cast', 'cast', (['Fixture', 'node'], {}), '(Fixture, node)\n', (6090, 6105), Fals... |
from decimal import Decimal
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from hordak.models import Account, StatementImport, StatementLine, Transaction
from hordak.tests.utils import DataProvider
from moneyed import Money
from hordak.utilities.curren... | [
"hordak.models.Transaction.objects.count",
"hordak.models.Transaction.objects.get",
"hordak.models.StatementLine.objects.get",
"hordak.models.StatementImport.objects.create",
"hordak.utilities.currency.Balance",
"moneyed.Money",
"django.urls.reverse",
"django.test.utils.override_settings",
"decimal.... | [((870, 938), 'django.test.utils.override_settings', 'override_settings', ([], {'DEFAULT_CURRENCY': '"""GBP"""', 'CURRENCIES': "['EUR', 'USD']"}), "(DEFAULT_CURRENCY='GBP', CURRENCIES=['EUR', 'USD'])\n", (887, 938), False, 'from django.test.utils import override_settings\n'), ((447, 484), 'django.urls.reverse', 'revers... |
#!flask/bin/python
from flask import Flask, jsonify, abort, make_response, request, send_from_directory
import sqlite3, json, logging, re
from flask_httpauth import HTTPBasicAuth
app = Flask(__name__)
db = sqlite3.connect("booksdb",check_same_thread = False)
cursor = db.cursor()
date_format = "%Y-%m-%d"
timestamp_form... | [
"flask_httpauth.HTTPBasicAuth",
"sqlite3.connect",
"re.compile",
"flask.Flask",
"logging.Formatter",
"json.dumps",
"flask.request.get_json",
"logging.FileHandler",
"flask.abort",
"flask.jsonify"
] | [((185, 200), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (190, 200), False, 'from flask import Flask, jsonify, abort, make_response, request, send_from_directory\n'), ((207, 258), 'sqlite3.connect', 'sqlite3.connect', (['"""booksdb"""'], {'check_same_thread': '(False)'}), "('booksdb', check_same_thread... |
import tensorflow as tf
def saturation(img):
mean = tf.keras.backend.mean(img, axis=-1, keepdims = True)
mul = tf.constant([1,1,1,3], tf.int32)
mean = tf.tile(mean, mul)
img = tf.math.subtract(img, mean)
sat = tf.einsum('aijk,aijk->aij', img, img)
sat = tf.math.scalar_mul((1.0/3.0),sat)
sat = tf.math.add(sat, t... | [
"tensorflow.expand_dims",
"tensorflow.tile",
"tensorflow.math.abs",
"tensorflow.math.pow",
"tensorflow.keras.backend.mean",
"tensorflow.math.subtract",
"tensorflow.nn.convolution",
"tensorflow.math.sqrt",
"tensorflow.split",
"tensorflow.einsum",
"tensorflow.math.multiply",
"tensorflow.constant... | [((54, 104), 'tensorflow.keras.backend.mean', 'tf.keras.backend.mean', (['img'], {'axis': '(-1)', 'keepdims': '(True)'}), '(img, axis=-1, keepdims=True)\n', (75, 104), True, 'import tensorflow as tf\n'), ((114, 149), 'tensorflow.constant', 'tf.constant', (['[1, 1, 1, 3]', 'tf.int32'], {}), '([1, 1, 1, 3], tf.int32)\n',... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
from __future__ import division
import csv
import numpy as np
import random
import pickle
import datetime
from NonSpatialFns import *
# <codecell>
#Script
#Number of state transitions to observe
M = int(2e7)
# time vector
time = np.zeros(M)
#Define par... | [
"numpy.random.random",
"datetime.datetime.now",
"numpy.zeros",
"numpy.log10"
] | [((296, 307), 'numpy.zeros', 'np.zeros', (['M'], {}), '(M)\n', (304, 307), True, 'import numpy as np\n'), ((1373, 1395), 'numpy.zeros', 'np.zeros', (['[6, changes]'], {}), '([6, changes])\n', (1381, 1395), True, 'import numpy as np\n'), ((2794, 2805), 'numpy.zeros', 'np.zeros', (['M'], {}), '(M)\n', (2802, 2805), True,... |
from mudes.app.mudes_app import MUDESApp
# app = HateSpansApp("multilingual-large", use_cuda=False)
# print(app.predict_hate_spans("ගෝඨාභය පොන්නයා විවාදෙට එන්නේ නැත්තේ ඇයි දන්නවා ද?", spans=True, language="xx"))
#
# tokens = app.predict_tokens("ගෝඨාභය පොන්නයා විවාදෙට එන්නේ නැත්තේ ඇයි දන්නවා ද?", language="xx")
# for t... | [
"mudes.app.mudes_app.MUDESApp"
] | [((383, 418), 'mudes.app.mudes_app.MUDESApp', 'MUDESApp', (['"""en-base"""'], {'use_cuda': '(False)'}), "('en-base', use_cuda=False)\n", (391, 418), False, 'from mudes.app.mudes_app import MUDESApp\n')] |
# Generated by Django 2.1.5 on 2019-01-16 15:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('travels', '0025_flight_time'),
]
operations = [
migrations.AddField(
model_name='flight',
name='date2',
... | [
"django.db.models.DateField"
] | [((326, 365), 'django.db.models.DateField', 'models.DateField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (342, 365), False, 'from django.db import migrations, models\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... | [
"google.cloud.security.common.util.parser.json_stringify"
] | [((1712, 1776), 'google.cloud.security.common.util.parser.json_stringify', 'parser.json_stringify', (["FAKE_PROJECT_APPLICATIONS_MAP['project1']"], {}), "(FAKE_PROJECT_APPLICATIONS_MAP['project1'])\n", (1733, 1776), False, 'from google.cloud.security.common.util import parser\n')] |
import json
__all__ = [
'dump',
'load',
]
def _get_mode(fp, mode):
if mode is None:
if fp.endswith('.jsonline') or fp.endswith('.jsonl'):
mode = 'jsonl'
else:
mode = 'json'
return mode
def _get_kwargs(**kwargs):
if 'encoding' not in kwargs:
kwargs... | [
"json.load",
"json.dumps",
"json.dump"
] | [((1096, 1114), 'json.dump', 'json.dump', (['obj', 'fp'], {}), '(obj, fp)\n', (1105, 1114), False, 'import json\n'), ((2420, 2433), 'json.load', 'json.load', (['fp'], {}), '(fp)\n', (2429, 2433), False, 'import json\n'), ((838, 854), 'json.dumps', 'json.dumps', (['item'], {}), '(item)\n', (848, 854), False, 'import jso... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour.appearance.hunt` module.
"""
import numpy as np
from itertools import permutations
from colour.appearance import (VIEWING_CONDITIONS_HUNT, InductionFactors_Hunt,
XYZ_to_Hunt)
from colour.appea... | [
"colour.utilities.domain_range_scale",
"colour.utilities.as_float_array",
"numpy.array",
"colour.appearance.XYZ_to_Hunt",
"itertools.permutations",
"colour.appearance.InductionFactors_Hunt",
"colour.utilities.tstack"
] | [((1584, 1625), 'colour.utilities.tstack', 'tstack', (["[data['X'], data['Y'], data['Z']]"], {}), "([data['X'], data['Y'], data['Z']])\n", (1590, 1625), False, 'from colour.utilities import as_float_array, domain_range_scale, ignore_numpy_errors, tstack\n'), ((1642, 1689), 'colour.utilities.tstack', 'tstack', (["[data[... |
from pathlib import Path
import os
import copy
import sys
import pytest
from ploomber.util.util import add_to_sys_path, chdir_code, requires
from ploomber.util import dotted_path
def test_add_to_sys_path():
path = str(Path('/path/to/add').resolve())
with add_to_sys_path(path, chdir=False):
assert pa... | [
"ploomber.util.dotted_path.load_dotted_path",
"ploomber.util.util.requires",
"pathlib.Path",
"ploomber.util.util.add_to_sys_path",
"os.getcwd",
"pytest.raises",
"ploomber.util.util.chdir_code",
"copy.copy"
] | [((524, 535), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (533, 535), False, 'import os\n'), ((770, 789), 'copy.copy', 'copy.copy', (['sys.path'], {}), '(sys.path)\n', (779, 789), False, 'import copy\n'), ((1392, 1449), 'ploomber.util.dotted_path.load_dotted_path', 'dotted_path.load_dotted_path', (['"""dotted_path_with... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import requests
import sys
import yaml
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
action = sys.argv[1] if len(sys.argv) > 1 else "status"
installfile = "install-config.yaml"
with open(installfile) as f:
data = yaml.... | [
"requests.post",
"re.match",
"requests.get",
"urllib3.disable_warnings",
"yaml.safe_load"
] | [((113, 180), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (137, 180), False, 'import urllib3\n'), ((315, 332), 'yaml.safe_load', 'yaml.safe_load', (['f'], {}), '(f)\n', (329, 332), False, 'import yaml\n'), ... |
import re
import random
import itertools
import math
from collections import defaultdict
from src.utilities import *
from src import debuglog, errlog, plog, users, channels
from src.decorators import cmd, event_listener
from src.containers import UserList, UserSet, UserDict, DefaultUserDict
from src.messages import me... | [
"src.events.Event",
"src.channels.Main.send",
"src.debuglog",
"src.decorators.event_listener"
] | [((358, 391), 'src.decorators.event_listener', 'event_listener', (['"""get_reveal_role"""'], {}), "('get_reveal_role')\n", (372, 391), False, 'from src.decorators import cmd, event_listener\n'), ((869, 901), 'src.decorators.event_listener', 'event_listener', (['"""get_final_role"""'], {}), "('get_final_role')\n", (883,... |
import os
from setuptools import setup
version = {}
version_path = os.path.join('array_namespace', '__version__.py')
with open(version_path, 'r', encoding='utf-8') as f:
exec(f.read(), version)
with open('README.rst', 'r', encoding='utf-8') as f:
readme = f.read()
setup(
name='array_namespace',
versi... | [
"os.path.join",
"setuptools.setup"
] | [((68, 117), 'os.path.join', 'os.path.join', (['"""array_namespace"""', '"""__version__.py"""'], {}), "('array_namespace', '__version__.py')\n", (80, 117), False, 'import os\n'), ((276, 1644), 'setuptools.setup', 'setup', ([], {'name': '"""array_namespace"""', 'version': "version['__version__']", 'description': '"""Exp... |
import copy
class TreeNode(object):
def __init__(self, tree, parent, title, string):
self.tree = tree
self.title = title
self.parent = parent
self.string = string
self.children = []
self.adoptive_parents = []
if self in self.tree:
raise ValueErro... | [
"copy.copy"
] | [((8134, 8171), 'copy.copy', 'copy.copy', (['tree_node.adoptive_parents'], {}), '(tree_node.adoptive_parents)\n', (8143, 8171), False, 'import copy\n'), ((5415, 5444), 'copy.copy', 'copy.copy', (['tree_node.children'], {}), '(tree_node.children)\n', (5424, 5444), False, 'import copy\n')] |
# Generated by Django 3.0.6 on 2020-05-17 12:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ramblings', '0011_auto_20200517_1237'),
]
operations = [
migrations.AddField(
model_name='post',
name='level',
... | [
"django.db.models.PositiveIntegerField"
] | [((333, 387), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(1)', 'editable': '(False)'}), '(default=1, editable=False)\n', (360, 387), False, 'from django.db import migrations, models\n'), ((538, 592), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', (... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='... | [
"django.db.models.DateTimeField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.ForeignKey"
] | [((395, 488), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'primary_key': '(True)', 'serialize': '(False)', 'auto_created': '(True)'}), "(verbose_name='ID', primary_key=True, serialize=False,\n auto_created=True)\n", (411, 488), False, 'from django.db import models, migrations\... |
import argparse
import boto3
import json
import time
IN_FILE = "initial-servers.json"
OUT_FILE = "temp-servers.json"
# Network ID for main network, gamma, and beta
NETWORK_ID="1"
NETWORK_ID_FILTER = {'Name': 'tag:NetworkId', 'Values': [NETWORK_ID]}
RUNNING_FILTER={'Name': 'instance-state-name', 'Values': ['running']}... | [
"argparse.ArgumentParser",
"time.sleep",
"boto3.resource",
"json.load",
"json.dump"
] | [((431, 502), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Create config for ssh-to via AWS"""'}), "(description='Create config for ssh-to via AWS')\n", (454, 502), False, 'import argparse\n'), ((1167, 1222), 'boto3.resource', 'boto3.resource', (['"""ec2"""'], {'region_name': 'old_exim... |
# ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... | [
"logging.getLogger",
"vttools.scrape._extract_default_vals",
"vttools.scrape._truncate_description",
"vttools.scrape.obj_src",
"numpy.testing.assert_equal",
"vttools.scrape._type_optional",
"vttools.scrape.scrape_function",
"itertools.product",
"numpy.testing.assert_raises",
"vttools.scrape._norma... | [((2657, 2684), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2674, 2684), False, 'import logging\n'), ((2939, 2997), 'vttools.scrape.scrape_function', 'scrape.scrape_function', (['"""porridge_for_the_bears"""', '__name__'], {}), "('porridge_for_the_bears', __name__)\n", (2961, 2997), F... |
import os
import numpy as np
import torch
import torch.nn.functional as F
from tqdm import tqdm
from test import test
import torchvision
class TrainLoop(object):
def __init__(self, model, optimizer, source_loader, test_source_loader, target_loader, patience, l2, penalty_weight, penalty_anneal_epochs, checkpoint_pat... | [
"numpy.argmax",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.CrossEntropyLoss",
"torch.load",
"os.path.join",
"torch.optim.lr_scheduler.StepLR",
"test.test",
"os.getcwd",
"os.path.isfile",
"numpy.max",
"torch.tensor",
"os.path.isdir",
"torch.sum",
"torch.autograd.grad",
"os.mkdir"
... | [((634, 683), 'os.path.join', 'os.path.join', (['self.checkpoint_path', '"""IRM_{}ep.pt"""'], {}), "(self.checkpoint_path, 'IRM_{}ep.pt')\n", (646, 683), False, 'import os\n'), ((831, 898), 'torch.optim.lr_scheduler.StepLR', 'torch.optim.lr_scheduler.StepLR', (['self.optimizer'], {'step_size': 'patience'}), '(self.opti... |
import sys; sys.path.append('../common')
import mylib as utils # pylint: disable=import-error
# Read args
filename = 'input.txt' if len(sys.argv) == 1 else sys.argv[1]
print(filename, '\n')
###########################
# region COMMON
REMINDER_VALUE = 20201227
def getNextValue(value: int, subjectNumber: int) -> int:... | [
"sys.path.append",
"mylib.readFileLines"
] | [((12, 40), 'sys.path.append', 'sys.path.append', (['"""../common"""'], {}), "('../common')\n", (27, 40), False, 'import sys\n'), ((1252, 1281), 'mylib.readFileLines', 'utils.readFileLines', (['filename'], {}), '(filename)\n', (1271, 1281), True, 'import mylib as utils\n')] |
import pandas as pd
from rdkit import Chem
import numpy as np
import json
from gensim.models import Word2Vec
from gensim.test.utils import get_tmpfile
from gensim.models import KeyedVectors
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
import seaborn as sns
import networkx as nx
import re
""" Load ... | [
"networkx.bipartite.projected_graph",
"networkx.all_pairs_shortest_path_length",
"seaborn.color_palette",
"pandas.read_csv",
"rdkit.Chem.MolFromSmiles",
"networkx.Graph",
"sklearn.manifold.TSNE",
"gensim.models.KeyedVectors.load",
"json.load",
"networkx.connected_components",
"matplotlib.pyplot.... | [((447, 500), 'gensim.models.KeyedVectors.load', 'KeyedVectors.load', (['"""../vectors_fullKEGG.kv"""'], {'mmap': '"""r"""'}), "('../vectors_fullKEGG.kv', mmap='r')\n", (464, 500), False, 'from gensim.models import KeyedVectors\n'), ((3701, 3759), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)', 'verbose':... |
"""This module contains several handy functions primarily meant for internal use."""
from __future__ import division
from datetime import date, datetime, time, timedelta, tzinfo
from calendar import timegm
import re
from pytz import timezone, utc
import six
try:
from inspect import signature
except ImportError: ... | [
"datetime.datetime",
"pytz.timezone",
"datetime.datetime.fromtimestamp",
"datetime.time",
"re.compile",
"six.itervalues",
"funcsigs.signature",
"datetime.timedelta"
] | [((2619, 2796), 're.compile', 're.compile', (['"""(?P<year>\\\\d{4})-(?P<month>\\\\d{1,2})-(?P<day>\\\\d{1,2})(?: (?P<hour>\\\\d{1,2}):(?P<minute>\\\\d{1,2}):(?P<second>\\\\d{1,2})(?:\\\\.(?P<microsecond>\\\\d{1,6}))?)?"""'], {}), "(\n '(?P<year>\\\\d{4})-(?P<month>\\\\d{1,2})-(?P<day>\\\\d{1,2})(?: (?P<hour>\\\\d{1... |
# Generated by Django 2.0.1 on 2018-02-18 20:36
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('countries', '0005_remove_locale_data'),
]
operations = [
migrations.RenameField(
model_name='country',
old_name='mpoly',
... | [
"django.db.migrations.RenameField"
] | [((229, 317), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""country"""', 'old_name': '"""mpoly"""', 'new_name': '"""outlines"""'}), "(model_name='country', old_name='mpoly', new_name=\n 'outlines')\n", (251, 317), False, 'from django.db import migrations\n'), ((369, 448), 'dja... |
import math
import torch
import torch.nn as nn
from torch.distributions import Normal
from torch.nn import init
FixedNormal = Normal
log_prob_normal = FixedNormal.log_prob
FixedNormal.log_probs = lambda self, actions: log_prob_normal(self, actions).sum(-1, keepdim=True)
entropy = FixedNormal.entropy
FixedNormal.entro... | [
"torch.nn.functional.linear",
"torch.nn.ReLU",
"torch.nn.LeakyReLU",
"torch.sigmoid",
"torch.Tensor",
"math.sqrt",
"torch.nn.Conv2d",
"torch.nn.init.xavier_normal_",
"torch.nn.init.kaiming_uniform_",
"torch.nn.Linear",
"torch.zeros",
"torch.FloatTensor",
"torch.cat"
] | [((738, 766), 'torch.nn.Linear', 'nn.Linear', (['size_in', 'size_out'], {}), '(size_in, size_out)\n', (747, 766), True, 'import torch.nn as nn\n'), ((914, 938), 'torch.zeros', 'torch.zeros', (['(1)', 'size_out'], {}), '(1, size_out)\n', (925, 938), False, 'import torch\n'), ((1834, 1869), 'torch.FloatTensor', 'torch.Fl... |
from django.core.management.base import BaseCommand
from quotes.models import Episode, Show
from quotes.quotelist import quotelistdict
from django.db import IntegrityError
from django.core.exceptions import ObjectDoesNotExist
class Command(BaseCommand):
help = 'Loads shows from quotes.quotelist.quotedictlist'
... | [
"quotes.models.Show.objects.count",
"quotes.models.Show"
] | [((659, 699), 'quotes.models.Show', 'Show', ([], {'name': "item['show']", 'is_active': '(False)'}), "(name=item['show'], is_active=False)\n", (663, 699), False, 'from quotes.models import Episode, Show\n'), ((1210, 1230), 'quotes.models.Show.objects.count', 'Show.objects.count', ([], {}), '()\n', (1228, 1230), False, '... |
"""
Streamlit web UI for plotting model outputs
"""
import streamlit as st
from autumn.tools import db
from autumn.tools.plots.plotter import StreamlitPlotter
from autumn.utils.params import load_targets
from dash import selectors
from .plots import PLOT_FUNCS
def run_dashboard():
app_name, app_dirpath = selec... | [
"dash.selectors.app_name",
"autumn.utils.params.load_targets",
"streamlit.write",
"autumn.tools.db.load.load_mcmc_tables",
"streamlit.sidebar.slider",
"autumn.tools.db.load.load_mcmc_params_tables",
"autumn.tools.plots.plotter.StreamlitPlotter"
] | [((315, 355), 'dash.selectors.app_name', 'selectors.app_name', ([], {'run_type': '"""calibrate"""'}), "(run_type='calibrate')\n", (333, 355), False, 'from dash import selectors\n'), ((479, 528), 'streamlit.sidebar.slider', 'st.sidebar.slider', (['"""Number of countries"""', '(2)', '(6)', '(3)'], {}), "('Number of count... |
from decimal import Decimal
from rest_framework import status
class MapObjectApiViewTestTemplate(object):
def test_empty_filter(self, url):
response = self.client.get(url)
filtered_objects = response.data
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqua... | [
"decimal.Decimal"
] | [((1540, 1571), 'decimal.Decimal', 'Decimal', (["rect_params['min_lat']"], {}), "(rect_params['min_lat'])\n", (1547, 1571), False, 'from decimal import Decimal\n'), ((1628, 1660), 'decimal.Decimal', 'Decimal', (["rect_params['min_long']"], {}), "(rect_params['min_long'])\n", (1635, 1660), False, 'from decimal import De... |
# the functionality of this test file has not been tested.
from pathlib import Path
import shutil
import chromedriver_binary
from dash.testing.application_runners import import_app
import pytest
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.w... | [
"selenium.webdriver.support.ui.WebDriverWait",
"pathlib.Path",
"dash.testing.application_runners.import_app",
"selenium.webdriver.support.expected_conditions.text_to_be_present_in_element",
"shutil.rmtree"
] | [((1153, 1172), 'dash.testing.application_runners.import_app', 'import_app', (['"""usage"""'], {}), "('usage')\n", (1163, 1172), False, 'from dash.testing.application_runners import import_app\n'), ((1440, 1459), 'dash.testing.application_runners.import_app', 'import_app', (['"""usage"""'], {}), "('usage')\n", (1450, 1... |
# BSD 3-Clause License
#
# Copyright (c) 2016-19, University of Liverpool
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notic... | [
"conkit.misc.deprecate"
] | [((1787, 1833), 'conkit.misc.deprecate', 'deprecate', (['"""0.11"""'], {'msg': '"""Use A2mParser instead"""'}), "('0.11', msg='Use A2mParser instead')\n", (1796, 1833), False, 'from conkit.misc import deprecate\n')] |
from flask import Flask
from flask_socketio import SocketIO, emit
from raven.engine.default_engine import DefaultEngine as Engine
from raven.input.rest_input import RESTInput
from raven.output.rest_output import RESTOutput
from raven.layer.cmd.wiki import WikiLayer
from config.stage import settings
app = Flask(__nam... | [
"flask.Flask",
"raven.input.rest_input.RESTInput",
"flask_socketio.SocketIO",
"raven.engine.default_engine.DefaultEngine",
"raven.output.rest_output.RESTOutput",
"raven.layer.cmd.wiki.WikiLayer"
] | [((309, 324), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (314, 324), False, 'from flask import Flask\n'), ((373, 386), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (381, 386), False, 'from flask_socketio import SocketIO, emit\n'), ((402, 434), 'raven.input.rest_input.RESTInput', 'RE... |
import json
import pytest
from indy import ledger, error
@pytest.mark.asyncio
async def test_build_attrib_request_works_for_raw_value():
identifier = "Th7MpTaRZVRYnPiabds81Y"
destination = "Th7MpTaRZVRYnPiabds81Y"
raw = '{"endpoint":{"ha":"127.0.0.1:5555"}}'
expected_response = {
"identifier... | [
"pytest.raises",
"indy.ledger.build_attrib_request"
] | [((2026, 2069), 'pytest.raises', 'pytest.raises', (['error.CommonInvalidStructure'], {}), '(error.CommonInvalidStructure)\n', (2039, 2069), False, 'import pytest\n'), ((490, 559), 'indy.ledger.build_attrib_request', 'ledger.build_attrib_request', (['identifier', 'destination', 'None', 'raw', 'None'], {}), '(identifier,... |
#! /usr/bin/env python
# Copyright 2020 CS Systemes d'Information, http://www.c-s.fr
#
# This file is part of pytest-executable
# https://www.github.com/CS-SI/pytest-executable
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# Y... | [
"pathlib.Path.cwd",
"yaml.safe_load",
"pathlib.Path"
] | [((2077, 2091), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (2081, 2091), False, 'from pathlib import Path\n'), ((4383, 4393), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (4391, 4393), False, 'from pathlib import Path\n'), ((2690, 2712), 'yaml.safe_load', 'yaml.safe_load', (['stream'], {}), '(stre... |
import warnings
from typing import Tuple, Callable, Any, List
import numpy as np
from nebullvm.base import QuantizationType
from nebullvm.inference_learners.base import BaseInferenceLearner
from nebullvm.measure import compute_relative_difference
def check_precision(
optimized_learner: BaseInferenceLearner,
... | [
"warnings.warn"
] | [((1539, 1676), 'warnings.warn', 'warnings.warn', (['"""Got a valid quantization type without any given quantization threshold. The quantization step will be ignored."""'], {}), "(\n 'Got a valid quantization type without any given quantization threshold. The quantization step will be ignored.'\n )\n", (1552, 167... |
import unittest
import numpy as np
from .bvgamma import *
from flavio.physics.bdecays.formfactors.b_v import bsz_parameters
from flavio.physics.eft import WilsonCoefficients
from flavio.physics.bdecays.wilsoncoefficients import wctot_dict
from flavio.parameters import default_parameters
import flavio
wc = WilsonCoeff... | [
"flavio.physics.eft.WilsonCoefficients"
] | [((309, 329), 'flavio.physics.eft.WilsonCoefficients', 'WilsonCoefficients', ([], {}), '()\n', (327, 329), False, 'from flavio.physics.eft import WilsonCoefficients\n')] |
from installed_clients.specialClient import special as special
import json
import os
import shutil
def wdl(callback_url, token, params):
sr = special(callback_url, token=token)
src = '/kb/module/workflow.wdl'
wdl_file = 'workflow.wdl'
shutil.copy(src, '/kb/module/work/tmp/' + wdl_file)
input_file ... | [
"json.dumps",
"shutil.copy",
"installed_clients.specialClient.special"
] | [((148, 182), 'installed_clients.specialClient.special', 'special', (['callback_url'], {'token': 'token'}), '(callback_url, token=token)\n', (155, 182), True, 'from installed_clients.specialClient import special as special\n'), ((253, 304), 'shutil.copy', 'shutil.copy', (['src', "('/kb/module/work/tmp/' + wdl_file)"], ... |
from midca import goals, base
from midca import midcatime
from ._goalgen import tf_fire
from ._goalgen import tf_3_scen
from midca.domains.logistics import deliverstate
from midca.domains.blocksworld import blockstate
from midca.worldsim import stateread
import copy,csv
import random
from midca.modules.monitors import ... | [
"midca.domains.blocksworld.blockstate.get_block_list"
] | [((1026, 1058), 'midca.domains.blocksworld.blockstate.get_block_list', 'blockstate.get_block_list', (['world'], {}), '(world)\n', (1051, 1058), False, 'from midca.domains.blocksworld import blockstate\n')] |
import unittest
import mock
from copy import copy
from tests import BaseTest
import logging
# Units under test
import cadquery
from cadquery.freecad_impl import console_logging
class TestLogging(BaseTest):
def setUp(self):
# save root logger's state
root_logger = logging.getLogger()
self... | [
"logging.getLogger",
"mock.patch",
"cadquery.freecad_impl.console_logging.disable",
"cadquery.freecad_impl.console_logging.enable",
"copy.copy"
] | [((777, 836), 'mock.patch', 'mock.patch', (['"""cadquery.freecad_impl.console_logging.FreeCAD"""'], {}), "('cadquery.freecad_impl.console_logging.FreeCAD')\n", (787, 836), False, 'import mock\n'), ((1186, 1245), 'mock.patch', 'mock.patch', (['"""cadquery.freecad_impl.console_logging.FreeCAD"""'], {}), "('cadquery.freec... |
#!/usr/bin/python3
import collections
import contextlib
import itertools
import logging
import math
import os.path
import re
import json
import sys
import types
from typing import Iterable, List, Tuple
import matplotlib
import numpy as np
from absl import app, flags
import scipy.stats
FLAGS = flags.FLAGS
flags.DEFIN... | [
"re.compile",
"matplotlib.pyplot.ylabel",
"absl.flags.register_validator",
"matplotlib.pyplot.errorbar",
"logging.info",
"numpy.arange",
"absl.flags.DEFINE_list",
"matplotlib.pyplot.xlabel",
"absl.app.run",
"numpy.max",
"matplotlib.pyplot.close",
"itertools.chain.from_iterable",
"matplotlib.... | [((309, 387), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""pdf_dir"""', '""""""', '"""directory to which PDF files are written"""'], {}), "('pdf_dir', '', 'directory to which PDF files are written')\n", (328, 387), False, 'from absl import app, flags\n'), ((388, 466), 'absl.flags.DEFINE_string', 'flags.DEFI... |
# -*- coding: UTF-8 -*-
"""
此脚本用于展示spectral embedding的效果
"""
import numpy as np
import matplotlib.pyplot as plt
from spectral_embedding_ import spectral_embedding
def generate_data():
"""
生成邻接矩阵
"""
data = np.array([
[0, 1, 1, 1, 0, 0, 0],
[1, 0, 1, 1, 1, 0, 0],
[1, 1, 0, 1, ... | [
"spectral_embedding_.spectral_embedding",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.show"
] | [((226, 406), 'numpy.array', 'np.array', (['[[0, 1, 1, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, 0], [1, 1,\n 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 0, 1], [0, 0, 0,\n 0, 1, 1, 0]]'], {}), '([[0, 1, 1, 1, 0, 0, 0], [1, 0, 1, 1, 1, 0, 0], [1, 1, 0, 1, 0, 0, \n 0], [1, 1, 1, 0, 0, 0,... |
"""
clustering.py
2018.06.11
"""
import sys
import os
import argparse
import tensorflow as tf
import numpy as np
import facenet
from scipy import misc
from sklearn.cluster import KMeans
class FaceNet:
def __init__(self, sess, args):
self.session = sess
facenet.load_model(args.model)
... | [
"sklearn.cluster.KMeans",
"os.path.exists",
"tensorflow.ConfigProto",
"facenet.get_image_paths",
"argparse.ArgumentParser",
"os.mkdir",
"facenet.prewhiten",
"numpy.concatenate",
"tensorflow.GPUOptions",
"facenet.to_rgb",
"facenet.load_model",
"tensorflow.get_default_graph"
] | [((1630, 1701), 'tensorflow.GPUOptions', 'tf.GPUOptions', ([], {'per_process_gpu_memory_fraction': 'args.gpu_memory_fraction'}), '(per_process_gpu_memory_fraction=args.gpu_memory_fraction)\n', (1643, 1701), True, 'import tensorflow as tf\n'), ((2952, 2977), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {})... |
import cv2
import numpy as np
import pafy
"""
url = 'https://youtu.be/u68EWmtKZw0?list=TLPQMDkwMzIwMjCcOgKmuF00yg'
vPafy = pafy.new(url)
play = vPafy.getbest(preftype="mp4")
cap = cv2.VideoCapture(play.url)
"""
cap = cv2.VideoCapture(0)
CLASSES = ["background", "aeroplane", "bicycle", "bird", "boat",
"bottl... | [
"cv2.rectangle",
"cv2.dnn.readNetFromCaffe",
"cv2.imshow",
"cv2.putText",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.resize",
"cv2.waitKey",
"numpy.arange"
] | [((217, 236), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (233, 236), False, 'import cv2\n'), ((1711, 1734), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (1732, 1734), False, 'import cv2\n'), ((601, 630), 'cv2.resize', 'cv2.resize', (['image', '(640, 640)'], {}), '(image, (640... |
"""
Vectorize() with support for decorating methods; for example::
from scipy.stats import rv_continuous
from scipy_ext import vectorize
class dist(rv_continuous):
@vectorize(excluded=('n',), otypes=(float,))
def _cdf(self, x, n):
if n < 5:
return f(x) # One ex... | [
"numpy.arange"
] | [((1635, 1665), 'numpy.arange', 'arange', (['starts', '(starts + count)'], {}), '(starts, starts + count)\n', (1641, 1665), False, 'from numpy import arange, stack, vectorize as numpy_vectorize\n'), ((1560, 1580), 'numpy.arange', 'arange', (['s', '(s + count)'], {}), '(s, s + count)\n', (1566, 1580), False, 'from numpy... |
# @title: pbt_trainer.py
# @author: <NAME>
# @date: 02.09.2021
############################################################
# Imports
import torch
import time
import numpy as np
import random
from torch.utils.tensorboard import SummaryWriter
from src.utility.container import (
ModelContainer,
UtilityC... | [
"src.gridworld_trainer.reinforce.model.ReinforceNetwork3D",
"src.gridworld_trainer.reinforce.memory.MemoryReinforce",
"torch.cuda.is_available",
"torchvision.utils.make_grid",
"copy.copy",
"logging.info",
"torch.utils.tensorboard.SummaryWriter",
"os.path.exists",
"src.utility.container.StatisticCont... | [((3125, 3153), 'torch.manual_seed', 'torch.manual_seed', (['self.seed'], {}), '(self.seed)\n', (3142, 3153), False, 'import torch\n'), ((3162, 3187), 'numpy.random.seed', 'np.random.seed', (['self.seed'], {}), '(self.seed)\n', (3176, 3187), True, 'import numpy as np\n'), ((3196, 3218), 'random.seed', 'random.seed', ([... |
# -*- coding: utf-8 -*-
'''
You are given a string where you have to find its first word.
When solving a task pay attention to the following points:
There can be dots and commas in a string.
A string can start with a letter or, for example, a dot or space.
A word can contain an apostrophe and it's a part of a word.
... | [
"datetime.date"
] | [((511, 533), 'datetime.date', 'date', (['a[0]', 'a[1]', 'a[2]'], {}), '(a[0], a[1], a[2])\n', (515, 533), False, 'from datetime import date\n'), ((536, 558), 'datetime.date', 'date', (['b[0]', 'b[1]', 'b[2]'], {}), '(b[0], b[1], b[2])\n', (540, 558), False, 'from datetime import date\n')] |
""" Batched Render file. """
import dirt
import numpy as np
import tensorflow as tf
from dirt import matrices
import dirt.lighting as lighting
from tensorflow.python.framework import ops
def orthgraphic_projection(w, h, near=0.1, far=10., name=None):
"""Constructs a orthographic projection matrix.
This func... | [
"dirt.rasterise_batch",
"tensorflow.shape",
"numpy.zeros",
"tensorflow.ones_like",
"tensorflow.convert_to_tensor",
"tensorflow.python.framework.ops.name_scope",
"tensorflow.cast"
] | [((2464, 2493), 'numpy.zeros', 'np.zeros', (['(3)'], {'dtype': 'np.float32'}), '(3, dtype=np.float32)\n', (2472, 2493), True, 'import numpy as np\n'), ((2545, 2574), 'numpy.zeros', 'np.zeros', (['(3)'], {'dtype': 'np.float32'}), '(3, dtype=np.float32)\n', (2553, 2574), True, 'import numpy as np\n'), ((2611, 2640), 'num... |
#!/usr/bin/env python
import sys
import binascii
from struct import pack, unpack
###############################################################################
# color crap
###############################################################################
palette = [0xbccbde, 0xc2dde6, 0xe6e9f0, 0x431c5d, 0xe05915, 0x... | [
"sys.exit"
] | [((9768, 9780), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (9776, 9780), False, 'import sys\n')] |
# -*- coding: utf-8
import unicodedata
import math
import logging
import pickle
import numpy as np
import h5py
from .alignment import Alignment, Edits
GAP = '\a' # reserved character that does not get mapped (for gap repairs)
class Sequence2Sequence(object):
'''Sequence to sequence (character-level) error correc... | [
"logging.getLogger",
"numpy.nanargmax",
"numpy.log",
"keras.callbacks.TerminateOnNaN",
"keras.layers.TimeDistributed",
"keras.backend.slice",
"math.sqrt",
"numpy.argsort",
"numpy.array",
"numpy.count_nonzero",
"keras.layers.Dense",
"tensorflow.compat.v1.get_default_graph",
"math.exp",
"ten... | [((10507, 10533), 'tensorflow.compat.v1.ConfigProto', 'tf.compat.v1.ConfigProto', ([], {}), '()\n', (10531, 10533), True, 'import tensorflow as tf\n'), ((12030, 12086), 'keras.layers.Input', 'Input', ([], {'shape': '(None, self.voc_size)', 'name': '"""encoder_input"""'}), "(shape=(None, self.voc_size), name='encoder_in... |
import inspect
from src.Challenge import Challenge
class ChainDecorators(Challenge):
def __init__(self):
super(ChainDecorators, self).__init__()
self.challenge = 'Chain multiple decorators together'
def code(self):
starting_string = 'Middle'
print('starting_string =', startin... | [
"inspect.getsource"
] | [((459, 491), 'inspect.getsource', 'inspect.getsource', (['decorator_one'], {}), '(decorator_one)\n', (476, 491), False, 'import inspect\n'), ((521, 553), 'inspect.getsource', 'inspect.getsource', (['decorator_two'], {}), '(decorator_two)\n', (538, 553), False, 'import inspect\n')] |
import sys
import re
import datefinder
#finds the first ID found in a string
def find_id(message):
result = re.search('<@!(.+?)>', message)
if(result):
return result.group(1)
return None
#finds the first date in a string
def find_date(message):
result = list(datefinder.find_date... | [
"re.findall",
"datefinder.find_dates",
"re.search"
] | [((119, 150), 're.search', 're.search', (['"""<@!(.+?)>"""', 'message'], {}), "('<@!(.+?)>', message)\n", (128, 150), False, 'import re\n'), ((300, 330), 'datefinder.find_dates', 'datefinder.find_dates', (['message'], {}), '(message)\n', (321, 330), False, 'import datefinder\n'), ((605, 651), 're.findall', 're.findall'... |
##############################################################################
# #
# This is a demonstration of the Fast Factorized Backprojection algorithm. #
# Data sets can be switched in and out by commenting/uncommenting the lines #
# o... | [
"ritsar.imgTools.imshow",
"matplotlib.pylab.tight_layout",
"matplotlib.pylab.title",
"ritsar.imgTools.img_plane_dict",
"ritsar.imgTools.backprojection",
"matplotlib.pylab.xlabel",
"ritsar.imgTools.FFBP",
"ritsar.phsRead.AFRL",
"time.time",
"matplotlib.pylab.subplot",
"ritsar.imgTools.FFBPmp",
... | [((621, 639), 'sys.path.append', 'path.append', (['"""../"""'], {}), "('../')\n", (632, 639), False, 'from sys import path\n'), ((640, 669), 'sys.path.append', 'path.append', (['"""./dictionaries"""'], {}), "('./dictionaries')\n", (651, 669), False, 'from sys import path\n'), ((3409, 3455), 'ritsar.phsRead.AFRL', 'phsR... |
# SPDX-License-Identifier: MIT
# Copyright (c) 2021 Akumatic
#
# https://adventofcode.com/2021/day/18
import math
class Node:
def __init__(self, left: "Node" = None, right: "Node" = None,
value: int = None, parent: "Node" = None, depth: int = 1):
self.left = left
self.right = right
... | [
"math.ceil",
"math.floor"
] | [((1701, 1716), 'math.floor', 'math.floor', (['val'], {}), '(val)\n', (1711, 1716), False, 'import math\n'), ((1785, 1799), 'math.ceil', 'math.ceil', (['val'], {}), '(val)\n', (1794, 1799), False, 'import math\n')] |
from typing import Optional, MutableMapping, List, Union
from datetime import datetime, timedelta
from fastapi.security import OAuth2PasswordBearer
from passlib.context import CryptContext
from sqlalchemy.orm.session import Session
from jose import jwt
from app.models import User
from app.config import settings
JWTP... | [
"fastapi.security.OAuth2PasswordBearer",
"datetime.datetime.utcnow",
"passlib.context.CryptContext",
"jose.jwt.encode",
"datetime.timedelta"
] | [((429, 467), 'fastapi.security.OAuth2PasswordBearer', 'OAuth2PasswordBearer', ([], {'tokenUrl': '"""token"""'}), "(tokenUrl='token')\n", (449, 467), False, 'from fastapi.security import OAuth2PasswordBearer\n'), ((482, 533), 'passlib.context.CryptContext', 'CryptContext', ([], {'schemes': "['bcrypt']", 'deprecated': '... |
#!/usr/bin/env python
from distutils.core import setup
setup(name = 'filltex',
version = '1.3.1',
description = 'Automatic queries to ADS and InSPIRE databases to fill LATEX bibliography',
long_description="See: `github.com/dgerosa/filltex <https://github.com/dgerosa/filltex>`_." ,
author = '<... | [
"distutils.core.setup"
] | [((57, 526), 'distutils.core.setup', 'setup', ([], {'name': '"""filltex"""', 'version': '"""1.3.1"""', 'description': '"""Automatic queries to ADS and InSPIRE databases to fill LATEX bibliography"""', 'long_description': '"""See: `github.com/dgerosa/filltex <https://github.com/dgerosa/filltex>`_."""', 'author': '"""<NA... |
from collector import Collector
from builder import Builder
from defender import Defender
from harvester_new import HarvesterNew
from upgrader import Upgrader
from creep_spawner import CreepSpawner
from tower import Tower
# defs is a package which claims to export all constants and some JavaScript objects, but in reali... | [
"builder.Builder",
"collector.Collector",
"upgrader.Upgrader",
"tower.Tower",
"defender.Defender",
"harvester_new.HarvesterNew",
"creep_spawner.CreepSpawner"
] | [((2008, 2020), 'tower.Tower', 'Tower', (['tower'], {}), '(tower)\n', (2013, 2020), False, 'from tower import Tower\n'), ((2485, 2522), 'creep_spawner.CreepSpawner', 'CreepSpawner', (['spawn', 'num_creeps', 'role'], {}), '(spawn, num_creeps, role)\n', (2497, 2522), False, 'from creep_spawner import CreepSpawner\n'), ((... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import subprocess
import sys
import os
import argparse
from timeit import default_timer as timer
def beep():
notes = [(0.25, 440), (0.25, 480), (0.25, 440), (0.25, 480),
(0.25, 440), (0.25, 480), (0.25, 440), (0.5, 520)]
try:
import winsound
... | [
"os.path.exists",
"os.makedirs",
"argparse.ArgumentParser",
"timeit.default_timer",
"subprocess.call",
"sys.exit",
"winsound.Beep"
] | [((620, 645), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (643, 645), False, 'import argparse\n'), ((1560, 1580), 'subprocess.call', 'subprocess.call', (['cmd'], {}), '(cmd)\n', (1575, 1580), False, 'import subprocess\n'), ((1699, 1726), 'os.path.exists', 'os.path.exists', (['args.output'], ... |
from setuptools import setup
setup(
name='hedgecock_dev',
version='1.0.0',
install_requires=[
"google-api-python-client",
"google-auth-httplib2",
"google-auth-oauthlib",
"cachecontrol",
'google',
'requests',
'sanic',
'websockets',
'dat... | [
"setuptools.setup"
] | [((30, 268), 'setuptools.setup', 'setup', ([], {'name': '"""hedgecock_dev"""', 'version': '"""1.0.0"""', 'install_requires': "['google-api-python-client', 'google-auth-httplib2', 'google-auth-oauthlib',\n 'cachecontrol', 'google', 'requests', 'sanic', 'websockets',\n 'dataclasses', 'jinja2']"}), "(name='hedgecock... |
from app import webapp, mysql
from flask import render_template, request, flash, redirect, jsonify, make_response, session, url_for
from .const import ErrorMessages
import os, cv2, json
import MySQLdb.cursors
from werkzeug.security import generate_password_hash, check_password_hash
import pymysql
import boto3
import r... | [
"flask.render_template",
"json.loads",
"boto3.client",
"flask.flash",
"json.dumps",
"pymysql.connect",
"os.path.join",
"requests.get",
"app.webapp.route",
"os.chdir",
"os.getcwd",
"flask.redirect",
"flask.url_for",
"werkzeug.security.check_password_hash",
"cv2.cvtColor",
"cv2.imread",
... | [((332, 436), 'requests.get', 'requests.get', (['"""http://169.254.169.254/latest/meta-data/iam/security-credentials/assignment2S3"""'], {}), "(\n 'http://169.254.169.254/latest/meta-data/iam/security-credentials/assignment2S3'\n )\n", (344, 436), False, 'import requests\n'), ((612, 780), 'pymysql.connect', 'pymy... |
import tensorflow as tf
import tef
import tef.pywrap
import tef.utils
class BaseOptimizer(object):
def __init__(self):
pass
def compute_gradients(self, loss):
tef_trainable = tef.utils.get_collection(tef.utils.TEF_TRAINABLE_COLLECTION)
gs = []
stubs = []
for stub in te... | [
"tef.pywrap.ps_hash_push",
"tef.utils.get_collection",
"tef.pywrap.ps_sparse_push",
"tensorflow.gradients",
"tensorflow.group",
"tensorflow.gather",
"tef.pywrap.ps_push"
] | [((202, 262), 'tef.utils.get_collection', 'tef.utils.get_collection', (['tef.utils.TEF_TRAINABLE_COLLECTION'], {}), '(tef.utils.TEF_TRAINABLE_COLLECTION)\n', (226, 262), False, 'import tef\n'), ((3053, 3071), 'tensorflow.group', 'tf.group', (['push_ops'], {}), '(push_ops)\n', (3061, 3071), True, 'import tensorflow as t... |
import numpy as np
import tensorflow as tf
import torch
from groupy.gconv.tensorflow_gconv.transform_filter import transform_filter_2d_nchw, transform_filter_2d_nhwc
from groupy.gconv.make_gconv_indices import make_c4_z2_indices, make_c4_p4_indices,\
make_d4_z2_indices, make_d4_p4m_indices, flatten_indices
from gr... | [
"numpy.abs",
"groupy.gconv.pytorch_gconv.splitgconv2d.trans_filter",
"groupy.gconv.make_gconv_indices.make_c4_z2_indices",
"tensorflow.Session",
"groupy.gconv.tensorflow_gconv.transform_filter.transform_filter_2d_nhwc",
"tensorflow.constant",
"groupy.gconv.make_gconv_indices.flatten_indices",
"groupy.... | [((493, 520), 'groupy.gconv.make_gconv_indices.make_c4_z2_indices', 'make_c4_z2_indices', ([], {'ksize': '(3)'}), '(ksize=3)\n', (511, 520), False, 'from groupy.gconv.make_gconv_indices import make_c4_z2_indices, make_c4_p4_indices, make_d4_z2_indices, make_d4_p4m_indices, flatten_indices\n'), ((529, 559), 'numpy.rando... |
"""Tanslate SMS language to French."""
import sys
import enchant
# import tempfile
# import os
smsdic = {
"cc": "Coucou, ",
"cv": "Ça va ?",
"tfq": "Tu fait quoi ?",
"pq": "Pourquoi ?",
"c": "C'est",
"t": "Tu est",
"xd": "😂",
"yep": "Oui",
"k": "Ok",
"nan": "Non",
"nop": ... | [
"enchant.Dict"
] | [((1254, 1272), 'enchant.Dict', 'enchant.Dict', (['"""fr"""'], {}), "('fr')\n", (1266, 1272), False, 'import enchant\n')] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"common.responses.OKJsonResponse",
"user_center.weixin.utils.get_user_wx_info",
"home.models.UserSettings.objects.filter",
"home.utils.get_user_apps",
"home.models.UsefulLinks.objects.get_common_links"
] | [((1455, 1478), 'home.utils.get_user_apps', 'get_user_apps', (['username'], {}), '(username)\n', (1468, 1478), False, 'from home.utils import get_user_apps\n'), ((1557, 1595), 'home.models.UsefulLinks.objects.get_common_links', 'UsefulLinks.objects.get_common_links', ([], {}), '()\n', (1593, 1595), False, 'from home.mo... |
from collections import defaultdict
class Node:
def __init__(self, value):
self.parent = None
self.value = value
def get_height(node):
height = 0
while node is not None:
height += 1
node = node.parent
return height
def solution2(node1, node2):
height1, height2... | [
"collections.defaultdict"
] | [((876, 893), 'collections.defaultdict', 'defaultdict', (['bool'], {}), '(bool)\n', (887, 893), False, 'from collections import defaultdict\n')] |
# Generated by Django 3.1.2 on 2020-10-12 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('listings', '0003_auto_20201012_2208'),
]
operations = [
migrations.AddField(
model_name='joblist',
name='icon',
... | [
"django.db.models.ImageField"
] | [((334, 392), 'django.db.models.ImageField', 'models.ImageField', ([], {'blank': '(True)', 'upload_to': '"""photos/%Y/%m/%d"""'}), "(blank=True, upload_to='photos/%Y/%m/%d')\n", (351, 392), False, 'from django.db import migrations, models\n')] |
__version__ = "1.5.0"
from deriva.qt.common.async_task import async_execute, Task
from deriva.qt.common.log_widget import QPlainTextEditLogger
from deriva.qt.common.table_widget import TableWidget
from deriva.qt.common.json_editor import JSONEditor
from deriva.qt.auth_agent.ui.auth_window import AuthWindow
from deriv... | [
"os.path.dirname",
"os.path.join"
] | [((750, 924), 'os.path.join', 'os.path.join', (['executableDir', '"""lib"""', '"""PyQt5"""', '"""Qt5"""', '"""lib"""', '"""QtWebEngineCore.framework"""', '"""Helpers"""', '"""QtWebEngineProcess.app"""', '"""Contents"""', '"""MacOS"""', '"""QtWebEngineProcess"""'], {}), "(executableDir, 'lib', 'PyQt5', 'Qt5', 'lib',\n ... |
# vim: set encoding=utf-8 :
# ***********************IMPORTANT NMAP LICENSE TERMS************************
# * *
# * The Nmap Security Scanner is (C) 1996-2013 Insecure.Com LLC. Nmap is *
# * also a registered trademark of Insecure.Com LLC. Thi... | [
"gtk.ComboBox",
"gtk.ListStore",
"zenmapGUI.higwidgets.higboxes.HIGHBox",
"gtk.CellRendererText"
] | [((10243, 10274), 'gtk.ListStore', 'gtk.ListStore', (['str', 'object', 'str'], {}), '(str, object, str)\n', (10256, 10274), False, 'import gtk\n'), ((10363, 10388), 'gtk.ComboBox', 'gtk.ComboBox', (['types_store'], {}), '(types_store)\n', (10375, 10388), False, 'import gtk\n'), ((10404, 10426), 'gtk.CellRendererText', ... |
from __future__ import print_function
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
class GoogleSheet:
def __init__(self, spreadsheet_id):
self.spreadsheet_id=spreadsheet_id
... | [
"pickle.dump",
"google.auth.transport.requests.Request",
"pickle.load",
"googleapiclient.discovery.build",
"google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file"
] | [((1555, 1600), 'googleapiclient.discovery.build', 'build', (['"""sheets"""', '"""v4"""'], {'credentials': 'self.creds'}), "('sheets', 'v4', credentials=self.creds)\n", (1560, 1600), False, 'from googleapiclient.discovery import build\n'), ((914, 932), 'pickle.load', 'pickle.load', (['token'], {}), '(token)\n', (925, 9... |
from django import forms
from django.core.exceptions import ValidationError
class ContactForm(forms.Form):
full_name = forms.CharField(label= "Your name and surname", required=True, widget=forms.TextInput
(attrs={'placeholder': 'Your full name'}))
email = forms.EmailField(required=Tr... | [
"django.forms.Textarea",
"django.forms.EmailInput",
"django.forms.TextInput"
] | [((194, 250), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'placeholder': 'Your full name'}"}), "(attrs={'placeholder': 'Your full name'})\n", (209, 250), False, 'from django import forms\n'), ((332, 391), 'django.forms.EmailInput', 'forms.EmailInput', ([], {'attrs': "{'placeholder': 'Enter your email'... |
import kivy
kivy.require('1.0.6') # replace with your current kivy version !
from kivy.app import App
from kivy.uix.label import Label
import os
import shutil
import json
import codecs
class MyApp(App):
def build(self):
self.root = "/home/Games/Crusader-HDUP/CrusaderAIManager"
self.ai_shorts =... | [
"kivy.require",
"os.path.join",
"kivy.uix.label.Label",
"os.mkdir",
"json.load",
"json.dump"
] | [((12, 33), 'kivy.require', 'kivy.require', (['"""1.0.6"""'], {}), "('1.0.6')\n", (24, 33), False, 'import kivy\n'), ((1214, 1239), 'kivy.uix.label.Label', 'Label', ([], {'text': '"""Hello world"""'}), "(text='Hello world')\n", (1219, 1239), False, 'from kivy.uix.label import Label\n'), ((1391, 1425), 'os.path.join', '... |
import os, json, time
from flask import Flask, request
import ml_utils
import sqlite3 as sql
import run_backend
app = Flask(__name__)
def get_predictions():
videos = []
with sql.connect(run_backend.db_name) as conn:
c = conn.cursor()
for line in c.execute("SELECT * FROM videos"):
... | [
"flask.request.args.get",
"sqlite3.connect",
"flask.Flask",
"ml_utils.compute_predictions",
"json.dumps"
] | [((121, 136), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'from flask import Flask, request\n'), ((1254, 1297), 'flask.request.args.get', 'request.args.get', (['"""yt_video_id"""'], {'default': '""""""'}), "('yt_video_id', default='')\n", (1270, 1297), False, 'from flask import Flask,... |
import numpy as np
import nanocut.common as nc
from nanocut.output import error, printstatus
__all__ = [ "Periodicity", ]
def gcd(numbers):
"""Calculates greatest common divisor of a list of numbers."""
aa = numbers[0]
for bb in numbers[1:]:
while bb:
aa, bb = bb, aa % bb
re... | [
"nanocut.output.printstatus",
"numpy.prod",
"numpy.equal",
"numpy.not_equal",
"numpy.array",
"numpy.linalg.norm",
"numpy.sin",
"nanocut.output.error",
"numpy.arange",
"numpy.greater",
"numpy.less",
"numpy.cross",
"numpy.dot",
"numpy.abs",
"numpy.eye",
"numpy.ones",
"numpy.cos",
"nu... | [((945, 968), 'numpy.prod', 'np.prod', (['miller_nonzero'], {}), '(miller_nonzero)\n', (952, 968), True, 'import numpy as np\n'), ((1061, 1088), 'numpy.zeros', 'np.zeros', (['(2, 3)'], {'dtype': 'int'}), '((2, 3), dtype=int)\n', (1069, 1088), True, 'import numpy as np\n'), ((3785, 3812), 'numpy.zeros', 'np.zeros', (['(... |
# coding=utf-8
from __future__ import unicode_literals
from transit.transit_types import Keyword, Symbol, true, false
from transit.pyversion import string_types
class KeywordUnicorn(Keyword):
def __init__(self):
self.parent = None
def __getattr__(self, value):
assert isinstance(value, string_... | [
"transit.transit_types.Symbol",
"transit.transit_types.Keyword"
] | [((1377, 1389), 'transit.transit_types.Symbol', 'Symbol', (['"""?e"""'], {}), "('?e')\n", (1383, 1389), False, 'from transit.transit_types import Keyword, Symbol, true, false\n'), ((1394, 1405), 'transit.transit_types.Symbol', 'Symbol', (['"""_"""'], {}), "('_')\n", (1400, 1405), False, 'from transit.transit_types impo... |
#! /usr/bin/env python3
import numpy as np
from sklearn.neighbors import NearestNeighbors
from computeNeighborWeights import computeNeighborWeights
from computeWeightedMRecons import computeWeightedMRecons
from computeFeatures import computeFeatures
def computeFullERD(MeasuredValues,MeasuredIdxs,UnMeasuredIdxs,Theta,S... | [
"numpy.sqrt",
"numpy.logical_and",
"numpy.where",
"numpy.delete",
"computeNeighborWeights.computeNeighborWeights",
"computeFeatures.computeFeatures",
"numpy.max",
"numpy.zeros",
"computeWeightedMRecons.computeWeightedMRecons",
"sklearn.neighbors.NearestNeighbors",
"numpy.min"
] | [((690, 884), 'computeFeatures.computeFeatures', 'computeFeatures', (['MeasuredValues', 'MeasuredIdxs', 'UnMeasuredIdxs', 'SizeImage', 'NeighborValues', 'NeighborWeights', 'NeighborDistances', 'TrainingInfo', 'ReconValues', 'ReconImage', 'Resolution', 'ImageType'], {}), '(MeasuredValues, MeasuredIdxs, UnMeasuredIdxs, S... |
from aiida_nanotech_empa.workflows.gaussian import common
from aiida_nanotech_empa.utils import common_utils
from aiida.engine import WorkChain, calcfunction, ExitCode
from aiida.orm import Int, Str, Code, Dict
from aiida.orm import StructureData, RemoteData
from aiida.plugins import WorkflowFactory
GaussianBaseWork... | [
"aiida.engine.ExitCode",
"aiida.orm.Int",
"aiida_nanotech_empa.utils.common_utils.check_if_calc_ok",
"aiida_nanotech_empa.workflows.gaussian.common.get_gaussian_cores_and_memory",
"aiida_nanotech_empa.workflows.gaussian.common.setup_context_variables",
"aiida.plugins.WorkflowFactory",
"aiida_nanotech_em... | [((328, 360), 'aiida.plugins.WorkflowFactory', 'WorkflowFactory', (['"""gaussian.base"""'], {}), "('gaussian.base')\n", (343, 360), False, 'from aiida.plugins import WorkflowFactory\n'), ((2350, 2386), 'aiida_nanotech_empa.workflows.gaussian.common.setup_context_variables', 'common.setup_context_variables', (['self'], ... |
import argparse
import os
import json
import sys
def copyright_main():
parser = argparse.ArgumentParser(
description="automatically set the copyright for you"
)
parser.add_argument("-p", "--path",
help="choose the path you want to add the copyright")
parser.... | [
"json.loads",
"os.walk",
"argparse.ArgumentParser",
"sys.exit"
] | [((93, 171), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""automatically set the copyright for you"""'}), "(description='automatically set the copyright for you')\n", (116, 171), False, 'import argparse\n'), ((3257, 3275), 'os.walk', 'os.walk', (['args.path'], {}), '(args.path)\n', (326... |
from keras.models import Sequential
from keras.layers import Dense
from sklearn.cross_validation import StratifiedKFold
import numpy as np
# init seed
seed = 7
np.random.seed(seed)
# load data (CSV)
dataset = np.loadtxt('pima-indians-diabetes.data', delimiter=',')
# split in put and output
X = dataset[:, 0:8]
Y = da... | [
"numpy.mean",
"keras.models.Sequential",
"sklearn.cross_validation.StratifiedKFold",
"numpy.random.seed",
"numpy.std",
"keras.layers.Dense",
"numpy.loadtxt"
] | [((161, 181), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (175, 181), True, 'import numpy as np\n'), ((211, 266), 'numpy.loadtxt', 'np.loadtxt', (['"""pima-indians-diabetes.data"""'], {'delimiter': '""","""'}), "('pima-indians-diabetes.data', delimiter=',')\n", (221, 266), True, 'import numpy as ... |
import tinyapi
from unittest import TestCase
from getpass import getpass
from nose.tools import raises
import os
DEFAULT_USERNAME = "tinyapi-test-account"
USERNAME = os.environ.get("TINYAPI_TEST_USERNAME") or DEFAULT_USERNAME
PASSWORD = os.environ.get("TINYAPI_TEST_PASSWORD") or getpass()
class TestDraft(TestCase):
... | [
"tinyapi.Session",
"os.environ.get",
"nose.tools.raises",
"getpass.getpass"
] | [((167, 206), 'os.environ.get', 'os.environ.get', (['"""TINYAPI_TEST_USERNAME"""'], {}), "('TINYAPI_TEST_USERNAME')\n", (181, 206), False, 'import os\n'), ((238, 277), 'os.environ.get', 'os.environ.get', (['"""TINYAPI_TEST_PASSWORD"""'], {}), "('TINYAPI_TEST_PASSWORD')\n", (252, 277), False, 'import os\n'), ((281, 290)... |
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# demonstrates the use of vtkPropAssembly
# create four parts: a top level assembly and three primitives
#
sphere = vtk.vtkSphereSource()
sphereMapper = vtk.vtkPolyDataMappe... | [
"vtk.util.misc.vtkGetDataRoot",
"vtk.vtkCylinderSource",
"vtk.vtkPropAssembly",
"vtk.vtkSphereSource",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkRenderWindow",
"vtk.vtkPolyDataMapper",
"vtk.vtkActor",
"vtk.vtkRenderer",
"vtk.vtkConeSource",
"vtk.vtkCubeSource",
"vtk.vtkAssembly"
] | [((123, 139), 'vtk.util.misc.vtkGetDataRoot', 'vtkGetDataRoot', ([], {}), '()\n', (137, 139), False, 'from vtk.util.misc import vtkGetDataRoot\n'), ((262, 283), 'vtk.vtkSphereSource', 'vtk.vtkSphereSource', ([], {}), '()\n', (281, 283), False, 'import vtk\n'), ((300, 323), 'vtk.vtkPolyDataMapper', 'vtk.vtkPolyDataMappe... |
import pandas as pd
import dash_bootstrap_components as dbc
import json
from dash import Dash, html, Input, Output, dash_table as dt
from dash.exceptions import PreventUpdate
from dash_extensions import EventListener
df = pd.read_csv("https://git.io/Juf1t")
df["id"] = df.index
app = Dash(external_stylesheets=[dbc.th... | [
"pandas.read_csv",
"dash.html.Div",
"json.dumps",
"dash_extensions.EventListener",
"dash.Input",
"dash.Output",
"dash_bootstrap_components.Alert",
"dash_bootstrap_components.Label",
"dash.Dash"
] | [((224, 259), 'pandas.read_csv', 'pd.read_csv', (['"""https://git.io/Juf1t"""'], {}), "('https://git.io/Juf1t')\n", (235, 259), True, 'import pandas as pd\n'), ((287, 336), 'dash.Dash', 'Dash', ([], {'external_stylesheets': '[dbc.themes.BOOTSTRAP]'}), '(external_stylesheets=[dbc.themes.BOOTSTRAP])\n', (291, 336), False... |
# Generated by Django 1.10.7 on 2017-07-11 12:26
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('phonelog', '0012_server_date_not_null'),
]
operations = [
migrations.DeleteModel(
name='OldDeviceReportEntry',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((231, 282), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""OldDeviceReportEntry"""'}), "(name='OldDeviceReportEntry')\n", (253, 282), False, 'from django.db import migrations\n')] |
from __future__ import unicode_literals
import io
import json
import os
import re
from collections import OrderedDict
VALID_COUNTRY_CODE = re.compile(r"^\w{2,3}$")
VALIDATION_DATA_DIR = os.path.join(os.path.dirname(__file__), "data")
VALIDATION_DATA_PATH = os.path.join(VALIDATION_DATA_DIR, "%s.json")
FIELD_MAPPING =... | [
"re.split",
"collections.OrderedDict",
"os.path.exists",
"re.compile",
"os.path.join",
"io.open",
"os.path.dirname",
"re.finditer",
"json.load"
] | [((141, 165), 're.compile', 're.compile', (['"""^\\\\w{2,3}$"""'], {}), "('^\\\\w{2,3}$')\n", (151, 165), False, 'import re\n'), ((259, 303), 'os.path.join', 'os.path.join', (['VALIDATION_DATA_DIR', '"""%s.json"""'], {}), "(VALIDATION_DATA_DIR, '%s.json')\n", (271, 303), False, 'import os\n'), ((201, 226), 'os.path.dir... |
import numpy as np
import tensorflow as tf
from PIL import Image
import os
from crawl_HHU.cfg import MAX_CAPTCHA, CHAR_SET_LEN, model_path
from crawl_HHU.cnn_sys import crack_captcha_cnn, X, keep_prob
from crawl_HHU.utils import vec2text, get_clear_bin_image
def hack_function(sess, predict, captcha_image):
"""
... | [
"tensorflow.Session",
"tensorflow.train.Saver",
"crawl_HHU.utils.vec2text",
"numpy.array",
"numpy.zeros",
"crawl_HHU.cnn_sys.crack_captcha_cnn",
"tensorflow.reshape",
"tensorflow.train.latest_checkpoint",
"crawl_HHU.utils.get_clear_bin_image"
] | [((566, 602), 'numpy.zeros', 'np.zeros', (['(MAX_CAPTCHA * CHAR_SET_LEN)'], {}), '(MAX_CAPTCHA * CHAR_SET_LEN)\n', (574, 602), True, 'import numpy as np\n'), ((699, 715), 'crawl_HHU.utils.vec2text', 'vec2text', (['vector'], {}), '(vector)\n', (707, 715), False, 'from crawl_HHU.utils import vec2text, get_clear_bin_image... |
import traceback
from io import StringIO
from typing import Union
from discord import Color, File
from discord.ext.commands import Context
from discord_slash.context import InteractionContext
from discord_slash.error import SlashCommandError
from .classes import BotPlus
from .database.translation import Translation
... | [
"io.StringIO",
"traceback.extract_tb",
"discord.File",
"discord.Color.red"
] | [((1558, 1568), 'io.StringIO', 'StringIO', ([], {}), '()\n', (1566, 1568), False, 'from io import StringIO\n'), ((1643, 1678), 'discord.File', 'File', (['buf'], {'filename': '"""traceback.txt"""'}), "(buf, filename='traceback.txt')\n", (1647, 1678), False, 'from discord import Color, File\n'), ((1496, 1541), 'traceback... |