code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# AUTOGENERATED! DO NOT EDIT! File to edit: nbs/02_transformer_fingerprints.ipynb (unless otherwise specified).
__all__ = ['RXNBERTFingerprintGenerator', 'RXNBERTMinhashFingerprintGenerator', 'get_default_model_and_tokenizer',
'generate_fingerprints']
# Cell
import torch
import pkg_resources
import numpy a... | [
"itertools.islice",
"pkg_resources.resource_filename",
"transformers.BertModel.from_pretrained",
"numpy.array",
"torch.cuda.is_available",
"torch.no_grad",
"tmap.Minhash"
] | [((3781, 3853), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['"""rxnfp"""', 'f"""models/transformers/{model}"""'], {}), "('rxnfp', f'models/transformers/{model}')\n", (3812, 3853), False, 'import pkg_resources\n'), ((3938, 4024), 'pkg_resources.resource_filename', 'pkg_resources.resource_file... |
#!/usr/bin/python
from .stl_general_test import CStlGeneral_Test, CTRexScenario
from trex_stl_lib.api import *
from trex.common.stats.trex_ns import CNsStats
from trex.common.services.trex_service_icmp import ServiceICMP
import pprint
class STLNS_Test(CStlGeneral_Test):
"""Tests for NS function """
def setU... | [
"trex.common.stats.trex_ns.CNsStats",
"pprint.pprint"
] | [((2115, 2125), 'trex.common.stats.trex_ns.CNsStats', 'CNsStats', ([], {}), '()\n', (2123, 2125), False, 'from trex.common.stats.trex_ns import CNsStats\n'), ((2278, 2296), 'pprint.pprint', 'pprint.pprint', (['cnt'], {}), '(cnt)\n', (2291, 2296), False, 'import pprint\n'), ((3183, 3193), 'trex.common.stats.trex_ns.CNsS... |
import numpy as np
import cv2 as cv
class opencv_camera():
def __init__(self, render, name, frame_interval):
self.frame_int = frame_interval
self.render = render
window_size = (self.render.win.getXSize(), self.render.win.getYSize())
self.buffer = self.render.win.makeTextureB... | [
"numpy.frombuffer",
"cv2.resize",
"cv2.flip"
] | [((867, 895), 'numpy.frombuffer', 'np.frombuffer', (['img', 'np.uint8'], {}), '(img, np.uint8)\n', (880, 895), True, 'import numpy as np\n'), ((1018, 1058), 'cv2.resize', 'cv.resize', (['image', '(0, 0)'], {'fx': '(0.5)', 'fy': '(0.5)'}), '(image, (0, 0), fx=0.5, fy=0.5)\n', (1027, 1058), True, 'import cv2 as cv\n'), (... |
from annotation_utils.ndds.structs import NDDS_Dataset
from annotation_utils.coco.structs import COCO_Category_Handler, COCO_Category
from annotation_utils.coco.structs import COCO_Dataset
from common_utils.file_utils import make_dir_if_not_exists, delete_all_files_in_dir
from typing import cast
from annotation_utils.c... | [
"cv2.imwrite",
"annotation_utils.ndds.structs.NDDS_Dataset.load_from_dir",
"annotation_utils.coco.structs.COCO_Dataset.new",
"logger.logger.info",
"common_utils.file_utils.make_dir_if_not_exists",
"common_utils.file_utils.delete_all_files_in_dir",
"common_utils.common_types.point.Point2D",
"common_uti... | [((723, 761), 'common_utils.file_utils.make_dir_if_not_exists', 'make_dir_if_not_exists', (['target_dst_dir'], {}), '(target_dst_dir)\n', (745, 761), False, 'from common_utils.file_utils import make_dir_if_not_exists, delete_all_files_in_dir\n'), ((762, 801), 'common_utils.file_utils.delete_all_files_in_dir', 'delete_a... |
# -*- coding: utf-8 -*-
import os
import sys
myPath = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, myPath + '/../')
import unittest
import meterbus
from meterbus.exceptions import *
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.dib_empty = meterbus.DataInformati... | [
"os.path.abspath",
"sys.path.insert",
"meterbus.DataInformationBlock",
"unittest.main"
] | [((99, 134), 'sys.path.insert', 'sys.path.insert', (['(0)', "(myPath + '/../')"], {}), "(0, myPath + '/../')\n", (114, 134), False, 'import sys\n'), ((72, 97), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (87, 97), False, 'import os\n'), ((2281, 2296), 'unittest.main', 'unittest.main', ([],... |
# Generated by Django 2.2.10 on 2020-03-20 16:15
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("mercury", "0011_merge_20200314_0111"),
]
operations = [
migrations.CreateModel(
name="GFConfig",
fields=[
... | [
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((375, 468), '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", (391, 468), False, 'from django.db import migrations, models\... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: log.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflectio... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor"
] | [((433, 459), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (457, 459), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((4389, 4707), 'google.protobuf.descriptor.FieldDescriptor', '_descriptor.FieldDescriptor', ([], {'name': '"""msgid"""', 'full_na... |
# begin-doc-include
import os
import re
import click
import pickle
import pylatex as pl
import autoroga_extract_report_data as extract_report_data
from datetime import datetime
from pylatex.utils import bold, italic
from autoroga_database import update_db
"""
This script receives input from a CFIA Redmine issue and ... | [
"autoroga_extract_report_data.parse_amr_profile",
"pylatex.Command",
"autoroga_extract_report_data.generate_gdcs_dict",
"re.compile",
"pylatex.NoEscape",
"autoroga_extract_report_data.validate_listeria",
"pylatex.utils.bold",
"pylatex.Head",
"pylatex.Subsubsection",
"autoroga_extract_report_data.g... | [((2081, 2096), 'click.command', 'click.command', ([], {}), '()\n', (2094, 2096), False, 'import click\n'), ((2098, 2177), 'click.option', 'click.option', (['"""--redmine_instance"""'], {'help': '"""Path to pickled Redmine API instance"""'}), "('--redmine_instance', help='Path to pickled Redmine API instance')\n", (211... |
import itertools
import pytest
from pyrdf2vec.graphs import KG, Vertex
from pyrdf2vec.rdf2vec import RDF2VecTransformer
from pyrdf2vec.walkers import ( # isort: skip
AnonymousWalker,
HALKWalker,
NGramWalker,
RandomWalker,
WalkletWalker,
WLWalker,
)
from pyrdf2vec.samplers import ( # isort: ... | [
"pytest.fixture",
"pyrdf2vec.graphs.Vertex",
"itertools.product",
"pyrdf2vec.graphs.KG"
] | [((910, 914), 'pyrdf2vec.graphs.KG', 'KG', ([], {}), '()\n', (912, 914), False, 'from pyrdf2vec.graphs import KG, Vertex\n'), ((926, 930), 'pyrdf2vec.graphs.KG', 'KG', ([], {}), '()\n', (928, 930), False, 'from pyrdf2vec.graphs import KG, Vertex\n'), ((1344, 1375), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '""... |
#!/usr/bin/env python
from impactutils.mapping.compass import get_compass_dir, get_compass_dir_azimuth
import numpy as np
import pandas as pd
def test_compass():
angles = [[1.0, ('N', 'North'), ('N', 'North'), ('N', 'North')],
[23.5, ('N', 'North'), ('NE', 'Northeast'),
('NNE', 'Nort... | [
"impactutils.mapping.compass.get_compass_dir_azimuth"
] | [((1729, 1798), 'impactutils.mapping.compass.get_compass_dir_azimuth', 'get_compass_dir_azimuth', (['angle'], {'resolution': '"""cardinal"""', 'format': '"""short"""'}), "(angle, resolution='cardinal', format='short')\n", (1752, 1798), False, 'from impactutils.mapping.compass import get_compass_dir, get_compass_dir_azi... |
"""
Copyright (c) 2019 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from textwrap import dedent
import sys
from flexmock import flexmock
import pytest
import atomic_reactor.utils.koji as koji_util
from atomi... | [
"textwrap.dedent",
"atomic_reactor.plugins.pre_reactor_config.ReactorConfig",
"atomic_reactor.inner.DockerBuildWorkflow",
"atomic_reactor.util.read_yaml",
"pytest.mark.parametrize",
"pytest.raises",
"tests.stubs.StubInsideBuilder",
"sys.modules.pop",
"atomic_reactor.plugin.PreBuildPluginsRunner",
... | [((12884, 12933), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""scratch"""', '(True, False)'], {}), "('scratch', (True, False))\n", (12907, 12933), False, 'import pytest\n'), ((12935, 13289), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dr_strs, dependency_replacements"""', "((None, None), ... |
import os
import csv
class Logger(object):
''' Logger saves the running results and helps make plots from the results
'''
def __init__(self, log_dir):
''' Initialize the labels, legend and paths of the plot and log file.
Args:
log_path (str): The path the log files
''... | [
"csv.DictWriter",
"os.path.exists",
"csv.DictReader",
"os.makedirs",
"os.path.join",
"matplotlib.pyplot.close",
"os.path.dirname",
"matplotlib.pyplot.subplots"
] | [((377, 409), 'os.path.join', 'os.path.join', (['log_dir', '"""log.txt"""'], {}), "(log_dir, 'log.txt')\n", (389, 409), False, 'import os\n'), ((434, 474), 'os.path.join', 'os.path.join', (['log_dir', '"""performance.csv"""'], {}), "(log_dir, 'performance.csv')\n", (446, 474), False, 'import os\n'), ((499, 531), 'os.pa... |
import tensorflow as tf
def make_weights(shape, name='weights'):
return tf.Variable(tf.truncated_normal(shape=shape, stddev=0.05), name=name)
def make_biases(shape, name='biases'):
return tf.Variable(tf.constant(0.05, shape=shape), name=name)
def convolution_layer(prev_layer, f_size, inp_c, out_c, stride_... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.nn.relu",
"tensorflow.constant",
"tensorflow.nn.dropout",
"tensorflow.matmul",
"tensorflow.reshape",
"tensorflow.truncated_normal"
] | [((651, 709), 'tensorflow.nn.max_pool', 'tf.nn.max_pool', (['prev_layer', 'kernel', 'stride'], {'padding': '"""SAME"""'}), "(prev_layer, kernel, stride, padding='SAME')\n", (665, 709), True, 'import tensorflow as tf\n'), ((1408, 1439), 'tensorflow.nn.dropout', 'tf.nn.dropout', (['prev_layer', 'prob'], {}), '(prev_layer... |
# Python Essential Libraries by <NAME> course example
# Example file for Pendulum library
import pendulum
# create a datetime and print it
dt1 = pendulum.datetime(2020, 7, 28, 15, 30)
print(dt1)
# use some formatting functions
print(dt1.to_date_string())
print(dt1.to_time_string())
print(dt1.to_datetime_string())
#... | [
"pendulum.datetime"
] | [((146, 184), 'pendulum.datetime', 'pendulum.datetime', (['(2020)', '(7)', '(28)', '(15)', '(30)'], {}), '(2020, 7, 28, 15, 30)\n', (163, 184), False, 'import pendulum\n')] |
import argparse
import base64
import binascii
import json
import msgpack
import sys
__version__ = "0.0.1"
ACTION_VALIDATE = "validate"
ACTION_DECODE = "decode"
actions = (ACTION_DECODE, ACTION_VALIDATE)
parser = argparse.ArgumentParser(description='python msgpack native formatter %s' % __version__)
parser.add_argum... | [
"argparse.ArgumentParser",
"json.dumps",
"base64.b64decode",
"msgpack.unpackb",
"sys.exit"
] | [((216, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': "('python msgpack native formatter %s' % __version__)"}), "(description='python msgpack native formatter %s' %\n __version__)\n", (239, 307), False, 'import argparse\n'), ((665, 676), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\... |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve.
#
# 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 applic... | [
"numpy.array",
"jieba.cut"
] | [((1430, 1466), 'numpy.array', 'np.array', (['example[-1]'], {'dtype': '"""int64"""'}), "(example[-1], dtype='int64')\n", (1438, 1466), True, 'import numpy as np\n'), ((5254, 5290), 'numpy.array', 'np.array', (['[label]'], {'dtype': 'label_dtype'}), '([label], dtype=label_dtype)\n', (5262, 5290), True, 'import numpy as... |
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_csv("./df_covid19.csv")
df_mujer = df[df.SEXO == 1]
df_hombre = df[df.SEXO == 2]
# HOMBRES
si_tiene_hombre = list(df_hombre.DIABETES).count(1)
no_tiene_hombre = list(df_hombre.DIABETES).count(2)
no_aplica_hombre = list(df_hombre.DIABETES).count(98)
f... | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"matplotlib.pyplot.show"
] | [((58, 89), 'pandas.read_csv', 'pd.read_csv', (['"""./df_covid19.csv"""'], {}), "('./df_covid19.csv')\n", (69, 89), True, 'import pandas as pd\n'), ((325, 337), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (335, 337), True, 'import matplotlib.pyplot as plt\n'), ((545, 581), 'matplotlib.pyplot.savefig', '... |
#!/usr/bin/env python3
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
'''Unit tests for the admin template gatherer.'''
from __future__ import print_function
import os
import sys
if __name__ == '__m... | [
"grit.grit_runner.Options",
"grit.util.PathFromRoot",
"os.path.dirname",
"six.StringIO",
"unittest.main",
"grit.gather.admin_template.AdmGatherer",
"grit.util.TempDir",
"grit.tool.build.RcBuilder"
] | [((3818, 3833), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3831, 3833), False, 'import unittest\n'), ((690, 824), 'six.StringIO', 'StringIO', (['"""bingo bongo\nding dong\n[strings] \nwhatcha="bingo bongo"\ngotcha = "bingolabongola "the wise" fingulafongula" \n"""'], {}), '(\n """bingo bongo\nding dong\n[s... |
from django.urls import path
from django.views.generic import TemplateView
from . import views
app_name = 'sim'
urlpatterns = [
path('', TemplateView.as_view(template_name='sim/index.html'), name='index'),
path('mania/', TemplateView.as_view(template_name='sim/mania.html'), name='mania'),
path('get/', vie... | [
"django.views.generic.TemplateView.as_view",
"django.urls.path"
] | [((304, 351), 'django.urls.path', 'path', (['"""get/"""', 'views.get_games'], {'name': '"""get_games"""'}), "('get/', views.get_games, name='get_games')\n", (308, 351), False, 'from django.urls import path\n'), ((357, 405), 'django.urls.path', 'path', (['"""post/"""', 'views.post_logs'], {'name': '"""post_logs"""'}), "... |
import requests_mock
from pathlib import Path
from send_to_kindle.downloader.image_downloader import download_images
def test_download_images(tmpdir, get_file_content):
tmp_dir = Path(tmpdir)
image_map = {
"ABC.jpg": "http://image/ABC",
"DEF.jpg": "http://image/DEF",
"GHI.jpg": "http:/... | [
"requests_mock.mock",
"send_to_kindle.downloader.image_downloader.download_images",
"pathlib.Path"
] | [((185, 197), 'pathlib.Path', 'Path', (['tmpdir'], {}), '(tmpdir)\n', (189, 197), False, 'from pathlib import Path\n'), ((387, 407), 'requests_mock.mock', 'requests_mock.mock', ([], {}), '()\n', (405, 407), False, 'import requests_mock\n'), ((712, 747), 'send_to_kindle.downloader.image_downloader.download_images', 'dow... |
import pandas
f = r'C:\Users\Ciaran\Documents\LargeStudy\GSS2375_WB_NewDur_Grant\GSS2375_RNA.xlsx'
data = pandas.read_excel(f)
import matplotlib.pyplot as plt
plt.figure()
plt.hist(data['Yield(ug)'],bins=50)
plt.show() | [
"matplotlib.pyplot.figure",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.show",
"pandas.read_excel"
] | [((114, 134), 'pandas.read_excel', 'pandas.read_excel', (['f'], {}), '(f)\n', (131, 134), False, 'import pandas\n'), ((171, 183), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (181, 183), True, 'import matplotlib.pyplot as plt\n'), ((185, 221), 'matplotlib.pyplot.hist', 'plt.hist', (["data['Yield(ug)']"],... |
from setuptools import setup, Extension
import sys
import platform
if platform.system() != 'Darwin':
print("The macos_display package can only be installed on macOS", file=sys.stderr)
sys.exit(1)
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'RE... | [
"os.path.join",
"setuptools.Extension",
"os.path.dirname",
"platform.system",
"sys.exit"
] | [((72, 89), 'platform.system', 'platform.system', ([], {}), '()\n', (87, 89), False, 'import platform\n'), ((194, 205), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (202, 205), False, 'import sys\n'), ((257, 279), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (269, 279), False, 'from os impo... |
import collections
import contextlib
import sys
import wave
import webrtcvad
import librosa
def read_wave(path):
with contextlib.closing(wave.open(path, 'rb')) as wf:
num_channels = wf.getnchannels()
assert num_channels == 1
sample_width = wf.getsampwidth()
assert sample_width ==... | [
"sklearn.cluster.SpectralClustering",
"wave.open",
"sklearn.mixture.GaussianMixture",
"collections.deque",
"copy.deepcopy",
"librosa.feature.delta",
"sys.stdout.write",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.dot",
"numpy.vstack",
"webrtcvad.Vad",
"numpy.shape",
"librosa.load"
... | [((3983, 3999), 'webrtcvad.Vad', 'webrtcvad.Vad', (['(2)'], {}), '(2)\n', (3996, 3999), False, 'import webrtcvad\n'), ((4540, 4568), 'librosa.load', 'librosa.load', (['test_file_path'], {}), '(test_file_path)\n', (4552, 4568), False, 'import librosa\n'), ((4723, 4750), 'librosa.feature.delta', 'librosa.feature.delta', ... |
from django.urls import path
from .views import *
app_name = 'stories'
urlpatterns = [
path('', story_home, name = 'home'), # done
path('all/', story_list, name = 'list'), # done
path('my/', story_my, name = 'my'), # done
path('new/', story_new, name='new'),
path('new/valid/', story_valid, name='... | [
"django.urls.path"
] | [((93, 126), 'django.urls.path', 'path', (['""""""', 'story_home'], {'name': '"""home"""'}), "('', story_home, name='home')\n", (97, 126), False, 'from django.urls import path\n'), ((142, 179), 'django.urls.path', 'path', (['"""all/"""', 'story_list'], {'name': '"""list"""'}), "('all/', story_list, name='list')\n", (14... |
#!/usr/bin/env python3
"""Connects the bot."""
import os
import os.path
import random
import re
import sys
import threading
import time
import hclib
import pymongo
from commands import currency
from commands import dictionary
from commands import jokes
from commands import katex
from commands import password
from c... | [
"time.sleep",
"sys.exit",
"pymongo.MongoClient",
"re.search",
"commands.dictionary.urban",
"utility.shorten_lines",
"commands.dictionary.Oxford",
"commands.currency.convert",
"commands.password.strengthen",
"commands.katex.generator",
"re.sub",
"re.findall",
"random.SystemRandom",
"time.ti... | [((626, 651), 'os.environ.get', 'os.environ.get', (['"""TRIGGER"""'], {}), "('TRIGGER')\n", (640, 651), False, 'import os\n'), ((664, 686), 'os.environ.get', 'os.environ.get', (['"""NICK"""'], {}), "('NICK')\n", (678, 686), False, 'import os\n'), ((698, 719), 'os.environ.get', 'os.environ.get', (['"""URL"""'], {}), "('... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... | [
"time_utils.seconds",
"boto3.client",
"datetime.datetime.utcnow",
"datetime.datetime.strptime",
"logging.warning",
"time.sleep",
"datetime.timedelta",
"logging.info"
] | [((2352, 2418), 'logging.info', 'logging.info', (['"""Monitoring scheduler status and publishing metrics"""'], {}), "('Monitoring scheduler status and publishing metrics')\n", (2364, 2418), False, 'import logging\n'), ((2435, 2481), 'boto3.client', 'boto3.client', (['"""cloudwatch"""'], {'region_name': 'region'}), "('c... |
# Autogenerated from KST: please remove this line if doing any edits by hand!
import unittest
from position_in_seq import _schema
class TestPositionInSeq(unittest.TestCase):
def test_position_in_seq(self):
r = _schema.parse_file('src/position_in_seq.bin')
self.assertEqual(r.numbers, [(0 + 1), 2, ... | [
"position_in_seq._schema.parse_file"
] | [((225, 270), 'position_in_seq._schema.parse_file', '_schema.parse_file', (['"""src/position_in_seq.bin"""'], {}), "('src/position_in_seq.bin')\n", (243, 270), False, 'from position_in_seq import _schema\n')] |
import unittest
import numpy as np
import logging
from dsbox.ml.neural_networks.keras_factory.text_models import LSTMFactory
from dsbox.ml.neural_networks.processing.workflow import TextNeuralNetPipeline, ImageNeuralNetPipeline
logging.getLogger("tensorflow").setLevel(logging.WARNING)
np.random.seed(42)
class T... | [
"logging.getLogger",
"dsbox.ml.neural_networks.processing.workflow.ImageNeuralNetPipeline",
"numpy.array",
"dsbox.ml.neural_networks.processing.workflow.TextNeuralNetPipeline",
"numpy.random.seed"
] | [((292, 310), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (306, 310), True, 'import numpy as np\n'), ((233, 264), 'logging.getLogger', 'logging.getLogger', (['"""tensorflow"""'], {}), "('tensorflow')\n", (250, 264), False, 'import logging\n'), ((461, 546), 'numpy.array', 'np.array', (["['this is re... |
import numpy as np
from pipeline.input_provider.base_input_provider import BaseInputProvider
class NormalizedOneHotInputProvider(BaseInputProvider):
def __init__(self):
BaseInputProvider.__init__(self)
self.__game_state = None
self.__screen_shot = None
def store(self, game_state, scr... | [
"numpy.array",
"numpy.zeros",
"pipeline.input_provider.base_input_provider.BaseInputProvider.__init__"
] | [((184, 216), 'pipeline.input_provider.base_input_provider.BaseInputProvider.__init__', 'BaseInputProvider.__init__', (['self'], {}), '(self)\n', (210, 216), False, 'from pipeline.input_provider.base_input_provider import BaseInputProvider\n'), ((676, 692), 'numpy.zeros', 'np.zeros', (['length'], {}), '(length)\n', (68... |
#!/usr/bin/env python
# -*-coding:utf-8-*-
import os
import shutil
import sys
from setuptools import setup, find_packages
is_windows = 'win32' == sys.platform.lower()
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f... | [
"shutil.which",
"os.path.join",
"setuptools.find_packages",
"os.path.dirname",
"sys.platform.lower"
] | [((158, 178), 'sys.platform.lower', 'sys.platform.lower', ([], {}), '()\n', (176, 178), False, 'import sys\n'), ((217, 242), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (232, 242), False, 'import os\n'), ((427, 453), 'shutil.which', 'shutil.which', (['"""pdftocairo"""'], {}), "('pdftocairo... |
'''Gradient penalty functions.
'''
import torch
from torch import autograd
def contrastive_gradient_penalty(network, input, penalty_amount=1.):
"""Contrastive gradient penalty.
This is essentially the loss introduced by Mescheder et al 2018.
Args:
network: Network to apply penalty through.
... | [
"torch.set_grad_enabled",
"torch.ones_like"
] | [((993, 1021), 'torch.set_grad_enabled', 'torch.set_grad_enabled', (['(True)'], {}), '(True)\n', (1015, 1021), False, 'import torch\n'), ((623, 646), 'torch.ones_like', 'torch.ones_like', (['output'], {}), '(output)\n', (638, 646), False, 'import torch\n')] |
from rest_framework import authentication, exceptions
from rest_framework.authentication import get_authorization_header
from django.utils.translation import ugettext_lazy as _
from .models import Token
class TokenAuthentication(authentication.BaseAuthentication):
"""
Simple token based authentication.
Cl... | [
"rest_framework.exceptions.AuthenticationFailed",
"django.utils.translation.ugettext_lazy",
"rest_framework.authentication.get_authorization_header"
] | [((935, 986), 'django.utils.translation.ugettext_lazy', '_', (['"""Invalid token header. No credentials provided."""'], {}), "('Invalid token header. No credentials provided.')\n", (936, 986), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1005, 1041), 'rest_framework.exceptions.AuthenticationFai... |
import math
from typing import Dict, Optional, Union, Tuple, List, cast
from collections import defaultdict
from .backends import Ops, NumpyOps, CupyOps, get_current_ops
from .types import Generator, FloatsXd
from .config import registry
KeyT = Tuple[int, str]
FloatOrSeq = Union[float, List[float], Generator]
IntOr... | [
"math.sqrt",
"collections.defaultdict",
"typing.cast"
] | [((1793, 1840), 'typing.cast', 'cast', (['bool', "ADAM_DEFAULTS['L2_is_weight_decay']"], {}), "(bool, ADAM_DEFAULTS['L2_is_weight_decay'])\n", (1797, 1840), False, 'from typing import Dict, Optional, Union, Tuple, List, cast\n'), ((2378, 2424), 'typing.cast', 'cast', (['bool', "SGD_DEFAULTS['L2_is_weight_decay']"], {})... |
from genmod.vcf_tools.header_parser import HeaderParser
def test_parse_info():
## GIVEN a header object
head = HeaderParser()
assert 'MQ' not in head.info_dict
info_line = '##INFO=<ID=MQ,Number=1,Type=Float,Description="RMS Mapping Quality">'
## WHEN parsing a correct info line
head.parse_... | [
"genmod.vcf_tools.header_parser.HeaderParser"
] | [((120, 134), 'genmod.vcf_tools.header_parser.HeaderParser', 'HeaderParser', ([], {}), '()\n', (132, 134), False, 'from genmod.vcf_tools.header_parser import HeaderParser\n'), ((492, 506), 'genmod.vcf_tools.header_parser.HeaderParser', 'HeaderParser', ([], {}), '()\n', (504, 506), False, 'from genmod.vcf_tools.header_p... |
import os
import torch
import argparse
from configs import args
from data import make_data_loader
from model import bulid_MGN_resnet
from processor import inference
def test(args):
print('Start Testing ------')
train_loader, val_loader, class_num, _, _, num_query = make_data_loader(args)
device = torch.d... | [
"data.make_data_loader",
"model.bulid_MGN_resnet",
"processor.inference",
"torch.device"
] | [((276, 298), 'data.make_data_loader', 'make_data_loader', (['args'], {}), '(args)\n', (292, 298), False, 'from data import make_data_loader\n'), ((313, 336), 'torch.device', 'torch.device', (['args.cuda'], {}), '(args.cuda)\n', (325, 336), False, 'import torch\n'), ((350, 372), 'model.bulid_MGN_resnet', 'bulid_MGN_res... |
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from saleor.checkout.views.utils import shipping_info
from saleor.easyship.api import post
from saleor.product.models import Product
from saleor.shipping.models import ShippingMethod, Shipment
from .discount import add_voucher_... | [
"saleor.easyship.api.post",
"saleor.product.models.Product.objects.get",
"django.template.response.TemplateResponse",
"saleor.checkout.views.utils.shipping_info",
"json.dumps",
"django.shortcuts.redirect"
] | [((993, 1030), 'django.shortcuts.redirect', 'redirect', (['"""checkout:shipping-address"""'], {}), "('checkout:shipping-address')\n", (1001, 1030), False, 'from django.shortcuts import redirect\n'), ((3619, 3810), 'django.template.response.TemplateResponse', 'TemplateResponse', (['request', '"""checkout/shipping_method... |
class CompressedGene:
def __init__(self, gene:str)->None:
self._compress(gene)
def _compress(self,gene:str):
self.bit_string : int = 1
for nucleotide in gene.upper():
self.bit_string<<=2
if nucleotide=="A":
self.bit_string |=0b00
elif ... | [
"sys.getsizeof"
] | [((1342, 1361), 'sys.getsizeof', 'getsizeof', (['original'], {}), '(original)\n', (1351, 1361), False, 'from sys import getsizeof\n'), ((1466, 1498), 'sys.getsizeof', 'getsizeof', (['compressed.bit_string'], {}), '(compressed.bit_string)\n', (1475, 1498), False, 'from sys import getsizeof\n')] |
"""Tests for the macroeco_distributions module"""
from __future__ import division
from macroeco_distributions import *
import nose
from nose.tools import assert_almost_equals, assert_equals
from math import log
from decimal import Decimal
#Test values for Poisson lognomal are chosen from Table 1 and Table 2
#in Grun... | [
"nose.run",
"math.log"
] | [((2005, 2015), 'nose.run', 'nose.run', ([], {}), '()\n', (2013, 2015), False, 'import nose\n'), ((1242, 1260), 'math.log', 'log', (['(10 ** line[0])'], {}), '(10 ** line[0])\n', (1245, 1260), False, 'from math import log\n'), ((1618, 1636), 'math.log', 'log', (['(10 ** line[0])'], {}), '(10 ** line[0])\n', (1621, 1636... |
"""
Library to deal unstable species
"""
import automol
from mechlib import filesys
from mechlib.amech_io import printer as ioprinter
# Handle reaction lst
def split_unstable_full(pes_rlst, spc_rlst, spc_dct,
spc_model_dct_i, save_prefix):
""" Loop over the pes reaction list and break up... | [
"automol.inchi.standard_form",
"automol.graph.inchi",
"mechlib.filesys.read.instability_transformation",
"mechlib.amech_io.printer.info_message",
"automol.reac.product_graphs"
] | [((6598, 6702), 'mechlib.filesys.read.instability_transformation', 'filesys.read.instability_transformation', (['spc_dct', 'spc_name', 'thy_info', 'save_prefix'], {'zma_locs': 'zma_locs'}), '(spc_dct, spc_name, thy_info,\n save_prefix, zma_locs=zma_locs)\n', (6637, 6702), False, 'from mechlib import filesys\n'), ((6... |
import IPython.lib.demo as ipd
# To use, run ipython, then
#
# In [1]: %run Demos.py
# In [2]: d = ImageDemo()
# In [3]: d()
# In [4]: d()
def ImageDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/Image.py' )
def InputOutputDemo ():
return ipd.ClearIPDemo ( 'BasicTutorial1/InputOutput.py' )
def MemoryManag... | [
"IPython.lib.demo.ClearIPDemo"
] | [((170, 212), 'IPython.lib.demo.ClearIPDemo', 'ipd.ClearIPDemo', (['"""BasicTutorial1/Image.py"""'], {}), "('BasicTutorial1/Image.py')\n", (185, 212), True, 'import IPython.lib.demo as ipd\n'), ((252, 300), 'IPython.lib.demo.ClearIPDemo', 'ipd.ClearIPDemo', (['"""BasicTutorial1/InputOutput.py"""'], {}), "('BasicTutoria... |
#!/usr/bin/env python3
import os
# Specify token to telegram
botoken = "433288264:<KEY>"
botchat_id = '-1001376475021'
# Mega sync
dirmega = "etc/documentos/Mega/"
# Google drive
gduser1 = "jadilson"
gduser2 = "si1720"
caminho = " ~/etc/documentos/G-Drive/"
opcao = " -label "
# Build
rom_custom = "rr"
device = "s... | [
"os.getenv"
] | [((489, 506), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (498, 506), False, 'import os\n')] |
# -*- coding: utf-8 -*-
# (C) Copyright 2014 Voyager Search
#
# 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 l... | [
"utils.task_utils.get_security_token",
"os.path.exists",
"utils.task_utils.get_parameter_value",
"os.makedirs",
"utils.task_utils.get_result_count",
"os.path.join",
"utils.status.Writer",
"warnings.simplefilter",
"utils.task_utils.get_ssl_mode"
] | [((782, 837), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'InsecureRequestWarning'], {}), "('ignore', InsecureRequestWarning)\n", (803, 837), False, 'import warnings\n'), ((878, 903), 'utils.task_utils.get_ssl_mode', 'task_utils.get_ssl_mode', ([], {}), '()\n', (901, 903), False, 'from utils imp... |
# Copyright 2017-2018 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in t... | [
"six.moves.range",
"os.environ.get",
"os.path.join",
"numpy.zeros",
"unittest.main"
] | [((1604, 1633), 'os.environ.get', 'os.environ.get', (['"""TEST_SRCDIR"""'], {}), "('TEST_SRCDIR')\n", (1618, 1633), False, 'import os\n'), ((1763, 1778), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1776, 1778), False, 'import unittest\n'), ((1279, 1308), 'numpy.zeros', 'np.zeros', (['(7,)'], {'dtype': 'np.intc... |
# Core Django imports
from django.contrib import admin
# Imports from my apps
from bus_system.apps.bus_driver.models import BusDriverModel
admin.site.register(BusDriverModel)
| [
"django.contrib.admin.site.register"
] | [((142, 177), 'django.contrib.admin.site.register', 'admin.site.register', (['BusDriverModel'], {}), '(BusDriverModel)\n', (161, 177), False, 'from django.contrib import admin\n')] |
import frappe
import logging
import logging.config
import os
import json
from pprint import pformat
class ContextFilter(logging.Filter):
"""
This is a filter which injects request information (if available) into the log.
"""
def filter(self, record):
record.form_dict = pformat(getattr(frappe.local, 'form_dict',... | [
"logging.config.dictConfig",
"os.environ.get",
"frappe.utils.get_traceback"
] | [((1540, 1579), 'logging.config.dictConfig', 'logging.config.dictConfig', (['logging_conf'], {}), '(logging_conf)\n', (1565, 1579), False, 'import logging\n'), ((394, 422), 'frappe.utils.get_traceback', 'frappe.utils.get_traceback', ([], {}), '()\n', (420, 422), False, 'import frappe\n'), ((501, 534), 'os.environ.get',... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import shlex
import signal
import subprocess
import threading
from os import path as osp
f... | [
"os.path.exists",
"signal.signal",
"habitat.logger.warn",
"shlex.split",
"torch.load",
"os.path.join",
"os.environ.get",
"ifcfg.default_interface",
"threading.Event",
"habitat.logger.info",
"os.getpid",
"torch.save"
] | [((422, 439), 'threading.Event', 'threading.Event', ([], {}), '()\n', (437, 439), False, 'import threading\n'), ((463, 480), 'threading.Event', 'threading.Event', ([], {}), '()\n', (478, 480), False, 'import threading\n'), ((508, 519), 'os.getpid', 'os.getpid', ([], {}), '()\n', (517, 519), False, 'import os\n'), ((536... |
import os
import re
import codecs
def isValidLine(line):
if re.search('include \"', line) == None or line.find('.PSVita') != -1 or line.find('.PS4') != -1 or line.find('.Switch') != -1 or line.find('.XBoxOne') != -1:
return True
return False
class CreateHeader:
def __init__(self):
self.lines = []
def addLine... | [
"codecs.open",
"re.search"
] | [((393, 428), 'codecs.open', 'codecs.open', (['path', '"""r"""', '"""utf-8_sig"""'], {}), "(path, 'r', 'utf-8_sig')\n", (404, 428), False, 'import codecs\n'), ((603, 638), 'codecs.open', 'codecs.open', (['path', '"""w"""', '"""utf-8_sig"""'], {}), "(path, 'w', 'utf-8_sig')\n", (614, 638), False, 'import codecs\n'), ((6... |
import os
from pathlib import Path
DB_NAME = "chatapp.db"
PROJECT_PATH = Path(__file__).parents[1]
DB_PATH = os.path.join(PROJECT_PATH, "resource", DB_NAME)
PORT_MIN = 1024
PORT_MAX = 65535
DEBUG = os.getenv("CHAT_APP_DEBUG", False)
if DEBUG:
TIMEOUT = 30
else:
TIMEOUT = 0.5
| [
"os.path.join",
"os.getenv",
"pathlib.Path"
] | [((110, 157), 'os.path.join', 'os.path.join', (['PROJECT_PATH', '"""resource"""', 'DB_NAME'], {}), "(PROJECT_PATH, 'resource', DB_NAME)\n", (122, 157), False, 'import os\n'), ((201, 235), 'os.getenv', 'os.getenv', (['"""CHAT_APP_DEBUG"""', '(False)'], {}), "('CHAT_APP_DEBUG', False)\n", (210, 235), False, 'import os\n'... |
from rest_framework import fields, serializers
from db.models.repos import Repo
class RepoSerializer(serializers.ModelSerializer):
project = fields.SerializerMethodField()
class Meta:
model = Repo
fields = ('project', 'created_at', 'updated_at', 'is_public', )
def get_user(self, obj):
... | [
"rest_framework.fields.SerializerMethodField"
] | [((148, 178), 'rest_framework.fields.SerializerMethodField', 'fields.SerializerMethodField', ([], {}), '()\n', (176, 178), False, 'from rest_framework import fields, serializers\n')] |
""" A class that can provide a date/time in any timeformat.format() format and both
local and UTC timezones within a ContextVariable.
Copyright (c) 2004 <NAME> (http://www.owlfish.com/)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided ... | [
"timeformat.format",
"re.compile",
"time.mktime",
"simpletal.simpleTALES.ContextVariable",
"time.localtime"
] | [((1745, 1786), 're.compile', 're.compile', (['"""^((?:local)|(?:utc))/?(.*)$"""'], {}), "('^((?:local)|(?:utc))/?(.*)$')\n", (1755, 1786), False, 'import re, time, math, string\n'), ((2928, 2982), 'timeformat.format', 'timeformat.format', (['strFrmt', 'timeValue'], {'utctime': 'utcTime'}), '(strFrmt, timeValue, utctim... |
from itertools import tee
import numpy as np
import scipy.interpolate as intp
from scipy.signal import savgol_filter
def get_edge_bin(array):
"""Detect the edge indcies of a binary 1-D array.
Args:
array (:class:`numpy.ndarray`): A list or Numpy 1d array, with binary
(0/1) or boolean (True... | [
"numpy.insert",
"numpy.ones_like",
"numpy.int64",
"numpy.roll",
"scipy.interpolate.InterpolatedUnivariateSpline",
"numpy.logical_and",
"numpy.where",
"numpy.diff",
"numpy.append",
"numpy.array",
"numpy.zeros",
"numpy.nonzero",
"itertools.tee",
"numpy.matrix",
"numpy.arange"
] | [((745, 760), 'numpy.int64', 'np.int64', (['array'], {}), '(array)\n', (753, 760), True, 'import numpy as np\n'), ((774, 797), 'numpy.insert', 'np.insert', (['array1', '(0)', '(0)'], {}), '(array1, 0, 0)\n', (783, 797), True, 'import numpy as np\n'), ((811, 831), 'numpy.append', 'np.append', (['array1', '(0)'], {}), '(... |
from subprocess import check_output
def isrunning(processName):
tasklist = check_output('tasklist', shell=False)
tasklist = str(tasklist)
return(processName in tasklist) | [
"subprocess.check_output"
] | [((80, 117), 'subprocess.check_output', 'check_output', (['"""tasklist"""'], {'shell': '(False)'}), "('tasklist', shell=False)\n", (92, 117), False, 'from subprocess import check_output\n')] |
from ctypes import *
import threading
import json
import os
import arcpy
class MyBuffer(threading.local):
def __init__(self):
self.buf = create_string_buffer(65535)
self.bufSize = sizeof(self.buf)
#arcpy.AddMessage("Created new Buffer {}".format(self.buf))
tls_var = MyBuffer()
from .G2Exception import ... | [
"arcpy.AddMessage"
] | [((2350, 2400), 'arcpy.AddMessage', 'arcpy.AddMessage', (['"""Initializing G2 Config Manager"""'], {}), "('Initializing G2 Config Manager')\n", (2366, 2400), False, 'import arcpy\n'), ((3374, 3504), 'arcpy.AddMessage', 'arcpy.AddMessage', (['"""ERROR: Unable to load G2. Did you remember to setup your environment by so... |
import pytest
import numpy as np
from ebbef2p.structure import Structure
L = 2
E = 1
I = 1
def test_center_load():
P = 100
M_max = P * L / 4 # maximum moment
S_max = P/2 # max shearing force
w_max = -P * L ** 3 / (48 * E * I) # max displacement
tolerance = 1e-6 #set a tolerance of 0.00... | [
"pytest.approx",
"ebbef2p.structure.Structure"
] | [((333, 350), 'ebbef2p.structure.Structure', 'Structure', (['"""test"""'], {}), "('test')\n", (342, 350), False, 'from ebbef2p.structure import Structure\n'), ((1213, 1230), 'ebbef2p.structure.Structure', 'Structure', (['"""test"""'], {}), "('test')\n", (1222, 1230), False, 'from ebbef2p.structure import Structure\n'),... |
"""
URLConf for OCR presets.
"""
from django.conf.urls.defaults import *
from django.contrib.auth.decorators import login_required
from ocradmin.presets import views
urlpatterns = patterns('',
(r'^builder/?$', login_required(views.builder)),
(r'^builder/(?P<pid>[^/]+)/?$', login_required(views.builder_doc_edit)),
... | [
"django.contrib.auth.decorators.login_required"
] | [((213, 242), 'django.contrib.auth.decorators.login_required', 'login_required', (['views.builder'], {}), '(views.builder)\n', (227, 242), False, 'from django.contrib.auth.decorators import login_required\n'), ((278, 316), 'django.contrib.auth.decorators.login_required', 'login_required', (['views.builder_doc_edit'], {... |
import os
import logging
from .paths import get_path
_FORMAT = '%(asctime)s:%(levelname)s:%(lineno)s:%(module)s.%(funcName)s:%(message)s'
_formatter = logging.Formatter(_FORMAT, '%H:%M:%S')
_handler = logging.StreamHandler()
_handler.setFormatter(_formatter)
logging.basicConfig(filename=os.path.join(get_path(), 'sp... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler"
] | [((154, 192), 'logging.Formatter', 'logging.Formatter', (['_FORMAT', '"""%H:%M:%S"""'], {}), "(_FORMAT, '%H:%M:%S')\n", (171, 192), False, 'import logging\n'), ((204, 227), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (225, 227), False, 'import logging\n'), ((417, 444), 'logging.getLogger', 'logg... |
from pathlib import Path
from unittest.mock import MagicMock
import pytest
from gretel_client.config import configure_session
FIXTURES = Path(__file__).parent / "fixtures"
@pytest.fixture
def get_fixture():
def _(name: str) -> Path:
return FIXTURES / name
return _
@pytest.fixture(scope="function... | [
"pytest.fixture",
"unittest.mock.MagicMock",
"pathlib.Path"
] | [((290, 336), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (304, 336), False, 'import pytest\n'), ((140, 154), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'from pathlib import Path\n'), ((391, 402), '... |
import time
from datetime import datetime, timedelta
from urllib.parse import urljoin
import requests
from bs4 import BeautifulSoup
from flask.views import MethodView
from config.setting import BOT_TOKEN
from models import User
hitcon_zeroday_base_url = "https://zeroday.hitcon.org"
hitcon_zeroday_all_url = "https://... | [
"datetime.datetime.utcnow",
"datetime.datetime.strptime",
"models.User.get_all",
"requests.get",
"bs4.BeautifulSoup",
"urllib.parse.urljoin",
"datetime.timedelta"
] | [((496, 528), 'requests.get', 'requests.get', (['hitcon_zeroday_url'], {}), '(hitcon_zeroday_url)\n', (508, 528), False, 'import requests\n'), ((540, 576), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""html.parser"""'], {}), "(r.text, 'html.parser')\n", (553, 576), False, 'from bs4 import BeautifulSoup\n'), ((7... |
# -*- coding: utf-8 -*-
from __future__ import division
import os
import pytest
from ethereum import _solidity
from ethereum._solidity import compile_file
from ethereum.utils import denoms
from pyethapp.rpc_client import JSONRPCClient
from pyethapp.jsonrpc import default_gasprice
from raiden.network.rpc.client impor... | [
"pyethapp.rpc_client.JSONRPCClient",
"raiden.utils.get_contract_path",
"raiden.utils.privatekey_to_address",
"ethereum._solidity.get_solidity",
"raiden.network.rpc.client.patch_send_transaction",
"pytest.mark.parametrize",
"raiden.network.rpc.client.decode_topic",
"pytest.mark.skipif",
"pytest.mark.... | [((519, 543), 'ethereum._solidity.get_solidity', '_solidity.get_solidity', ([], {}), '()\n', (541, 543), False, 'from ethereum import _solidity\n'), ((580, 604), 'pytest.mark.timeout', 'pytest.mark.timeout', (['(180)'], {}), '(180)\n', (599, 604), False, 'import pytest\n'), ((606, 667), 'pytest.mark.parametrize', 'pyte... |
from tkinter import messagebox, Tk, Menu, ttk
news = ['Mid Day News', 'Evening News']
features = ['Calling Farmers', 'Round About Ja', 'You and the Law', 'Get the Facts',
'Career Talk', 'Economy and you', 'Arts Page', 'Tourism Roundup',
'Jeep','Jamaica Promise', 'House Matters', 'Jamaica H... | [
"tkinter.Menu",
"tkinter.ttk.Button",
"tkinter.ttk.Frame",
"tkinter.Tk",
"tkinter.ttk.Combobox"
] | [((1223, 1227), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (1225, 1227), False, 'from tkinter import messagebox, Tk, Menu, ttk\n'), ((1304, 1336), 'tkinter.ttk.Frame', 'ttk.Frame', (['root'], {'padding': '(5, 10)'}), '(root, padding=(5, 10))\n', (1313, 1336), False, 'from tkinter import messagebox, Tk, Menu, ttk\n'), ((1612... |
import statistics
from typing import List, Tuple
import pendulum
from smart_queue.analysis import CONDITION_TABLE, CONFIGURATION_PATH
from smart_queue.analysis.classes.Patient import Patient
class Queue:
def __init__(self, open_time, close_time, iter_data=None, naive=True):
self.open_time = pendulum.par... | [
"smart_queue.analysis.classes.Patient.Patient",
"pendulum.parse"
] | [((308, 333), 'pendulum.parse', 'pendulum.parse', (['open_time'], {}), '(open_time)\n', (322, 333), False, 'import pendulum\n'), ((360, 386), 'pendulum.parse', 'pendulum.parse', (['close_time'], {}), '(close_time)\n', (374, 386), False, 'import pendulum\n'), ((4602, 4659), 'smart_queue.analysis.classes.Patient.Patient'... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['Times New Roman'] # 如果要显示中文字体,则在此处设为:SimHei
plt.rcParams['axes.unicode_minus'] = False # 显示负号
plt.figure(figsize=(10, 6))
plt.grid(linestyle="--") # 设置背景网格线为虚线
ax = plt.gca()
ax.spines['top'].set_visible(F... | [
"matplotlib.pyplot.setp",
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.title",
"matplotlib.pyplot.lege... | [((208, 235), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(10, 6)'}), '(figsize=(10, 6))\n', (218, 235), True, 'import matplotlib.pyplot as plt\n'), ((236, 260), 'matplotlib.pyplot.grid', 'plt.grid', ([], {'linestyle': '"""--"""'}), "(linestyle='--')\n", (244, 260), True, 'import matplotlib.pyplot as pl... |
import os
import sys
#import pip.utils.logging
#import pip
import socket
import tempfile
import threading
import subprocess
import xmlrpclib
import re
from cStringIO import StringIO
import sys
import shutil
import time
#import zipfile
from distutils.version import LooseVersion
if __name__ == "__main__":
import doc... | [
"docassemble.webapp.packages.models.Package",
"time.sleep",
"docassemble.webapp.packages.models.Package.id.desc",
"sys.exit",
"docassemble.base.config.daconfig.get",
"xmlrpclib.Server",
"docassemble.webapp.packages.models.Package.query.filter_by",
"re.search",
"docassemble.webapp.db_object.db.sessio... | [((722, 767), 'os.environ.get', 'os.environ.get', (['"""SUPERVISOR_SERVER_URL"""', 'None'], {}), "('SUPERVISOR_SERVER_URL', None)\n", (736, 767), False, 'import os\n'), ((1490, 1539), 'sys.stderr.write', 'sys.stderr.write', (['"""check_for_updates: starting\n"""'], {}), "('check_for_updates: starting\\n')\n", (1506, 15... |
# -*- coding: utf-8 -*-
from typing import List, Union
import pandas as pd
from sqlalchemy.orm import Session
from zvt.accounts.ccxt_account import CCXTAccount
from zvt.api.common import get_data, decode_security_id
from zvt.api.common import get_security_schema, get_kdata_schema
from zvt.domain import get_db_engine,... | [
"zvt.domain.get_db_engine",
"zvt.utils.pd_utils.df_is_not_null",
"zvt.api.common.get_security_schema",
"zvt.accounts.ccxt_account.CCXTAccount.get_ccxt_exchange",
"zvt.domain.get_db_session",
"zvt.domain.SecurityType",
"zvt.api.common.get_data",
"zvt.api.common.get_kdata_schema",
"zvt.domain.get_stor... | [((608, 642), 'zvt.api.common.get_security_schema', 'get_security_schema', (['security_type'], {}), '(security_type)\n', (627, 642), False, 'from zvt.api.common import get_security_schema, get_kdata_schema\n'), ((664, 707), 'zvt.domain.get_store_category', 'get_store_category', ([], {'data_schema': 'data_schema'}), '(d... |
import pymysql
import threading
import time
from queue import Queue
from DBUtils.PooledDB import PooledDB
import random
ini = {
'agent_id' : 10000, # 固定值,agent_id
'create_time' : '2020-3-16 9:00:00', # 固定值,create_time
'count' : 100000, # executemany每次执行多少行插入
'insert_no': 10000000, # 总插入数量
... | [
"DBUtils.PooledDB.PooledDB",
"threading.Thread",
"queue.Queue",
"time.time",
"random.randint"
] | [((379, 404), 'random.randint', 'random.randint', (['(0)', '(100000)'], {}), '(0, 100000)\n', (393, 404), False, 'import random\n'), ((550, 561), 'time.time', 'time.time', ([], {}), '()\n', (559, 561), False, 'import time\n'), ((870, 1003), 'DBUtils.PooledDB.PooledDB', 'PooledDB', (['pymysql', 'maxconnections'], {'host... |
import asyncio
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from pytz import UnknownTimeZoneError, utc
from tradingsignal.utils import ts_logging
# Don't use this directly. Use scheduler() instead.
_scheduler = None
async def scheduler() -> AsyncIOScheduler:
"""Return apscheduler instance."""
... | [
"asyncio.get_event_loop",
"tradingsignal.utils.ts_logging.raise_warning"
] | [((510, 628), 'tradingsignal.utils.ts_logging.raise_warning', 'ts_logging.raise_warning', (['"""apscheduler could not find a timezone configuration and added to default to utc."""'], {}), "(\n 'apscheduler could not find a timezone configuration and added to default to utc.'\n )\n", (534, 628), False, 'from tradi... |
"""This package provides compatibility interfaces for v1/v2."""
import cStringIO
import gzip
import hashlib
import json
from containerregistry.client.v2 import docker_image as v2_image
from containerregistry.client.v2 import util as v2_util
from containerregistry.client.v2_2 import docker_http
from containerregistr... | [
"hashlib.sha256",
"cStringIO.StringIO",
"json.loads",
"json.dumps",
"gzip.GzipFile"
] | [((1123, 1155), 'json.loads', 'json.loads', (['raw_manifest_schema1'], {}), '(raw_manifest_schema1)\n', (1133, 1155), False, 'import json\n'), ((2836, 2870), 'json.dumps', 'json.dumps', (['config'], {'sort_keys': '(True)'}), '(config, sort_keys=True)\n', (2846, 2870), False, 'import json\n'), ((3269, 3313), 'json.dumps... |
# -*- coding: utf-8 -*-
"""Functions from market data"""
__author__ = "<NAME>"
__version__ = "1"
import numpy as np
from pyquanttrade.engine.utils import (
max_drawdown_ratio,
max_drawdown_value,
safe_div,
safe_min,
safe_sum,
safe_mean,
)
from pyquanttrade.engine.test_summary import TestSummar... | [
"pyquanttrade.engine.test_summary.TestSummary",
"pyquanttrade.engine.stats.daily_stats.DailyStats",
"pyquanttrade.engine.stats.summary_stats.SystemSummaryStats"
] | [((661, 698), 'pyquanttrade.engine.stats.daily_stats.DailyStats', 'DailyStats', (['data_sim', 'ticker', 'capital'], {}), '(data_sim, ticker, capital)\n', (671, 698), False, 'from pyquanttrade.engine.stats.daily_stats import DailyStats\n'), ((1041, 1070), 'pyquanttrade.engine.stats.summary_stats.SystemSummaryStats', 'Sy... |
from __future__ import print_function
import os
import unittest
from .test_base_column_profilers import AbstractTestColumnProfiler
from dataprofiler.profilers.column_profile_compilers import \
ColumnPrimitiveTypeProfileCompiler
test_root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
cla... | [
"unittest.main",
"os.path.realpath"
] | [((737, 752), 'unittest.main', 'unittest.main', ([], {}), '()\n', (750, 752), False, 'import unittest\n'), ((286, 312), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (302, 312), False, 'import os\n')] |
#!/usr/bin/env python
# noinspection PyUnresolvedReferences
import vtkmodules.vtkRenderingOpenGL2
from vtkmodules.vtkIOImage import vtkImageReader2Factory
from vtkmodules.vtkImagingMorphological import (
vtkImageDilateErode3D,
vtkImageSeedConnectivity
)
from vtkmodules.vtkInteractionStyle import vtkInteractorS... | [
"vtkmodules.vtkImagingMorphological.vtkImageDilateErode3D",
"vtkmodules.vtkInteractionStyle.vtkInteractorStyleImage",
"argparse.ArgumentParser",
"vtkmodules.vtkRenderingCore.vtkImageActor",
"vtkmodules.vtkRenderingCore.vtkRenderWindow",
"vtkmodules.vtkRenderingCore.vtkRenderWindowInteractor",
"vtkmodule... | [((591, 615), 'vtkmodules.vtkIOImage.vtkImageReader2Factory', 'vtkImageReader2Factory', ([], {}), '()\n', (613, 615), False, 'from vtkmodules.vtkIOImage import vtkImageReader2Factory\n'), ((752, 775), 'vtkmodules.vtkImagingMorphological.vtkImageDilateErode3D', 'vtkImageDilateErode3D', ([], {}), '()\n', (773, 775), Fals... |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests that check if both the debug and the release builds pass."""
import itertools
import os
import pytest
import host_tools.cargo_build as host # pylint:disable=import-error
FEATURES = ["", "vsock"]
... | [
"itertools.product",
"os.path.join",
"host_tools.cargo_build.cargo_build"
] | [((1126, 1177), 'os.path.join', 'os.path.join', (['host.CARGO_BUILD_REL_PATH', 'build_type'], {}), '(host.CARGO_BUILD_REL_PATH, build_type)\n', (1138, 1177), False, 'import os\n'), ((1333, 1379), 'os.path.join', 'os.path.join', (['test_session_root_path', 'rel_path'], {}), '(test_session_root_path, rel_path)\n', (1345,... |
import os
import json
from collections import OrderedDict
import paramiko
from stat import S_ISDIR
paramiko.util.log_to_file("paramiko.log")
def get_path_out(path_out):
os.chdir(r'..')
root = os.getcwd()
path_out = os.path.join(root, path_out)
return path_out
def read_connection(input_file):
try... | [
"paramiko.SFTPClient.from_transport",
"os.path.exists",
"stat.S_ISDIR",
"paramiko.util.log_to_file",
"os.makedirs",
"os.path.join",
"paramiko.Transport",
"os.getcwd",
"os.chdir",
"json.load"
] | [((99, 140), 'paramiko.util.log_to_file', 'paramiko.util.log_to_file', (['"""paramiko.log"""'], {}), "('paramiko.log')\n", (124, 140), False, 'import paramiko\n'), ((175, 189), 'os.chdir', 'os.chdir', (['""".."""'], {}), "('..')\n", (183, 189), False, 'import os\n'), ((202, 213), 'os.getcwd', 'os.getcwd', ([], {}), '()... |
__author__ = 'keithd'
from time import sleep
import random
import imager2 as IMR
from reflectance_sensors import ReflectanceSensors
from camera import Camera
from motors import Motors
from ultrasonic import Ultrasonic
from zumo_button import ZumoButton
## BE SURE TO RUN THESE DEMOS ON THE FLOOR or to have plenty of ... | [
"zumo_button.ZumoButton",
"random.choice",
"camera.Camera",
"time.sleep",
"motors.Motors",
"ultrasonic.Ultrasonic",
"reflectance_sensors.ReflectanceSensors"
] | [((523, 531), 'motors.Motors', 'Motors', ([], {}), '()\n', (529, 531), False, 'from motors import Motors\n'), ((964, 972), 'motors.Motors', 'Motors', ([], {}), '()\n', (970, 972), False, 'from motors import Motors\n'), ((978, 990), 'ultrasonic.Ultrasonic', 'Ultrasonic', ([], {}), '()\n', (988, 990), False, 'from ultras... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os.path
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.contrib.sites.shortcuts import get_current_site
from django.db import models
from .forms import LatestEntriesFo... | [
"django.db.models.Q",
"cms.plugin_pool.plugin_pool.register_plugin",
"django.contrib.sites.shortcuts.get_current_site"
] | [((5593, 5645), 'cms.plugin_pool.plugin_pool.register_plugin', 'plugin_pool.register_plugin', (['BlogLatestEntriesPlugin'], {}), '(BlogLatestEntriesPlugin)\n', (5620, 5645), False, 'from cms.plugin_pool import plugin_pool\n'), ((5646, 5704), 'cms.plugin_pool.plugin_pool.register_plugin', 'plugin_pool.register_plugin', ... |
from __future__ import print_function, absolute_import
import vtk
from fem.utilities import MrSignal
from ..picking import PickingManager
from ...vtk_graphics import VTKGraphics
from ...vtk_graphics.rendering import (
vtkPVInteractorStyle, vtkPVTrackballPan, vtkPVTrackballRotate, vtkPVTrackballZoom, vtkCameraMani... | [
"fem.utilities.MrSignal"
] | [((1718, 1728), 'fem.utilities.MrSignal', 'MrSignal', ([], {}), '()\n', (1726, 1728), False, 'from fem.utilities import MrSignal\n')] |
import datetime
import uuid
from bson import json_util
from ..db_init import db, FlaskDocument
from flask_mongoengine import BaseQuerySet
from ..models.user import User
job_status = ("Open", "Closed")
class CustomQuerySet(BaseQuerySet):
def to_json(self):
return "[%s]" % (",".join([doc.to_json() for doc ... | [
"datetime.datetime.now",
"bson.json_util.dumps"
] | [((953, 974), 'bson.json_util.dumps', 'json_util.dumps', (['data'], {}), '(data)\n', (968, 974), False, 'from bson import json_util\n'), ((636, 659), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (657, 659), False, 'import datetime\n')] |
"""Option helper functions"""
__docformat__ = "numpy"
import argparse
from typing import List
import pandas as pd
import numpy as np
from gamestonk_terminal.helper_funcs import (
parse_known_args_and_warn,
check_non_negative,
)
# pylint: disable=R1710
def load(other_args: List[str]) -> str:
"""Load ti... | [
"numpy.array",
"gamestonk_terminal.helper_funcs.parse_known_args_and_warn",
"argparse.ArgumentParser"
] | [((491, 657), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'add_help': '(False)', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'prog': '"""opload"""', 'description': '"""Load a ticker into option menu"""'}), "(add_help=False, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, p... |
import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... | [
"data_export.pipeline.dataset.Dataset",
"pandas.testing.assert_frame_equal",
"unittest.mock.MagicMock",
"pandas.DataFrame"
] | [((248, 259), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (257, 259), False, 'from unittest.mock import MagicMock\n'), ((343, 354), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (352, 354), False, 'from unittest.mock import MagicMock\n'), ((427, 438), 'unittest.mock.MagicMock', 'MagicMock', ([... |
# -*- coding: utf-8 -*-
from bamboo_engine.builder import * # noqa
from bamboo_engine.engine import Engine
from pipeline.eri.runtime import BambooDjangoRuntime
from ..utils import * # noqa
def test_retry_subprocess():
subproc_start = EmptyStartEvent()
subproc_act = ServiceActivity(component_code="debug_no... | [
"pipeline.eri.runtime.BambooDjangoRuntime"
] | [((728, 749), 'pipeline.eri.runtime.BambooDjangoRuntime', 'BambooDjangoRuntime', ([], {}), '()\n', (747, 749), False, 'from pipeline.eri.runtime import BambooDjangoRuntime\n')] |
#
# Copyright (c) 2018 Via Technology Ltd. All Rights Reserved.
# Consult your license regarding permissions and restrictions.
#
"""
operations related to airspaces and intersections.
"""
from psycopg2 import Error, InternalError
from psycopg2.extensions import AsIs
from psycopg2.extras import DictCursor
from itertoo... | [
"functools.reduce",
"pru.logger.logger",
"shapely.wkt.loads",
"psycopg2.extensions.AsIs"
] | [((467, 483), 'pru.logger.logger', 'logger', (['__name__'], {}), '(__name__)\n', (473, 483), False, 'from pru.logger import logger\n'), ((15759, 15812), 'functools.reduce', 'reduce', (['merge_l_t', 'intersection_details', '[[], [], []]'], {}), '(merge_l_t, intersection_details, [[], [], []])\n', (15765, 15812), False, ... |
from django.urls import path
from .views import (
product_orders_modal,
make_product_purchase,
allocate_product_to_order,
receive_product_stock,
ProductListView,
product_add_to_purchase,
product_search,
)
app_name = "products"
urlpatterns = [
path('', ProductListView.as_view(), name="... | [
"django.urls.path"
] | [((340, 394), 'django.urls.path', 'path', (['"""search/"""', 'product_search'], {'name': '"""product-search"""'}), "('search/', product_search, name='product-search')\n", (344, 394), False, 'from django.urls import path\n'), ((400, 498), 'django.urls.path', 'path', (['"""add-to-purchase/<uuid:guid>/"""', 'product_add_t... |
#!/usr/bin/env python3.6
import os
import asyncio
from time import time
import chevron
import uvloop
from aiohttp import web, ClientError, ClientSession
from aiohttp_session import SimpleCookieStorage, get_session
from aiohttp_session import setup as session_setup
from arq import Actor, BaseWorker, RedisSettings, conc... | [
"aiohttp.web.run_app",
"aiohttp.ClientSession",
"os.getenv",
"aiohttp.web.HTTPFound",
"aiohttp.web.Response",
"aiohttp.web.Application",
"aiohttp_session.get_session",
"uvloop.EventLoopPolicy",
"aiohttp_session.SimpleCookieStorage",
"time.time"
] | [((379, 403), 'uvloop.EventLoopPolicy', 'uvloop.EventLoopPolicy', ([], {}), '()\n', (401, 403), False, 'import uvloop\n'), ((2275, 2324), 'aiohttp.web.Response', 'web.Response', ([], {'text': 'html', 'content_type': '"""text/html"""'}), "(text=html, content_type='text/html')\n", (2287, 2324), False, 'from aiohttp impor... |
#!/usr/bin/env python3
# Copyright Istio 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 ag... | [
"logging.basicConfig",
"runner.cluster.set_up_if_not_exists",
"runner.config.from_toml_file",
"argparse.ArgumentParser",
"runner.entrypoint.extract_name",
"runner.mesh.for_state"
] | [((805, 880), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'log_level', 'format': '"""%(levelname)s\t> %(message)s"""'}), "(level=log_level, format='%(levelname)s\\t> %(message)s')\n", (824, 880), False, 'import logging\n'), ((895, 931), 'runner.config.from_toml_file', 'cfg.from_toml_file', (['args.conf... |
from functools import lru_cache
class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
@lru_cache(None)
def helper(b,e):
print(b,e)
if b > e : return 0
if b == e : return 1
if s[b] == s[e] :
return helper(b+1,e-1) + 2
... | [
"functools.lru_cache"
] | [((112, 127), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (121, 127), False, 'from functools import lru_cache\n')] |
from django.shortcuts import render
from decouple import config
from .models import Images
# Create your views here.
def index(request, **kwargs):
"""
Render single page application and provide context data.
:param request:
:param kwargs:
:return:
"""
context = {
'images': Images... | [
"django.shortcuts.render",
"decouple.config"
] | [((483, 528), 'django.shortcuts.render', 'render', (['request', '"""spa/main_SPA.html"""', 'context'], {}), "(request, 'spa/main_SPA.html', context)\n", (489, 528), False, 'from django.shortcuts import render\n'), ((375, 407), 'decouple.config', 'config', (['"""googleForm"""'], {'default': '""""""'}), "('googleForm', d... |
# Copyright 2021-present citharus
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use utils.py 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 ... | [
"azury.utils.parse_iso"
] | [((2444, 2472), 'azury.utils.parse_iso', 'parse_iso', (["data['updatedAt']"], {}), "(data['updatedAt'])\n", (2453, 2472), False, 'from azury.utils import parse_iso\n'), ((3235, 3263), 'azury.utils.parse_iso', 'parse_iso', (["data['createdAt']"], {}), "(data['createdAt'])\n", (3244, 3263), False, 'from azury.utils impor... |
# -*- coding: utf-8 -*-
"""
chemdataextractor.tests.test_reader_els.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test reader for Elsevier.
<NAME> (<EMAIL>)
"""
import unittest
import logging
import io
import os
from chemdataextractor import Document
from chemdataextractor.reader.elsevier import ElsevierXmlReader
log = loggi... | [
"logging.getLogger",
"os.path.dirname",
"unittest.main",
"chemdataextractor.reader.elsevier.ElsevierXmlReader"
] | [((315, 342), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (332, 342), False, 'import logging\n'), ((1582, 1597), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1595, 1597), False, 'import unittest\n'), ((536, 555), 'chemdataextractor.reader.elsevier.ElsevierXmlReader', 'ElsevierX... |
#!/usr/bin/env python
import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
import sys
# create pipeline - structured grid
#
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName("" + str(VTK_DATA_ROOT) + "/Data/combxyz.bin")
pl3d.SetQFileName("" + str(VTK_DATA_ROOT) + "/Data/combq.... | [
"vtk.util.misc.vtkGetDataRoot",
"vtk.vtkIntArray",
"vtk.vtkRenderWindowInteractor",
"vtk.vtkRectilinearGridReader",
"vtk.vtkGeometryFilter",
"vtk.vtkPolyDataMapper",
"vtk.vtkActor",
"vtk.vtkRenderWindow",
"vtk.vtkPoints",
"vtk.vtkRenderer",
"sys.exit",
"vtk.vtkExtractGeometry",
"vtk.vtkSpher... | [((90, 106), 'vtk.util.misc.vtkGetDataRoot', 'vtkGetDataRoot', ([], {}), '()\n', (104, 106), False, 'from vtk.util.misc import vtkGetDataRoot\n'), ((164, 195), 'vtk.vtkMultiBlockPLOT3DReader', 'vtk.vtkMultiBlockPLOT3DReader', ([], {}), '()\n', (193, 195), False, 'import vtk\n'), ((451, 474), 'vtk.vtkGeometryFilter', 'v... |
"""
Our modification of the OpenAI Gym Continuous Mountain Car by <NAME>:
https://github.com/openai/gym/blob/master/gym/envs/classic_control/continuous_mountain_car.py
which was (ultimately) based on Sutton's implementation:
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
"""
from pilco.errors import En... | [
"numpy.clip",
"gym.envs.classic_control.rendering.make_circle",
"gym.envs.classic_control.rendering.Line",
"gym.spaces.Box",
"numpy.array",
"gym.envs.classic_control.rendering.Viewer",
"numpy.linspace",
"gym.envs.classic_control.rendering.Transform",
"numpy.cos",
"pilco.errors.EnvironmentError",
... | [((903, 967), 'numpy.array', 'np.array', (['[self.min_position, -self.max_speed]'], {'dtype': 'np.float32'}), '([self.min_position, -self.max_speed], dtype=np.float32)\n', (911, 967), True, 'import numpy as np\n'), ((1029, 1092), 'numpy.array', 'np.array', (['[self.max_position, self.max_speed]'], {'dtype': 'np.float32... |
import socket
import sys
ESP_IP = '192.168.7.1'
PORT = 10000
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print('try to connect')
sock.connect((ESP_IP, PORT))
print('connected...')
data = sock.recv(255)
print('msg: ', data.decode())
sock.close()
| [
"socket.socket"
] | [((70, 119), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (83, 119), False, 'import socket\n')] |
from algoliaqb import AlgoliaQueryBuilder
def test_normal_filters():
aqb = AlgoliaQueryBuilder(
search_param="search",
filter_map={
"is_reported": "is_reported"
}
)
flask_request_args = {
"is_reported": True
}
filter_query = aqb.get_filter_query(flask_... | [
"algoliaqb.AlgoliaQueryBuilder"
] | [((81, 170), 'algoliaqb.AlgoliaQueryBuilder', 'AlgoliaQueryBuilder', ([], {'search_param': '"""search"""', 'filter_map': "{'is_reported': 'is_reported'}"}), "(search_param='search', filter_map={'is_reported':\n 'is_reported'})\n", (100, 170), False, 'from algoliaqb import AlgoliaQueryBuilder\n'), ((422, 599), 'algol... |
from pybox.inject import Inject, InjectLazy
from pybox.service import IService, ServiceMode
class SingletonService(IService):
def who_am_i(self):
print(f'Singleton {id(self)}')
class FactoryService(IService):
singleton = Inject(SingletonService)
@classmethod
def service_mode(self):
... | [
"pybox.inject.Inject",
"pybox.inject.InjectLazy"
] | [((241, 265), 'pybox.inject.Inject', 'Inject', (['SingletonService'], {}), '(SingletonService)\n', (247, 265), False, 'from pybox.inject import Inject, InjectLazy\n'), ((437, 461), 'pybox.inject.Inject', 'Inject', (['SingletonService'], {}), '(SingletonService)\n', (443, 461), False, 'from pybox.inject import Inject, I... |
""" Method for data manipulation in the mock db """
from flask import jsonify
from marshmallow import ValidationError
from app.api.model.party import Party
from app.api.util.dto import party_schema, parties_schema
from app.api.db.database import AppDatabase as db
def save_new_party(json_data):
"""saves a new par... | [
"app.api.model.party.Party.add_party",
"app.api.util.dto.parties_schema.dump",
"app.api.model.party.Party.get_parties_query",
"flask.jsonify",
"app.api.model.party.Party.update_party",
"app.api.db.database.AppDatabase",
"app.api.util.dto.party_schema.dump",
"app.api.model.party.Party.delete_party",
... | [((912, 947), 'app.api.model.party.Party.get_party_by_name', 'Party.get_party_by_name', (['party_name'], {}), '(party_name)\n', (935, 947), False, 'from app.api.model.party import Party\n'), ((2057, 2083), 'app.api.model.party.Party.get_party_by_id', 'Party.get_party_by_id', (['_id'], {}), '(_id)\n', (2078, 2083), Fals... |
import meraki, datetime, json, requests, os.path, shutil, time, threading, os, sys
from config_meraki import *
from video import *
from os import path
sys.path.append(os.path.abspath('..'))
from config_shared import meraki_api_key
#Local path to save Images
rooting = os.path.abspath(os.getcwd()) + "/mask-detection"
... | [
"os.path.exists",
"shutil.copyfileobj",
"datetime.datetime.strptime",
"json.dumps",
"os.path.join",
"time.sleep",
"requests.get",
"requests.request",
"os.getcwd",
"datetime.datetime.now",
"os.path.abspath",
"datetime.timedelta",
"datetime.datetime.strftime",
"meraki.DashboardAPI"
] | [((169, 190), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {}), "('..')\n", (184, 190), False, 'import meraki, datetime, json, requests, os.path, shutil, time, threading, os, sys\n'), ((1291, 1314), 'os.path.exists', 'path.exists', (['statusfile'], {}), '(statusfile)\n', (1302, 1314), False, 'from os import pat... |
import argparse
from readers import generics, facebook, telegram, discord
from visualization import visualization as viz
parser = argparse.ArgumentParser(
description='Reads messages from various social medias and generates plots.'
)
# Add command line parameters
generics.init(parser)
facebook.init(parser)
telegr... | [
"readers.generics.df_from_list",
"readers.telegram.init",
"readers.facebook.init",
"visualization.visualization.init",
"readers.telegram.parse",
"argparse.ArgumentParser",
"readers.discord.parse",
"visualization.visualization.display",
"readers.generics.init",
"readers.facebook.parse",
"readers.... | [((131, 237), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Reads messages from various social medias and generates plots."""'}), "(description=\n 'Reads messages from various social medias and generates plots.')\n", (154, 237), False, 'import argparse\n'), ((270, 291), 'readers.gene... |
# Export Nexus device show interface brief command output to
# an Excel file
import json
import xlsxwriter
from netmiko import ConnectHandler
# Devices to SSH into
devices = [
{
"device_type": "cisco_nxos",
"ip": "sbx-nxos-mgmt.cisco.com",
"username": "admin",
"password": "<PASSWO... | [
"netmiko.ConnectHandler",
"xlsxwriter.Workbook",
"json.dump"
] | [((945, 1008), 'xlsxwriter.Workbook', 'xlsxwriter.Workbook', ([], {'filename': '"""Ex4-Nexus-Interfaces-Brief.xlsx"""'}), "(filename='Ex4-Nexus-Interfaces-Brief.xlsx')\n", (964, 1008), False, 'import xlsxwriter\n'), ((1123, 1147), 'netmiko.ConnectHandler', 'ConnectHandler', ([], {}), '(**device)\n', (1137, 1147), False... |
from reliability.Reliability_testing import one_sample_proportion
result = one_sample_proportion(trials=30, successes=29)
print(result)
'''
(0.8278305443665873, 0.9991564290733695)
'''
| [
"reliability.Reliability_testing.one_sample_proportion"
] | [((75, 121), 'reliability.Reliability_testing.one_sample_proportion', 'one_sample_proportion', ([], {'trials': '(30)', 'successes': '(29)'}), '(trials=30, successes=29)\n', (96, 121), False, 'from reliability.Reliability_testing import one_sample_proportion\n')] |
#!/usr/bin/env python3
# coding: utf-8
"""The game logic.
This should be independent of media used to interact with player."""
from typing import Tuple, List, Set, Dict
from const import PLAYER_SHIFT, LAST_ON_PATH, END_PROGRESS
from piece import Piece
from player import Player
from util import progress_to_positio... | [
"piece.Piece",
"action.roll_dice"
] | [((544, 572), 'piece.Piece', 'Piece', (['player_num', 'piece_num'], {}), '(player_num, piece_num)\n', (549, 572), False, 'from piece import Piece\n'), ((2014, 2037), 'action.roll_dice', 'roll_dice', ([], {'player_num': 'i'}), '(player_num=i)\n', (2023, 2037), False, 'from action import roll_dice\n')] |
import copy
import logging
from abc import ABC
from typing import Dict, Optional, Type, Union
import torch
from pytorch_lightning import LightningModule
from torch.nn.modules import Module
from torch.utils.data import DataLoader
from .generic_model import GenericModel
from .lightning_model import LightningModel
logg... | [
"logging.getLogger",
"torch.no_grad",
"torch.stack",
"torch.cat"
] | [((325, 344), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (342, 344), False, 'import logging\n'), ((1361, 1376), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1374, 1376), False, 'import torch\n'), ((1732, 1756), 'torch.stack', 'torch.stack', (['predictions'], {}), '(predictions)\n', (1743, 1756)... |
""" CUDA / AMP utils
Hacked together by / Copyright 2020 <NAME>
"""
import torch
from typing import Any
from theseus.utilities.loggers.observer import LoggerObserver
LOGGER = LoggerObserver.getLogger('main')
def get_devices_info(device_names="0"):
if device_names.startswith('cuda'):
device_names = device... | [
"theseus.utilities.loggers.observer.LoggerObserver.getLogger",
"torch.device",
"torch.is_tensor",
"torch.cuda.is_available",
"torch.cuda.get_device_properties"
] | [((176, 208), 'theseus.utilities.loggers.observer.LoggerObserver.getLogger', 'LoggerObserver.getLogger', (['"""main"""'], {}), "('main')\n", (200, 208), False, 'from theseus.utilities.loggers.observer import LoggerObserver\n'), ((911, 929), 'torch.device', 'torch.device', (['name'], {}), '(name)\n', (923, 929), False, ... |