code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
import os
import numpy as np
import pyscal.core as pc
import pyscal.crystal_structures as pcs
def test_q_4():
atoms, boxdims = pcs.make_crystal('bcc', repetitions = [4, 4, 4])
sys = pc.System()
sys.atoms = atoms
sys.box = boxdims
#sys.get_neighbors(method = 'voronoi')
... | [
"pyscal.crystal_structures.make_crystal",
"numpy.array",
"pyscal.core.System"
] | [((153, 199), 'pyscal.crystal_structures.make_crystal', 'pcs.make_crystal', (['"""bcc"""'], {'repetitions': '[4, 4, 4]'}), "('bcc', repetitions=[4, 4, 4])\n", (169, 199), True, 'import pyscal.crystal_structures as pcs\n'), ((213, 224), 'pyscal.core.System', 'pc.System', ([], {}), '()\n', (222, 224), True, 'import pysca... |
# Monitors a directory and if it sees a file or files newer that some time,
# create a manifest and send a message to the message queue.
from dirmon import checkDir
from manifest import generateFileManifest
import argparse
import json
import zmq
context = zmq.Context()
socket = context.socket(zmq.REQ)
socket.connect("... | [
"argparse.ArgumentParser",
"dirmon.checkDir",
"manifest.generateFileManifest",
"json.dumps",
"zmq.Context"
] | [((257, 270), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (268, 270), False, 'import zmq\n'), ((366, 391), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (389, 391), False, 'import argparse\n'), ((782, 828), 'dirmon.checkDir', 'checkDir', (["args['dir']"], {'last_mtime': "args['time']"}), "... |
"""Samples given according to http://oauth.net/core/1.0/#sig_base_example"""
from __future__ import print_function
import unittest
from emailage import signature
class SignatureTest(unittest.TestCase):
def setUp(self):
self.method = 'GET'
self.url = 'http://photos.example.net/photos'
... | [
"unittest.main",
"emailage.signature.concatenate_request_elements",
"emailage.signature.create",
"emailage.signature.normalize_query_parameters"
] | [((3630, 3645), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3643, 3645), False, 'import unittest\n'), ((1882, 1931), 'emailage.signature.normalize_query_parameters', 'signature.normalize_query_parameters', (['self.params'], {}), '(self.params)\n', (1918, 1931), False, 'from emailage import signature\n'), ((234... |
from django.contrib import admin
from .models import *
admin.site.register(Artwork)
admin.site.register(Category)
admin.site.register(Artist)
admin.site.register(Project)
| [
"django.contrib.admin.site.register"
] | [((56, 84), 'django.contrib.admin.site.register', 'admin.site.register', (['Artwork'], {}), '(Artwork)\n', (75, 84), False, 'from django.contrib import admin\n'), ((85, 114), 'django.contrib.admin.site.register', 'admin.site.register', (['Category'], {}), '(Category)\n', (104, 114), False, 'from django.contrib import a... |
import time
import math
import ast
import pickle
from collections import defaultdict
from whr.player import Player
from whr.game import Game
from whr.utils import test_stability
class Base:
def __init__(self, config=None):
if config is None:
self.config = defaultdict(lambda: None)
els... | [
"whr.utils.test_stability",
"whr.player.Player",
"time.time",
"collections.defaultdict",
"whr.game.Game",
"ast.literal_eval"
] | [((4485, 4554), 'whr.game.Game', 'Game', (['black_player', 'white_player', 'winner', 'time_step', 'handicap', 'extras'], {}), '(black_player, white_player, winner, time_step, handicap, extras)\n', (4489, 4554), False, 'from whr.game import Game\n'), ((6500, 6511), 'time.time', 'time.time', ([], {}), '()\n', (6509, 6511... |
from rest_framework import viewsets
from provider.models import Provider
from provider.api.paginations import ProviderPagination
from serializers import ProviderSerializer
from rest_framework.decorators import permission_classes
from rest_framework.permissions import IsAuthenticatedOrReadOnly
@permission_classes((IsA... | [
"rest_framework.decorators.permission_classes",
"provider.models.Provider.objects.all"
] | [((297, 345), 'rest_framework.decorators.permission_classes', 'permission_classes', (['(IsAuthenticatedOrReadOnly,)'], {}), '((IsAuthenticatedOrReadOnly,))\n', (315, 345), False, 'from rest_framework.decorators import permission_classes\n'), ((407, 429), 'provider.models.Provider.objects.all', 'Provider.objects.all', (... |
# -*- coding: utf-8 -*-
"""
Created on Sun May 15 22:37:00 2016
@author: <NAME>
"""
import random
import time
import numpy
from solution import solution
def PSO(objf, lb, ub, dim, popSize, iters):
# PSO parameters
vMax = 6
wMax = 0.9
wMin = 0.2
c1 = 2
c2 = 2
s = solution()
if... | [
"numpy.random.uniform",
"solution.solution",
"numpy.zeros",
"time.strftime",
"numpy.clip",
"time.time",
"random.random"
] | [((303, 313), 'solution.solution', 'solution', ([], {}), '()\n', (311, 313), False, 'from solution import solution\n'), ((485, 512), 'numpy.zeros', 'numpy.zeros', (['(popSize, dim)'], {}), '((popSize, dim))\n', (496, 512), False, 'import numpy\n'), ((531, 551), 'numpy.zeros', 'numpy.zeros', (['popSize'], {}), '(popSize... |
#!/usr/bin/env python3
import sys
def is_low(grid: list, r: int, c: int) -> bool:
rows = len(grid)
cols = len(grid[0])
x = grid[r][c]
return (
(r == 0 or grid[r - 1][c] > x)
and (c == 0 or grid[r][c - 1] > x)
and (r == rows - 1 or grid[r + 1][c] > x)
and (c == cols - ... | [
"sys.stdin.read"
] | [((1667, 1683), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (1681, 1683), False, 'import sys\n')] |
'''
Library containing definitions relevent to GRBL-based controllers
* List of Supported G-Codes in Grbl v1.1:
- Non-Modal Commands:
* G4: dwell for given period (X, U, or P)
* G10 L2 P?: change G5? work coordinate system origin setting
* G10 L20 P?: calculated G5? work coordinate system origin
* G2... | [
"parse.parse",
"collections.namedtuple"
] | [((17554, 17609), 'collections.namedtuple', 'namedtuple', (['"""Setting"""', '"""default name units description"""'], {}), "('Setting', 'default name units description')\n", (17564, 17609), False, 'from collections import namedtuple\n'), ((26319, 26346), 'parse.parse', 'parse', (['"""ALARM:{num:d}"""', 'msg'], {}), "('... |
# Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# 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... | [
"os.environ.get",
"os.getpid"
] | [((676, 710), 'os.environ.get', 'os.environ.get', (['"""LATENCY_TEST_BIN"""'], {}), "('LATENCY_TEST_BIN')\n", (690, 710), False, 'import shlex, subprocess, time, os, socket, sys\n'), ((799, 810), 'os.getpid', 'os.getpid', ([], {}), '()\n', (808, 810), False, 'import shlex, subprocess, time, os, socket, sys\n'), ((899, ... |
#!/usr/bin/env python
"""Run a command in every package, in order of increasing dependency."""
import os
import subprocess
import sys
PACKAGE_DEPENDENCY_LIST = [
# Order matters! Packages must be handled in dependency order (most
# independent first) in order for them to resolve properly.
"contract_add... | [
"os.chdir",
"subprocess.check_call"
] | [((571, 588), 'os.chdir', 'os.chdir', (['package'], {}), '(package)\n', (579, 588), False, 'import os\n'), ((593, 628), 'subprocess.check_call', 'subprocess.check_call', (['sys.argv[1:]'], {}), '(sys.argv[1:])\n', (614, 628), False, 'import subprocess\n'), ((633, 647), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..'... |
from trame import get_app_instance
from trame.html import AbstractElement, Template
try:
import numpy as np
from numbers import Number
except:
# dataframe_to_grid won't work
pass
# Make sure used module is available
_app = get_app_instance()
if "vuetify" not in _app.vue_use:
_app.vue_use += ["vuet... | [
"trame.get_app_instance",
"trame.html.Template.slot_names.update",
"numpy.isinf",
"numpy.isnan"
] | [((241, 259), 'trame.get_app_instance', 'get_app_instance', ([], {}), '()\n', (257, 259), False, 'from trame import get_app_instance\n'), ((3125, 3163), 'trame.html.Template.slot_names.update', 'Template.slot_names.update', (['slot_names'], {}), '(slot_names)\n', (3151, 3163), False, 'from trame.html import AbstractEle... |
#!/usr/bin/python
#
# Copyright (C) 2016 Google, Inc
# Written by <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: GPL-2.0+
#
import struct
import sys
import fdt_util
import libfdt
# This deals with a device tree, presenting it as an assortment of Node and
# Prop objects, representing nodes and properties, respect... | [
"libfdt.fdt_off_dt_struct",
"fdt_util.fdt32_to_cpu",
"libfdt.fdt_next_property_offset",
"libfdt.Fdt",
"libfdt.fdt_pack",
"struct.pack",
"libfdt.fdt_first_property_offset",
"libfdt.fdt_strerror",
"libfdt.fdt_totalsize",
"fdt_util.EnsureCompiled"
] | [((1606, 1643), 'fdt_util.fdt32_to_cpu', 'fdt_util.fdt32_to_cpu', (['self.value[:4]'], {}), '(self.value[:4])\n', (1627, 1643), False, 'import fdt_util\n'), ((10363, 10394), 'libfdt.fdt_totalsize', 'libfdt.fdt_totalsize', (['self._fdt'], {}), '(self._fdt)\n', (10383, 10394), False, 'import libfdt\n'), ((11159, 11216), ... |
# probability.py
import scipy
import numpy as np
################################################################################
# Functions:
# Phi
# T
# SkewNorm
# SampleSkewNorm
################################################################################
def Phi(x, m, s, a):
return 0.5 * (1. + scipy.speci... | [
"numpy.random.rand",
"scipy.optimize.newton",
"scipy.integrate.quad"
] | [((962, 978), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (976, 978), True, 'import numpy as np\n'), ((1134, 1164), 'scipy.optimize.newton', 'scipy.optimize.newton', (['func', '(0)'], {}), '(func, 0)\n', (1155, 1164), False, 'import scipy\n'), ((459, 488), 'scipy.integrate.quad', 'scipy.integrate.quad', ([... |
from datetime import datetime, timedelta
from threading import Lock
from cutecare.backends import BluetoothInterface
import logging
_HANDLE_READ_SENSOR_DATA = 0x25
_LOGGER = logging.getLogger(__name__)
class CuteCarePollerCC41A(object):
def __init__(self, mac, backend, adapter='hci0'):
self._mac = mac
... | [
"cutecare.backends.BluetoothInterface",
"logging.getLogger"
] | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n'), ((347, 383), 'cutecare.backends.BluetoothInterface', 'BluetoothInterface', (['backend', 'adapter'], {}), '(backend, adapter)\n', (365, 383), False, 'from cutecare.backends import Bluetooth... |
"""
desispec.fiberbitmasking
==============
Functions to properly take FIBERSTATUS into account in the variances for data reduction
"""
from __future__ import absolute_import, division
import numpy as np
from astropy.table import Table
from desiutil.log import get_logger
from desispec.maskbits import fibermask as fm... | [
"desiutil.log.get_logger",
"astropy.table.Table",
"numpy.int32"
] | [((2333, 2354), 'astropy.table.Table', 'Table', (['frame.fibermap'], {}), '(frame.fibermap)\n', (2338, 2354), False, 'from astropy.table import Table\n'), ((2401, 2413), 'desiutil.log.get_logger', 'get_logger', ([], {}), '()\n', (2411, 2413), False, 'from desiutil.log import get_logger\n'), ((2780, 2797), 'numpy.int32'... |
from cosmo_tester.framework.test_hosts import Hosts, VM
def get_test_prerequisites(ssh_key, module_tmpdir, test_config, logger,
request, vm_os, manager_count=1):
hosts = Hosts(ssh_key, module_tmpdir, test_config, logger, request,
manager_count + 1)
hosts.instances[... | [
"cosmo_tester.framework.test_hosts.VM",
"cosmo_tester.framework.test_hosts.Hosts"
] | [((203, 281), 'cosmo_tester.framework.test_hosts.Hosts', 'Hosts', (['ssh_key', 'module_tmpdir', 'test_config', 'logger', 'request', '(manager_count + 1)'], {}), '(ssh_key, module_tmpdir, test_config, logger, request, manager_count + 1)\n', (208, 281), False, 'from cosmo_tester.framework.test_hosts import Hosts, VM\n'),... |
import math
import operator as op
from collections import ChainMap
from types import MappingProxyType
from .symbol import Symbol
from hyperpython import h
import imp
def eval(x, env=None):
"""
Avalia expressão no ambiente de execução dado.
"""
# Cria ambiente padrão, caso o usuário não passe o arg... | [
"collections.ChainMap",
"hyperpython.h"
] | [((2466, 2494), 'collections.ChainMap', 'ChainMap', (['kwargs', 'global_env'], {}), '(kwargs, global_env)\n', (2474, 2494), False, 'from collections import ChainMap\n'), ((376, 400), 'collections.ChainMap', 'ChainMap', (['{}', 'global_env'], {}), '({}, global_env)\n', (384, 400), False, 'from collections import ChainMa... |
# This file is part of astro_metadata_translator.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
# (http://www.lsst.org).
# See the LICENSE file at the top-level directory of this distribution
# for details of code ownership.
#
# Use of this source code... | [
"astro_metadata_translator.fix_header",
"traceback.print_exc",
"argparse.ArgumentParser",
"logging.basicConfig",
"importlib.import_module",
"logging.warn",
"yaml.dump",
"astro_metadata_translator.MetadataTranslator.determine_translator",
"astro_metadata_translator.ObservationInfo"
] | [((2222, 2312), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Summarize headers from astronomical data files"""'}), "(description=\n 'Summarize headers from astronomical data files')\n", (2245, 2312), False, 'import argparse\n'), ((12457, 12622), 'logging.warn', 'logging.warn', (['""... |
# coding: utf-8
from __future__ import annotations
from datetime import date, datetime # noqa: F401
import re # noqa: F401
from typing import Any, Dict, List, Optional # noqa: F401
from pydantic import AnyUrl, BaseModel, EmailStr, validator # noqa: F401
from acapy_wrapper.models.indy_rev_reg_def import IndyRevRe... | [
"pydantic.validator",
"re.match"
] | [((2598, 2621), 'pydantic.validator', 'validator', (['"""created_at"""'], {}), "('created_at')\n", (2607, 2621), False, 'from pydantic import AnyUrl, BaseModel, EmailStr, validator\n'), ((2862, 2886), 'pydantic.validator', 'validator', (['"""cred_def_id"""'], {}), "('cred_def_id')\n", (2871, 2886), False, 'from pydanti... |
import math
from dataclasses import dataclass
from typing import Tuple, List, TypeVar
T = TypeVar('T')
@dataclass
class BrowserConfig:
index: int = 0
item_per_line: int = 1
item_per_page: int = 1
tool_bar: bool = True
transpose_grid: bool = False # TODO: transpose orientation
def range(self... | [
"typing.TypeVar"
] | [((91, 103), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (98, 103), False, 'from typing import Tuple, List, TypeVar\n')] |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
class PhoneItem(scrapy.Item):
# define the fields for your item here like:
name = scrapy.Field()
brand = scrapy.Field()
model = scrapy.Field()
category = s... | [
"scrapy.Field"
] | [((235, 249), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (247, 249), False, 'import scrapy\n'), ((262, 276), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (274, 276), False, 'import scrapy\n'), ((289, 303), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (301, 303), False, 'import scrapy\n'), ((319, 333), ... |
# Copyright (c) 2015-2018 Cisco Systems, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge... | [
"os.environ.copy",
"molecule.util.os_walk",
"os.path.dirname",
"molecule.logger.get_logger"
] | [((1226, 1253), 'molecule.logger.get_logger', 'logger.get_logger', (['__name__'], {}), '(__name__)\n', (1243, 1253), False, 'from molecule import logger\n'), ((3559, 3576), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (3574, 3576), False, 'import os\n'), ((4309, 4351), 'molecule.util.os_walk', 'util.os_walk'... |
from onegov.core.security import Private
from onegov.form import merge_forms
from onegov.org.views.payment import view_payments, export_payments
from onegov.town6 import TownApp
from onegov.org.forms import DateRangeForm, ExportForm
from onegov.pay import PaymentCollection
from onegov.town6.layout import PaymentCollec... | [
"onegov.form.merge_forms",
"onegov.town6.TownApp.html",
"onegov.town6.layout.PaymentCollectionLayout"
] | [((334, 420), 'onegov.town6.TownApp.html', 'TownApp.html', ([], {'model': 'PaymentCollection', 'template': '"""payments.pt"""', 'permission': 'Private'}), "(model=PaymentCollection, template='payments.pt', permission=\n Private)\n", (346, 420), False, 'from onegov.town6 import TownApp\n'), ((508, 546), 'onegov.town6... |
""" TensorMONK :: regularizations """
__all__ = ["DropOut"]
def DropOut(tensor_size, p, dropblock=True, **kwargs):
import torch.nn as nn
if p > 0:
if len(tensor_size) == 4:
if dropblock:
from .dropblock import DropBlock
kwgs = {}
if "block_s... | [
"torch.nn.Dropout",
"torch.nn.Dropout2d"
] | [((887, 900), 'torch.nn.Dropout', 'nn.Dropout', (['p'], {}), '(p)\n', (897, 900), True, 'import torch.nn as nn\n'), ((838, 853), 'torch.nn.Dropout2d', 'nn.Dropout2d', (['p'], {}), '(p)\n', (850, 853), True, 'import torch.nn as nn\n')] |
import logging
# # Local imports
from rdigraphs.sgtaskmanager import SgTaskManager
# #####################
# PROBABLY USELESS
from pathlib import Path
import platform
# This is to solve a known incompatibility issue between matplotlib and
# tkinter on mac os.
if platform.system() == 'Darwin': # Darwin is the sys... | [
"logging.info",
"pathlib.Path",
"matplotlib.use",
"platform.system",
"rdigraphs.supergraph.validator.Validator"
] | [((266, 283), 'platform.system', 'platform.system', ([], {}), '()\n', (281, 283), False, 'import platform\n'), ((507, 530), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (521, 530), False, 'import matplotlib\n'), ((1308, 1317), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (1312, 131... |
# -*- encoding: utf-8 -*-
"""Information about the backend H2O cluster."""
from __future__ import division, print_function, absolute_import, unicode_literals
import sys
import time
import h2o
from h2o.exceptions import H2OConnectionError, H2OServerError
from h2o.display import H2ODisplay
from h2o.utils.compatibility ... | [
"h2o.api",
"time.time",
"h2o.expr.ExprNode",
"h2o.utils.shared_utils.get_human_readable_bytes",
"h2o.utils.shared_utils.get_human_readable_time",
"h2o.rapids",
"h2o.utils.typechecks.assert_is_type",
"h2o.connection",
"h2o.display.H2ODisplay"
] | [((1282, 1293), 'time.time', 'time.time', ([], {}), '()\n', (1291, 1293), False, 'import time\n'), ((5596, 5624), 'h2o.utils.typechecks.assert_is_type', 'assert_is_type', (['prompt', 'bool'], {}), '(prompt, bool)\n', (5610, 5624), False, 'from h2o.utils.typechecks import assert_is_type\n'), ((9305, 9334), 'h2o.api', 'h... |
from flask import Blueprint, render_template, redirect, url_for
from rest_api.forms.address import AddressCreateForm
from rest_api.models.address import AddressModel
address_bp = Blueprint("address", __name__)
@address_bp.route("/create/<int:company_id><int:user_id>", methods=["GET", "POST"])
def address_create(com... | [
"rest_api.models.address.AddressModel",
"flask.Blueprint",
"flask.url_for",
"flask.render_template",
"rest_api.forms.address.AddressCreateForm",
"rest_api.models.address.AddressModel.find_by_id"
] | [((179, 209), 'flask.Blueprint', 'Blueprint', (['"""address"""', '__name__'], {}), "('address', __name__)\n", (188, 209), False, 'from flask import Blueprint, render_template, redirect, url_for\n'), ((351, 370), 'rest_api.forms.address.AddressCreateForm', 'AddressCreateForm', ([], {}), '()\n', (368, 370), False, 'from ... |
# Copyright (c) 2019, NVIDIA CORPORATION.
#
# 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... | [
"cuml.dask.common.comms.CommsContext",
"cuml.dask.common.input_utils.DistributedDataHandler.create",
"cuml.dask.common.comms.worker_state",
"cuml.dask.common.part_utils.flatten_grouped_results",
"cuml.dask.common.input_utils.to_output"
] | [((2078, 2135), 'cuml.dask.common.input_utils.DistributedDataHandler.create', 'DistributedDataHandler.create', ([], {'data': 'X', 'client': 'self.client'}), '(data=X, client=self.client)\n', (2107, 2135), False, 'from cuml.dask.common.input_utils import DistributedDataHandler\n'), ((2191, 2220), 'cuml.dask.common.comms... |
"""Testing utils for jupyter_client tests
"""
import os
import sys
from tempfile import TemporaryDirectory
from typing import Dict
from unittest.mock import patch
import pytest
from jupyter_client import AsyncKernelManager
from jupyter_client import AsyncMultiKernelManager
from jupyter_client import KernelManager
fr... | [
"sys.platform.startswith",
"tempfile.TemporaryDirectory"
] | [((419, 449), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (442, 449), False, 'import sys\n'), ((674, 694), 'tempfile.TemporaryDirectory', 'TemporaryDirectory', ([], {}), '()\n', (692, 694), False, 'from tempfile import TemporaryDirectory\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from fastapi import APIRouter, File, UploadFile
from plugins.github import Github
from utils.spider import put, delete
from config import *
import time
router = APIRouter()
@router.get("/trending/", include_in_schema=True)
async def trending(type: str = "trending",
... | [
"time.ctime",
"plugins.github.Github",
"fastapi.File",
"utils.spider.put",
"utils.spider.delete",
"fastapi.APIRouter"
] | [((207, 218), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (216, 218), False, 'from fastapi import APIRouter, File, UploadFile\n'), ((909, 918), 'fastapi.File', 'File', (['...'], {}), '(...)\n', (913, 918), False, 'from fastapi import APIRouter, File, UploadFile\n'), ((1830, 1839), 'fastapi.File', 'File', (['...... |
from urllib.parse import urljoin
from twisted.web import resource
from twisted.web import server
from twisted.web import static
from twisted.web import util
class SiteTest:
def setUp(self):
from twisted.internet import reactor
super().setUp()
self.site = reactor.listenTCP(0, test_site(),... | [
"urllib.parse.urljoin",
"twisted.web.util.Redirect.render",
"twisted.web.static.Data",
"twisted.web.resource.Resource",
"twisted.internet.reactor.run",
"twisted.web.util.Redirect",
"twisted.web.server.Site"
] | [((855, 874), 'twisted.web.resource.Resource', 'resource.Resource', ([], {}), '()\n', (872, 874), False, 'from twisted.web import resource\n'), ((1480, 1494), 'twisted.web.server.Site', 'server.Site', (['r'], {}), '(r)\n', (1491, 1494), False, 'from twisted.web import server\n'), ((1694, 1707), 'twisted.internet.reacto... |
import math
import torch
import gpytorch
import numpy as np
import random
from matplotlib import pyplot as plt
from pssgp.kernels import MyMaternKernel
from unittest import TestCase
# We will use the simplest form of GP model, exact inference
class ExactGPModel(gpytorch.models.ExactGP):
def __init__(self, train_x... | [
"numpy.random.seed",
"gpytorch.distributions.MultivariateNormal",
"gpytorch.mlls.ExactMarginalLogLikelihood",
"math.sqrt",
"torch.manual_seed",
"gpytorch.settings.fast_pred_var",
"pssgp.kernels.MyMaternKernel",
"gpytorch.kernels.MaternKernel",
"random.seed",
"gpytorch.likelihoods.GaussianLikelihoo... | [((1210, 1269), 'gpytorch.mlls.ExactMarginalLogLikelihood', 'gpytorch.mlls.ExactMarginalLogLikelihood', (['likelihood', 'model'], {}), '(likelihood, model)\n', (1250, 1269), False, 'import gpytorch\n'), ((453, 482), 'gpytorch.means.ConstantMean', 'gpytorch.means.ConstantMean', ([], {}), '()\n', (480, 482), False, 'impo... |
import builtins
import hashlib
import json
import base64
from flask import Flask
from flask.globals import request
from google.cloud import bigquery
import datetime
app = Flask(__name__)
def process_jenkins_event(msg):
envelope = json.loads(base64.b64decode(msg["data"]).decode("utf-8").strip())
#envelope =... | [
"google.cloud.bigquery.Client",
"flask.Flask",
"json.dumps",
"flask.globals.request.get_json",
"base64.b64decode",
"datetime.datetime.utcfromtimestamp"
] | [((173, 188), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'from flask import Flask\n'), ((1628, 1645), 'google.cloud.bigquery.Client', 'bigquery.Client', ([], {}), '()\n', (1643, 1645), False, 'from google.cloud import bigquery\n'), ((2966, 2984), 'flask.globals.request.get_json', 're... |
"""Metadata table."""
from typing import List
from pma_api.app import PmaApiFlask
from pma_api.utils import get_app_instance
from pma_api.models import db
app: PmaApiFlask = get_app_instance()
class Task(db.Model):
"""Tasks
Attribute 'id' is not auto-generated / auto-incremented, but is actually
a un... | [
"pma_api.models.db.Column",
"pma_api.task_utils.validate_active_task_status",
"pma_api.utils.get_app_instance",
"pma_api.models.db.session.add",
"pma_api.models.db.session.commit",
"pma_api.models.db.Boolean"
] | [((178, 196), 'pma_api.utils.get_app_instance', 'get_app_instance', ([], {}), '()\n', (194, 196), False, 'from pma_api.utils import get_app_instance\n'), ((398, 436), 'pma_api.models.db.Column', 'db.Column', (['db.String'], {'primary_key': '(True)'}), '(db.String, primary_key=True)\n', (407, 436), False, 'from pma_api.... |
from pytorch_lightning import Trainer
from models import TSPAgent
from argparse import ArgumentParser
def main(args):
model = TSPAgent(args)
trainer = Trainer.from_argparse_args(args)
trainer.fit(model)
trainer.save_checkpoint(f'tsp{args.n_node}_ep{trainer.current_epoch}.ckpt')
if __name__ == '__mai... | [
"models.TSPAgent",
"pytorch_lightning.Trainer.from_argparse_args",
"argparse.ArgumentParser"
] | [((132, 146), 'models.TSPAgent', 'TSPAgent', (['args'], {}), '(args)\n', (140, 146), False, 'from models import TSPAgent\n'), ((161, 193), 'pytorch_lightning.Trainer.from_argparse_args', 'Trainer.from_argparse_args', (['args'], {}), '(args)\n', (187, 193), False, 'from pytorch_lightning import Trainer\n'), ((339, 355),... |
import matplotlib as mpl
import numpy as np
import pandas
import sys
from matplotlib import pyplot as pp
from pprint import pprint
from prep_data import get_raw_xy
from prep_data import get_vpo
sizes = [[15, 8, 10], [20, 10, 20]]
sidx = 1
def setup_plot(sidx=sidx, yfrom=1973, yto=2020, step=4, xls=sizes[sidx][2]):
... | [
"matplotlib.pyplot.title",
"matplotlib.rc",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"prep_data.get_raw_xy",
"pandas.read_csv",
"matplotlib.pyplot.style.use",
"prep_data.get_vpo",
"numpy.array",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matp... | [((376, 406), 'matplotlib.rc', 'mpl.rc', (['"""xtick"""'], {'labelsize': 'xls'}), "('xtick', labelsize=xls)\n", (382, 406), True, 'import matplotlib as mpl\n'), ((411, 452), 'matplotlib.rc', 'mpl.rc', (['"""ytick"""'], {'labelsize': 'sizes[sidx][2]'}), "('ytick', labelsize=sizes[sidx][2])\n", (417, 452), True, 'import ... |
import mxnet as mx
from mxnet import ndarray as nd
from mxnet.gluon import nn
from mxnet import gluon
import utils
import mrt as _mrt
import gluon_zoo as zoo
import sym_pass as spass
import sym_utils as sutils
import sim_quant_helper as sim
import dataset
import logging
def load_fname(suffix=None, with_ext=False):
... | [
"sim_quant_helper.load_real_data",
"sym_utils.get_mxnet_op",
"gluon_zoo.save_model",
"logging.getLogger",
"mrt.split_model",
"utils.extend_fname",
"sim_quant_helper.load_ext",
"sym_pass.sym_quant_prepare",
"mxnet.sym.var",
"mrt.MRT",
"utils.multi_validate",
"mxnet.gpu",
"mxnet.gluon.nn.Symbo... | [((442, 478), 'utils.extend_fname', 'utils.extend_fname', (['prefix', 'with_ext'], {}), '(prefix, with_ext)\n', (460, 478), False, 'import utils\n'), ((707, 722), 'mxnet.nd.waitall', 'mx.nd.waitall', ([], {}), '()\n', (720, 722), True, 'import mxnet as mx\n'), ((1854, 1896), 'logging.getLogger', 'logging.getLogger', ([... |
#!/usr/bin/env python
# coding: utf-8
# vim:softtabstop=4:ts=4:sw=4:expandtab:tw=120
import argparse
import datetime
import git
import hashlib
import logging
import logging.handlers
import os
import sys
import traceback
def _update_logger(verbosity):
if verbosity == 0:
_log.setLevel(logging.ERROR)
eli... | [
"git.Git",
"os.path.abspath",
"hashlib.md5",
"argparse.ArgumentParser",
"os.path.isdir",
"os.getcwd",
"logging.StreamHandler",
"os.walk",
"logging.Formatter",
"logging.captureWarnings",
"sys.exc_info",
"traceback.print_exception",
"os.path.join",
"logging.getLogger",
"argparse.ArgumentTy... | [((476, 503), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (493, 503), False, 'import logging\n'), ((508, 537), 'logging.captureWarnings', 'logging.captureWarnings', (['(True)'], {}), '(True)\n', (531, 537), False, 'import logging\n'), ((583, 643), 'logging.Formatter', 'logging.Formatte... |
# this code performes a dimension reduction on the dataset,
# using a DenseNet121 pretrained model.
import tensorflow as tf
from scipy.io import loadmat, savemat
import numpy as np
FV = loadmat('images.mat')
data = FV['data']
labels = FV['labels']
print(data.shape)
labels = labels.transpose()
labels = labels.ravel()... | [
"scipy.io.loadmat",
"tensorflow.keras.Input",
"scipy.io.savemat",
"tensorflow.keras.models.Model",
"numpy.array",
"tensorflow.keras.layers.GlobalAveragePooling2D",
"tensorflow.keras.applications.DenseNet121"
] | [((189, 210), 'scipy.io.loadmat', 'loadmat', (['"""images.mat"""'], {}), "('images.mat')\n", (196, 210), False, 'from scipy.io import loadmat, savemat\n'), ((350, 385), 'tensorflow.keras.Input', 'tf.keras.Input', ([], {'shape': '(224, 224, 3)'}), '(shape=(224, 224, 3))\n', (364, 385), True, 'import tensorflow as tf\n')... |
import numpy as np
from matplotlib import pyplot as plt
from ..Xfit.basic import fitline, fitline0, fitconstant
from ..Xfit.MCMC_straight_line import mcmc_sl
from ..Xfit.fit_basic import fit_basic
from ..Xplot.niceplot import niceplot
from matplotlib.offsetbox import AnchoredText
from matplotlib import ticker
def plo... | [
"matplotlib.offsetbox.AnchoredText",
"numpy.zeros",
"numpy.isfinite",
"numpy.hstack",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.ma.masked_array",
"numpy.mean",
"matplotlib.pyplot.subplots",
"numpy.delete",
"numpy.sqrt"
] | [((2329, 2347), 'numpy.arange', 'np.arange', (['qv.size'], {}), '(qv.size)\n', (2338, 2347), True, 'import numpy as np\n'), ((1386, 1413), 'numpy.arange', 'np.arange', (['(modes - 1)', 'modes'], {}), '(modes - 1, modes)\n', (1395, 1413), True, 'import numpy as np\n'), ((1438, 1453), 'numpy.array', 'np.array', (['modes'... |
import numpy as np
import os
import shutil
import tempfile
import unittest
import yt
from yt.utilities.exceptions import \
YTProfileDataShape
from yt.data_objects.particle_filters import add_particle_filter
from yt.data_objects.profiles import Profile1D, Profile2D, Profile3D,\
create_profile
from yt.testing im... | [
"numpy.nan_to_num",
"yt.YTQuantity",
"yt.data_objects.profiles.Profile2D",
"numpy.ones",
"numpy.isnan",
"numpy.random.normal",
"shutil.rmtree",
"os.chdir",
"yt.data_objects.profiles.create_profile",
"yt.testing.assert_equal",
"yt.load_particles",
"yt.testing.fake_random_ds",
"tempfile.mkdtem... | [((15715, 15741), 'yt.testing.requires_module', 'requires_module', (['"""astropy"""'], {}), "('astropy')\n", (15730, 15741), False, 'from yt.testing import assert_equal, assert_raises, assert_rel_equal, fake_random_ds, requires_module\n'), ((16912, 16937), 'yt.testing.requires_module', 'requires_module', (['"""pandas""... |
"""Reconcile Halo issues against Jira."""
import os
import logging
from concurrent.futures import ThreadPoolExecutor, as_completed
from cloudpassage.exceptions import CloudPassageResourceExistence
from itertools import groupby
import json
import hashlib
from .halo import Halo
from .jira_local import JiraLocal
from .log... | [
"itertools.groupby",
"os.cpu_count",
"concurrent.futures.as_completed",
"json.dumps"
] | [((1699, 1778), 'itertools.groupby', 'groupby', (['sorted_issues'], {'key': '(lambda issue: {x: issue[x] for x in groupby_params})'}), '(sorted_issues, key=lambda issue: {x: issue[x] for x in groupby_params})\n', (1706, 1778), False, 'from itertools import groupby\n'), ((2457, 2491), 'concurrent.futures.as_completed', ... |
"""
@author: <NAME>
@contact: U{<EMAIL><mailto:<EMAIL>>}
@since: 2011-11-23
"""
from abc import abstractmethod
from pytest_splunk_addon.helmut.manager import Manager
from pytest_splunk_addon.helmut.misc.collection import Collection
from pytest_splunk_addon.helmut.misc.manager_utils import (
create_wrapper_from_con... | [
"pytest_splunk_addon.helmut.manager.Manager.__init__",
"pytest_splunk_addon.helmut.misc.manager_utils.create_wrapper_from_connector_mapping",
"pytest_splunk_addon.helmut.misc.collection.Collection.__init__"
] | [((966, 999), 'pytest_splunk_addon.helmut.manager.Manager.__init__', 'Manager.__init__', (['self', 'connector'], {}), '(self, connector)\n', (982, 999), False, 'from pytest_splunk_addon.helmut.manager import Manager\n'), ((1008, 1033), 'pytest_splunk_addon.helmut.misc.collection.Collection.__init__', 'Collection.__init... |
import os
import subprocess
import pytest
from unit.applications.lang.java import TestApplicationJava
from unit.option import option
class TestJavaIsolationRootfs(TestApplicationJava):
prerequisites = {'modules': {'java': 'all'}}
def setup_method(self, is_su):
if not is_su:
return
... | [
"subprocess.Popen",
"os.chmod",
"os.makedirs",
"pytest.fail",
"pytest.skip"
] | [((323, 361), 'os.makedirs', 'os.makedirs', (["(option.temp_dir + '/jars')"], {}), "(option.temp_dir + '/jars')\n", (334, 361), False, 'import os\n'), ((370, 407), 'os.makedirs', 'os.makedirs', (["(option.temp_dir + '/tmp')"], {}), "(option.temp_dir + '/tmp')\n", (381, 407), False, 'import os\n'), ((416, 455), 'os.chmo... |
# Generated by Django 2.2.3 on 2019-07-30 12:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quotes', '0002_auto_20190722_2143'),
]
operations = [
migrations.AddField(
model_name='quote',
name='no_user_favouri... | [
"django.db.models.DateTimeField",
"django.db.models.PositiveIntegerField"
] | [((344, 382), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n', (371, 382), False, 'from django.db import migrations, models\n'), ((508, 546), 'django.db.models.PositiveIntegerField', 'models.PositiveIntegerField', ([], {'default': '(0)'}), '(default=0)\n... |
import cgi
from docify.lib.formatter import Formatter
from docify import Document, components as c
__all__ = [
'DOC_TMPL',
'HTML'
]
DOC_TMPL = '''\
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
... | [
"cgi.escape"
] | [((1515, 1536), 'cgi.escape', 'cgi.escape', (['obj.value'], {}), '(obj.value)\n', (1525, 1536), False, 'import cgi\n')] |
#!/usr/bin/python
"""
Custom Smart Substation Communication Topology
----------------------------------
Model built using Sayon (a MIT License Software).
----------------------------------
W A R N I N G:
----------------------------------
--> Please make sure you know Mininet Python API very well before editing this f... | [
"mininet.topo.Topo.__init__",
"mininet.topo.Topo"
] | [((879, 911), 'mininet.topo.Topo.__init__', 'Topo.__init__', (['self'], {'link': 'TCLink'}), '(self, link=TCLink)\n', (892, 911), False, 'from mininet.topo import Topo\n'), ((1375, 1381), 'mininet.topo.Topo', 'Topo', ([], {}), '()\n', (1379, 1381), False, 'from mininet.topo import Topo\n')] |
from datetime import datetime as dt
from enum import Enum
from math import ceil
ISO8601_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
class LiftStatus(Enum):
STOPPED = 0
IN_ACTION = 1
class ActorStatus(Enum):
IDLE = 0
EXPECT = 1
IN_LIFT = 2
class Lift():
def __init__(self, id, speed, max_weight, floo... | [
"datetime.datetime.utcnow",
"math.ceil"
] | [((1336, 1376), 'math.ceil', 'ceil', (['(self.position / self._floor_height)'], {}), '(self.position / self._floor_height)\n', (1340, 1376), False, 'from math import ceil\n'), ((4717, 4728), 'datetime.datetime.utcnow', 'dt.utcnow', ([], {}), '()\n', (4726, 4728), True, 'from datetime import datetime as dt\n')] |
"""
Mock Library for RPi.GPIO
"""
import time
import logging
import os
import yaml
logger = logging.getLogger(__name__)
log_level = os.getenv('LOG_LEVEL')
if log_level is not None:
if log_level == "Info":
logger.setLevel(logging.INFO)
if log_level == "Debug":
logger.setLevel(logging.DEBUG)
... | [
"logging.StreamHandler",
"time.sleep",
"logging.Formatter",
"os.getenv",
"logging.getLogger"
] | [((94, 121), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (111, 121), False, 'import logging\n'), ((135, 157), 'os.getenv', 'os.getenv', (['"""LOG_LEVEL"""'], {}), "('LOG_LEVEL')\n", (144, 157), False, 'import os\n'), ((594, 653), 'logging.Formatter', 'logging.Formatter', (['"""%(asctim... |
# -*- coding: utf-8 -*-
# This file is a part of DDT (https://github.com/datadriventests/ddt)
# Copyright 2012-2015 <NAME> and DDT contributors
# For the exact contribution history, see the git revision log.
# DDT is licensed under the MIT License, included in
# https://github.com/datadriventests/ddt/blob/master/LICENS... | [
"yaml.load",
"json.load",
"codecs.open",
"os.path.dirname",
"os.path.exists",
"yaml.safe_load",
"functools.wraps",
"re.sub",
"inspect.getsourcefile"
] | [((4151, 4189), 're.sub', 're.sub', (['"""\\\\W|^(?=\\\\d)"""', '"""_"""', 'test_name'], {}), "('\\\\W|^(?=\\\\d)', '_', test_name)\n", (4157, 4189), False, 'import re\n'), ((4355, 4366), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (4360, 4366), False, 'from functools import wraps\n'), ((5580, 5606), 'inspe... |
import logging
import os
import cv2
import numpy as np
import inferencing_pb2
import media_pb2
import extension_pb2
import extension_pb2_grpc
# import timeit as t
from enum import Enum
from shared_memory import SharedMemoryManager
from exception_handler import PrintGetExceptionDetails
from model_wrapper import Yolo... | [
"cv2.imwrite",
"numpy.frombuffer",
"shared_memory.SharedMemoryManager",
"extension_pb2.MediaStreamMessage",
"media_pb2.MediaDescriptor",
"model_wrapper.YoloV4Model",
"logging.info",
"inferencing_pb2.Tag",
"numpy.array",
"inferencing_pb2.Rectangle",
"os.getenv",
"exception_handler.PrintGetExcep... | [((489, 507), 'os.getenv', 'os.getenv', (['"""DEBUG"""'], {}), "('DEBUG')\n", (498, 507), False, 'import os\n'), ((2192, 2205), 'model_wrapper.YoloV4Model', 'YoloV4Model', ([], {}), '()\n', (2203, 2205), False, 'from model_wrapper import YoloV4Model\n'), ((3403, 3439), 'cv2.imwrite', 'cv2.imwrite', (['outputFileName', ... |
#!/usr/bin/env python
# coding: utf-8
# Copy from https://github.com/Urinx/WeixinBot/blob/master/wxbot_project_py2.7/config/constant.py
import time
class Constant(object):
"""
@brief All used constants are listed here
"""
WECHAT_CONFIG_FILE = 'config/wechat.conf'
WECHAT_COOKIE_FILE = 'config/... | [
"time.localtime"
] | [((4484, 4500), 'time.localtime', 'time.localtime', ([], {}), '()\n', (4498, 4500), False, 'import time\n'), ((4775, 4791), 'time.localtime', 'time.localtime', ([], {}), '()\n', (4789, 4791), False, 'import time\n')] |
"""Implementation of treadmill-admin CLI plugin."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import click
from treadmill import cli
from treadmill import restclient
from treadmill import yamlwrapper ... | [
"treadmill.restclient.delete",
"treadmill.restclient.put",
"click.argument",
"treadmill.restclient.post",
"click.option",
"click.Choice",
"treadmill.yamlwrapper.load",
"click.Path",
"treadmill.cli.make_formatter",
"io.open",
"click.group",
"treadmill.cli.handle_exceptions",
"treadmill.restcl... | [((406, 419), 'click.group', 'click.group', ([], {}), '()\n', (417, 419), False, 'import click\n'), ((425, 545), 'click.option', 'click.option', (['"""--cell"""'], {'required': '(True)', 'envvar': '"""TREADMILL_CELL"""', 'callback': 'cli.handle_context_opt', 'expose_value': '(False)'}), "('--cell', required=True, envva... |
import pika
import sys
import os
import time
from pathlib import Path
class LogConfirmer(object):
FILENAME = "log.txt"
def __init__(self):
self.cache_dict = {}
self.already = set()
try:
os.remove(self.FILENAME)
Path(self.FILENAME).touch()
except OSError... | [
"os.remove",
"pika.ConnectionParameters",
"time.time",
"pathlib.Path",
"os._exit",
"sys.exit"
] | [((1805, 1848), 'pika.ConnectionParameters', 'pika.ConnectionParameters', ([], {'host': '"""localhost"""'}), "(host='localhost')\n", (1830, 1848), False, 'import pika\n'), ((233, 257), 'os.remove', 'os.remove', (['self.FILENAME'], {}), '(self.FILENAME)\n', (242, 257), False, 'import os\n'), ((1029, 1040), 'time.time', ... |
import numpy as np
import os
# lib from Qiskit Aqua
# from qiskit.aqua import Operator, QuantumInstance
# from qiskit.aqua.algorithms import VQE, ExactEigensolver
# from qiskit.aqua.components.optimizers import COBYLA
from qiskit.aqua.operators import Z2Symmetries
from qiskit.circuit.instruction import Instruction
# li... | [
"qiskit.chemistry.components.variational_forms.UCCSD",
"qiskit.chemistry.FermionicOperator",
"qiskit.chemistry.components.initial_states.HartreeFock",
"torchquantum.plugins.qiskit2tq",
"qiskit.chemistry.drivers.PySCFDriver",
"pdb.set_trace",
"numpy.random.rand",
"qiskit.aqua.operators.Z2Symmetries.two... | [((710, 1004), 'torchquantum.plugins.qiskit_processor.QiskitProcessor', 'QiskitProcessor', ([], {'use_real_qc': '(False)', 'backend_name': 'None', 'noise_model_name': 'None', 'coupling_map_name': 'None', 'basis_gates_name': 'None', 'n_shots': '(8192)', 'initial_layout': 'None', 'seed_transpiler': '(42)', 'seed_simulato... |
# Author: <NAME>
import unittest
import redis
import threading
import time
import copy
from redis_rw_lock import RWLock
class Writer(threading.Thread):
def __init__(self, buffer_, rw_lock, init_sleep_time, sleep_time, to_write):
"""
@param buffer_: common buffer_ shared by the readers and writer... | [
"copy.deepcopy",
"threading.Thread.__init__",
"redis_rw_lock.RWLock",
"time.time",
"time.sleep",
"redis.StrictRedis"
] | [((675, 706), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (700, 706), False, 'import threading\n'), ((1089, 1123), 'time.sleep', 'time.sleep', (['self.__init_sleep_time'], {}), '(self.__init_sleep_time)\n', (1099, 1123), False, 'import time\n'), ((1183, 1194), 'time.time', 'tim... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright (c) 2014, <NAME>. All rights reserved.
# Distributed under the terms of the new BSD License.
# -----------------------------------------------------------------------------
"""
An ArrayList is a strongly ... | [
"numpy.resize",
"numpy.log2",
"numpy.zeros",
"numpy.ones",
"numpy.array"
] | [((2573, 2599), 'numpy.array', 'np.array', (['data'], {'copy': '(False)'}), '(data, copy=False)\n', (2581, 2599), True, 'import numpy as np\n'), ((3563, 3594), 'numpy.zeros', 'np.zeros', (['(self._count, 2)', 'int'], {}), '((self._count, 2), int)\n', (3571, 3594), True, 'import numpy as np\n'), ((3747, 3771), 'numpy.ze... |
import datetime
import re
import sys
from cybox.objects.account_object import Account
from cybox.objects.address_object import Address
from cybox.objects.archive_file_object import ArchiveFile
from cybox.objects.domain_name_object import DomainName
from cybox.objects.email_message_object import EmailMessage
from cybox... | [
"stix2elevator.options.error",
"stix2elevator.ids.get_object_id_value",
"stix2.ObjectPath.make_object_path",
"stix2.FloatConstant",
"stix2elevator.ids.add_object_id_value",
"stix2elevator.ids.get_id_value",
"stix2elevator.options.warn",
"stix2elevator.utils.map_vocabs_to_label",
"re.match",
"stix2... | [((6988, 7047), 'stix2elevator.options.error', 'error', (['"""Placeholder %s should be resolved"""', '(203)', 'self.idref'], {}), "('Placeholder %s should be resolved', 203, self.idref)\n", (6993, 7047), False, 'from stix2elevator.options import error, info, warn\n'), ((15663, 15734), 'stix2elevator.options.error', 'er... |
import lightgbm as lgb
import numpy as np
import pandas as pd
from attrdict import AttrDict
from sklearn.externals import joblib
from steppy.base import BaseTransformer
from .utils import NeptuneContext, get_logger
neptune_ctx = NeptuneContext()
logger = get_logger()
class LightGBM(BaseTransformer):
def __init_... | [
"sklearn.externals.joblib.dump",
"lightgbm.train",
"lightgbm.Dataset",
"numpy.array",
"sklearn.externals.joblib.load"
] | [((1858, 1970), 'lightgbm.Dataset', 'lgb.Dataset', ([], {'data': 'X', 'label': 'y', 'feature_name': 'feature_names', 'categorical_feature': 'categorical_features'}), '(data=X, label=y, feature_name=feature_names,\n categorical_feature=categorical_features, **kwargs)\n', (1869, 1970), True, 'import lightgbm as lgb\n'... |
from libs.base import get_webdriver
def main():
driver_name = "firefox"
# This will not work on my linux box because my
# version of chrome is too new...
# driver_name = "chrome"
browser = get_webdriver(driver_name=driver_name)
browser.get("http://seleniumhq.org/")
browser.implicitly_wa... | [
"libs.base.get_webdriver"
] | [((213, 251), 'libs.base.get_webdriver', 'get_webdriver', ([], {'driver_name': 'driver_name'}), '(driver_name=driver_name)\n', (226, 251), False, 'from libs.base import get_webdriver\n')] |
import logging
import inspect
import ast
import io
import importlib
import operator
from ._base_node import NodeEntityBase
from ._class_node import ClassNode
from ._function_node import FunctionNode
from apistub import Navigation, Kind, NavigationTag
filter_function = lambda x: isinstance(x, FunctionNode)
filter_clas... | [
"apistub.Navigation",
"inspect.isroutine",
"inspect.isclass",
"apistub.NavigationTag",
"inspect.getmembers"
] | [((1312, 1340), 'inspect.getmembers', 'inspect.getmembers', (['self.obj'], {}), '(self.obj)\n', (1330, 1340), False, 'import inspect\n'), ((1460, 1487), 'inspect.isclass', 'inspect.isclass', (['member_obj'], {}), '(member_obj)\n', (1475, 1487), False, 'import inspect\n'), ((4039, 4087), 'apistub.Navigation', 'Navigatio... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: tensorflow_serving/config/logging_config.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.pro... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((470, 496), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (494, 496), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((2402, 2783), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""log_collector_confi... |
from django.db import models
from treebeard.mp_tree import MP_Node
class Object(models.Model):
name = models.CharField(max_length=50)
class TreeNode(MP_Node):
name = models.CharField(max_length=30)
def __unicode__(self):
return 'Category: %s' % self.name
| [
"django.db.models.CharField"
] | [((108, 139), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (124, 139), False, 'from django.db import models\n'), ((178, 209), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (194, 209), False, 'from django.db im... |
# -*- coding: utf-8 -*-
# Copyright 2018 <NAME> & <NAME>. 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
#
#... | [
"numpy.zeros_like",
"numpy.maximum",
"numpy.tanh",
"numpy.ones_like",
"numpy.square",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.arctan"
] | [((725, 736), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (733, 736), True, 'import numpy as np\n'), ((749, 765), 'numpy.maximum', 'np.maximum', (['(0)', 'x'], {}), '(0, x)\n', (759, 765), True, 'import numpy as np\n'), ((805, 816), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (813, 816), True, 'import numpy a... |
#Author-<NAME>
#Description-Create a basic multi-post setup sheet
import adsk.core, adsk.fusion, adsk.cam, traceback
import os, sys, re
import math
import time
import pathlib
THISSCRIPT = "Setup Sheet Generator v2 (c) <NAME> 2020"
# Set these to True or False (case sensitive) to enable or disable output
TXTOUTPUT = ... | [
"os.remove",
"pathlib.Path.home",
"math.sqrt",
"math.atan2",
"re.finditer",
"os.system",
"time.sleep",
"pathlib.Path",
"traceback.format_exc",
"os.path.join",
"os.startfile"
] | [((2411, 2426), 'time.sleep', 'time.sleep', (['(0.2)'], {}), '(0.2)\n', (2421, 2426), False, 'import time\n'), ((2441, 2460), 'pathlib.Path', 'pathlib.Path', (['fname'], {}), '(fname)\n', (2453, 2460), False, 'import pathlib\n'), ((2737, 2752), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (2747, 2752), False... |
from torch import nn
from drnn import DRNN
class DRNN_Copy(nn.Module):
def __init__(self, input_size, hidden_size, num_layers, dropout, output_size):
super(DRNN_Copy, self).__init__()
self.drnn = DRNN(cell_type='GRU', dropout=dropout, n_hidden=hidden_size,
n_input=input_s... | [
"drnn.DRNN",
"torch.nn.Linear"
] | [((219, 343), 'drnn.DRNN', 'DRNN', ([], {'cell_type': '"""GRU"""', 'dropout': 'dropout', 'n_hidden': 'hidden_size', 'n_input': 'input_size', 'n_layers': 'num_layers', 'batch_first': '(True)'}), "(cell_type='GRU', dropout=dropout, n_hidden=hidden_size, n_input=\n input_size, n_layers=num_layers, batch_first=True)\n",... |
"""
.. function:: execnselect(query:None, [path:None, variables])
This function expecting the query results to be target queries for execution (similar to exec).
Base on the parameters executes the target queries with the appropriate execution environment
and returns the results of the last target query.
*path* ... | [
"os.path.abspath",
"traceback.print_exc",
"os.getcwd",
"functions.register",
"re.match",
"apsw.complete",
"functions.Connection",
"sys.setdefaultencoding",
"functions.vtable.vtbase.VTGenerator",
"os.chdir",
"doctest.testmod",
"re.compile"
] | [((725, 755), 're.compile', 're.compile', (['"""/\\\\*.*?\\\\*/(.*)$"""'], {}), "('/\\\\*.*?\\\\*/(.*)$')\n", (735, 755), False, 'import re\n'), ((808, 853), 're.match', 're.match', (['"""\\\\s*--"""', 's', '(re.DOTALL | re.UNICODE)'], {}), "('\\\\s*--', s, re.DOTALL | re.UNICODE)\n", (816, 853), False, 'import re\n'),... |
import pandas as pd
import numpy as np
from sklearn.metrics import f1_score, accuracy_score, precision_score, recall_score
import time
import matplotlib.pyplot as plt
df = pd.read_csv("FinalData2.csv")
df['label'] = df['label'].map({1: -1,0 : 1})
df.head()
print(df.dtypes)
from sklearn.cluster import DBSCAN
t1 = tim... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.plot",
"pandas.read_csv",
"time.process_time",
"sklearn.metrics.accuracy_score",
"matplotlib.pyplot.legend",
"sklearn.metrics.recall_score",
"sklearn.metrics.f1_score",
"sklearn.metrics.precision_score",
"matplotlib.pyplot.ylabel",
"matplotlib.pypl... | [((172, 201), 'pandas.read_csv', 'pd.read_csv', (['"""FinalData2.csv"""'], {}), "('FinalData2.csv')\n", (183, 201), True, 'import pandas as pd\n'), ((317, 336), 'time.process_time', 'time.process_time', ([], {}), '()\n', (334, 336), False, 'import time\n'), ((357, 416), 'sklearn.cluster.DBSCAN', 'DBSCAN', ([], {'eps': ... |
# Generated by Django 3.2 on 2021-04-14 03:23
from django.db import migrations, models
import game.models
class Migration(migrations.Migration):
dependencies = [
('game', '0002_alter_room_players'),
]
operations = [
migrations.AlterField(
model_name='room',
name=... | [
"django.db.models.CharField"
] | [((348, 691), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[(game.models.GameRoom.StatusType['ORGANIZE'], game.models.GameRoom.\n StatusType['ORGANIZE']), (game.models.GameRoom.StatusType['PLAYING'],\n game.models.GameRoom.StatusType['PLAYING']), (game.models.GameRoom.\n StatusType['END'... |
# Copyright 2017 theloop, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"loopchain.utils.dict_to_binary",
"logging.error",
"struct.pack",
"time.time",
"hashlib.sha256",
"collections.OrderedDict",
"loopchain.tools.PublicVerifierContainer.get_public_verifier"
] | [((1467, 1492), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1490, 1492), False, 'import collections\n'), ((4609, 4641), 'loopchain.utils.dict_to_binary', 'util.dict_to_binary', (['self.__meta'], {}), '(self.__meta)\n', (4628, 4641), True, 'import loopchain.utils as util\n'), ((4663, 4698), ... |
import numpy as np
import pytest
from numpy import linalg
import numpy.testing as npt
import itertools
from utils import get_rstate, get_printing
import dynesty # noqa
from dynesty import utils as dyfunc # noqa
"""
Run a series of basic tests to check whether anything huge is broken.
"""
nlive = 500
printing = get... | [
"numpy.abs",
"dynesty.utils.mean_and_cov",
"dynesty.DynamicNestedSampler",
"dynesty.utils.jitter_run",
"numpy.exp",
"utils.get_printing",
"dynesty.utils.unravel_run",
"numpy.std",
"numpy.identity",
"numpy.linspace",
"dynesty.utils.simulate_run",
"itertools.product",
"numpy.linalg.det",
"nu... | [((317, 331), 'utils.get_printing', 'get_printing', ([], {}), '()\n', (329, 331), False, 'from utils import get_rstate, get_printing\n'), ((520, 560), 'numpy.exp', 'np.exp', (['(results.logwt - results.logz[-1])'], {}), '(results.logwt - results.logz[-1])\n', (526, 560), True, 'import numpy as np\n'), ((1451, 1491), 'n... |
# Crichton, Admirable Source Configuration Management
# Copyright 2012 British Broadcasting Corporation
#
# 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/licens... | [
"south.db.db.delete_table",
"south.db.db.send_create_signal"
] | [((1270, 1324), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""frontend"""', "['FollowedProduct']"], {}), "('frontend', ['FollowedProduct'])\n", (1291, 1324), False, 'from south.db import db\n'), ((1417, 1460), 'south.db.db.delete_table', 'db.delete_table', (['"""frontend_followedproduct"""'], {}), "(... |
#!python3
#encoding:utf-8
import subprocess
import shlex
import time
import requests
import json
class Commiter:
def __init__(self, db, client, user, repo):
# def __init__(self, db, client):
# def __init__(self, data, client):
# self.data = data
self.__db = db
self.__client = client
... | [
"shlex.split",
"time.sleep"
] | [((707, 720), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (717, 720), False, 'import time\n'), ((428, 455), 'shlex.split', 'shlex.split', (['"""git add -n ."""'], {}), "('git add -n .')\n", (439, 455), False, 'import shlex\n'), ((527, 551), 'shlex.split', 'shlex.split', (['"""git add ."""'], {}), "('git add .')... |
# Copyright (c) 2019-2021, <NAME>, <NAME>, <NAME>, and <NAME>.
#
# Distributed under the 3-clause BSD license, see accompanying file LICENSE
# or https://github.com/scikit-hep/vector for details.
import numpy
from vector.compute.planar import x, y
from vector.compute.spatial import z
from vector.methods import (
... | [
"vector.methods._ltype",
"vector.methods._aztype",
"numpy.errstate"
] | [((3109, 3137), 'numpy.errstate', 'numpy.errstate', ([], {'all': '"""ignore"""'}), "(all='ignore')\n", (3123, 3137), False, 'import numpy\n'), ((3044, 3056), 'vector.methods._aztype', '_aztype', (['vec'], {}), '(vec)\n', (3051, 3056), False, 'from vector.methods import AzimuthalRhoPhi, AzimuthalXY, LongitudinalEta, Lon... |
from django.db import models
class Thing(models.Model):
color = models.CharField(max_length=10)
__str__ = __repr__ = lambda self: self.color | [
"django.db.models.CharField"
] | [((69, 100), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)'}), '(max_length=10)\n', (85, 100), False, 'from django.db import models\n')] |
import os
import pytest
import tempfile
import pickle
import numpy as np
from ogindia.utils import comp_array, comp_scalar, dict_compare
from ogindia.get_micro_data import get_calculator
from ogindia import SS, TPI, utils
from ogindia.parameters import Specifications
from taxcalc import GrowFactors
TOL = 1e-5
CUR_PAT... | [
"tempfile.NamedTemporaryFile",
"os.remove",
"ogindia.TPI.run_TPI",
"ogindia.execute.runner",
"os.makedirs",
"taxcalc.GrowFactors",
"os.path.dirname",
"numpy.allclose",
"ogindia.utils.pickle_file_compare",
"ogindia.utils.dict_compare",
"ogindia.parameters.Specifications",
"ogindia.SS.run_SS",
... | [((1635, 1705), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""time_path"""', '[False, True]'], {'ids': "['SS', 'TPI']"}), "('time_path', [False, True], ids=['SS', 'TPI'])\n", (1658, 1705), False, 'import pytest\n'), ((340, 365), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (35... |
# coding=utf-8
from setuptools import find_packages, setup
base_requires = [
'Click',
'ansible==3.0.0',
'backports.shutil_get_terminal_size',
'semver',
'junit_xml',
'structlog'
]
test_requires = base_requires + [
'mock',
'coverage',
'pep8',
'yapf==0.14.0'
]
setup(
name='or... | [
"setuptools.find_packages"
] | [((485, 517), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (498, 517), False, 'from setuptools import find_packages, setup\n')] |
from ansible.module_utils.basic import AnsibleModule, return_values
"""
(c) 2017 <NAME> <<EMAIL>>
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the Lice... | [
"ansible.module_utils.basic.return_values",
"napalm_base.get_network_driver"
] | [((7451, 7477), 'napalm_base.get_network_driver', 'get_network_driver', (['dev_os'], {}), '(dev_os)\n', (7469, 7477), False, 'from napalm_base import get_network_driver\n'), ((5428, 5458), 'ansible.module_utils.basic.return_values', 'return_values', (['provider[param]'], {}), '(provider[param])\n', (5441, 5458), False,... |
#Deploys a stack and S3bucket to cloudformation.
#test
#Imports Python libraries
import boto3
import re
import sys
import argparse
import random
import string
import subprocess
import logging
from datetime import date
from os.path import dirname
script_dir = dirname(__file__)
#Sets logging
logger = logging.getLogger(_... | [
"subprocess.Popen",
"random.SystemRandom",
"logging.FileHandler",
"boto3.client",
"argparse.ArgumentParser",
"os.path.dirname",
"logging.StreamHandler",
"datetime.date.today",
"logging.Formatter",
"logging.getLogger",
"re.compile"
] | [((259, 276), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (266, 276), False, 'from os.path import dirname\n'), ((301, 328), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (318, 328), False, 'import logging\n'), ((372, 470), 'logging.Formatter', 'logging.Formatter', (... |
from distutils.core import setup
from setuptools import find_packages
setup(
name="dgk",
version="0.08.1",
packages=find_packages(),
package_data={"dgk": ["config/*.ini", "database/*.db"]},
url="https://github.com/sg679/disc-golf-keeper",
license="MIT",
author="<NAME>",
description="A ... | [
"setuptools.find_packages"
] | [((130, 145), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (143, 145), False, 'from setuptools import find_packages\n')] |
import logging
from typing import Any, AsyncIterator, Callable
import aioredis
from aiohttp_example.darq import darq
from aiohttp_example.db import create_engine
from aiohttp_example.services import services
log = logging.getLogger(__name__)
async def connect_darq(*args: Any) -> AsyncIterator[None]:
await darq... | [
"aiohttp_example.darq.darq.disconnect",
"aioredis.create_redis_pool",
"aiohttp_example.darq.darq.connect",
"aiohttp_example.db.create_engine",
"logging.getLogger"
] | [((217, 244), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (234, 244), False, 'import logging\n'), ((316, 330), 'aiohttp_example.darq.darq.connect', 'darq.connect', ([], {}), '()\n', (328, 330), False, 'from aiohttp_example.darq import darq\n'), ((351, 368), 'aiohttp_example.darq.darq.d... |
# This file uses the `convert` system function to convert character (such as
# letter, numbers, symbols) to png format images, which will be used to
# annotate objects in YOLO detection.
#
# AUTHORS
#
# The Veracruz Development Team.
#
# COPYRIGHT AND LICENSING
#
# See the `LICENSE_MIT.markdown` file in the Veracruz de... | [
"pipes.quote",
"os.system"
] | [((841, 986), 'os.system', 'os.system', (['(\'convert -fill black -background white -bordercolor white -pointsize %d label:"\\\\ " data/labels/32_%d.png\'\n % (s, s / 12 - 1))'], {}), '(\n \'convert -fill black -background white -bordercolor white -pointsize %d label:"\\\\ " data/labels/32_%d.png\'\n % (s, s... |
from flask import Flask
from flask import request, jsonify
from flask_cors import CORS, cross_origin
from .redactioncalc import get_distances_from_filepaths
import os, json
app= Flask(__name__)
cors = CORS(app)
app.config['CORS_HEADERS'] = 'Content-Type'
@app.route('/', methods=['GET'])
def home():
return '''<h1>New... | [
"os.open",
"flask.request.args.get",
"flask_cors.CORS",
"os.path.getsize",
"flask.Flask",
"flask_cors.cross_origin",
"flask.jsonify",
"os.close",
"os.listdir"
] | [((178, 193), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'from flask import Flask\n'), ((201, 210), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (205, 210), False, 'from flask_cors import CORS, cross_origin\n'), ((498, 512), 'flask_cors.cross_origin', 'cross_origin', ([], {})... |
from flask import Flask, render_template, make_response, request
from routes.index import main
from routes.hello import hello
from routes import allow_cross_domain
from flask_cors import CORS
app = Flask(__name__)
CORS(app, supports_credentials=True)
# 设置 secret_key 来使用 flask 自带的 session
# 这个字符串随便你设置什么内容都可以
app.secr... | [
"flask_cors.CORS",
"flask.Flask",
"flask.render_template"
] | [((200, 215), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'from flask import Flask, render_template, make_response, request\n'), ((216, 252), 'flask_cors.CORS', 'CORS', (['app'], {'supports_credentials': '(True)'}), '(app, supports_credentials=True)\n', (220, 252), False, 'from flask_... |
from flask import jsonify, session, request
from flask_restx import Resource, reqparse, inputs
from modules.LoginModule.LoginModule import user_multi_auth
from modules.FlaskModule.FlaskModule import user_api_ns as api
from opentera.db.models.TeraUser import TeraUser
from opentera.db.models.TeraParticipantGroup import T... | [
"opentera.db.models.TeraParticipantGroup.TeraParticipantGroup.insert",
"modules.FlaskModule.FlaskModule.user_api_ns.expect",
"opentera.db.models.TeraParticipantGroup.TeraParticipantGroup",
"opentera.db.models.TeraParticipantGroup.TeraParticipantGroup.get_participant_group_by_id",
"opentera.db.models.TeraPar... | [((538, 550), 'modules.FlaskModule.FlaskModule.user_api_ns.parser', 'api.parser', ([], {}), '()\n', (548, 550), True, 'from modules.FlaskModule.FlaskModule import user_api_ns as api\n'), ((1419, 1443), 'flask_restx.reqparse.RequestParser', 'reqparse.RequestParser', ([], {}), '()\n', (1441, 1443), False, 'from flask_res... |
#!/usr/bin/env python
"""
.. py:currentmodule:: FileFormat.Results.exported.test_XrayIntensityXY
.. moduleauthor:: <NAME> <<EMAIL>>
Tests for the module XrayIntensityXY.
"""
# Script information for the file.
__author__ = "<NAME> (<EMAIL>)"
__version__ = ""
__date__ = ""
__copyright__ = "Copyright (c) 2014 Hendrix De... | [
"unittest.TestCase.setUp",
"pymcxray.FileFormat.Results.exported.XrayIntensityXY.XrayIntensityXY",
"unittest.TestCase.tearDown",
"pymcxray.Testings.runTestModuleWithCoverage",
"logging.getLogger"
] | [((1732, 1767), 'pymcxray.Testings.runTestModuleWithCoverage', 'runTestModuleWithCoverage', (['__file__'], {}), '(__file__)\n', (1757, 1767), False, 'from pymcxray.Testings import runTestModuleWithCoverage\n'), ((787, 816), 'unittest.TestCase.setUp', 'unittest.TestCase.setUp', (['self'], {}), '(self)\n', (810, 816), Fa... |
#!/usr/bin/env python
'''Communicating with Benchtop RIGOL Spectrum Analyzer RSA5065-TG
'''
from colorama import init, Fore, Back
init(autoreset=True) #to convert termcolor to wins color
from os.path import basename as bs
mdlname = bs(__file__).split('.')[0] # module's name e.g. PSG
from time import sleep
import py... | [
"colorama.init",
"pyqum.instrument.logger.address",
"pyvisa.ResourceManager",
"os.path.basename",
"time.sleep",
"pyqum.instrument.logger.debug"
] | [((131, 151), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (135, 151), False, 'from colorama import init, Fore, Back\n'), ((485, 499), 'pyqum.instrument.logger.debug', 'debug', (['mdlname'], {}), '(mdlname)\n', (490, 499), False, 'from pyqum.instrument.logger import address, set_status,... |
from Bagpipe.importer import raw_importer, pre_analyzed_importer
from itertools import product as prod, combinations, chain
from Bagpipe.exporter import pre_analyzed_exporter
from Rexy.Core.general import cal_sim_product
from statistics import median, mean
from collections import defaultdict
class ProductPreAnalyzer:... | [
"collections.defaultdict",
"itertools.combinations",
"statistics.mean",
"itertools.product",
"Rexy.Core.general.cal_sim_product"
] | [((528, 553), 'itertools.combinations', 'combinations', (['products', '(2)'], {}), '(products, 2)\n', (540, 553), False, 'from itertools import product as prod, combinations, chain\n'), ((740, 757), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (751, 757), False, 'from collections import default... |
import multiprocessing
import sys
import torch.optim as optim
import numpy as np
from functools import partial
from src.base_model import BaseModel
from src.networks import Destilation_student_matchingInstance
from src.utils import save_images
from src.utils import bland_altman_loss, dice_soft_loss, ss_loss, generate_a... | [
"functools.partial",
"src.networks.Destilation_student_matchingInstance",
"numpy.copy",
"src.utils.apply_transform",
"src.utils.generate_affine",
"multiprocessing.Pool",
"torch.optim.lr_scheduler.MultiStepLR"
] | [((797, 871), 'src.networks.Destilation_student_matchingInstance', 'Destilation_student_matchingInstance', (['(self.cf.labels - 1)', 'self.cf.channels'], {}), '(self.cf.labels - 1, self.cf.channels)\n', (833, 871), False, 'from src.networks import Destilation_student_matchingInstance\n'), ((1152, 1246), 'torch.optim.lr... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"marvin.lib.utils.cleanup_resources",
"marvin.lib.base.FireWallRule.create",
"marvin.lib.base.Account.create",
"marvin.lib.common.list_hosts",
"marvin.lib.base.VPC.create",
"marvin.lib.common.get_template",
"marvin.lib.utils.get_process_status",
"marvin.lib.base.ServiceOffering.create",
"socket.setd... | [((2451, 2486), 'logging.getLogger', 'logging.getLogger', (['"""TestNetworkOps"""'], {}), "('TestNetworkOps')\n", (2468, 2486), False, 'import logging\n'), ((2504, 2527), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (2525, 2527), False, 'import logging\n'), ((4925, 4983), 'nose.plugins.attrib.att... |
"""Some utility functions for working with headline of Markdown.
Terminologies
- Headline :: The headline entity OR the text of the headline
- Content :: The content under the current headline. It stops after
encountering a headline with the same or higher level OR EOF.
"""
# Author: <NAME> <<EMAIL>>
import re
impo... | [
"utilities.is_region_void",
"sublime.Region",
"re.match"
] | [((1554, 1603), 'sublime.Region', 'sublime.Region', (['content_line_start_point', 'end_pos'], {}), '(content_line_start_point, end_pos)\n', (1568, 1603), False, 'import sublime\n'), ((3340, 3369), 're.match', 're.match', (['re_string', 'headline'], {}), '(re_string, headline)\n', (3348, 3369), False, 'import re\n'), ((... |
import re
text = input()
pattern = r"\+359( |-)2\1\d{3}\1\d{4}\b"
number = [object.group() for object in re.finditer(pattern, text)]
print(', '.join(number))
| [
"re.finditer"
] | [((106, 132), 're.finditer', 're.finditer', (['pattern', 'text'], {}), '(pattern, text)\n', (117, 132), False, 'import re\n')] |
from twisted.web.error import Error
from twisted.web.http import NOT_ALLOWED
from twisted.web.static import File
class NoListingFile(File):
"""
Serve files, but disallow directory listing.
"""
def directoryListing(self):
# type: () -> None
raise Error(NOT_ALLOWED, b"Not allowed")
| [
"twisted.web.error.Error"
] | [((281, 315), 'twisted.web.error.Error', 'Error', (['NOT_ALLOWED', "b'Not allowed'"], {}), "(NOT_ALLOWED, b'Not allowed')\n", (286, 315), False, 'from twisted.web.error import Error\n')] |
import inspect
import logging
import os
from itertools import product
from multiprocessing import JoinableQueue, Process
from queue import Empty
import numpy as np
import torch
import torch.nn.functional as F
from pandas import DataFrame
from fonduer.learning.models.marginal import Marginal
logger = logging.getLogge... | [
"numpy.concatenate",
"numpy.ravel",
"numpy.argmax",
"torch.nn.functional.cross_entropy",
"logging.getLogger",
"numpy.random.RandomState",
"multiprocessing.Process.__init__",
"numpy.where",
"numpy.array",
"inspect.getargspec",
"pandas.DataFrame.from_records",
"itertools.product",
"numpy.vstac... | [((304, 331), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (321, 331), False, 'import logging\n'), ((1080, 1107), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1097, 1107), False, 'import logging\n'), ((1986, 2013), 'fonduer.learning.models.marginal.Marg... |
#!/usr/bin/env python
"""A QR and BWM Find SCU application.
For sending Query/Retrieve (QR) and Basic Worklist Modality (BWM) C-FIND
requests to a QR/BWM - Find SCP.
"""
import argparse
import sys
from pydicom.dataset import Dataset
from pydicom.uid import (
ExplicitVRLittleEndian,
ImplicitVRLittleEndian,
... | [
"argparse.ArgumentParser",
"pydicom.dataset.Dataset",
"pynetdicom.apps.common.setup_logging",
"pynetdicom.pdu_primitives.SOPClassExtendedNegotiation",
"pynetdicom.AE",
"pynetdicom.apps.common.create_dataset",
"pydicom.uid.generate_uid",
"sys.exit"
] | [((1121, 1549), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""The findscu application implements a Service Class User (SCU) for the Query/Retrieve (QR) and Basic Worklist Management (BWM) Service Classes. findscu only supports query functionality using the C-FIND message. It sends query... |
#!/usr/bin/env python
import sys
import argparse
import math
from typing import List, Tuple
from pysam import Fastafile, Samfile
from rgt.Util import ErrorHandler, HmmData, GenomeData, OverlapType
from rgt.HINT.signalProcessing import GenomicSignal
from rgt.HINT.biasTable import BiasTable
from .constants import *
... | [
"pysam.Samfile",
"rgt.HINT.signalProcessing.GenomicSignal",
"rgt.HINT.biasTable.BiasTable",
"rgt.Util.HmmData",
"rgt.Util.GenomeData"
] | [((983, 1012), 'rgt.Util.GenomeData', 'GenomeData', ([], {'organism': 'assembly'}), '(organism=assembly)\n', (993, 1012), False, 'from rgt.Util import ErrorHandler, HmmData, GenomeData, OverlapType\n'), ((1030, 1039), 'rgt.Util.HmmData', 'HmmData', ([], {}), '()\n', (1037, 1039), False, 'from rgt.Util import ErrorHandl... |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | [
"pyflink.table.TableConfig",
"pyflink.table.BatchTableEnvironment.create",
"pyflink.dataset.ExecutionEnvironment.get_execution_environment"
] | [((3244, 3292), 'pyflink.dataset.ExecutionEnvironment.get_execution_environment', 'ExecutionEnvironment.get_execution_environment', ([], {}), '()\n', (3290, 3292), False, 'from pyflink.dataset import ExecutionEnvironment\n'), ((3348, 3361), 'pyflink.table.TableConfig', 'TableConfig', ([], {}), '()\n', (3359, 3361), Fal... |
from argparse import ArgumentParser
import numpy as np
import requests
from mmcls.apis import inference_model, init_model, show_result_pyplot
def parse_args():
parser = ArgumentParser()
parser.add_argument('img', help='Image file')
parser.add_argument('config', help='Config file')
parser.add_argumen... | [
"argparse.ArgumentParser",
"numpy.allclose",
"mmcls.apis.inference_model",
"mmcls.apis.show_result_pyplot",
"requests.post",
"mmcls.apis.init_model"
] | [((177, 193), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (191, 193), False, 'from argparse import ArgumentParser\n'), ((798, 858), 'mmcls.apis.init_model', 'init_model', (['args.config', 'args.checkpoint'], {'device': 'args.device'}), '(args.config, args.checkpoint, device=args.device)\n', (808, 858... |
#
# https://stackoverflow.com/a/47983927/1832058
#
import tkinter as tk
root = tk.Tk()
root.geometry('250x250')
root.title('Canvas')
canvas = tk.Canvas(root, width=250, height=250)
canvas.pack()
img = tk.PhotoImage(file='hal_9000.gif')
canvas.create_image((0, 0), image=img, anchor='nw')
canvas.create_text((10,... | [
"tkinter.Canvas",
"tkinter.PhotoImage",
"tkinter.Entry",
"tkinter.Tk"
] | [((84, 91), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (89, 91), True, 'import tkinter as tk\n'), ((148, 186), 'tkinter.Canvas', 'tk.Canvas', (['root'], {'width': '(250)', 'height': '(250)'}), '(root, width=250, height=250)\n', (157, 186), True, 'import tkinter as tk\n'), ((208, 242), 'tkinter.PhotoImage', 'tk.PhotoImage... |