code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import sys
sys.path.append('.')
from unittest import TestCase
from exporter import parse_params
from exporter import default_collectors
import os
import unittest
class TestLaunchExporter(TestCase):
# test with debug option on
def test_with_cli_params_1(self):
sys.argv = ['prog', '-o', '1234', '-d', ... | [
"os.environ.clear",
"os.getenv",
"exporter.default_collectors",
"exporter.parse_params",
"unittest.main",
"sys.path.append"
] | [((12, 32), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (27, 32), False, 'import sys\n'), ((3965, 3980), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3978, 3980), False, 'import unittest\n'), ((393, 407), 'exporter.parse_params', 'parse_params', ([], {}), '()\n', (405, 407), False, 'from... |
# test_common.py
# Created on: Dec 2, 2015
# Author: pchero
import socket
import uuid
def make_dict(lst):
ret ={}
for i in lst:
i = i.strip()
if i and i[0] is not "#" and i[-1] is not "=":
try:
var,val = i.split(":", 1)
except:
cont... | [
"socket.socket",
"uuid.uuid4"
] | [((439, 488), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (452, 488), False, 'import socket\n'), ((698, 710), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (708, 710), False, 'import uuid\n')] |
# Python test set -- part 6, built-in types
from test.support import run_with_locale
import collections.abc
import inspect
import pickle
import locale
import sys
import types
import unittest.mock
import weakref
class TypesTests(unittest.TestCase):
def test_truth_values(self):
if None: self.fail('None is ... | [
"locale.format_string",
"types.SimpleNamespace",
"pickle.dumps",
"types.prepare_class",
"test.support.run_with_locale",
"types.resolve_bases",
"types.new_class",
"pickle.loads",
"types.coroutine",
"weakref.ref"
] | [((14461, 14504), 'test.support.run_with_locale', 'run_with_locale', (['"""LC_NUMERIC"""', '"""en_US.UTF8"""'], {}), "('LC_NUMERIC', 'en_US.UTF8')\n", (14476, 14504), False, 'from test.support import run_with_locale\n'), ((14872, 14915), 'test.support.run_with_locale', 'run_with_locale', (['"""LC_NUMERIC"""', '"""en_US... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((1413, 1452), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {'exclude': "['tests']"}), "('src', exclude=['tests'])\n", (1426, 1452), False, 'from setuptools import setup, find_packages\n'), ((979, 1004), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (994, 1004), False, 'impo... |
#!/usr/bin/env python3
# @Author : <NAME>
# @FileName : site_level_eval.py
# @Software : NANOME project
# @Organization : JAX Li Lab
# @Website : https://github.com/TheJacksonLaboratory/nanome
"""
Generate site-level methylation correlation results in nanome paper.
"""
import argparse
import pybedtools
from scipy... | [
"nanocompare.global_settings.save_done_file",
"nanocompare.global_settings.load_genome_annotation_config",
"argparse.ArgumentParser",
"pybedtools.helpers.set_tempdir"
] | [((15059, 15183), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""site_level_eval (NANOME)"""', 'description': '"""Site-level correlation analysis in nanome paper"""'}), "(prog='site_level_eval (NANOME)', description=\n 'Site-level correlation analysis in nanome paper')\n", (15082, 15183), Fa... |
"""
This script reproduces Fig. 1 of Izhikevich (2004).
Original implementation references:
Izhikevich E.M. (2004) Which Model to Use for Cortical Spiking Neurons?
IEEE Transactions on Neural Networks, 15:1063-1070 (special issue on temporal coding)
Izhikevich E.M. (2003) Simple Model... | [
"matplotlib.pyplot.show",
"numpy.hstack",
"matplotlib.use",
"pyNN.utility.normalized_filename",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.figure",
"matplotlib.gridspec.GridSpec",
"numpy.array",
"numpy.empty",
"numpy.empty_like",
"os.path.dirname",
"pyNN.utility.get_simulator",
... | [((1351, 1372), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (1365, 1372), False, 'import matplotlib\n'), ((1539, 1679), 'matplotlib.pyplot.rcParams.update', 'plt.rcParams.update', (["{'lines.linewidth': 0.5, 'legend.fontsize': 'small', 'axes.titlesize':\n 'small', 'font.size': 6, 'savefig.d... |
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from copy import deepcopy
from cell_operations import ResNetBasicblock
from genotypes import Structure
from search_cells import NAS201SearchCell as SearchCell
class TinyNetwork_NAS(nn.Module):
def __init__... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"copy.deepcopy",
"search_cells.NAS201SearchCell",
"torch.nn.ModuleList",
"genotypes.Structure",
"torch.nn.Conv2d",
"torch.cuda.current_device",
"torch.nn.Linear",
"torch.nn.AdaptiveAvgPool2d",
"cell_operations.ResNetBasicblock",
"torch.no_grad",
"torc... | [((911, 926), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (924, 926), True, 'import torch.nn as nn\n'), ((1502, 1524), 'copy.deepcopy', 'deepcopy', (['search_space'], {}), '(search_space)\n', (1510, 1524), False, 'from copy import deepcopy\n'), ((1707, 1730), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgP... |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import os
import compas_rhino
from compas._os import remove_symlink
__all__ = ['uninstall_plugin']
def uninstall_plugin(plugin, version=None):
"""Uninstall a Rhino Python Command Plugin.
Paramete... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.join",
"compas_rhino._get_python_plugins_path",
"compas._os.remove_symlink"
] | [((842, 888), 'compas_rhino._get_python_plugins_path', 'compas_rhino._get_python_plugins_path', (['version'], {}), '(version)\n', (879, 888), False, 'import compas_rhino\n'), ((908, 949), 'os.path.join', 'os.path.join', (['python_plugins_path', 'plugin'], {}), '(python_plugins_path, plugin)\n', (920, 949), False, 'impo... |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# <NAME>
# California Institute of Technology
# (C) 1998-2003 All Rights Reserved
#
# <LicenseText>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~... | [
"pyre.components.Component.Component.__init__",
"pyre.applications.Application.Application.__init__"
] | [((782, 831), 'pyre.components.Component.Component.__init__', 'Component.__init__', (['self', '"""component"""', '"""facility"""'], {}), "(self, 'component', 'facility')\n", (800, 831), False, 'from pyre.components.Component import Component\n'), ((2196, 2231), 'pyre.applications.Application.Application.__init__', 'App... |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import unittest
from openvino.tools.mo.front.AttributedRollToRoll import AttributedRollToRoll
from openvino.tools.mo.front.common.partial_infer.utils import int64_array
from openvino.tools.mo.graph.graph import Node
from openvino.tools.... | [
"unit_tests.utils.graph.regular_op",
"unit_tests.utils.graph.result",
"openvino.tools.mo.utils.ir_engine.compare_graphs.compare_graphs",
"openvino.tools.mo.front.AttributedRollToRoll.AttributedRollToRoll",
"openvino.tools.mo.front.common.partial_infer.utils.int64_array",
"unit_tests.utils.graph.build_grap... | [((478, 526), 'unit_tests.utils.graph.regular_op', 'regular_op', (['"""placeholder"""', "{'type': 'Parameter'}"], {}), "('placeholder', {'type': 'Parameter'})\n", (488, 526), False, 'from unit_tests.utils.graph import build_graph, const, result, regular_op\n'), ((715, 731), 'unit_tests.utils.graph.result', 'result', ([... |
# Project 1-2
#
# Code by <NAME>
import imp_xyz as ix
import m_tools as mt
import time
import itertools
file_name = "propanediol-1"
_, _, mol = ix.import_xyz("molecule_models/{}.xyz".format(file_name))
dmol = ix.select_by_name(mol,'C') + ix.select_by_name(mol,'O')
# De-signing dmol (taking absolute value) to obtain... | [
"m_tools.find_possibles",
"itertools.product",
"m_tools.bond_length_filter",
"imp_xyz.select_by_name",
"time.time",
"m_tools.distance"
] | [((458, 486), 'imp_xyz.select_by_name', 'ix.select_by_name', (['dmol', '"""C"""'], {}), "(dmol, 'C')\n", (475, 486), True, 'import imp_xyz as ix\n'), ((495, 523), 'imp_xyz.select_by_name', 'ix.select_by_name', (['dmol', '"""O"""'], {}), "(dmol, 'O')\n", (512, 523), True, 'import imp_xyz as ix\n'), ((212, 239), 'imp_xyz... |
import requests
import re
import time
import datetime
import numpy as np
"""
Prerequisite: Create access tokens
You need private access token to have full access to Github search
API.
Generate your access token in [here](https://github.com/settings/tokens)
you don't need to tick on any access permission because you ar... | [
"numpy.random.choice",
"time.sleep",
"requests.get",
"datetime.timedelta",
"datetime.date",
"datetime.date.today"
] | [((1038, 1068), 'datetime.date', 'datetime.date', (['from_year', '(1)', '(1)'], {}), '(from_year, 1, 1)\n', (1051, 1068), False, 'import datetime\n'), ((641, 668), 'requests.get', 'requests.get', (['*args'], {}), '(*args, **argv)\n', (653, 668), False, 'import requests\n'), ((813, 829), 'time.sleep', 'time.sleep', (['w... |
# -*- coding: utf-8 -*-
"""Console script for ghdl."""
import sys
import click
from ghdl import ghdl
@click.command()
@click.option('--loglevel', default='DEBUG', prompt='Log level = DEBUG/INFO/WARNING', help='Set your log level')
def main(loglevel):
"""Console script for ghdl."""
print('ABClevel {}'.format... | [
"click.option",
"click.command",
"ghdl.ghdl.download"
] | [((105, 120), 'click.command', 'click.command', ([], {}), '()\n', (118, 120), False, 'import click\n'), ((122, 238), 'click.option', 'click.option', (['"""--loglevel"""'], {'default': '"""DEBUG"""', 'prompt': '"""Log level = DEBUG/INFO/WARNING"""', 'help': '"""Set your log level"""'}), "('--loglevel', default='DEBUG', ... |
# -*- coding: utf-8 -*-
# Copyright 2009-2013, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain a
# copy of the License at:
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"logging.getLogger",
"pyxb.binding.datatypes.ID.SimpleTypeDefinition",
"pyxb.utils.utility.UniqueIdentifier",
"pyxb.namespace.Namespace",
"pyxb.BadDocumentError",
"pyxb.namespace.archive.NamespaceArchive._AnonymousCategory",
"pyxb.binding.datatypes.anyURI.SimpleTypeDefinition",
"pyxb.ValueError"
] | [((778, 805), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (795, 805), False, 'import logging\n'), ((900, 976), 'pyxb.utils.utility.UniqueIdentifier', 'pyxb.utils.utility.UniqueIdentifier', (["('PyXB-' + pyxb.__version__ + '-Builtin')"], {}), "('PyXB-' + pyxb.__version__ + '-Builtin')\n... |
from code_challenges.insertion_sort.insertion_sort import insert_sort
def test_sorting_functionality():
test_list = [8,4,23,42,16,15]
actual = insert_sort(test_list)
expected = [4,8,15,16,23,42]
assert actual == expected
| [
"code_challenges.insertion_sort.insertion_sort.insert_sort"
] | [((152, 174), 'code_challenges.insertion_sort.insertion_sort.insert_sort', 'insert_sort', (['test_list'], {}), '(test_list)\n', (163, 174), False, 'from code_challenges.insertion_sort.insertion_sort import insert_sort\n')] |
# The following parts are originally part of scikit-bio, with copyright notice
# as reproduced below. The original COPYING.txt file can be found under
# licenses/scikit-bio.txt.
# ----------------------------------------------------------------------------
# Copyright (c) 2013--, scikit-bio development team.
#
# Distr... | [
"numpy.identity",
"numpy.sqrt",
"composition_stats.ilr_inv",
"composition_stats.alr_inv",
"numpy.testing.assert_allclose",
"numpy.log",
"numpy.column_stack",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"composition_stats._gram_schmidt_basis",
"numpy.sum",
"composition_stats.ilr",
"compositi... | [((1010, 1042), 'numpy.array', 'np.array', (['[[2, 2, 6], [4, 4, 2]]'], {}), '([[2, 2, 6], [4, 4, 2]])\n', (1018, 1042), True, 'import numpy as np\n'), ((1097, 1116), 'numpy.array', 'np.array', (['[2, 2, 6]'], {}), '([2, 2, 6])\n', (1105, 1116), True, 'import numpy as np\n'), ((1140, 1201), 'numpy.array', 'np.array', (... |
from datetime import datetime
from django.db.models import IntegerField, Sum, functions
from django.utils import timezone
from plotly import graph_objs as go
from apps.track.models import Track
from . import time_range_query
from .base import BaseChart
class ExerciseHistoryChart(BaseChart):
name = "Exercise Hi... | [
"apps.track.models.Track.objects.filter",
"django.db.models.IntegerField",
"django.utils.timezone.now",
"plotly.graph_objs.Bar",
"django.db.models.Sum"
] | [((676, 690), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (688, 690), False, 'from django.utils import timezone\n'), ((888, 944), 'apps.track.models.Track.objects.filter', 'Track.objects.filter', (['time_query.query'], {'sport': 'self.sport'}), '(time_query.query, sport=self.sport)\n', (908, 944), Fa... |
from anytree import Node, RenderTree
from .NFA import eNFA
# simple LR parser
class Parser :
def __init__(self) :
self.nt_symbols = []
self.t_symbols = []
self.productions = {}
self.start_symbol = ''
self.tokens = ''
self.ident = 0
self.first = {}
self.follow = {}
self.items = []
... | [
"anytree.Node"
] | [((6653, 6661), 'anytree.Node', 'Node', (['nt'], {}), '(nt)\n', (6657, 6661), False, 'from anytree import Node, RenderTree\n'), ((6541, 6564), 'anytree.Node', 'Node', (["(topI + ' ' + topS)"], {}), "(topI + ' ' + topS)\n", (6545, 6564), False, 'from anytree import Node, RenderTree\n')] |
from ursina import *
# Cf. LINE 84: temp_entity = Entity(parent=entity.model, ignore=True)
def new_combine(entity, analyze=False, auto_destroy=True, ignore=[]):
verts = list()
tris = list()
norms = list()
uvs = list()
cols = list()
to_destroy = list()
o = 0
for e in scene.entities:
... | [
"ursina.destroy"
] | [((2633, 2653), 'ursina.destroy', 'destroy', (['temp_entity'], {}), '(temp_entity)\n', (2640, 2653), False, 'from ursina import destroy\n'), ((1916, 1926), 'ursina.destroy', 'destroy', (['e'], {}), '(e)\n', (1923, 1926), False, 'from ursina import destroy\n')] |
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more in... | [
"packagedcode.bower.BowerJson.recognize",
"packagedcode.bower.BowerJson.is_manifest"
] | [((677, 715), 'packagedcode.bower.BowerJson.is_manifest', 'bower.BowerJson.is_manifest', (['test_file'], {}), '(test_file)\n', (704, 715), False, 'from packagedcode import bower\n'), ((842, 878), 'packagedcode.bower.BowerJson.recognize', 'bower.BowerJson.recognize', (['test_file'], {}), '(test_file)\n', (867, 878), Fal... |
from webapp2_extras.routes import RedirectRoute
from .model_register import register, ModelAdmin
def get_application_routes(handler_cls=None):
from . import admin_settings
if not handler_cls:
from .handlers import AdminHandler
handler_cls = AdminHandler
if handler_cls.__name__ in admin_settings._applic... | [
"webapp2_extras.routes.RedirectRoute"
] | [((1367, 1502), 'webapp2_extras.routes.RedirectRoute', 'RedirectRoute', ([], {'name': 'name', 'template': 'pattern', 'methods': 'methods', 'handler': 'handler_cls', 'handler_method': 'handler_method', 'strict_slash': '(True)'}), '(name=name, template=pattern, methods=methods, handler=\n handler_cls, handler_method=h... |
"""
Helioviewer Client tests
"""
import os
import urllib
from collections import OrderedDict
import pytest
import sunpy
import sunpy.map
from sunpy.net.helioviewer import HelioviewerClient
from sunpy.tests.helpers import figure_test, skip_glymur
@pytest.fixture(scope="function")
@pytest.mark.remote_data
def client(... | [
"pytest.mark.filterwarnings",
"sunpy.map.Map",
"sunpy.net.helioviewer.HelioviewerClient",
"pytest.raises",
"pytest.fixture",
"os.remove"
] | [((251, 283), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (265, 283), False, 'import pytest\n'), ((3163, 3232), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore::sunpy.util.SunpyMetadataWarning"""'], {}), "('ignore::sunpy.util.SunpyMetadataWarni... |
import subprocess
import sys
import setup_util
import os
def start(args, logfile, errfile):
setup_util.replace_text("openresty/nginx.conf", "CWD", os.getcwd())
setup_util.replace_text("openresty/app.lua", "DBHOSTNAME", args.database_host)
subprocess.Popen('sudo /usr/local/openresty/nginx/sbin/nginx -c `pwd`/ngin... | [
"subprocess.Popen",
"setup_util.replace_text",
"os.getcwd"
] | [((165, 243), 'setup_util.replace_text', 'setup_util.replace_text', (['"""openresty/app.lua"""', '"""DBHOSTNAME"""', 'args.database_host'], {}), "('openresty/app.lua', 'DBHOSTNAME', args.database_host)\n", (188, 243), False, 'import setup_util\n'), ((488, 648), 'subprocess.Popen', 'subprocess.Popen', (['"""sudo /usr/lo... |
import sys, os, fnmatch, csv
import numpy as np
import pandas as pd
from joblib import dump, load
from sklearn.model_selection import train_test_split
from sklearn_rvm import EMRVR
from sklearn.model_selection import RandomizedSearchCV
from scipy.stats import uniform
from sklearn.pipeline import make_pipeline
from sk... | [
"os.listdir",
"sklearn.model_selection.train_test_split",
"sklearn.utils.shuffle",
"sklearn_rvm.EMRVR.fit",
"joblib.dump",
"os.path.join",
"os.getcwd",
"sklearn.preprocessing.StandardScaler",
"numpy.array_split",
"fnmatch.filter",
"sklearn_rvm.EMRVR",
"pandas.concat",
"pandas.read_hdf"
] | [((660, 694), 'os.listdir', 'os.listdir', (['PATH_DATA_PROCESSED_ML'], {}), '(PATH_DATA_PROCESSED_ML)\n', (670, 694), False, 'import sys, os, fnmatch, csv\n'), ((1344, 1361), 'pandas.concat', 'pd.concat', (['frames'], {}), '(frames)\n', (1353, 1361), True, 'import pandas as pd\n'), ((1482, 1543), 'sklearn.model_selecti... |
import sys
import numpy
from PyQt5.QtWidgets import QApplication, QMessageBox
from orangewidget import gui
from orangewidget.settings import Setting
from oasys.widgets import gui as oasysgui, congruence
from oasys.widgets.exchange import DataExchangeObject
from orangecontrib.xoppy.util.xoppy_xraylib_util import cross... | [
"oasys.widgets.gui.widgetBox",
"numpy.log10",
"oasys.widgets.congruence.checkEmptyString",
"orangecontrib.xoppy.util.xoppy_xraylib_util.cross_calc_mix",
"orangecontrib.xoppy.util.xoppy_xraylib_util.cross_calc_nist",
"orangecontrib.xoppy.util.xoppy_xraylib_util.density_element",
"oasys.widgets.congruence... | [((828, 838), 'orangewidget.settings.Setting', 'Setting', (['(2)'], {}), '(2)\n', (835, 838), False, 'from orangewidget.settings import Setting\n'), ((856, 869), 'orangewidget.settings.Setting', 'Setting', (['"""Si"""'], {}), "('Si')\n", (863, 869), False, 'from orangewidget.settings import Setting\n'), ((885, 897), 'o... |
# -*- coding: utf-8 -*-
import os
import scrapy
from scrapy.exceptions import CloseSpider
from crawl_itjuzi.items import CompanyItem
from crawl_itjuzi import utils
from crawl_itjuzi import constant
class CompanySpider(scrapy.Spider):
name = "company_spider"
start_urls = [
'http://www.itjuzi.com/comp... | [
"crawl_itjuzi.items.CompanyItem",
"crawl_itjuzi.utils.get_job_url",
"os.path.join",
"scrapy.Request"
] | [((2538, 2551), 'crawl_itjuzi.items.CompanyItem', 'CompanyItem', ([], {}), '()\n', (2549, 2551), False, 'from crawl_itjuzi.items import CompanyItem\n'), ((2880, 2907), 'crawl_itjuzi.utils.get_job_url', 'utils.get_job_url', (['response'], {}), '(response)\n', (2897, 2907), False, 'from crawl_itjuzi import utils\n'), ((2... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: hanshengjiang
"""
import numpy as np
#--------------
# auxiliary function
def KLD(p,q):
p = p.ravel()
q = q.ravel()
n = len(p)
s = 0
for i in range(n):
s = s + p[i]*np.log(p[i]/q[i])
return s
#-------------- | [
"numpy.log"
] | [((254, 273), 'numpy.log', 'np.log', (['(p[i] / q[i])'], {}), '(p[i] / q[i])\n', (260, 273), True, 'import numpy as np\n')] |
from __future__ import absolute_import
import pytest
import time
from sentry.digests import Record
from sentry.digests.backends.base import InvalidState
from sentry.digests.backends.redis import RedisBackend
from sentry.testutils import TestCase
class RedisBackendTestCase(TestCase):
def test_basic(self):
... | [
"sentry.digests.backends.redis.RedisBackend",
"time.time",
"pytest.raises"
] | [((332, 346), 'sentry.digests.backends.redis.RedisBackend', 'RedisBackend', ([], {}), '()\n', (344, 346), False, 'from sentry.digests.backends.redis import RedisBackend\n'), ((1672, 1719), 'sentry.digests.backends.redis.RedisBackend', 'RedisBackend', ([], {'capacity': '(2)', 'truncation_chance': '(1.0)'}), '(capacity=2... |
import mmcv
import numpy as np
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from .recall import eval_recalls
def coco_eval(result_files, result_types, coco, max_dets=(100, 300, 1000)):
for res_type in result_types:
assert res_type in [
'proposal', 'pr... | [
"mmcv.is_str",
"pycocotools.cocoeval.COCOeval",
"pycocotools.coco.COCO",
"mmcv.dump",
"numpy.array",
"numpy.zeros",
"mmcv.load",
"numpy.arange"
] | [((383, 400), 'mmcv.is_str', 'mmcv.is_str', (['coco'], {}), '(coco)\n', (394, 400), False, 'import mmcv\n'), ((1639, 1665), 'numpy.arange', 'np.arange', (['(0.5)', '(0.96)', '(0.05)'], {}), '(0.5, 0.96, 0.05)\n', (1648, 1665), True, 'import numpy as np\n'), ((1676, 1696), 'mmcv.is_str', 'mmcv.is_str', (['results'], {})... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Description
----------
This module gives general functions
----------
Author: <NAME>
Maintainer:
Email: <EMAIL>
Copyright:
Credits:
License:
Version:
Status: in development
"""
import os, pygtc, configparser, json, sys
from os im... | [
"os.path.exists",
"os.listdir",
"configparser.ConfigParser",
"os.path.join",
"os.getcwd",
"os.chdir"
] | [((382, 393), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (391, 393), False, 'import os, pygtc, configparser, json, sys\n'), ((614, 636), 'os.path.exists', 'path.exists', (['file_name'], {}), '(file_name)\n', (625, 636), False, 'from os import path\n'), ((3861, 3872), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (3870, ... |
from typing import List
from webserver.model import Status, ChannelItem
_in_memory_store = {
1: ChannelItem(1, 'Outdoor Front', 'rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream', Status.OFF),
2: ChannelItem(2, 'Kitchen Entrance', 'rtsp://192.168.0.10:553/kitchen_1_fhd', Status.OFF),
3: Channel... | [
"webserver.model.ChannelItem"
] | [((101, 212), 'webserver.model.ChannelItem', 'ChannelItem', (['(1)', '"""Outdoor Front"""', '"""rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream"""', 'Status.OFF'], {}), "(1, 'Outdoor Front',\n 'rtsp://freja.hiof.no:1935/rtplive/definst/hessdalen03.stream', Status.OFF)\n", (112, 212), False, 'from webser... |
import unittest
from yandex_checkout.domain.common.data_context import DataContext
from yandex_checkout.domain.common.payment_method_type import PaymentMethodType
from yandex_checkout.domain.models.payment_data.payment_data_factory import PaymentDataFactory
from yandex_checkout.domain.models.payment_data.request.payme... | [
"yandex_checkout.domain.models.payment_data.payment_data_factory.PaymentDataFactory"
] | [((583, 603), 'yandex_checkout.domain.models.payment_data.payment_data_factory.PaymentDataFactory', 'PaymentDataFactory', ([], {}), '()\n', (601, 603), False, 'from yandex_checkout.domain.models.payment_data.payment_data_factory import PaymentDataFactory\n')] |
from typing import Optional
from starlette.responses import HTMLResponse
def get_swagger_ui_html(
*,
openapi_url: str,
title: str,
swagger_js_url: str = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/swagger-ui-bundle.js",
swagger_css_url: str = "https://cdn.jsdelivr.net/npm/swagger-ui-dist@3/sw... | [
"starlette.responses.HTMLResponse"
] | [((1322, 1340), 'starlette.responses.HTMLResponse', 'HTMLResponse', (['html'], {}), '(html)\n', (1334, 1340), False, 'from starlette.responses import HTMLResponse\n'), ((2302, 2320), 'starlette.responses.HTMLResponse', 'HTMLResponse', (['html'], {}), '(html)\n', (2314, 2320), False, 'from starlette.responses import HTM... |
import asyncio
from pathlib import Path
from copy import deepcopy
import pytest
from pytest import fixture, mark
from ..query import QueryResult, QueryLevel
from ..net import LocalEntity
from ..route import StaticRoute, DynamicRoute, Router
from ..sync import SyncManager
from ..store import TransferMethod
from ..stor... | [
"pytest.mark.parametrize",
"copy.deepcopy",
"pytest.param",
"pathlib.Path"
] | [((1896, 2110), 'pytest.mark.parametrize', 'mark.parametrize', (['"""subset_specs"""', "[[None] * 3, ['all'] * 3, ['PATIENT-0'] * 3, ['PATIENT-0/STUDY-0'] * 3, [\n 'PATIENT-0/STUDY-0/SERIES-0'] * 3, [\n 'PATIENT-0/STUDY-0/SERIES-0/IMAGE-0'] * 3, ['PATIENT-1'] * 3]"], {}), "('subset_specs', [[None] * 3, ['all'] * ... |
import numpy as np
class Perceptron:
def __init__(self, number_of_inputs, learning_rate):
self.weights = np.random.rand(1, number_of_inputs + 1)[0]
self.learning_rate = learning_rate
"""A step function where non-negative values are returned by a 1 and negative values are returned by a -1"""
... | [
"numpy.array",
"numpy.random.rand",
"numpy.random.seed"
] | [((1013, 1033), 'numpy.random.seed', 'np.random.seed', (['(1111)'], {}), '(1111)\n', (1027, 1033), True, 'import numpy as np\n'), ((1088, 1134), 'numpy.array', 'np.array', (['[[-1, -1], [-1, 1], [1, -1], [1, 1]]'], {}), '([[-1, -1], [-1, 1], [1, -1], [1, 1]])\n', (1096, 1134), True, 'import numpy as np\n'), ((1152, 118... |
from django.shortcuts import get_object_or_404, redirect, render, render_to_response
from .forms import RegisterForm, PostForm
from django.urls import reverse
from django.utils import timezone
from .models import Post, about
from django.contrib.auth.models import User
from django.http import Http404
import markdown
... | [
"django.shortcuts.render",
"markdown.markdown",
"django.shortcuts.get_object_or_404",
"django.utils.timezone.now",
"django.shortcuts.redirect"
] | [((503, 576), 'django.shortcuts.render', 'render', (['request', '"""blog/post_list.html"""', "{'posts': posts, 'about': about_}"], {}), "(request, 'blog/post_list.html', {'posts': posts, 'about': about_})\n", (509, 576), False, 'from django.shortcuts import get_object_or_404, redirect, render, render_to_response\n'), (... |
import builtins
import os
import sys
import types
import typing as tp
from unittest.mock import MagicMock
import pytest
from xonsh.aliases import Aliases
from xonsh.built_ins import XonshSession, XSH
from xonsh.execer import Execer
from xonsh.jobs import tasks
from xonsh.events import events
from xonsh.platform impor... | [
"xonsh.aliases.Aliases",
"xonsh.environ.default_env",
"xonsh.built_ins.XSH.load",
"xonsh.parsers.completion_context.CompletionContextParser",
"pytest.fixture",
"xonsh.built_ins.XSH.unload",
"types.MethodType",
"prompt_toolkit.input.create_pipe_input",
"tools.DummyHistory",
"tools.DummyShell",
"p... | [((1804, 1835), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1818, 1835), False, 'import pytest\n'), ((3925, 3956), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (3939, 3956), False, 'import pytest\n'), ((577, 602), 'os.path... |
"""
Script to validate that the version numbers used in the spec, docs, and
implementations match up.
"""
import os
ROOT_DIR = os.path.dirname(os.path.dirname(__file__))
def collect_files():
""" Collect files that must specify the BSDF version.
"""
files = []
# Add spec conf
files.append(os... | [
"os.listdir",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"os.path.basename"
] | [((145, 170), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (160, 170), False, 'import os\n'), ((500, 520), 'os.listdir', 'os.listdir', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (510, 520), False, 'import os\n'), ((318, 351), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""SPEC.md"""'], {}), "(R... |
import sys
import tensorflow as tf
import tensorflow.keras as k
class ActivityTracker(tf.Module):
def __init__(self):
super().__init__()
self.num_classes = 6 # activities in the training set
self.mapping = tf.lookup.StaticHashTable(
tf.lookup.KeyValueTensorInitializer(
... | [
"tensorflow.keras.layers.Input",
"tensorflow.Variable",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.optimizers.SGD",
"tensorflow.not_equal",
"tensorflow.saved_model.save",
"tensorflow.GradientTape",
"tensorflow.argmax",
"tensorflow.keras.layers.LSTM",
"tensorflow.ker... | [((3634, 3723), 'tensorflow.saved_model.save', 'tf.saved_model.save', (['at', '"""at"""'], {'signatures': "{'learn': at.learn, 'predict': at.predict}"}), "(at, 'at', signatures={'learn': at.learn, 'predict': at.\n predict})\n", (3653, 3723), True, 'import tensorflow as tf\n'), ((1202, 1249), 'tensorflow.Variable', '... |
# Copyright Hybrid Logic Ltd. See LICENSE file for details.
# -*- test-case-name: flocker.node.test.test_deploy -*-
"""
Deploy applications on nodes.
"""
from itertools import chain
from warnings import warn
from zope.interface import Interface, implementer, Attribute
from characteristic import attributes
from py... | [
"characteristic.attributes",
"zope.interface.implementer",
"pyrsistent.field",
"zope.interface.Attribute",
"twisted.internet.defer.gatherResults",
"warnings.warn",
"eliot.Logger",
"twisted.internet.defer.fail"
] | [((1054, 1062), 'eliot.Logger', 'Logger', ([], {}), '()\n', (1060, 1062), False, 'from eliot import Message, write_failure, Logger, start_action\n'), ((3414, 3439), 'zope.interface.implementer', 'implementer', (['IStateChange'], {}), '(IStateChange)\n', (3425, 3439), False, 'from zope.interface import Interface, implem... |
import json
import hashlib
import time
from stravalib import Client
class StravaModel:
def __init__(self, my_strava_club_id, client_id, client_secret, host):
self.my_strava_club_id = my_strava_club_id
self.client_id = client_id
self.client_secret = client_secret
self.host = host
... | [
"json.load",
"json.dumps",
"time.time",
"stravalib.Client"
] | [((513, 562), 'stravalib.Client', 'Client', ([], {'access_token': "access_token['access_token']"}), "(access_token=access_token['access_token'])\n", (519, 562), False, 'from stravalib import Client\n'), ((1542, 1554), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1551, 1554), False, 'import json\n'), ((2533, 2541), ... |
import json
import pytest
import grpclib.const
import grpclib.server
from grpclib.client import UnaryUnaryMethod
from grpclib.events import _DispatchServerEvents
from grpclib.exceptions import GRPCError
from grpclib.encoding.base import CodecBase
from grpclib.encoding.proto import ProtoCodec
from conn import Client... | [
"grpclib.encoding.proto.ProtoCodec",
"grpclib.events._DispatchServerEvents",
"dummy_pb2.DummyRequest",
"json.dumps",
"grpclib.client.UnaryUnaryMethod",
"pytest.raises"
] | [((7218, 7230), 'grpclib.encoding.proto.ProtoCodec', 'ProtoCodec', ([], {}), '()\n', (7228, 7230), False, 'from grpclib.encoding.proto import ProtoCodec\n'), ((1276, 1345), 'grpclib.client.UnaryUnaryMethod', 'UnaryUnaryMethod', (['channel', '"""/ping.PingService/UnaryUnary"""', 'None', 'None'], {}), "(channel, '/ping.P... |
# coding=utf-8
# Copyright 2022 Google LLC.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
"jax.numpy.diag",
"jax.numpy.zeros",
"jax.random.PRNGKey",
"ott.tools.gaussian_mixture.gaussian_mixture.GaussianMixture.from_random",
"absl.testing.absltest.main",
"absl.testing.parameterized.named_parameters",
"jax.tree_util.tree_flatten",
"jax.tree_util.tree_unflatten",
"jax.tree_map",
"jax.nump... | [((4768, 5004), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('balanced_unlocked', 0.01, 1.0, False)", "('balanced_locked', 0.01, 1.0, True)", "('unbalanced_unlocked', 0.01, 0.1 / (0.1 + 0.01), False)", "('unbalanced_locked', 0.01, 0.1 / (0.1 + 0.01), True)"], {}), "(('balanced_un... |
import logging
import maya.cmds as cmds
import os
import rsTools.utils.data.string as string
import rsTools.utils.data.curveData as curveData
import rsTools.utils.data.osUtils as osUtils
import rsTools.utils.data.scene.topNode as topUtils
import rsTools.utils.transforms.transforms as tUtils
from rsTools.core.model.mo... | [
"logging.getLogger",
"rsTools.utils.data.osUtils.get_project_show",
"rsTools.utils.data.curveData.buildControlShape",
"rsTools.utils.data.osUtils.getSubdirs",
"maya.cmds.connectAttr",
"os.path.exists",
"rsTools.utils.transforms.transforms.transformCreate",
"rsTools.utils.transforms.transforms.attrAdd"... | [((419, 446), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (436, 446), False, 'import logging\n'), ((2476, 2515), 'maya.cmds.group', 'cmds.group', ([], {'em': '(True)', 'name': 'self._topNode'}), '(em=True, name=self._topNode)\n', (2486, 2515), True, 'import maya.cmds as cmds\n'), ((252... |
import json
from rest_client.GetRest import GetRest
from rest_client.PostRest import PostRest
class CogAPI(object):
"""
This class manage the requests for the cog objects into the restAPI
:param function: the name of the function to access in the rest API
:type function: string
"""
def __init... | [
"json.dumps",
"rest_client.PostRest.PostRest",
"rest_client.GetRest.GetRest"
] | [((1001, 1021), 'json.dumps', 'json.dumps', (['jsonData'], {}), '(jsonData)\n', (1011, 1021), False, 'import json\n'), ((718, 749), 'rest_client.GetRest.GetRest', 'GetRest', ([], {'function': 'self.function'}), '(function=self.function)\n', (725, 749), False, 'from rest_client.GetRest import GetRest\n'), ((1044, 1095),... |
#! /usr/bin/env python
# _*_coding:utf-8 -*_
from app.lib import *
from flask import render_template
def start_scan():
command = {
"Type": "WVSCommand",
"Data": {
"Action": "StartNewScan",
"Config": { # 可选,当命令为StartNewScan时需提供该字段作为扫描参数
# "StartURL": "http:... | [
"flask.render_template"
] | [((656, 695), 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': '""""""'}), "('index.html', title='')\n", (671, 695), False, 'from flask import render_template\n')] |
#
# grid_spline.py
#
# Code for one-dimensional cubic splines on a
# uniform grid, including analytic slope, curvature,
# and extremum evaluation.
#
# Most convenient interface is via GridSpline class,
# which encapsulates the low-level routines.
#
# <NAME>, <NAME>, 2010-2014
#
import numpy as n
def tri_diag(a, b, c,... | [
"numpy.roll",
"numpy.sqrt",
"numpy.where",
"numpy.int32",
"numpy.asarray",
"numpy.zeros",
"numpy.arange"
] | [((1120, 1137), 'numpy.zeros', 'n.zeros', (['(bign - 1)'], {}), '(bign - 1)\n', (1127, 1137), True, 'import numpy as n\n'), ((1157, 1174), 'numpy.zeros', 'n.zeros', (['(bign - 1)'], {}), '(bign - 1)\n', (1164, 1174), True, 'import numpy as n\n'), ((1371, 1381), 'numpy.int32', 'n.int32', (['x'], {}), '(x)\n', (1378, 138... |
from game.casting.actor import Actor
import pygame
class Banner(Actor):
def __init__(self, pos, text = 'Text', font_size = 32):
pygame.font.init()
self._position = pos
self._font_size = font_size
self._font = pygame.font.Font('freesansbold.ttf', font_size)
self._text_imag... | [
"pygame.font.Font",
"pygame.font.init"
] | [((144, 162), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (160, 162), False, 'import pygame\n'), ((249, 296), 'pygame.font.Font', 'pygame.font.Font', (['"""freesansbold.ttf"""', 'font_size'], {}), "('freesansbold.ttf', font_size)\n", (265, 296), False, 'import pygame\n')] |
import unittest
from app.models import Pitch
from app import db
class PitchTest(unittest.TestCase):
"""
Test class to test the behaviour of the Pitch
"""
def setUp(self):
"""
Set up method that will run before every Test
"""
self.new_pitch = Pitch(0000, 'name','... | [
"app.models.Pitch"
] | [((300, 331), 'app.models.Pitch', 'Pitch', (['(0)', '"""name"""', '"""description"""'], {}), "(0, 'name', 'description')\n", (305, 331), False, 'from app.models import Pitch\n')] |
from sanic import HTTPResponse, Request, Sanic, text
app = Sanic(__name__)
@app.get("/<name>")
async def handler(request: Request, name: str) -> HTTPResponse:
return text(f"Hi {name}")
# DO NOT DO THIS
# @app.on_response
# async def cors(_, resp):
# resp.headers["Access-Control-Allow-Origin"] = "*"
| [
"sanic.Sanic",
"sanic.text"
] | [((60, 75), 'sanic.Sanic', 'Sanic', (['__name__'], {}), '(__name__)\n', (65, 75), False, 'from sanic import HTTPResponse, Request, Sanic, text\n'), ((173, 191), 'sanic.text', 'text', (['f"""Hi {name}"""'], {}), "(f'Hi {name}')\n", (177, 191), False, 'from sanic import HTTPResponse, Request, Sanic, text\n')] |
# 运行参数: --model_dir=E:\model\official_myDataset --data_dir=E:\data\my_dataset --train_epochs=10 --distribution_strategy=one_device --num_gpus=1 --download
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except... | [
"official.utils.flags.core.define_distribution",
"tensorflow.train.Checkpoint",
"official.utils.flags.core.define_device",
"absl.logging.info",
"tensorflow.keras.layers.Dense",
"official.utils.flags.core.define_base",
"tensorflow.keras.layers.Input",
"official.utils.misc.distribution_utils.get_distrib... | [((1583, 1639), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(12, 12, 1)', 'name': '"""image12"""'}), "(shape=(12, 12, 1), name='image12')\n", (1604, 1639), True, 'import tensorflow as tf\n'), ((1653, 1706), 'tensorflow.keras.layers.Input', 'tf.keras.layers.Input', ([], {'shape': '(6, 6, 1)... |
import os
import itertools
from ipykernel import kernelspec as ks
import nbformat
from nbformat.v4.nbbase import new_markdown_cell
from generate_contents import NOTEBOOK_DIR, REG, iter_notebooks, get_notebook_title
def prev_this_next(it):
a, b, c = itertools.tee(it, 3)
next(c)
return zip(itertools.chain... | [
"itertools.chain",
"nbformat.read",
"os.path.join",
"generate_contents.iter_notebooks",
"nbformat.write",
"generate_contents.get_notebook_title",
"nbformat.v4.nbbase.new_markdown_cell",
"os.path.basename",
"itertools.tee"
] | [((257, 277), 'itertools.tee', 'itertools.tee', (['it', '(3)'], {}), '(it, 3)\n', (270, 277), False, 'import itertools\n'), ((305, 331), 'itertools.chain', 'itertools.chain', (['[None]', 'a'], {}), '([None], a)\n', (320, 331), False, 'import itertools\n'), ((336, 362), 'itertools.chain', 'itertools.chain', (['c', '[Non... |
#
# Copyright 2021 Ocean Protocol Foundation
# SPDX-License-Identifier: Apache-2.0
#
from ocean_lib.assets.asset import V3Asset
from ocean_lib.assets.did import DID
from ocean_lib.common.agreements.service_types import ServiceTypes
from tests.resources.ddo_helpers import (
get_registered_algorithm_ddo,
get_regi... | [
"ocean_lib.assets.asset.V3Asset",
"tests.resources.ddo_helpers.get_resource_path",
"ocean_lib.assets.did.DID.did",
"tests.resources.ddo_helpers.get_registered_ddo_with_compute_service",
"tests.resources.helper_functions.get_publisher_wallet",
"tests.resources.ddo_helpers.wait_for_ddo",
"tests.resources.... | [((728, 750), 'tests.resources.helper_functions.get_publisher_wallet', 'get_publisher_wallet', ([], {}), '()\n', (748, 750), False, 'from tests.resources.helper_functions import get_publisher_wallet\n'), ((867, 914), 'tests.resources.ddo_helpers.wait_for_ddo', 'wait_for_ddo', (['publisher_ocean_instance', 'ddo.did'], {... |
"""
shortly.app
~~~~~~~~~~~
Shortly app inspired by http://werkzeug.pocoo.org/docs/tutorial/.
:copyright: (c) 2014 by fsp.
:license: BSD.
"""
from flask import Flask
app = Flask(__name__)
from shortly import settings
app.config.from_object(settings)
import shortly.views
| [
"flask.Flask"
] | [((194, 209), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (199, 209), False, 'from flask import Flask\n')] |
import time
import pytest
from tests.integration.job import IntegrationTestConfig, Job, \
with_constraint, with_instance_count
from peloton_client.pbgen.peloton.api.v0 import peloton_pb2
from peloton_client.pbgen.peloton.api.v0.task import task_pb2
from tools.minicluster.minicluster import run_mesos_agent, \
t... | [
"pytest.mark.random_order",
"tests.integration.job.IntegrationTestConfig",
"tests.integration.job.with_instance_count",
"peloton_client.pbgen.peloton.api.v0.task.task_pb2.TaskState.Value",
"time.sleep",
"tools.minicluster.minicluster.teardown_mesos_agent",
"tools.minicluster.minicluster.run_mesos_agent"... | [((528, 567), 'pytest.mark.random_order', 'pytest.mark.random_order', ([], {'disabled': '(True)'}), '(disabled=True)\n', (552, 567), False, 'import pytest\n'), ((2138, 2172), 'tools.minicluster.minicluster.teardown_mesos_agent', 'teardown_mesos_agent', (['mc_config', '(0)'], {}), '(mc_config, 0)\n', (2158, 2172), False... |
import scipy.misc
import matplotlib.pyplot as plt
lena = scipy.misc.ascent()
plt.gray()
plt.imshow(lena)
plt.colorbar()
plt.show()
| [
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.gray",
"matplotlib.pyplot.show"
] | [((77, 87), 'matplotlib.pyplot.gray', 'plt.gray', ([], {}), '()\n', (85, 87), True, 'import matplotlib.pyplot as plt\n'), ((88, 104), 'matplotlib.pyplot.imshow', 'plt.imshow', (['lena'], {}), '(lena)\n', (98, 104), True, 'import matplotlib.pyplot as plt\n'), ((105, 119), 'matplotlib.pyplot.colorbar', 'plt.colorbar', ([... |
import os
import shutil
import unittest
import uuid
from unittest import mock
from unittest.mock import MagicMock
from dmake import utils, build, template_args
def yaml_file(filename):
return os.path.join(os.path.dirname(__file__), filename)
class BuildOrderTestCase(unittest.TestCase):
def test_only_one_bu... | [
"dmake.utils.sort_builds_dict",
"os.path.join",
"uuid.uuid4",
"os.path.dirname",
"dmake.build.Build",
"os.mkdir",
"shutil.rmtree",
"unittest.main",
"unittest.mock.patch"
] | [((1539, 1611), 'unittest.mock.patch', 'mock.patch', (['"""dmake.template_args.label_template_args"""'], {'return_value': 'None'}), "('dmake.template_args.label_template_args', return_value=None)\n", (1549, 1611), False, 'from unittest import mock\n'), ((1821, 1883), 'unittest.mock.patch', 'mock.patch', (['"""dmake.bui... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 08_train_self_supervised.ipynb (unless otherwise specified).
__all__ = ['get_ss_gen', 'get_ss_data', 'pipe_update_size', 'get_aug_pipe', 'SSModel', 'CombinedSSLoss', 'wrap_metric',
'SSCallback']
# Cell
from .imports import *
from .metadata import *
from .preproce... | [
"functools.wraps"
] | [((2437, 2445), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (2442, 2445), False, 'from functools import wraps\n')] |
# Developed by BlazinVapin for Redbot.
# Inspired by the snail race mini game
# STD Library
import asyncio
import random
import os
# Discord and Red Utils
import discord
from discord.ext import commands
from __main__ import send_cmd_help
from .utils import checks
from .utils.dataIO import dataIO
anima... | [
"os.path.exists",
"random.uniform",
"random.choice",
"os.makedirs",
"discord.ext.commands.group",
"asyncio.sleep",
"discord.ext.commands.cooldown",
"__main__.send_cmd_help",
"discord.Embed",
"random.randint"
] | [((3369, 3414), 'discord.ext.commands.group', 'commands.group', ([], {'pass_context': '(True)', 'no_pm': '(True)'}), '(pass_context=True, no_pm=True)\n', (3383, 3414), False, 'from discord.ext import commands\n'), ((3579, 3624), 'discord.ext.commands.group', 'commands.group', ([], {'pass_context': '(True)', 'no_pm': '(... |
from matrixstore.db import get_db
def simplify_bnf_codes(bnf_codes):
"""Given list of BNF codes, return list of BNF prefixes for BNF subsections such
that:
1. every BNF code that belongs to one of these prefixes is in the original list,
2. every code in the original list belongs to exactly on... | [
"matrixstore.db.get_db"
] | [((1249, 1257), 'matrixstore.db.get_db', 'get_db', ([], {}), '()\n', (1255, 1257), False, 'from matrixstore.db import get_db\n'), ((1804, 1812), 'matrixstore.db.get_db', 'get_db', ([], {}), '()\n', (1810, 1812), False, 'from matrixstore.db import get_db\n')] |
from pathlib import Path
import tempfile
from transformers.convert_graph_to_onnx import convert, quantize
# requires:
# transformers==4.0.0
# torch==1.7.1
dest = Path(tempfile.mkdtemp(), "text-generation.onnx")
convert(
pipeline_name="text-generation",
model="gpt2",
output=dest,
framework="pt",
opset=11
)
p... | [
"tempfile.mkdtemp",
"transformers.convert_graph_to_onnx.convert"
] | [((213, 310), 'transformers.convert_graph_to_onnx.convert', 'convert', ([], {'pipeline_name': '"""text-generation"""', 'model': '"""gpt2"""', 'output': 'dest', 'framework': '"""pt"""', 'opset': '(11)'}), "(pipeline_name='text-generation', model='gpt2', output=dest,\n framework='pt', opset=11)\n", (220, 310), False, ... |
import cv2
import numpy as np
import sys
import os
import peakutils
from scipy import signal
def detectKanji(img):
img_gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
blur = cv2.GaussianBlur(img_gray, (11, 11), 0)
ret3, img_thres = cv2.threshold(blur, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
height, w... | [
"os.path.exists",
"cv2.threshold",
"os.path.join",
"scipy.signal.savgol_filter",
"cv2.imshow",
"peakutils.indexes",
"numpy.array",
"cv2.waitKey",
"cv2.destroyAllWindows",
"os.mkdir",
"cv2.cvtColor",
"cv2.GaussianBlur",
"cv2.imread",
"cv2.namedWindow"
] | [((131, 168), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_RGB2GRAY'], {}), '(img, cv2.COLOR_RGB2GRAY)\n', (143, 168), False, 'import cv2\n'), ((180, 219), 'cv2.GaussianBlur', 'cv2.GaussianBlur', (['img_gray', '(11, 11)', '(0)'], {}), '(img_gray, (11, 11), 0)\n', (196, 219), False, 'import cv2\n'), ((242, 306), ... |
import graphene
from graphene_django import DjangoObjectType
from nautobot.dcim.graphql.types import InterfaceType
from nautobot.ipam import models, filters
from nautobot.extras.graphql.types import TagType # noqa: F401
from nautobot.virtualization.graphql.types import VMInterfaceType
class AggregateType(DjangoObje... | [
"graphene.String",
"graphene.Field"
] | [((394, 411), 'graphene.String', 'graphene.String', ([], {}), '()\n', (409, 411), False, 'import graphene\n'), ((1056, 1073), 'graphene.String', 'graphene.String', ([], {}), '()\n', (1071, 1073), False, 'import graphene\n'), ((1133, 1192), 'graphene.Field', 'graphene.Field', (['"""nautobot.dcim.graphql.types.InterfaceT... |
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods,misplaced-comparison-constant
import datetime
import os
import tempfile
from contextlib import contextmanager
from pathlib import Path
from typing import List, Optional, Union
import click
import pytest
from click.testing import CliRunner, Result... | [
"libratom.cli.utils.validate_existing_dir",
"libratom.lib.database.db_session_from_cmd_out",
"libratom.cli.utils.validate_eml_export_input",
"datetime.timedelta",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.func.count",
"pathlib.Path",
"sqlalchemy.create_engine",
"libratom.cli.utils.list_spacy_models... | [((3222, 3367), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""params, expected"""', "[([], 'Usage'), (['-h'], 'Usage'), (['--help'], 'Usage'), (['--version'],\n libratom.__version__)]"], {}), "('params, expected', [([], 'Usage'), (['-h'],\n 'Usage'), (['--help'], 'Usage'), (['--version'], libratom._... |
# ------------------------------------------------------------------------------
# MIT License
#
# Copyright (c) 2019-2021 ThatRedKite
#
# 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 with... | [
"molmass.analyze",
"re.compile",
"thatkitebot.backend.util.errormsg",
"re.findall",
"discord.Embed",
"discord.ext.commands.command"
] | [((1518, 1569), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""molar_mass"""', 'aliases': "['mm']"}), "(name='molar_mass', aliases=['mm'])\n", (1534, 1569), False, 'from discord.ext import commands\n'), ((1658, 1686), 're.compile', 're.compile', (['"""mass: (\\\\S+)\n"""'], {}), "('mass: (\\\\S+)... |
import nmap
from scapy import main
from datetime import datetime
class Network(object):
def __init__(self, ip= " "):
ip = input("[+] Enter Your Router's Ip address : ")
self.ip = ip
def NetworkScannner(self):
if len(self.ip) == 0:
network = "192.168.100.1/24"
el... | [
"nmap.PortScanner",
"datetime.datetime.now"
] | [((480, 498), 'nmap.PortScanner', 'nmap.PortScanner', ([], {}), '()\n', (496, 498), False, 'import nmap\n'), ((423, 437), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (435, 437), False, 'from datetime import datetime\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
#@Time : 2019/5/13 10:28
#@Author: yangjian
#@File : predict.py
from flyai.dataset import Dataset
from model import Model
data = Dataset()
model = Model(data)
p = model.predict(question='增城公交路线到达增城区新塘镇的有哪些?',
answer='新塘镇内公交车(主要行走于增城区新塘镇内,1... | [
"flyai.dataset.Dataset",
"model.Model"
] | [((189, 198), 'flyai.dataset.Dataset', 'Dataset', ([], {}), '()\n', (196, 198), False, 'from flyai.dataset import Dataset\n'), ((208, 219), 'model.Model', 'Model', (['data'], {}), '(data)\n', (213, 219), False, 'from model import Model\n')] |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"lit_nlp.api.types.RegressionScore",
"lit_nlp.api.types.Scalar",
"lit_nlp.lib.caching.input_hash",
"lit_nlp.lib.testing_utils.assert_deep_almost_equal",
"lit_nlp.api.types.CategoryLabel",
"absl.testing.absltest.main",
"lit_nlp.components.pdp.PdpInterpreter",
"lit_nlp.api.types.MulticlassPreds"
] | [((5625, 5640), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (5638, 5640), False, 'from absl.testing import absltest\n'), ((2052, 2072), 'lit_nlp.components.pdp.PdpInterpreter', 'pdp.PdpInterpreter', ([], {}), '()\n', (2070, 2072), False, 'from lit_nlp.components import pdp\n'), ((3080, 3151), 'lit_... |
import setuptools
import smac
with open('requirements.txt') as fh:
requirements = fh.read()
requirements = requirements.split('\n')
requirements = [requirement.strip() for requirement in requirements]
with open("smac/__version__.py") as fh:
version = fh.readlines()[-1].split()[-1].strip("\"'")
setuptools.... | [
"setuptools.find_packages"
] | [((713, 765), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'exclude': "['test', 'source']"}), "(exclude=['test', 'source'])\n", (737, 765), False, 'import setuptools\n')] |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"time.sleep",
"builtins.str",
"google_cloud_utils.credentials.get_default",
"googleapiclient.discovery.build",
"base.retry.wrap",
"httplib2.Http"
] | [((3379, 3509), 'base.retry.wrap', 'retry.wrap', (['RETRY_COUNT', 'RETRY_DELAY', '"""handlers.cron.helpers.bot_manager.Resource.execute"""'], {'exception_type': 'RetryableError'}), "(RETRY_COUNT, RETRY_DELAY,\n 'handlers.cron.helpers.bot_manager.Resource.execute', exception_type=\n RetryableError)\n", (3389, 3509... |
#!/usr/bin/env python3
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
"""Definitions of model layers/NN modules"""
import ipdb
import torch
import torch.nn as nn
import os
from tor... | [
"torch.nn.init.constant_",
"torch.utils.model_zoo.load_url",
"torch.bmm",
"torch.nn.functional.softmax",
"torch.nn.functional.linear",
"torch.nn.ModuleList",
"torch.nn.LSTM",
"torch.nn.init.xavier_uniform_",
"torch.nn.utils.rnn.PackedSequence",
"torch.nn.utils.rnn.pad_packed_sequence",
"torch.au... | [((2074, 2089), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2087, 2089), True, 'import torch.nn as nn\n'), ((4596, 4639), 'torch.sort', 'torch.sort', (['lengths'], {'dim': '(0)', 'descending': '(True)'}), '(lengths, dim=0, descending=True)\n', (4606, 4639), False, 'import torch\n'), ((4664, 4691), 'torch... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from future.utils import text_to_native_str
import logging
import smtplib
import socket
import getpass
from email.mime.multipart import MIMEMultipart
from email.mime.text i... | [
"logging.getLogger",
"socket.getfqdn",
"flexget.plugin.register",
"flexget.event.event",
"future.utils.text_to_native_str",
"flexget.config_schema.one_or_more",
"email.mime.multipart.MIMEMultipart",
"email.utils.formatdate",
"getpass.getuser"
] | [((633, 663), 'logging.getLogger', 'logging.getLogger', (['plugin_name'], {}), '(plugin_name)\n', (650, 663), False, 'import logging\n'), ((6994, 7018), 'flexget.event.event', 'event', (['"""plugin.register"""'], {}), "('plugin.register')\n", (6999, 7018), False, 'from flexget.event import event\n'), ((7046, 7131), 'fl... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
##############
# GPathFinder: Identification of ligand pathways by a multi-objective
# genetic algorithm
#
# https://github.com/insilichem/gpathfinder
#
# Copyright 2019 <NAME>, <NAME>,
# <NAME>, <NAME>,
# <NAME> and <NAME>
#
# Licensed under the Apache License, Version... | [
"conftest.datapath",
"pytest.mark.parametrize",
"conftest.expressed",
"gpath.genes.search.Search.with_validation"
] | [((1373, 1535), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""path, target, radius, rotate"""', "[('5er1_ligand.mol2', 'Molecule/1', 3.0, False), ('5er1_ligand.mol2',\n 'Molecule/1', 15.0, True)]"], {}), "('path, target, radius, rotate', [(\n '5er1_ligand.mol2', 'Molecule/1', 3.0, False), ('5er1_lig... |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"base.utils.remove_prefix",
"base.utils.strip_from_left",
"re.compile"
] | [((707, 735), 're.compile', 're.compile', (['"""^[a-zA-Z]:\\\\\\\\"""'], {}), "('^[a-zA-Z]:\\\\\\\\')\n", (717, 735), False, 'import re\n'), ((801, 827), 're.compile', 're.compile', (['"""^[/]?src[/]?"""'], {}), "('^[/]?src[/]?')\n", (811, 827), False, 'import re\n'), ((859, 960), 're.compile', 're.compile', (['"""(?<=... |
import os
import sys
from datetime import datetime, tzinfo
import dateutil
import dateutil.rrule
import ics
import yaml
from dateutil.tz import gettz
interval_type = {
"seconds": dateutil.rrule.SECONDLY,
"minutes": dateutil.rrule.MINUTELY,
"hours": dateutil.rrule.HOURLY,
"days": dateutil.rrule.DAILY,
... | [
"datetime.datetime.utcnow",
"dateutil.tz.gettz",
"ics.Event",
"ics.ContentLine",
"ics.Calendar",
"os.path.isfile",
"os.path.dirname",
"sys.exit"
] | [((994, 1008), 'ics.Event', 'ics.Event', ([], {}), '(**d)\n', (1003, 1008), False, 'import ics\n'), ((2910, 2924), 'ics.Calendar', 'ics.Calendar', ([], {}), '()\n', (2922, 2924), False, 'import ics\n'), ((4531, 4543), 'sys.exit', 'sys.exit', (['(-1)'], {}), '(-1)\n', (4539, 4543), False, 'import sys\n'), ((1387, 1399),... |
import os
from setuptools import setup, find_packages
import versioneer
author = 'theislab'
author_email = '<EMAIL>'
description = "sfaira is a model and a data repository for single-cell data in a single python package."
with open("README.rst", "r") as fh:
long_description = fh.read()
with open('requirements.t... | [
"setuptools.find_packages",
"os.path.join",
"versioneer.get_version",
"os.path.dirname",
"versioneer.get_cmdclass",
"os.walk"
] | [((601, 626), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (616, 626), False, 'import os\n'), ((461, 479), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (468, 479), False, 'import os\n'), ((653, 704), 'os.path.join', 'os.path.join', (['WD', '"""sfaira"""', '"""commands"""', '"... |
# -*- coding: utf-8 -*-
from ..data_helpers import production_volume
import pprint
def ensure_all_datasets_have_production_volume(data):
"""Make sure all datasets have a single reference product exchange with a valid production volume amount"""
for ds in data:
assert production_volume(ds), "Dataset do... | [
"pprint.pformat"
] | [((369, 387), 'pprint.pformat', 'pprint.pformat', (['ds'], {}), '(ds)\n', (383, 387), False, 'import pprint\n')] |
#!/usr/bin/env python
import rospy
import math
from robosub2019.msg import Key
from robosub2019.msg import MotorCommands
'''
MotorCommands:
0: Port Forward
1: Starboard Forward
2: Fore Strafe
3: Aft Strafe
4: Port Fore Depth
5: Starboard Fore Depth
6: Port Aft Depth
7: Starboard Aft ... | [
"rospy.Subscriber",
"robosub2019.msg.MotorCommands",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_rostime",
"rospy.Rate",
"rospy.spin",
"rospy.Publisher"
] | [((2146, 2165), 'rospy.get_rostime', 'rospy.get_rostime', ([], {}), '()\n', (2163, 2165), False, 'import rospy\n'), ((2265, 2293), 'rospy.init_node', 'rospy.init_node', (['"""UserInput"""'], {}), "('UserInput')\n", (2280, 2293), False, 'import rospy\n'), ((2298, 2349), 'rospy.Subscriber', 'rospy.Subscriber', (['"""keyb... |
# Dummy testbench just for Vivado project scripts
import os
from sonar.testbench import Testbench, Module, TestVector, Thread
from sonar.interfaces import AXIS
from sonar_strToInt import strToInt
am_rx = Testbench.default('memory')
filepath = os.path.join(os.path.dirname(__file__), 'build/memory/')
dut = Module.de... | [
"sonar.interfaces.AXIS",
"sonar.testbench.Thread",
"sonar.testbench.TestVector",
"sonar.testbench.Testbench.default",
"os.path.dirname",
"sonar_strToInt.strToInt",
"sonar.testbench.Module.default"
] | [((208, 235), 'sonar.testbench.Testbench.default', 'Testbench.default', (['"""memory"""'], {}), "('memory')\n", (225, 235), False, 'from sonar.testbench import Testbench, Module, TestVector, Thread\n'), ((311, 332), 'sonar.testbench.Module.default', 'Module.default', (['"""DUT"""'], {}), "('DUT')\n", (325, 332), False,... |
"""
This module keeps properties of genome fasta files and functions associated with those.
"""
import logging
from Bio import SeqIO
from fivepseq import config
class Genome:
fasta_file = None
genome_dict = None
logger = logging.getLogger(config.FIVEPSEQ_LOGGER)
def __init__(self, fasta_file):
... | [
"logging.getLogger"
] | [((238, 279), 'logging.getLogger', 'logging.getLogger', (['config.FIVEPSEQ_LOGGER'], {}), '(config.FIVEPSEQ_LOGGER)\n', (255, 279), False, 'import logging\n')] |
# This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
# Django settings file for a project based on the playdoh template.
# import * into your settings_local.py
import logging
import os
import socket
from django.utils.functio... | [
"decouple.Csv",
"glob.iglob",
"decouple.config",
"os.path.join",
"django.contrib.auth.models.User.objects.filter",
"os.path.dirname",
"os.path.isdir",
"django_sha2.get_password_hashers",
"os.path.basename",
"django.utils.functional.lazy",
"socket.gethostname"
] | [((738, 770), 'decouple.config', 'config', (['"""SECRET_KEY"""'], {'default': '""""""'}), "('SECRET_KEY', default='')\n", (744, 770), False, 'from decouple import Csv, config\n'), ((846, 887), 'decouple.config', 'config', (['"""DEBUG"""'], {'default': '(False)', 'cast': 'bool'}), "('DEBUG', default=False, cast=bool)\n"... |
import json
import joblib
import pandas as pd
import plotly
from plotly.graph_objs import Bar, Scatter, Heatmap
import plotly.graph_objects as px
from sqlalchemy import create_engine
def load_figures():
"""
:return: Figure containing plots and id for each plot
"""
engine = create_engine('sqlite:///da... | [
"pandas.read_sql_table",
"sqlalchemy.create_engine",
"json.dumps",
"plotly.graph_objs.Bar"
] | [((293, 345), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///data/disaster_response.db"""'], {}), "('sqlite:///data/disaster_response.db')\n", (306, 345), False, 'from sqlalchemy import create_engine\n'), ((355, 401), 'pandas.read_sql_table', 'pd.read_sql_table', (['"""disaster_response"""', 'engine'], {}... |
"""
Collection of approximation methods
Global methods are used on a distribution as a wrapper. Local
function are used by the graph-module as part of calculations.
Functions
---------
pdf Probability density function (local)
pdf_full Probability density function (global)
ppf Inverse CD... | [
"numpy.mean",
"numpy.prod",
"numpy.allclose",
"numpy.abs",
"numpy.ones",
"numpy.where",
"numpy.ndindex",
"numpy.any",
"numpy.max",
"numpy.asfarray",
"numpy.sum",
"numpy.zeros",
"numpy.array",
"numpy.empty",
"numpy.cov",
"numpy.min",
"numpy.all",
"numpy.var"
] | [((1346, 1363), 'numpy.asfarray', 'numpy.asfarray', (['x'], {}), '(x)\n', (1360, 1363), False, 'import numpy\n'), ((1433, 1463), 'numpy.where', 'numpy.where', (['(x < mu)', 'eps', '(-eps)'], {}), '(x < mu, eps, -eps)\n', (1444, 1463), False, 'import numpy\n'), ((1502, 1522), 'numpy.empty', 'numpy.empty', (['x.shape'], ... |
from random import Random
from game import Game
from const import Const
from randomagent import RandomAgent
from agent import Agent
class Matchup:
'''
Pit two agents against each other in a game
'''
def __init__(self, verbose : bool = True):
self._game = Game()
self._goatAgent : Agent... | [
"const.Const.stateStr",
"game.Game",
"randomagent.RandomAgent"
] | [((282, 288), 'game.Game', 'Game', ([], {}), '()\n', (286, 288), False, 'from game import Game\n'), ((323, 363), 'randomagent.RandomAgent', 'RandomAgent', (['self._game', 'Const.MARK_GOAT'], {}), '(self._game, Const.MARK_GOAT)\n', (334, 363), False, 'from randomagent import RandomAgent\n'), ((399, 440), 'randomagent.Ra... |
import sys
import os
import json
from cx_Freeze import setup, Executable
import urllib.request, ssl, certifi
request = urllib.request.Request(
f"https://api.type.world/latestUnpublishedVersion/world.type.guiapp/windows/?APPBUILD_KEY={os.environ['APPBUILD_KEY']}"
)
sslcontext = ssl.create_default_context(cafile=c... | [
"certifi.where",
"os.path.dirname",
"os.path.join",
"os.getenv"
] | [((319, 334), 'certifi.where', 'certifi.where', ([], {}), '()\n', (332, 334), False, 'import urllib.request, ssl, certifi\n'), ((625, 659), 'os.path.join', 'os.path.join', (['baseFolder', '"""app.py"""'], {}), "(baseFolder, 'app.py')\n", (637, 659), False, 'import os\n'), ((868, 904), 'os.path.join', 'os.path.join', ([... |
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import re
path='/var/www/test/tagging/tools/db/tags/'
def getTagset():
tagsetFile = open(path+'tagset.txt', 'r')
h = {}
for line in tagsetFile:
matchObj = re.match(r'^(\w+)\s+([0-9,]+)$', line)
if matchObj:
tagName = matchObj.grou... | [
"re.match"
] | [((225, 264), 're.match', 're.match', (['"""^(\\\\w+)\\\\s+([0-9,]+)$"""', 'line'], {}), "('^(\\\\w+)\\\\s+([0-9,]+)$', line)\n", (233, 264), False, 'import re\n')] |
# ActivitySim
# See full license in LICENSE.txt.
from builtins import range
import logging
import numpy as np
import pandas as pd
from activitysim.core import logit
from activitysim.core import config
from activitysim.core import inject
from activitysim.core import tracing
from activitysim.core import chunk
from act... | [
"logging.getLogger",
"activitysim.core.util.reindex",
"activitysim.core.config.config_file_path",
"activitysim.core.chunk.log_df",
"activitysim.core.tracing.has_trace_targets",
"activitysim.core.tracing.extend_trace_label",
"numpy.arange",
"activitysim.core.logit.make_choices",
"numpy.where",
"act... | [((588, 615), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (605, 615), False, 'import logging\n'), ((14433, 14446), 'activitysim.core.inject.step', 'inject.step', ([], {}), '()\n', (14444, 14446), False, 'from activitysim.core import inject\n'), ((1374, 1409), 'activitysim.core.util.rei... |
import datetime as dt
import os.path
import pytest
from tzlocal import get_localzone
from validate import VdtValueError
from khal.settings import get_config
from khal.settings.exceptions import (CannotParseConfigFileError,
InvalidSettingsError)
from khal.settings.utils import (co... | [
"khal.settings.utils.config_checks",
"tzlocal.get_localzone",
"khal.settings.utils.get_all_vdirs",
"khal.settings.utils.get_color_from_vdir",
"pytest.raises",
"khal.settings.utils.is_color",
"datetime.timedelta",
"khal.settings.utils.get_unique_name",
"khal.settings.get_config"
] | [((7296, 7317), 'khal.settings.utils.config_checks', 'config_checks', (['config'], {}), '(config)\n', (7309, 7317), False, 'from khal.settings.utils import config_checks, get_all_vdirs, get_color_from_vdir, get_unique_name, is_color\n'), ((618, 728), 'khal.settings.get_config', 'get_config', (["(PATH + 'simple.conf')"]... |
import numpy as np
from sklearn.naive_bayes import MultinomialNB
from sklearn import metrics
from sklearn.decomposition import NMF
import datetime
import matplotlib.pyplot as plt
if __name__ == "__main__":
startTime = datetime.datetime.now()
# Load training data
x = np.load('data/train_w2v_data_array.npy'... | [
"matplotlib.pyplot.savefig",
"numpy.add",
"numpy.amin",
"matplotlib.pyplot.ylabel",
"sklearn.metrics.average_precision_score",
"matplotlib.pyplot.show",
"matplotlib.pyplot.xlabel",
"numpy.where",
"sklearn.metrics.precision_recall_curve",
"matplotlib.pyplot.fill_between",
"datetime.datetime.now",... | [((223, 246), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (244, 246), False, 'import datetime\n'), ((281, 321), 'numpy.load', 'np.load', (['"""data/train_w2v_data_array.npy"""'], {}), "('data/train_w2v_data_array.npy')\n", (288, 321), True, 'import numpy as np\n'), ((330, 372), 'numpy.load', 'np... |
import pygame
class color:
black = (0, 0, 0)
white = (255, 255, 255)
red = (255, 0, 0)
blue = (0, 0, 255)
green = (0, 255, 0)
yellow = (255, 255, 0)
dark_red = (100, 0, 0)
dark_blue = (0, 0, 100)
dark_green = (0, 100, 0)
dark_yellow = (100, 100, 0)
class button:
func = No... | [
"pygame.draw.circle",
"pygame.init",
"pygame.draw.line",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.mouse.get_pos",
"pygame.time.Clock",
"pygame.draw.rect",
"pygame.display.set_caption",
"pygame.display.update",
"pygame.font.SysFont"
] | [((904, 979), 'pygame.draw.rect', 'pygame.draw.rect', (['gameDisplay', 'self.color', '(self.x, self.y, self.w, self.h)'], {}), '(gameDisplay, self.color, (self.x, self.y, self.w, self.h))\n', (920, 979), False, 'import pygame\n'), ((4009, 4065), 'pygame.draw.circle', 'pygame.draw.circle', (['gameDisplay', 'c', '(self.x... |
"""
=====================
Gramian Angular Field
=====================
A Gramian Angular Field is an image obtained from a time series, representing
some temporal correlation between each time point. Two methods are
available: Gramian Angular Summation Field and Gramian Angular Difference
Field. This example illustrate... | [
"pyts.datasets.load_gunpoint",
"pyts.image.GramianAngularField",
"matplotlib.pyplot.colorbar",
"matplotlib.pyplot.figure",
"mpl_toolkits.axes_grid1.ImageGrid",
"matplotlib.pyplot.suptitle",
"matplotlib.pyplot.show"
] | [((763, 793), 'pyts.datasets.load_gunpoint', 'load_gunpoint', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (776, 793), False, 'from pyts.datasets import load_gunpoint\n'), ((858, 912), 'pyts.image.GramianAngularField', 'GramianAngularField', ([], {'image_size': '(24)', 'method': '"""summation"""'}), "(image_s... |
""" Code for the EKF Refactored """
import sympy
from sympy import atan, pi, tan
from sympy import symbols, Matrix
from math import sqrt, tan, cos, sin, atan2
import matplotlib.pyplot as plt
import numpy as np
from numpy.random import randn
from filterpy.kalman import ExtendedKalmanFilter as EKF
from numpy import arra... | [
"sympy.sin",
"sympy.cos",
"filterpy.kalman.ExtendedKalmanFilter.__init__",
"math.tan",
"sympy.Matrix",
"sympy.tan",
"sympy.symbols",
"numpy.array",
"numpy.dot",
"math.cos",
"math.sin"
] | [((417, 444), 'filterpy.kalman.ExtendedKalmanFilter.__init__', 'EKF.__init__', (['self', '(3)', '(2)', '(2)'], {}), '(self, 3, 2, 2)\n', (429, 444), True, 'from filterpy.kalman import ExtendedKalmanFilter as EKF\n'), ((605, 639), 'sympy.symbols', 'symbols', (['"""a, x, y, v, w, theta, t"""'], {}), "('a, x, y, v, w, the... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | [
"testcase.utils.Constant.Constant",
"sys.path.append",
"yat.test.Node",
"testcase.utils.Logger.Logger"
] | [((885, 922), 'sys.path.append', 'sys.path.append', (["(sys.path[0] + '/../')"], {}), "(sys.path[0] + '/../')\n", (900, 922), False, 'import sys\n'), ((1057, 1065), 'testcase.utils.Logger.Logger', 'Logger', ([], {}), '()\n', (1063, 1065), False, 'from testcase.utils.Logger import Logger\n'), ((1294, 1308), 'yat.test.No... |
import glob
import json
from cfpq_data.config import RELEASE_INFO
def rdf_dict():
data_rdf = dict()
names_rdf = RELEASE_INFO['RDF']
for name in names_rdf:
with open(f'./cfpq_data/data/RDF/Graphs/{name}_meta.json', 'r') as graph_info:
data_rdf[name] = json.load(graph_info)
return d... | [
"json.load",
"glob.glob"
] | [((286, 307), 'json.load', 'json.load', (['graph_info'], {}), '(graph_info)\n', (295, 307), False, 'import json\n'), ((504, 568), 'glob.glob', 'glob.glob', (["('./cfpq_data/data/MemoryAliases/Graphs/' + name + '*')"], {}), "('./cfpq_data/data/MemoryAliases/Graphs/' + name + '*')\n", (513, 568), False, 'import glob\n'),... |
from __future__ import annotations
import dataclasses
def argsort_permutation(arr: list[int]) -> list[int]:
order = [0] * len(arr)
for i, value in enumerate(arr):
order[value] = i
return order
@dataclasses.dataclass
class CompressionResult:
compressed: list[int]
retrieve:... | [
"bisect.bisect_left"
] | [((475, 499), 'bisect.bisect_left', 'bisect.bisect_left', (['v', 'x'], {}), '(v, x)\n', (493, 499), False, 'import bisect\n')] |
# coding: utf-8
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless req... | [
"oslo_utils.timeutils.utcnow",
"json.loads",
"murano.db.models.Environment",
"murano.api.v1.environments.Controller",
"murano.tests.unit.utils.save_models",
"oslo_config.cfg.StrOpt",
"json.dumps",
"murano.common.config.CONF.register_opts",
"oslo_utils.timeutils.isotime"
] | [((1052, 1077), 'murano.api.v1.environments.Controller', 'environments.Controller', ([], {}), '()\n', (1075, 1077), False, 'from murano.api.v1 import environments\n'), ((1779, 1810), 'murano.common.config.CONF.register_opts', 'config.CONF.register_opts', (['opts'], {}), '(opts)\n', (1804, 1810), False, 'from murano.com... |
import numpy as np
import pandas as pd
import pyro
import pyro.distributions as dist
import torch
from pyro.nn import PyroModule
from scvi import _CONSTANTS
from scvi.data._anndata import get_from_registry
from scvi.nn import one_hot
# class NegativeBinomial(TorchDistributionMixin, ScVINegativeBinomial):
# pass
c... | [
"pyro.distributions.Exponential",
"torch.ones",
"scvi.nn.one_hot",
"pyro.distributions.GammaPoisson",
"numpy.power",
"pyro.deterministic",
"torch.tensor",
"scvi.data._anndata.get_from_registry",
"pyro.distributions.Gamma",
"numpy.dot",
"numpy.arange",
"pyro.plate"
] | [((8385, 8448), 'pyro.plate', 'pyro.plate', (['"""obs_plate"""'], {'size': 'self.n_obs', 'dim': '(-2)', 'subsample': 'idx'}), "('obs_plate', size=self.n_obs, dim=-2, subsample=idx)\n", (8395, 8448), False, 'import pyro\n'), ((9542, 9576), 'scvi.nn.one_hot', 'one_hot', (['batch_index', 'self.n_batch'], {}), '(batch_inde... |
import math
print("keep all values greater than 0")
forceA=float(input("Enter number of non artillery forces for side A: "))
forceB=float(input("Enter number of non artillery forces for side B: "))
deteffectivenessA=float(input("Enter the organic detection effectiveness (%) of side A: "))
deteffectivenessB=float(i... | [
"math.pow"
] | [((1478, 1506), 'math.pow', 'math.pow', (['(forceA / forceB)', '(2)'], {}), '(forceA / forceB, 2)\n', (1486, 1506), False, 'import math\n'), ((1780, 1808), 'math.pow', 'math.pow', (['(forceA / forceB)', '(2)'], {}), '(forceA / forceB, 2)\n', (1788, 1808), False, 'import math\n'), ((2129, 2157), 'math.pow', 'math.pow', ... |
# Copyright 2021 <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((2131, 2169), 'setuptools.setup', 'setup', ([], {'classifiers': 'classifiers'}), '(classifiers=classifiers, **info)\n', (2136, 2169), False, 'from setuptools import find_packages, setup\n'), ((986, 1010), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""."""'}), "(where='.')\n", (999, 1010), False, 'fr... |
import codecs
import json
import dill
import pickle
import inspect
import logging
logger = logging.getLogger(__name__)
from funcx.serialize.base import fxPicker_enforcer, fxPicker_shared
class json_base64(fxPicker_shared):
_identifier = '00\n'
_for_code = False
def __init__(self):
super().__ini... | [
"logging.getLogger",
"pickle.dumps",
"json.dumps",
"dill.source.getsource",
"inspect.getsource"
] | [((92, 119), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (109, 119), False, 'import logging\n'), ((370, 386), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (380, 386), False, 'import json\n'), ((1786, 1813), 'dill.source.getsource', 'dill.source.getsource', (['data'], {}), '(... |