code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
#!/usr/bin/env python3
import argparse
import io
import os
import os.path
from PIL import Image
def read_pages(fname):
with io.open(fname, "r", encoding="utf-8") as f:
for line in f:
yield line.strip().split(".tif")[0]
raise StopIteration
def read_boxes(fname, w, h):
with io.open(fn... | [
"os.makedirs",
"os.path.join",
"argparse.ArgumentParser",
"io.open"
] | [((969, 994), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (992, 994), False, 'import argparse\n'), ((1346, 1389), 'os.makedirs', 'os.makedirs', (['args.output_dir'], {'exist_ok': '(True)'}), '(args.output_dir, exist_ok=True)\n', (1357, 1389), False, 'import os\n'), ((131, 168), 'io.open', 'i... |
from math import floor, log
from ..die_roll import die_roll
class Word:
def __init__(self, wordlist):
self.word = None
self.wordlist_key = None
wordlist_length = len(wordlist)
roll_count = floor(log(wordlist_length, 6))
word_key_list = [str(die_roll()) for i in range(roll... | [
"math.log"
] | [((235, 258), 'math.log', 'log', (['wordlist_length', '(6)'], {}), '(wordlist_length, 6)\n', (238, 258), False, 'from math import floor, log\n')] |
from flexx import ui
class Example(ui.Widget):
def init(self):
with ui.BoxLayout(orientation='v'):
ui.Label(text='Flex 0 0 0')
with ui.HBox(flex=0):
self.b1 = ui.Button(text='Hola', flex=0)
self.b2 = ui.Button(text='Hello world', flex=0)
... | [
"flexx.ui.Button",
"flexx.ui.Widget",
"flexx.ui.BoxLayout",
"flexx.ui.Label",
"flexx.ui.HBox"
] | [((81, 110), 'flexx.ui.BoxLayout', 'ui.BoxLayout', ([], {'orientation': '"""v"""'}), "(orientation='v')\n", (93, 110), False, 'from flexx import ui\n'), ((125, 152), 'flexx.ui.Label', 'ui.Label', ([], {'text': '"""Flex 0 0 0"""'}), "(text='Flex 0 0 0')\n", (133, 152), False, 'from flexx import ui\n'), ((381, 408), 'fle... |
import multiprocessing as mp
import time
from ucp._libs import ucx_api
from ucp._libs.arr import Array
mp = mp.get_context("spawn")
def blocking_handler(request, exception, finished):
assert exception is None
finished[0] = True
def blocking_send(worker, ep, msg, tag=0):
msg = Array(msg)
finished =... | [
"ucp._libs.arr.Array",
"ucp._libs.ucx_api.tag_recv_nb",
"time.sleep",
"multiprocessing.get_context",
"ucp._libs.ucx_api.tag_send_nb"
] | [((110, 133), 'multiprocessing.get_context', 'mp.get_context', (['"""spawn"""'], {}), "('spawn')\n", (124, 133), True, 'import multiprocessing as mp\n'), ((295, 305), 'ucp._libs.arr.Array', 'Array', (['msg'], {}), '(msg)\n', (300, 305), False, 'from ucp._libs.arr import Array\n'), ((339, 439), 'ucp._libs.ucx_api.tag_se... |
def product(x, y):
return (x * y);
def main():
return product(0,42);
if __name__ == '__main__':
try:
import sys
sys.exit(main())
except NameError:
sys.exit(0)
| [
"sys.exit"
] | [((190, 201), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (198, 201), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
import collections
import datetime
import logging
import os
import re
import subprocess
import tarfile
import tempfile
GitRef = collections.namedtuple(
"VersionRef",
[
"name",
"commit",
"source",
"is_remote",
"refname",
"creatordate",
... | [
"subprocess.run",
"tarfile.TarFile",
"subprocess.check_call",
"logging.basicConfig",
"subprocess.check_output",
"re.match",
"tempfile.SpooledTemporaryFile",
"os.environ.get",
"datetime.datetime.strptime",
"collections.namedtuple",
"logging.getLogger"
] | [((153, 262), 'collections.namedtuple', 'collections.namedtuple', (['"""VersionRef"""', "['name', 'commit', 'source', 'is_remote', 'refname', 'creatordate']"], {}), "('VersionRef', ['name', 'commit', 'source',\n 'is_remote', 'refname', 'creatordate'])\n", (175, 262), False, 'import collections\n'), ((393, 425), 'log... |
from datetime import datetime
from sqlalchemy import (
Column,
ForeignKey,
String,
Integer,
)
from .schema_base import SchemaBase
EPOCH_TIME = datetime(1970, 1, 1)
def days_since_epoch():
delta = datetime.now() - EPOCH_TIME
return delta.days
class Password(SchemaBase):
DEFAULT_PASSWD,... | [
"sqlalchemy.ForeignKey",
"datetime.datetime",
"sqlalchemy.Column",
"sqlalchemy.String",
"datetime.datetime.now"
] | [((161, 181), 'datetime.datetime', 'datetime', (['(1970)', '(1)', '(1)'], {}), '(1970, 1, 1)\n', (169, 181), False, 'from datetime import datetime\n'), ((657, 714), 'sqlalchemy.Column', 'Column', (['Integer'], {'default': 'days_since_epoch', 'nullable': '(False)'}), '(Integer, default=days_since_epoch, nullable=False)\... |
"""Database model for Job Root table"""
from config import db
class JobRoot(db.Model):
__tablename__ = "job_roots"
id = db.Column(db.Integer, primary_key=True)
root_domain = db.Column(db.String(200), nullable=False, server_default="")
job_source_id = db.Column(
db.Integer, db.ForeignKey('job_... | [
"config.db.String",
"config.db.ForeignKey",
"config.db.Column"
] | [((131, 170), 'config.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (140, 170), False, 'from config import db\n'), ((199, 213), 'config.db.String', 'db.String', (['(200)'], {}), '(200)\n', (208, 213), False, 'from config import db\n'), ((301, 332), 'config.db.... |
from chemreps.bagger import BagMaker
from chemreps.bat import bat
import numpy as np
import pytest as pt
from collections import OrderedDict
def test_bat():
bags_true = OrderedDict([('C', 16), ('CC', 120), ('CCC', 11), ('CCCC', 8), ('CCCH', 25), ('CCCN', 4),
('CCCO', 5), ('CCCS', 2), ... | [
"numpy.abs",
"chemreps.bagger.BagMaker",
"pytest.raises",
"numpy.array",
"collections.OrderedDict",
"chemreps.bat.bat"
] | [((175, 1054), 'collections.OrderedDict', 'OrderedDict', (["[('C', 16), ('CC', 120), ('CCC', 11), ('CCCC', 8), ('CCCH', 25), ('CCCN', 4\n ), ('CCCO', 5), ('CCCS', 2), ('CCH', 23), ('CCN', 7), ('CCNC', 4), (\n 'CCNH', 3), ('CCO', 7), ('CCOC', 1), ('CCOH', 1), ('CCS', 4), ('CH', \n 288), ('CNC', 4), ('CNCC', 7),... |
from django.db import models
class Profile(models.Model):
telegram_user_id = models.CharField(primary_key=True, max_length=250)
telegram_username = models.CharField(max_length=250, db_index=True)
telegram_name = models.CharField(max_length=250)
clubhouse_user_id = models.CharField(max_length=250, db_... | [
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((83, 133), 'django.db.models.CharField', 'models.CharField', ([], {'primary_key': '(True)', 'max_length': '(250)'}), '(primary_key=True, max_length=250)\n', (99, 133), False, 'from django.db import models\n'), ((158, 205), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)', 'db_index': '(Tr... |
import unittest
try:
# Python 2
from StringIO import StringIO
except ImportError:
# Python 3
from io import StringIO
from asynchronousfilereader import AsynchronousFileReader
class AsynchronousFileReaderTest(unittest.TestCase):
def test_simple(self):
file = StringIO('line1\nline2\n')
... | [
"unittest.main",
"asynchronousfilereader.AsynchronousFileReader",
"io.StringIO"
] | [((605, 620), 'unittest.main', 'unittest.main', ([], {}), '()\n', (618, 620), False, 'import unittest\n'), ((290, 316), 'io.StringIO', 'StringIO', (['"""line1\nline2\n"""'], {}), "('line1\\nline2\\n')\n", (298, 316), False, 'from io import StringIO\n'), ((334, 362), 'asynchronousfilereader.AsynchronousFileReader', 'Asy... |
from xmarievm.runtime.streams.output_stream import OutputStream
def test_output_stream():
stream = OutputStream()
stream.write('hello')
assert stream.buf == ['hello']
| [
"xmarievm.runtime.streams.output_stream.OutputStream"
] | [((105, 119), 'xmarievm.runtime.streams.output_stream.OutputStream', 'OutputStream', ([], {}), '()\n', (117, 119), False, 'from xmarievm.runtime.streams.output_stream import OutputStream\n')] |
import unittest
from reactivex import operators as ops
from reactivex.testing import ReactiveTest, TestScheduler
from reactivex.testing.marbles import marbles_testing
on_next = ReactiveTest.on_next
on_completed = ReactiveTest.on_completed
on_error = ReactiveTest.on_error
subscribe = ReactiveTest.subscribe
subscribed ... | [
"reactivex.testing.TestScheduler",
"reactivex.testing.marbles.marbles_testing",
"reactivex.operators.buffer_toggle",
"reactivex.operators.buffer_when",
"reactivex.operators.buffer"
] | [((503, 518), 'reactivex.testing.TestScheduler', 'TestScheduler', ([], {}), '()\n', (516, 518), False, 'from reactivex.testing import ReactiveTest, TestScheduler\n'), ((1797, 1812), 'reactivex.testing.TestScheduler', 'TestScheduler', ([], {}), '()\n', (1810, 1812), False, 'from reactivex.testing import ReactiveTest, Te... |
import torch, argparse
from pandas import json_normalize
import torch.optim as optim
import numpy as np
import torch.nn as nn
from torch.optim import *
from kme.data.utils import get_loaders, get_loader_dataset
from kme.models.utils import build_kme_net, count_parameters
from torch.utils.tensorboard import SummaryWrite... | [
"torch.distributions.Categorical",
"kme.data.utils.get_loaders",
"argparse.ArgumentParser",
"numpy.argmax",
"torch.cuda.device_count",
"kme.models.utils.count_parameters",
"kme.tools.checkpoint.save_checkpoint",
"kme.tools.config.load_config",
"kme.tools.checkpoint.load_checkpoint",
"kme.tools.tra... | [((1070, 1091), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (1089, 1091), True, 'import torch.nn as nn\n'), ((4720, 4756), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {'reduction': '"""sum"""'}), "(reduction='sum')\n", (4739, 4756), True, 'import torch.nn as nn\n'), ((6094, 6118),... |
import pytest
from mdpants import mdpants
from os import path
from pkg_resources import resource_exists
def test_dist_has_wordlist_txt():
assert resource_exists('mdpants', 'lists/words.txt')
def test_dist_has_wordlist_bin():
assert resource_exists('mdpants', 'lists/words.bin')
def test_dist_has_emoticons_txt():
... | [
"pkg_resources.resource_exists"
] | [((149, 194), 'pkg_resources.resource_exists', 'resource_exists', (['"""mdpants"""', '"""lists/words.txt"""'], {}), "('mdpants', 'lists/words.txt')\n", (164, 194), False, 'from pkg_resources import resource_exists\n'), ((238, 283), 'pkg_resources.resource_exists', 'resource_exists', (['"""mdpants"""', '"""lists/words.b... |
import dash_html_components as html
this_layout = html.Div([html.H1("はじめてのファイル分割", id="h_one", n_clicks=0)])
| [
"dash_html_components.H1"
] | [((61, 107), 'dash_html_components.H1', 'html.H1', (['"""はじめてのファイル分割"""'], {'id': '"""h_one"""', 'n_clicks': '(0)'}), "('はじめてのファイル分割', id='h_one', n_clicks=0)\n", (68, 107), True, 'import dash_html_components as html\n')] |
# @copyright@
# Copyright (c) 2006 - 2018 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
#
# @rocks@
# Copyright (c) 2000 - 2010 The Regents of the University of California
# All rights reserved. Rocks(r) v5.4 www.rocksclusters.org
# ... | [
"subprocess.Popen",
"sys.stdin.read",
"sys.stdin.isatty",
"stack.exception.ArgRequired",
"stack.exception.CommandError"
] | [((1811, 1829), 'sys.stdin.isatty', 'sys.stdin.isatty', ([], {}), '()\n', (1827, 1829), False, 'import sys\n'), ((2018, 2198), 'subprocess.Popen', 'subprocess.Popen', (['"""/opt/stack/bin/stack list host profile chapter=main profile=bash"""'], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE', 'stderr': 'subproc... |
from multiprocessing import Pool, TimeoutError
import time
from tqdm import tqdm
def myf(x):
if x % 5 == 0:
time.sleep(20.2)
else:
time.sleep(0.3)
return x * x
def safely_get(value, timeout=2):
try:
data = value.get(timeout=timeout)
except TimeoutError:
data = 0
... | [
"time.sleep",
"multiprocessing.Pool"
] | [((373, 391), 'multiprocessing.Pool', 'Pool', ([], {'processes': '(10)'}), '(processes=10)\n', (377, 391), False, 'from multiprocessing import Pool, TimeoutError\n'), ((832, 845), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (842, 845), False, 'import time\n'), ((122, 138), 'time.sleep', 'time.sleep', (['(20.2)'... |
import math
from pyemd import emd
from algorithms.distribution_based.column_model import CorrelationClusteringColumn
from algorithms.distribution_based.quantile_histogram import QuantileHistogram
def quantile_emd(column1: CorrelationClusteringColumn, column2: CorrelationClusteringColumn, quantiles: int = 256):
""... | [
"algorithms.distribution_based.quantile_histogram.QuantileHistogram",
"pyemd.emd"
] | [((1100, 1207), 'algorithms.distribution_based.quantile_histogram.QuantileHistogram', 'QuantileHistogram', (['column2.long_name', 'column2.ranks', 'column2.size', 'quantiles'], {'reference_hist': 'histogram1'}), '(column2.long_name, column2.ranks, column2.size, quantiles,\n reference_hist=histogram1)\n', (1117, 1207... |
import math
def int_to_english(num):
ans = ''
if num > 999.999999e9:
raise Exception('Error: too big')
if num < 0:
ans += 'negative '
num *= -1
tri_places = {9: 'billion', 6: 'million', 3: 'thousand'}
tens_places = {9: 'ninety', 8: 'eighty', 7: 'seventy', 6: 'sixty', 5: 'fif... | [
"math.log10"
] | [((1372, 1387), 'math.log10', 'math.log10', (['num'], {}), '(num)\n', (1382, 1387), False, 'import math\n'), ((1532, 1547), 'math.log10', 'math.log10', (['num'], {}), '(num)\n', (1542, 1547), False, 'import math\n'), ((1691, 1706), 'math.log10', 'math.log10', (['num'], {}), '(num)\n', (1701, 1706), False, 'import math\... |
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-28 13:11
from __future__ import absolute_import, print_function, unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('doc... | [
"django.db.models.TextField"
] | [((489, 517), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (505, 517), False, 'from django.db import migrations, models\n'), ((650, 678), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)'}), '(blank=True)\n', (666, 678), False, 'from django.db im... |
import numpy as np
def one_hot(data, n_cols):
data_onehot = np.zeros((data.shape[0], n_cols))
data_onehot[range(data.shape[0]), data.flatten()] = 1.
return data_onehot
def multiclass_loss(Y, Y_hat):
L_sum = np.sum(np.multiply(Y, np.log(Y_hat)))
m = Y.shape[0]
L = -(1/m) * L_sum
return L
| [
"numpy.zeros",
"numpy.log"
] | [((65, 98), 'numpy.zeros', 'np.zeros', (['(data.shape[0], n_cols)'], {}), '((data.shape[0], n_cols))\n', (73, 98), True, 'import numpy as np\n'), ((247, 260), 'numpy.log', 'np.log', (['Y_hat'], {}), '(Y_hat)\n', (253, 260), True, 'import numpy as np\n')] |
# Generated by Django 3.1.6 on 2021-02-17 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('projects', '0002_project_description_short'),
]
operations = [
migrations.AddField(
model_name='project',
name='poin... | [
"django.db.models.IntegerField"
] | [((342, 372), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (361, 372), False, 'from django.db import migrations, models\n')] |
from setuptools_scm import get_version
from skbuild import setup
project_name = "GMatElastoPlasticQPot"
setup(
name=project_name,
description="Elasto-plastic material model.",
long_description="Elasto-plastic material model.",
version=get_version(),
license="MIT",
author="<NAME>",
author_e... | [
"setuptools_scm.get_version"
] | [((253, 266), 'setuptools_scm.get_version', 'get_version', ([], {}), '()\n', (264, 266), False, 'from setuptools_scm import get_version\n')] |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
"subprocess.Popen",
"os.remove",
"argparse.ArgumentParser",
"os.path.basename",
"logging.warning",
"subprocess.check_output",
"os.path.dirname",
"os.path.exists",
"subprocess.list2cmdline",
"subprocess.CalledProcessError",
"logging.info"
] | [((8616, 8678), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Install cert on device."""'}), "(description='Install cert on device.')\n", (8639, 8678), False, 'import argparse\n'), ((1385, 1417), 'os.path.basename', 'os.path.basename', (['self.cert_path'], {}), '(self.cert_path)\n', (14... |
from domino import Domino
import os
domino = Domino("marks/quick-start",
api_key=os.environ['DOMINO_USER_API_KEY'],
host=os.environ['DOMINO_API_HOST'])
new_project_name = "fromapi3"
try:
new_project = domino.project_create("marks", new_project_name)
print(new_project)
except:
... | [
"domino.Domino"
] | [((46, 157), 'domino.Domino', 'Domino', (['"""marks/quick-start"""'], {'api_key': "os.environ['DOMINO_USER_API_KEY']", 'host': "os.environ['DOMINO_API_HOST']"}), "('marks/quick-start', api_key=os.environ['DOMINO_USER_API_KEY'], host\n =os.environ['DOMINO_API_HOST'])\n", (52, 157), False, 'from domino import Domino\n... |
# ------------------------------------------------------------------------------
# CodeHawk Binary Analyzer
# Author: <NAME>
# ------------------------------------------------------------------------------
# The MIT License (MIT)
#
# Copyright (c) 2016-2020 Kestrel Technology LLC
# Copyright (c) 2020 <NAME>
# Copy... | [
"chb.util.fileutil.CHBError"
] | [((2239, 2301), 'chb.util.fileutil.CHBError', 'UF.CHBError', (["('Dll enum value without name in ' + self.typename)"], {}), "('Dll enum value without name in ' + self.typename)\n", (2250, 2301), True, 'import chb.util.fileutil as UF\n'), ((3022, 3081), 'chb.util.fileutil.CHBError', 'UF.CHBError', (["('Dll enum name wit... |
from pyswip import Prolog
from datetime import date
class Engine:
"""
A minimal parser for Multilingual Incomplete & Abbreviated Dates
"""
def __init__(self, context=date.today()):
self.context = context.strftime('date(%Y,%m,%d)')
self.prolog = Prolog()
next(self.prolog.query... | [
"datetime.date.today",
"pyswip.Prolog"
] | [((186, 198), 'datetime.date.today', 'date.today', ([], {}), '()\n', (196, 198), False, 'from datetime import date\n'), ((281, 289), 'pyswip.Prolog', 'Prolog', ([], {}), '()\n', (287, 289), False, 'from pyswip import Prolog\n')] |
"""Command line fluidpythran
============================
Internal API
------------
.. autofunction:: run
.. autofunction:: parse_args
"""
import argparse
from pathlib import Path
from glob import glob
import sys
from . import __version__
from .transpiler import make_pythran_files
from .log import logger
from .py... | [
"pathlib.Path",
"argparse.ArgumentParser",
"sys.exit"
] | [((2274, 2373), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'doc', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=doc, formatter_class=argparse.\n RawDescriptionHelpFormatter)\n', (2297, 2373), False, 'import argparse\n'), ((1372, 1382), 'pathlib.Path', 'Pat... |
#!/usr/bin/env python
from __future__ import with_statement
from __future__ import print_function
from scapy_ssl_tls.ssl_tls import *
import pyperclip
tls_version = TLSVersion.TLS_1_1
def tls_hello(sock):
client_hello = TLSRecord(version=tls_version) / \
TLSHandshake() / \
... | [
"pyperclip.paste"
] | [((2206, 2223), 'pyperclip.paste', 'pyperclip.paste', ([], {}), '()\n', (2221, 2223), False, 'import pyperclip\n')] |
import sys
import os
import math
import random
import numpy as np
# from scipy import misc
from PIL import Image, ImageEnhance
from skimage import transform
import imageio
import cv2
from scipy.ndimage.interpolation import rotate
import scipy.ndimage as nd
import time
# from keras_preprocessing import image as Keras_Im... | [
"cv2.GaussianBlur",
"numpy.abs",
"numpy.ones",
"numpy.clip",
"cv2.fillPoly",
"cv2.warpAffine",
"numpy.mean",
"skimage.transform.resize",
"numpy.arange",
"numpy.random.normal",
"numpy.random.randint",
"numpy.ndarray",
"numpy.pad",
"random.randint",
"cv2.filter2D",
"cv2.dilate",
"numpy... | [((793, 825), 'math.sqrt', 'math.sqrt', (['(v0 * (x - m) ** 2 / v)'], {}), '(v0 * (x - m) ** 2 / v)\n', (802, 825), False, 'import math\n'), ((1383, 1401), 'numpy.zeros', 'np.zeros', (['im.shape'], {}), '(im.shape)\n', (1391, 1401), True, 'import numpy as np\n'), ((1445, 1461), 'numpy.ones_like', 'np.ones_like', (['im'... |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import ... | [
"six.iteritems"
] | [((6290, 6323), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (6303, 6323), False, 'import six\n')] |
from Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi import trackerNumberingGeometry
from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
dd4hep.toModify(trackerNumberingGeometry, fromDDD = False, fromDD4hep = True)
| [
"Configuration.ProcessModifiers.dd4hep_cff.dd4hep.toModify"
] | [((162, 235), 'Configuration.ProcessModifiers.dd4hep_cff.dd4hep.toModify', 'dd4hep.toModify', (['trackerNumberingGeometry'], {'fromDDD': '(False)', 'fromDD4hep': '(True)'}), '(trackerNumberingGeometry, fromDDD=False, fromDD4hep=True)\n', (177, 235), False, 'from Configuration.ProcessModifiers.dd4hep_cff import dd4hep\n... |
import collections
import logging
import multiprocessing
import os
import re
import warnings
import numpy as np
import pandas as pd
import tables
from trafficgraphnn.utils import (E1IterParseWrapper, E2IterParseWrapper,
TLSSwitchIterParseWrapper, _col_dtype_key,
... | [
"trafficgraphnn.utils.pairwise_iterate",
"os.remove",
"pandas.HDFStore",
"trafficgraphnn.utils.TLSSwitchIterParseWrapper",
"trafficgraphnn.utils.E2IterParseWrapper",
"pandas.Interval",
"collections.defaultdict",
"os.path.isfile",
"numpy.arange",
"os.path.join",
"pandas.DataFrame",
"warnings.si... | [((372, 399), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (389, 399), False, 'import logging\n'), ((1584, 1614), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['buffer'], {}), '(buffer)\n', (1606, 1614), True, 'import pandas as pd\n'), ((2433, 2462), 'collections.defaultdict... |
#!/usr/bin/python3
#
# Copyright (c) 2014-2022 The Voxie Authors
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy,... | [
"prototype_helpers.find_json_files",
"codecs.getreader",
"argparse.ArgumentParser",
"prototype_helpers.add_arguments"
] | [((1308, 1333), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1331, 1333), False, 'import argparse\n'), ((1334, 1373), 'prototype_helpers.add_arguments', 'prototype_helpers.add_arguments', (['parser'], {}), '(parser)\n', (1365, 1373), False, 'import prototype_helpers\n'), ((1409, 1448), 'prot... |
from Include.commands.commander import Commander
from Include.commands.new_project import NewProject
from Include.commands.open_project import OpenProject
from Include.commands.close_project import CloseProject
from Include.commands.exit_app import ExitApp
from Include.commands.translator import Translator
class Core... | [
"Include.commands.commander.Commander",
"Include.commands.translator.Translator"
] | [((421, 432), 'Include.commands.commander.Commander', 'Commander', ([], {}), '()\n', (430, 432), False, 'from Include.commands.commander import Commander\n'), ((488, 500), 'Include.commands.translator.Translator', 'Translator', ([], {}), '()\n', (498, 500), False, 'from Include.commands.translator import Translator\n')... |
import json
import logging
import re
from typing import Dict, Optional, Tuple
from urllib.parse import parse_qs, urlparse
from moto.apigateway import models as apigateway_models
from moto.apigateway.exceptions import NoIntegrationDefined, UsagePlanNotFoundException
from moto.apigateway.responses import APIGatewayRespo... | [
"localstack.utils.common.short_uid",
"localstack.utils.common.to_str",
"json.loads",
"moto.apigateway.exceptions.UsagePlanNotFoundException",
"localstack.services.infra.start_moto_server",
"urllib.parse.urlparse",
"localstack.services.apigateway.helpers.apply_json_patch_safe",
"localstack.utils.common... | [((743, 770), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (760, 770), False, 'import logging\n'), ((24549, 24712), 'localstack.services.infra.start_moto_server', 'start_moto_server', ([], {'key': '"""apigateway"""', 'name': '"""API Gateway"""', 'asynchronous': 'asynchronous', 'port': '... |
"""
---> Find K Closest Elements
---> Medium
"""
import bisect
import math
from heapq import *
class Solution:
def findClosestElements(self, arr, k: int, x: int):
heap = []
for ele in arr:
dist = abs(ele - x)
if len(heap) < k:
heappush(heap, (-1 * dist, ... | [
"bisect.bisect_left"
] | [((601, 627), 'bisect.bisect_left', 'bisect.bisect_left', (['arr', 'x'], {}), '(arr, x)\n', (619, 627), False, 'import bisect\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: evgeniy
"""
from HunterMooseCode import Player, GameSimulator
from HunterMooseCodeMonteCarlo import PlayerMC, MCGameSimulator
###################################################################
#### Probability Tree Diagrams simulation
###################... | [
"HunterMooseCode.GameSimulator",
"HunterMooseCode.Player",
"HunterMooseCodeMonteCarlo.PlayerMC",
"HunterMooseCodeMonteCarlo.MCGameSimulator"
] | [((716, 782), 'HunterMooseCode.Player', 'Player', (['"""Hunter"""'], {'current_pos': '(hunter_start - 1)', 'moves': 'hunter_moves'}), "('Hunter', current_pos=hunter_start - 1, moves=hunter_moves)\n", (722, 782), False, 'from HunterMooseCode import Player, GameSimulator\n'), ((812, 901), 'HunterMooseCode.Player', 'Playe... |
import tensorflow.compat.v1.keras.backend as K
import tensorflow
import tensorflow.keras.backend
class TensorGradient(object):
def __init__(self, model):
# See https://stackoverflow.com/questions/54566337/how-to-get-gradient-values-using-tensorflow.keras-backend-gradients
#self.gradients = K.gradie... | [
"tensorflow.Variable",
"tensorflow.GradientTape",
"tensorflow.keras.backend.eval"
] | [((527, 575), 'tensorflow.Variable', 'tensorflow.Variable', (['x'], {'dtype': 'tensorflow.float32'}), '(x, dtype=tensorflow.float32)\n', (546, 575), False, 'import tensorflow\n'), ((791, 841), 'tensorflow.keras.backend.eval', 'tensorflow.keras.backend.eval', (['evaluated_gradients'], {}), '(evaluated_gradients)\n', (82... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>-<NAME>
"""
import numpy as np
def segmentation_blocks(band_pass_signal_hr, sb, sh, dim):
"""Function used for the segmentation of the signal into smaller parts of audio (blocks). This has been implemented
as described in Formula 16 (section 5.1.4) of ECMA... | [
"numpy.zeros"
] | [((4572, 4625), 'numpy.zeros', 'np.zeros', (['(sb, band_pass_signal_hr.ndim)'], {'dtype': 'float'}), '((sb, band_pass_signal_hr.ndim), dtype=float)\n', (4580, 4625), True, 'import numpy as np\n'), ((906, 918), 'numpy.zeros', 'np.zeros', (['sb'], {}), '(sb)\n', (914, 918), True, 'import numpy as np\n'), ((1013, 1031), '... |
#!/usr/bin/env python3
import numpy as np
import env_wrapper
import matplotlib.pyplot as plt
from copy import deepcopy
from gym.envs.registration import register
register(
id='FrozenLakeNotSlippery-v0',
entry_point='gym.envs.toy_text:FrozenLakeEnv',
kwargs={'map_name' : '4x4', 'is_slippery': False},
m... | [
"matplotlib.pyplot.title",
"numpy.random.seed",
"numpy.sum",
"matplotlib.pyplot.clf",
"env_wrapper.make",
"numpy.ones",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.arange",
"env_wrapper.env_wrapper",
"numpy.exp",
"numpy.random.normal",
"numpy.random.randint",
"matplotlib.pyplot.fill_b... | [((164, 355), 'gym.envs.registration.register', 'register', ([], {'id': '"""FrozenLakeNotSlippery-v0"""', 'entry_point': '"""gym.envs.toy_text:FrozenLakeEnv"""', 'kwargs': "{'map_name': '4x4', 'is_slippery': False}", 'max_episode_steps': '(100)', 'reward_threshold': '(0.78)'}), "(id='FrozenLakeNotSlippery-v0', entry_po... |
# -*- coding: utf-8 -*-
"""
test_reader_uspto
~~~~~~~~~~~~~~~~~
Test USPTO reader.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import io
import logging
import os
import unittest
from chemda... | [
"unittest.main",
"logging.basicConfig",
"chemdataextractor.reader.UsptoXmlReader",
"os.path.dirname",
"logging.getLogger"
] | [((406, 446), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (425, 446), False, 'import logging\n'), ((454, 481), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (471, 481), False, 'import logging\n'), ((1646, 1661), 'unittest.mai... |
import unittest
from ..sequence.aligner import Aligner
class TestAlignerModule(unittest.TestCase):
def setUp(self):
self.aligner = Aligner(backend="ambivert")
def tearDown(self):
pass
def test_correct_alignment_insertion(self):
trace = self.aligner.align("ATG", "ACTG")
e... | [
"unittest.main"
] | [((3554, 3569), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3567, 3569), False, 'import unittest\n')] |
from plugin import plugin
import subprocess
@plugin("infob17037")
def infob17037(jarvis, s):
"""Repeats what you type"""
stri0 = "Welcome to the info plugin of ATYANT YADAV roll num B17037."
stri1 = "Please select one of the options below:"
stri2 = "->[F]ull name prints your full name "
stri3... | [
"subprocess.Popen",
"plugin.plugin"
] | [((47, 67), 'plugin.plugin', 'plugin', (['"""infob17037"""'], {}), "('infob17037')\n", (53, 67), False, 'from plugin import plugin\n'), ((1374, 1420), 'subprocess.Popen', 'subprocess.Popen', (['cmd1'], {'stdout': 'subprocess.PIPE'}), '(cmd1, stdout=subprocess.PIPE)\n', (1390, 1420), False, 'import subprocess\n')] |
from common import * # NOQA
from test_shared_volumes import add_storage_pool
def test_inactive_agent(super_client, new_context):
host = super_client.reload(new_context.host)
agent = host.agent()
c = new_context.create_container()
assert c.state == 'running'
agent = super_client.wait_success(age... | [
"test_shared_volumes.add_storage_pool"
] | [((927, 993), 'test_shared_volumes.add_storage_pool', 'add_storage_pool', (['new_context', '[new_context.host.uuid, host2.uuid]'], {}), '(new_context, [new_context.host.uuid, host2.uuid])\n', (943, 993), False, 'from test_shared_volumes import add_storage_pool\n')] |
import os
import sys
import unittest
PROJECT_ROOT = os.path.join(os.path.join(os.path.dirname(__file__), '..'), 'src')
sys.path.insert(0, os.path.abspath(PROJECT_ROOT))
from classes import ParentClassOne, ChildClass
class TestParentClassOne(unittest.TestCase):
def setUp(self):
self.object = ParentClass... | [
"unittest.main",
"os.path.abspath",
"os.path.dirname",
"classes.ParentClassOne"
] | [((139, 168), 'os.path.abspath', 'os.path.abspath', (['PROJECT_ROOT'], {}), '(PROJECT_ROOT)\n', (154, 168), False, 'import os\n'), ((557, 572), 'unittest.main', 'unittest.main', ([], {}), '()\n', (570, 572), False, 'import unittest\n'), ((79, 104), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n... |
# -*- coding: utf-8 -*-
"""The VMDK image path specification resolver helper implementation."""
from dfvfs.file_io import vmdk_file_io
from dfvfs.lib import definitions
from dfvfs.resolver_helpers import manager
from dfvfs.resolver_helpers import resolver_helper
class VMDKResolverHelper(resolver_helper.ResolverHelpe... | [
"dfvfs.file_io.vmdk_file_io.VMDKFile"
] | [((625, 664), 'dfvfs.file_io.vmdk_file_io.VMDKFile', 'vmdk_file_io.VMDKFile', (['resolver_context'], {}), '(resolver_context)\n', (646, 664), False, 'from dfvfs.file_io import vmdk_file_io\n')] |
from profil3r.modules.forum.zeroxzerozerosec import ZeroxZeroZeroSec
from profil3r.modules.forum.jeuxvideo import JeuxVideo
from profil3r.modules.forum.hackernews import Hackernews
from profil3r.modules.forum.crackedto import CrackedTo
from profil3r.modules.forum.lesswrong import LessWrong
# 0x00sec
def zeroxzerozeros... | [
"profil3r.modules.forum.hackernews.Hackernews",
"profil3r.modules.forum.zeroxzerozerosec.ZeroxZeroZeroSec",
"profil3r.modules.forum.crackedto.CrackedTo",
"profil3r.modules.forum.jeuxvideo.JeuxVideo",
"profil3r.modules.forum.lesswrong.LessWrong"
] | [((359, 412), 'profil3r.modules.forum.zeroxzerozerosec.ZeroxZeroZeroSec', 'ZeroxZeroZeroSec', (['self.CONFIG', 'self.permutations_list'], {}), '(self.CONFIG, self.permutations_list)\n', (375, 412), False, 'from profil3r.modules.forum.zeroxzerozerosec import ZeroxZeroZeroSec\n'), ((550, 596), 'profil3r.modules.forum.jeu... |
####################################
# File name: SiteScan_Image_Formatter_Source.py
# About: Embeds Drone Flight CSV GPS Info into Image Metadata/EXIF
# Version for Executable compilation
# Author: <NAME> | Imagery & Remote Sensing Team | Esri
# Date created: 12/12/2019
# Date last modified: 12/13/2... | [
"os.remove",
"piexif.insert",
"csv.reader",
"csv.DictReader",
"os.path.exists",
"os.path.join",
"piexif.dump"
] | [((2689, 2704), 'piexif.dump', 'dump', (['exif_dict'], {}), '(exif_dict)\n', (2693, 2704), False, 'from piexif import dump, insert, GPSIFD\n'), ((2709, 2738), 'piexif.insert', 'insert', (['exif_bytes', 'file_name'], {}), '(exif_bytes, file_name)\n', (2715, 2738), False, 'from piexif import dump, insert, GPSIFD\n'), ((3... |
import re
r_q = re.compile('\\?*')
r_cj = re.compile('([CJ])\\?*([CJ])')
def main():
x, y, s = input().split()
if len(s) < 2:
return 0
x = int(x)
y = int(y)
q = r_q.search(s)
i = q.end()
# collection of all functions for '{first_letter}{last_letter}' with only '?' between
if x + y < 0:
functions = {
... | [
"re.compile"
] | [((17, 35), 're.compile', 're.compile', (['"""\\\\?*"""'], {}), "('\\\\?*')\n", (27, 35), False, 'import re\n'), ((43, 73), 're.compile', 're.compile', (['"""([CJ])\\\\?*([CJ])"""'], {}), "('([CJ])\\\\?*([CJ])')\n", (53, 73), False, 'import re\n')] |
# Generated by Django 3.1.1 on 2020-09-29 08:25
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='address',
fields=[
('id', models.AutoField(... | [
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((303, 396), '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", (319, 396), False, 'from django.db import migrations, models\... |
import tabledata_classification
import mnist_classification
from sklearn.preprocessing import OneHotEncoder
import sklearn
import argparse
import pandas as pd
import json
import numpy as np
import pathlib
import tensorflow as tf
filedir = pathlib.Path(__file__).resolve().parent
parser = argparse.ArgumentParser(descrip... | [
"json.dump",
"json.load",
"argparse.ArgumentParser",
"pandas.read_csv",
"sklearn.preprocessing.OneHotEncoder",
"tensorflow.config.experimental.set_memory_growth",
"pathlib.Path",
"numpy.array",
"tensorflow.config.experimental.list_logical_devices",
"tensorflow.config.experimental.list_physical_dev... | [((289, 335), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""ml task"""'}), "(description='ml task')\n", (312, 335), False, 'import argparse\n'), ((952, 1003), 'tensorflow.config.experimental.list_physical_devices', 'tf.config.experimental.list_physical_devices', (['"""GPU"""'], {}), "('... |
# coding: utf-8
'''This is a simple script to download an NVD CVE feed, extract interesting bits
from the XML and import/update a mongo db - or optionally print it to screen'''
import zipfile
import urllib.request, urllib.error, urllib.parse
import argparse
import io
import xml.etree.ElementTree as ET
import pprint
im... | [
"sys.path.append",
"sys.stdout.write",
"utils.utilsv2.create_connection",
"utils.utilsv2.find_or_create",
"utils.utilsv2.push",
"sys.stdout.flush",
"re.sub"
] | [((386, 411), 'sys.path.append', 'sys.path.append', (['PATRONUS'], {}), '(PATRONUS)\n', (401, 411), False, 'import sys\n'), ((448, 473), 'sys.path.append', 'sys.path.append', (['PATRONUS'], {}), '(PATRONUS)\n', (463, 473), False, 'import sys\n'), ((1659, 1697), 're.sub', 're.sub', (['"""[^\\\\x00-\\\\x7f]"""', '""""""'... |
import collections
import exrsplit.exrsplit as exrsplit
import pytest
import sys
if sys.version_info < (3, 0):
from itertools import izip_longest as zip_longest
else:
from itertools import zip_longest
@pytest.mark.parametrize('header,fullname,expected_view', [
({}, '', None),
({'view': b'camera'}, 'R... | [
"exrsplit.exrsplit.get_view",
"exrsplit.exrsplit._get_layer",
"exrsplit.exrsplit.EXRChannel",
"itertools.zip_longest",
"exrsplit.exrsplit.group_channels",
"collections.namedtuple",
"exrsplit.exrsplit._get_channel_type",
"exrsplit.exrsplit.output_file_name",
"pytest.mark.parametrize"
] | [((213, 578), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""header,fullname,expected_view"""', "[({}, '', None), ({'view': b'camera'}, 'R', b'camera'), ({'multiView': [\n b'left', b'right']}, 'R', b'left'), ({'multiView': [b'left', b'right']},\n 'car.R', b'left'), ({'multiView': [b'left', b'right']}... |
#!/usr/bin/env python
from __future__ import division
from minau.msg import ControlStatus
from minau.srv import ArmControl, DisarmControl, SetHeadingDepth, SetHeadingVelocity
import rospy
import numpy as np
from geometry_msgs.msg import Vector3
def set_head_depth(heading, depth, setpoint_thresh):
rospy.loginfo("Se... | [
"rospy.logwarn",
"rospy.get_namespace",
"geometry_msgs.msg.Vector3",
"numpy.arctan2",
"rospy.wait_for_message",
"rospy.ServiceProxy",
"rospy.sleep",
"rospy.get_param",
"rospy.loginfo",
"rospy.is_shutdown",
"numpy.sin",
"numpy.linalg.norm",
"rospy.init_node",
"numpy.cos",
"rospy.wait_for_... | [((2751, 2782), 'rospy.init_node', 'rospy.init_node', (['"""planner_node"""'], {}), "('planner_node')\n", (2766, 2782), False, 'import rospy\n'), ((2788, 2809), 'rospy.get_namespace', 'rospy.get_namespace', ([], {}), '()\n', (2807, 2809), False, 'import rospy\n'), ((2811, 2883), 'rospy.logwarn', 'rospy.logwarn', (["('W... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Tigera, Inc. 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 re... | [
"calico.felix.labels.LabelInheritanceIndex",
"calico.felix.selectors.parse_selector",
"logging.getLogger"
] | [((972, 999), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (989, 999), False, 'import logging\n'), ((8583, 8616), 'calico.felix.labels.LabelInheritanceIndex', 'LabelInheritanceIndex', (['self.index'], {}), '(self.index)\n', (8604, 8616), False, 'from calico.felix.labels import LinearSca... |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import osmnx as ox
import networkx as nx
from analogistics.chart.chart_3D_surface import createFigureWith3Dsurface
from analogistics.supply_chain.P8_performance_assessment.utilities_movements import getCov... | [
"matplotlib.pyplot.title",
"numpy.abs",
"analogistics.chart.chart_3D_surface.createFigureWith3Dsurface",
"analogistics.supply_chain.P8_performance_assessment.utilities_movements.getCoverageStats",
"sklearn.mixture.GaussianMixture",
"matplotlib.pyplot.figure",
"numpy.mean",
"numpy.sin",
"numpy.interp... | [((9154, 9225), 'analogistics.supply_chain.P8_performance_assessment.utilities_movements.getCoverageStats', 'getCoverageStats', (['D_mov', 'analysisFieldList'], {'capacityField': 'capacityField'}), '(D_mov, analysisFieldList, capacityField=capacityField)\n', (9170, 9225), False, 'from analogistics.supply_chain.P8_perfo... |
# -*- coding: utf-8 -*-
"""
tests.unit.utils.processes.bases.test_processresult
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test saltfactories.utils.processes.bases.ProcessResult
"""
import textwrap
import pytest
from saltfactories.utils.processes.bases import ProcessResult
@pytest.mark.parametrize("exitco... | [
"pytest.mark.parametrize",
"pytest.raises",
"saltfactories.utils.processes.bases.ProcessResult"
] | [((289, 348), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exitcode"""', "[None, 1.0, -1.0, '0']"], {}), "('exitcode', [None, 1.0, -1.0, '0'])\n", (312, 348), False, 'import pytest\n'), ((598, 637), 'saltfactories.utils.processes.bases.ProcessResult', 'ProcessResult', (['exitcode', 'stdout', 'stderr'], {... |
import blockchain
import flask
from flask import Flask, request, session
from flask_script import Manager, Server, Command, Option
from flask_session import Session
from uuid import uuid4
import json
import requests
import sys
import random
my_blockchain = blockchain.Blockchain()
app = Flask(__name__)
app.debug = T... | [
"flask_script.Manager",
"flask.Flask",
"flask_session.Session",
"flask.session.get",
"json.dumps",
"blockchain.Blockchain",
"blockchain.Block",
"requests.get",
"requests.post",
"flask.request.get_json"
] | [((260, 283), 'blockchain.Blockchain', 'blockchain.Blockchain', ([], {}), '()\n', (281, 283), False, 'import blockchain\n'), ((291, 306), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (296, 306), False, 'from flask import Flask, request, session\n'), ((385, 397), 'flask_session.Session', 'Session', (['app... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"io.BytesIO",
"mindspore.log.debug",
"mindspore.log.warning",
"numpy.isneginf",
"numpy.zeros",
"numpy.ma.masked_invalid",
"mindspore.log.error",
"time.time",
"numpy.isnan",
"socket.gethostname",
"numpy.histogram",
"numpy.max",
"numpy.min",
"PIL.Image.fromarray",
"numpy.isposinf",
"nump... | [((3255, 3275), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (3273, 3275), False, 'import socket\n'), ((3635, 3646), 'time.time', 'time.time', ([], {}), '()\n', (3644, 3646), False, 'import time\n'), ((4016, 4027), 'time.time', 'time.time', ([], {}), '()\n', (4025, 4027), False, 'import time\n'), ((628... |
import multiprocessing
import time
import queue
import sys
import psutil
import logging
logger = logging.getLogger('nanoservice')
class Worker(dict):
pass
class ProcessManager(object):
def __init__(self, CodeManager, num_of_workers, callerpid, parentpid):
logger.info('Initialized ProcessManager o... | [
"psutil.pid_exists",
"logging.getLogger",
"time.time",
"multiprocessing.Process",
"sys.exit"
] | [((99, 131), 'logging.getLogger', 'logging.getLogger', (['"""nanoservice"""'], {}), "('nanoservice')\n", (116, 131), False, 'import logging\n'), ((4175, 4325), 'multiprocessing.Process', 'multiprocessing.Process', ([], {'target': 'self.code', 'name': 'name', 'args': '(self.code_manager, self.trained_model, self.input_q... |
from PyQt5.QtWidgets import QHBoxLayout, QPushButton, QGroupBox, QStyle, qApp
from PyQt5.QtCore import QThread, pyqtSignal, pyqtSlot
from ultimatelabeling.models import KeyboardListener, FrameMode
import time
class PlayerThread(QThread):
FRAME_RATE = 20
def __init__(self, state):
super().__init__()
... | [
"PyQt5.QtWidgets.QHBoxLayout",
"time.sleep",
"PyQt5.QtWidgets.QPushButton"
] | [((1038, 1051), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (1049, 1051), False, 'from PyQt5.QtWidgets import QHBoxLayout, QPushButton, QGroupBox, QStyle, qApp\n'), ((1322, 1335), 'PyQt5.QtWidgets.QPushButton', 'QPushButton', ([], {}), '()\n', (1333, 1335), False, 'from PyQt5.QtWidgets import QHBoxL... |
"""Data schema for Game Rules.
Includes magic constants from game rules.
"""
import collections
GameRules = collections.namedtuple(
"NobleTile", [
# Number of points to win the game.
"points_to_win",
# Max number of gems that can be held by a player.
"max_gems",
# Max number of reserved Devel... | [
"collections.namedtuple"
] | [((111, 336), 'collections.namedtuple', 'collections.namedtuple', (['"""NobleTile"""', "['points_to_win', 'max_gems', 'max_reserved_cards', 'min_double_take_gems',\n 'num_cards_revealed_per_level', 'max_players', 'min_players',\n 'nongold_gem_removals_by_num_players']"], {}), "('NobleTile', ['points_to_win', 'max... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.train.DynamicLossScaleManager",
"mindspore.context.set_context",
"mindspore.ops.composite.clip_by_global_norm",
"mindspore.Model",
"mindspore.ops.operations.Cast",
"mindspore.context.set_auto_parallel_context",
"numpy.ones",
"mindspore.dataset.GeneratorDataset",
"mindspore.nn.wrap.cell_wr... | [((2625, 2697), 'mindspore.dataset.GeneratorDataset', 'ds.GeneratorDataset', (['dataset_generator'], {'column_names': "['inputs', 'label']"}), "(dataset_generator, column_names=['inputs', 'label'])\n", (2644, 2697), True, 'import mindspore.dataset as ds\n'), ((3275, 3319), 'mindspore.context.set_context', 'context.set_... |
import os.path
from data.base_dataset import BaseDataset, get_transform
from data.image_folder import make_dataset
from PIL import Image
import random
import csv
import torch
import numpy as np
class RoadshowDataset(BaseDataset):
"""
This dataset class can load unaligned/unpaired datasets.
It requires two... | [
"data.base_dataset.BaseDataset.__init__",
"csv.DictReader",
"PIL.Image.open",
"data.image_folder.make_dataset",
"torch.zeros",
"data.base_dataset.get_transform"
] | [((879, 910), 'data.base_dataset.BaseDataset.__init__', 'BaseDataset.__init__', (['self', 'opt'], {}), '(self, opt)\n', (899, 910), False, 'from data.base_dataset import BaseDataset, get_transform\n'), ((1902, 1950), 'data.base_dataset.get_transform', 'get_transform', (['self.opt'], {'grayscale': '(input_nc == 1)'}), '... |
from tests.config_data import complex_step, complex_step_alt, complex_steps_merged, echo_step
from valohai_yaml.objs import Config
def test_merging():
a = Config.parse([echo_step])
b = Config.parse([complex_step])
c = a.merge_with(b)
assert len(c.steps) == 2
for step in a.steps.keys() & b.steps.ke... | [
"valohai_yaml.objs.Config.parse"
] | [((161, 186), 'valohai_yaml.objs.Config.parse', 'Config.parse', (['[echo_step]'], {}), '([echo_step])\n', (173, 186), False, 'from valohai_yaml.objs import Config\n'), ((195, 223), 'valohai_yaml.objs.Config.parse', 'Config.parse', (['[complex_step]'], {}), '([complex_step])\n', (207, 223), False, 'from valohai_yaml.obj... |
# Copyright The IETF Trust 2019-2020, All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
from ietf.group.factories import RoleFactory
from ietf.utils.mail import empty_outbox, get_payload_text, outbox
from ietf.utils.test_utils import TestCase, reload_db_objects
from .factories import ReviewAssignmentFactory,... | [
"ietf.utils.test_utils.reload_db_objects",
"ietf.utils.mail.empty_outbox",
"datetime.date.today",
"ietf.group.factories.RoleFactory",
"datetime.timedelta",
"ietf.utils.mail.get_payload_text"
] | [((3980, 4001), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (3999, 4001), False, 'import datetime\n'), ((2289, 2318), 'ietf.utils.test_utils.reload_db_objects', 'reload_db_objects', (['review_req'], {}), '(review_req)\n', (2306, 2318), False, 'from ietf.utils.test_utils import TestCase, reload_db_ob... |
from bem import BEMModel, AerofoilDatabase, Blade
def get_test_model(radii=None):
root_length = 1.25
blade = Blade.from_yaml('tests/data/Bladed_demo_a_modified/blade.yaml')
if radii is not None:
x = radii - root_length
blade = blade.resample(x)
db = AerofoilDatabase('tests/data/aerofoil... | [
"bem.Blade.from_yaml",
"bem.BEMModel",
"bem.AerofoilDatabase"
] | [((118, 181), 'bem.Blade.from_yaml', 'Blade.from_yaml', (['"""tests/data/Bladed_demo_a_modified/blade.yaml"""'], {}), "('tests/data/Bladed_demo_a_modified/blade.yaml')\n", (133, 181), False, 'from bem import BEMModel, AerofoilDatabase, Blade\n'), ((283, 327), 'bem.AerofoilDatabase', 'AerofoilDatabase', (['"""tests/data... |
"""
Test ch1/binary_search.py
"""
import unittest
from ch1.binary_search import search
from ch1.binary_search import recursive_search
#sys.path.append(os.path.dirname(__file__)+"/../")
# print(__file__)
class TestBinarySearch(unittest.TestCase):
"""
Test binary_search
"""
def test_search(self):
... | [
"ch1.binary_search.recursive_search",
"ch1.binary_search.search"
] | [((393, 419), 'ch1.binary_search.search', 'search', (['(5)', '[1, 2, 3, 5, 9]'], {}), '(5, [1, 2, 3, 5, 9])\n', (399, 419), False, 'from ch1.binary_search import search\n'), ((449, 475), 'ch1.binary_search.search', 'search', (['(9)', '[1, 2, 3, 5, 9]'], {}), '(9, [1, 2, 3, 5, 9])\n', (455, 475), False, 'from ch1.binary... |
import numpy as np
import numpy.testing as npt
import pytest
from typing import List
from itertools import product, permutations
from quara.objects import matrix_basis
from quara.objects.matrix_basis import (
get_normalized_pauli_basis,
)
from quara.objects.elemental_system import ElementalSystem
from quara.objec... | [
"quara.objects.gate_typical.calc_hamiltonian_mat_from_gate_name_2qutrit_base_matrices",
"quara.objects.gate_typical.get_gate_names_1qutrit_single_gellmann",
"pytest.mark.parametrize",
"quara.objects.gate_typical.calc_quadrant_from_pauli_symbol",
"quara.objects.gate_typical.generate_unitary_mat_from_gate_nam... | [((4432, 4479), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_qubit"""', '[1, 2, 3]'], {}), "('num_qubit', [1, 2, 3])\n", (4455, 4479), False, 'import pytest\n'), ((5000, 5047), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""num_qubit"""', '[1, 2, 3]'], {}), "('num_qubit', [1, 2, 3])\n", ... |
# Copyright 2015 ETH Zurich
#
# 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, sof... | [
"logging.debug",
"random.shuffle",
"dns.resolver.Resolver",
"logging.log",
"external.expiring_dict.ExpiringDict"
] | [((2316, 2341), 'dns.resolver.Resolver', 'Resolver', ([], {'configure': '(False)'}), '(configure=False)\n', (2324, 2341), False, 'from dns.resolver import Resolver\n'), ((4514, 4528), 'random.shuffle', 'shuffle', (['addrs'], {}), '(addrs)\n', (4521, 4528), False, 'from random import shuffle\n'), ((5116, 5191), 'externa... |
from precise.skaters.managers.managerfactory import static_cov_manager_factory_d0
from precise.skaters.covariance.ewapm import ewa_pm_factory
from precise.skaters.portfoliostatic.schurportfactory import schur_portfolio_factory
from precise.skaters.portfoliostatic.weakportfactory import weak_portfolio_factory
from preci... | [
"functools.partial",
"precise.skaters.managers.managerfactory.static_cov_manager_factory_d0"
] | [((930, 991), 'functools.partial', 'partial', (['ewa_pm_factory'], {'k': '(1)', 'r': 'r', 'target': 'target', 'n_emp': 'n_emp'}), '(ewa_pm_factory, k=1, r=r, target=target, n_emp=n_emp)\n', (937, 991), False, 'from functools import partial\n'), ((1005, 1059), 'functools.partial', 'partial', (['weak_allocation_factory']... |
"""The Tower of Hanoi, by <NAME> <EMAIL>
A stack-moving puzzle game.
This and other games are available at https://nostarch.com/XX
Tags: short, game, puzzle game"""
__version__ = 0
import copy
import sys
TOTAL_DISKS = 5 # More disks means a more difficult puzzle.
# Start with all disks on tower A:
COMPLETE_TOWER = l... | [
"copy.copy",
"sys.exit"
] | [((690, 715), 'copy.copy', 'copy.copy', (['COMPLETE_TOWER'], {}), '(COMPLETE_TOWER)\n', (699, 715), False, 'import copy\n'), ((1318, 1328), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1326, 1328), False, 'import sys\n'), ((1770, 1780), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1778, 1780), False, 'import sys\n')] |
from .common import BeautifulSoup
from requests import Response
import json
class BaseZhihu:
def _gen_soup(self, content):
self.soup = BeautifulSoup(content)
def _get_content(self):
# use _url for question
url = self._url if hasattr(self, '_url') else self.url
if url.endswith(... | [
"requests.Response",
"json.loads"
] | [((1329, 1339), 'requests.Response', 'Response', ([], {}), '()\n', (1337, 1339), False, 'from requests import Response\n'), ((1493, 1512), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1503, 1512), False, 'import json\n')] |
from torchvision import transforms, utils
from torch.utils.data import Dataset, DataLoader
import matplotlib.pyplot as plt
from PIL import Image
import numpy as np
import csv
import os
class Resize(object):
def __init__(self, size, interpolation=Image.BILINEAR):
self.size = size
self.interpolation... | [
"torchvision.transforms.ColorJitter",
"torchvision.transforms.RandomHorizontalFlip",
"PIL.Image.open",
"torchvision.transforms.Normalize",
"torchvision.transforms.Resize",
"torchvision.transforms.ToTensor"
] | [((1093, 1122), 'torchvision.transforms.Resize', 'transforms.Resize', (['(224, 224)'], {}), '((224, 224))\n', (1110, 1122), False, 'from torchvision import transforms, utils\n'), ((1128, 1161), 'torchvision.transforms.RandomHorizontalFlip', 'transforms.RandomHorizontalFlip', ([], {}), '()\n', (1159, 1161), False, 'from... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python
#
# Copyright 2015 <NAME> (<EMAIL>), <NAME> (<EMAIL>)
#
# 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... | [
"spkwifi.get_current_connected_network",
"spkwifi.get_available_networks",
"spkserial.ThreadsafeSerial.get",
"threading.Thread.__init__",
"common.internet_thread.last_job_status.as_dict",
"common.get_parser",
"threading.RLock",
"spkwifi.set_wifi_network",
"cgi.FieldStorage",
"common.internet_threa... | [((1012, 1047), 'common.URL.replace', 'common.URL.replace', (['"""https"""', '"""http"""'], {}), "('https', 'http')\n", (1030, 1047), False, 'import common\n'), ((1145, 1162), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (1160, 1162), False, 'import threading\n'), ((1177, 1194), 'threading.RLock', 'threading... |
#!/usr/bin/env python3
import sys
from varscan_tool import multi_varscan
if __name__ == "__main__":
# CLI Entrypoint.
retcode = 0
try:
retcode = multi_varscan.main()
except Exception as e:
retcode = 1
sys.exit(retcode)
# __END__
| [
"varscan_tool.multi_varscan.main",
"sys.exit"
] | [((242, 259), 'sys.exit', 'sys.exit', (['retcode'], {}), '(retcode)\n', (250, 259), False, 'import sys\n'), ((168, 188), 'varscan_tool.multi_varscan.main', 'multi_varscan.main', ([], {}), '()\n', (186, 188), False, 'from varscan_tool import multi_varscan\n')] |
from rest_framework import pagination
from rest_framework.response import Response
from rest_framework.utils.urls import remove_query_param, replace_query_param
class AppPagination(pagination.PageNumberPagination):
def get_paginated_response(self, data):
next_url = self.get_next_link()
previous_ur... | [
"rest_framework.utils.urls.remove_query_param",
"rest_framework.response.Response",
"rest_framework.utils.urls.replace_query_param"
] | [((864, 943), 'rest_framework.response.Response', 'Response', (["{'links': links, 'count': self.page.paginator.count, 'results': data}"], {}), "({'links': links, 'count': self.page.paginator.count, 'results': data})\n", (872, 943), False, 'from rest_framework.response import Response\n'), ((1187, 1252), 'rest_framework... |
import cv2
import numpy
from keras.models import load_model
from sigmar.hex import Point, Orientation, Layout
from sigmar.board import Board, Element
def normalize_image(image):
"""Apply some basic image normalization to cut down on noise."""
clahe = cv2.createCLAHE(clipLimit=2.0, tileGridSize=(4, 4))
... | [
"keras.models.load_model",
"cv2.Canny",
"sigmar.board.Board.new",
"sigmar.board.Element",
"sigmar.hex.Point",
"numpy.array",
"cv2.createCLAHE",
"numpy.prod"
] | [((263, 314), 'cv2.createCLAHE', 'cv2.createCLAHE', ([], {'clipLimit': '(2.0)', 'tileGridSize': '(4, 4)'}), '(clipLimit=2.0, tileGridSize=(4, 4))\n', (278, 314), False, 'import cv2\n'), ((433, 459), 'cv2.Canny', 'cv2.Canny', (['image', '(150)', '(200)'], {}), '(image, 150, 200)\n', (442, 459), False, 'import cv2\n'), (... |
"""
BLE serial protocol implmentation for Radiation Alert geiger counters.
The recent Radiation Alert series of geiger counters from SE International
provide a Bluetooth LE connection that can be used to communicate with the
device. This module implements the serial protocol used by this connection,
decoding the packe... | [
"struct.unpack",
"radalert.util.ble.TransparentService",
"bluepy.btle.Peripheral"
] | [((4618, 4651), 'struct.unpack', 'struct.unpack', (['"""<2IHI2B"""', 'bytestr'], {}), "('<2IHI2B', bytestr)\n", (4631, 4651), False, 'import struct\n'), ((7077, 7108), 'struct.unpack', 'struct.unpack', (['"""<I4HI"""', 'bytestr'], {}), "('<I4HI', bytestr)\n", (7090, 7108), False, 'import struct\n'), ((8679, 8698), 'blu... |
#!/usr/bin/env python3
from __future__ import annotations
from unittest import IsolatedAsyncioTestCase
from unittest.mock import AsyncMock, Mock, call, patch
from playlist_id import PlaylistID
from spotify import (
Album,
Artist,
FailedToGetAccessTokenError,
FailedToGetPlaylistError,
FailedToGetT... | [
"spotify.Artist",
"spotify.Spotify.get_access_token",
"spotify.Spotify",
"unittest.mock.AsyncMock",
"spotify.Playlist",
"unittest.mock.patch",
"spotify.Album",
"playlist_id.PlaylistID",
"unittest.mock.call"
] | [((3864, 3924), 'unittest.mock.patch', 'patch', (['"""spotify.Spotify._get_tracks"""'], {'new_callable': 'AsyncMock'}), "('spotify.Spotify._get_tracks', new_callable=AsyncMock)\n", (3869, 3924), False, 'from unittest.mock import AsyncMock, Mock, call, patch\n'), ((6951, 6974), 'unittest.mock.patch', 'patch', (['"""spot... |
import FWCore.ParameterSet.Config as cms
from RecoLocalFastTime.FTLRecProducers.mtdUncalibratedRecHits_cfi import mtdUncalibratedRecHits
from RecoLocalFastTime.FTLRecProducers.mtdRecHits_cfi import mtdRecHits
from RecoLocalFastTime.FTLRecProducers.mtdTrackingRecHits_cfi import mtdTrackingRecHits
from RecoLocalFastTime... | [
"FWCore.ParameterSet.Config.Sequence",
"FWCore.ParameterSet.Config.Task"
] | [((544, 621), 'FWCore.ParameterSet.Config.Task', 'cms.Task', (['mtdUncalibratedRecHits', 'mtdRecHits', 'mtdClusters', 'mtdTrackingRecHits'], {}), '(mtdUncalibratedRecHits, mtdRecHits, mtdClusters, mtdTrackingRecHits)\n', (552, 621), True, 'import FWCore.ParameterSet.Config as cms\n'), ((641, 678), 'FWCore.ParameterSet.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat May 4 01:58:44 2019
@author: john.onwuemeka; <NAME>
"""
import numpy as np
from scipy.optimize import curve_fit
from .sinspec_model import sinspec_model
from joblib import Parallel, delayed
def fit_sin_spec_pll(pms,fn,station,fc1min,fc1max,trt,model,... | [
"numpy.sum",
"numpy.median",
"numpy.power",
"numpy.asarray",
"scipy.optimize.curve_fit",
"numpy.linspace",
"joblib.Parallel",
"joblib.delayed"
] | [((1907, 1931), 'numpy.linspace', 'np.linspace', (['(1.8)', '(3.0)', '(7)'], {}), '(1.8, 3.0, 7)\n', (1918, 1931), True, 'import numpy as np\n'), ((1943, 1967), 'numpy.linspace', 'np.linspace', (['(1.0)', '(2.0)', '(6)'], {}), '(1.0, 2.0, 6)\n', (1954, 1967), True, 'import numpy as np\n'), ((2402, 2419), 'numpy.asarray... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This is a ...
"""
from __future__ import unicode_literals
import codecs
import os
import re
import shutil
import sys
import tkinter as T
def get_path():
""" get Kindle path """
if sys.platform == "win32":
x = os.popen("wmic VOLUME WHERE Label='kindle... | [
"os.listdir",
"tkinter.Text",
"tkinter.Menu",
"os.path.join",
"tkinter.Button",
"os.path.isdir",
"os.popen",
"tkinter.Scrollbar",
"re.search",
"tkinter.Frame",
"shutil.rmtree",
"os.path.normcase",
"tkinter.Tk",
"re.sub"
] | [((813, 829), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (823, 829), False, 'import os\n'), ((2156, 2162), 'tkinter.Tk', 'T.Tk', ([], {}), '()\n', (2160, 2162), True, 'import tkinter as T\n'), ((2509, 2526), 'tkinter.Menu', 'T.Menu', (['self.root'], {}), '(self.root)\n', (2515, 2526), True, 'import tkinter... |
import click
import logging
import time
from config import Config
from commands.poll.poller import Poller
@click.command(name='poll')
@click.pass_context
def poll(ctx):
client = ctx.obj['client']
Config.create_monitors(client)
poller = Poller(Config.monitors)
while True:
try:
poll... | [
"time.sleep",
"click.command",
"logging.info",
"config.Config.create_monitors",
"commands.poll.poller.Poller"
] | [((110, 136), 'click.command', 'click.command', ([], {'name': '"""poll"""'}), "(name='poll')\n", (123, 136), False, 'import click\n'), ((207, 237), 'config.Config.create_monitors', 'Config.create_monitors', (['client'], {}), '(client)\n', (229, 237), False, 'from config import Config\n'), ((251, 274), 'commands.poll.po... |
#!/usr/bin/env python
# Copyright (C) 2018 <NAME>
# <NAME> 11/07/2018
'''
'''
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(name='songsim',
version='0.1.1',
description='Consistent Bayesian Inversion',
author='<NAME>',
author_email='<EMAIL>... | [
"distutils.core.setup"
] | [((174, 432), 'distutils.core.setup', 'setup', ([], {'name': '"""songsim"""', 'version': '"""0.1.1"""', 'description': '"""Consistent Bayesian Inversion"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packages': '[]', 'install_requires': "['matplotlib', 'scipy', 'numpy', 'ipyker... |
""" Extractors for URLs from
`/robots.txt <http://en.wikipedia.org/wiki/Robots_exclusion_standard#Sitemap>`_
and `sitemaps <http://www.sitemaps.org/protocol.html>`_.
"""
from __future__ import unicode_literals, absolute_import, print_function
import logging
import wex.py2compat ; assert wex.py2compat
from lxml.etree... | [
"codecs.getreader",
"wex.http.decode",
"wex.url.URL",
"six.moves.urllib_parse.urljoin",
"wex.extractor.chained",
"logging.getLogger"
] | [((519, 546), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (536, 546), False, 'import logging\n'), ((2998, 3061), 'wex.extractor.chained', 'chained', (['urls_from_robots_txt', 'urls_from_urlset_or_sitemapindex'], {}), '(urls_from_robots_txt, urls_from_urlset_or_sitemapindex)\n', (3005, ... |
#!/usr/bin/env python
# coding: utf-8
import six
import socket
from contextlib import closing
import webbrowser
if six.PY2:
import SimpleHTTPServer
import SocketServer
else:
import http.server as SimpleHTTPServer
import socketserver as SocketServer
def is_port_avaiable(port):
sock = socket.socke... | [
"socketserver.TCPServer",
"socket.socket",
"webbrowser.open"
] | [((308, 357), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (321, 357), False, 'import socket\n'), ((741, 784), 'socketserver.TCPServer', 'SocketServer.TCPServer', (["('', PORT)", 'Handler'], {}), "(('', PORT), Handler)\n", (763, 784), True, ... |
import numpy as np
from .custom_numpy import is_sorted
class SegmentedLagrangeX():
def __init__(self, grid, order, extrapolate=False,
assume_sorted=False, mode='left', adjust_order=True):
# Specification
self.extrapolate = extrapolate
self.sorted = assume_sorted
... | [
"numpy.zeros_like",
"numpy.flip",
"numpy.ceil",
"numpy.ones_like",
"numpy.floor",
"numpy.zeros",
"numpy.searchsorted",
"numpy.ones",
"numpy.hstack",
"numpy.isfinite",
"numpy.sort",
"numpy.array",
"numpy.arange"
] | [((719, 743), 'numpy.array', 'np.array', (['pad'], {'dtype': 'int'}), '(pad, dtype=int)\n', (727, 743), True, 'import numpy as np\n'), ((1439, 1452), 'numpy.array', 'np.array', (['seg'], {}), '(seg)\n', (1447, 1452), True, 'import numpy as np\n'), ((2818, 2836), 'numpy.zeros', 'np.zeros', (['(n, n_x)'], {}), '((n, n_x)... |
import isopy
from isopy import core
from isopy import io
import numpy as np
import functools
import os
__all__ = ['refval']
########################
### Reference Values ###
########################
def _load_RV_values(filename, datatype=None):
filepath = os.path.join(os.path.dirname(__file__), 'referencedata', ... | [
"isopy.io.read_csv",
"isopy.ElementKeyString",
"os.path.dirname",
"isopy.IsotopeKeyList",
"isopy.core.IsopyDict"
] | [((350, 371), 'isopy.io.read_csv', 'io.read_csv', (['filepath'], {}), '(filepath)\n', (361, 371), False, 'from isopy import io\n'), ((276, 301), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (291, 301), False, 'import os\n'), ((5614, 5649), 'isopy.core.IsopyDict', 'core.IsopyDict', (['data']... |
from math import isnan
from ._utils import get_random_int
def generate_afm(
force_first_digit: int = None,
pre99: bool = False,
individual: bool = False,
legal_entity: bool = False,
repeat_tolerance: int = None,
valid: bool = True
) -> str:
"""Generates an TIN/AFM number based on object pa... | [
"math.isnan"
] | [((1418, 1442), 'math.isnan', 'isnan', (['force_first_digit'], {}), '(force_first_digit)\n', (1423, 1442), False, 'from math import isnan\n')] |
import unittest
import json
from app.tests.base_test import BaseTest
class TestProduct(BaseTest):
"""Test Suite for Product endpoints"""
def test_post_product(self):
"""Test that admin can add Product"""
self.user_authentication_register(email="<EMAIL>", password="password", confirm_password... | [
"json.loads",
"json.dumps"
] | [((4231, 4262), 'json.loads', 'json.loads', (['fetch_products.data'], {}), '(fetch_products.data)\n', (4241, 4262), False, 'import json\n'), ((8053, 8089), 'json.loads', 'json.loads', (['edit_single_product.data'], {}), '(edit_single_product.data)\n', (8063, 8089), False, 'import json\n'), ((9953, 9984), 'json.loads', ... |
# -*- coding: utf-8 -*-
from ..base import MyBaseCommand, ObjectDoesNotExist
from ...models import Schedule
from django.contrib.auth import get_user_model
import datetime
User = get_user_model()
class Command(MyBaseCommand):
Model = Schedule
def do_csv_line(self, ln, commit):
u, d, v, w, ws, we, zs,... | [
"datetime.date.fromisoformat",
"django.contrib.auth.get_user_model",
"datetime.time.fromisoformat"
] | [((179, 195), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (193, 195), False, 'from django.contrib.auth import get_user_model\n'), ((420, 450), 'datetime.date.fromisoformat', 'datetime.date.fromisoformat', (['d'], {}), '(d)\n', (447, 450), False, 'import datetime\n'), ((520, 551), 'datetime... |
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth import get_user_model
import getpass
from xmlrpc import client as xmlrpclib
from furl import furl
from yats.models import docs, docs_files
from yats.docs import get_doc_files_folder
from yats.shortcuts imp... | [
"yats.shortcuts.convertOfficeTpPDF",
"os.unlink",
"os.path.isfile",
"django.core.management.base.CommandError",
"mimetypes.guess_type",
"furl.furl",
"os.path.exists",
"yats.models.docs",
"yats.shortcuts.isPreviewable",
"yats.docs.get_doc_files_folder",
"yats.models.docs_files",
"re.sub",
"ha... | [((486, 512), 're.sub', 're.sub', (["'\\r\\n'", '"""\n"""', 'text'], {}), "('\\r\\n', '\\n', text)\n", (492, 512), False, 'import re\n'), ((524, 560), 're.sub', 're.sub', (['"""{{{(.*?)}}}"""', '"""`\\\\1`"""', 'text'], {}), "('{{{(.*?)}}}', '`\\\\1`', text)\n", (530, 560), False, 'import re\n'), ((573, 646), 're.sub',... |
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
import matplotlib.pyplot as plt
N = 100
L = 1000
T = 20
x = np.empty((N, L), np.float32)
x[:] = np.array(range(L)) + np.random.randint(-4*T, 4*T, N).reshape(N, 1)
y = np.sin(x/1.0/T).astype(np.float32)
# print(x.shape)
# print(y.shape)... | [
"matplotlib.pyplot.title",
"numpy.empty",
"torch.nn.LSTMCell",
"torch.cat",
"matplotlib.pyplot.figure",
"numpy.sin",
"numpy.random.randint",
"numpy.arange",
"torch.no_grad",
"torch.nn.MSELoss",
"matplotlib.pyplot.close",
"matplotlib.pyplot.yticks",
"torch.nn.Linear",
"torch.zeros",
"matp... | [((144, 172), 'numpy.empty', 'np.empty', (['(N, L)', 'np.float32'], {}), '((N, L), np.float32)\n', (152, 172), True, 'import numpy as np\n'), ((1832, 1860), 'torch.from_numpy', 'torch.from_numpy', (['y[3:, :-1]'], {}), '(y[3:, :-1])\n', (1848, 1860), False, 'import torch\n'), ((1880, 1907), 'torch.from_numpy', 'torch.f... |
# -*- coding: utf-8 -*-
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
long_description = open(os.path.join(here, 'README.rst')).read()
# allow setup.py to be run from any path
#os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
s... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((103, 128), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (118, 128), False, 'import os\n'), ((460, 511), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['contrib', 'docs', 'test*']"}), "(exclude=['contrib', 'docs', 'test*'])\n", (473, 511), False, 'from setuptools import s... |
# from typing import List
from typing import Optional, Type, TypeVar
from typing import cast as typecast
from ..resource import Resource
R = TypeVar('R', bound=Resource)
class ACResource (Resource):
"""
A resource that we're going to use as part of the Ambassador configuration.
Elements in a Resource:
... | [
"typing.cast",
"typing.TypeVar"
] | [((143, 171), 'typing.TypeVar', 'TypeVar', (['"""R"""'], {'bound': 'Resource'}), "('R', bound=Resource)\n", (150, 171), False, 'from typing import Optional, Type, TypeVar\n'), ((2770, 2795), 'typing.cast', 'typecast', (['str', 'apiVersion'], {}), '(str, apiVersion)\n', (2778, 2795), True, 'from typing import cast as ty... |
import re
import json
import datetime
from datetime import datetime
from datetime import timedelta
import pandas as pd
from pandas.io.json import json_normalize
import numpy as np
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import argparse
import os
import csv
class ProcessTweets(object):
def __in... | [
"pandas.DataFrame",
"pandas.DataFrame.from_dict",
"argparse.ArgumentParser",
"nltk.sentiment.vader.SentimentIntensityAnalyzer",
"json.loads",
"os.makedirs",
"numpy.asarray",
"os.walk",
"os.path.exists",
"os.path.join",
"pandas.to_datetime",
"datetime.timedelta",
"re.sub"
] | [((2672, 2697), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2695, 2697), False, 'import argparse\n'), ((3077, 3100), 'os.walk', 'os.walk', (['args.input_dir'], {}), '(args.input_dir)\n', (3084, 3100), False, 'import os\n'), ((506, 526), 'json.loads', 'json.loads', (['json_str'], {}), '(json... |
# ©2019 <NAME>. GNU GPL v3.
# coding: utf-8
import csv
fichierNb = "decompte-des-numeros-seao.csv"
fichierInput = "seao_2009-2018-nb3.csv"
fichierOutput = "contrats-nb3.csv"
f1 = open(fichierNb)
numeros = csv.reader(f1)
next(numeros)
for numero in numeros:
if numero[1] == "3":
montantAvis = 0
montantAvisRevise... | [
"csv.reader",
"csv.writer"
] | [((208, 222), 'csv.reader', 'csv.reader', (['f1'], {}), '(f1)\n', (218, 222), False, 'import csv\n'), ((525, 539), 'csv.reader', 'csv.reader', (['f2'], {}), '(f2)\n', (535, 539), False, 'import csv\n'), ((1370, 1389), 'csv.writer', 'csv.writer', (['douglas'], {}), '(douglas)\n', (1380, 1389), False, 'import csv\n'), ((... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.