code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
from scipy.signal import hilbert
from PyEMD.compact import filt6, pade6
# Visualisation is an optional module. To minimise installation, `matplotlib` is not added
# by default. Please install extras with `pip install -r requirement-extra.txt`.
try:
import pylab as plt
except ImportError:
pa... | [
"PyEMD.compact.filt6",
"PyEMD.compact.pade6",
"pylab.tight_layout",
"numpy.diff",
"numpy.angle",
"numpy.array",
"numpy.cos",
"numpy.sin",
"pylab.subplots",
"scipy.signal.hilbert",
"PyEMD.EMD",
"numpy.arange",
"pylab.show"
] | [((5626, 5647), 'numpy.arange', 'np.arange', (['(0)', '(3)', '(0.01)'], {}), '(0, 3, 0.01)\n', (5635, 5647), True, 'import numpy as np\n'), ((5715, 5720), 'PyEMD.EMD', 'EMD', ([], {}), '()\n', (5718, 5720), False, 'from PyEMD import EMD\n'), ((1818, 1912), 'pylab.subplots', 'plt.subplots', (['num_rows', '(1)'], {'figsi... |
import os
MUSIC_EXTENSIONS=(".mp3",".wav") # Valid music extensions
def is_valid_extension(file_name:str):
if file_name.endswith(MUSIC_EXTENSIONS):
return True
return False
class SongFile:
""" Class that stv ores information of a song file
This class with store the path where is found the s... | [
"os.path.splitext",
"os.path.join"
] | [((1062, 1103), 'os.path.join', 'os.path.join', (['self._path', 'self._file_name'], {}), '(self._path, self._file_name)\n', (1074, 1103), False, 'import os\n'), ((770, 803), 'os.path.splitext', 'os.path.splitext', (['self._file_name'], {}), '(self._file_name)\n', (786, 803), False, 'import os\n')] |
import random
import numpy as np
import threading
import multiprocessing
def TestSquare(square, color):
for y in range(len(square)):
for x in range(len(square[y])):
if square[y][x] != color:
return False
return True
def TestRug(num, dimensions, squareSize, col... | [
"multiprocessing.Manager",
"numpy.zeros",
"random.randint",
"multiprocessing.Pool"
] | [((383, 423), 'numpy.zeros', 'np.zeros', (['(dimensions[0], dimensions[1])'], {}), '((dimensions[0], dimensions[1]))\n', (391, 423), True, 'import numpy as np\n'), ((1886, 1930), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'maxProcesses'}), '(processes=maxProcesses)\n', (1906, 1930), False, 'impo... |
import rclpy
from rclpy.node import Node
from rclpy.qos import QoSProfile
from std_msgs.msg import String
from geometry_msgs.msg import Twist
class KeysToTwist(Node):
key_mapping = {'w': [0., 1.], 'x': [0., -1.],
'a': [-1., 0.], 'd': [1., 0.],
's': [0., 0.]}
def __init__... | [
"rclpy.spin",
"geometry_msgs.msg.Twist",
"rclpy.init",
"rclpy.shutdown",
"rclpy.qos.QoSProfile"
] | [((1047, 1068), 'rclpy.init', 'rclpy.init', ([], {'args': 'args'}), '(args=args)\n', (1057, 1068), False, 'import rclpy\n'), ((1107, 1132), 'rclpy.spin', 'rclpy.spin', (['keys_to_twist'], {}), '(keys_to_twist)\n', (1117, 1132), False, 'import rclpy\n'), ((1170, 1186), 'rclpy.shutdown', 'rclpy.shutdown', ([], {}), '()\n... |
#!/usr/bin/env python
"""
emr_simulator.py
Part of Dooplicity framework
Runs JSON-encoded Hadoop Streaming job flow. FUNCTIONALITY IS IDIOSYNCRATIC;
it is currently confined to those features used by Rail. Format of input JSON
mirrors that of StepConfig list from JSON sent to EMR via RunJobsFlow. Any
files input to a ... | [
"gzip.open",
"tools.make_temp_dir_and_register_cleanup",
"time.sleep",
"os.walk",
"os.remove",
"ipyparallel.Client",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.isdir",
"socket.gethostname",
"interface.DooplicityInterface",
"glob.glob",
"interf... | [((6690, 6734), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'signal.SIG_IGN'], {}), '(signal.SIGINT, signal.SIG_IGN)\n', (6703, 6734), False, 'import signal\n'), ((8947, 9077), 'subprocess.Popen', 'subprocess.Popen', (["('gzip -%d >%s' % (gzip_level, outfn))"], {'shell': '(True)', 'bufsize': '(-1)', 'executabl... |
from autolens.data import ccd
from autolens.data.array import mask as ma
from autolens.lens import ray_tracing, lens_fit
from autolens.model.galaxy import galaxy as g
from autolens.lens import lens_data as ld
from autolens.model.profiles import light_profiles as lp
from autolens.model.profiles import mass_profiles as m... | [
"autolens.data.ccd.load_ccd_data_from_fits",
"autolens.model.profiles.light_profiles.EllipticalSersic",
"autolens.lens.plotters.ray_tracing_plotters.plot_image_plane_image",
"autolens.model.profiles.mass_profiles.EllipticalIsothermal",
"autolens.lens.ray_tracing.TracerImageSourcePlanes",
"autolens.lens.le... | [((1170, 1340), 'autolens.data.ccd.load_ccd_data_from_fits', 'ccd.load_ccd_data_from_fits', ([], {'image_path': "(path + '/data/image.fits')", 'noise_map_path': "(path + '/data/noise_map.fits')", 'psf_path': "(path + '/data/psf.fits')", 'pixel_scale': '(0.1)'}), "(image_path=path + '/data/image.fits',\n noise_map_pa... |
# -*- coding: utf-8 -*-
import os
import logging
from boto.exception import EC2ResponseError
def security_group_exists(self, sg_id=None, name=None):
"""
Checks if a security group already exists on this connection, by name or by ID.
:param boto.ec2.EC2Connection self: Current connection.
:param str... | [
"logging.basicConfig",
"logging.error",
"logging.debug",
"os.path.expanduser"
] | [((4867, 4934), 'logging.debug', 'logging.debug', (['"""Test passed : No instance has the same \'name\' tag."""'], {}), '("Test passed : No instance has the same \'name\' tag.")\n', (4880, 4934), False, 'import logging\n'), ((5086, 5157), 'logging.debug', 'logging.debug', (['"""Test passed : No keypair was found with t... |
"""
Main module for demonstrating time difference between finding elements using
different approaches.
CAUTION!!! It may take around hour of your life:))))
"""
from linkedbst import LinkedBST
if __name__ == '__main__':
tree = LinkedBST()
tree.demo_bst('words.txt') | [
"linkedbst.LinkedBST"
] | [((232, 243), 'linkedbst.LinkedBST', 'LinkedBST', ([], {}), '()\n', (241, 243), False, 'from linkedbst import LinkedBST\n')] |
#! /usr/bin/env python2
import numpy as np
import cv2
def convert_bw(I):
cl = cv2.createCLAHE(clipLimit=5.0)
if I.ndim > 2:
I_g = cv2.cvtColor(I,7)
else:
I_g = I
I_ = cl.apply(I_g)
return I_
def convert_color(I):
cl = cv2.createCLAHE(clipLimit=10.0)
I_ycbcr = cv2.cvtColor(... | [
"cv2.cvtColor",
"cv2.createCLAHE"
] | [((84, 114), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(5.0)'}), '(clipLimit=5.0)\n', (99, 114), False, 'import cv2\n'), ((261, 292), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(10.0)'}), '(clipLimit=10.0)\n', (276, 292), False, 'import cv2\n'), ((307, 326), 'cv2.cvtColor', 'cv2.cvtColor'... |
# -*- coding:UTF-8
# 用户点击借这本书以后,生成信息二维码,加密处理还没加上去
import qrcode
from Crypto.Cipher import AES
from binascii import b2a_hex, a2b_hex
from bookdata.models import Book
from models import BorrowItem
import time
def create_qrcode(id_list, ctime, qrtype, pay_id):
"""
:param bid:表示书籍的唯一id,用isbn号码
... | [
"qrcode.QRCode",
"bookdata.models.Book.objects.get",
"binascii.b2a_hex",
"binascii.a2b_hex",
"Crypto.Cipher.AES.new",
"models.BorrowItem.objects.get"
] | [((403, 505), 'qrcode.QRCode', 'qrcode.QRCode', ([], {'version': '(1)', 'error_correction': 'qrcode.constants.ERROR_CORRECT_L', 'box_size': '(10)', 'border': '(4)'}), '(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L,\n box_size=10, border=4)\n', (416, 505), False, 'import qrcode\n'), ((1862, 1964), 'qr... |
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("square", type=int,
help="Muestra el número que le hayamos pasado elevado al cuadrado")
parser.add_argument("-v", "--verbosity", action="count", default=0, # <1>
help="incrementa la verbosidad de la salida por... | [
"argparse.ArgumentParser"
] | [((25, 50), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (48, 50), False, 'import argparse\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, bikbuk and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
import math
import pytz
from datetime import datetime as dt
from dateutil.relativedelta import relativedelta as rd
from frappe.model.... | [
"pytz.timezone",
"json.loads",
"frappe.db.get_value",
"frappe.get_list",
"frappe.db.get_single_value",
"dateutil.relativedelta.relativedelta",
"math.ceil",
"frappe.whitelist",
"json.dumps",
"datetime.datetime.now",
"frappe.delete_doc",
"frappe.db.commit",
"frappe.get_doc",
"frappe.get_all"... | [((470, 488), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (486, 488), False, 'import frappe\n'), ((3983, 4001), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (3999, 4001), False, 'import frappe\n'), ((5453, 5471), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (5469, 5471), False, '... |
from django.conf.urls import include, url
import django_eventstream
from . import views
urlpatterns = [
url(r'^$', views.home),
url(r'^events/', include(django_eventstream.urls)),
]
| [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((106, 127), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.home'], {}), "('^$', views.home)\n", (109, 127), False, 'from django.conf.urls import include, url\n'), ((148, 180), 'django.conf.urls.include', 'include', (['django_eventstream.urls'], {}), '(django_eventstream.urls)\n', (155, 180), False, 'from django.... |
# Copyright (c) 2017-2018 {Flair Inc.} <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... | [
"taf.foundation.api.ui.UIElement"
] | [((1638, 1660), 'taf.foundation.api.ui.UIElement', 'UIElement', ([], {'id': '"""simple"""'}), "(id='simple')\n", (1647, 1660), False, 'from taf.foundation.api.ui import UIElement\n'), ((1935, 1972), 'taf.foundation.api.ui.UIElement', 'UIElement', (['self.child'], {'id': '"""composite"""'}), "(self.child, id='composite'... |
import numpy as np
from sparc.videoprocessing.processing import Processing
from sparc.videoprocessing.lkopticalflow import LKOpticalFlow
from opencmiss.zinc.scenecoordinatesystem import SCENECOORDINATESYSTEM_LOCAL, \
SCENECOORDINATESYSTEM_WINDOW_PIXEL_TOP_LEFT
from opencmiss.zinc.field import FieldFindMeshLocati... | [
"json.loads",
"sparc.videoprocessing.processing.Processing",
"numpy.asarray",
"sparc.videoprocessing.lkopticalflow.LKOpticalFlow"
] | [((636, 648), 'sparc.videoprocessing.processing.Processing', 'Processing', ([], {}), '()\n', (646, 648), False, 'from sparc.videoprocessing.processing import Processing\n'), ((680, 720), 'sparc.videoprocessing.lkopticalflow.LKOpticalFlow', 'LKOpticalFlow', ([], {'win': '(20, 20)', 'max_level': '(2)'}), '(win=(20, 20), ... |
import ctypes
import ipaddress
import io
class SpopDataTypes:
NULL = 0
BOOL = 1
INT32 = 2
UINT32 = 3
INT64 = 4
UINT64 = 5
IPV4 = 6
IPV6 = 7
STRING = 8
BINARY = 9
SINGLE_BYTE_MAX = 0xF0
MIDDLE_BYTE_MASK = 0x80
TERMINAL_BYTE_MASK = 0x00
def __is_middle_byte(byte: int) -> boo... | [
"ipaddress.IPv4Address",
"ipaddress.IPv6Address"
] | [((1282, 1316), 'ipaddress.IPv4Address', 'ipaddress.IPv4Address', (['ipv4_struct'], {}), '(ipv4_struct)\n', (1303, 1316), False, 'import ipaddress\n'), ((1425, 1459), 'ipaddress.IPv6Address', 'ipaddress.IPv6Address', (['ipv6_struct'], {}), '(ipv6_struct)\n', (1446, 1459), False, 'import ipaddress\n')] |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
"azure.core.AsyncPipelineClient",
"msrest.Serializer",
"msrest.Deserializer"
] | [((5234, 5303), 'azure.core.AsyncPipelineClient', 'AsyncPipelineClient', ([], {'base_url': 'base_url', 'config': 'self._config'}), '(base_url=base_url, config=self._config, **kwargs)\n', (5253, 5303), False, 'from azure.core import AsyncPipelineClient\n'), ((5421, 5446), 'msrest.Serializer', 'Serializer', (['client_mod... |
# author: <NAME>, <NAME>, <NAME>
# date: 2020-11-21
"""This is a script that will take a url that contains the data and save it at a user defined path from the root of where the script is ran
Usage: src/data_download.py --url=<url> --delim=<delim> --filepath=<filepath> --filename=<filename>
Options:
--url The url whe... | [
"os.path.dirname",
"requests.get",
"docopt.docopt",
"pandas.read_csv"
] | [((636, 651), 'docopt.docopt', 'docopt', (['__doc__'], {}), '(__doc__)\n', (642, 651), False, 'from docopt import docopt\n'), ((877, 927), 'pandas.read_csv', 'pd.read_csv', (['url'], {'delimiter': 'delim', 'engine': '"""python"""'}), "(url, delimiter=delim, engine='python')\n", (888, 927), True, 'import pandas as pd\n'... |
#######################################################
#This script is for evaluating for the task of SLR #
#######################################################
import argparse
import time
import collections
import os
import sys
import torch
import torch.nn
from torch.autograd import Variable
import torch.nn as... | [
"utils.path_data",
"torch.from_numpy",
"torch.cuda.is_available",
"progressbar.Percentage",
"bleu.compute_bleu",
"os.path.exists",
"argparse.ArgumentParser",
"_pickle.load",
"torch.autograd.Variable",
"utils.Batch",
"dataloader_slt.loader",
"time.time",
"torch.device",
"progressbar.Bar",
... | [((1606, 1655), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Evaluation"""'}), "(description='Evaluation')\n", (1629, 1655), False, 'import argparse\n'), ((4536, 4564), 'torch.manual_seed', 'torch.manual_seed', (['args.seed'], {}), '(args.seed)\n', (4553, 4564), False, 'import torch\n'... |
# Generated from \SimpleWorkflow.g4 by ANTLR 4.7
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as buf:
buf.write("\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\2+")
buf.write("\u010d\b\1\4\2\t\2\4\3\t\3\4\4\t\4\4\5\t\... | [
"io.StringIO"
] | [((166, 176), 'io.StringIO', 'StringIO', ([], {}), '()\n', (174, 176), False, 'from io import StringIO\n')] |
import os
import subprocess
import uuid
import pytest
from traitlets.config import Config
from dask_gateway import Gateway
from dask_gateway.auth import BasicAuth, JupyterHubAuth
from dask_gateway_server.utils import random_port
from .utils import temp_gateway
try:
import kerberos
del kerberos
skip = n... | [
"dask_gateway.Gateway",
"dask_gateway_server.utils.random_port",
"logging.getLogger",
"jupyterhub.tests.utils.add_user",
"subprocess.check_call",
"os.environ.get",
"uuid.uuid4",
"dask_gateway.auth.BasicAuth",
"pytest.raises",
"pytest.mark.skipif",
"traitlets.config.Config",
"tornado.httpclient... | [((3805, 3875), 'pytest.mark.skipif', 'pytest.mark.skipif', (['(not hub_mocking)'], {'reason': '"""JupyterHub not installed"""'}), "(not hub_mocking, reason='JupyterHub not installed')\n", (3823, 3875), False, 'import pytest\n'), ((388, 449), 'pytest.mark.skipif', 'pytest.mark.skipif', (['skip'], {'reason': '"""No kerb... |
import os
import typing
from datetime import datetime
from importlib import import_module
from typing import Dict, Callable, Optional, List, Tuple
from twitchbot.database import CustomCommand
from twitchbot.message import Message
from .config import cfg
from .enums import CommandContext
from .util import get_py_files,... | [
"os.path.abspath",
"datetime.datetime.now",
"os.path.exists",
"importlib.import_module"
] | [((11306, 11320), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (11318, 11320), False, 'from datetime import datetime\n'), ((11552, 11573), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (11567, 11573), False, 'import os\n'), ((11586, 11606), 'os.path.exists', 'os.path.exists', (['path']... |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2014-2020, <NAME> <EMAIL>
"""
Module containing the CodecVHDLPackage class.
"""
from string import Tem... | [
"string.Template",
"vunit.com.codec_vhdl_enumeration_type.CodecVHDLEnumerationType.find",
"vunit.vhdl_parser.remove_comments",
"vunit.com.codec_vhdl_enumeration_type.CodecVHDLEnumerationType",
"vunit.com.codec_vhdl_array_type.CodecVHDLArrayType.find",
"vunit.com.codec_vhdl_record_type.CodecVHDLRecordType.... | [((12056, 12174), 'string.Template', 'Template', (['""" function $name$parameter_part\n return string;\n alias $alias_name is $alias_signature\n\n"""'], {}), '(\n """ function $name$parameter_part\n return string;\n alias $alias_name is $alias_signature\n\n"""\n )\n', (12064, 12174), False, 'from string... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import logging
from typing import Iterator
import time
import json
from seq2seq.helpers import sequence_accuracy
from seq2seq.ReaSCAN_dataset import ReaSCANDataset
import pdb
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
logger ... | [
"logging.getLogger",
"torch.tensor",
"torch.cat",
"torch.cuda.is_available",
"torch.nn.functional.log_softmax",
"torch.no_grad",
"time.time",
"json.dump"
] | [((322, 349), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (339, 349), False, 'import logging\n'), ((3910, 3921), 'time.time', 'time.time', ([], {}), '()\n', (3919, 3921), False, 'import time\n'), ((275, 300), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (298,... |
import unittest
from dnplab import dnpdata
from numpy.testing import assert_array_equal
import dnplab.dnpImport as wrapper
import dnplab.dnpNMR as nmr
import dnplab.dnpFit as efit
import dnplab.dnpTools as tools
import dnplab as dnp
import numpy as np
import os
class dnpFit_tester(unittest.TestCase):
def setUp(se... | [
"dnplab.create_workspace",
"dnplab.dnpNMR.remove_offset",
"dnplab.dnpNMR.fourier_transform",
"dnplab.dnpNMR.autophase",
"dnplab.dnpFit.exponential_fit",
"os.path.join",
"dnplab.dnpNMR.window",
"dnplab.dnpTools.baseline",
"dnplab.dnpImport.load",
"dnplab.dnpTools.integrate"
] | [((340, 383), 'os.path.join', 'os.path.join', (['"""."""', '"""data"""', '"""topspin"""', '"""304"""'], {}), "('.', 'data', 'topspin', '304')\n", (352, 383), False, 'import os\n'), ((404, 443), 'dnplab.dnpImport.load', 'wrapper.load', (['path'], {'data_type': '"""topspin"""'}), "(path, data_type='topspin')\n", (416, 44... |
import datetime
from django import template
from django.template import Context
from django.template.loader import get_template
from django.utils.html import format_html
from django.utils import timezone
register = template.Library()
MINUTE_TO_SECONDS = 60
HOUR_TO_SECONDS = 60 * 60
DAY_TO_SECONDS = 24 * 60 * 60
... | [
"django.utils.timezone.now",
"django.utils.html.format_html",
"django.template.Library"
] | [((219, 237), 'django.template.Library', 'template.Library', ([], {}), '()\n', (235, 237), False, 'from django import template\n'), ((1499, 1561), 'django.utils.html.format_html', 'format_html', (['("<span class=\'%s\'>%s</span>" % (span_class, text))'], {}), '("<span class=\'%s\'>%s</span>" % (span_class, text))\n', (... |
# Copyright (c) 2019 Graphcore Ltd. All rights reserved.
import numpy as np
import popart
import torch
import pytest
import torch.nn.functional as F
from op_tester import op_tester
# `import test_util` requires adding to sys.path
import sys
from pathlib import Path
sys.path.append(Path(__file__).resolve().parent.paren... | [
"numpy.random.rand",
"pathlib.Path",
"op_tester.op_tester.setPatterns",
"op_tester.op_tester.run",
"torch.tensor",
"pytest.mark.parametrize",
"popart.reservedGradientPrefix",
"pytest.raises",
"torch.isnan"
] | [((2531, 2579), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""in_infos"""', 'input_infos'], {}), "('in_infos', input_infos)\n", (2554, 2579), False, 'import pytest\n'), ((1155, 1241), 'op_tester.op_tester.setPatterns', 'op_tester.setPatterns', (["['PreUniRepl', 'MulArgGradOp']"], {'enableRuntimeAsserts': ... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.core.protobuf.config_pb2.RunOptions",
"tensorflow.python.client.session._FetchMapper.for_fetch",
"tensorflow.core.protobuf.config_pb2.RunMetadata",
"random.Random",
"threading.Lock",
"tensorflow.python.util.compat.as_bytes",
"os.path.join",
"sys.stderr.write",
"tensorflow.python.platform... | [((6840, 6858), 'random.Random', 'random.Random', (['(111)'], {}), '(111)\n', (6853, 6858), False, 'import random\n'), ((7156, 7172), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (7170, 7172), False, 'import threading\n'), ((11065, 11099), 'tensorflow.python.platform.gfile.MakeDirs', 'gfile.MakeDirs', (['self.... |
# -*- coding: utf-8 -*-
#
# Copyright 2019-2020 Data61, CSIRO
#
# 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 ... | [
"random.sample",
"collections.namedtuple",
"networkx.MultiDiGraph",
"stellargraph.core.schema.EdgeType",
"numpy.asarray",
"networkx.MultiGraph",
"numpy.zeros",
"numpy.empty",
"networkx.to_scipy_sparse_matrix",
"numpy.vstack",
"collections.defaultdict"
] | [((1144, 1197), 'collections.namedtuple', 'namedtuple', (['"""NeighbourWithWeight"""', "['node', 'weight']"], {}), "('NeighbourWithWeight', ['node', 'weight'])\n", (1154, 1197), False, 'from collections import defaultdict, namedtuple\n'), ((4335, 4354), 'numpy.zeros', 'np.zeros', (['data_size'], {}), '(data_size)\n', (... |
from keras import applications
from keras.preprocessing.image import ImageDataGenerator
from keras import optimizers
from keras.models import Sequential, Model
from keras.layers import Dropout, Flatten, Dense, GlobalAveragePooling2D
from keras import backend as k
from keras.callbacks import ModelCheckpoint, LearningRat... | [
"cv2.imread",
"keras.layers.Flatten",
"keras.callbacks.ModelCheckpoint",
"numpy.argmax",
"keras.preprocessing.image.ImageDataGenerator",
"keras.optimizers.SGD",
"keras.applications.vgg16.preprocess_input",
"keras.models.Model",
"keras.callbacks.EarlyStopping",
"numpy.expand_dims",
"keras.layers.... | [((688, 790), 'keras.applications.VGG16', 'applications.VGG16', ([], {'weights': '"""imagenet"""', 'include_top': '(False)', 'input_shape': '(img_width, img_height, 3)'}), "(weights='imagenet', include_top=False, input_shape=(\n img_width, img_height, 3))\n", (706, 790), False, 'from keras import applications\n'), (... |
#!/usr/local/bin/python3
#
# @(!--#) @(#) recsv.py, version 003, 22-april-2016
#
# read in a CSV file and produce the same format but
# with everything inside double quotes
#
import csv
import os
import sys
import cgi
import cgitb
cgitb.enable() # for troubleshooting
################################################... | [
"cgi.FieldStorage",
"csv.writer",
"cgitb.enable",
"os.path.basename",
"sys.exit",
"cgi.escape",
"csv.reader"
] | [((232, 246), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (244, 246), False, 'import cgitb\n'), ((1670, 1688), 'cgi.FieldStorage', 'cgi.FieldStorage', ([], {}), '()\n', (1686, 1688), False, 'import cgi\n'), ((2445, 2455), 'sys.exit', 'sys.exit', ([], {}), '()\n', (2453, 2455), False, 'import sys\n'), ((470, 496),... |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | [
"bpy.props.IntProperty",
"bpy.utils.unregister_class",
"bpy.ops.text.jump",
"bpy.types.TEXT_MT_context_menu.append",
"bpy.utils.register_class",
"bpy.types.TEXT_MT_context_menu.remove"
] | [((4514, 4537), 'bpy.props.IntProperty', 'IntProperty', ([], {'default': '(-1)'}), '(default=-1)\n', (4525, 4537), False, 'from bpy.props import IntProperty\n'), ((6083, 6149), 'bpy.types.TEXT_MT_context_menu.append', 'bpy.types.TEXT_MT_context_menu.append', (['menu_development_class_view'], {}), '(menu_development_cla... |
"""Model and evaluate."""
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import LeaveOneGroupOut, permutation_test_score
from sklearn.svm import SVC, SVR, LinearSVC, LinearSVR
def fit_model(model, X, y, runs, scoring, n_permutatio... | [
"sklearn.model_selection.permutation_test_score",
"numpy.mean",
"sklearn.model_selection.LeaveOneGroupOut",
"sklearn.svm.LinearSVR",
"sklearn.svm.LinearSVC",
"sklearn.preprocessing.StandardScaler",
"sklearn.pipeline.Pipeline",
"sklearn.svm.SVR",
"sklearn.svm.SVC"
] | [((412, 430), 'sklearn.model_selection.LeaveOneGroupOut', 'LeaveOneGroupOut', ([], {}), '()\n', (428, 430), False, 'from sklearn.model_selection import LeaveOneGroupOut, permutation_test_score\n'), ((509, 631), 'sklearn.model_selection.permutation_test_score', 'permutation_test_score', (['model', 'X', 'y'], {'groups': ... |
import subprocess
import logging
def execute_download(scp_data):
request = scp_data.execute()
logging.info("the request for downloading log from ec2: " + request)
s = subprocess.Popen(request, shell=True, stdout=subprocess.PIPE).stdout.read().strip()
logging.info("end download log")
logging.info(s... | [
"subprocess.Popen",
"logging.info"
] | [((104, 172), 'logging.info', 'logging.info', (["('the request for downloading log from ec2: ' + request)"], {}), "('the request for downloading log from ec2: ' + request)\n", (116, 172), False, 'import logging\n'), ((269, 301), 'logging.info', 'logging.info', (['"""end download log"""'], {}), "('end download log')\n",... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ˅
import os
from structural_patterns.facade.data_library import DataLibrary
from structural_patterns.facade.html_writer import HtmlWriter
# ˄
class PageCreator(object):
# ˅
# ˄
__instance = None
@classmethod
def get_instance(cls):
# ˅... | [
"structural_patterns.facade.data_library.DataLibrary",
"structural_patterns.facade.html_writer.HtmlWriter",
"os.getcwd"
] | [((752, 778), 'structural_patterns.facade.html_writer.HtmlWriter', 'HtmlWriter', (['html_file_name'], {}), '(html_file_name)\n', (762, 778), False, 'from structural_patterns.facade.html_writer import HtmlWriter\n'), ((1167, 1178), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1176, 1178), False, 'import os\n'), ((599, 6... |
#!/usr/bin/python
#coding=utf8
import socket
host = 'github.com'
try:
with open('etc/hosts', 'a+') as fp:
ip = socket.gethostnbyname(host)
fp.write(' ',join([ip, host, '\n']))
except BaseException as e:
print(e)
else:
print('sucess')
| [
"socket.gethostnbyname"
] | [((126, 153), 'socket.gethostnbyname', 'socket.gethostnbyname', (['host'], {}), '(host)\n', (147, 153), False, 'import socket\n')] |
from pywps import Process
# from pywps import LiteralInput
from pywps import ComplexInput, LiteralInput, ComplexOutput
from pywps import Format, FORMATS
from pywps.app.Common import Metadata
from flyingpigeon.log import init_process_logger
from flyingpigeon.utils import rename_complexinputs
from flyingpigeon import eo... | [
"logging.getLogger",
"pywps.LiteralInput",
"os.path.exists",
"datetime.time",
"os.makedirs",
"pywps.Format",
"pywps.app.Common.Metadata",
"zipfile.ZipFile",
"os.path.join",
"flyingpigeon.eodata.plot_products",
"datetime.datetime.now",
"flyingpigeon.log.init_process_logger",
"flyingpigeon.con... | [((637, 663), 'logging.getLogger', 'logging.getLogger', (['"""PYWPS"""'], {}), "('PYWPS')\n", (654, 663), False, 'import logging\n'), ((5557, 5587), 'flyingpigeon.log.init_process_logger', 'init_process_logger', (['"""log.txt"""'], {}), "('log.txt')\n", (5576, 5587), False, 'from flyingpigeon.log import init_process_lo... |
from synapse.nn.layers import Layer
from synapse.core.tensor import Tensor
from synapse.core.differentiable import Differentiable
import numpy as np
from typing import Callable
def tanhBackward(grad: Tensor, t1: Tensor) -> Tensor:
data = grad.data * (1 - np.tanh(t1.data) ** 2)
return Tensor(data)
@Differe... | [
"numpy.where",
"numpy.tanh",
"synapse.core.differentiable.Differentiable",
"numpy.exp",
"numpy.sum",
"synapse.core.tensor.Tensor",
"numpy.maximum"
] | [((313, 341), 'synapse.core.differentiable.Differentiable', 'Differentiable', (['tanhBackward'], {}), '(tanhBackward)\n', (327, 341), False, 'from synapse.core.differentiable import Differentiable\n'), ((611, 639), 'synapse.core.differentiable.Differentiable', 'Differentiable', (['reluBackward'], {}), '(reluBackward)\n... |
import datetime
import itertools
import logging
import uuid
from math import log10
from typing import Any, Dict, Iterable, List, Optional
import click
from pydantic import root_validator, validator
from datahub.configuration import config_loader
from datahub.configuration.common import (
ConfigModel,
DynamicT... | [
"logging.getLogger",
"datahub.ingestion.extractor.extractor_registry.extractor_registry.get",
"datahub.ingestion.sink.sink_registry.sink_registry.get",
"pydantic.root_validator",
"pydantic.validator",
"click.secho",
"datahub.ingestion.api.common.PipelineContext",
"datahub.ingestion.source.source_regis... | [((1189, 1216), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1206, 1216), False, 'import logging\n'), ((1819, 1861), 'pydantic.validator', 'validator', (['"""run_id"""'], {'pre': '(True)', 'always': '(True)'}), "('run_id', pre=True, always=True)\n", (1828, 1861), False, 'from pydantic ... |
import threading
from core.charts_abc import ChartFactory, ChartColor
from core.sensors import TemperatureSensor
class Application:
def __init__(self, chart_factory: ChartFactory) -> None:
self.sensor = TemperatureSensor()
table_chart = chart_factory.create_table_chart(self.sensor.name)
... | [
"threading.Event",
"core.sensors.TemperatureSensor"
] | [((218, 237), 'core.sensors.TemperatureSensor', 'TemperatureSensor', ([], {}), '()\n', (235, 237), False, 'from core.sensors import TemperatureSensor\n'), ((600, 617), 'threading.Event', 'threading.Event', ([], {}), '()\n', (615, 617), False, 'import threading\n')] |
#!/usr/bin/python
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
modul... | [
"ansible.module_utils.ec2.boto3_conn",
"ansible.module_utils.ec2.get_aws_connection_info",
"ansible.module_utils.aws.core.AnsibleAWSModule"
] | [((6421, 6464), 'ansible.module_utils.ec2.get_aws_connection_info', 'get_aws_connection_info', (['module'], {'boto3': '(True)'}), '(module, boto3=True)\n', (6444, 6464), False, 'from ansible.module_utils.ec2 import boto3_conn, get_aws_connection_info\n'), ((6482, 6595), 'ansible.module_utils.ec2.boto3_conn', 'boto3_con... |
# Copyright 2021 Google, Inc.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met: redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer;
# redistribu... | [
"importlib.import_module",
"argparse.ArgumentParser",
"sys.exit",
"code_formatter.code_formatter",
"importer.install"
] | [((1621, 1646), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1644, 1646), False, 'import argparse\n'), ((2284, 2302), 'importer.install', 'importer.install', ([], {}), '()\n', (2300, 2302), False, 'import importer\n'), ((2312, 2349), 'importlib.import_module', 'importlib.import_module', (['a... |
from __future__ import absolute_import, division, print_function, unicode_literals
from mopidy import backend, listener
class EventMonitorListener(listener.Listener):
"""
Marker interface for recipients of events sent by the event monitor.
"""
@staticmethod
def send(event, **kwargs):
l... | [
"mopidy.listener.send"
] | [((319, 371), 'mopidy.listener.send', 'listener.send', (['EventMonitorListener', 'event'], {}), '(EventMonitorListener, event, **kwargs)\n', (332, 371), False, 'from mopidy import backend, listener\n'), ((2110, 2165), 'mopidy.listener.send', 'listener.send', (['PandoraFrontendListener', 'event'], {}), '(PandoraFrontend... |
# -*- coding: utf-8 -*-
"""A plugin-based ``click`` CLI.
The ``click`` package is the command-line framework by <NAME>.
See http://click.pocoo.org/5/ for documentation.
This subclass simply loads the subcommands from plugins passed to
the constructor. Each module is just a regular old python module
which defines som... | [
"click.ClickException"
] | [((1859, 1888), 'click.ClickException', 'click.ClickException', (['message'], {}), '(message)\n', (1879, 1888), False, 'import click\n')] |
from django.contrib import admin
import autocomplete_light
from .models import Dummy
from .forms import DummyForm
class DummyInline(admin.TabularInline):
model = Dummy
form = DummyForm
class DummyAdmin(admin.ModelAdmin):
form = DummyForm
inlines = [DummyInline]
admin.site.register(Dummy, DummyAdmin)
| [
"django.contrib.admin.site.register"
] | [((278, 316), 'django.contrib.admin.site.register', 'admin.site.register', (['Dummy', 'DummyAdmin'], {}), '(Dummy, DummyAdmin)\n', (297, 316), False, 'from django.contrib import admin\n')] |
import functools
import json
import logging
from collections import defaultdict
from datetime import datetime
from typing import Callable, Optional, Iterator, Tuple, List, Union, Dict, Any
from dcplib.aws.clients import clouddirectory as cd_client
from fusillade.directory.structs import ConsistencyLevel, UpdateObjectP... | [
"logging.getLogger",
"dcplib.aws.clients.clouddirectory.update_link_attributes",
"fusillade.errors.FusilladeException",
"dcplib.aws.clients.clouddirectory.batch_write",
"dcplib.aws.clients.clouddirectory.list_applied_schema_arns",
"dcplib.aws.clients.clouddirectory.list_object_children",
"dcplib.aws.cli... | [((436, 463), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (453, 463), False, 'import logging\n'), ((875, 922), 'fusillade.utils.retry.retry', 'retry', ([], {'inherit': '(True)'}), '(**cd_read_retry_parameters, inherit=True)\n', (880, 922), False, 'from fusillade.utils.retry import retr... |
import wave
import struct
# Morse unit time in samples (assuming 48000hz sample rate in input file)
# 0.10s: 4800 (Slowest, most reliable)
# 0.05s: 2400 (Default - Best for NFM transmission)
# 0.02s: 960
# 0.01s: 480 (Fastest, least reliable)
UNIT_TIME = 2400
# Value at which an amplitude is considered ON or OFF. (10... | [
"wave.open",
"struct.unpack"
] | [((2821, 2845), 'wave.open', 'wave.open', (['filename', '"""r"""'], {}), "(filename, 'r')\n", (2830, 2845), False, 'import wave\n'), ((3158, 3185), 'struct.unpack', 'struct.unpack', (['"""<h"""', 'sFrame'], {}), "('<h', sFrame)\n", (3171, 3185), False, 'import struct\n')] |
"""
Terminology
original_view: the view in the regular editor, without it's own window
markdown_view: the markdown view, in the special window
preview_view: the preview view, in the special window
original_window: the regular window
preview_window: the window with the markdown file and the preview
"""
import time
impo... | [
"sublime.active_window",
"sublime.PhantomSet",
"sublime.packages_path",
"sublime.Region",
"sublime.run_command",
"functools.partial",
"sublime.load_resource",
"sublime.message_dialog",
"time.time",
"sublime.load_settings"
] | [((6532, 6593), 'sublime.load_settings', 'sublime.load_settings', (['"""MarkdownLivePreview.sublime-settings"""'], {}), "('MarkdownLivePreview.sublime-settings')\n", (6553, 6593), False, 'import sublime\n'), ((6866, 6893), 'sublime.load_resource', 'sublime.load_resource', (['path'], {}), '(path)\n', (6887, 6893), False... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set()
from sklearn.model_selection import train_test_split
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler, PolynomialF... | [
"seaborn.set",
"sklearn.preprocessing.PolynomialFeatures",
"sklearn.linear_model.LinearRegression",
"matplotlib.pyplot.xticks",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.plot",
"pandas.get_dummies",
"sklearn.preprocessing.StandardScaler",
"sklearn.metrics.mean_squared_error",
... | [((93, 102), 'seaborn.set', 'sns.set', ([], {}), '()\n', (100, 102), True, 'import seaborn as sns\n'), ((1065, 1083), 'sklearn.linear_model.LinearRegression', 'LinearRegression', ([], {}), '()\n', (1081, 1083), False, 'from sklearn.linear_model import LinearRegression, Lasso, LassoCV, Ridge, RidgeCV\n'), ((1713, 1731),... |
import pytest
from dagster import (
DagsterInvalidDefinitionError,
ModeDefinition,
ResourceDefinition,
execute_pipeline,
pipeline,
system_storage,
)
from dagster.core.definitions.system_storage import create_mem_system_storage_data
def test_resource_requirements_pass():
called = {}
@... | [
"dagster.execute_pipeline",
"dagster.core.definitions.system_storage.create_mem_system_storage_data",
"pytest.raises",
"dagster.ResourceDefinition.none_resource",
"dagster.system_storage"
] | [((320, 362), 'dagster.system_storage', 'system_storage', ([], {'required_resources': "{'yup'}"}), "(required_resources={'yup'})\n", (334, 362), False, 'from dagster import DagsterInvalidDefinitionError, ModeDefinition, ResourceDefinition, execute_pipeline, pipeline, system_storage\n'), ((1284, 1326), 'dagster.system_s... |
from random import random
from buildings import ModularBuilding
def main():
building = ModularBuilding()
with open('test.ldr', 'w') as out:
out.write(building.to_ldr())
if __name__ == '__main__':
main() | [
"buildings.ModularBuilding"
] | [((91, 108), 'buildings.ModularBuilding', 'ModularBuilding', ([], {}), '()\n', (106, 108), False, 'from buildings import ModularBuilding\n')] |
import plotly.graph_objects as go
from pcutils.kitti_util import compute_box_3d
from PIL import Image
import numpy as np
ptc_layout_config={
'title': {
'text': 'test vis LiDAR',
'font': {
'size': 20,
'color': 'rgb(150,150,150)',
},
'xanchor': 'left',
... | [
"PIL.Image.fromarray",
"pcutils.kitti_util.compute_box_3d",
"plotly.graph_objects.Figure",
"plotly.graph_objects.Scatter",
"plotly.graph_objects.Scatter3d",
"numpy.vstack"
] | [((2323, 2334), 'plotly.graph_objects.Figure', 'go.Figure', ([], {}), '()\n', (2332, 2334), True, 'import plotly.graph_objects as go\n'), ((5634, 5662), 'pcutils.kitti_util.compute_box_3d', 'compute_box_3d', (['obj', 'calib.P'], {}), '(obj, calib.P)\n', (5648, 5662), False, 'from pcutils.kitti_util import compute_box_3... |
# -*- coding: utf-8 -*-
"""
This module is a work in progress, as such concepts are subject to change.
MAIN IDEA:
`MultiTaskSamples` serves as a structure to contain and manipulate a set of
samples with potentially many different types of labels and features.
"""
import logging
import utool as ut
import ubelt ... | [
"logging.getLogger",
"utool.list_alignment",
"sklearn.metrics.classification_report",
"utool.index_complement",
"sklearn.metrics.roc_auc_score",
"sklearn.model_selection.StratifiedKFold",
"utool.take",
"numpy.array",
"sklearn.metrics.log_loss",
"utool.qtensure",
"sklearn.calibration.CalibratedCl... | [((597, 617), 'utool.inject2', 'ut.inject2', (['__name__'], {}), '(__name__)\n', (607, 617), True, 'import utool as ut\n'), ((627, 652), 'logging.getLogger', 'logging.getLogger', (['"""wbia"""'], {}), "('wbia')\n", (644, 652), False, 'import logging\n'), ((768, 812), 'utool.ParamInfo', 'ut.ParamInfo', (['"""type"""', '... |
import unittest
import rotate_word
class TestRotateWord(unittest.TestCase):
def test_rotateWord(self):
self.assertEqual(rotate_word.rotate('abc', 1), 'bcd')
self.assertEqual(rotate_word.rotate('abcz', 2), 'cdeb')
self.assertEqual(rotate_word.rotate('abc', 27), 'bcd')
self.assertEqu... | [
"rotate_word.rotate"
] | [((134, 162), 'rotate_word.rotate', 'rotate_word.rotate', (['"""abc"""', '(1)'], {}), "('abc', 1)\n", (152, 162), False, 'import rotate_word\n'), ((196, 225), 'rotate_word.rotate', 'rotate_word.rotate', (['"""abcz"""', '(2)'], {}), "('abcz', 2)\n", (214, 225), False, 'import rotate_word\n'), ((260, 289), 'rotate_word.r... |
# -*- coding: utf-8 -*-
"""
Clip burn depth and environmental variables
(tree cover, tree species, elevation, slope, topsoil carbon content)
to fire perimeters and assign class overwinter/other to each perimeter
based on the id
Requirements:
- list of overwinteirng fire ids (output of algorithm.R)
- and parent... | [
"pandas.read_csv",
"numpy.where",
"rasterio.open",
"numpy.count_nonzero",
"numpy.nanmean",
"numpy.isnan",
"fiona.open",
"rasterio.mask.mask"
] | [((1354, 1373), 'pandas.read_csv', 'pd.read_csv', (['nndist'], {}), '(nndist)\n', (1365, 1373), True, 'import pandas as pd\n'), ((2325, 2350), 'rasterio.open', 'rasterio.open', (['depth_path'], {}), '(depth_path)\n', (2338, 2350), False, 'import rasterio\n'), ((2364, 2386), 'rasterio.open', 'rasterio.open', (['tc_path'... |
import os
import numpy
import numpy as np
import torch
from dg_util.python_utils import misc_util
from torch import nn
numpy.set_printoptions(precision=4)
torch.set_printoptions(precision=4, sci_mode=False)
def batch_norm_layer(channels):
return nn.BatchNorm2d(channels)
def nonlinearity():
return nn.ReLU(... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.set_printoptions",
"dg_util.python_utils.misc_util.get_time_str",
"numpy.array",
"os.path.dirname",
"numpy.set_printoptions"
] | [((121, 156), 'numpy.set_printoptions', 'numpy.set_printoptions', ([], {'precision': '(4)'}), '(precision=4)\n', (143, 156), False, 'import numpy\n'), ((157, 208), 'torch.set_printoptions', 'torch.set_printoptions', ([], {'precision': '(4)', 'sci_mode': '(False)'}), '(precision=4, sci_mode=False)\n', (179, 208), False,... |
import discord
import os
client = discord.Client()
def is_image(attachment):
return attachment.height != None
async def add_reaction(message):
await message.add_reaction('⬆')
await message.add_reaction('⬇')
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@c... | [
"discord.Client",
"os.getenv"
] | [((35, 51), 'discord.Client', 'discord.Client', ([], {}), '()\n', (49, 51), False, 'import discord\n'), ((546, 572), 'os.getenv', 'os.getenv', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (555, 572), False, 'import os\n')] |
# -*- coding: utf-8 -*-
from django.db import models
from .mixins import SeasonsMixin
from . import fields
from .time_base import TimeMixin
class CategoryManager(models.Manager):
def get_by_natural_key(self, code):
return self.get(code=code)
class Category(SeasonsMixin, TimeMixin, models.Model):
... | [
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((360, 462), 'django.db.models.CharField', 'models.CharField', (['"""Kurzzeichen"""'], {'max_length': '(3)', 'unique': '(True)', 'help_text': '"""Kurzzeichen der Kategorie"""'}), "('Kurzzeichen', max_length=3, unique=True, help_text=\n 'Kurzzeichen der Kategorie')\n", (376, 462), False, 'from django.db import model... |
# -*- coding: utf-8 -*-
from datetime import datetime
from app import db
class Checkup(db.Model):
__tablename__ = 'checkup'
id = db.Column(db.Integer, primary_key=True)
created = db.Column(db.DateTime, default=datetime.utcnow)
# TODO: add one unique constraint on the column group of owner and repo
... | [
"app.db.Column",
"app.db.relationship"
] | [((140, 179), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (149, 179), False, 'from app import db\n'), ((194, 241), 'app.db.Column', 'db.Column', (['db.DateTime'], {'default': 'datetime.utcnow'}), '(db.DateTime, default=datetime.utcnow)\n', (203, 241), F... |
import npc
import pytest
def test_creates_character(campaign):
result = npc.commands.create_character.werewolf('wer<NAME>', 'cahalith')
character = campaign.get_character('werewolf mann.nwod')
assert result.success
assert character.exists()
assert campaign.get_absolute(result.openable[0]) == str(ch... | [
"npc.commands.create_character.werewolf"
] | [((77, 140), 'npc.commands.create_character.werewolf', 'npc.commands.create_character.werewolf', (['"""wer<NAME>"""', '"""cahalith"""'], {}), "('wer<NAME>', 'cahalith')\n", (115, 140), False, 'import npc\n'), ((379, 477), 'npc.commands.create_character.werewolf', 'npc.commands.create_character.werewolf', (['"""werewolf... |
# vim: ts=4 et filetype=python
# This file is part of MiniREST
#
#Copyright (c) 2012 Wireless Generation, 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 w... | [
"random.randrange",
"gevent.pywsgi.WSGIServer",
"gevent.pywsgi.WSGIServer.wrap_socket_and_handle"
] | [((1750, 1813), 'gevent.pywsgi.WSGIServer.wrap_socket_and_handle', 'WSGIServer.wrap_socket_and_handle', (['self', 'client_socket', 'address'], {}), '(self, client_socket, address)\n', (1783, 1813), False, 'from gevent.pywsgi import WSGIServer, WSGIHandler\n'), ((4090, 4139), 'gevent.pywsgi.WSGIServer', 'WSGIServer', ([... |
from odoo import fields, models
class IrModel(models.Model):
_inherit = 'ir.model'
rest_api = fields.Boolean('REST API', default=True,
help="Allow this model to be fetched through REST API")
| [
"odoo.fields.Boolean"
] | [((105, 206), 'odoo.fields.Boolean', 'fields.Boolean', (['"""REST API"""'], {'default': '(True)', 'help': '"""Allow this model to be fetched through REST API"""'}), "('REST API', default=True, help=\n 'Allow this model to be fetched through REST API')\n", (119, 206), False, 'from odoo import fields, models\n')] |
# Block development using web3
""" >>> from web3 import Web3
# IPCProvider:
>>> w3 = Web3(Web3.IPCProvider('./path/to/geth.ipc'))
# HTTPProvider:
>>> w3 = Web3(Web3.HTTPProvider('http://127.0.0.1:8545'))
# WebsocketProvider:
>>> w3 = Web3(Web3.WebsocketProvider('ws://127.0.0.1:8546'))
>>> w3.isConnected()
True """... | [
"web3.Web3.HTTPProvider"
] | [((354, 423), 'web3.Web3.HTTPProvider', 'Web3.HTTPProvider', (['"""https://mainnet.infura.io/v3/<infura-project-id>"""'], {}), "('https://mainnet.infura.io/v3/<infura-project-id>')\n", (371, 423), False, 'from web3 import Web3\n')] |
import torch
import torch.nn as nn
from .base import KGLossBase
class SigmoidLoss(nn.Module):
r"""
Pairwise loss function. :math:`x_p` is the predition score of positive examples,
and :math:`x_n` is the predition score of negative examples.
.. math::
\text{loss}(x_p, x_n) = -{\sum_i log \frac... | [
"torch.nn.Softplus",
"torch.Tensor",
"torch.nn.SoftMarginLoss",
"torch.nn.LogSigmoid",
"torch.softmax",
"torch.nn.MSELoss",
"torch.nn.BCELoss"
] | [((514, 529), 'torch.nn.LogSigmoid', 'nn.LogSigmoid', ([], {}), '()\n', (527, 529), True, 'import torch.nn as nn\n'), ((1628, 1641), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), '()\n', (1639, 1641), True, 'import torch.nn as nn\n'), ((4592, 4635), 'torch.nn.MSELoss', 'nn.MSELoss', (['size_average', 'reduce', 'reducti... |
import pytest
from schwifty import BIC
def test_bic():
bic = BIC("GENODEM1GLS")
assert bic.formatted == "GENO DE M1 GLS"
assert bic.validate()
def test_bic_allow_invalid():
bic = BIC("GENODXM1GLS", allow_invalid=True)
assert bic
assert bic.country_code == "DX"
with pytest.raises(ValueEr... | [
"schwifty.BIC.from_bank_code",
"pytest.mark.parametrize",
"schwifty.BIC",
"pytest.raises",
"pytest.warns"
] | [((1789, 1957), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""code,type"""', "[('GENODEM0GLS', 'testing'), ('GENODEM1GLS', 'passive'), ('GENODEM2GLS',\n 'reverse billing'), ('GENODEMMGLS', 'default')]"], {}), "('code,type', [('GENODEM0GLS', 'testing'), (\n 'GENODEM1GLS', 'passive'), ('GENODEM2GLS', ... |
# Importing libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from sklearn import preprocessing
# naive and gaussian model
from sklearn.naive_bayes import GaussianNB
from sklearn.model_selection import train_test_split
# for accuracy
from sklearn import metrics
# print precision and r... | [
"matplotlib.pyplot.imshow",
"sklearn.metrics.accuracy_score",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.metrics.classification_report",
"sklearn.datasets.load_digits",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"sklearn.naive_bayes.Gaus... | [((508, 521), 'sklearn.datasets.load_digits', 'load_digits', ([], {}), '()\n', (519, 521), False, 'from sklearn.datasets import load_digits\n'), ((523, 551), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (533, 551), True, 'import matplotlib.pyplot as plt\n'), ((680, 70... |
#!/usr/bin/env python
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.metrics import plot_confusion_matrix
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import make_pipeline
from sklearn... | [
"category_encoders.OrdinalEncoder",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.linear_model.LogisticRegression",
"sklearn.preprocessing.StandardScaler",
"sklearn.impute.SimpleImputer",
"sklearn.metrics.plot_confusion_matrix"
] | [((1747, 1790), 'sklearn.model_selection.train_test_split', 'train_test_split', (['dataframe'], {'test_size': '(0.15)'}), '(dataframe, test_size=0.15)\n', (1763, 1790), False, 'from sklearn.model_selection import train_test_split\n'), ((1807, 1844), 'sklearn.model_selection.train_test_split', 'train_test_split', (['bas... |
# Generated by Django 2.1.5 on 2019-02-23 06:44
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('IoT_DataMgmt', '0050_auto_20190223_0551'),
]
operations = [
migrations.AlterUniqueTogether(
name='equipmentinstancedailymetadata',
... | [
"django.db.migrations.AlterUniqueTogether"
] | [((232, 355), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""equipmentinstancedailymetadata"""', 'unique_together': "{('equipment_instance', 'date')}"}), "(name='equipmentinstancedailymetadata',\n unique_together={('equipment_instance', 'date')})\n", (262, 355), False... |
import pandas as pd
import os
scenario = 'cross-4'
name = 'PPO_FrameStack_9c0e9_00000_0_2021-12-09_00-21-45'
checkpoint_nr = 10
pickle_path = os.path.join('baselines', 'marl_benchmark', 'log', 'results', 'run',
scenario,
name,
'checkpoi... | [
"pandas.read_pickle"
] | [((455, 482), 'pandas.read_pickle', 'pd.read_pickle', (['pickle_path'], {}), '(pickle_path)\n', (469, 482), True, 'import pandas as pd\n')] |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("auditlog", "0005_logentry_additional_data_verbose_name"),
]
operations = [
migrations.AlterField(
model_name="logentry",
name="object_pk",
field=models.C... | [
"django.db.models.CharField"
] | [((312, 385), 'django.db.models.CharField', 'models.CharField', ([], {'verbose_name': '"""object pk"""', 'max_length': '(255)', 'db_index': '(True)'}), "(verbose_name='object pk', max_length=255, db_index=True)\n", (328, 385), False, 'from django.db import migrations, models\n')] |
import pandas as pd
def get_label(template_id):
mapping_df = pd.read_csv('mapping.csv')
row = mapping_df[mapping_df["template_id"] == template_id]
label = row["label"].values[0]
print("get_label ", label)
return label
def get_template_id(label):
mapping_df = pd.read_csv('mapping.csv')
r... | [
"pandas.read_csv"
] | [((68, 94), 'pandas.read_csv', 'pd.read_csv', (['"""mapping.csv"""'], {}), "('mapping.csv')\n", (79, 94), True, 'import pandas as pd\n'), ((288, 314), 'pandas.read_csv', 'pd.read_csv', (['"""mapping.csv"""'], {}), "('mapping.csv')\n", (299, 314), True, 'import pandas as pd\n'), ((547, 573), 'pandas.read_csv', 'pd.read_... |
# ===============================================================================
# Copyright 2012 <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/LI... | [
"pychron.entry.irradiation_status.IrradiationStatusView",
"pychron.canvas.utils.markup_canvas_position",
"pychron.data_mapper.do_import_irradiation",
"pychron.entry.editors.level_editor.load_holder_canvas",
"pychron.core.helpers.formatting.floatfmt",
"pychron.core.helpers.logger_setup.logging_setup",
"t... | [((2802, 2816), 'traits.api.Button', 'Button', (['"""Edit"""'], {}), "('Edit')\n", (2808, 2816), False, 'from traits.api import Property, Str, cached_property, List, Event, Button, Instance, Bool, on_trait_change, Float, HasTraits, Any\n'), ((2842, 2870), 'traits.api.Property', 'Property', ([], {'depends_on': '"""level... |
from mrjob.job import MRJob
from mrjob.step import MRStep
mean = 0
class MRJobVariance(MRJob):
def steps(self):
return [
MRStep(mapper=self.mapper_variance,
combiner=self.combiner_variance,
reducer=self.reducer_variance),
# MRStep(reducer=sel... | [
"mrjob.step.MRStep"
] | [((149, 252), 'mrjob.step.MRStep', 'MRStep', ([], {'mapper': 'self.mapper_variance', 'combiner': 'self.combiner_variance', 'reducer': 'self.reducer_variance'}), '(mapper=self.mapper_variance, combiner=self.combiner_variance,\n reducer=self.reducer_variance)\n', (155, 252), False, 'from mrjob.step import MRStep\n')] |
import serial
import binascii
import struct
import time
# 创建serial实例
serialport = serial.Serial()
serialport.port = 'COM3'
serialport.baudrate = 115200
serialport.parity = 'N'
serialport.bytesize = 8
serialport.stopbits = 1
serialport.timeout = 0.2
while 1:
serialport.open()
# 发送数据
d=bytes.fromhex('0B ... | [
"binascii.b2a_hex",
"serial.Serial",
"time.sleep",
"time.time"
] | [((86, 101), 'serial.Serial', 'serial.Serial', ([], {}), '()\n', (99, 101), False, 'import serial\n'), ((417, 439), 'binascii.b2a_hex', 'binascii.b2a_hex', (['str1'], {}), '(str1)\n', (433, 439), False, 'import binascii\n'), ((721, 736), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (731, 736), False, 'import... |
#!/usr/bin/env python
#
# <EMAIL>
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
import os
import click
import prettytab... | [
"prettytable.PrettyTable",
"click.echo",
"functest.utils.constants.CONST.__getattribute__",
"functest.utils.functest_utils.execute_command"
] | [((1095, 1140), 'functest.utils.functest_utils.execute_command', 'ft_utils.execute_command', (['"""prepare_env start"""'], {}), "('prepare_env start')\n", (1119, 1140), True, 'import functest.utils.functest_utils as ft_utils\n'), ((1705, 1740), 'functest.utils.constants.CONST.__getattribute__', 'CONST.__getattribute__'... |
# 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
# distributed under t... | [
"os.path.exists",
"pwd.getpwnam",
"umd.utils.runcmd",
"os.path.join",
"os.chmod",
"os.chown",
"tempfile.NamedTemporaryFile",
"umd.utils.install",
"socket.gethostname",
"mock.MagicMock"
] | [((2099, 2186), 'umd.utils.install', 'utils.install', (["['torque-server', 'torque-scheduler', 'torque-mom', 'torque-client']"], {}), "(['torque-server', 'torque-scheduler', 'torque-mom',\n 'torque-client'])\n", (2112, 2186), False, 'from umd import utils\n'), ((2237, 2272), 'umd.utils.runcmd', 'utils.runcmd', (['""... |
from __future__ import annotations
import logging
from typing import Any
from .typing import CallableHandler
log = logging.getLogger(__name__)
class EventHandler():
def __init__(self) -> None:
self._handlers: set[CallableHandler] = set()
def __iadd__(self, handler: CallableHandler) -> EventHandler... | [
"logging.getLogger"
] | [((118, 145), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (135, 145), False, 'import logging\n')] |
import os
import subprocess
import numpy as np
import matplotlib.pyplot as pyplot
import matplotlib.cm as cm
from matplotlib.colors import Normalize
from matplotlib.backends.backend_pdf import PdfPages
from mpl_toolkits.axes_grid1 import make_axes_locatable
from simtk import unit
import openmmtools
from cg_openmm.utili... | [
"numpy.sqrt",
"matplotlib.pyplot.ylabel",
"openmmtools.multistate.MultiStateReporter",
"numpy.array",
"os.remove",
"os.path.exists",
"numpy.mean",
"numpy.histogram",
"simtk.openmm.app.pdbfile.PDBFile.writeFile",
"numpy.where",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"time.perf_... | [((906, 992), 'simtk.unit.MOLAR_GAS_CONSTANT_R.in_units_of', 'unit.MOLAR_GAS_CONSTANT_R.in_units_of', (['(unit.kilojoule / (unit.kelvin * unit.mole))'], {}), '(unit.kilojoule / (unit.kelvin * unit.\n mole))\n', (943, 992), False, 'from simtk import unit\n'), ((2514, 2551), 'os.path.join', 'os.path.join', (['output_d... |
import cv2
import numpy as np
import math
import serial
import time
ser = serial.Serial('/dev/ttyACM0', baudrate = 9600, timeout = 1)
cap = cv2.VideoCapture(0)
cap.set(3,1280)
cap.set(4,720)
path_lower = np.array([0,80,0])
path_upper = np.array([179,255,255])
font = cv2.FONT_HERSHEY_COMPLEX
kernel =... | [
"cv2.rectangle",
"time.sleep",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"cv2.erode",
"cv2.minAreaRect",
"cv2.waitKey",
"cv2.drawContours",
"numpy.ones",
"cv2.boxPoints",
"numpy.int0",
"cv2.putText",
"cv2.morphologyEx",
"cv2.cvtColor",
"cv2.GaussianBlur",
"cv2.inRange",
... | [((81, 136), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM0"""'], {'baudrate': '(9600)', 'timeout': '(1)'}), "('/dev/ttyACM0', baudrate=9600, timeout=1)\n", (94, 136), False, 'import serial\n'), ((150, 169), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (166, 169), False, 'import cv2\n'), ((219,... |
# ============================================================================
# Copyright 2021 The AIMM team at Shenzhen Bay Laboratory & Peking University
#
# People: <NAME>, <NAME>, <NAME>, <NAME>, <NAME>,
# <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
#
# This code is a part of Cybertron-Code package.
#
# The Cyb... | [
"mindspore.ops.operations.Cos",
"mindspore.ops.operations.LogicalAnd",
"mindspore.ops.operations.Exp",
"mindspore.ops.functional.zeros_like",
"mindspore.ops.operations.Pow",
"mindspore.ops.functional.select",
"mindspore.ops.functional.square",
"mindspore.ops.functional.cast",
"mindspore.ops.function... | [((3157, 3182), 'mindspore.Tensor', 'Tensor', (['np.pi', 'ms.float32'], {}), '(np.pi, ms.float32)\n', (3163, 3182), False, 'from mindspore import Tensor\n'), ((3202, 3209), 'mindspore.ops.operations.Cos', 'P.Cos', ([], {}), '()\n', (3207, 3209), True, 'from mindspore.ops import operations as P\n'), ((3237, 3251), 'mind... |
#!/usr/bin/env python3
#
# Copyright (C) 2021 Intel Corporation.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import sys, os, re
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
import common, lib.error, lib.lib
from collections import namedtuple
# VMSIX devices list
TSN_DEVS ... | [
"collections.namedtuple",
"re.compile",
"common.get_node",
"common.round_up",
"common.append_node",
"os.path.abspath"
] | [((2442, 2484), 'collections.namedtuple', 'namedtuple', (['"""AddrWindow"""', "['start', 'end']"], {}), "('AddrWindow', ['start', 'end'])\n", (2452, 2484), False, 'from collections import namedtuple\n'), ((2536, 2594), 're.compile', 're.compile', (['"""\\\\s*(?P<start>[0-9a-f]+)-(?P<end>[0-9a-f]+) """'], {}), "('\\\\s*... |
import param_estimate as pe
import matplotlib.pyplot as plt
import numpy as np
import time
import pickle
filename = 'fitting_data'
save_data_series = [1,2,3]
for j in save_data_series:
pkl_file = open(filename+'_'+str(j)+'.par', 'rb')
SAVE_DATA = None
SAVE_DATA = pickle.load(pkl_file)
pkl_file.close()
fig = pl... | [
"param_estimate.load_data",
"pickle.load",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"matplotlib.pyplot.show"
] | [((1274, 1284), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1282, 1284), True, 'import matplotlib.pyplot as plt\n'), ((269, 290), 'pickle.load', 'pickle.load', (['pkl_file'], {}), '(pkl_file)\n', (280, 290), False, 'import pickle\n'), ((318, 331), 'matplotlib.pyplot.figure', 'plt.figure', (['j'], {}), '(j)... |
import os
import torch
from typing import List, Tuple
from torch import nn
from transformers import BertConfig, BertModel, BertPreTrainedModel, BertTokenizerFast, AutoTokenizer
from repconc.models.repconc import RepCONC
class TCTEncoder(BertPreTrainedModel):
def __init__(self, config: BertConfig):
BertPr... | [
"repconc.models.repconc.RepCONC",
"transformers.BertModel",
"os.path.join",
"inspect.getfullargspec",
"torch.sum",
"transformers.AutoTokenizer.from_pretrained",
"transformers.BertPreTrainedModel.__init__"
] | [((1335, 1456), 'repconc.models.repconc.RepCONC', 'RepCONC', (['dense_encoder.config', 'dense_encoder'], {'use_constraint': 'use_constraint', 'sk_epsilon': 'sk_epsilon', 'sk_iters': 'sk_iters'}), '(dense_encoder.config, dense_encoder, use_constraint=use_constraint,\n sk_epsilon=sk_epsilon, sk_iters=sk_iters)\n', (13... |
import time
import asyncio
import redis
def now(): return time.time()
def get_redis():
connection_pool = redis.ConnectionPool(host='127.0.0.1', db=9)
return redis.Redis(connection_pool=connection_pool)
rcon = get_redis()
async def worker():
print('Start worker')
while True:
start = now(... | [
"asyncio.Task.all_tasks",
"redis.ConnectionPool",
"redis.Redis",
"asyncio.sleep",
"asyncio.get_event_loop",
"time.time"
] | [((60, 71), 'time.time', 'time.time', ([], {}), '()\n', (69, 71), False, 'import time\n'), ((113, 157), 'redis.ConnectionPool', 'redis.ConnectionPool', ([], {'host': '"""127.0.0.1"""', 'db': '(9)'}), "(host='127.0.0.1', db=9)\n", (133, 157), False, 'import redis\n'), ((169, 213), 'redis.Redis', 'redis.Redis', ([], {'co... |
import os
import re
import ast
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext as _build_ext
package_name = "omicexperiment"
# version parsing from __init__ pulled from scikit-bio
# https://github.com/biocore/scikit-bio/blob/master/setup.py
# which is itself based off F... | [
"pypandoc.convert",
"re.compile",
"setuptools.find_packages",
"os.path.join",
"ast.literal_eval",
"os.path.dirname",
"numpy.get_include",
"setuptools.command.build_ext.build_ext.finalize_options"
] | [((406, 444), 're.compile', 're.compile', (['"""__version__\\\\s+=\\\\s+(.*)"""'], {}), "('__version__\\\\s+=\\\\s+(.*)')\n", (416, 444), False, 'import re\n'), ((1057, 1082), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1072, 1082), False, 'import os\n'), ((1244, 1307), 'pypandoc.convert'... |
import logging
import os
import tempfile
from typing import List
from zipfile import ZipFile
from .. import register_backend
from .android_lifecycle import callback
from .soot import Soot
try:
from pyaxmlparser import APK as APKParser
PYAXMLPARSER_INSTALLED = True
except ImportError:
PYAXMLPARSER_INSTALLE... | [
"logging.getLogger",
"zipfile.ZipFile",
"os.path.join",
"pyaxmlparser.APK",
"tempfile.mkdtemp"
] | [((508, 540), 'logging.getLogger', 'logging.getLogger', ([], {'name': '__name__'}), '(name=__name__)\n', (525, 540), False, 'import logging\n'), ((2814, 2833), 'pyaxmlparser.APK', 'APKParser', (['apk_path'], {}), '(apk_path)\n', (2823, 2833), True, 'from pyaxmlparser import APK as APKParser\n'), ((7516, 7533), 'zipfile... |
from papertalk.server import make_app
app = make_app()
| [
"papertalk.server.make_app"
] | [((44, 54), 'papertalk.server.make_app', 'make_app', ([], {}), '()\n', (52, 54), False, 'from papertalk.server import make_app\n')] |
import json
from moto.core.exceptions import JsonRESTError
class IoTClientError(JsonRESTError):
code = 400
class ResourceNotFoundException(IoTClientError):
def __init__(self, msg=None):
self.code = 404
super().__init__(
"ResourceNotFoundException", msg or "The specified resource... | [
"json.dumps"
] | [((1716, 1813), 'json.dumps', 'json.dumps', (["{'message': self.message, 'resourceId': resource_id, 'resourceArn':\n resource_arn}"], {}), "({'message': self.message, 'resourceId': resource_id,\n 'resourceArn': resource_arn})\n", (1726, 1813), False, 'import json\n')] |
import sqlite3
def Inicia():
print('Acesso aberto.')
global conector
conector = sqlite3.connect("conta.db")
global cursor
cursor = conector.cursor()
def Excluir(Cod):
sql = "delete from cadastro where codigo = :param"
cursor.execute(sql, {'param' : Cod})
conector.commit()
print(f"C... | [
"sqlite3.connect"
] | [((93, 120), 'sqlite3.connect', 'sqlite3.connect', (['"""conta.db"""'], {}), "('conta.db')\n", (108, 120), False, 'import sqlite3\n')] |
import requests
def getHTMLText(url):
try:
r = requests.get(url, timeout=30)
r.raise_for_status() # 如果状态不是200,引发HTTPError异常
r.encoding = r.apparent_encoding
return r.text
except:
return "产生异常"
if __name__ == "__main__":
url = "http://www.baidu.com"
print(getH... | [
"requests.get"
] | [((61, 90), 'requests.get', 'requests.get', (['url'], {'timeout': '(30)'}), '(url, timeout=30)\n', (73, 90), False, 'import requests\n')] |
import time
from compactor.process import Process
from compactor.context import Context
import logging
logging.basicConfig()
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
class WebProcess(Process):
@Process.install('ping')
def ping(self, from_pid, body):
log.info("Received ping")
def r... | [
"logging.basicConfig",
"logging.getLogger",
"time.sleep",
"compactor.process.Process.install",
"compactor.context.Context"
] | [((105, 126), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (124, 126), False, 'import logging\n'), ((134, 161), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (151, 161), False, 'import logging\n'), ((222, 245), 'compactor.process.Process.install', 'Process.install', ([... |
import re
from django.db import models
import apps.common.functions as commonfunctions
from apps.objects.models import Node, Document as BaseDocument
from apps.taxonomy.models import BoardPolicySection
from apps.dashboard.models import PageLayout
class Document(BaseDocument):
PARENT_TYPE = ''
PARENT_URL = ''... | [
"django.db.models.OneToOneField",
"apps.dashboard.models.PageLayout.objects.get_or_create",
"django.db.models.DateField",
"re.escape",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.CharField"
] | [((536, 582), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'help_text': '""""""'}), "(max_length=200, help_text='')\n", (552, 582), False, 'from django.db import models\n'), ((625, 758), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Node'], {'blank': '(True)', 'null': '(True)'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
remove_duplicates.py
Remove duplicate files
"""
import os
import argparse
import logging
from pathlib import Path
from unittest import TestCase
try:
import xxhash
HASHER = xxhash.xxh3_64
except ImportError as e:
import hashlib
HASHER = hashlib.md5
... | [
"logging.getLogger",
"logging.StreamHandler",
"argparse.ArgumentParser",
"pathlib.Path",
"logging.Formatter",
"logging.warning",
"logging.info"
] | [((423, 442), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (440, 442), False, 'import logging\n'), ((457, 480), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (478, 480), False, 'import logging\n'), ((497, 529), 'logging.Formatter', 'logging.Formatter', (['"""%(message)s"""'], {}), "... |
import string
template = string.Template("""
[KEYSTONE]
auth_url=$__contrail_ks_auth_url__
auth_host=$__contrail_keystone_ip__
auth_protocol=$__contrail_ks_auth_protocol__
auth_port=$__contrail_ks_auth_port__
admin_user=$__contrail_admin_user__
admin_password=$__<PASSWORD>__
admin_tenant_name=$__contrail_admin_tenant_... | [
"string.Template"
] | [((26, 487), 'string.Template', 'string.Template', (['"""\n[KEYSTONE]\nauth_url=$__contrail_ks_auth_url__\nauth_host=$__contrail_keystone_ip__\nauth_protocol=$__contrail_ks_auth_protocol__\nauth_port=$__contrail_ks_auth_port__\nadmin_user=$__contrail_admin_user__\nadmin_password=$__<PASSWORD>__\nadmin_tenant_name=$__co... |
# coding: utf-8
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
from __future__ import division
from builtins import zip
from builtins import next
from builtins import range
from ....pipeline import engine as pe
from ....interfaces import utility as ni... | [
"builtins.next",
"nibabel.load",
"numpy.hstack",
"nibabel.funcs.concat_images",
"math.cos",
"numpy.array",
"numpy.loadtxt",
"numpy.linalg.norm",
"numpy.where",
"numpy.concatenate",
"numpy.abs",
"numpy.eye",
"os.path.splitext",
"numpy.squeeze",
"builtins.zip",
"numpy.savetxt",
"nibabe... | [((9396, 9411), 'nibabel.load', 'nb.load', (['in_dwi'], {}), '(in_dwi)\n', (9403, 9411), True, 'import nibabel as nb\n'), ((9452, 9471), 'numpy.loadtxt', 'np.loadtxt', (['in_bval'], {}), '(in_bval)\n', (9462, 9471), True, 'import numpy as np\n'), ((10159, 10175), 'nibabel.load', 'nb.load', (['in_file'], {}), '(in_file)... |
# Crie um programa que leia dois valores e mostre um menu na tela:
# [ 1 ] Somar
# [ 2 ] Multiplicar
# [ 3 ] Maior
# [ 4 ] Novos Números
# [ 5 ] Sair do Programa
# Seu programa deverá realizar a operação solicitada em cada caso.
from time import sleep
numero1 = float(input('Informe um número: '))
numero2 = float(input(... | [
"time.sleep"
] | [((736, 746), 'time.sleep', 'sleep', (['(1.5)'], {}), '(1.5)\n', (741, 746), False, 'from time import sleep\n'), ((921, 931), 'time.sleep', 'sleep', (['(1.5)'], {}), '(1.5)\n', (926, 931), False, 'from time import sleep\n'), ((1109, 1119), 'time.sleep', 'sleep', (['(1.5)'], {}), '(1.5)\n', (1114, 1119), False, 'from ti... |
from django.db import models
from django.utils.encoding import force_unicode
from mptt.models import MPTTModel
from mptt.fields import TreeForeignKey
class ProductCategoryBase(MPTTModel):
parent = TreeForeignKey('self',
blank=True,
null=True,
... | [
"django.db.models.SlugField",
"django.db.models.CharField",
"mptt.fields.TreeForeignKey",
"django.db.models.BooleanField"
] | [((204, 301), 'mptt.fields.TreeForeignKey', 'TreeForeignKey', (['"""self"""'], {'blank': '(True)', 'null': '(True)', 'related_name': '"""children"""', 'verbose_name': '"""Parent"""'}), "('self', blank=True, null=True, related_name='children',\n verbose_name='Parent')\n", (218, 301), False, 'from mptt.fields import T... |
# Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import trunc_normal_init
from ..builder import HEADS
from .base import BaseHead
@HEADS.register_module()
class TimeSformerHead(BaseHead):
"""Classification head for TimeSformer.
Args:
num_classes (int): Number of cla... | [
"mmcv.cnn.trunc_normal_init",
"torch.nn.Linear"
] | [((1021, 1066), 'torch.nn.Linear', 'nn.Linear', (['self.in_channels', 'self.num_classes'], {}), '(self.in_channels, self.num_classes)\n', (1030, 1066), True, 'import torch.nn as nn\n'), ((1156, 1205), 'mmcv.cnn.trunc_normal_init', 'trunc_normal_init', (['self.fc_cls'], {'std': 'self.init_std'}), '(self.fc_cls, std=self... |
# -*- coding: utf-8 -*-
"""
Created on Sat May 1 18:26:28 2021
@author: abhay
version: 0.0.1
"""
import os,argparse
stack = []
'''
Stack is Used as a directory(folder/path) pointer due to its property of LIFO
It's last element is current directory Current Directory
'''
ipath = ''
'''
This is ... | [
"os.path.isfile",
"os.scandir",
"os.path.isdir",
"argparse.ArgumentParser"
] | [((3340, 3365), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (3363, 3365), False, 'import os, argparse\n'), ((1609, 1626), 'os.scandir', 'os.scandir', (['ipath'], {}), '(ipath)\n', (1619, 1626), False, 'import os, argparse\n'), ((2050, 2067), 'os.scandir', 'os.scandir', (['ipath'], {}), '(ipa... |
from django.shortcuts import render
from django.http import HttpResponse
from userProfile import loginFcn, buildProfile
from .models import Game, Category, Genre
# Create your views here.
def index(request):
'''
context = {
"games": Game.objects.all()
}
'''
queryDict = request.POST
res... | [
"django.shortcuts.render",
"userProfile.buildProfile",
"userProfile.loginFcn"
] | [((715, 743), 'django.shortcuts.render', 'render', (['request', '"""user.html"""'], {}), "(request, 'user.html')\n", (721, 743), False, 'from django.shortcuts import render\n'), ((892, 923), 'django.shortcuts.render', 'render', (['request', '"""profile.html"""'], {}), "(request, 'profile.html')\n", (898, 923), False, '... |