code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pdb
import sys
from binascii import hexlify, unhexlify
import hashlib
import bchscript.bchopcodes as bchopcodes
import bchscript.cashaddrutil as cashaddrutil
import bchscript.errors as err
if not "BCH_ADDRESS_PREFIX" in globals(): # don't initialize twice
BCH_ADDRESS_PREFIX = None
BCH_TESTNET = "bchtest:"... | [
"binascii.hexlify",
"bchscript.cashaddrutil.verify_checksum",
"bchscript.cashaddrutil.convertbits",
"bchscript.cashaddrutil.b32decode",
"hashlib.sha256",
"hashlib.new",
"bchscript.errors.Output",
"hashlib.blake2b"
] | [((2539, 2563), 'hashlib.new', 'hashlib.new', (['"""ripemd160"""'], {}), "('ripemd160')\n", (2550, 2563), False, 'import hashlib\n'), ((6778, 6806), 'bchscript.cashaddrutil.b32decode', 'cashaddrutil.b32decode', (['addr'], {}), '(addr)\n', (6800, 6806), True, 'import bchscript.cashaddrutil as cashaddrutil\n'), ((6948, 6... |
#!/usr/bin/env python3
import datetime
import csv
import re
from decimal import Decimal
from beancount.ingest import importer
from beancount.core import data
from beancount.core.amount import Amount
VERSION = '0.1.3'
class CSVImporter(importer.ImporterProtocol):
ENCODING = 'iso-8859-15'
HEAD = re.compile(... | [
"csv.reader",
"decimal.Decimal",
"csv.DictReader",
"datetime.datetime.strptime",
"beancount.core.data.Posting",
"beancount.core.data.new_metadata",
"re.compile"
] | [((309, 503), 're.compile', 're.compile', (['"""^\\\\* Transaktioner Period ([0-9]{4}-[0-9]{2}-[0-9]{2}).([0-9]{4}-[0-9]{2}-[0-9]{2}) Skapad ([0-9]{4}-[0-9]{2}-[0-9]{2}) ([0-9]{2}:[0-9]{2}) ([+-][0-9]{2}:[0-9]{2}|CES?T)$"""'], {}), "(\n '^\\\\* Transaktioner Period ([0-9]{4}-[0-9]{2}-[0-9]{2}).([0-9]{4}-[0-9]{2}-[0-... |
# Generated by Django 3.0.5 on 2020-04-04 17:25
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Trend',
fields=[
... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateField"
] | [((334, 427), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (350, 427), False, 'from django.db import migrations, models\... |
## Import modules
import dns
import json
import logging
import re
import requests
import ssl
import socket
import srvlookup
import urllib3
from fake_useragent import UserAgent
## Functions
def resolve_well_known(hostname):
"""Get delegated hostname and port from hostname
Try and look up the well-know server... | [
"fake_useragent.UserAgent",
"socket.gethostbyname",
"requests.get",
"srvlookup.lookup",
"urllib3.disable_warnings",
"logging.getLogger",
"re.compile"
] | [((732, 743), 'fake_useragent.UserAgent', 'UserAgent', ([], {}), '()\n', (741, 743), False, 'from fake_useragent import UserAgent\n'), ((928, 995), 'urllib3.disable_warnings', 'urllib3.disable_warnings', (['urllib3.exceptions.InsecureRequestWarning'], {}), '(urllib3.exceptions.InsecureRequestWarning)\n', (952, 995), Fa... |
import os
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as dist
from model.warp import backwarp, multiwarp, multimerge_flow
from model.refine import *
from model.setrans import SETransConfig, SelfAttVisPosTrans, print0
from model.forward_warp import fwarp_... | [
"functools.partial",
"model.losses.dual_teaching_loss",
"model.raft.update.BasicUpdateBlock",
"model.forward_warp.fwarp_blob",
"model.warp.multiwarp",
"torch.zeros_like",
"model.raft.extractor.BasicEncoder",
"torch.distributed.barrier",
"torch.cat",
"model.warp.backwarp",
"torch.zeros",
"os.en... | [((530, 561), 'os.environ.get', 'os.environ.get', (['"""LOCAL_RANK"""', '(0)'], {}), "('LOCAL_RANK', 0)\n", (544, 561), False, 'import os\n'), ((904, 918), 'torch.distributed.barrier', 'dist.barrier', ([], {}), '()\n', (916, 918), True, 'import torch.distributed as dist\n'), ((1875, 1934), 'model.raft.extractor.BasicEn... |
from django.contrib.sitemaps import Sitemap
from django.shortcuts import reverse
from .models import Article
class StaticViewSitemap(Sitemap):
def items(self):
return ["home", "articles"]
def location(self, item):
return reverse(item)
class ArticleSitemap(Sitemap):
def items(self):
... | [
"django.shortcuts.reverse"
] | [((249, 262), 'django.shortcuts.reverse', 'reverse', (['item'], {}), '(item)\n', (256, 262), False, 'from django.shortcuts import reverse\n')] |
from efdir import fs
from efdir import rstcfg
from efdir import jsoncfg
import os
#dlmktree mktree-from-dirs
#fmktree mktree-from-filecfg
def _cfgfile2pl(cfgfile):
suffix = os.path.splitext(cfgfile)[1]
if(suffix == ".rst"):
rst_str = fs.rfile(cfgfile)
dirs = rstcfg.get_dirs(rst_str)
elif... | [
"efdir.jsoncfg.get_dirs",
"os.path.join",
"os.path.basename",
"os.path.isdir",
"os.path.dirname",
"os.path.exists",
"efdir.fs.rjson",
"efdir.rstcfg.get_dirs",
"efdir.fs.touch",
"os.path.splitext",
"efdir.fs.mkdirs",
"efdir.fs.rfile"
] | [((754, 780), 'os.path.exists', 'os.path.exists', (['parent_dir'], {}), '(parent_dir)\n', (768, 780), False, 'import os\n'), ((975, 995), 'os.path.dirname', 'os.path.dirname', (['dir'], {}), '(dir)\n', (990, 995), False, 'import os\n'), ((1011, 1032), 'os.path.basename', 'os.path.basename', (['dir'], {}), '(dir)\n', (1... |
from typing import List
import numpy as np
Tensor = List[float]
def single_output(xdata: List[Tensor], ydata: List[Tensor]) -> List[Tensor]:
xdata = np.asarray(xdata)
ydata = np.asarray(ydata)
| [
"numpy.asarray"
] | [((155, 172), 'numpy.asarray', 'np.asarray', (['xdata'], {}), '(xdata)\n', (165, 172), True, 'import numpy as np\n'), ((185, 202), 'numpy.asarray', 'np.asarray', (['ydata'], {}), '(ydata)\n', (195, 202), True, 'import numpy as np\n')] |
import pytz
from django.db import transaction
from django.utils import timezone
from messdiener.models import Mass, Type
@transaction.atomic
def delete_masses_without_type(plan_pk):
Mass.objects.filter(plan=plan_pk).filter(type__isnull=True).delete()
@transaction.atomic
def assign_types(plan_pk):
types = T... | [
"messdiener.models.Mass.objects.filter",
"django.utils.timezone.get_current_timezone",
"messdiener.models.Type.objects.all"
] | [((319, 337), 'messdiener.models.Type.objects.all', 'Type.objects.all', ([], {}), '()\n', (335, 337), False, 'from messdiener.models import Mass, Type\n'), ((1229, 1260), 'django.utils.timezone.get_current_timezone', 'timezone.get_current_timezone', ([], {}), '()\n', (1258, 1260), False, 'from django.utils import timez... |
import json
import os
from discord.ext import commands
with open(os.getcwd() + '/resources/Setting.json', mode='r',
encoding='utf8') as Setting_Json:
Setting_Json_data = json.load(Setting_Json)
pybot = commands.Bot(command_prefix='r?')
@pybot.event
async def on_ready():
print("debug code 0")
for ... | [
"os.getcwd",
"json.load",
"discord.ext.commands.Bot"
] | [((218, 251), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': '"""r?"""'}), "(command_prefix='r?')\n", (230, 251), False, 'from discord.ext import commands\n'), ((185, 208), 'json.load', 'json.load', (['Setting_Json'], {}), '(Setting_Json)\n', (194, 208), False, 'import json\n'), ((343, 354), 'os.ge... |
import json
import os
import time
from confluent_kafka import Consumer, KafkaError
from slack import WebClient
from slack.errors import SlackApiError
# Bot User OAuth Access Token
# Scope = chat:write
token = os.environ["SLACK_BOT_TOKEN"]
sc = WebClient(token)
# Set 'auto.offset.reset': 'smallest' if you want to c... | [
"slack.WebClient",
"confluent_kafka.Consumer",
"time.sleep"
] | [((248, 264), 'slack.WebClient', 'WebClient', (['token'], {}), '(token)\n', (257, 264), False, 'from slack import WebClient\n'), ((530, 548), 'confluent_kafka.Consumer', 'Consumer', (['settings'], {}), '(settings)\n', (538, 548), False, 'from confluent_kafka import Consumer, KafkaError\n'), ((709, 722), 'time.sleep', '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 17 14:53:05 2017
@author: manu
Step 1 : Modify the 1KGP OMNI maps to have same physical positions(bp) by interpolation
"""
import pandas as pd
import os
from scipy.interpolate import interp1d
import numpy as np
omni="../OMNI/" #... | [
"pandas.DataFrame",
"os.makedirs",
"pandas.merge",
"os.path.exists",
"numpy.diff",
"pandas.read_table",
"scipy.interpolate.interp1d",
"os.listdir"
] | [((474, 490), 'os.listdir', 'os.listdir', (['omni'], {}), '(omni)\n', (484, 490), False, 'import os\n'), ((1431, 1447), 'os.listdir', 'os.listdir', (['omni'], {}), '(omni)\n', (1441, 1447), False, 'import os\n'), ((551, 573), 'os.listdir', 'os.listdir', (['(omni + pop)'], {}), '(omni + pop)\n', (561, 573), False, 'impo... |
"""
Terminal info.
"""
import platform
import struct
# pylint: disable=invalid-name
try:
if platform.system() == 'Windows': # pragma: no cover (windows)
from ctypes import windll, create_string_buffer
fcntl, termios = None, None
else:
import fcntl
import termios
windl... | [
"fcntl.ioctl",
"struct.unpack",
"ctypes.windll.kernel32.GetStdHandle",
"ctypes.create_string_buffer",
"ctypes.windll.kernel32.GetConsoleScreenBufferInfo",
"platform.system"
] | [((99, 116), 'platform.system', 'platform.system', ([], {}), '()\n', (114, 116), False, 'import platform\n'), ((687, 729), 'fcntl.ioctl', 'fcntl.ioctl', (['(0)', 'termios.TIOCGWINSZ', '""" """'], {}), "(0, termios.TIOCGWINSZ, ' ')\n", (698, 729), False, 'import fcntl\n'), ((753, 781), 'struct.unpack', 'struct.unp... |
from rdflib import URIRef, Namespace
from definednamespace import DefinedNamespace
class RDFMOD(DefinedNamespace):
# http://www.w3.org/1999/02/22-rdf-syntax-ns#Property
comment: URIRef # A description of the subject resource.
domain: URIRef # A domain of the subject property.
... | [
"rdflib.Namespace"
] | [((1483, 1533), 'rdflib.Namespace', 'Namespace', (['"""http://www.w3.org/2000/01/rdf-schema#"""'], {}), "('http://www.w3.org/2000/01/rdf-schema#')\n", (1492, 1533), False, 'from rdflib import URIRef, Namespace\n')] |
#!/usr/bin/env python
'''
Author: <NAME>
Date: 23/11/2016
Script to convert pipeline output in MRP matrix format to distance matrix format.
Produces distance matrix file for every tree block in input,
and also a log file for every input file.
Run by using "make sdmdata" command.
Pipeline MRP input:
T... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"os.path.basename",
"logging.warning",
"logging.info",
"itertools.product"
] | [((752, 828), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s:%(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(levelname)s:%(message)s', level=logging.DEBUG)\n", (771, 828), False, 'import logging\n'), ((3535, 3603), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'de... |
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
import random
import time
import sys
def display_image(window_name, img):
"""
Displays image with given window name.
:param window_name: name of the window
:param img: image object to display
"""
cv.imshow(window_name, im... | [
"cv2.GaussianBlur",
"cv2.integral",
"numpy.sum",
"numpy.argmax",
"cv2.sepFilter2D",
"cv2.medianBlur",
"cv2.bilateralFilter",
"numpy.exp",
"cv2.imshow",
"random.randint",
"cv2.filter2D",
"cv2.copyMakeBorder",
"cv2.destroyAllWindows",
"cv2.equalizeHist",
"numpy.size",
"cv2.waitKey",
"c... | [((295, 322), 'cv2.imshow', 'cv.imshow', (['window_name', 'img'], {}), '(window_name, img)\n', (304, 322), True, 'import cv2 as cv\n'), ((327, 340), 'cv2.waitKey', 'cv.waitKey', (['(0)'], {}), '(0)\n', (337, 340), True, 'import cv2 as cv\n'), ((345, 367), 'cv2.destroyAllWindows', 'cv.destroyAllWindows', ([], {}), '()\n... |
from django.db import models
class Blog(models.Model):
title = models.CharField(max_length=200)
blog = models.TextField()
date = models.DateField()
writer = models.CharField(max_length=30, null=True)
def __str__(self):
return self.title
class WriterIdentifier(models.Model):
everybodys ... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.DateField"
] | [((68, 100), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (84, 100), False, 'from django.db import models\n'), ((112, 130), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (128, 130), False, 'from django.db import models\n'), ((142, 160), 'dj... |
from sqlalchemy.orm import Session
from fastapi import HTTPException
import models
import schemas
import ast
import datetime
import pandas as pd
def get_courier_by_id(db: Session, courier_id: int):
courier = db.query(models.Courier).filter(models.Courier.courier_id == courier_id).first()
return courier
de... | [
"pandas.DataFrame",
"fastapi.HTTPException",
"models.CompleteOrder",
"pandas.Index",
"pandas.to_datetime",
"ast.literal_eval",
"datetime.datetime.now"
] | [((4123, 4156), 'ast.literal_eval', 'ast.literal_eval', (['courier.regions'], {}), '(courier.regions)\n', (4139, 4156), False, 'import ast\n'), ((4185, 4224), 'ast.literal_eval', 'ast.literal_eval', (['courier.working_hours'], {}), '(courier.working_hours)\n', (4201, 4224), False, 'import ast\n'), ((6463, 6501), 'ast.l... |
import urllib.request
import zipfile
import time
import statistics
import pytest
from sly.lex import LexError
from nix_transform import NixLexer
@pytest.mark.parametrize('repo_url', [
'https://github.com/NixOS/nixpkgs/archive/master.zip'
])
def test_benchmark_lexer(tmp_path, repo_url):
zip_filename = tmp... | [
"zipfile.ZipFile",
"statistics.median",
"time.time",
"nix_transform.NixLexer",
"statistics.mean",
"pytest.mark.parametrize"
] | [((151, 248), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""repo_url"""', "['https://github.com/NixOS/nixpkgs/archive/master.zip']"], {}), "('repo_url', [\n 'https://github.com/NixOS/nixpkgs/archive/master.zip'])\n", (174, 248), False, 'import pytest\n'), ((485, 514), 'zipfile.ZipFile', 'zipfile.ZipFil... |
from uuid import UUID
def is_uuid_valid(uuid):
try:
version = UUID(uuid).version
# nil UUID has version None
return False if version is None else True
except (AttributeError, ValueError, TypeError):
return False
| [
"uuid.UUID"
] | [((76, 86), 'uuid.UUID', 'UUID', (['uuid'], {}), '(uuid)\n', (80, 86), False, 'from uuid import UUID\n')] |
# CSE Drone Team 2020
import numpy as np
import cv2
import cv2.aruco as aruco
import sys, time, math
class ArucoTracker():
def __init__(self, tracker_id, tracker_size, mtx, dst, camera_size=[640,480], gui=False):
#Marker information
self.tracker_id = tracker_id
self.tracker_s... | [
"math.atan",
"cv2.aruco.estimatePoseSingleMarkers",
"cv2.aruco.drawDetectedMarkers",
"cv2.aruco.DetectorParameters_create",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.destroyAllWindows",
"time.time",
"cv2.aruco.Dictionary_get",
"cv2.VideoCapture",
"cv2.aruco.detectMarkers",
"numpy.sh... | [((5528, 5579), 'numpy.loadtxt', 'np.loadtxt', (['"""calib/cameraMatrix.txt"""'], {'delimiter': '""","""'}), "('calib/cameraMatrix.txt', delimiter=',')\n", (5538, 5579), True, 'import numpy as np\n'), ((5592, 5647), 'numpy.loadtxt', 'np.loadtxt', (['"""calib/cameraDistortion.txt"""'], {'delimiter': '""","""'}), "('cali... |
import tensorflow as tf
import tensorflow_model_analysis as tfma
from tfx.proto import trainer_pb2
def gzip_reader_fn(filenames):
return tf.data.TFRecordDataset(
filenames,
compression_type='GZIP')
def get_feature_spec():
feature_spec = {}
for key in range(0, 200):
feature_spec['var_{0}'.format(... | [
"tensorflow_model_analysis.export.EvalInputReceiver",
"tensorflow.data.TFRecordDataset",
"tensorflow.compat.v1.placeholder",
"tensorflow.data.experimental.make_batched_features_dataset",
"tensorflow.compat.v1.data.make_one_shot_iterator",
"tensorflow.io.parse_example",
"tensorflow.io.FixedLenFeature",
... | [((140, 199), 'tensorflow.data.TFRecordDataset', 'tf.data.TFRecordDataset', (['filenames'], {'compression_type': '"""GZIP"""'}), "(filenames, compression_type='GZIP')\n", (163, 199), True, 'import tensorflow as tf\n'), ((399, 440), 'tensorflow.io.FixedLenFeature', 'tf.io.FixedLenFeature', (['[]'], {'dtype': 'tf.int64'}... |
import os
from sys import platform
from typing import Any, Dict, List
import pymysql
import yaml
url_prefix = 'api/v%s' % ('.'.join(os.environ['UWKGM_API_VERSION'].split('.')[:2]))
def envyml(name: str, base_dir: str, var: str) -> Any:
def walk(sub_tree: Dict[str, Any], sub_path: List[str]) -> Any:
ret... | [
"pymysql.install_as_MySQLdb"
] | [((583, 611), 'pymysql.install_as_MySQLdb', 'pymysql.install_as_MySQLdb', ([], {}), '()\n', (609, 611), False, 'import pymysql\n')] |
import pathlib
import os
import sys
import cellpy
from cellpy import cellreader
from cellpy import log
log.setup_logging(default_level="DEBUG")
def load_c_file(filename):
c = cellreader.CellpyData()
c.load(filename)
return c
def load_r_file(filename):
c = cellreader.CellpyData()
c.from_raw(fil... | [
"pathlib.Path",
"cellpy.log.setup_logging",
"cellpy.cellreader.CellpyData",
"os.listdir"
] | [((105, 145), 'cellpy.log.setup_logging', 'log.setup_logging', ([], {'default_level': '"""DEBUG"""'}), "(default_level='DEBUG')\n", (122, 145), False, 'from cellpy import log\n'), ((627, 646), 'os.listdir', 'os.listdir', (['hdf_dir'], {}), '(hdf_dir)\n', (637, 646), False, 'import os\n'), ((732, 751), 'os.listdir', 'os... |
import pkg_resources
pkg_resources.declare_namespace(__name__)
__version__ = '2'
| [
"pkg_resources.declare_namespace"
] | [((21, 62), 'pkg_resources.declare_namespace', 'pkg_resources.declare_namespace', (['__name__'], {}), '(__name__)\n', (52, 62), False, 'import pkg_resources\n')] |
import requests, json
def get_subs(page):
metadata = get_metadata(page)
return metadata['subtitles']
def get_metadata(page):
meta = page.text.split('vilos.config.media = ')[1].split(';\n\n')[0]
return json.loads(meta) | [
"json.loads"
] | [((219, 235), 'json.loads', 'json.loads', (['meta'], {}), '(meta)\n', (229, 235), False, 'import requests, json\n')] |
#!/usr/bin/env python -OO
# encoding: utf-8
###########
# ORP - Open Robotics Platform
#
# Copyright (c) 2010 <NAME>, <NAME>
#
# 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 restr... | [
"unittest.main",
"thread.start_new_thread",
"time.sleep",
"threading.Lock",
"test_helper.startServerIfStopped",
"sys.stderr.write",
"SocketServer.ThreadingTCPServer.__init__"
] | [((5815, 5830), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5828, 5830), False, 'import unittest\n'), ((1750, 1902), 'sys.stderr.write', 'sys.stderr.write', (['(\'You might not have the \' + PKGNAME +\n " module, try \'easy_install " + PKGNAME +\n """\', else consult google.\n""" + e)'], {}),... |
"""
EZBASTI -- A python package that allows you to download BASTI isochrones directly from the BASTI
directly website
based on EZPADOVA and EZBASTI
:version: 0.1
:author: <NAME>
"""
from __future__ import print_function, unicode_literals, division
import sys
import os
import inspect
import time
from io import Stri... | [
"io.BytesIO",
"re.findall",
"tarfile.open",
"urllib2.urlopen",
"astropy.table.Table.read",
"re.compile"
] | [((4172, 4181), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (4179, 4181), False, 'from io import BytesIO\n'), ((4379, 4421), 'tarfile.open', 'tarfile.open', ([], {'fileobj': 'tmpfile', 'mode': '"""r:gz"""'}), "(fileobj=tmpfile, mode='r:gz')\n", (4391, 4421), False, 'import tarfile\n'), ((5021, 5067), 'astropy.table.Tabl... |
#!/usr/bin/env python
import os
import time
import traceback
from argparse import ArgumentParser
from glob import glob
import numpy as np
import tensorflow as tf
from scipy.misc import imread, imsave
from utils import (get_hand_segmentation_for_image, get_combined_segmentation_for_image,
get_patho... | [
"utils.get_patho_segmentation_for_image",
"utils.get_combined_segmentation_for_image",
"numpy.count_nonzero",
"argparse.ArgumentParser",
"tensorflow.logging.info",
"os.path.basename",
"tensorflow.logging.set_verbosity",
"time.time",
"utils.get_hand_segmentation_for_image",
"os.path.splitext",
"t... | [((471, 487), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (485, 487), False, 'from argparse import ArgumentParser\n'), ((2610, 2721), 'tensorflow.logging.info', 'tf.logging.info', (['"""There seems to be exactly one hand, pathology, and combined segmentation per image"""'], {}), "(\n 'There seems ... |
import sys
if(sys.version_info >= (3, 8)):
from importlib.metadata import version
else:
from importlib_metadata import version
__version__ = version(__package__)
from .captcha9kw import api9kw, CaptchaError
__all__ = ["api9kw", "CaptchaError"]
| [
"importlib_metadata.version"
] | [((150, 170), 'importlib_metadata.version', 'version', (['__package__'], {}), '(__package__)\n', (157, 170), False, 'from importlib_metadata import version\n')] |
import numpy as np
from numpy.linalg import inv
def ukfupdate(xsigmapts, ysigmapts, yobs, sigw):
"""Provides Updated mean and covariance.
:param xsigmapts: prior state sigma points.
:param ysigmapts: measurement generated by prior state sigma points.
:param yobs: actual measurement.
:param sigw: ... | [
"numpy.shape",
"numpy.linalg.inv",
"numpy.zeros",
"numpy.matmul"
] | [((572, 590), 'numpy.zeros', 'np.zeros', (['(l1, l1)'], {}), '((l1, l1))\n', (580, 590), True, 'import numpy as np\n'), ((601, 619), 'numpy.zeros', 'np.zeros', (['(l1, l1)'], {}), '((l1, l1))\n', (609, 619), True, 'import numpy as np\n'), ((630, 648), 'numpy.zeros', 'np.zeros', (['(l1, l1)'], {}), '((l1, l1))\n', (638,... |
"""
Question Source: https://leetcode.com/problems/find-the-town-judge/
Level: Easy
Topic: Graph
Solver: Tayyrov
Date: 03.01.2022
"""
from collections import defaultdict
def findJudge_solution1(trust, n) -> int:
trustees = defaultdict(set) # as the values are unique list as a value type can be used to... | [
"collections.defaultdict"
] | [((240, 256), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (251, 256), False, 'from collections import defaultdict\n')] |
from containers import Databases
from file import load_databases_from_file as load
load()
print(Databases.databases) | [
"file.load_databases_from_file"
] | [((83, 89), 'file.load_databases_from_file', 'load', ([], {}), '()\n', (87, 89), True, 'from file import load_databases_from_file as load\n')] |
import pytest
from pexen.sched import TaskRes
from pexen.sched.pool import PoolError
from tests.sched.common import *
from tests.sched.common import check_resources
@parametrize_pool_both()
def test_pool_reuse(pool):
dummy1 = create_dummy('dummy1')
dummy2 = create_dummy('dummy2')
p = pool()
p.registe... | [
"pytest.raises",
"pexen.sched.TaskRes"
] | [((829, 844), 'pexen.sched.TaskRes', 'TaskRes', (['dummy1'], {}), '(dummy1)\n', (836, 844), False, 'from pexen.sched import TaskRes\n'), ((863, 878), 'pexen.sched.TaskRes', 'TaskRes', (['dummy2'], {}), '(dummy2)\n', (870, 878), False, 'from pexen.sched import TaskRes\n'), ((1424, 1439), 'pexen.sched.TaskRes', 'TaskRes'... |
#! /usr/bin/env python
# encoding: utf-8
import re
from marshmallow import Schema, fields
import datetime
from collections import OrderedDict
from dataclasses import dataclass
import logging
from io import StringIO
def soup_maker(fh):
""" Takes a file handler returns BeautifulSoup"""
try:
from bs4 im... | [
"io.StringIO",
"re.split",
"logging.basicConfig",
"BeautifulSoup.BeautifulStoneSoup",
"datetime.date.today",
"bs4.BeautifulSoup",
"datetime.datetime.strptime",
"re.findall",
"datetime.timedelta",
"marshmallow.fields.String",
"marshmallow.fields.Number",
"collections.OrderedDict",
"logging.ge... | [((33597, 33612), 'marshmallow.fields.Number', 'fields.Number', ([], {}), '()\n', (33610, 33612), False, 'from marshmallow import Schema, fields\n'), ((33634, 33649), 'marshmallow.fields.Number', 'fields.Number', ([], {}), '()\n', (33647, 33649), False, 'from marshmallow import Schema, fields\n'), ((33675, 33690), 'mar... |
import os
from bot.clientSetup import clientSetup
from bot.preferences import Preferences
def main():
os.chdir(os.path.dirname(__file__))
p = Preferences()
c = clientSetup(p)
f = open("data/token.txt", 'r')
token = f.readline()[:-1]
f.close()
c.run(token)
main() | [
"os.path.dirname",
"bot.clientSetup.clientSetup",
"bot.preferences.Preferences"
] | [((154, 167), 'bot.preferences.Preferences', 'Preferences', ([], {}), '()\n', (165, 167), False, 'from bot.preferences import Preferences\n'), ((176, 190), 'bot.clientSetup.clientSetup', 'clientSetup', (['p'], {}), '(p)\n', (187, 190), False, 'from bot.clientSetup import clientSetup\n'), ((118, 143), 'os.path.dirname',... |
from collections import defaultdict
from catalyst.core.callback import Callback, CallbackNode, CallbackOrder
from catalyst.core.runner import IRunner
class ValidationManagerCallback(Callback):
"""
A callback to aggregate runner.valid_metrics from runner.epoch_metrics.
"""
def __init__(self):
... | [
"collections.defaultdict"
] | [((656, 673), 'collections.defaultdict', 'defaultdict', (['None'], {}), '(None)\n', (667, 673), False, 'from collections import defaultdict\n')] |
from setuptools import setup, find_packages
setup(
name="home-assistant-frontend",
version="20191108.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",
author_email="<EMAIL>",
license="Apache Li... | [
"setuptools.find_packages"
] | [((345, 404), 'setuptools.find_packages', 'find_packages', ([], {'include': "['hass_frontend', 'hass_frontend.*']"}), "(include=['hass_frontend', 'hass_frontend.*'])\n", (358, 404), False, 'from setuptools import setup, find_packages\n')] |
"""Remove duplicate QNR.identifiers
Revision ID: a1de3ab4d050
Revises: <KEY>
Create Date: 2019-02-11 16:48:55.332527
"""
import json
from sqlalchemy import func
from portal.database import db
from portal.dict_tools import dict_compare
from portal.models.audit import Audit
from portal.models.identifier import Identifi... | [
"portal.database.db.session.query",
"portal.models.questionnaire_response.QuestionnaireResponse.by_identifier",
"portal.models.questionnaire_response.QuestionnaireResponse.id.in_",
"portal.database.db.session.add",
"json.dumps",
"portal.database.db.session.commit",
"portal.models.user.User.query.filter_... | [((735, 759), 'portal.dict_tools.dict_compare', 'dict_compare', (['doc1', 'doc2'], {}), '(doc1, doc2)\n', (747, 759), False, 'from portal.dict_tools import dict_compare\n'), ((1849, 1887), 'portal.models.identifier.Identifier', 'Identifier', ([], {'system': 'system', 'value': 'value'}), '(system=system, value=value)\n'... |
import numpy as np
def realization(p_1, p_2, n_trials):
p_3 = 1.0 - p_1 - p_2
outcomes = np.random.random(n_trials)
ii_1 = outcomes<=p_1
ii_2 = (outcomes>p_1) & (outcomes<=(p_1+p_2))
ii_3 = (~ii_1) & (~ii_2)
outcomes[ii_1] = 1
outcomes[ii_2] = 2
outcomes[ii_3] = 3
N_1 = len(outc... | [
"numpy.random.random",
"numpy.zeros"
] | [((99, 125), 'numpy.random.random', 'np.random.random', (['n_trials'], {}), '(n_trials)\n', (115, 125), True, 'import numpy as np\n'), ((468, 506), 'numpy.zeros', 'np.zeros', (['[n_trials + 1, n_trials + 1]'], {}), '([n_trials + 1, n_trials + 1])\n', (476, 506), True, 'import numpy as np\n')] |
# Copyright (c) 2021 Red Hat 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 writi... | [
"oslo_utils.uuidutils.generate_uuid",
"neutron.policy.enforce"
] | [((9620, 9678), 'neutron.policy.enforce', 'policy.enforce', (['self.context', '"""create_router"""', 'self.target'], {}), "(self.context, 'create_router', self.target)\n", (9634, 9678), False, 'from neutron import policy\n'), ((9924, 9994), 'neutron.policy.enforce', 'policy.enforce', (['self.context', '"""create_router... |
import pytest
import shapely.geometry
from descarteslabs import scenes
from .. import GeoContext
from descarteslabs.workflows.types.containers import Tuple
from descarteslabs.workflows.types.primitives import Int, Float
def test_from_scenes_wrong_type():
with pytest.raises(
TypeError, match=r"expected a ... | [
"pytest.raises",
"pytest.mark.parametrize",
"descarteslabs.scenes.DLTile",
"descarteslabs.scenes.XYZTile"
] | [((2748, 2835), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""attr"""', "['arr_shape', 'gdal_geotrans', 'projected_bounds']"], {}), "('attr', ['arr_shape', 'gdal_geotrans',\n 'projected_bounds'])\n", (2771, 2835), False, 'import pytest\n'), ((1864, 1888), 'descarteslabs.scenes.DLTile', 'scenes.DLTile',... |
# Created: 28.12.2019
# Copyright (c) 2019 <NAME>
# License: MIT License
import pytest
from io import StringIO
from steputils import p21
@pytest.fixture
def stpfile():
stp = p21.new_step_file()
timestamp = p21.timestamp()
stp.header.set_file_description(('notes1', 'notes2'))
stp.header.set_file_name(... | [
"steputils.p21.timestamp",
"io.StringIO",
"pytest.main",
"pytest.raises",
"steputils.p21.new_step_file",
"steputils.p21.is_simple_entity_instance",
"steputils.p21.entity"
] | [((181, 200), 'steputils.p21.new_step_file', 'p21.new_step_file', ([], {}), '()\n', (198, 200), False, 'from steputils import p21\n'), ((217, 232), 'steputils.p21.timestamp', 'p21.timestamp', ([], {}), '()\n', (230, 232), False, 'from steputils import p21\n'), ((840, 859), 'steputils.p21.new_step_file', 'p21.new_step_f... |
import os
import random
import string
import numpy as np
import pandas as pd
from sklearn import preprocessing
from pymilvus_orm.types import DataType
from base.schema_wrapper import ApiCollectionSchemaWrapper, ApiFieldSchemaWrapper
from common import common_type as ct
from utils.util_log import test_log as log
import... | [
"numpy.bitwise_xor",
"utils.util_log.test_log.error",
"os.path.isfile",
"numpy.arange",
"base.schema_wrapper.ApiFieldSchemaWrapper",
"numpy.bitwise_or",
"pandas.DataFrame",
"base.schema_wrapper.ApiCollectionSchemaWrapper",
"random.randint",
"utils.util_log.test_log.debug",
"utils.util_log.test_l... | [((3773, 3824), 'sklearn.preprocessing.normalize', 'preprocessing.normalize', (['vectors'], {'axis': '(1)', 'norm': '"""l2"""'}), "(vectors, axis=1, norm='l2')\n", (3796, 3824), False, 'from sklearn import preprocessing\n'), ((4483, 4641), 'pandas.DataFrame', 'pd.DataFrame', (['{ct.default_int64_field_name: int_values,... |
import datetime
import os
from collections import deque
import random
import numpy as np
import tensorflow as tf
import pysc2.agents.myAgent.myAgent_6.config.config as config
from pysc2.agents.myAgent.myAgent_6.net.lenet import Lenet
class DQN():
def __init__(self, mu, sigma, learning_rate, actiondim, paramete... | [
"numpy.random.uniform",
"os.makedirs",
"tensorflow.train.Saver",
"numpy.argmax",
"numpy.random.rand",
"random.sample",
"numpy.zeros",
"numpy.append",
"pysc2.agents.myAgent.myAgent_6.net.lenet.Lenet",
"tensorflow.summary.FileWriter",
"numpy.array",
"numpy.random.randint",
"tensorflow.initiali... | [((418, 450), 'collections.deque', 'deque', ([], {'maxlen': 'config.REPLAY_SIZE'}), '(maxlen=config.REPLAY_SIZE)\n', (423, 450), False, 'from collections import deque\n'), ((845, 959), 'pysc2.agents.myAgent.myAgent_6.net.lenet.Lenet', 'Lenet', (['self.mu', 'self.sigma', 'self.learning_rate', 'self.action_dim', 'self.pa... |
from datetime import datetime
from time import time
from typing import TYPE_CHECKING
from grouper.constants import PERMISSION_CREATE
from grouper.entities.permission import Permission
from grouper.fe.template_util import print_date
from itests.pages.permissions import PermissionsPage
from itests.setup import frontend_... | [
"itests.pages.permissions.PermissionsPage",
"grouper.fe.template_util.print_date",
"time.time",
"datetime.datetime.utcfromtimestamp",
"itests.setup.frontend_server",
"tests.url_util.url",
"grouper.entities.permission.Permission"
] | [((869, 897), 'datetime.datetime.utcfromtimestamp', 'datetime.utcfromtimestamp', (['(1)'], {}), '(1)\n', (894, 897), False, 'from datetime import datetime\n'), ((1045, 1139), 'grouper.entities.permission.Permission', 'Permission', ([], {'name': '"""first-permission"""', 'description': '"""first"""', 'created_on': 'now_... |
import os
from django.shortcuts import render
from django.conf import settings
from django.http import HttpResponse
from . import database
from .models import PageView
from rest_framework.viewsets import GenericViewSet
from rest_framework.mixins import (RetrieveModelMixin, CreateModelMixin, ListModelMixin, RetrieveM... | [
"primesession.serializer.Session.objects.all",
"os.getenv"
] | [((465, 497), 'os.getenv', 'os.getenv', (['"""HOSTNAME"""', '"""unknown"""'], {}), "('HOSTNAME', 'unknown')\n", (474, 497), False, 'import os\n'), ((934, 955), 'primesession.serializer.Session.objects.all', 'Session.objects.all', ([], {}), '()\n', (953, 955), False, 'from primesession.serializer import Session, Session... |
import logging
logging.basicConfig(
format='%(asctime)s - %(levelname)s - %(name)s - %(message)s',
datefmt='%Y/%m/%d %H:%M:%S',
level=logging.INFO,
)
logger = logging.getLogger("Main")
import os,random
import numpy as np
import torch
from utils_glue import output_modes, processors
from pytorch_pretrai... | [
"numpy.random.seed",
"torch.utils.data.RandomSampler",
"numpy.argmax",
"pytorch_pretrained_bert.BertTokenizer",
"textbrewer.MultiTeacherDistiller",
"torch.cuda.device_count",
"config.parse",
"pytorch_pretrained_bert.my_modeling.BertConfig.from_json_file",
"torch.device",
"modeling.BertForGLUESimpl... | [((15, 157), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%Y/%m/%d %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%Y/%m/%d %H:%M:%S', level=logg... |
import unittest
"""
Implement a queue with 2 stacks.
Your queue should have an enqueue and a dequeue function and it should be "first in first out" (FIFO).
"""
class SelfImplementQueue:
stack1 = []
stack2 = []
def __init__(self):
pass
def enqueue(self, item):
"""
Adds a new ... | [
"unittest.main"
] | [((1383, 1398), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1396, 1398), False, 'import unittest\n')] |
import csv
import json
import itertools
PARTIES = ['conservative', 'liberal', 'ndp', 'green', 'bloc']
BASE_URL = 'https://www.ourcommons.ca/Parliamentarians/en/votes/%d/%d/%d/'
if __name__ == '__main__':
headers = ['Date', 'Parliament Number', 'Session Number', 'Decision Number',
'Result', 'Decision Type', 'Decis... | [
"itertools.combinations",
"json.load",
"csv.writer"
] | [((639, 673), 'itertools.combinations', 'itertools.combinations', (['PARTIES', '(2)'], {}), '(PARTIES, 2)\n', (661, 673), False, 'import itertools\n'), ((825, 859), 'itertools.combinations', 'itertools.combinations', (['PARTIES', '(3)'], {}), '(PARTIES, 3)\n', (847, 859), False, 'import itertools\n'), ((1105, 1117), 'j... |
import numpy as np
import random,copy
from scipy.sparse import csr_matrix
import scipy.integrate
from numpy import linalg
import time
import settings
import math
####PAULI OPERATORS####
def sigma_x_operator(basis_vector,indices,pos_sigma=-1):
"""Operator that creates the matrix representation of sigma_x."""
... | [
"numpy.trace",
"numpy.zeros_like",
"numpy.multiply",
"numpy.std",
"numpy.vdot",
"numpy.zeros",
"numpy.transpose",
"numpy.identity",
"copy.copy",
"random.random",
"scipy.sparse.csr_matrix",
"numpy.mean",
"numpy.reshape",
"numpy.linalg.norm",
"numpy.sqrt"
] | [((731, 751), 'numpy.zeros', 'np.zeros', (['(dim, dim)'], {}), '((dim, dim))\n', (739, 751), True, 'import numpy as np\n'), ((2582, 2595), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (2590, 2595), True, 'import numpy as np\n'), ((3320, 3333), 'numpy.zeros', 'np.zeros', (['dim'], {}), '(dim)\n', (3328, 3333), T... |
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
"""
Simple settings file for the in-and-outs of Kaa.
"""
class KaaSettings:
'Should we try to parallelize the generator calculations?'
Parallelize = True
'''
The optimiation procedure to use in the bundle transformation. Optimization proc... | [
"os.path.abspath",
"os.path.join"
] | [((37, 62), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (52, 62), False, 'import os\n'), ((796, 826), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""data"""'], {}), "(ROOT_DIR, 'data')\n", (808, 826), False, 'import os\n'), ((1371, 1404), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"... |
# -*- coding: utf-8 -*- #
# Copyright 2014 Google LLC. 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 requir... | [
"googlecloudsdk.core.util.platforms.OperatingSystem.Current",
"os.path.join",
"sys.exc_info"
] | [((2459, 2494), 'googlecloudsdk.core.util.platforms.OperatingSystem.Current', 'platforms.OperatingSystem.Current', ([], {}), '()\n', (2492, 2494), False, 'from googlecloudsdk.core.util import platforms\n'), ((2937, 2976), 'os.path.join', 'os.path.join', (['sdk_root', '"""bin"""', '"""gcloud"""'], {}), "(sdk_root, 'bin'... |
from stix_shifter_utils.utils.error_mapper_base import ErrorMapperBase
from stix_shifter_utils.utils.error_response import ErrorCode
from stix_shifter_utils.stix_translation.src.utils.exceptions import DataMappingException, StixValidationException, \
UnsupportedDataSourceException, TranslationResultException, Unsup... | [
"stix_shifter_utils.utils.error_mapper_base.ErrorMapperBase.set_error_code",
"stix_shifter_utils.utils.logger.set_logger"
] | [((1415, 1442), 'stix_shifter_utils.utils.logger.set_logger', 'logger.set_logger', (['__name__'], {}), '(__name__)\n', (1432, 1442), False, 'from stix_shifter_utils.utils import logger\n'), ((2436, 2513), 'stix_shifter_utils.utils.error_mapper_base.ErrorMapperBase.set_error_code', 'ErrorMapperBase.set_error_code', (['r... |
from application import app
from flask import render_template, request, json, jsonify
from sklearn import preprocessing
from sklearn.preprocessing import OneHotEncoder
import requests
import numpy
import pandas as pd
#decorator to access the app
@app.route("/")
@app.route("/index")
def index():
return render_templ... | [
"flask.request.form.get",
"flask.json.dumps",
"flask.render_template",
"application.app.route",
"requests.post"
] | [((248, 262), 'application.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (257, 262), False, 'from application import app\n'), ((264, 283), 'application.app.route', 'app.route', (['"""/index"""'], {}), "('/index')\n", (273, 283), False, 'from application import app\n'), ((373, 424), 'application.app.route', 'ap... |
#!/usr/bin/env python3
import os
from random import randint
from RLTest import Env
from redis import ResponseError
import redis
import sys
import random
import math
is_valgrind = True if ("VGD" in os.environ or "VALGRIND" in os.environ) else False
def parse_tdigest_info(array_reply):
reply_dict = {}
for pos ... | [
"random.random",
"RLTest.Env"
] | [((578, 603), 'RLTest.Env', 'Env', ([], {'decodeResponses': '(True)'}), '(decodeResponses=True)\n', (581, 603), False, 'from RLTest import Env\n'), ((2793, 2808), 'random.random', 'random.random', ([], {}), '()\n', (2806, 2808), False, 'import random\n'), ((4350, 4365), 'random.random', 'random.random', ([], {}), '()\n... |
#!/usr/bin/python
"""
Program to add uncat template to images without categories at commons.
See imagerecat.py to add these images to categories.
This script is working on the given site, so if the commons should be handled,
the site commons should be given and not a Wikipedia or similar.
¶ms;
"""
#
# (C) Pywiki... | [
"pywikibot.Site",
"pywikibot.output",
"pywikibot.pagegenerators.GeneratorFactory",
"contextlib.suppress",
"pywikibot.tools.issue_deprecation_warning",
"pywikibot.bot.suggest_help",
"datetime.timedelta",
"pywikibot.handle_args",
"pywikibot.Timestamp.utcnow"
] | [((41605, 41633), 'pywikibot.Timestamp.utcnow', 'pywikibot.Timestamp.utcnow', ([], {}), '()\n', (41631, 41633), False, 'import pywikibot\n'), ((43456, 43483), 'pywikibot.handle_args', 'pywikibot.handle_args', (['args'], {}), '(args)\n', (43477, 43483), False, 'import pywikibot\n'), ((43496, 43512), 'pywikibot.Site', 'p... |
""" Cisco_IOS_XR_asr9k_sc_envmon_admin_oper
This module contains a collection of YANG definitions
for Cisco IOS\-XR asr9k\-sc\-envmon package
admin\-plane operational data.
This module contains definitions
for the following management objects\:
environmental\-monitoring\: Admin Environmental Monitoring
Operati... | [
"collections.OrderedDict",
"ydk.types.YLeaf",
"ydk.types.YList"
] | [((1787, 1853), 'collections.OrderedDict', 'OrderedDict', (["[('racks', ('racks', EnvironmentalMonitoring.Racks))]"], {}), "([('racks', ('racks', EnvironmentalMonitoring.Racks))])\n", (1798, 1853), False, 'from collections import OrderedDict\n'), ((1876, 1889), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n'... |
"""
Hacky way to load a .reg file into the registry when regedit.exe has been disabled by the administrator
Probably very fragile!
"""
import sys
import winreg
def load_reg(input_file):
lines = open(input_file, encoding='utf-16-le').read().splitlines()
hkey = None
for line in lines:
if line.st... | [
"winreg.CreateKey",
"winreg.SetValueEx"
] | [((774, 828), 'winreg.SetValueEx', 'winreg.SetValueEx', (['hkey', 'name', '(0)', 'winreg.REG_SZ', 'value'], {}), '(hkey, name, 0, winreg.REG_SZ, value)\n', (791, 828), False, 'import winreg\n'), ((493, 523), 'winreg.CreateKey', 'winreg.CreateKey', (['top', 'sub_key'], {}), '(top, sub_key)\n', (509, 523), False, 'import... |
import os
from pyspedas.utilities.dailynames import dailynames
from pyspedas.utilities.download import download
from pyspedas.analysis.time_clip import time_clip as tclip
from pytplot import cdf_to_tplot
from .config import CONFIG
def load(trange=['2018-11-5', '2018-11-6'],
probe=['noaa19'],
instru... | [
"pyspedas.analysis.time_clip.time_clip",
"pytplot.cdf_to_tplot",
"pyspedas.utilities.dailynames.dailynames",
"pyspedas.utilities.download.download"
] | [((1505, 1633), 'pytplot.cdf_to_tplot', 'cdf_to_tplot', (['out_files'], {'suffix': 'suffix', 'merge': '(True)', 'get_support_data': 'get_support_data', 'varformat': 'varformat', 'notplot': 'notplot'}), '(out_files, suffix=suffix, merge=True, get_support_data=\n get_support_data, varformat=varformat, notplot=notplot)... |
import pytest
try:
from unittest import mock
except ImportError:
import mock
from collections import defaultdict, Counter
import itertools
import numpy as np
from openpathsampling.tests.test_helpers import make_1d_traj
from .serialization_helpers import get_uuid, set_uuid
from .storable_functions import *
_... | [
"collections.Counter",
"pytest.skip",
"mock.patch",
"collections.defaultdict",
"mock.NonCallableMock",
"pytest.raises",
"numpy.array",
"itertools.product",
"pytest.mark.parametrize",
"mock.MagicMock",
"openpathsampling.tests.test_helpers.make_1d_traj"
] | [((1438, 1630), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""array_input,expected"""', '[([[1], [2], [3]], [1, 2, 3]), ([1, 2, 3], [1, 2, 3]), ([[1, 2], [3, 4]], [\n [1, 2], [3, 4]]), ([[[1, 2]], [[3, 4]]], [[1, 2], [3, 4]])]'], {}), "('array_input,expected', [([[1], [2], [3]], [1, 2, 3\n ]), ([1, ... |
# -*- encoding: utf-8 -*-
#
# Copyright © 2018–2020 Mergify SAS
#
# 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 appl... | [
"mergify_engine.rules.PullRequestRuleCondition",
"mergify_engine.rules.PullRequestRules.from_list",
"mergify_engine.context.Context",
"unittest.mock.Mock",
"pytest.raises",
"mergify_engine.rules.UserConfigurationSchema",
"pytest.mark.parametrize",
"mergify_engine.rules.InvalidRules",
"mergify_engine... | [((989, 1172), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""valid"""', "({'name': 'hello', 'conditions': ['head:master'], 'actions': {}}, {'name':\n 'hello', 'conditions': ['base:foo', 'base:baz'], 'actions': {}})"], {}), "('valid', ({'name': 'hello', 'conditions': [\n 'head:master'], 'actions': {}... |
import pytest
from model_mommy import mommy
from talentmap_api.language.models import Qualification
@pytest.fixture
def test_language_model_fixture():
# Create a specific language, and set of proficiency, and qualification
mommy.make('language.Language', code="DE", long_description="German", short_descripti... | [
"model_mommy.mommy.make",
"pytest.mark.usefixtures",
"talentmap_api.language.models.Qualification.get_or_create_by_codes",
"pytest.mark.django_db"
] | [((432, 455), 'pytest.mark.django_db', 'pytest.mark.django_db', ([], {}), '()\n', (453, 455), False, 'import pytest\n'), ((825, 848), 'pytest.mark.django_db', 'pytest.mark.django_db', ([], {}), '()\n', (846, 848), False, 'import pytest\n'), ((850, 904), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""test_l... |
import csv
with open('TheCure_Discography.csv') as f:
f_csv = csv.reader(f, delimiter=';')
headers = next(f_csv)
for row in filter(
lambda l: "Fiction Records" in l[1] and 1980 <= int(l[2]) <= 1989,
f_csv
):
print(row)
| [
"csv.reader"
] | [((66, 94), 'csv.reader', 'csv.reader', (['f'], {'delimiter': '""";"""'}), "(f, delimiter=';')\n", (76, 94), False, 'import csv\n')] |
import torch
import torch.nn as nn
import misc.utils as utils
from misc.rewards import init_scorer, get_self_critical_reward
import torch.nn.functional as F
class LossWrapper(torch.nn.Module):
def __init__(self, model, opt):
super(LossWrapper, self).__init__()
self.opt = opt
self.model = m... | [
"torch.nn.BCELoss",
"torch.stack",
"torch.nn.LogSoftmax",
"misc.utils.LanguageModelCriterion",
"torch.nn.KLDivLoss",
"torch.norm",
"misc.rewards.get_self_critical_reward",
"misc.utils.LabelSmoothing",
"torch.no_grad",
"misc.utils.RewardCriterion",
"torch.from_numpy"
] | [((529, 552), 'misc.utils.RewardCriterion', 'utils.RewardCriterion', ([], {}), '()\n', (550, 552), True, 'import misc.utils as utils\n'), ((585, 597), 'torch.nn.BCELoss', 'nn.BCELoss', ([], {}), '()\n', (595, 597), True, 'import torch.nn as nn\n'), ((616, 645), 'torch.nn.KLDivLoss', 'nn.KLDivLoss', ([], {'reduction': '... |
from __future__ import print_function
import pathlib
from builtins import object
from builtins import str
from typing import Dict
from empire.server.common import helpers
from empire.server.common.module_models import PydanticModule
from empire.server.utils import data_util
from empire.server.utils.module_util import... | [
"empire.server.utils.data_util.keyword_obfuscation",
"empire.server.utils.data_util.obfuscate",
"pathlib.Path",
"empire.server.utils.module_util.handle_error_message",
"builtins.str"
] | [((4198, 4235), 'empire.server.utils.data_util.keyword_obfuscation', 'data_util.keyword_obfuscation', (['script'], {}), '(script)\n', (4227, 4235), False, 'from empire.server.utils import data_util\n'), ((1274, 1401), 'empire.server.utils.data_util.obfuscate', 'data_util.obfuscate', ([], {'installPath': 'main_menu.inst... |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the ZMQ notification interface."""
import configparser
import os
import struct
from test_framewor... | [
"test_framework.test_framework.SkipTest",
"test_framework.mininode.CTransaction",
"test_framework.util.bytes_to_hex_str",
"io.BytesIO",
"test_framework.util.hash256",
"os.path.dirname",
"struct.unpack",
"configparser.ConfigParser",
"test_framework.util.assert_equal",
"zmq.Context"
] | [((981, 1012), 'test_framework.util.assert_equal', 'assert_equal', (['topic', 'self.topic'], {}), '(topic, self.topic)\n', (993, 1012), False, 'from test_framework.util import assert_equal, bytes_to_hex_str, hash256\n'), ((1575, 1602), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (1600, 1... |
'''
Manage command to export intervention data for use by others.
Generates a CSV and JSON file with details for all interventions
documented in the database.
Takes an optional argument to specify the output directory. Otherwise,
files are created in the current directory.
'''
import codecs
from collections import... | [
"json.dump",
"csv.DictWriter",
"derrida.interventions.models.Intervention.objects.all",
"collections.OrderedDict",
"codecs.BOM_UTF8.decode"
] | [((1883, 1918), 'json.dump', 'json.dump', (['data', 'jsonfile'], {'indent': '(2)'}), '(data, jsonfile, indent=2)\n', (1892, 1918), False, 'import json\n'), ((2170, 2221), 'csv.DictWriter', 'csv.DictWriter', (['csvfile'], {'fieldnames': 'self.csv_fields'}), '(csvfile, fieldnames=self.csv_fields)\n', (2184, 2221), False,... |
# -*- coding: utf-8 -*-
"""
Functions to calculate the color of a multilayer thin film under reflected
light. A perfect mirror will look white, because we imagine seeing the white
light source ("illuminant") reflected in it. A half-reflective mirror will be
gray, a non-reflective surface will be black, etc. See tmm.exa... | [
"colorpy.ciexyz.xyz_from_spectrum",
"numpy.all",
"colorpy.plots.spectrum_plot",
"numpy.array",
"numpy.arange",
"colorpy.colormodels.irgb_from_rgb",
"colorpy.colormodels.rgb_from_xyz"
] | [((2541, 2557), 'numpy.arange', 'arange', (['(360)', '(831)'], {}), '(360, 831)\n', (2547, 2557), False, 'from numpy import arange, array\n'), ((3416, 3435), 'numpy.array', 'array', (['final_answer'], {}), '(final_answer)\n', (3421, 3435), False, 'from numpy import arange, array\n'), ((4564, 4583), 'numpy.array', 'arra... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"os.path.expanduser",
"os.makedirs",
"json.loads",
"os.path.dirname",
"os.environ.copy",
"e2e.workspace_dir",
"downloads.download_url",
"os.environ.get",
"datetime.datetime.utcnow",
"downloads.expand_tar",
"downloads.exec",
"os.path.join"
] | [((684, 710), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (708, 710), False, 'import datetime\n'), ((955, 987), 'os.path.join', 'os.path.join', (['scratch_dir', '"""bin"""'], {}), "(scratch_dir, 'bin')\n", (967, 987), False, 'import os\n'), ((992, 1027), 'os.makedirs', 'os.makedirs', (['bi... |
# Generated by Django 3.1.1 on 2020-09-17 18:40
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Fixture',... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((365, 458), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (381, 458), False, 'from django.db import migrations, models\... |
import enum
import json
import time
import typing as t
import structlog
from django.conf import settings
from django.core.serializers.json import DjangoJSONEncoder
from django.urls import reverse
from google.cloud.tasks_v2 import CloudTasksClient
log = structlog.get_logger()
registry = {}
schedule_registry = {}
cla... | [
"json.dumps",
"time.time",
"django.urls.reverse",
"google.cloud.tasks_v2.CloudTasksClient",
"structlog.get_logger"
] | [((255, 277), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (275, 277), False, 'import structlog\n'), ((3092, 3103), 'time.time', 'time.time', ([], {}), '()\n', (3101, 3103), False, 'import time\n'), ((725, 743), 'google.cloud.tasks_v2.CloudTasksClient', 'CloudTasksClient', ([], {}), '()\n', (741, 7... |
# Copyright (C) 2001 Python Software Foundation
# Author: <EMAIL> (<NAME>)
"""Module containing encoding functions for Image.Image and Text.Text.
"""
import base64
from quopri import encodestring as _encodestring
# Helpers
def _qencode(s):
return _encodestring(s, quotetabs=1)
def _bencode(s):
# We can't... | [
"base64.encodestring",
"quopri.encodestring"
] | [((257, 286), 'quopri.encodestring', '_encodestring', (['s'], {'quotetabs': '(1)'}), '(s, quotetabs=1)\n', (270, 286), True, 'from quopri import encodestring as _encodestring\n'), ((483, 505), 'base64.encodestring', 'base64.encodestring', (['s'], {}), '(s)\n', (502, 505), False, 'import base64\n')] |
# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
# Copyright (c) 2014 TrilioData, Inc
# Copyright (c) 2015 EMC Corporation
# Copyright (C) 2015 <NAME> <<EMAIL>>
# Copyright (C) 2015 <NAME> <<EMAIL>>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | [
"oslo_log.log.getLogger",
"os.fsync",
"json.dumps",
"six.add_metaclass",
"cinder.openstack.common.loopingcall.FixedIntervalLoopingCall",
"cinder.i18n._LW",
"cinder.i18n._LI",
"cinder.exception.InvalidBackup",
"cinder.exception.InvalidVolume",
"cinder.i18n._LE",
"json.loads",
"cinder.volume.uti... | [((1312, 1339), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1329, 1339), True, 'from oslo_log import log as logging\n'), ((1583, 1613), 'six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (1600, 1613), False, 'import six\n'), ((1376, 1487), 'oslo_c... |
# Copyright 2014-2015 The Alive authors.
#
# 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 ... | [
"sys.stdin.read",
"asdl.lang.alive_lang.alive.parser.parse_opt_file",
"itertools.count",
"collections.defaultdict",
"pprint.pprint",
"re.sub"
] | [((17353, 17370), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (17364, 17370), False, 'from collections import defaultdict\n'), ((18399, 18415), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (18413, 18415), False, 'import argparse, glob, re, sys\n'), ((2963, 2979), 'collections.defaultd... |
#!/usr/bin/env python
import sys
import os
import numpy as np
from BaseDriver import LabberDriver, Error
sys.path.append('C:\\Program Files (x86)\\Keysight\\SD1\\Libraries\\Python')
import keysightSD1
class Driver(LabberDriver):
"""Keysigh PXI HVI trigger"""
def performOpen(self, options={}):
"""Perf... | [
"sys.path.append",
"BaseDriver.Error",
"keysightSD1.SD_Module.getProductNameByIndex",
"keysightSD1.SD_Module.getSlotByIndex",
"os.path.realpath",
"keysightSD1.SD_Module.moduleCount",
"keysightSD1.SD_HVI",
"keysightSD1.SD_Module.getChassisByIndex",
"numpy.array",
"os.path.join",
"keysightSD1.SD_E... | [((105, 181), 'sys.path.append', 'sys.path.append', (['"""C:\\\\Program Files (x86)\\\\Keysight\\\\SD1\\\\Libraries\\\\Python"""'], {}), "('C:\\\\Program Files (x86)\\\\Keysight\\\\SD1\\\\Libraries\\\\Python')\n", (120, 181), False, 'import sys\n'), ((585, 620), 'keysightSD1.SD_Module.moduleCount', 'keysightSD1.SD_Modu... |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"dataclasses.field",
"dataclasses.asdict"
] | [((1877, 1916), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (1894, 1916), False, 'import dataclasses\n'), ((1968, 2010), 'dataclasses.field', 'dataclasses.field', ([], {'default_factory': 'Version'}), '(default_factory=Version)\n', (1985, 2010), False, 'impor... |
#!/usr/bin/env python3
"""
PREREQUISITE: For document migration to work you'll need AWS credentials set up for the relevant environment:
Save your aws_access_key_id and aws_secret_access_key in ~/.aws/credentials
If you have more than one set of credentials in there then be sure to set your ... | [
"random.randint",
"docopt.docopt",
"dmscripts.helpers.auth_helpers.get_auth_token",
"sys.path.insert",
"dmutils.env_helpers.get_api_endpoint_from_stage",
"backoff.on_exception",
"re.escape",
"datetime.datetime.now",
"dmscripts.helpers.framework_helpers.find_suppliers_on_framework",
"collections.Co... | [((1887, 1910), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""."""'], {}), "(0, '.')\n", (1902, 1910), False, 'import sys\n'), ((4385, 4449), 'backoff.on_exception', 'backoff.on_exception', (['backoff.expo', 'S3ResponseError'], {'max_tries': '(5)'}), '(backoff.expo, S3ResponseError, max_tries=5)\n', (4405, 4449), ... |
"""package setup"""
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
class PyTest(TestCommand):
"""Our test runner."""
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.... | [
"pytest.main",
"setuptools.command.test.test.finalize_options",
"sys.exit",
"setuptools.command.test.test.initialize_options",
"setuptools.find_packages"
] | [((308, 344), 'setuptools.command.test.test.initialize_options', 'TestCommand.initialize_options', (['self'], {}), '(self)\n', (338, 344), True, 'from setuptools.command.test import test as TestCommand\n'), ((455, 489), 'setuptools.command.test.test.finalize_options', 'TestCommand.finalize_options', (['self'], {}), '(s... |
"""
.. module: dispatch.plugins.dispatch_opsgenie.plugin
:platform: Unix
:copyright: (c) 2019 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
"""
import logging
from pydantic import Field, SecretStr
from dispatch.config import BaseConfigurationModel
from dispatch.deco... | [
"pydantic.Field",
"dispatch.decorators.apply",
"logging.getLogger"
] | [((481, 508), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (498, 508), False, 'import logging\n'), ((742, 778), 'dispatch.decorators.apply', 'apply', (['counter'], {'exclude': "['__init__']"}), "(counter, exclude=['__init__'])\n", (747, 778), False, 'from dispatch.decorators import appl... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 16 20:23:01 2020
@author: wantysal
"""
# Standard library imports
import numpy as np
# Mosqito functions import
from mosqito.sq_metrics.tonality.tone_to_noise_ecma._spectrum_smoothing import _spectrum_smoothing
from mosqito.sq_metrics.tonality.tone_to_noise_ecma._LTH imp... | [
"mosqito.sq_metrics.tonality.tone_to_noise_ecma._critical_band._critical_band",
"mosqito.sq_metrics.tonality.tone_to_noise_ecma._LTH._LTH",
"numpy.asarray",
"numpy.append",
"numpy.where",
"numpy.arange",
"numpy.diff",
"mosqito.sq_metrics.tonality.tone_to_noise_ecma._spectrum_smoothing._spectrum_smooth... | [((5967, 5998), 'numpy.asarray', 'np.asarray', (['tones'], {'dtype': 'object'}), '(tones, dtype=object)\n', (5977, 5998), True, 'import numpy as np\n'), ((1765, 1834), 'mosqito.sq_metrics.tonality.tone_to_noise_ecma._spectrum_smoothing._spectrum_smoothing', '_spectrum_smoothing', (['freqs', 'spec_db.T', '(24)', 'low_fr... |
import argparse
import os
from util import util
import torch
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser()
self.initialized = False
def initialize(self):
self.parser.add_argument('--dataroot', type=str, default="/content/DeblurGAN/input_img/", help='path to images (should ha... | [
"torch.cuda.set_device",
"os.path.join",
"argparse.ArgumentParser",
"util.util.mkdirs"
] | [((120, 145), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (143, 145), False, 'import argparse\n'), ((4744, 4797), 'os.path.join', 'os.path.join', (['self.opt.checkpoints_dir', 'self.opt.name'], {}), '(self.opt.checkpoints_dir, self.opt.name)\n', (4756, 4797), False, 'import os\n'), ((4800, 4... |
import pytest
from rentomatic.repository.postgres_objects import Room
from rentomatic.repository import postgresrepo
pytestmark = pytest.mark.integration
def test_repository_list_without_parameters(docker_setup, pg_data, pg_session):
repo = postgresrepo.PostgresRepo(docker_setup['postgres'])
repo_rooms = r... | [
"rentomatic.repository.postgresrepo.PostgresRepo"
] | [((249, 300), 'rentomatic.repository.postgresrepo.PostgresRepo', 'postgresrepo.PostgresRepo', (["docker_setup['postgres']"], {}), "(docker_setup['postgres'])\n", (274, 300), False, 'from rentomatic.repository import postgresrepo\n'), ((521, 572), 'rentomatic.repository.postgresrepo.PostgresRepo', 'postgresrepo.Postgres... |
import pytest
import sqlalchemy as sa
from sqlalchemy.orm import dynamic_loader
from sqlalchemy_utils.observer import observes
@pytest.fixture
def Director(Base):
class Director(Base):
__tablename__ = 'director'
id = sa.Column(sa.Integer, primary_key=True)
name = sa.Column(sa.String)
... | [
"sqlalchemy_utils.observer.observes",
"sqlalchemy.orm.dynamic_loader",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"pytest.mark.usefixtures"
] | [((992, 1033), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""postgresql_dsn"""'], {}), "('postgresql_dsn')\n", (1015, 1033), False, 'import pytest\n'), ((240, 279), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (249, 279), True, 'import ... |
import click
import json
import os
from xdg import XDG_CONFIG_HOME
class InvalidDataDirException(Exception):
pass
def get_data_dir():
if os.environ.get('NLGEVAL_DATA'):
if not os.path.exists(os.environ.get('NLGEVAL_DATA')):
click.secho("NLGEVAL_DATA variable is set but points to non-exist... | [
"json.load",
"os.path.exists",
"os.environ.get",
"click.secho",
"os.path.join"
] | [((148, 178), 'os.environ.get', 'os.environ.get', (['"""NLGEVAL_DATA"""'], {}), "('NLGEVAL_DATA')\n", (162, 178), False, 'import os\n'), ((411, 441), 'os.environ.get', 'os.environ.get', (['"""NLGEVAL_DATA"""'], {}), "('NLGEVAL_DATA')\n", (425, 441), False, 'import os\n'), ((255, 355), 'click.secho', 'click.secho', (['"... |
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule, Scale, bias_init_with_prob
from IPython import embed
INF = 1e8
@HEADS.registe... | [
"torch.stack",
"torch.zeros_like",
"torch.nn.ModuleList",
"torch.sqrt",
"torch.nn.Conv2d",
"mmdet.core.force_fp32",
"torch.cat",
"torch.meshgrid",
"mmdet.core.distance2bbox",
"mmcv.cnn.normal_init",
"torch.arange",
"mmdet.core.multiclass_nms",
"mmdet.core.multi_apply"
] | [((10174, 10239), 'mmdet.core.force_fp32', 'force_fp32', ([], {'apply_to': "('cls_scores', 'bbox_preds', 'centernesses')"}), "(apply_to=('cls_scores', 'bbox_preds', 'centernesses'))\n", (10184, 10239), False, 'from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms\n'), ((13126, 13191), 'mmdet.cor... |
# ==============================================================================
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
'''... | [
"cntk.default_options.default_override_or",
"cntk.default_options.get_default_override",
"cntk.softmax",
"cntk.tanh",
"cntk.initializer.glorot_uniform",
"cntk.element_times",
"cntk.default_options.default_options",
"cntk.sequence.broadcast_as"
] | [((921, 947), 'cntk.default_options.default_override_or', 'default_override_or', (['(False)'], {}), '(False)\n', (940, 947), False, 'from cntk.default_options import default_options, get_default_override, default_override_or\n'), ((994, 1019), 'cntk.default_options.default_override_or', 'default_override_or', (['(True)... |
from setuptools import setup, find_packages
setup(
name='scrapy_selenium',
version='0.0.9',
description='Selenium Middleware for Scrapy that allow for multiple concurrent headless browsers.',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
keywords='scr... | [
"setuptools.find_packages"
] | [((601, 616), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (614, 616), False, 'from setuptools import setup, find_packages\n')] |
import pickle
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
from sklearn.metrics import confusion_matrix, accuracy_score
def pre_processing(X):
pass
# sc = StandardScaler()
... | [
"pandas.DataFrame",
"pickle.dump",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.tree.DecisionTreeClassifier",
"pickle.load",
"sklearn.metrics.confusion_matrix"
] | [((390, 426), 'pandas.read_csv', 'pd.read_csv', (['"""datasets/Diabetes.csv"""'], {}), "('datasets/Diabetes.csv')\n", (401, 426), True, 'import pandas as pd\n'), ((1140, 1199), 'sklearn.tree.DecisionTreeClassifier', 'DecisionTreeClassifier', ([], {'criterion': '"""entropy"""', 'random_state': '(0)'}), "(criterion='entr... |
"""Variable is a one-dimensional discrete and continuous real variable class.
<NAME>, July 2005
"""
# ----------------------------------------------------------------------------
from __future__ import absolute_import, print_function
# PyDSTool imports
from .utils import *
from .common import *
from .c... | [
"six.exec_",
"numpy.asarray",
"copy.copy",
"numpy.isfinite",
"numpy.array",
"numpy.all"
] | [((45847, 45871), 'copy.copy', 'copy.copy', (['self.__dict__'], {}), '(self.__dict__)\n', (45856, 45871), False, 'import copy\n'), ((51884, 51927), 'numpy.array', 'array', (['[vs.indepvararray, vs.coordarray[0]]'], {}), '([vs.indepvararray, vs.coordarray[0]])\n', (51889, 51927), False, 'from numpy import Inf, NaN, isfi... |
import unittest
import numpy
import pytest
import dpnp as cupy
from tests.third_party.cupy import testing
# from cupy.core import _accelerator
@testing.gpu
class TestSearch(unittest.TestCase):
@testing.for_all_dtypes(no_complex=True)
@testing.numpy_cupy_allclose()
def test_argmax_all(self, xp, dtype):
... | [
"tests.third_party.cupy.testing.product",
"tests.third_party.cupy.testing.for_all_dtypes",
"tests.third_party.cupy.testing.parameterize",
"tests.third_party.cupy.testing.for_all_dtypes_combination",
"numpy.empty",
"tests.third_party.cupy.testing.with_requires",
"pytest.raises",
"tests.third_party.cupy... | [((8409, 8713), 'tests.third_party.cupy.testing.parameterize', 'testing.parameterize', (["{'cond_shape': (2, 3, 4), 'x_shape': (2, 3, 4), 'y_shape': (2, 3, 4)}", "{'cond_shape': (4,), 'x_shape': (2, 3, 4), 'y_shape': (2, 3, 4)}", "{'cond_shape': (2, 3, 4), 'x_shape': (2, 3, 4), 'y_shape': (3, 4)}", "{'cond_shape': (3, ... |
"""
Lookup the references given in the `Source` column of a sheet in Glottolog hh.bib or the Grambank bib.
"""
import pathlib
import collections
from termcolor import colored
from cldfcatalog import Catalog
from pygrambank.sheet import Sheet
from pygrambank.cldf import refs
def register(parser):
parser.add_argu... | [
"collections.defaultdict",
"termcolor.colored",
"pygrambank.sheet.Sheet",
"cldfcatalog.Catalog"
] | [((1053, 1082), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (1076, 1082), False, 'import collections\n'), ((1023, 1040), 'pygrambank.sheet.Sheet', 'Sheet', (['args.sheet'], {}), '(args.sheet)\n', (1028, 1040), False, 'from pygrambank.sheet import Sheet\n'), ((1093, 1137), 'termcolo... |
import pytest
from uvicorn.importer import ImportFromStringError, import_from_string
def test_invalid_format() -> None:
with pytest.raises(ImportFromStringError) as exc_info:
import_from_string("example:")
expected = 'Import string "example:" must be in format "<module>:<attribute>".'
assert expe... | [
"pytest.raises",
"uvicorn.importer.import_from_string"
] | [((1091, 1135), 'uvicorn.importer.import_from_string', 'import_from_string', (['"""tempfile:TemporaryFile"""'], {}), "('tempfile:TemporaryFile')\n", (1109, 1135), False, 'from uvicorn.importer import ImportFromStringError, import_from_string\n'), ((1307, 1340), 'uvicorn.importer.import_from_string', 'import_from_string... |
"""
Minimal bitcoin cash transaction stuff for making weird smart contracts
"""
from collections import namedtuple
import struct
import hashlib
from itertools import chain
### Transactions stuff
zero32 = b'\0'*32
SIGHASH_ALL = 1
SIGHASH_NONE = 2
SIGHASH_SINGLE = 3
SIGHASH_FORKID = 0x40
SIGHASH_ANYONECANPAY = 0x80
d... | [
"struct.Struct",
"hashlib.sha256",
"hashlib.new",
"struct.error"
] | [((448, 472), 'hashlib.new', 'hashlib.new', (['"""ripemd160"""'], {}), "('ripemd160')\n", (459, 472), False, 'import hashlib\n'), ((816, 834), 'struct.Struct', 'struct.Struct', (['"""B"""'], {}), "('B')\n", (829, 834), False, 'import struct\n'), ((855, 874), 'struct.Struct', 'struct.Struct', (['"""<H"""'], {}), "('<H')... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2011 <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... | [
"lxml.etree.XML",
"nova.openstack.common.log.getLogger"
] | [((878, 905), 'nova.openstack.common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (895, 905), True, 'from nova.openstack.common import log as logging\n'), ((1262, 1277), 'lxml.etree.XML', 'etree.XML', (['data'], {}), '(data)\n', (1271, 1277), False, 'from lxml import etree\n'), ((1678, 1693)... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
inpt = "()(())"
sol = Solution()
res = sol.longestValidParentheses(inpt)
print(res)
| [
"solution.Solution"
] | [((100, 110), 'solution.Solution', 'Solution', ([], {}), '()\n', (108, 110), False, 'from solution import Solution\n')] |
# -*- coding: utf-8 -*-
# ----------------------------------------------------------------------
# forensic
# ----------------------------------------------------------------------
# Copyright (C) 2007-2018 The NOC Project
# See LICENSE for details
# ---------------------------------------------------------------------... | [
"time.strftime",
"time.time",
"operator.attrgetter",
"six.itervalues",
"collections.namedtuple",
"re.compile"
] | [((572, 638), 'collections.namedtuple', 'namedtuple', (['"""SpanData"""', "['ts', 'id', 'server', 'service', 'label']"], {}), "('SpanData', ['ts', 'id', 'server', 'service', 'label'])\n", (582, 638), False, 'from collections import namedtuple\n'), ((683, 832), 're.compile', 're.compile', (['"""(\\\\d{4}-\\\\d{2}-\\\\d{... |
from __future__ import absolute_import
from copy import deepcopy
import sentry_sdk
from sentry import nodestore
from sentry.snuba.events import Columns
from sentry.utils.services import Service
from .models import Event
class Filter(object):
"""
A set of conditions, start/end times and project, group and ... | [
"sentry_sdk.start_span",
"copy.deepcopy",
"sentry.nodestore.get_multi"
] | [((2786, 2800), 'copy.deepcopy', 'deepcopy', (['self'], {}), '(self)\n', (2794, 2800), False, 'from copy import deepcopy\n'), ((7527, 7581), 'sentry_sdk.start_span', 'sentry_sdk.start_span', ([], {'op': '"""eventstore.base.bind_nodes"""'}), "(op='eventstore.base.bind_nodes')\n", (7548, 7581), False, 'import sentry_sdk\... |
"""This is a decorator to show the time cost by the function"""
from functools import wraps
from time import time
def count_time(func):
"""print run time calculation"""
@wraps(func)
def count(*args, **kwargs):
"""record the time of both start and end,
print the cost time after finishing t... | [
"functools.wraps",
"time.time"
] | [((181, 192), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (186, 192), False, 'from functools import wraps\n'), ((356, 362), 'time.time', 'time', ([], {}), '()\n', (360, 362), False, 'from time import time\n'), ((418, 424), 'time.time', 'time', ([], {}), '()\n', (422, 424), False, 'from time import time\n')] |
# Copyright 2021 Huawei Technologies Co., Ltd.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 ap... | [
"mindconverter.graph_based_converter.mapper.base.AtenToMindSporeMapper._generate_snippet_template",
"mindconverter.graph_based_converter.common.utils.reset_template_and_exchange_msg"
] | [((1924, 1982), 'mindconverter.graph_based_converter.mapper.base.AtenToMindSporeMapper._generate_snippet_template', 'AtenToMindSporeMapper._generate_snippet_template', ([], {}), '(**kwargs)\n', (1972, 1982), False, 'from mindconverter.graph_based_converter.mapper.base import AtenToMindSporeMapper\n'), ((3729, 3908), 'm... |