code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import unittest
from spyd.authentication.services.vanilla.auth_success import VanillaAuthSuccess
class TestVanillaAuthSuccess(unittest.TestCase):
def setUp(self):
self.instance = VanillaAuthSuccess('localhost', 'chasm')
def test_get_group_names(self):
group_names = self.instance.group_pro... | [
"spyd.authentication.services.vanilla.auth_success.VanillaAuthSuccess"
] | [((193, 233), 'spyd.authentication.services.vanilla.auth_success.VanillaAuthSuccess', 'VanillaAuthSuccess', (['"""localhost"""', '"""chasm"""'], {}), "('localhost', 'chasm')\n", (211, 233), False, 'from spyd.authentication.services.vanilla.auth_success import VanillaAuthSuccess\n')] |
import tekore as tk
app_token = tk.request_client_token("b516728497b34264afab4e995b4e2569", "<KEY>")
spotify = tk.Spotify(app_token)
def menu():
print("search for:\n1. Artist\n2. Album\n3. Track ")
num = input("type your input there : ")
if num == "1":
artist_name = input("what's the artist name... | [
"tekore.Spotify",
"tekore.request_client_token"
] | [((33, 101), 'tekore.request_client_token', 'tk.request_client_token', (['"""b516728497b34264afab4e995b4e2569"""', '"""<KEY>"""'], {}), "('b516728497b34264afab4e995b4e2569', '<KEY>')\n", (56, 101), True, 'import tekore as tk\n'), ((112, 133), 'tekore.Spotify', 'tk.Spotify', (['app_token'], {}), '(app_token)\n', (122, 1... |
"""
Generates a path on the given occupancy grid (map of
the environment)
"""
import networkx as nx
from grid_loader import Grid
import numpy as np
def euclidean(node1, node2):
x1, y1 = node1
x2, y2 = node2
return ((x1-x2)**2+(y1-y2)**2)**0.5
class AStar:
# Constructor
def __init__(self)... | [
"numpy.array",
"networkx.grid_2d_graph"
] | [((1256, 1296), 'networkx.grid_2d_graph', 'nx.grid_2d_graph', (['grid_obj.w', 'grid_obj.h'], {}), '(grid_obj.w, grid_obj.h)\n', (1272, 1296), True, 'import networkx as nx\n'), ((2139, 2159), 'numpy.array', 'np.array', (['astar_path'], {}), '(astar_path)\n', (2147, 2159), True, 'import numpy as np\n'), ((1861, 1876), 'n... |
'''
Created on Jan 25, 2017
@author: metelko
'''
# riaps:keep_import:begin
from riaps.run.comp import Component
import logging
import time
import os
# riaps:keep_import:end
class TempSensor(Component):
# riaps:keep_constr:begin
def __init__(self):
super(TempSensor, self).__init__()
self.pid = os.ge... | [
"os.getpid",
"time.time"
] | [((315, 326), 'os.getpid', 'os.getpid', ([], {}), '()\n', (324, 326), False, 'import os\n'), ((1061, 1072), 'time.time', 'time.time', ([], {}), '()\n', (1070, 1072), False, 'import time\n'), ((386, 397), 'time.time', 'time.time', ([], {}), '()\n', (395, 397), False, 'import time\n'), ((669, 680), 'time.time', 'time.tim... |
# -*- coding: utf-8 -*-
from discord import Embed, Member
from discord.ext.commands import command, Cog, Context
import time
from dataclasses import dataclass
@dataclass
class Job:
title: str
salary: float
responsibilites: str
requirements: str
JOBS = [
Job(
"Backend Specialist",
... | [
"discord.ext.commands.command",
"discord.Embed",
"time.time"
] | [((2336, 2345), 'discord.ext.commands.command', 'command', ([], {}), '()\n', (2343, 2345), False, 'from discord.ext.commands import command, Cog, Context\n'), ((2576, 2585), 'discord.ext.commands.command', 'command', ([], {}), '()\n', (2583, 2585), False, 'from discord.ext.commands import command, Cog, Context\n'), ((3... |
import cv2
from model import PersonSegmentation
if __name__ == '__main__':
# change 'cpu' to 'cuda' if you have pytorch cuda and your discrete GPU has enough VRAM
# output size will autoscale to fit input image aspect ratio
# if you want full image resolution set 'is_resize=False'
ps = PersonSegmentati... | [
"cv2.waitKey",
"cv2.destroyAllWindows",
"model.PersonSegmentation",
"cv2.vconcat"
] | [((304, 362), 'model.PersonSegmentation', 'PersonSegmentation', (['"""cpu"""'], {'is_resize': '(True)', 'resize_size': '(480)'}), "('cpu', is_resize=True, resize_size=480)\n", (322, 362), False, 'from model import PersonSegmentation\n'), ((802, 816), 'cv2.waitKey', 'cv2.waitKey', (['(0)'], {}), '(0)\n', (813, 816), Fal... |
"""
AnalysisConfig.py:
Centralized configuration for the nu_e CCQE analysis:
signal definitions (nu vs. anti-nu),
file locations,
etc.
Original author: <NAME> (<EMAIL>)
January 2014
"""
import ROOT
ROOT.PyConfig.IgnoreCommandLineOptions = True
#ROOT.gErrorIgnoreLevel = ROOT.k... | [
"pprint.pformat",
"argparse.ArgumentParser",
"os.walk",
"ROOT.gROOT.SetBatch",
"os.path.join"
] | [((328, 349), 'ROOT.gROOT.SetBatch', 'ROOT.gROOT.SetBatch', ([], {}), '()\n', (347, 349), False, 'import ROOT\n'), ((7591, 7670), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (7614... |
import numpy as np
import collections
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
from sklearn.manifold import MDS
from time import time
from warnings import warn
class ForestSim():
def __init__(self, forest):
# TODO : adapt if non sklearn forest used
self.forest = forest
def fit... | [
"pandas.DataFrame",
"numpy.random.seed",
"matplotlib.pyplot.show",
"seaborn.scatterplot",
"numpy.float32",
"numpy.zeros",
"time.time",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.random.choice",
"warnings.warn",
"sklearn.manifold.MDS",
"numpy.random.shuffle",
"numpy.sqrt"
] | [((405, 418), 'numpy.float32', 'np.float32', (['X'], {}), '(X)\n', (415, 418), True, 'import numpy as np\n'), ((515, 541), 'numpy.zeros', 'np.zeros', (['(self.n, self.n)'], {}), '((self.n, self.n))\n', (523, 541), True, 'import numpy as np\n'), ((796, 802), 'time.time', 'time', ([], {}), '()\n', (800, 802), False, 'fro... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""CNN_using_persistence_images_on_patch.py
The aim of this script is to perform the training of a CNN using persistence
images as a input. This script is inspired from this script:
BorgwardtLab/ADNI_MRI_Analysis/blob/mixed_CNN/mixed_CNN/run_Sarah.py
To get real time info... | [
"tensorflow.random.set_seed",
"numpy.load",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dense",
"os.walk",
"tensorflow.keras.callbacks.ModelCheckpoint",
"tensorflow.keras.layers.concatenate",
"numpy.mean",
"tensorflow.keras.metrics.BinaryAccuracy",
"shutil.rmtree",
"tensorfl... | [((934, 956), 'dotenv.dotenv_values', 'dotenv.dotenv_values', ([], {}), '()\n', (954, 956), False, 'import dotenv\n'), ((957, 979), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['(42)'], {}), '(42)\n', (975, 979), True, 'import tensorflow as tf\n'), ((889, 914), 'tensorflow.test.gpu_device_name', 'tf.test.gpu_d... |
"""
Create docstring tests for the following functions
"""
import doctest
# Example
def get_area_rect(length, width):
"""Returns area of rectangle
>>> get_area_rect(5 , 5)
25
>>> get_area_rect(5 , 0)
Traceback (most recent call last):
...
ValueError
>>> g... | [
"doctest.testmod"
] | [((1230, 1247), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (1245, 1247), False, 'import doctest\n')] |
"""A simple, 2D peridynamics simulation example."""
import argparse
import cProfile
from io import StringIO
import numpy as np
import pathlib
from peridynamics import Model
from peridynamics.model import initial_crack_helper
from peridynamics.integrators import Euler
from pstats import SortKey, Stats
mesh_file = pathl... | [
"io.StringIO",
"argparse.ArgumentParser",
"peridynamics.Model",
"pstats.Stats",
"cProfile.Profile",
"pathlib.Path",
"numpy.arange",
"peridynamics.integrators.Euler"
] | [((1611, 1636), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1634, 1636), False, 'import argparse\n'), ((1836, 1938), 'peridynamics.Model', 'Model', (['mesh_file'], {'horizon': '(0.1)', 'critical_strain': '(0.005)', 'elastic_modulus': '(0.05)', 'initial_crack': 'is_crack'}), '(mesh_file, hor... |
##############################################################################
#
# Copyright (c) 2006 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"zope.component.queryMultiAdapter",
"zope.interface.implements",
"xml.etree.ElementTree.Element",
"zope.component.adapts",
"zope.component.getMultiAdapter"
] | [((1301, 1357), 'zope.interface.implements', 'interface.implements', (['z3c.dav.interfaces.IDAVErrorWidget'], {}), '(z3c.dav.interfaces.IDAVErrorWidget)\n', (1321, 1357), False, 'from zope import interface\n'), ((1362, 1434), 'zope.component.adapts', 'component.adapts', (['interface.Interface', 'z3c.dav.interfaces.IWeb... |
import xml.etree.ElementTree as ET
from os import sys
#Return *.c for 1, *.o for 2
#tipo = sys.argv[1]
#names_files = []
names_files = []
names_functions = []
hosts_ips = []
names = ""
root = ET.parse('startup.xml').getroot()
arquivo = open("Makefile","w")
functions_file = open("functions_names","w")
hosts = open(... | [
"xml.etree.ElementTree.parse"
] | [((194, 217), 'xml.etree.ElementTree.parse', 'ET.parse', (['"""startup.xml"""'], {}), "('startup.xml')\n", (202, 217), True, 'import xml.etree.ElementTree as ET\n')] |
import pytest
from pysyncgateway.exceptions import DoesNotExist
def test(recipe_document, database):
reload_document = database.get_document('butter_chicken')
result = reload_document.retrieve()
assert result is True
for key in list(reload_document.data.keys()):
assert isinstance(key, str)
... | [
"pytest.raises"
] | [((1200, 1227), 'pytest.raises', 'pytest.raises', (['DoesNotExist'], {}), '(DoesNotExist)\n', (1213, 1227), False, 'import pytest\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import py_trees
import random
class Foo(py_trees.behaviour.Behaviour):
def __init__(self, name):
"""
Minimal one-time initialisation. A good rule of thumb is
to only include the initialisation relevant for being able
to insert this be... | [
"random.choice"
] | [((2678, 2706), 'random.choice', 'random.choice', (['[True, False]'], {}), '([True, False])\n', (2691, 2706), False, 'import random\n'), ((2726, 2754), 'random.choice', 'random.choice', (['[True, False]'], {}), '([True, False])\n', (2739, 2754), False, 'import random\n')] |
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/tslasso.main.ipynb (unless otherwise specified).
__all__ = ['run_exp']
# Cell
from ..atomgeom.features import get_features,get_D_feats_feats
from ..atomgeom.utils import get_atoms_4
from ..simulations.rigidethanol import get_rigid_ethanol_data
from ..utils.utils import... | [
"numpy.abs",
"pathos.multiprocessing.cpu_count",
"sklearn.decomposition.TruncatedSVD",
"numpy.asarray",
"numpy.einsum",
"numpy.identity",
"numpy.hstack",
"megaman.embedding.SpectralEmbedding",
"numpy.mean",
"dill.dump",
"pathos.multiprocessing.ProcessingPool",
"numpy.unique"
] | [((1456, 1478), 'numpy.asarray', 'np.asarray', (['hparams.ii'], {}), '(hparams.ii)\n', (1466, 1478), True, 'import numpy as np\n'), ((1488, 1510), 'numpy.asarray', 'np.asarray', (['hparams.jj'], {}), '(hparams.jj)\n', (1498, 1510), True, 'import numpy as np\n'), ((2422, 2433), 'pathos.multiprocessing.ProcessingPool', '... |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import attr
from attr import ib as Field
from addonpayments.validators import RequestValidator
from addonpayments.utils import GenerationUtils
from addonpayments.mixins import HashMixin
from addonpayments.api.mixins import XmlMixin
... | [
"attr.validate",
"attr.ib",
"addonpayments.utils.GenerationUtils"
] | [((1235, 1280), 'attr.ib', 'Field', ([], {'validator': 'RequestValidator.merchant_id'}), '(validator=RequestValidator.merchant_id)\n', (1240, 1280), True, 'from attr import ib as Field\n'), ((1292, 1311), 'attr.ib', 'Field', ([], {'default': 'None'}), '(default=None)\n', (1297, 1311), True, 'from attr import ib as Fiel... |
__author__ = 'hofmann'
import os
import glob
import time
import shutil
import tempfile
from scripts.Validator.validator import Validator
class MGCluster(Validator):
"""
Alignment and clustering of marker genes with references
"""
_label = "MGCluster"
_cluster_method_choices = ['average', 'furthest', 'nearest... | [
"os.path.basename",
"os.getcwd",
"shutil.copy2",
"os.path.dirname",
"os.path.exists",
"os.system",
"time.time",
"tempfile.mkdtemp",
"os.path.splitext",
"glob.glob",
"shutil.rmtree",
"os.symlink",
"os.path.join",
"os.chdir"
] | [((3389, 3425), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {'dir': 'temp_directory'}), '(dir=temp_directory)\n', (3405, 3425), False, 'import tempfile\n'), ((5297, 5308), 'time.time', 'time.time', ([], {}), '()\n', (5306, 5308), False, 'import time\n'), ((5321, 5332), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5330... |
from datetime import timedelta
from celery import Celery
from ..conf import setting
celery = Celery(
'noweibo',
broker=setting.CELERY_BROKER,
)
celery.conf.update(
CELERY_TIMEZONE='Asia/Shanghai',
CELERY_IMPORTS=('noweibo.tasks.periodic', ),
CELERY_RESULT_BACKEND=setting.CELERY_BACKEND,
CEL... | [
"celery.Celery",
"datetime.timedelta"
] | [((97, 144), 'celery.Celery', 'Celery', (['"""noweibo"""'], {'broker': 'setting.CELERY_BROKER'}), "('noweibo', broker=setting.CELERY_BROKER)\n", (103, 144), False, 'from celery import Celery\n'), ((599, 643), 'datetime.timedelta', 'timedelta', ([], {'minutes': 'setting.SCHEDULE_PERIODIC'}), '(minutes=setting.SCHEDULE_P... |
"""Next-gen alignments with BWA (http://bio-bwa.sourceforge.net/)
"""
import contextlib
import gzip
import os
from Bio.SeqIO.QualityIO import FastqGeneralIterator
from bcbio.pipeline import config_utils
from bcbio import utils
from bcbio.distributed.transaction import file_transaction
from bcbio.ngsalign import novoa... | [
"bcbio.utils.file_exists",
"bcbio.ngsalign.novoalign.get_rg_info",
"gzip.open",
"bcbio.pipeline.config_utils.get_resources",
"bcbio.provenance.do.file_nonempty",
"os.path.basename",
"Bio.SeqIO.QualityIO.FastqGeneralIterator",
"bcbio.utils.curdir_tmpdir",
"bcbio.pipeline.config_utils.get_program",
... | [((875, 919), 'bcbio.pipeline.config_utils.get_program', 'config_utils.get_program', (['"""samtools"""', 'config'], {}), "('samtools', config)\n", (899, 919), False, 'from bcbio.pipeline import config_utils\n'), ((935, 979), 'bcbio.pipeline.config_utils.get_program', 'config_utils.get_program', (['"""bedtools"""', 'con... |
from flask_login import current_user
from portality.core import app
from portality import models
# query sanitisers
##################
def public_query_validator(q):
# no deep paging
if q.from_result() > 10000:
return False
if q.size() > 200:
return False
# if the query has facets, t... | [
"portality.core.app.config.get",
"portality.models.EditorGroup.groups_by_editor"
] | [((1118, 1170), 'portality.models.EditorGroup.groups_by_editor', 'models.EditorGroup.groups_by_editor', (['current_user.id'], {}), '(current_user.id)\n', (1153, 1170), False, 'from portality import models\n'), ((885, 929), 'portality.core.app.config.get', 'app.config.get', (['"""UPDATE_REQUEST_SHOW_OLDEST"""'], {}), "(... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from pyGDM2 import (structures, materials, core,
linear, fields, propagators,
tools)
def get_spectrum(geometry, step, wavelengths):
'''Obtains a uv-vis spectra for a specified geometry'''
material ... | [
"numpy.random.randn",
"pyGDM2.materials.gold",
"pyGDM2.tools.calculate_spectrum",
"pyGDM2.structures.center_struct",
"pyGDM2.structures.struct",
"pyGDM2.core.simulation",
"numpy.max",
"pyGDM2.structures.sphere",
"numpy.array",
"pyGDM2.propagators.DyadsQuasistatic123",
"pyGDM2.fields.efield",
"... | [((322, 338), 'pyGDM2.materials.gold', 'materials.gold', ([], {}), '()\n', (336, 338), False, 'from pyGDM2 import structures, materials, core, linear, fields, propagators, tools\n'), ((352, 410), 'pyGDM2.structures.struct', 'structures.struct', (['step', 'geometry', 'material'], {'verbose': '(False)'}), '(step, geometr... |
import logging
log = logging.getLogger(__name__)
class Codec(object):
"""Codec."""
def __init__(self):
pass
def compress(self, stream):
"""Compress.
:param io.BytesIO stream: Uncompressed input stream.
:rtype: io.BytesIO
"""
return stream
def decompr... | [
"logging.getLogger"
] | [((22, 49), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (39, 49), False, 'import logging\n')] |
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 3 16:14:46 2020
@author: Dripta
"""
from covidindia import *
import os
import pickle
file_path = os.path.dirname(os.path.abspath(__file__))
data_path=os.path.join(file_path,'static','server_data')
with open(os.path.join(file_path,'updater.txt'),'a') as f:
f.writ... | [
"os.path.abspath",
"os.path.join",
"pickle.dump"
] | [((202, 250), 'os.path.join', 'os.path.join', (['file_path', '"""static"""', '"""server_data"""'], {}), "(file_path, 'static', 'server_data')\n", (214, 250), False, 'import os\n'), ((164, 189), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (179, 189), False, 'import os\n'), ((261, 299), 'os.... |
from typing import List
from aiohttp import web
from openapi.db.path import ApiPath, SqlApiPath
from openapi.exc import JsonHttpException
from openapi.spec import op
from .models import (
MultiKey,
MultiKeyUnique,
SourcePrice,
Task,
TaskAdd,
TaskOrderableQuery,
TaskPathSchema,
TaskPat... | [
"aiohttp.web.RouteTableDef",
"openapi.exc.JsonHttpException",
"aiohttp.web.Response",
"openapi.spec.op"
] | [((384, 403), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (401, 403), False, 'from aiohttp import web\n'), ((426, 445), 'aiohttp.web.RouteTableDef', 'web.RouteTableDef', ([], {}), '()\n', (443, 445), False, 'from aiohttp import web\n'), ((482, 501), 'aiohttp.web.RouteTableDef', 'web.RouteTableDe... |
import os
count = 0
with open('listHis', 'w') as f:
for root, dirs, files in os.walk('.'):
tzt = [file for file in files if 'His.csv.gz' in file]
for tztfile in tzt:
p = os.path.join(root, tztfile)
f.write(p) ; f.write('\n')
count += 1
if count % 1000 ... | [
"os.walk",
"os.path.join"
] | [((81, 93), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (88, 93), False, 'import os\n'), ((202, 229), 'os.path.join', 'os.path.join', (['root', 'tztfile'], {}), '(root, tztfile)\n', (214, 229), False, 'import os\n')] |
from django.contrib import admin
from dfirtrack_artifacts.models import (
Artifact,
Artifactpriority,
Artifactstatus,
Artifacttype,
)
# Register your models here.
admin.site.register(Artifact)
admin.site.register(Artifactpriority)
admin.site.register(Artifactstatus)
admin.site.register(Artifacttype)
| [
"django.contrib.admin.site.register"
] | [((181, 210), 'django.contrib.admin.site.register', 'admin.site.register', (['Artifact'], {}), '(Artifact)\n', (200, 210), False, 'from django.contrib import admin\n'), ((211, 248), 'django.contrib.admin.site.register', 'admin.site.register', (['Artifactpriority'], {}), '(Artifactpriority)\n', (230, 248), False, 'from ... |
import urllib.request
url = 'http://www.ifce.edu.br'
# Obter o conteúdo da página
pagina = urllib.request.urlopen(url)
texto1 = pagina.read().decode('utf-8')
# Outra forma de fazer a mesma coisa ..
import requests
page = requests.get(url)
texto2 = page.content.decode('utf-8')
# Verificamos que todas as linhas são i... | [
"requests.get"
] | [((224, 241), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (236, 241), False, 'import requests\n')] |
from dataclasses import dataclass, field
__NAMESPACE__ = "http://www.opengis.net/ows"
@dataclass
class Title1:
"""
Title of this resource, normally used for display to a human.
"""
class Meta:
name = "Title"
namespace = "http://www.opengis.net/ows"
value: str = field(
de... | [
"dataclasses.field"
] | [((303, 349), 'dataclasses.field', 'field', ([], {'default': '""""""', 'metadata': "{'required': True}"}), "(default='', metadata={'required': True})\n", (308, 349), False, 'from dataclasses import dataclass, field\n')] |
# -*- coding: utf-8 -*-
"""
Inputs
#################
*Module* ``project.user.inputs``
This module defines routes to manage input new inputs of projects from users.
"""
import re, boto3, string
from flask import render_template, redirect, url_for, Response, current_app
from flask_login import login_required, current... | [
"flask.url_for",
"re.sub",
"flask.render_template",
"boto3.client"
] | [((8916, 9011), 'flask.render_template', 'render_template', (['"""user/upload-project.html"""'], {'form': 'project_form', 'name': 'current_user.username'}), "('user/upload-project.html', form=project_form, name=\n current_user.username)\n", (8931, 9011), False, 'from flask import render_template, redirect, url_for, ... |
#!/usr/bin/env python3
import subprocess
from ruamel.yaml import YAML
import glob
import re
import argparse
class Semver:
def __init__(self, major: int, minor: int, patch: int):
self.major = major
self.minor = minor
self.patch = patch
def incr_major(self):
self.major = self.maj... | [
"subprocess.run",
"re.fullmatch",
"argparse.ArgumentParser",
"re.match",
"ruamel.yaml.YAML",
"glob.glob"
] | [((1050, 1056), 'ruamel.yaml.YAML', 'YAML', ([], {}), '()\n', (1054, 1056), False, 'from ruamel.yaml import YAML\n'), ((1315, 1353), 'glob.glob', 'glob.glob', (['search_path'], {'recursive': '(True)'}), '(search_path, recursive=True)\n', (1324, 1353), False, 'import glob\n'), ((1773, 1864), 'argparse.ArgumentParser', '... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests
import logging
import time
import re
logger = logging.getLogger('data')
USER_AGENT = "<NAME> (for academic research) <<EMAIL>>"
default_requests_session = requests.Session()
default_requests_session.headers['User... | [
"requests.Session",
"re.search",
"logging.getLogger",
"time.sleep"
] | [((152, 177), 'logging.getLogger', 'logging.getLogger', (['"""data"""'], {}), "('data')\n", (169, 177), False, 'import logging\n'), ((263, 281), 'requests.Session', 'requests.Session', ([], {}), '()\n', (279, 281), False, 'import requests\n'), ((2537, 2579), 're.search', 're.search', (['"""<([^>]*)>; rel="next\\""""', ... |
import numpy as np
with open("data.txt") as f:
draws = np.array([int(d) for d in f.readline().split(",")])
boards = np.array([[[int(n) for n in r.split()] for r in b.split("\n")] for b in f.read()[1:].split("\n\n")])
def bingo(data: np.ndarray, fill: int):
"""
Returns horizontal (rows) and vertical ... | [
"numpy.where",
"numpy.transpose"
] | [((396, 414), 'numpy.transpose', 'np.transpose', (['data'], {}), '(data)\n', (408, 414), True, 'import numpy as np\n'), ((924, 962), 'numpy.where', 'np.where', (['(b_data == draw)', 'fill', 'b_data'], {}), '(b_data == draw, fill, b_data)\n', (932, 962), True, 'import numpy as np\n'), ((1478, 1516), 'numpy.where', 'np.w... |
from module import main
main()
| [
"module.main"
] | [((24, 30), 'module.main', 'main', ([], {}), '()\n', (28, 30), False, 'from module import main\n')] |
##############################################################
# #
# Automatic design of an #
# Asymmetrical Inverted Schmitt-Trigger with Single Supply #
# for E24 resistors scale #
# ... | [
"math.pow",
"math.fabs"
] | [((6085, 6145), 'math.fabs', 'math.fabs', (['(V_low_threshold_target - V_low_threshold_obtained)'], {}), '(V_low_threshold_target - V_low_threshold_obtained)\n', (6094, 6145), False, 'import math\n'), ((6161, 6223), 'math.fabs', 'math.fabs', (['(V_high_threshold_target - V_high_threshold_obtained)'], {}), '(V_high_thre... |
import json
from typing import Any, Dict, List
from contrib.descriptions import VulnDescriptionProvider
from contrib.internal_types import ScanResult
from contrib.report_builders import ReportBuilder
class JsonReportBuilder(ReportBuilder):
def __init__(self, description_provider: VulnDescriptionProvider):
... | [
"json.dumps"
] | [((654, 678), 'json.dumps', 'json.dumps', (['self._buffer'], {}), '(self._buffer)\n', (664, 678), False, 'import json\n')] |
import pytest
from src.users.role import Role
from .presets.role import role_metrics
@pytest.mark.parametrize(
("name, can_edit_settings, can_create_users," "can_edit_roles, can_manage_roles"),
role_metrics,
)
def test_create_role_object(
name,
can_edit_settings,
can_create_users,
can_edit_ro... | [
"pytest.mark.parametrize",
"src.users.role.Role"
] | [((89, 214), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""name, can_edit_settings, can_create_users,can_edit_roles, can_manage_roles"""', 'role_metrics'], {}), "(\n 'name, can_edit_settings, can_create_users,can_edit_roles, can_manage_roles'\n , role_metrics)\n", (112, 214), False, 'import pytest\n... |
# -*- coding: utf-8 -*-
import time, os, io, picamera, threading
from flask import Flask, request, session, url_for, redirect, render_template, g, Response, send_file
# configuration
DATABASE = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'minitwit.db')
DEBUG = False
SECRET_KEY = 'This is a very secrey k... | [
"io.BytesIO",
"os.path.realpath",
"flask.Flask",
"time.sleep",
"threading.Lock",
"time.time",
"flask.render_template",
"picamera.PiCamera"
] | [((1335, 1350), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (1340, 1350), False, 'from flask import Flask, request, session, url_for, redirect, render_template, g, Response, send_file\n'), ((1482, 1511), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (1497, 1... |
import pickle
from pathlib import Path
from datetime import datetime as dt
def storage_timestamp(t=dt.now(), storage_dir=Path.home() / ".pyx_store", ext="p"):
"""
Return a timestamp now suitable to create a file path as:
yy/mm/dd/hh-mm-ss
By default under `~/.pyx_store/` (`storage_dir`) with ... | [
"pathlib.Path",
"datetime.datetime.now",
"pathlib.Path.home",
"pickle.dump"
] | [((100, 108), 'datetime.datetime.now', 'dt.now', ([], {}), '()\n', (106, 108), True, 'from datetime import datetime as dt\n'), ((122, 133), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (131, 133), False, 'from pathlib import Path\n'), ((832, 847), 'pathlib.Path', 'Path', (['datestamp'], {}), '(datestamp)\n', (83... |
# Copyright (c) 2013--2014 King's College London
# Created by the Software Development Team <http://soft-dev.org/>
#
# 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, inclu... | [
"sys.path.append",
"PyQt5.QtGui.QColor",
"mipy.kernel.IPythonKernelProcess",
"os.path.isfile",
"PyQt5.QtGui.QImage",
"PyQt5.QtCore.QPoint",
"PyQt5.QtWidgets.QApplication.instance",
"PyQt5.QtCore.QPointF"
] | [((1258, 1284), 'sys.path.append', 'sys.path.append', (['"""../mipy"""'], {}), "('../mipy')\n", (1273, 1284), False, 'import sys\n'), ((4638, 4662), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (4652, 4662), False, 'import math, os\n'), ((5162, 5191), 'mipy.kernel.IPythonKernelProcess', 'kern... |
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.mixins import ListModelMixin, RetrieveModelMixin, CreateModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ModelViewS... | [
"teleband.submissions.models.Submission.objects.all",
"teleband.submissions.models.SubmissionAttachment.objects.all",
"teleband.submissions.models.Submission.objects.filter",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"teleband.submissions.models.Submission.objects.get",
"te... | [((797, 821), 'teleband.submissions.models.Submission.objects.all', 'Submission.objects.all', ([], {}), '()\n', (819, 821), False, 'from teleband.submissions.models import Grade, Submission, SubmissionAttachment\n'), ((1294, 1328), 'teleband.submissions.models.SubmissionAttachment.objects.all', 'SubmissionAttachment.ob... |
import json
import base64
import requests
from flask import Flask, abort, jsonify, request
from app.config import Config
import os
import schedule
import threading
import time
from pathlib import Path
app = Flask(__name__)
# set environment variable
app.config["ENV"] = Config.DEPLOY_ENV
times = []
image_counter ... | [
"schedule.run_pending",
"threading.Thread",
"flask.Flask",
"json.dumps",
"time.sleep",
"requests.get",
"schedule.every",
"pathlib.Path.cwd"
] | [((213, 228), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (218, 228), False, 'from flask import Flask, abort, jsonify, request\n'), ((1351, 1403), 'threading.Thread', 'threading.Thread', ([], {'target': 'schedule_check', 'daemon': '(True)'}), '(target=schedule_check, daemon=True)\n', (1367, 1403), False... |
from django.test import TestCase, Client
from plan.models import Announcement
class AnnouncementTestCase(TestCase):
def setUp(self):
self.client = Client()
Announcement.objects.create(title='test1', content='test content1')
Announcement.objects.create(title='test2', content='test content2... | [
"plan.models.Announcement.objects.create",
"plan.models.Announcement.objects.all",
"django.test.Client"
] | [((162, 170), 'django.test.Client', 'Client', ([], {}), '()\n', (168, 170), False, 'from django.test import TestCase, Client\n'), ((179, 246), 'plan.models.Announcement.objects.create', 'Announcement.objects.create', ([], {'title': '"""test1"""', 'content': '"""test content1"""'}), "(title='test1', content='test conten... |
#!/usr/bin/env python
#
# Copyright (c) 2021 Intel Corporation
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
#
from ros_compatibility.core import get_ros_version
ROS_VERSION = get_ros_version()
if ROS_VERSION == 1:
import rospy
class... | [
"ros_compatibility.core.get_ros_version"
] | [((252, 269), 'ros_compatibility.core.get_ros_version', 'get_ros_version', ([], {}), '()\n', (267, 269), False, 'from ros_compatibility.core import get_ros_version\n')] |
import igraph as ig
import numpy as np
from scipy.special import betaln
g = ig.Graph.Read_GML('karate.txt')
X = np.array(g.get_adjacency().data)
def irm(X, T, a, b, A, random_seed = 42):
N = len(X)
z = np.ones([N,1])
Z = []
np.random.seed(random_seed)
for t in range(T): # for T iterations
... | [
"numpy.sum",
"numpy.random.seed",
"numpy.concatenate",
"igraph.Graph.Read_GML",
"numpy.ix_",
"numpy.zeros",
"numpy.ones",
"scipy.special.betaln",
"numpy.append",
"numpy.cumsum",
"numpy.tile",
"numpy.random.rand",
"numpy.delete",
"numpy.all"
] | [((77, 108), 'igraph.Graph.Read_GML', 'ig.Graph.Read_GML', (['"""karate.txt"""'], {}), "('karate.txt')\n", (94, 108), True, 'import igraph as ig\n'), ((212, 227), 'numpy.ones', 'np.ones', (['[N, 1]'], {}), '([N, 1])\n', (219, 227), True, 'import numpy as np\n'), ((243, 270), 'numpy.random.seed', 'np.random.seed', (['ra... |
from __future__ import annotations
import logging
import typing as t
from fastapi import APIRouter, FastAPI
from fastapi.param_functions import Depends
from starlette.responses import (
JSONResponse,
Response,
)
from api.config import get_config
from api.postgres import Connection, Postgres, connect_and_migr... | [
"api.config.get_config",
"api.postgres.connect_and_migrate",
"fastapi.param_functions.Depends",
"starlette.responses.JSONResponse",
"fastapi.FastAPI",
"api.postgres.Postgres.disconnect",
"logging.getLogger",
"fastapi.APIRouter"
] | [((334, 361), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (351, 361), False, 'import logging\n'), ((371, 382), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (380, 382), False, 'from fastapi import APIRouter, FastAPI\n'), ((440, 468), 'fastapi.param_functions.Depends', 'Depends', ... |
import networkx as nx
import matplotlib.pyplot as plt
G=nx.cubical_graph() #Return the 3-regular Platonic Cubical graph.
plt.subplot(121) #subplot(nrows, ncols, index)
nx.draw(G) # default spring_layout
plt.subplot(122)
nx.draw(G, pos=nx.circular_layout(G), nodecolor='r', edge_color='b')
| [
"networkx.cubical_graph",
"matplotlib.pyplot.subplot",
"networkx.draw",
"networkx.circular_layout"
] | [((57, 75), 'networkx.cubical_graph', 'nx.cubical_graph', ([], {}), '()\n', (73, 75), True, 'import networkx as nx\n'), ((122, 138), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(121)'], {}), '(121)\n', (133, 138), True, 'import matplotlib.pyplot as plt\n'), ((169, 179), 'networkx.draw', 'nx.draw', (['G'], {}), '(G)\... |
from flask import Flask
from flask import render_template
app = Flask(__name__)
# main routes
@app.route('/')
def index():
return render_template('index.html')
@app.route('/home')
def home():
return render_template('home.html') | [
"flask.Flask",
"flask.render_template"
] | [((65, 80), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (70, 80), False, 'from flask import Flask\n'), ((136, 165), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (151, 165), False, 'from flask import render_template\n'), ((210, 238), 'flask.render_template',... |
import datetime
END_DATE = datetime.date(2019, 4, 25)
STATE2DESCRIPTOR = {0: 'REST', 1: 'SLEEP', 2: 'ACTIVE', 3: 'RUN', 4: 'EAT&DRINK', 5: 'EAT'}
DAY_NIGHTS = ['day', 'night']
STATES = list(STATE2DESCRIPTOR.values())
STATE_AGG_BASE_FEATURES = ['VO2', 'VCO2', 'VH2O', 'KCal_hr', 'RQ', 'Food', 'PedMeters', 'AllMeters']
... | [
"datetime.date"
] | [((29, 55), 'datetime.date', 'datetime.date', (['(2019)', '(4)', '(25)'], {}), '(2019, 4, 25)\n', (42, 55), False, 'import datetime\n')] |
import os
import re
import sys
import platform
import subprocess
import versioneer
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
cpus = os.cpu_count()
here = os.path.abspath(os.path.dirname(__file__))
with open(os.... | [
"versioneer.get_version",
"os.path.abspath",
"setuptools.find_packages",
"os.path.join",
"os.makedirs",
"os.path.dirname",
"os.environ.copy",
"subprocess.check_output",
"os.path.exists",
"versioneer.get_cmdclass",
"os.cpu_count",
"platform.system",
"setuptools.Extension.__init__",
"subproc... | [((241, 255), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (253, 255), False, 'import os\n'), ((2774, 2799), 'versioneer.get_cmdclass', 'versioneer.get_cmdclass', ([], {}), '()\n', (2797, 2799), False, 'import versioneer\n'), ((279, 304), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (2... |
# Twitcaspy
# Copyright 2021 Alma-field
# See LICENSE for details.
from twitcaspy import API, AppAuthHandler
# The client id and/or secret can be found on your application's Details page
# located at select app in https://twitcasting.tv/developer.php
# (in "details" tab)
CLIENT_ID = ''
CLIENT_SECRET = ''
auth = AppA... | [
"twitcaspy.AppAuthHandler",
"twitcaspy.API"
] | [((316, 356), 'twitcaspy.AppAuthHandler', 'AppAuthHandler', (['CLIENT_ID', 'CLIENT_SECRET'], {}), '(CLIENT_ID, CLIENT_SECRET)\n', (330, 356), False, 'from twitcaspy import API, AppAuthHandler\n'), ((363, 372), 'twitcaspy.API', 'API', (['auth'], {}), '(auth)\n', (366, 372), False, 'from twitcaspy import API, AppAuthHand... |
from django.conf import settings
from django.http import JsonResponse
from common import errors
def render_json(code=errors.OK, data=None):
"""
自定义 json 输出
:param code:
:param data:
:return:
"""
result = {
'code': code
}
if data:
result['data'] = data
if set... | [
"django.http.JsonResponse"
] | [((475, 544), 'django.http.JsonResponse', 'JsonResponse', (['result'], {'safe': '(False)', 'json_dumps_params': 'json_dumps_params'}), '(result, safe=False, json_dumps_params=json_dumps_params)\n', (487, 544), False, 'from django.http import JsonResponse\n')] |
import sys
sys.path.append('./model')
import argparse
import torch
import numpy as np
from model.model import NCNet
import torchvision.transforms as transforms
from dataloader import TrainLoader, ValLoader
from loss import WeakLoss
import torch.optim as optim
import json
import os
## Parameters
parser = argparse.... | [
"os.mkdir",
"numpy.random.seed",
"argparse.ArgumentParser",
"model.model.NCNet",
"loss.WeakLoss",
"torchvision.transforms.Normalize",
"torch.no_grad",
"os.path.join",
"sys.path.append",
"torch.load",
"os.path.exists",
"dataloader.ValLoader",
"torchvision.transforms.CenterCrop",
"json.dump"... | [((12, 38), 'sys.path.append', 'sys.path.append', (['"""./model"""'], {}), "('./model')\n", (27, 38), False, 'import sys\n'), ((311, 365), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Nc-Net Training"""'}), "(description='Nc-Net Training')\n", (334, 365), False, 'import argparse\n'), (... |
import sys
for i in range(5):
for j in range(i+1):
sys.stdout.write("*")
print()
| [
"sys.stdout.write"
] | [((63, 84), 'sys.stdout.write', 'sys.stdout.write', (['"""*"""'], {}), "('*')\n", (79, 84), False, 'import sys\n')] |
import cgi
import json
from types import FunctionType
from typing import Any, Awaitable, Callable, Dict, List, Optional, Tuple, cast
import attr
from aiohttp import web
from .context import COMPONENTS
from .swagger import Swagger
from .validators import MISSING, Validator, ValidatorError, schema_to_validator, securit... | [
"typing.cast",
"cgi.parse_header",
"attr.attrs",
"json.dumps"
] | [((1042, 1083), 'attr.attrs', 'attr.attrs', ([], {'slots': '(True)', 'auto_attribs': '(True)'}), '(slots=True, auto_attribs=True)\n', (1052, 1083), False, 'import attr\n'), ((785, 807), 'typing.cast', 'cast', (['FunctionType', 'fn'], {}), '(FunctionType, fn)\n', (789, 807), False, 'from typing import Any, Awaitable, Ca... |
from django_redis import get_redis_connection
import json
from .BaseOpration import BaseOpration
from big_screen.utils import tools as t
from big_screen.serialization.allSerialization import serMobile
from big_screen.utils import re_format as f
class defaultOp(BaseOpration):
def __init__(self):
BaseOprat... | [
"django_redis.get_redis_connection",
"big_screen.utils.tools.getaddress",
"big_screen.serialization.allSerialization.serMobile",
"json.loads"
] | [((358, 389), 'django_redis.get_redis_connection', 'get_redis_connection', (['"""default"""'], {}), "('default')\n", (378, 389), False, 'from django_redis import get_redis_connection\n'), ((502, 533), 'django_redis.get_redis_connection', 'get_redis_connection', (['"""session"""'], {}), "('session')\n", (522, 533), Fals... |
import logging
from collections import deque
from abc import ABC, abstractmethod
import math
from lxml import etree
from pyqtree import Index as PqtreeIndex
from PIL import Image, ImageDraw, ImageColor
from sciencebeam_gym.structured_document.svg import (
SVG_NSMAP,
SVG_DOC,
SVG_RECT,
)
DEFAULT_NEARBY_TO... | [
"PIL.Image.new",
"lxml.etree.Element",
"math.ceil",
"pyqtree.Index",
"PIL.ImageColor.getrgb",
"logging.getLogger",
"PIL.ImageDraw.Draw",
"collections.deque"
] | [((363, 390), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (380, 390), False, 'import logging\n'), ((2547, 2554), 'collections.deque', 'deque', ([], {}), '()\n', (2552, 2554), False, 'from collections import deque\n'), ((2862, 2875), 'collections.deque', 'deque', (['blocks'], {}), '(blo... |
import datetime
def add_time(start, duration, weekday_name = ' '):
start = datetime.datetime.strptime(start,'%I:%M %p')
h_duration,m_duration = duration.split(':')
t_duration = int(h_duration)*60 + int(m_duration)
calc_time = start + datetime.timedelta(minutes=int(t_duration))
day = calc_time.day
... | [
"datetime.datetime.strptime"
] | [((81, 126), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['start', '"""%I:%M %p"""'], {}), "(start, '%I:%M %p')\n", (107, 126), False, 'import datetime\n')] |
import time
from pdm.constants import BUFFER
from urllib.request import (
build_opener,
urlopen,
Request
)
from http.client import HTTPResponse, HTTPMessage
from threading import Thread, Event
from pdm.utils import get_filename
from concurrent.futures import Future
from pdm.hooker import ProgressDownloadHoo... | [
"threading.Thread",
"concurrent.futures.Future",
"urllib.request.Request",
"urllib.request.urlopen",
"urllib.request.build_opener",
"time.time",
"pdm.hooker.ProgressDownloadHooker",
"pdm.utils.get_filename",
"pdm.constants.BUFFER.__repr__"
] | [((1645, 1659), 'urllib.request.build_opener', 'build_opener', ([], {}), '()\n', (1657, 1659), False, 'from urllib.request import build_opener, urlopen, Request\n'), ((2081, 2095), 'urllib.request.build_opener', 'build_opener', ([], {}), '()\n', (2093, 2095), False, 'from urllib.request import build_opener, urlopen, Re... |
from unittest import mock
from unittest.mock import patch
from cartography.intel.gsuite import api
def test_get_all_users():
client = mock.MagicMock()
raw_request_1 = mock.MagicMock()
raw_request_2 = mock.MagicMock()
user1 = {'primaryEmail': '<EMAIL>'}
user2 = {'primaryEmail': '<EMAIL>'}
use... | [
"cartography.intel.gsuite.api.transform_users",
"cartography.intel.gsuite.api.get_all_users",
"unittest.mock.MagicMock",
"cartography.intel.gsuite.api.load_gsuite_groups",
"cartography.intel.gsuite.api.sync_gsuite_users",
"cartography.intel.gsuite.api.load_gsuite_users",
"unittest.mock.patch",
"cartog... | [((1630, 1688), 'unittest.mock.patch', 'patch', (['"""cartography.intel.gsuite.api.cleanup_gsuite_users"""'], {}), "('cartography.intel.gsuite.api.cleanup_gsuite_users')\n", (1635, 1688), False, 'from unittest.mock import patch\n'), ((1690, 1745), 'unittest.mock.patch', 'patch', (['"""cartography.intel.gsuite.api.load_... |
from django.conf import settings
from notifications import constants, email, helpers
def verification_code_not_given():
verification_code_not_given_first_reminder()
verification_code_not_given_seconds_reminder()
def verification_code_not_given_first_reminder():
days_ago = settings.VERIFICATION_CODE_NOT... | [
"notifications.helpers.group_new_companies_by_industry",
"notifications.helpers.get_new_companies_anonymous_subscribers",
"notifications.email.NewCompaniesInSectorNotification",
"notifications.email.VerificationStillWaitingNotification",
"notifications.helpers.get_unverified_suppliers",
"notifications.ema... | [((1393, 1434), 'notifications.helpers.group_new_companies_by_industry', 'helpers.group_new_companies_by_industry', ([], {}), '()\n', (1432, 1434), False, 'from notifications import constants, email, helpers\n'), ((1458, 1507), 'notifications.helpers.get_new_companies_anonymous_subscribers', 'helpers.get_new_companies_... |
# encoding: utf-8
"""
@author: liaoxingyu
@contact: <EMAIL>
"""
import torchvision.transforms as T
import random
import numpy as np
import PIL
from .transforms import RandomErasing
class AddGaussianNoise(object):
def __call__(self, img):
std = random.uniform(0, 1.0)
if std > 0.5:
retu... | [
"torchvision.transforms.ColorJitter",
"torchvision.transforms.RandomHorizontalFlip",
"random.uniform",
"torchvision.transforms.RandomRotation",
"numpy.asarray",
"numpy.clip",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Pad",
"numpy.random.normal",
"PIL.Image.fromarray",
"torchvisi... | [((691, 754), 'torchvision.transforms.Normalize', 'T.Normalize', ([], {'mean': 'cfg.INPUT.PIXEL_MEAN', 'std': 'cfg.INPUT.PIXEL_STD'}), '(mean=cfg.INPUT.PIXEL_MEAN, std=cfg.INPUT.PIXEL_STD)\n', (702, 754), True, 'import torchvision.transforms as T\n'), ((1655, 1718), 'torchvision.transforms.Normalize', 'T.Normalize', ([... |
from datetime import datetime
from core.modules.output_mod import output
def greet(master):
hour = datetime.now().hour
if 5 <= hour < 12:
output(f"Good morning {master}")
elif 12 <= hour < 18:
output(f"Good afternoon {master}")
else:
output(f"Good evening {master}")
| [
"core.modules.output_mod.output",
"datetime.datetime.now"
] | [((106, 120), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (118, 120), False, 'from datetime import datetime\n'), ((158, 190), 'core.modules.output_mod.output', 'output', (['f"""Good morning {master}"""'], {}), "(f'Good morning {master}')\n", (164, 190), False, 'from core.modules.output_mod import output\... |
import h5py
from signal_filter.fft import LowPassFilter
from signal_filter.mpi_signal_filter import SignalFilter
h5_path = 'giv_raw.h5'
h5_f = h5py.File(h5_path, mode='r+')
h5_grp = h5_f['Measurement_000/Channel_000']
h5_main = h5_grp['Raw_Data']
samp_rate = h5_grp.attrs['IO_samp_rate_[Hz]']
num_spectral_pts = h5_ma... | [
"h5py.File",
"numpy.abs",
"numpy.allclose",
"signal_filter.fft.LowPassFilter",
"signal_filter.mpi_signal_filter.SignalFilter"
] | [((145, 174), 'h5py.File', 'h5py.File', (['h5_path'], {'mode': '"""r+"""'}), "(h5_path, mode='r+')\n", (154, 174), False, 'import h5py\n'), ((434, 597), 'signal_filter.mpi_signal_filter.SignalFilter', 'SignalFilter', (['h5_main'], {'frequency_filters': 'frequency_filters', 'noise_threshold': 'noise_tol', 'write_filtere... |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.http import Request
from scrapy_splash import SplashRequest
from work.items import ShopItem
import re
class Test2Spider(scrapy.Spider):
name = 'test2'
allowed_domains = ['www.countryattire.com']
start_urls = ['https://www.countryattire.com/']
custom_s... | [
"work.items.ShopItem"
] | [((2701, 2711), 'work.items.ShopItem', 'ShopItem', ([], {}), '()\n', (2709, 2711), False, 'from work.items import ShopItem\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-10-08 18:57
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Crea... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((2177, 2268), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""semester.Semester"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'semester.Semester')\n", (2194, 2268), False, 'from django.db import migrations, models\n'), ((400, 493),... |
from django.db import models
import datetime
from django.contrib.auth.models import User
# Create your models here.
class Review(models.Model):
user = models.ForeignKey(User,blank=True,null=True,on_delete=models.CASCADE)
mark = models.IntegerField()
text = models.TextField()
created = models.DateTimeField(auto_now... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.TextField",
"django.db.models.DateTimeField"
] | [((153, 225), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'blank': '(True)', 'null': '(True)', 'on_delete': 'models.CASCADE'}), '(User, blank=True, null=True, on_delete=models.CASCADE)\n', (170, 225), False, 'from django.db import models\n'), ((231, 252), 'django.db.models.IntegerField', 'models.Int... |
"""
Run a job: i.e. run a configuration file through the DAGRunner
"""
import argparse
import logging
import warnings
######################################
######################################
# Important:
#
# If your configuration uses custom node classes, be sure to set environment variable
# PRIMROSE_EXT_NOD... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"warnings.filterwarnings",
"primrose.dag_runner.DagRunner",
"primrose.configuration.configuration.Configuration"
] | [((843, 876), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (866, 876), False, 'import warnings\n'), ((1028, 1053), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1051, 1053), False, 'import argparse\n'), ((1626, 1749), 'logging.basicConfig', 'lo... |
"""
Unit tests for the mqtt support class
Copyright 2022 <NAME>
SPDX-License-Identifier: Apache-2.0
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
Unle... | [
"time.sleep"
] | [((1918, 1931), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (1928, 1931), False, 'import time\n')] |
#!/usr/bin/env python
import os, sys, subprocess
from os.path import basename,dirname
import h5py
from netCDF4 import Dataset
import numpy as np
import numpy.ma as ma
import gdal
from gdalconst import *
from osgeo import ogr, osr
from datetime import datetime, date
def createImgSCISAT(fileAbsPath):
# read info fr... | [
"netCDF4.Dataset",
"numpy.ma.min",
"gdal.GetDriverByName",
"numpy.ma.set_fill_value",
"os.path.exists",
"numpy.expand_dims",
"datetime.datetime.strptime",
"sys.exit",
"osgeo.osr.SpatialReference",
"numpy.ma.max"
] | [((343, 368), 'netCDF4.Dataset', 'Dataset', (['fileAbsPath', '"""r"""'], {}), "(fileAbsPath, 'r')\n", (350, 368), False, 'from netCDF4 import Dataset\n'), ((495, 582), 'datetime.datetime.strptime', 'datetime.strptime', (["ncfile.groups['ACE-FTS-v2.2'].start_time", '"""%Y-%m-%d %H:%M:%S+00"""'], {}), "(ncfile.groups['AC... |
import logging
from os import write
import requests
from typing import Any, Dict
from cartpole import CartPole
from tensorboardX import SummaryWriter
class BonsaiAgent(object):
""" The agent that gets the action from the trained brain exported as docker image and started locally
"""
def act(self, state) -... | [
"tensorboardX.SummaryWriter",
"logging.basicConfig",
"requests.get",
"cartpole.CartPole",
"logging.getLogger"
] | [((1044, 1065), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (1063, 1065), False, 'import logging\n'), ((1076, 1105), 'logging.getLogger', 'logging.getLogger', (['"""cartpole"""'], {}), "('cartpole')\n", (1093, 1105), False, 'import logging\n'), ((1151, 1166), 'tensorboardX.SummaryWriter', 'SummaryWr... |
"""
Packing and unpacking of floats in the IEEE 32-bit and 64-bit formats.
"""
import math
from pypy.rlib.rarithmetic import r_longlong, isinf, isnan, INFINITY, NAN
def pack_float(result, number, size, bigendian):
"""Append to 'result' the 'size' characters of the 32-bit or 64-bit
IEEE representation of the n... | [
"pypy.rlib.rarithmetic.r_longlong",
"pypy.rlib.rarithmetic.isnan",
"pypy.rlib.rarithmetic.isinf",
"math.frexp",
"math.ldexp"
] | [((479, 492), 'pypy.rlib.rarithmetic.isnan', 'isnan', (['number'], {}), '(number)\n', (484, 492), False, 'from pypy.rlib.rarithmetic import r_longlong, isinf, isnan, INFINITY, NAN\n'), ((1048, 1084), 'pypy.rlib.rarithmetic.r_longlong', 'r_longlong', (['(power_of_two * man + 0.5)'], {}), '(power_of_two * man + 0.5)\n', ... |
import torchvision.transforms as T
def aug_transform(crop, base_transform, cfg, extra_t=[]):
""" augmentation transform generated from config """
return T.Compose(
[
T.RandomApply(
[T.ColorJitter(cfg.cj0, cfg.cj1, cfg.cj2, cfg.cj3)], p=cfg.cj_p
),
T.... | [
"torchvision.transforms.ColorJitter",
"torchvision.transforms.RandomResizedCrop",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomGrayscale"
] | [((318, 347), 'torchvision.transforms.RandomGrayscale', 'T.RandomGrayscale', ([], {'p': 'cfg.gs_p'}), '(p=cfg.gs_p)\n', (335, 347), True, 'import torchvision.transforms as T\n'), ((361, 476), 'torchvision.transforms.RandomResizedCrop', 'T.RandomResizedCrop', (['crop'], {'scale': '(cfg.crop_s0, cfg.crop_s1)', 'ratio': '... |
import argparse
from torch import cuda
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--directory', metavar='EXPORT_DIR', help='destination where trained network should be saved')
parser.add_argument('--training-dataset', default='GLDv2', help='training dataset: (default: GLDv2)')... | [
"torch.cuda.is_available",
"argparse.ArgumentParser"
] | [((70, 95), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (93, 95), False, 'import argparse\n'), ((661, 680), 'torch.cuda.is_available', 'cuda.is_available', ([], {}), '()\n', (678, 680), False, 'from torch import cuda\n')] |
import os
from flask import Flask
from flask import request
from flask import render_template
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'GET':
return render_template('index.html')
elif request.method == 'POST':
data = request.form
... | [
"flask.Flask",
"os.system",
"flask.render_template"
] | [((101, 116), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (106, 116), False, 'from flask import Flask\n'), ((1411, 1460), 'flask.render_template', 'render_template', (['"""index.html"""'], {'flash': '"""Alarm set!"""'}), "('index.html', flash='Alarm set!')\n", (1426, 1460), False, 'from flask import ren... |
"""
Rhino Python Script Tutorial
Exercise 01
Draw point at origin.
Important note: Python is very sensitive to indentation.
Notice how the rs.AddPoint statement is indented inwards.
This means that it is part of the Main method.
All this will be clear in due time.
"""
import rhinoscriptsyntax a... | [
"rhinoscriptsyntax.AddPoint"
] | [((359, 381), 'rhinoscriptsyntax.AddPoint', 'rs.AddPoint', (['[0, 0, 0]'], {}), '([0, 0, 0])\n', (370, 381), True, 'import rhinoscriptsyntax as rs\n')] |
import time
import random
import numpy as np
import pandas as pds
from collections import namedtuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchdiffeq import odeint_adjoint as odeint
from config import D_TYPE
def get_data():
Arg = namedtuple('Arg', ['method', 'data_size', 'bat... | [
"collections.namedtuple",
"torch.linspace",
"torch.no_grad",
"torch.sin",
"torch.tensor",
"torchdiffeq.odeint_adjoint"
] | [((274, 396), 'collections.namedtuple', 'namedtuple', (['"""Arg"""', "['method', 'data_size', 'batch_time', 'batch_size', 'niters', 'test_freq',\n 'viz', 'gpu', 'adjoint']"], {}), "('Arg', ['method', 'data_size', 'batch_time', 'batch_size',\n 'niters', 'test_freq', 'viz', 'gpu', 'adjoint'])\n", (284, 396), False,... |
import json
class Model:
def __init__(self, zacetni_seznam_nalog, tema=''):
self.naloge = zacetni_seznam_nalog
self.aktualna_naloga = None
self.tema = tema
def dodaj_novo_nalogo(self, naloga):
self.naloge.append(naloga)
def v_slovar(self):
seznam_nalog = [
... | [
"json.dump",
"json.load"
] | [((926, 948), 'json.dump', 'json.dump', (['slovar', 'dat'], {}), '(slovar, dat)\n', (935, 948), False, 'import json\n'), ((1086, 1100), 'json.load', 'json.load', (['dat'], {}), '(dat)\n', (1095, 1100), False, 'import json\n')] |
from django.utils import timezone
from django_filters.rest_framework import DjangoFilterBackend
from drf_haystack.viewsets import HaystackViewSet
from rest_flex_fields.views import FlexFieldsMixin
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.viewsets import ReadOnlyModelViewSet
f... | [
"django.utils.timezone.now",
"outpost.django.base.decorators.docstring_format"
] | [((1672, 1814), 'outpost.django.base.decorators.docstring_format', 'docstring_format', ([], {'model': 'models.Function.__doc__', 'filter': 'filters.FunctionFilter.__doc__', 'serializer': 'serializers.FunctionSerializer.__doc__'}), '(model=models.Function.__doc__, filter=filters.\n FunctionFilter.__doc__, serializer=... |
from __future__ import print_function
import torch.autograd as autograd
from torch.autograd import Variable
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchvision
import random
import numpy as np
import sys
import os
from ffn import FFN
sys.path.insert(1, os.pa... | [
"torch.nn.ReLU",
"torch.nn.Conv1d",
"torch.nn.ConvTranspose1d",
"torch.nn.Linear",
"os.path.join"
] | [((315, 349), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""../.."""'], {}), "(sys.path[0], '../..')\n", (327, 349), False, 'import os\n'), ((846, 937), 'torch.nn.Conv1d', 'nn.Conv1d', (['self.otu_handler.num_strains', 'hidden_dim'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(3)'}), '(self.otu_handler.... |
# -----------------------------------------------------------------------------
# Copyright (c) 2015, The Deblur Development Team.
#
# Distributed under the terms of the BSD 3-clause License.
#
# The full license is in the file LICENSE, distributed with this software.
# -------------------------------------------------... | [
"unittest.main"
] | [((885, 891), 'unittest.main', 'main', ([], {}), '()\n', (889, 891), False, 'from unittest import TestCase, main\n')] |
"""Class for converter."""
import numpy as np
import math
import cmath
import scipy
import logging
from scipy import signal
from scipy.integrate import odeint,ode
#from converter_utilities import plot_signal, plot_FFT
import converter_utilities
import config
from models import InverterModels
class PowerElectr... | [
"numpy.array"
] | [((10519, 10535), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (10527, 10535), True, 'import numpy as np\n'), ((11081, 11097), 'numpy.array', 'np.array', (['result'], {}), '(result)\n', (11089, 11097), True, 'import numpy as np\n')] |
import pytest
from todocli.todo import commands
class TestCommandparser(object):
successful_user_input = ['-f', 'file1', '-e', '.py', '-m', ]
successfully_parsed_args = commands.command_interpreter(successful_user_input)
no_args_parsed_args = commands.command_interpreter([])
# successful run
def... | [
"todocli.todo.commands.command_interpreter",
"pytest.raises"
] | [((178, 229), 'todocli.todo.commands.command_interpreter', 'commands.command_interpreter', (['successful_user_input'], {}), '(successful_user_input)\n', (206, 229), False, 'from todocli.todo import commands\n'), ((256, 288), 'todocli.todo.commands.command_interpreter', 'commands.command_interpreter', (['[]'], {}), '([]... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 4 12:48:05 2020
@author: sven
"""
import numpy as np
def nearfield(f,c,theta):
"""
Compute the nearfield
Parameters
----------
f : numeric
Transducer Frequency in kHz [kHz].
c : numeric
Ambient sound speed [m/s].
theta : numeric
3dB angle or beam width in ... | [
"numpy.sin",
"numpy.log10",
"numpy.tan"
] | [((1024, 1053), 'numpy.log10', 'np.log10', (['(5.78 / (k * a) ** 2)'], {}), '(5.78 / (k * a) ** 2)\n', (1032, 1053), True, 'import numpy as np\n'), ((1356, 1387), 'numpy.tan', 'np.tan', (['(theta * np.pi / 180 / 2)'], {}), '(theta * np.pi / 180 / 2)\n', (1362, 1387), True, 'import numpy as np\n'), ((504, 535), 'numpy.s... |
from weather_tracker import weather_tracker, output_file_path
from wt_exceptions import WeatherException, LocationException
def check_selection_value(value):
return value in [1, 2]
if __name__ == '__main__':
print("Welcome to the Automatic Weather Machine! We find your location (Based on IP Address) and tel... | [
"weather_tracker.weather_tracker"
] | [((933, 956), 'weather_tracker.weather_tracker', 'weather_tracker', (['output'], {}), '(output)\n', (948, 956), False, 'from weather_tracker import weather_tracker, output_file_path\n')] |
import pandas as pd
import numpy as np
class regout(object):
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
stat_names=['coeff', 'se', 't', 'p>t', 'CI_low', 'CI_high']
var_names=['mpg', 'length', '_cons']
tsls_std = regout(
summary=pd.DataFrame(np.array([
[-1319.865169393102,
1906.786... | [
"numpy.array"
] | [((278, 673), 'numpy.array', 'np.array', (['[[-1319.865169393102, 1906.786380881755, -0.6921935160784805, \n 0.4910734473693195, -5121.889227450638, 2482.158888664433], [-\n 217.1947537663291, 420.1260089670161, -0.5169752624941175, \n 0.6067801835089432, -1054.902223005562, 620.5127154729038], [\n 75092.75... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
import django_extensions.db.fields
class Migration(migrations.Migration):
dependencies = [
('omaha', '0022_auto_20150909_0755'),
]
operations = [
migrations.AddField(
model_name='request',
name='ip... | [
"django.db.models.GenericIPAddressField"
] | [((341, 392), 'django.db.models.GenericIPAddressField', 'models.GenericIPAddressField', ([], {'null': '(True)', 'blank': '(True)'}), '(null=True, blank=True)\n', (369, 392), False, 'from django.db import models, migrations\n')] |
import gibberish
def test_generate_word():
word = gibberish.generate_word()
assert len(word)
assert word.isalpha()
def test_generate_words():
word_list = gibberish.generate_word()
assert len(word_list)
for word in word_list:
assert len(word)
assert word.isalpha()
| [
"gibberish.generate_word"
] | [((56, 81), 'gibberish.generate_word', 'gibberish.generate_word', ([], {}), '()\n', (79, 81), False, 'import gibberish\n'), ((174, 199), 'gibberish.generate_word', 'gibberish.generate_word', ([], {}), '()\n', (197, 199), False, 'import gibberish\n')] |
#import pygame
#pygame.mixer.init()
#pygame.mixer.music.load('desaf021.mp3')
#pygame.mixer.music.play()
#while pygame.mixer.music.get_busy(): pass
import playsound
playsound.playsound('desaf021.mp3')
| [
"playsound.playsound"
] | [((164, 199), 'playsound.playsound', 'playsound.playsound', (['"""desaf021.mp3"""'], {}), "('desaf021.mp3')\n", (183, 199), False, 'import playsound\n')] |
# Author: <NAME>
# MIT license (see LICENCE.txt in the top-level folder)
import unittest
import numpy as np
from numpy import random
from numpy import linalg as LA
from sklearn.linear_model import LinearRegression, LogisticRegression
from single_neuron import models as models
from single_neuron import math_utils as... | [
"numpy.zeros",
"sklearn.linear_model.LinearRegression",
"numpy.linalg.matrix_rank",
"numpy.random.randint",
"numpy.random.multivariate_normal",
"numpy.random.rand"
] | [((551, 579), 'numpy.random.randint', 'random.randint', (['(3)', '(N_max + 1)'], {}), '(3, N_max + 1)\n', (565, 579), False, 'from numpy import random\n'), ((594, 622), 'numpy.random.randint', 'random.randint', (['(3)', '(N_max + 1)'], {}), '(3, N_max + 1)\n', (608, 622), False, 'from numpy import random\n'), ((631, 65... |
import logging
logger = logging.getLogger()
log_format = logging.Formatter("[%(asctime)s %(levelname)s] %(message)s")
logger.setLevel(logging.INFO)
console_handler = logging.StreamHandler()
console_handler.setFormatter(log_format)
logger.handlers = [console_handler] | [
"logging.Formatter",
"logging.StreamHandler",
"logging.getLogger"
] | [((25, 44), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (42, 44), False, 'import logging\n'), ((58, 118), 'logging.Formatter', 'logging.Formatter', (['"""[%(asctime)s %(levelname)s] %(message)s"""'], {}), "('[%(asctime)s %(levelname)s] %(message)s')\n", (75, 118), False, 'import logging\n'), ((168, 191)... |
from django import template
from joblistings.models import Job
from companies.models import Company
register = template.Library()
@register.inclusion_tag('dashbar.html')
def get_dashbar(*args, **kwargs):
location = kwargs['location']
return {
'location': location
} | [
"django.template.Library"
] | [((114, 132), 'django.template.Library', 'template.Library', ([], {}), '()\n', (130, 132), False, 'from django import template\n')] |
# Solution of;
# Project Euler Problem 405: A rectangular tiling
# https://projecteuler.net/problem=405
#
# We wish to tile a rectangle whose length is twice its width. Let T(0) be the
# tiling consisting of a single rectangle. For n > 0, let T(n) be obtained
# from T(n-1) by replacing all tiles in the following man... | [
"timed.caller"
] | [((762, 796), 'timed.caller', 'timed.caller', (['dummy', 'n', 'i', 'prob_id'], {}), '(dummy, n, i, prob_id)\n', (774, 796), False, 'import timed\n')] |
import logging
import numpy as np
from time import time as now
from gunpowder.batch import Batch
from gunpowder.profiling import Timing
from gunpowder.array import Array
from gunpowder.nodes.hdf5like_source_base import Hdf5LikeSource
from gunpowder.compat import ensure_str
from gunpowder.coordinate import Coordinate
... | [
"time.time",
"gunpowder.coordinate.Coordinate",
"gunpowder.compat.ensure_str",
"gunpowder.profiling.Timing",
"gunpowder.batch.Batch",
"logging.getLogger"
] | [((365, 392), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (382, 392), False, 'import logging\n'), ((1743, 1755), 'gunpowder.profiling.Timing', 'Timing', (['self'], {}), '(self)\n', (1749, 1755), False, 'from gunpowder.profiling import Timing\n'), ((1796, 1803), 'gunpowder.batch.Batch',... |
from flask import make_response
from ckan.common import config, c
import ckan.plugins as p
import ckan.model as model
import ckan.authz as authz
import ckan.logic as logic
import ckan.lib.jobs as jobs
from ckanext.iati.helpers import extras_to_dict, parse_error_object_to_list
from ckanext.iati import helpers as h
from ... | [
"json.dump",
"ckan.authz.is_sysadmin",
"xlwt.Workbook",
"io.BytesIO",
"csv.writer",
"csv.reader",
"ckan.plugins.toolkit.abort",
"ckan.model.Session.query",
"ckan.plugins.toolkit.get_validator",
"ckan.common.config.get",
"ckan.plugins.toolkit.get_action",
"ckanext.iati.helpers.extras_to_dict",
... | [((543, 570), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (560, 570), False, 'import logging\n'), ((609, 645), 'ckan.plugins.toolkit.get_validator', 'p.toolkit.get_validator', (['"""not_empty"""'], {}), "('not_empty')\n", (632, 645), True, 'import ckan.plugins as p\n'), ((662, 701), 'c... |
import uvicorn
from uvicorn.reloaders.statreload import StatReload
from uvicorn.main import run, get_logger
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from utils.tiempo import eightDigits
from utils.pipeline import MongoDBPipeline
from settings import BACKEND_PORT
app =... | [
"starlette.applications.Starlette",
"starlette.responses.JSONResponse",
"utils.tiempo.eightDigits",
"uvicorn.run",
"utils.pipeline.MongoDBPipeline",
"uvicorn.main.get_logger"
] | [((321, 344), 'starlette.applications.Starlette', 'Starlette', ([], {'debug': '"""true"""'}), "(debug='true')\n", (330, 344), False, 'from starlette.applications import Starlette\n'), ((607, 624), 'utils.pipeline.MongoDBPipeline', 'MongoDBPipeline', ([], {}), '()\n', (622, 624), False, 'from utils.pipeline import Mongo... |
import json, base64
import pulumi
from pulumi.output import Output
from pulumi.resource import ComponentResource, ResourceOptions
import pulumi_gcp as gcp
import pulumi_datadog as datadog
import pulumi_random
class GCPLogSinkToDataDog(ComponentResource):
def __init__(
self,
name: str,
... | [
"pulumi_gcp.pubsub.SubscriptionExpirationPolicyArgs",
"pulumi.output.Output.concat",
"pulumi_gcp.pubsub.SubscriptionRetryPolicyArgs",
"pulumi.Config",
"pulumi_gcp.pubsub.SubscriptionPushConfigArgs",
"pulumi.resource.ResourceOptions",
"base64.b64decode",
"pulumi_gcp.organizations.get_project"
] | [((1341, 1372), 'pulumi_gcp.organizations.get_project', 'gcp.organizations.get_project', ([], {}), '()\n', (1370, 1372), True, 'import pulumi_gcp as gcp\n'), ((578, 606), 'pulumi.resource.ResourceOptions', 'ResourceOptions', ([], {'parent': 'self'}), '(parent=self)\n', (593, 606), False, 'from pulumi.resource import Co... |
import tensorflow as tf
import numpy as np
from model import decoder,vae
import cv2
vae.load_weights("vae_cnn.h5")
lv = np.load("lv.npy")
fourcc = cv2.VideoWriter_fourcc(*'XVID')
video = cv2.VideoWriter("output.avi", fourcc, 30.0, (208, 120))
for i in range(1000):
data = lv[i].reshape(1,128)
img = decoder.pre... | [
"numpy.load",
"cv2.VideoWriter_fourcc",
"model.decoder.predict",
"cv2.cvtColor",
"numpy.array",
"cv2.VideoWriter",
"model.vae.load_weights"
] | [((85, 115), 'model.vae.load_weights', 'vae.load_weights', (['"""vae_cnn.h5"""'], {}), "('vae_cnn.h5')\n", (101, 115), False, 'from model import decoder, vae\n'), ((121, 138), 'numpy.load', 'np.load', (['"""lv.npy"""'], {}), "('lv.npy')\n", (128, 138), True, 'import numpy as np\n'), ((148, 179), 'cv2.VideoWriter_fourcc... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
USE_CUDA = torch.cuda.is_available()
device = torch.device("cuda" if USE_CUDA else "cpu")
class Bert_Base(nn.Module):
def __init__(self, opt):
super(Bert_Base, self).__init__()
self.opt = opt
#self.tokeni... | [
"torch.stack",
"numpy.asarray",
"numpy.zeros",
"torch.cuda.is_available",
"torch.device",
"torch.sum",
"torch.from_numpy"
] | [((98, 123), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (121, 123), False, 'import torch\n'), ((133, 176), 'torch.device', 'torch.device', (["('cuda' if USE_CUDA else 'cpu')"], {}), "('cuda' if USE_CUDA else 'cpu')\n", (145, 176), False, 'import torch\n'), ((603, 647), 'torch.sum', 'torch.s... |
from typing import Optional
from aioros_action import ActionClient
from aioros_action import create_client
from aioros import NodeHandle
from aioros_tf2.abc import BufferInterface
from aioros_tf2.exceptions import ConnectivityException
from aioros_tf2.exceptions import ExtrapolationException
from aioros_tf2.exception... | [
"genpy.Duration",
"aioros_tf2.exceptions.LookupException",
"aioros_tf2.exceptions.TimeoutException",
"aioros_tf2.exceptions.ConnectivityException",
"aioros_tf2.exceptions.TransformException",
"aioros_tf2.exceptions.InvalidArgumentException",
"aioros_action.create_client",
"aioros_tf2.exceptions.Extrap... | [((1018, 1077), 'aioros_action.create_client', 'create_client', (['node_handle', 'self._ns', 'LookupTransformAction'], {}), '(node_handle, self._ns, LookupTransformAction)\n', (1031, 1077), False, 'from aioros_action import create_client\n'), ((3762, 3804), 'aioros_tf2.exceptions.LookupException', 'LookupException', ([... |