code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import json
import logging
import time
from pathlib import Path
from django.core.mail import EmailMultiAlternatives, get_connection
from django.core.management import BaseCommand
from slack_sdk import WebClient, errors
from database_locks import locked
from notifications.models import Notification, Subscription
from ... | [
"logging.getLogger",
"json.loads",
"pathlib.Path",
"time.sleep",
"notifications.models.Notification.objects.filter",
"slack_sdk.WebClient",
"django.core.mail.get_connection",
"time.time"
] | [((358, 385), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (375, 385), False, 'import logging\n'), ((527, 576), 'slack_sdk.WebClient', 'WebClient', (['settings.NOTIFICATIONS_SLACK_APP_TOKEN'], {}), '(settings.NOTIFICATIONS_SLACK_APP_TOKEN)\n', (536, 576), False, 'from slack_sdk import W... |
# -*- coding: utf-8 -*-
from openre.agent.decorators import action
import logging
from openre.agent.client.helpers import Net
@action(namespace='client')
def deploy(agent):
logging.debug('Run Net')
config = agent.net_config
if not config:
raise ValueError('No net config')
net = None
try:
... | [
"logging.info",
"logging.debug",
"openre.agent.decorators.action",
"openre.agent.client.helpers.Net"
] | [((129, 155), 'openre.agent.decorators.action', 'action', ([], {'namespace': '"""client"""'}), "(namespace='client')\n", (135, 155), False, 'from openre.agent.decorators import action\n'), ((179, 203), 'logging.debug', 'logging.debug', (['"""Run Net"""'], {}), "('Run Net')\n", (192, 203), False, 'import logging\n'), ((... |
# -*- coding: utf-8 -*-
"""Hello module."""
import platform
import sys
def get_hello():
system = platform.system()
py_version = sys.version_info.major
if system == "Windows":
if py_version < 3:
return "Hello Windows, I'm Python2 or earlier!"
else:
return "Hello W... | [
"platform.system"
] | [((105, 122), 'platform.system', 'platform.system', ([], {}), '()\n', (120, 122), False, 'import platform\n')] |
import numpy
import pytest
import orthopy
import quadpy
from helpers import check_degree_ortho
schemes = [
quadpy.e2r2.haegemans_piessens_a(),
quadpy.e2r2.haegemans_piessens_b(),
quadpy.e2r2.rabinowitz_richter_1(),
quadpy.e2r2.rabinowitz_richter_2(),
quadpy.e2r2.rabinowitz_richter_3(),
quadpy.... | [
"quadpy.e2r2.rabinowitz_richter_3",
"quadpy.e2r2.rabinowitz_richter_4",
"quadpy.e2r2.stroud_15_1",
"numpy.sqrt",
"quadpy.e2r2.haegemans_piessens_b",
"quadpy.e2r2.rabinowitz_richter_1",
"quadpy.e2r2.stroud_4_1",
"quadpy.e2r2.rabinowitz_richter_2",
"quadpy.e2r2.rabinowitz_richter_5",
"quadpy.e2r2.ha... | [((770, 812), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scheme"""', 'schemes'], {}), "('scheme', schemes)\n", (793, 812), False, 'import pytest\n'), ((113, 147), 'quadpy.e2r2.haegemans_piessens_a', 'quadpy.e2r2.haegemans_piessens_a', ([], {}), '()\n', (145, 147), False, 'import quadpy\n'), ((153, 187)... |
import unittest
from lcis import find_lcis_length
class LCISTests(unittest.TestCase):
"""Tests for longest continuous increasing subsequence challenge."""
def test_case_1(self):
self.assertEqual(find_lcis_length([1, 3, 5, 4, 7]), 3)
def test_case_2(self):
self.assertEqual(find_lcis_len... | [
"unittest.main",
"lcis.find_lcis_length"
] | [((747, 773), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (760, 773), False, 'import unittest\n'), ((216, 249), 'lcis.find_lcis_length', 'find_lcis_length', (['[1, 3, 5, 4, 7]'], {}), '([1, 3, 5, 4, 7])\n', (232, 249), False, 'from lcis import find_lcis_length\n'), ((307, 340), 'lci... |
import snap
Graph = snap.GenFull(snap.PNEANet, 10)
Src = 1
Dst = 2
EI = Graph.GetEI(Src,Dst)
EId = EI.GetId()
print(EId, Graph.GetEI(Src,Dst).GetId())
print(Graph.GetEI(Src,Dst).GetSrcNId(), Graph.GetEI(Src,Dst).GetDstNId())
print(Graph.GetEI(EId).GetSrcNId(), Graph.GetEI(EId).GetDstNId())
if EId != Graph.GetEI(Src,Ds... | [
"snap.GenFull"
] | [((20, 50), 'snap.GenFull', 'snap.GenFull', (['snap.PNEANet', '(10)'], {}), '(snap.PNEANet, 10)\n', (32, 50), False, 'import snap\n')] |
from floodsystem.station import MonitoringStation
from floodsystem.geo import rivers_by_station_number
def test_rivers_by_station_number():
"""Test for Task1E functions"""
#create 4 test stations
station_id = "Test station_id"
measure_id = "Test measure_id"
label = "Test station"
coord = (0.0,... | [
"floodsystem.geo.rivers_by_station_number",
"floodsystem.station.MonitoringStation"
] | [((395, 486), 'floodsystem.station.MonitoringStation', 'MonitoringStation', (['station_id', 'measure_id', 'label', 'coord', 'typical_range', '"""River A"""', 'town'], {}), "(station_id, measure_id, label, coord, typical_range,\n 'River A', town)\n", (412, 486), False, 'from floodsystem.station import MonitoringStati... |
import logging
import os
from typing import Dict, Optional, List
import libinfinitton
from . import tasks
class Screen:
logger = logging.getLogger(__name__)
def __init__(self, task_list: Dict[str, tasks.BaseTask], name: str, config: dict = None):
self._task_list = task_list
self.name = nam... | [
"logging.getLogger",
"os.path.exists",
"os.path.join",
"os.getcwd",
"os.path.isfile"
] | [((138, 165), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (155, 165), False, 'import logging\n'), ((2129, 2149), 'os.path.exists', 'os.path.exists', (['icon'], {}), '(icon)\n', (2143, 2149), False, 'import os\n'), ((2154, 2174), 'os.path.isfile', 'os.path.isfile', (['icon'], {}), '(ico... |
import unittest
from automon.integrations.elasticsearch.config import ElasticsearchConfig, SnapshotBot, JVMBot
from automon.integrations.elasticsearch.client import ElasticsearchClient
from automon.integrations.elasticsearch.cleanup import Cleanup
from automon.integrations.elasticsearch.metrics import Metric, MetricTi... | [
"automon.integrations.elasticsearch.config.ElasticsearchConfig",
"automon.integrations.elasticsearch.client.ElasticsearchClient",
"automon.integrations.elasticsearch.cleanup.Cleanup",
"datetime.datetime.now",
"automon.integrations.elasticsearch.config.JVMBot",
"automon.integrations.elasticsearch.config.Sn... | [((387, 408), 'automon.integrations.elasticsearch.client.ElasticsearchClient', 'ElasticsearchClient', ([], {}), '()\n', (406, 408), False, 'from automon.integrations.elasticsearch.client import ElasticsearchClient\n'), ((4876, 4891), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4889, 4891), False, 'import unitt... |
import pytest
from .validators.pre import prevalidators
from .validators.post import postvalidators
validators = prevalidators + postvalidators
@pytest.mark.parametrize('validator', validators)
def test_valid(validator):
data = {
'name': 'Oleg',
'mail': '<EMAIL>',
'count': 20,
}
... | [
"pytest.mark.parametrize"
] | [((150, 198), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""validator"""', 'validators'], {}), "('validator', validators)\n", (173, 198), False, 'import pytest\n'), ((415, 463), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""validator"""', 'validators'], {}), "('validator', validators)\n", (4... |
from typer.testing import CliRunner
from indic_transliteration.sanscript_cli import app
runner = CliRunner()
test_input = "rAmAyaNa"
expected_output = "rāmāyaṇa"
def test_argument_input():
result = runner.invoke(app, ["--from", "hk", "--to", "iast", test_input])
assert result.exit_code == 0
assert expe... | [
"typer.testing.CliRunner"
] | [((99, 110), 'typer.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (108, 110), False, 'from typer.testing import CliRunner\n')] |
import trio
from functools import partial
from .base_runner import BaseRunner
from .async_tools import raise_return, AsyncExecution
class TrioRunner(BaseRunner):
"""Runner for coroutines with :py:mod:`trio`"""
flavour = trio
def __init__(self):
self._nursery = None
super().__init__()
... | [
"trio.open_nursery",
"functools.partial",
"trio.run",
"trio.sleep"
] | [((629, 654), 'trio.run', 'trio.run', (['self._await_all'], {}), '(self._await_all)\n', (637, 654), False, 'import trio\n'), ((394, 424), 'functools.partial', 'partial', (['raise_return', 'payload'], {}), '(raise_return, payload)\n', (401, 424), False, 'from functools import partial\n'), ((842, 861), 'trio.open_nursery... |
from mission.constants.missions import Gate, Path
from conf.vehicle import is_mainsub
HYDROPHONES_PINGER_DEPTH = 3.0
NONSURFACE_MIN_DEPTH = 0.6
# gate = Gate(
# depth=1.0,
# initial_approach_target_percent_of_screen=.45,
# gate_width_threshold=0.4,
# pre_spin_charge_dist=16 if is_mainsub else 12,
# ... | [
"mission.constants.missions.Path"
] | [((432, 695), 'mission.constants.missions.Path', 'Path', ([], {'depth': '(1.0)', 'search_forward': '(6 if is_mainsub else 2)', 'search_stride': '(10 if is_mainsub else 8)', 'search_right_first': '(True)', 'search_speed': '(0.1)', 'post_dist': '(2.5)', 'failure_back_up_dist': '(0.5 if is_mainsub else 0.1)', 'failure_bac... |
from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
with open(path.join(this_directory, "LICENSE"), encoding="utf-8") as f:
license_ = f.read... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((96, 118), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (108, 118), False, 'from os import path\n'), ((130, 168), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (139, 168), False, 'from os import path\n'), ((237, 273), 'os.path.jo... |
import copy
import warnings
from Constants import TARGET_REGISTER, RAND_VALUE, FOCUS_REGISTER, ADDRESS, OPERAND_TYPE, OPERANDS, ISSUE_SLOT
from util.Processor import Processor
class Instruction:
def __init__(self, assembly: str, mutable=True):
# set default enabled features
self.isRandValueRando... | [
"util.Processor.Processor",
"copy.deepcopy"
] | [((1025, 1059), 'copy.deepcopy', 'copy.deepcopy', (['self.parsestring[1]'], {}), '(self.parsestring[1])\n', (1038, 1059), False, 'import copy\n'), ((473, 484), 'util.Processor.Processor', 'Processor', ([], {}), '()\n', (482, 484), False, 'from util.Processor import Processor\n'), ((554, 565), 'util.Processor.Processor'... |
import carla
import random
import time
from tqdm import tqdm
client = carla.Client('localhost', 2000)
client.set_timeout(2.0)
for mid, map_name in enumerate(client.get_available_maps()):
world = client.load_world(map_name)
blueprint_library = world.get_blueprint_library()
print('load map', map_name)
... | [
"carla.Client",
"time.sleep"
] | [((71, 102), 'carla.Client', 'carla.Client', (['"""localhost"""', '(2000)'], {}), "('localhost', 2000)\n", (83, 102), False, 'import carla\n'), ((1688, 1701), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1698, 1701), False, 'import time\n'), ((1223, 1239), 'time.sleep', 'time.sleep', (['(0.15)'], {}), '(0.15)\n... |
"""
Displays FISH data, raw and deconvolved, with spots detected using starFISH
"""
from skimage.io import imread
import numpy as np
from napari import Viewer, gui_qt
raw = imread('data-njs/smFISH/raw.tif')
deconvolved = imread('data-njs/smFISH/deconvolved.tif')
spots = np.loadtxt('data-njs/smFISH/spots.csv', delimit... | [
"napari.Viewer",
"numpy.roll",
"napari.gui_qt",
"skimage.io.imread",
"numpy.loadtxt"
] | [((175, 208), 'skimage.io.imread', 'imread', (['"""data-njs/smFISH/raw.tif"""'], {}), "('data-njs/smFISH/raw.tif')\n", (181, 208), False, 'from skimage.io import imread\n'), ((223, 264), 'skimage.io.imread', 'imread', (['"""data-njs/smFISH/deconvolved.tif"""'], {}), "('data-njs/smFISH/deconvolved.tif')\n", (229, 264), ... |
import shelve
shelfFile = shelve.open('mydata')
file = open('allCountries.txt')
print('Dividiendo el fichero en un array de líneas')
lineas = file.readlines()
print('OK')
shelfFile['arraylineas'] = lineas
shelfFile.close()
| [
"shelve.open"
] | [((27, 48), 'shelve.open', 'shelve.open', (['"""mydata"""'], {}), "('mydata')\n", (38, 48), False, 'import shelve\n')] |
import b
def get_str():
return f"123_{b.get_hoge()}_456" # 123_hoge_456
if __name__ == "__main__":
print(get_str())
| [
"b.get_hoge"
] | [((44, 56), 'b.get_hoge', 'b.get_hoge', ([], {}), '()\n', (54, 56), False, 'import b\n')] |
# The MIT License (MIT)
#
# Copyright (c) 2020-2022 <NAME>
#
# Use of this source code is governed by The MIT License (MIT)
# that can be found in the LICENSE.txt file.
"""
APIs for handling processes
"""
import subprocess
from shlibvischeck.common.error import error
__all__ = ['run', 'is_runnable']
def run(cmd,... | [
"shlibvischeck.common.error.error",
"subprocess.Popen"
] | [((449, 535), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdin': 'None', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(cmd, stdin=None, stdout=subprocess.PIPE, stderr=subprocess\n .PIPE)\n', (465, 535), False, 'import subprocess\n'), ((672, 712), 'shlibvischeck.common.error.error', 'error', ... |
from astra import models
import redis
db = redis.StrictRedis(host='127.0.0.1', decode_responses=True)
class SiteColorModel(models.Model):
color = models.CharField()
def get_db(self):
return db
| [
"redis.StrictRedis",
"astra.models.CharField"
] | [((45, 103), 'redis.StrictRedis', 'redis.StrictRedis', ([], {'host': '"""127.0.0.1"""', 'decode_responses': '(True)'}), "(host='127.0.0.1', decode_responses=True)\n", (62, 103), False, 'import redis\n'), ((154, 172), 'astra.models.CharField', 'models.CharField', ([], {}), '()\n', (170, 172), False, 'from astra import m... |
from recip.validate.types.Block import Block
from recip.validate.types.Tx import Tx
from recip.validate import ValidatorType
def getInstance(vType):
'''Validator Types'''
if ValidatorType.BLOCK == vType:
return Block()
elif ValidatorType.TX == vType:
return Tx() | [
"recip.validate.types.Block.Block",
"recip.validate.types.Tx.Tx"
] | [((237, 244), 'recip.validate.types.Block.Block', 'Block', ([], {}), '()\n', (242, 244), False, 'from recip.validate.types.Block import Block\n'), ((296, 300), 'recip.validate.types.Tx.Tx', 'Tx', ([], {}), '()\n', (298, 300), False, 'from recip.validate.types.Tx import Tx\n')] |
from abc import ABCMeta, abstractmethod
import json
import logging
import copy
import boto3
import botocore
from botocore.exceptions import ClientError
from endgame.shared.response_message import ResponseMessage
from endgame.shared.list_resources_response import ListResourcesResponse
from endgame.shared.response_messag... | [
"logging.getLogger",
"json.dumps",
"endgame.shared.response_message.ResponseMessage"
] | [((354, 381), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (371, 381), False, 'import logging\n'), ((3227, 3522), 'endgame.shared.response_message.ResponseMessage', 'ResponseMessage', ([], {'message': 'message', 'operation': 'operation', 'success': 'success', 'evil_principal': 'evil_pri... |
""" Production Agroindustrial Tools """
# Django
from django.db import models
class AgroindustrialTools(models.Model):
""" Modelo Herramientas del la
produccion Agroindustrial """
production_agroindustrial = models.ForeignKey(
"producer.ProductionAgroindustrial",
related_name="agroindus... | [
"django.db.models.PositiveIntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((225, 347), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""producer.ProductionAgroindustrial"""'], {'related_name': '"""agroindustrial_tools"""', 'on_delete': 'models.CASCADE'}), "('producer.ProductionAgroindustrial', related_name=\n 'agroindustrial_tools', on_delete=models.CASCADE)\n", (242, 347), Fals... |
from django.shortcuts import render, HttpResponse
from home.models import Contact, Library, category
from datetime import datetime
from django.contrib import messages
# Create your views here.
def index(request):
return render(request, "index.html")
#return HttpResponse("Home page")
def abou... | [
"django.shortcuts.render",
"datetime.datetime.today",
"home.models.Library.objects.all",
"django.contrib.messages.success"
] | [((240, 269), 'django.shortcuts.render', 'render', (['request', '"""index.html"""'], {}), "(request, 'index.html')\n", (246, 269), False, 'from django.shortcuts import render, HttpResponse\n'), ((344, 373), 'django.shortcuts.render', 'render', (['request', '"""about.html"""'], {}), "(request, 'about.html')\n", (350, 37... |
import operator
from plenum.test.helper import sdk_send_batches_of_random_and_check
from plenum.test.node_catchup.helper import ensure_all_nodes_have_same_data
def nodes_by_rank(txnPoolNodeSet):
return [t[1] for t in sorted([(node.rank, node)
for node in txnPoolNodeSet],
... | [
"plenum.test.helper.sdk_send_batches_of_random_and_check",
"plenum.test.node_catchup.helper.ensure_all_nodes_have_same_data",
"operator.itemgetter"
] | [((509, 609), 'plenum.test.helper.sdk_send_batches_of_random_and_check', 'sdk_send_batches_of_random_and_check', (['looper', 'nodes', 'sdk_pool', 'sdk_wallet', 'num_reqs', 'num_batches'], {}), '(looper, nodes, sdk_pool, sdk_wallet,\n num_reqs, num_batches)\n', (545, 609), False, 'from plenum.test.helper import sdk_s... |
import sys
import os
import time
import opt.example.SixPeaksEvaluationFunction as SixPeaksEvaluationFunction
import dist.DiscreteUniformDistribution as DiscreteUniformDistribution
import opt.DiscreteChangeOneNeighbor as DiscreteChangeOneNeighbor
import opt.ga.DiscreteChangeOneMutation as DiscreteChangeOneMutation
impo... | [
"dist.DiscreteUniformDistribution",
"opt.ga.DiscreteChangeOneMutation",
"array.array",
"dist.DiscreteDependencyTree",
"opt.prob.MIMIC",
"opt.ga.SingleCrossOver",
"shared.FixedIterationTrainer",
"opt.DiscreteChangeOneNeighbor",
"opt.ga.GenericGeneticAlgorithmProblem",
"opt.example.SixPeaksEvaluatio... | [((1074, 1090), 'array.array', 'array', (['"""i"""', 'fill'], {}), "('i', fill)\n", (1079, 1090), False, 'from array import array\n'), ((1097, 1126), 'opt.example.SixPeaksEvaluationFunction', 'SixPeaksEvaluationFunction', (['T'], {}), '(T)\n', (1123, 1126), True, 'import opt.example.SixPeaksEvaluationFunction as SixPea... |
import json
import os
import random
import re
import subprocess
import sys
from types import ModuleType
DEBUG_RUN_JS = os.getenv("DEBUG_RUN_JS", False) in [
"TRUE",
"true",
"True",
"T",
"t",
"1",
]
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
CWD = os.getcwd()
class NodeFunction:
... | [
"json.loads",
"os.getenv",
"subprocess.Popen",
"json.dumps",
"os.path.join",
"re.match",
"os.getcwd",
"os.path.realpath",
"os.path.isfile",
"subprocess.call",
"random.randint"
] | [((286, 297), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (295, 297), False, 'import os\n'), ((120, 152), 'os.getenv', 'os.getenv', (['"""DEBUG_RUN_JS"""', '(False)'], {}), "('DEBUG_RUN_JS', False)\n", (129, 152), False, 'import os\n'), ((251, 277), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__... |
import os
import max_quant as MQ
# Process the MaxQuant results of the stress response and stress response Hog1
# inhibition experiments
if __name__ == '__main__':
root = '../'
table_dir = os.path.join(root, 'tables')
fasta_path = os.path.join(root, 'yeast_cont_20140324.fasta')
mq_txt_folder = 'MQ_t... | [
"max_quant.reverse_ratios",
"max_quant.write_phosphosite_table",
"max_quant.process_evidence",
"os.path.join",
"max_quant.write_protein_table",
"collections.defaultdict",
"max_quant.write_evidence_table"
] | [((201, 229), 'os.path.join', 'os.path.join', (['root', '"""tables"""'], {}), "(root, 'tables')\n", (213, 229), False, 'import os\n'), ((247, 294), 'os.path.join', 'os.path.join', (['root', '"""yeast_cont_20140324.fasta"""'], {}), "(root, 'yeast_cont_20140324.fasta')\n", (259, 294), False, 'import os\n'), ((359, 420), ... |
from pyramid.config import Configurator
from pyramid.events import NewRequest, subscriber
from .model.meta import setup_app, Session
from .util import dumps
from pyramid.renderers import JSON
@subscriber(NewRequest)
def cleanup_sess(event):
"""Listen for new requests and assign a cleanup handler to each."""
d... | [
"pyramid.config.Configurator",
"pyramid.events.subscriber",
"pyramid.renderers.JSON"
] | [((194, 216), 'pyramid.events.subscriber', 'subscriber', (['NewRequest'], {}), '(NewRequest)\n', (204, 216), False, 'from pyramid.events import NewRequest, subscriber\n'), ((464, 495), 'pyramid.config.Configurator', 'Configurator', ([], {'settings': 'settings'}), '(settings=settings)\n', (476, 495), False, 'from pyrami... |
#
# Copyright (c) 2015-2020 <NAME> <tflorac AT ulthar.net>
# 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 SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | [
"pyramid.view.forbidden_view_config",
"pyams_utils.adapter.adapter_config",
"pyams_zmi.interfaces.configuration.MYAMS_BUNDLES.get",
"pyams_utils.registry.query_utility",
"pyams_viewlet.viewlet.viewlet_config",
"pyramid.csrf.new_csrf_token",
"zope.schema.fieldproperty.FieldProperty",
"pyams_form.button... | [((2383, 2430), 'pyramid.view.forbidden_view_config', 'forbidden_view_config', ([], {'request_type': 'IPyAMSLayer'}), '(request_type=IPyAMSLayer)\n', (2404, 2430), False, 'from pyramid.view import forbidden_view_config, view_config\n'), ((2615, 2689), 'pyramid.view.forbidden_view_config', 'forbidden_view_config', ([], ... |
import numpy as np
from scipy.spatial.distance import pdist, squareform
import scipy.cluster.hierarchy as hy
import matplotlib.pyplot as plt
# Creating a cluster of clusters function
def clusters(number=20, cnumber=5, csize=10):
# Note that the way the clusters are positioned is Gaussian randomness.
rnum = np... | [
"scipy.spatial.distance.squareform",
"scipy.cluster.hierarchy.dendrogram",
"numpy.random.rand",
"numpy.where",
"scipy.spatial.distance.pdist",
"numpy.column_stack",
"numpy.max",
"matplotlib.pyplot.figure",
"scipy.cluster.hierarchy.linkage",
"numpy.vstack",
"numpy.random.randn"
] | [((1070, 1088), 'scipy.spatial.distance.pdist', 'pdist', (['cls[:, 0:2]'], {}), '(cls[:, 0:2])\n', (1075, 1088), False, 'from scipy.spatial.distance import pdist, squareform\n'), ((1093, 1106), 'scipy.spatial.distance.squareform', 'squareform', (['D'], {}), '(D)\n', (1103, 1106), False, 'from scipy.spatial.distance imp... |
import pyzipper
import terminal
from sys import argv
from os import remove
from pyzipper import is_zipfile
if __name__ == "__main__":
argv_count = len(argv)
if argv_count < 3:
terminal.how_to()
else:
my_file = argv[1]
if is_zipfile(my_file):
# noinspection PyBroadExcep... | [
"pyzipper.is_zipfile",
"terminal.dictionary",
"pyzipper.AESZipFile",
"terminal.brute",
"terminal.how_to",
"os.remove"
] | [((195, 212), 'terminal.how_to', 'terminal.how_to', ([], {}), '()\n', (210, 212), False, 'import terminal\n'), ((260, 279), 'pyzipper.is_zipfile', 'is_zipfile', (['my_file'], {}), '(my_file)\n', (270, 279), False, 'from pyzipper import is_zipfile\n'), ((867, 884), 'terminal.how_to', 'terminal.how_to', ([], {}), '()\n',... |
import unittest
import torch
class TensorMultiplying(unittest.TestCase):
def test_tensor_multiplying_last_layer(self):
out = torch.tensor(
[[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]],
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], ... | [
"unittest.main",
"torch.tensor",
"torch.equal"
] | [((2295, 2310), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2308, 2310), False, 'import unittest\n'), ((139, 322), 'torch.tensor', 'torch.tensor', (['[[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], [[1.0, 2.0, 3.0], [\n 4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [\n 7.0, 8... |
import time
from random import randint
from threading import Lock
from typing import List, Optional, Tuple
import telegram
from src.config import CONFIG
from src.modules.antimat.antimat import Antimat
from src.utils.cache import pure_cache, TWO_YEARS, cache, MONTH
from src.utils.callback_helpers import get_callback_d... | [
"src.utils.cache.pure_cache.add_to_set",
"random.randint",
"src.utils.cache.cache.get",
"src.utils.cache.pure_cache.get_set",
"telegram.InlineKeyboardMarkup",
"threading.Lock",
"src.utils.callback_helpers.get_callback_data",
"src.modules.antimat.antimat.Antimat.bad_words",
"src.utils.telegram_helper... | [((441, 461), 'src.utils.logger_helpers.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (451, 461), False, 'from src.utils.logger_helpers import get_logger\n'), ((896, 965), 'src.utils.telegram_helpers.telegram_retry', 'telegram_retry', ([], {'logger': 'logger', 'title': 'f"""[{CACHE_PREFIX}] send_messag... |
from unittest import mock
import gym
import numpy as np
from tests.fixtures.envs.dummy import DummyEnv
class DummyDiscretePixelEnv(DummyEnv):
"""
A dummy discrete pixel environment.
It follows Atari game convention, where actions are 'NOOP', 'FIRE', ...
It also contains self.unwrapped.... | [
"unittest.mock.Mock",
"numpy.ones",
"gym.spaces.Discrete",
"gym.spaces.Box",
"numpy.random.uniform",
"numpy.full"
] | [((1029, 1040), 'unittest.mock.Mock', 'mock.Mock', ([], {}), '()\n', (1038, 1040), False, 'from unittest import mock\n'), ((1127, 1195), 'gym.spaces.Box', 'gym.spaces.Box', ([], {'low': '(0)', 'high': '(255)', 'shape': 'self._obs_dim', 'dtype': 'np.uint8'}), '(low=0, high=255, shape=self._obs_dim, dtype=np.uint8)\n', (... |
from openpyxl import load_workbook
from extractor import read_agenda
# setting up testing files
wb1 = load_workbook('test_example_1.xlsx', data_only=True)
worksheet_1 = wb1.worksheets[0]
wb2 = load_workbook('test_example_2.xlsx', data_only=True)
worksheet_2 = wb2.worksheets[0]
wb3 = load_workbook('test_example_3.x... | [
"openpyxl.load_workbook",
"extractor.read_agenda"
] | [((105, 157), 'openpyxl.load_workbook', 'load_workbook', (['"""test_example_1.xlsx"""'], {'data_only': '(True)'}), "('test_example_1.xlsx', data_only=True)\n", (118, 157), False, 'from openpyxl import load_workbook\n'), ((197, 249), 'openpyxl.load_workbook', 'load_workbook', (['"""test_example_2.xlsx"""'], {'data_only'... |
import os
import requests
import string
import xml.etree.ElementTree as xml
from os.path import join as j
from time import sleep
from virfac import data_dir
bad_bugs = """Acinetobacter baumannii ACICU
Aeromonas hydrophila subsp. hydrophila ATCC 7966
Aeromonas salmonicida subsp. salmonicida A449
Aeromonas hydrophila... | [
"xml.etree.ElementTree.fromstring",
"os.path.join"
] | [((8162, 8181), 'os.path.join', 'j', (['data_dir', 'subdir'], {}), '(data_dir, subdir)\n', (8163, 8181), True, 'from os.path import join as j\n'), ((8494, 8521), 'xml.etree.ElementTree.fromstring', 'xml.fromstring', (['res.content'], {}), '(res.content)\n', (8508, 8521), True, 'import xml.etree.ElementTree as xml\n'), ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import django
from django.core import signals
from django.core.cache.backends.base import BaseCache
logging.basicConfig()
logger = logging.getLogger(__name__)
def get_cache(backend, **kwargs):
from django.core import cache as dj_cach... | [
"logging.basicConfig",
"logging.getLogger",
"django.core.cache.backends.base.BaseCache.__init__",
"django.core.cache.get_cache",
"django.core.cache._create_cache",
"django.core.signals.request_finished.connect",
"django.core.cache.caches.create_connection"
] | [((181, 202), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (200, 202), False, 'import logging\n'), ((212, 239), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (229, 239), False, 'import logging\n'), ((372, 409), 'django.core.cache.get_cache', 'dj_cache.get_cache', (['ba... |
import torch
import numpy as np
from ctc_decoders import Scorer, ctc_beam_search_decoder_batch
"""
# 安装语言模型
sudo apt-get install build-essential libboost-all-dev cmake zlib1g-dev libbz2-dev liblzma-dev
git clone https://github.com/NVIDIA/OpenSeq2Seq -b ctc-decoders
mv OpenSeq2Seq/decoders .
rm -rf OpenSeq2Seq
cd decod... | [
"torch.log_softmax",
"ctc_decoders.ctc_beam_search_decoder_batch",
"numpy.max",
"ctc_decoders.Scorer",
"torch.no_grad",
"numpy.zeros_like",
"torch.randn",
"torch.IntTensor"
] | [((859, 874), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (872, 874), False, 'import torch\n'), ((2354, 2403), 'torch.randn', 'torch.randn', (['(2, 1000, 4334)'], {'dtype': 'torch.float32'}), '((2, 1000, 4334), dtype=torch.float32)\n', (2365, 2403), False, 'import torch\n'), ((1119, 1329), 'ctc_decoders.ctc_bea... |
import pytest
import os
import toml
from tempfile import gettempdir
import neo.libs.login
from neo.libs import login
class TestLogin:
def test_check_env(self, fs):
home = os.path.expanduser("~")
fs.create_file(os.path.join(home, ".neo", "config.toml"))
assert login.check_env()
def fa... | [
"os.path.exists",
"neo.libs.login.check_session",
"neo.libs.login.check_env",
"os.path.join",
"toml.loads",
"tempfile.gettempdir",
"neo.libs.login.get_env_values",
"neo.libs.login.do_logout",
"neo.libs.login.is_current_env",
"os.path.expanduser"
] | [((186, 209), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (204, 209), False, 'import os\n'), ((291, 308), 'neo.libs.login.check_env', 'login.check_env', ([], {}), '()\n', (306, 308), False, 'from neo.libs import login\n'), ((1121, 1139), 'toml.loads', 'toml.loads', (['config'], {}), '(conf... |
import os
from SSHLibrary import SSHLibrary
from constants import (
HPC_IP,
HPC_USERNAME,
HPC_KEY_PATH,
HPC_HOME_PATH,
)
# The Service broker will use the SSHCommunication class
# to communicate with the HPC environment
# This is just a dummy implementation
# TODO: Improve the code and implement app... | [
"os.path.isfile",
"os.path.exists",
"SSHLibrary.SSHLibrary"
] | [((464, 476), 'SSHLibrary.SSHLibrary', 'SSHLibrary', ([], {}), '()\n', (474, 476), False, 'from SSHLibrary import SSHLibrary\n'), ((492, 520), 'os.path.exists', 'os.path.exists', (['HPC_KEY_PATH'], {}), '(HPC_KEY_PATH)\n', (506, 520), False, 'import os\n'), ((528, 556), 'os.path.isfile', 'os.path.isfile', (['HPC_KEY_PA... |
import random
from PIL import Image
def roll_dice():
return random.randint(1, 6)
def potential_moves():
duplicated_moves = []
for i in range(1, 7):
for j in range(1, 7):
duplicated_moves.append(i*j)
valid_moves = sorted(set(duplicated_moves))
return valid_moves
if __name__ ... | [
"PIL.Image.open",
"random.randint"
] | [((65, 85), 'random.randint', 'random.randint', (['(1)', '(6)'], {}), '(1, 6)\n', (79, 85), False, 'import random\n'), ((2186, 2226), 'PIL.Image.open', 'Image.open', (['"""templates/actual_board.jpg"""'], {}), "('templates/actual_board.jpg')\n", (2196, 2226), False, 'from PIL import Image\n'), ((2277, 2309), 'PIL.Image... |
# pylint: disable=no-name-in-module,import-error
"""
Copyright 2017-2018 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required ... | [
"os.path.dirname",
"setuptools.find_packages",
"os.getenv",
"sys.exit"
] | [((1756, 1777), 'os.getenv', 'os.getenv', (['"""CIRCLECI"""'], {}), "('CIRCLECI')\n", (1765, 1777), False, 'import os\n'), ((2512, 2565), 'setuptools.find_packages', 'find_packages', ([], {'include': "['icetea_lib.*', 'icetea_lib']"}), "(include=['icetea_lib.*', 'icetea_lib'])\n", (2525, 2565), False, 'from setuptools ... |
# -*- coding: utf-8 -*-
"""
tests.middlwares.test_session
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests session middleware
:copyright: (c) 2015 by <NAME>.
:license: BSD, see LICENSE for more details.
"""
from anillo.middlewares.default_headers import wrap_default_headers
from anillo.http.request import Req... | [
"anillo.middlewares.default_headers.wrap_default_headers",
"anillo.http.responses.Response",
"anillo.http.request.Request"
] | [((371, 457), 'anillo.middlewares.default_headers.wrap_default_headers', 'wrap_default_headers', (["{'in-test': 'in-test-value'}", "{'out-test': 'out-test-value'}"], {}), "({'in-test': 'in-test-value'}, {'out-test':\n 'out-test-value'})\n", (391, 457), False, 'from anillo.middlewares.default_headers import wrap_defa... |
from .models import Signal
from rest_framework import viewsets
from dashboard.quickstart.serializers import SignalSerializer
from django.utils import timezone
class SignalViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows Signal to be viewed or edited.
"""
queryset = Signal.objects.filter(
... | [
"django.utils.timezone.now"
] | [((353, 367), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (365, 367), False, 'from django.utils import timezone\n')] |
import socket
import constants
import serial
import time
from datetime import date, datetime
import errno
import select
from socket import error as socket_error
print("======================================")
print("Setting up Serial between Raspberry Pi and Leonardo.")
ser = serial.Serial(constants.SERIAL_PORT, const... | [
"select.select",
"socket.socket",
"time.sleep",
"datetime.datetime.now",
"serial.Serial"
] | [((278, 341), 'serial.Serial', 'serial.Serial', (['constants.SERIAL_PORT', 'constants.SERIAL_BUADRATE'], {}), '(constants.SERIAL_PORT, constants.SERIAL_BUADRATE)\n', (291, 341), False, 'import serial\n'), ((607, 655), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, soc... |
from collections import namedtuple
# From pyenv.git/pylib/sr/vision.py
MARKER_ARENA, MARKER_ROBOT, MARKER_PEDESTAL, MARKER_TOKEN = range(4)
marker_offsets = {
MARKER_ARENA: 0,
MARKER_ROBOT: 28,
MARKER_PEDESTAL: 32,
MARKER_TOKEN: 41
}
marker_sizes = {
MARKER_ARENA: 0.25 * (10.0/12),
MARKER_ROB... | [
"collections.namedtuple"
] | [((448, 504), 'collections.namedtuple', 'namedtuple', (['"""MarkerInfo"""', '"""code marker_type offset size"""'], {}), "('MarkerInfo', 'code marker_type offset size')\n", (458, 504), False, 'from collections import namedtuple\n'), ((821, 861), 'collections.namedtuple', 'namedtuple', (['"""PolarCoord"""', '"""length ro... |
"""
Utility functions
"""
from datetime import datetime, timezone
def parse_date_string(date: str) -> datetime:
"""Converts date as string (e.g. "2004-05-25T02:19:28Z") to UNIX timestamp (uses UTC, always)
"""
# https://docs.python.org/3.6/library/datetime.html#strftime-strptime-behavior
# http://strf... | [
"datetime.datetime.strptime"
] | [((343, 388), 'datetime.datetime.strptime', 'datetime.strptime', (['date', '"""%Y-%m-%dT%H:%M:%SZ"""'], {}), "(date, '%Y-%m-%dT%H:%M:%SZ')\n", (360, 388), False, 'from datetime import datetime, timezone\n')] |
def obfuscate(utils_path, project_path):
import subprocess
print('Running obfuscator ...')
subprocess.run(f'{utils_path}/confuser/Confuser.CLI.exe {project_path} -n')
| [
"subprocess.run"
] | [((104, 179), 'subprocess.run', 'subprocess.run', (['f"""{utils_path}/confuser/Confuser.CLI.exe {project_path} -n"""'], {}), "(f'{utils_path}/confuser/Confuser.CLI.exe {project_path} -n')\n", (118, 179), False, 'import subprocess\n')] |
# -*- coding: utf-8 -*-
#@+leo-ver=5-thin
#@+node:ekr.20201129023817.1: * @file leoTest2.py
#@@first
"""
Support for Leo's new unit tests, contained in leo/unittests/test_*.py.
Run these tests using unittest or pytest from the command line.
See g.run_unit_tests and g.run_coverage_tests.
This file also contains classe... | [
"leo.core.leoNodes.NodeIndices",
"leo.core.leoApp.LoadManager",
"leo.core.leoApp.LeoApp",
"leo.core.leoApp.RecentFilesManager",
"leo.core.leoCommands.Commands",
"leo.core.leoGui.NullGui",
"leo.core.leoGlobals.trace",
"leo.plugins.qt_gui.LeoQtGui",
"leo.core.leoConfig.GlobalConfigManager",
"leo.cor... | [((899, 918), 'time.process_time', 'time.process_time', ([], {}), '()\n', (916, 918), False, 'import time\n'), ((1099, 1114), 'leo.core.leoApp.LeoApp', 'leoApp.LeoApp', ([], {}), '()\n', (1112, 1114), False, 'from leo.core import leoApp\n'), ((1363, 1382), 'time.process_time', 'time.process_time', ([], {}), '()\n', (13... |
from setuptools import setup, find_packages
exec(open('counsyl_pyads/version.py').read())
setup(
name='counsyl-pyads',
version=__version__,
packages=find_packages(),
scripts=['bin/twincat_plc_info.py'],
include_package_data=True,
zip_safe=False,
author='<NAME>.',
author_email='<EMAIL>'... | [
"setuptools.find_packages"
] | [((163, 178), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (176, 178), False, 'from setuptools import setup, find_packages\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pykg2vec.core.KGMeta import ModelMeta, InferenceMeta
class RotatE(ModelMeta, InferenceMeta):
""" `Rotate-Knowledge graph embeddi... | [
"tensorflow.nn.embedding_lookup",
"tensorflow.shape",
"tensorflow.reduce_sum",
"tensorflow.placeholder",
"tensorflow.nn.top_k",
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.sqrt",
"tensorflow.name_scope",
"tensorflow.maximum",
"tensorflow.expand_dims",
"tensorflow.sin",
"tensorf... | [((2303, 2335), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {}), '(tf.int32, [None])\n', (2317, 2335), True, 'import tensorflow as tf\n'), ((2357, 2389), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32', '[None]'], {}), '(tf.int32, [None])\n', (2371, 2389), True, 'import tensorflow as t... |
from __future__ import with_statement
from fabric.api import run, parallel, env, hide
from utils import FabricTest, eq_
from server import server, RESPONSES
class TestParallel(FabricTest):
@server()
@parallel
def test_parallel(self):
"""
Want to do a simple call and respond
"""
... | [
"fabric.api.run",
"server.server",
"fabric.api.hide"
] | [((199, 207), 'server.server', 'server', ([], {}), '()\n', (205, 207), False, 'from server import server, RESPONSES\n'), ((387, 405), 'fabric.api.hide', 'hide', (['"""everything"""'], {}), "('everything')\n", (391, 405), False, 'from fabric.api import run, parallel, env, hide\n'), ((423, 431), 'fabric.api.run', 'run', ... |
from datetime import datetime, date, timedelta
import pandas as pd
import networkx as nx
from itertools import combinations
import numpy as np
class TeamworkStudyRunner:
def __init__(self, notes, window_in_days, step_in_days):
notes.sort_values('date', inplace=True)
self.notes = notes
sel... | [
"numpy.timedelta64",
"itertools.combinations",
"networkx.Graph",
"numpy.arange"
] | [((330, 365), 'numpy.timedelta64', 'np.timedelta64', (['window_in_days', '"""D"""'], {}), "(window_in_days, 'D')\n", (344, 365), True, 'import numpy as np\n'), ((386, 419), 'numpy.timedelta64', 'np.timedelta64', (['step_in_days', '"""D"""'], {}), "(step_in_days, 'D')\n", (400, 419), True, 'import numpy as np\n'), ((533... |
# nodenet/utilities/commons.py
# Description:
# "commons.py" provide commons utilities that can be use widely.
# Copyright 2018 NOOXY. All Rights Reserved.
from nodenet.imports.commons import *
import numpy as np2
# np2 for cupy compabable
def cut_dataset_by_ratio_ramdom(datasets, cut_ratio = 0.1):
dimension = le... | [
"numpy.delete"
] | [((1010, 1047), 'numpy.delete', 'np2.delete', (['input_data', 'index'], {'axis': '(0)'}), '(input_data, index, axis=0)\n', (1020, 1047), True, 'import numpy as np2\n'), ((1070, 1108), 'numpy.delete', 'np2.delete', (['output_data', 'index'], {'axis': '(0)'}), '(output_data, index, axis=0)\n', (1080, 1108), True, 'import... |
"""
Configuration file for the Sphinx documentation builder.
This file only contains a selection of the most common options. For a full
list see the documentation:
http://www.sphinx-doc.org/en/master/config
"""
# pylint: disable=import-error, invalid-name, redefined-builtin
import datetime as dt
import sphinx_rtd_th... | [
"datetime.datetime.now"
] | [((925, 942), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '()\n', (940, 942), True, 'import datetime as dt\n')] |
import tensorflow as tf
import csv
import time
from datetime import timedelta
import sys
import numpy as np
from tensorflow.python.training import training_util
from tensorflow.contrib import slim
from tensorflow.python.ops import variables as tf_variables
from ..configuration import *
from .. import trainer, evaluator... | [
"tensorflow.cast",
"logging.getLogger",
"tensorflow.python.training.training_util.get_or_create_global_step",
"tensorflow.check_numerics",
"tensorflow.Variable",
"tensorflow.train.Saver",
"numpy.sum",
"tensorflow.control_dependencies",
"tensorflow.assign_add",
"time.time",
"tensorflow.python.ops... | [((769, 842), 'csv.reader', 'csv.reader', (['file'], {'delimiter': '""","""', 'quotechar': '"""\\""""', 'quoting': 'csv.QUOTE_MINIMAL'}), '(file, delimiter=\',\', quotechar=\'"\', quoting=csv.QUOTE_MINIMAL)\n', (779, 842), False, 'import csv\n'), ((1423, 1439), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\... |
import click
from retrieval.elastic_retriever import ElasticRetriever
import os
@click.command()
@click.option('--sections-parquet', type=str, help='', default='')
@click.option('--documents-parquet', type=str, help='', default='')
@click.option('--tables-parquet', type=str, help='', default='')
@click.option('--figur... | [
"click.option",
"click.command",
"retrieval.elastic_retriever.ElasticRetriever",
"os.environ.get"
] | [((82, 97), 'click.command', 'click.command', ([], {}), '()\n', (95, 97), False, 'import click\n'), ((99, 164), 'click.option', 'click.option', (['"""--sections-parquet"""'], {'type': 'str', 'help': '""""""', 'default': '""""""'}), "('--sections-parquet', type=str, help='', default='')\n", (111, 164), False, 'import cl... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import numpy as np
import tqdm
from data import dataset as dset
import torchvision.models as tmodels
import tqdm
from models import models
import os
import itertools
import glob
from utils import utils
import torch.backend... | [
"data.dataset.CompositionDatasetActivations",
"models.models.Evaluator",
"argparse.ArgumentParser",
"models.models.VisualProductNN",
"torch.load",
"models.models.LabelEmbedPlus",
"models.models.AttributeOperator",
"models.models.RedWine",
"os.path.basename",
"torch.utils.data.DataLoader",
"torch... | [((386, 411), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (409, 411), False, 'import argparse\n'), ((2913, 3015), 'data.dataset.CompositionDatasetActivations', 'dset.CompositionDatasetActivations', ([], {'root': 'args.data_dir', 'phase': '"""test"""', 'split': '"""compositional-split"""'}), ... |
# -*- coding: utf-8 -*-
from flask_restful import Api
from resources.person import PersonResource
from resources.company import CompanyResource
#Define app end points
def get_endpoints(app):
api = Api(app)
api.add_resource(PersonResource,'/people','/people/<string:username>')
api.add_resource(CompanyResou... | [
"flask_restful.Api"
] | [((203, 211), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (206, 211), False, 'from flask_restful import Api\n')] |
# Notes
# This module not really designed for general purpose use. I wrote this as a study mechanism for
# decomposition algorithms. The codes are not well tested and may be naive.
#
# lapack working notes at http://www.netlib.org/lapack/lawns/
import pyJvsip as pv
def eye(t,n):
"""
Usage: I=eye(t,n)
cre... | [
"pyJvsip.vsip_sqrt_d",
"pyJvsip.vsip_mag_d",
"pyJvsip.create",
"pyJvsip.vsip_hypot_d"
] | [((420, 438), 'pyJvsip.create', 'pv.create', (['t', 'n', 'n'], {}), '(t, n, n)\n', (429, 438), True, 'import pyJvsip as pv\n'), ((740, 771), 'pyJvsip.vsip_hypot_d', 'pv.vsip_hypot_d', (['a.real', 'a.imag'], {}), '(a.real, a.imag)\n', (755, 771), True, 'import pyJvsip as pv\n'), ((3057, 3080), 'pyJvsip.vsip_hypot_d', 'p... |
# Copyright 2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"json.loads",
"json.dumps",
"tripleo_common_tempest_plugin.services.base.get_resource"
] | [((1340, 1355), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj)\n', (1350, 1355), False, 'import json\n'), ((1549, 1577), 'tripleo_common_tempest_plugin.services.base.get_resource', 'base.get_resource', (['file_name'], {}), '(file_name)\n', (1566, 1577), False, 'from tripleo_common_tempest_plugin.services import base... |
"""
This module defines functions that are called on a django signal such as post_migrate.
"""
from serverside import utils
def create_permissions_and_grant_privileges(*args, **kwargs):
"""
Creates database permissions to assign to a user.
Creates django permissions that reflect what a corresponding dat... | [
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.contrib.auth.models.Permission.objects.update_or_create",
"serverside.utils.get_permission_codename",
"django.contrib.contenttypes.models.ContentType.objects.clear_cache",
"serverside.utils.get_all_models",
"serverside.models.... | [((990, 1023), 'django.contrib.contenttypes.models.ContentType.objects.clear_cache', 'ContentType.objects.clear_cache', ([], {}), '()\n', (1021, 1023), False, 'from django.contrib.contenttypes.models import ContentType\n'), ((1038, 1071), 'serverside.utils.get_all_models', 'utils.get_all_models', (['(True)', '(False)']... |
""""""
from scipy import misc
import time
img = 'IMG-20200828-WA0022.'
output0 = img+'..png'
output1 = img+'...png'
img+='jpg'
input0 = misc.imread(img)
input1 = misc.imread(img)
l = input0.shape[0]
c = input1.shape[1]
print('\n %d x %d [%d] \n' %(l, c, (l*c)))
start = time.time()
for x in range(l):
#print(x,end=... | [
"scipy.misc.imsave",
"scipy.misc.imread",
"time.time"
] | [((138, 154), 'scipy.misc.imread', 'misc.imread', (['img'], {}), '(img)\n', (149, 154), False, 'from scipy import misc\n'), ((164, 180), 'scipy.misc.imread', 'misc.imread', (['img'], {}), '(img)\n', (175, 180), False, 'from scipy import misc\n'), ((275, 286), 'time.time', 'time.time', ([], {}), '()\n', (284, 286), Fals... |
'''
Bandidos estocásticos: introducción, algoritmos y experimentos
TFG Informática
Sección 4.2
Figura 1
Autor: <NAME>
'''
import random
import sympy.stats as stats
import matplotlib.pyplot as plt
def randomPolicy(n,machines):
chosen = n*[-1]
totalrwd = 0
for i in range(n):
chosen[i] = rando... | [
"sympy.stats.sample",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((1943, 1977), 'matplotlib.pyplot.plot', 'plt.plot', (['regret'], {'color': '"""tab:blue"""'}), "(regret, color='tab:blue')\n", (1951, 1977), True, 'import matplotlib.pyplot as plt\n'), ((2111, 2143), 'matplotlib.pyplot.plot', 'plt.plot', (['regret'], {'color': '"""orange"""'}), "(regret, color='orange')\n", (2119, 21... |
import re
from datetime import date
import tagging
from ckeditor.fields import RichTextField
from django.core import validators
from django.core.urlresolvers import reverse
from django.db import models
from django.template.defaultfilters import truncatechars
from django.utils import timezone
from django.conf import set... | [
"django.db.models.DateField",
"django.template.defaultfilters.truncatechars",
"django.db.models.TextField",
"django.db.models.IntegerField",
"ckeditor.fields.RichTextField",
"django.core.urlresolvers.reverse",
"files_widget.ImageField",
"django.db.models.ForeignKey",
"django.db.models.DateTimeField"... | [((4629, 4682), 'tagging.register', 'tagging.register', (['News'], {'tag_descriptor_attr': '"""tag_set"""'}), "(News, tag_descriptor_attr='tag_set')\n", (4645, 4682), False, 'import tagging\n'), ((5520, 5574), 'tagging.register', 'tagging.register', (['Event'], {'tag_descriptor_attr': '"""tag_set"""'}), "(Event, tag_de... |
from ..util.NameSearchDto import NameSearchDto
from ..util.envNames import VERSION, UPLOAD_FOLDER, path
from ..service.LogService import updateDelete, saveLog, getByPublicId
from ..service.languageBuilder import LanguageBuilder
from ..service.CreateDocumentHan... | [
"flask.send_from_directory",
"os.path.join"
] | [((2060, 2102), 'os.path.join', 'os.path.join', (['path', 'evaluator.fakeFilename'], {}), '(path, evaluator.fakeFilename)\n', (2072, 2102), False, 'import os\n'), ((2140, 2177), 'os.path.join', 'os.path.join', (['path', 'nameOfNewDocument'], {}), '(path, nameOfNewDocument)\n', (2152, 2177), False, 'import os\n'), ((855... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Test Tango device server for use with scaling tests."""
import argparse
import time
import tango
def delete_server():
"""."""
db = tango.Database()
server = 'TestDeviceServer/1'
server_list = list(db.get_server_list(server))
if server in server_... | [
"argparse.ArgumentParser",
"time.time",
"tango.DbDevInfo",
"tango.Database"
] | [((192, 208), 'tango.Database', 'tango.Database', ([], {}), '()\n', (206, 208), False, 'import tango\n'), ((525, 541), 'tango.Database', 'tango.Database', ([], {}), '()\n', (539, 541), False, 'import tango\n'), ((1050, 1066), 'tango.Database', 'tango.Database', ([], {}), '()\n', (1064, 1066), False, 'import tango\n'), ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 27 15:16:34 2021
@author: ag
"""
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Ellipse
import matplotlib.transforms as transforms
import re
def confidence_ellipse(x, y, n_std=1.0, weights=None, ax=None, facecolor='none', **kwargs):
... | [
"numpy.mean",
"numpy.all",
"numpy.sqrt",
"matplotlib.pyplot.gca",
"numpy.argsort",
"numpy.array",
"numpy.sum",
"numpy.cov",
"matplotlib.transforms.Affine2D",
"numpy.cumsum",
"numpy.interp",
"re.sub",
"matplotlib.patches.Ellipse"
] | [((1466, 1486), 'numpy.sqrt', 'np.sqrt', (['(1 + pearson)'], {}), '(1 + pearson)\n', (1473, 1486), True, 'import numpy as np\n'), ((1506, 1526), 'numpy.sqrt', 'np.sqrt', (['(1 - pearson)'], {}), '(1 - pearson)\n', (1513, 1526), True, 'import numpy as np\n'), ((1541, 1674), 'matplotlib.patches.Ellipse', 'Ellipse', (['(0... |
import re
from flask import request
from flask_wtf import FlaskForm
from flask_wtf.file import FileAllowed, FileField
from wtforms import (HiddenField, IntegerField, SelectField, StringField,
SubmitField, TextAreaField)
from wtforms.validators import (DataRequired, Length, NumberRange, Optional,
... | [
"wtforms.validators.NumberRange",
"wtforms.validators.ValidationError",
"flask_wtf.file.FileAllowed",
"wtforms.SubmitField",
"wtforms.StringField",
"wtforms.validators.Optional",
"wtforms.validators.Length",
"re.sub",
"wtforms.validators.DataRequired"
] | [((850, 882), 're.sub', 're.sub', (['"""[-–—\\\\s]"""', '""""""', 'isbn_val'], {}), "('[-–—\\\\s]', '', isbn_val)\n", (856, 882), False, 'import re\n'), ((1326, 1358), 're.sub', 're.sub', (['"""[-–—\\\\s]"""', '""""""', 'isbn_val'], {}), "('[-–—\\\\s]', '', isbn_val)\n", (1332, 1358), False, 'import re\n'), ((2851, 287... |
import sqlite3
connection=sqlite3.connect('customer.db')
cur=connection.cursor()
#create a table
cur.execute(""" CREATE TABLE customers (
first_name text,
last_name text,
email text
)
""")
#commit our command
connection.commit()
#close our connection
connection.close() | [
"sqlite3.connect"
] | [((31, 61), 'sqlite3.connect', 'sqlite3.connect', (['"""customer.db"""'], {}), "('customer.db')\n", (46, 61), False, 'import sqlite3\n')] |
from django.contrib.auth.models import AbstractUser
from django.urls import reverse
from django.db import models
class User(AbstractUser):
# First Name and Last Name do not cover all name patterns
name = models.CharField(verbose_name='Name of User', blank=True, max_length=255)
class Meta:
app_la... | [
"django.db.models.CharField",
"django.urls.reverse"
] | [((215, 288), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""Name of User"""', 'blank': '(True)', 'max_length': '(255)'}), "(verbose_name='Name of User', blank=True, max_length=255)\n", (231, 288), False, 'from django.db import models\n'), ((435, 494), 'django.urls.reverse', 'reverse', (['"... |
import sys
import numpy as np
rng = np.random.default_rng()
# dt = np.dtype('i,i,i,i,i,i,i,i,i,i,U16,U16,U16,U16,f,f,f,f,f,f,f,f')
nrows = 2000000
filename = 'data/bigmixed.csv'
print("Generating {}".format(filename))
with open(filename, 'w') as f:
for k in range(nrows):
values1 = rng.integers(1, 1000... | [
"sys.stdout.flush",
"numpy.random.default_rng"
] | [((39, 62), 'numpy.random.default_rng', 'np.random.default_rng', ([], {}), '()\n', (60, 62), True, 'import numpy as np\n'), ((723, 741), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (739, 741), False, 'import sys\n')] |
#!/usr/bin/env python3
import argparse
import re
import sys
import zipfile
import numpy as np
import bert_wrapper
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("input_conllu", type=str, help="Input CoNLL-U file")
parser.add_argument("output_npz", type=str, help="Output... | [
"zipfile.ZipFile",
"argparse.ArgumentParser",
"bert_wrapper.BertWrapper",
"re.match",
"numpy.save"
] | [((157, 182), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (180, 182), False, 'import argparse\n'), ((1946, 2147), 'bert_wrapper.BertWrapper', 'bert_wrapper.BertWrapper', ([], {'language': 'args.language', 'size': 'args.size', 'casing': 'args.casing', 'layer_indices': 'args.layer_indices', 'w... |
from django.conf.urls import url
from django.contrib import admin
from blog.views import *
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', home),
url(r'^about/', about),
url(r'^kontak/', kontak),
url(r'^blog/', blog),
]
| [
"django.conf.urls.url"
] | [((119, 150), 'django.conf.urls.url', 'url', (['"""^admin/"""', 'admin.site.urls'], {}), "('^admin/', admin.site.urls)\n", (122, 150), False, 'from django.conf.urls import url\n'), ((158, 173), 'django.conf.urls.url', 'url', (['"""^$"""', 'home'], {}), "('^$', home)\n", (161, 173), False, 'from django.conf.urls import ... |
import sys, math, numpy, struct
import matplotlib.pyplot as plt
class readBinaryModels(object):
'''Class for reading binary models'''
def __init__(self, fil):
'''Initialize'''
super(readBinaryModels, self).__init__()
self.fread = open(fil, "rb")
self.head = None
self.m... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.array",
"struct.unpack",
"matplotlib.pyplot.ylim",
"math.log10",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.show"
] | [((7333, 7343), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (7341, 7343), True, 'import matplotlib.pyplot as plt\n'), ((6152, 6172), 'numpy.array', 'numpy.array', (['evolEps'], {}), '(evolEps)\n', (6163, 6172), False, 'import sys, math, numpy, struct\n'), ((6204, 6224), 'numpy.array', 'numpy.array', (['evol... |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
"""This config file is for running experiments for the EMNLP camera ready.
It will generate the following experiments (depending on the value of eval_split and model):
- 200 dev examples
- GPT-3 Constrained Canonical, P = 20
- GPT-3 Constraine... | [
"semantic_parsing_with_constrained_lm.domains.calflow.CalflowMetrics",
"semantic_parsing_with_constrained_lm.configs.lib.calflow.cached_read_calflow_jsonl",
"semantic_parsing_with_constrained_lm.eval.TopKExactMatch",
"torch.cuda.is_available",
"semantic_parsing_with_constrained_lm.lm_openai_gpt3.Incremental... | [((2305, 2331), 'semantic_parsing_with_constrained_lm.scfg.scfg.SCFG', 'SCFG', (['preprocessed_grammar'], {}), '(preprocessed_grammar)\n', (2309, 2331), False, 'from semantic_parsing_with_constrained_lm.scfg.scfg import SCFG\n'), ((4792, 4959), 'semantic_parsing_with_constrained_lm.configs.lib.calflow.make_semantic_par... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\conta\Documents\script\Wizard\App\gui\ui_files\chat.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QPushBut... | [((7788, 7820), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['sys.argv'], {}), '(sys.argv)\n', (7810, 7820), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((7832, 7851), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', ([], {}), '()\n', (7849, 7851), False, 'from PyQt5 import QtCore, QtGui, QtWi... |
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import PolynomialFeatures
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.pipeline import make_pipeline
import matplotlib.pyplot as plt
import numpy as np
import random
#=================================================... | [
"sklearn.preprocessing.PolynomialFeatures",
"numpy.asarray",
"matplotlib.pyplot.scatter",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.show"
] | [((1680, 1696), 'numpy.asarray', 'np.asarray', (['days'], {}), '(days)\n', (1690, 1696), True, 'import numpy as np\n'), ((1705, 1722), 'numpy.asarray', 'np.asarray', (['cases'], {}), '(cases)\n', (1715, 1722), True, 'import numpy as np\n'), ((1782, 1806), 'matplotlib.pyplot.scatter', 'plt.scatter', (['days', 'cases'], ... |
import pandas as pd
from fastapi import APIRouter
# Define Router
router = APIRouter()
data_url = "https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv"
data = None
@router.get("/get_data")
async def get_data():
global data
if data is None:
data = pd.read_csv(data_url)... | [
"fastapi.APIRouter",
"pandas.read_csv"
] | [((77, 88), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (86, 88), False, 'from fastapi import APIRouter\n'), ((299, 320), 'pandas.read_csv', 'pd.read_csv', (['data_url'], {}), '(data_url)\n', (310, 320), True, 'import pandas as pd\n')] |
# Generated by Django 4.0.1 on 2022-01-16 16:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0004_user_rating'),
]
operations = [
migrations.AddField(
model_name='user',
name='banned',
fie... | [
"django.db.models.BooleanField"
] | [((323, 357), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (342, 357), False, 'from django.db import migrations, models\n')] |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.context.set_context",
"numpy.array",
"scipy.stats.poisson",
"mindspore.nn.probability.distribution.Poisson",
"mindspore.Tensor"
] | [((924, 992), 'mindspore.context.set_context', 'context.set_context', ([], {'mode': 'context.GRAPH_MODE', 'device_target': '"""Ascend"""'}), "(mode=context.GRAPH_MODE, device_target='Ascend')\n", (943, 992), True, 'import mindspore.context as context\n'), ((1334, 1355), 'scipy.stats.poisson', 'stats.poisson', ([], {'mu... |
#Dependencies
from googlesearch import search
import sys
#Variables
args = sys.argv
#Main
if len(args) == 1:
print("python index.py <keyword> <amount> <output>")
sys.exit()
if len(args) == 2:
print("Invalid amount.")
sys.exit()
if len(args) == 3:
print("Invalid output.")
sys.exit()
... | [
"sys.exit"
] | [((172, 182), 'sys.exit', 'sys.exit', ([], {}), '()\n', (180, 182), False, 'import sys\n'), ((240, 250), 'sys.exit', 'sys.exit', ([], {}), '()\n', (248, 250), False, 'import sys\n'), ((308, 318), 'sys.exit', 'sys.exit', ([], {}), '()\n', (316, 318), False, 'import sys\n'), ((394, 404), 'sys.exit', 'sys.exit', ([], {}),... |
from RPi import GPIO
from time import sleep
# clk = 17
# dt = 18
sw = 24
clk = 12
dt = 25
GPIO.setmode(GPIO.BCM)
GPIO.setup(clk, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(dt, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(sw, GPIO.IN, pull_up_down=GPIO.PUD_UP)
counter = 0
clkLastState = GPIO.input(clk)
try:... | [
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.input",
"RPi.GPIO.setmode"
] | [((93, 115), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (105, 115), False, 'from RPi import GPIO\n'), ((116, 168), 'RPi.GPIO.setup', 'GPIO.setup', (['clk', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_DOWN'}), '(clk, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)\n', (126, 168), False, 'from RPi import GPI... |
# ------------------------------------------------------------
# Copyright (c) 2017-present, SeetaTech, Co.,Ltd.
#
# Licensed under the BSD 2-Clause License.
# You should have received a copy of the BSD 2-Clause License
# along with the software. If not, See,
#
# <https://opensource.org/licenses/BSD-2-Clause>
#
# ... | [
"dragon.vm.tensorflow.framework.ops.add_to_collection",
"dragon.vm.tensorflow.framework.ops._DefaultStack",
"dragon.vm.tensorflow.ops.init_ops.zeros_initializer",
"dragon.vm.tensorflow.framework.ops.get_collection",
"dragon.get_default_name_scope",
"dragon.name_scope",
"dragon.vm.tensorflow.ops.init_ops... | [((6029, 6044), 'dragon.vm.tensorflow.framework.ops._DefaultStack', '_DefaultStack', ([], {}), '()\n', (6042, 6044), False, 'from dragon.vm.tensorflow.framework.ops import _DefaultStack\n'), ((5350, 5382), 'dragon.name_scope', 'dragon.name_scope', (['name_or_scope'], {}), '(name_or_scope)\n', (5367, 5382), False, 'impo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 7/20/20 8:07 PM
# @Author : anonymous
# @File : Mutation_equal.py
#TODO:integrate transformation rules
import re
import random
import mutation.gateCirq_EqualT as MC
import mutation.gateQiskit_EqualT as MQ
import mutation.gatePyQuil_EqualT as MP
def figur... | [
"re.compile",
"mutation.gatePyQuil_EqualT.two_CNOT",
"mutation.gatePyQuil_EqualT.two_X",
"mutation.gateCirq_EqualT.cnot_to_hczh",
"mutation.gatePyQuil_EqualT.cnot_to_hczh",
"mutation.gateCirq_EqualT.two_CNOT",
"mutation.gateQiskit_EqualT.z_to_cnotzcnot",
"mutation.gatePyQuil_EqualT.z_to_cnotzcnot",
... | [((623, 650), 're.compile', 're.compile', (['"""# circuit end"""'], {}), "('# circuit end')\n", (633, 650), False, 'import re\n'), ((733, 784), 're.compile', 're.compile', (["('../data/' + address_in[13:-3] + '.csv')"], {}), "('../data/' + address_in[13:-3] + '.csv')\n", (743, 784), False, 'import re\n'), ((808, 837), ... |
import functools
import os
from fase_lib.base_util import singleton_util
TEMPLATE_SYMBOL = '@'
PIXEL_DENSITY_STEP = 0.25
PIXEL_DENSITY_MIN = 0
PIXEL_DENSITY_MAX = 10
@singleton_util.Singleton()
class ResourceManager():
def __init__(self, resource_dir):
self.resource_dir = resource_dir
def GetResourceDir(s... | [
"os.path.join",
"functools.lru_cache",
"fase_lib.base_util.singleton_util.Singleton"
] | [((171, 197), 'fase_lib.base_util.singleton_util.Singleton', 'singleton_util.Singleton', ([], {}), '()\n', (195, 197), False, 'from fase_lib.base_util import singleton_util\n'), ((359, 404), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None', 'typed': '(True)'}), '(maxsize=None, typed=True)\n', (378,... |
from IA.model import model
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import logging
import json
TOKEN = json.load(open('telegram_bot/token.json'))['token']
updater = Updater(token=TOKEN, use_context=True)
dispatcher = updater.dispatcher
logging.basicConfig(format='%(asctime)s - %(name... | [
"logging.basicConfig",
"IA.model.model.predict",
"telegram.ext.MessageHandler",
"telegram.ext.CommandHandler",
"telegram.ext.Updater"
] | [((200, 238), 'telegram.ext.Updater', 'Updater', ([], {'token': 'TOKEN', 'use_context': '(True)'}), '(token=TOKEN, use_context=True)\n', (207, 238), False, 'from telegram.ext import Updater, CommandHandler, MessageHandler, Filters\n'), ((272, 379), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asc... |
"""Tabular iterators."""
from typing import Optional
from typing import Tuple
from typing import Union
from typing import cast
import cupy as cp
from lightautoml.dataset.gpu.gpu_dataset import CupyDataset
from lightautoml.dataset.gpu.gpu_dataset import CudfDataset
from lightautoml.dataset.gpu.gpu_dataset import Dask... | [
"lightautoml.validation.base.DummyIterator",
"cupy.arange",
"lightautoml.validation.base.CustomIterator",
"lightautoml.validation.base.HoldoutIterator",
"cupy.logical_not",
"typing.cast"
] | [((3087, 3110), 'cupy.logical_not', 'cp.logical_not', (['val_idx'], {}), '(val_idx)\n', (3101, 3110), True, 'import cupy as cp\n'), ((3125, 3155), 'cupy.arange', 'cp.arange', (['self.train.shape[0]'], {}), '(self.train.shape[0])\n', (3134, 3155), True, 'import cupy as cp\n'), ((4011, 4034), 'cupy.logical_not', 'cp.logi... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from nltk.tokenize import TweetTokenizer
from nltk.stem.snowball import SnowballStemmer
import numpy as np
from collections import defaultdict,Counter
import logging as logger
from nortok.stopwords import get_norwegian_stopwords
import pickle
import gzip
def dd_def():
... | [
"nltk.tokenize.TweetTokenizer",
"pickle.dump",
"gzip.open",
"pickle.load",
"collections.Counter",
"nltk.stem.snowball.SnowballStemmer",
"numpy.zeros",
"collections.defaultdict",
"nortok.stopwords.get_norwegian_stopwords"
] | [((494, 503), 'collections.Counter', 'Counter', ([], {}), '()\n', (501, 503), False, 'from collections import defaultdict, Counter\n'), ((533, 552), 'collections.defaultdict', 'defaultdict', (['dd_def'], {}), '(dd_def)\n', (544, 552), False, 'from collections import defaultdict, Counter\n'), ((1159, 1178), 'collections... |
from django import template
from django.utils.translation import pgettext
from django.templatetags.static import static
from django.template.defaultfilters import safe, truncatechars
register = template.Library()
@register.filter()
def safe_truncate(string, arg):
return truncatechars(safe(string), arg) | [
"django.template.defaultfilters.safe",
"django.template.Library"
] | [((195, 213), 'django.template.Library', 'template.Library', ([], {}), '()\n', (211, 213), False, 'from django import template\n'), ((292, 304), 'django.template.defaultfilters.safe', 'safe', (['string'], {}), '(string)\n', (296, 304), False, 'from django.template.defaultfilters import safe, truncatechars\n')] |
import numpy.testing as test
import numpy as np
from unittest import TestCase
from PyFVCOM.ocean import *
class OceanToolsTest(TestCase):
def setUp(self):
""" Make a set of data for the various ocean tools functions """
self.lat = 30
self.z = np.array(9712.02)
self.t = np.array(4... | [
"numpy.array",
"numpy.testing.assert_equal",
"numpy.arange",
"numpy.testing.assert_almost_equal"
] | [((275, 292), 'numpy.array', 'np.array', (['(9712.02)'], {}), '(9712.02)\n', (283, 292), True, 'import numpy as np\n'), ((310, 322), 'numpy.array', 'np.array', (['(40)'], {}), '(40)\n', (318, 322), True, 'import numpy as np\n'), ((340, 352), 'numpy.array', 'np.array', (['(40)'], {}), '(40)\n', (348, 352), True, 'import... |
#!/usr/bin/python
#
# Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
#
import os
import sys
import argparse
import netaddr
import netifaces
import ConfigParser
import platform
from fabric.api import local
from contrail_provisioning.common.base import ContrailSetup
from contrail_provisioning.compute.n... | [
"netifaces.ifaddresses",
"platform.linux_distribution",
"fabric.api.local",
"netaddr.IPNetwork"
] | [((460, 489), 'platform.linux_distribution', 'platform.linux_distribution', ([], {}), '()\n', (487, 489), False, 'import platform\n'), ((5097, 5171), 'fabric.api.local', 'local', (["('sudo mv %s/keepalived.conf /etc/keepalived/' % self._temp_dir_name)"], {}), "('sudo mv %s/keepalived.conf /etc/keepalived/' % self._temp... |
# Generated by Django 3.2.7 on 2021-09-10 17:26
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('project', '0006_auto_20210910_1323'),
]
operations = [
migrations.AlterField(
model_name='project',
name='project_ad... | [
"django.db.models.TextField",
"django.db.models.CharField"
] | [((347, 403), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'verbose_name': '"""Address"""'}), "(max_length=100, verbose_name='Address')\n", (363, 403), False, 'from django.db import migrations, models\n'), ((536, 609), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(... |
import json
from typing import List
from .customer import Customer
from .facility import Facility
class InputData:
def __init__(self, facilities: List[Facility], customers: List[Customer]):
self.facilities = facilities
self.customers = customers
def supply(self, facility_name) -> float:
... | [
"json.load"
] | [((535, 547), 'json.load', 'json.load', (['f'], {}), '(f)\n', (544, 547), False, 'import json\n')] |
from configs.config_handler import Config
from libs.core import FaceMaskAppEngine as CvEngine
from ui.web_gui import WebGUI as UI
from argparse import ArgumentParser
def main():
"""
Creates config and application engine module and starts ui
:return:
"""
argparse = ArgumentParser()
argparse.add... | [
"ui.web_gui.WebGUI",
"libs.core.FaceMaskAppEngine",
"argparse.ArgumentParser",
"configs.config_handler.Config"
] | [((287, 303), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (301, 303), False, 'from argparse import ArgumentParser\n'), ((580, 604), 'configs.config_handler.Config', 'Config', ([], {'path': 'config_path'}), '(path=config_path)\n', (586, 604), False, 'from configs.config_handler import Config\n'), ((61... |
#!/usr/bin/env python3
import argparse
####################################
### Parse command-line arguments ###
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("EH_filename", type=str)
parser.add_argument("disease_locus_filename", type=str)
args = parser.p... | [
"argparse.ArgumentParser"
] | [((124, 203), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (147, 203), False, 'import argparse\n')] |
from __future__ import print_function
from src import cli
from os import environ as ENV
PROFILE=False
if PROFILE:
print("PROFILING")
import cProfile
cProfile.run("cli.main()", "restats")
import pstats
p = pstats.Stats('restats')
p.strip_dirs().sort_stats('cumulative').print_stats(50)
else:
... | [
"pstats.Stats",
"cProfile.run",
"src.cli.main"
] | [((162, 199), 'cProfile.run', 'cProfile.run', (['"""cli.main()"""', '"""restats"""'], {}), "('cli.main()', 'restats')\n", (174, 199), False, 'import cProfile\n'), ((227, 250), 'pstats.Stats', 'pstats.Stats', (['"""restats"""'], {}), "('restats')\n", (239, 250), False, 'import pstats\n'), ((322, 332), 'src.cli.main', 'c... |
from base64 import standard_b64decode
import logging
import os
import requests
from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError
from urllib3.util.retry import Retry
from sdc.rabbit.exceptions import BadMessageError, RetryableError
from sdc.crypto.decrypter import decrypt as sdc... | [
"logging.getLogger",
"requests.Session",
"os.getenv",
"urllib3.util.retry.Retry",
"sdc.crypto.decrypter.decrypt",
"requests.adapters.HTTPAdapter"
] | [((499, 517), 'requests.Session', 'requests.Session', ([], {}), '()\n', (515, 517), False, 'import requests\n'), ((528, 562), 'urllib3.util.retry.Retry', 'Retry', ([], {'total': '(5)', 'backoff_factor': '(0.1)'}), '(total=5, backoff_factor=0.1)\n', (533, 562), False, 'from urllib3.util.retry import Retry\n'), ((588, 62... |