code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pystan
import pickle
from models.stan_dlm_models import *
model_vanilla_ar1 = pystan.StanModel(model_code=dlm_vanilla_ar1)
f = open('models/dlm_vanilla_ar1.pkl', 'wb')
pickle.dump(model_vanilla_ar1, f)
f.close()
model_vanilla_ar2 = pystan.StanModel(model_code=dlm_vanilla_ar2)
f = open('models/dlm_vanilla_ar2.p... | [
"pickle.dump",
"pystan.StanModel"
] | [((86, 130), 'pystan.StanModel', 'pystan.StanModel', ([], {'model_code': 'dlm_vanilla_ar1'}), '(model_code=dlm_vanilla_ar1)\n', (102, 130), False, 'import pystan\n'), ((176, 209), 'pickle.dump', 'pickle.dump', (['model_vanilla_ar1', 'f'], {}), '(model_vanilla_ar1, f)\n', (187, 209), False, 'import pickle\n'), ((241, 28... |
import string
from functools import partial as p
from pathlib import Path
from textwrap import dedent
import pytest
from tests.helpers.agent import Agent
from tests.helpers.assertions import has_datapoint_with_dim, tcp_socket_open
from tests.helpers.kubernetes.utils import get_discovery_rule, run_k8s_monitors_test, g... | [
"textwrap.dedent",
"functools.partial",
"string.Template",
"tests.helpers.kubernetes.utils.get_discovery_rule",
"tests.helpers.util.run_service",
"tests.helpers.util.container_ip",
"pathlib.Path",
"tests.helpers.kubernetes.utils.get_metrics",
"tests.helpers.kubernetes.utils.run_k8s_monitors_test"
] | [((509, 635), 'string.Template', 'string.Template', (['"""\nmonitors:\n - type: collectd/health-checker\n host: $host\n port: 80\n tcpCheck: true\n"""'], {}), '(\n """\nmonitors:\n - type: collectd/health-checker\n host: $host\n port: 80\n tcpCheck: true\n"""\n )\n', (524, 635), False, 'import... |
from dace.config import Config
Config.set("compiler", "cpu", "libs", value="papi",autosave=True)
| [
"dace.config.Config.set"
] | [((32, 98), 'dace.config.Config.set', 'Config.set', (['"""compiler"""', '"""cpu"""', '"""libs"""'], {'value': '"""papi"""', 'autosave': '(True)'}), "('compiler', 'cpu', 'libs', value='papi', autosave=True)\n", (42, 98), False, 'from dace.config import Config\n')] |
from tkinter.messagebox import askyesno
def quit_popup():
"""
Quit action confirmation
:return: Boolean representing confirmation
"""
return askyesno(title='Confirm exit', message='Are you sure you want to exit?')
| [
"tkinter.messagebox.askyesno"
] | [((163, 235), 'tkinter.messagebox.askyesno', 'askyesno', ([], {'title': '"""Confirm exit"""', 'message': '"""Are you sure you want to exit?"""'}), "(title='Confirm exit', message='Are you sure you want to exit?')\n", (171, 235), False, 'from tkinter.messagebox import askyesno\n')] |
"""Control IoT device by reading sensor values and writing data to disk."""
from __future__ import annotations
import os
import asyncio
from datetime import datetime
from bairy.device.validate import DeviceConfigs
from bairy.device.configs import DATA_PATH, load_device
from bairy.log_configs import DATE_FORMAT
from ba... | [
"asyncio.sleep",
"os.path.exists",
"bairy.device.configs.load_device",
"datetime.datetime.now",
"bairy.device.sensor.Sensor"
] | [((1224, 1249), 'os.path.exists', 'os.path.exists', (['DATA_PATH'], {}), '(DATA_PATH)\n', (1238, 1249), False, 'import os\n'), ((1495, 1508), 'bairy.device.configs.load_device', 'load_device', ([], {}), '()\n', (1506, 1508), False, 'from bairy.device.configs import DATA_PATH, load_device\n'), ((1522, 1531), 'bairy.devi... |
#!/usr/bin/env python3
import mariadb
from flask import Flask, jsonify
app = Flask(__name__)
app.config.from_json('config.json')
config = {
'port': 3306,
'user': 'awendelk',
'host': app.config['MARIADB_HOST'],
'password': app.config['<PASSWORD>'],
'database': 'demo'
}
@app.route('/', methods=... | [
"flask.jsonify",
"flask.Flask",
"mariadb.connect"
] | [((81, 96), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (86, 96), False, 'from flask import Flask, jsonify\n'), ((470, 495), 'mariadb.connect', 'mariadb.connect', ([], {}), '(**config)\n', (485, 495), False, 'import mariadb\n'), ((869, 887), 'flask.jsonify', 'jsonify', (['json_data'], {}), '(json_data)\... |
'''
* Copyright (C) 2019-2020 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
'''
from http import HTTPStatus
import connexion
from vaserving.common.utils import logging
from vaserving.vaserving import VAServing
logger = logging.get_logger('Default Controller', is_static=True)
bad_request_response = ... | [
"vaserving.vaserving.VAServing.pipeline_manager.get_instance_parameters",
"vaserving.vaserving.VAServing.pipeline_manager.get_pipeline_parameters",
"connexion.request.get_json",
"vaserving.vaserving.VAServing.pipeline_manager.get_loaded_pipelines",
"vaserving.vaserving.VAServing.pipeline_manager.stop_instan... | [((238, 294), 'vaserving.common.utils.logging.get_logger', 'logging.get_logger', (['"""Default Controller"""'], {'is_static': '(True)'}), "('Default Controller', is_static=True)\n", (256, 294), False, 'from vaserving.common.utils import logging\n'), ((558, 601), 'vaserving.vaserving.VAServing.model_manager.get_loaded_m... |
"""
Helper classes for the management of subscription and unsubscription of the
Items handled by the Remote Data Adapter.
"""
from contextlib import contextmanager
import threading
from _collections import deque
from lightstreamer_adapter.protocol import RemotingException
from . import DATA_PROVIDER_LOGGER
class _I... | [
"threading.Lock",
"threading.RLock",
"_collections.deque"
] | [((980, 987), '_collections.deque', 'deque', ([], {}), '()\n', (985, 987), False, 'from _collections import deque\n'), ((1067, 1083), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1081, 1083), False, 'import threading\n'), ((6721, 6738), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (6736, 6738), Fal... |
"""
A store has a dict-like interface to get and set data that a consumer wants to persist between program restarts e.g. the current :mod:`Readings <snsary.models.reading>` in a :mod:`Window <snsary.functions.window>`. This module provides a ``get_storage`` function and a ``HasStore`` trait to make it easy access to pe... | [
"os.environ.get",
"atexit.register",
"cachetools.cached"
] | [((1668, 1678), 'cachetools.cached', 'cached', (['{}'], {}), '({})\n', (1674, 1678), False, 'from cachetools import TTLCache, cached\n'), ((1829, 1863), 'os.environ.get', 'os.environ.get', (['"""STORAGE_PATH"""', '""""""'], {}), "('STORAGE_PATH', '')\n", (1843, 1863), False, 'import os\n'), ((2012, 2048), 'os.environ.g... |
import firebase_admin
import jsonpickle as jsonpickle
from firebase_admin import credentials, firestore
from doc_lms.settings import firebase_admin_config_credentials
cred = credentials.Certificate(jsonpickle.encode(firebase_admin_config_credentials))
firebase_admin.initialize_app(cred)
db = firestore.client()
| [
"firebase_admin.initialize_app",
"firebase_admin.firestore.client",
"jsonpickle.encode"
] | [((254, 289), 'firebase_admin.initialize_app', 'firebase_admin.initialize_app', (['cred'], {}), '(cred)\n', (283, 289), False, 'import firebase_admin\n'), ((296, 314), 'firebase_admin.firestore.client', 'firestore.client', ([], {}), '()\n', (312, 314), False, 'from firebase_admin import credentials, firestore\n'), ((20... |
# -*- coding: utf-8 -*-
import colorsys
import csv
import json
import math
import os
def distance(p0, p1):
return math.sqrt((p0[0] - p1[0])**2 + (p0[1] - p1[1])**2)
def distance3(p0, p1):
x = p1[0] - p0[0]
y = p1[1] - p0[1]
z = p1[2] - p0[2]
return math.sqrt(x**2 + y**2 + z**2)
def hex2hsv(hex):... | [
"colorsys.rgb_to_hsv",
"json.load",
"math.sqrt",
"math.atan2",
"csv.DictReader",
"math.sin",
"os.path.isfile",
"math.cos"
] | [((120, 174), 'math.sqrt', 'math.sqrt', (['((p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2)'], {}), '((p0[0] - p1[0]) ** 2 + (p0[1] - p1[1]) ** 2)\n', (129, 174), False, 'import math\n'), ((272, 307), 'math.sqrt', 'math.sqrt', (['(x ** 2 + y ** 2 + z ** 2)'], {}), '(x ** 2 + y ** 2 + z ** 2)\n', (281, 307), False, 'import... |
# -*- coding: utf-8 -*-
from collections import Counter, deque
import cv2 as cv
from sklearn.utils._joblib import load
RECTANGLE_COLOR = (69, 53, 220)
TEXT_COLOR = (41, 37, 33)
NUMBER_OF_ROIS = 29
Q_KEY = ord('q')
W_KEY = ord('w')
E_KEY = ord('e')
ESC_KEY = 27
def putText(frame, text):
cv.putText(frame, text... | [
"cv2.createBackgroundSubtractorMOG2",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"sklearn.utils._joblib.load",
"cv2.rectangle",
"cv2.flip",
"cv2.destroyAllWindows",
"collections.deque"
] | [((398, 418), 'sklearn.utils._joblib.load', 'load', (['"""model.joblib"""'], {}), "('model.joblib')\n", (402, 418), False, 'from sklearn.utils._joblib import load\n'), ((430, 448), 'cv2.VideoCapture', 'cv.VideoCapture', (['(1)'], {}), '(1)\n', (445, 448), True, 'import cv2 as cv\n'), ((552, 587), 'cv2.createBackgroundS... |
from keras import applications
import keras
import numpy as np
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
import matplotlib.pyplot as plt
from keras.applications.imagenet_utils import decode_predictions
import os
from keras.models import model_from_json
from keras.... | [
"keras.models.load_model",
"keras.applications.imagenet_utils.decode_predictions",
"numpy.expand_dims",
"json.dumps",
"keras.preprocessing.image.img_to_array"
] | [((1187, 1227), 'keras.applications.imagenet_utils.decode_predictions', 'decode_predictions', (['predictions_resnet50'], {}), '(predictions_resnet50)\n', (1205, 1227), False, 'from keras.applications.imagenet_utils import decode_predictions\n'), ((1353, 1370), 'json.dumps', 'json.dumps', (['preds'], {}), '(preds)\n', (... |
import io
import re
import spectra
from PIL import Image
from ..help import add_help_item
from userbot.utils import parse_arguments
from userbot.events import register
@register(outgoing=True, pattern=r"^\.color\s+(.*)")
async def color_props(e):
params = e.pattern_match.group(1) or ""
args, color = parse_a... | [
"spectra.rgb",
"spectra.hsl",
"io.BytesIO",
"PIL.Image.new",
"userbot.utils.parse_arguments",
"userbot.events.register",
"spectra.cmy",
"re.findall",
"spectra.hsv",
"spectra.xyz",
"spectra.lab",
"spectra.lch",
"spectra.html",
"spectra.cmyk"
] | [((173, 225), 'userbot.events.register', 'register', ([], {'outgoing': '(True)', 'pattern': '"""^\\\\.color\\\\s+(.*)"""'}), "(outgoing=True, pattern='^\\\\.color\\\\s+(.*)')\n", (181, 225), False, 'from userbot.events import register\n'), ((313, 360), 'userbot.utils.parse_arguments', 'parse_arguments', (['params', "['... |
import json
import os
import time
import ccxt
import pandas as pd
from unittest import TestCase, mock
from crypto_data_fetcher.ftx import FtxFetcher
def ftx_config():
path = os.getenv("HOME") + '/.ftx.json'
with open(path) as f:
return json.load(f)
def create_ccxt_client():
headers = {
'FT... | [
"json.load",
"os.getenv",
"crypto_data_fetcher.ftx.FtxFetcher"
] | [((179, 196), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (188, 196), False, 'import os\n'), ((253, 265), 'json.load', 'json.load', (['f'], {}), '(f)\n', (262, 265), False, 'import json\n'), ((645, 672), 'crypto_data_fetcher.ftx.FtxFetcher', 'FtxFetcher', ([], {'ccxt_client': 'ftx'}), '(ccxt_client=ft... |
import json
import os
config = {}
settings_file_wd = os.path.join(os.getcwd(), ".cdash-client.json")
home_directory = os.path.expanduser("~")
settings_file_home = os.path.join(home_directory, ".cdash-client.json")
settings_file = ""
# First of all, we look for our settings file inside the user's home folder.
# This ... | [
"json.load",
"os.path.join",
"os.getcwd",
"os.path.isfile",
"os.path.expanduser",
"os.access"
] | [((120, 143), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (138, 143), False, 'import os\n'), ((165, 215), 'os.path.join', 'os.path.join', (['home_directory', '""".cdash-client.json"""'], {}), "(home_directory, '.cdash-client.json')\n", (177, 215), False, 'import os\n'), ((68, 79), 'os.getc... |
#-------------------------------------------------------------------------------
# Import Libraries
#-------------------------------------------------------------------------------
from rosalindLibrary.loaders.rosalindLoader import rosalindLoader
#------------------------------------------------------------------------... | [
"rosalindLibrary.loaders.rosalindLoader.rosalindLoader"
] | [((467, 492), 'rosalindLibrary.loaders.rosalindLoader.rosalindLoader', 'rosalindLoader', (['inputFile'], {}), '(inputFile)\n', (481, 492), False, 'from rosalindLibrary.loaders.rosalindLoader import rosalindLoader\n')] |
"""
numpy and scipy based backend.
Transparently handles scipy.sparse matrices as input.
"""
from __future__ import division, absolute_import
import numpy as np
import scipy.sparse
import scipy.sparse.linalg
import scipy.linalg
def inv(matrix):
"""
Calculate the inverse of a matrix.
Uses the standard ``... | [
"numpy.diagonal"
] | [((1303, 1322), 'numpy.diagonal', 'np.diagonal', (['matrix'], {}), '(matrix)\n', (1314, 1322), True, 'import numpy as np\n')] |
# Copyright (c) 2015-2019 Vector 35 Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, ... | [
"atexit.register",
"binaryninja._binaryninjacore.BNInitRepoPlugins",
"binaryninja._binaryninjacore.BNGetProduct",
"builtins.range",
"sys.path.append",
"binaryninja._binaryninjacore.BNGetVersionString",
"binaryninja._binaryninjacore.BNInitUserPlugins",
"binaryninja._binaryninjacore.BNRegisterForPluginL... | [((3978, 4003), 'atexit.register', 'atexit.register', (['shutdown'], {}), '(shutdown)\n', (3993, 4003), False, 'import atexit\n'), ((5463, 5531), 'binaryninja._binaryninjacore.BNRegisterForPluginLoading', 'core.BNRegisterForPluginLoading', (['_plugin_api_name', 'load_plugin.cb', '(0)'], {}), '(_plugin_api_name, load_pl... |
# -*- coding: utf-8 -*-
"""
This module defines a general procedure for running applications
Example usage:
app_driver = ApplicationDriver()
app_driver.initialise_application(system_param, input_data_param)
app_driver.run_application()
system_param and input_data_param should be generated using:
niftynet.u... | [
"tensorflow.train.Coordinator",
"tensorflow.logging.info",
"tensorflow.get_collection",
"tensorflow.logging.warning",
"tensorflow.ConfigProto",
"sys.exc_info",
"os.path.join",
"os.path.exists",
"tensorflow.summary.FileWriter",
"niftynet.io.misc_io.get_latest_subfolder",
"traceback.print_exceptio... | [((3441, 3483), 'niftynet.utilities.util_common.set_cuda_device', 'set_cuda_device', (['system_param.cuda_devices'], {}), '(system_param.cuda_devices)\n', (3456, 3483), False, 'from niftynet.utilities.util_common import set_cuda_device\n'), ((3643, 3684), 'os.path.join', 'os.path.join', (['self.model_dir', 'FILE_PREFIX... |
"""
Tests for the :module`regression_tests.parsers.text_parser` module.
"""
import unittest
from regression_tests.parsers.text_parser import Text
from regression_tests.parsers.text_parser import parse
class ParseTests(unittest.TestCase):
"""Tests for `parse()`."""
def test_returns_text_from_string(self... | [
"regression_tests.parsers.text_parser.Text",
"regression_tests.parsers.text_parser.parse"
] | [((338, 351), 'regression_tests.parsers.text_parser.parse', 'parse', (['"""text"""'], {}), "('text')\n", (343, 351), False, 'from regression_tests.parsers.text_parser import parse\n'), ((461, 474), 'regression_tests.parsers.text_parser.parse', 'parse', (['"""text"""'], {}), "('text')\n", (466, 474), False, 'from regres... |
import sys
import os
import globals
import user_io
from encrypt import Encryption
def get_config():
config_values = {
}
# get Packet credentials
sys.stdout.write("\nPlease enter credentials for Packet.Net:\n")
project_id = user_io.read_kbd("--> Project ID", [], '', True, True)
if project_id =... | [
"sys.stdout.write",
"user_io.read_kbd",
"encrypt.Encryption"
] | [((164, 230), 'sys.stdout.write', 'sys.stdout.write', (['"""\nPlease enter credentials for Packet.Net:\n"""'], {}), '("""\nPlease enter credentials for Packet.Net:\n""")\n', (180, 230), False, 'import sys\n'), ((246, 300), 'user_io.read_kbd', 'user_io.read_kbd', (['"""--> Project ID"""', '[]', '""""""', '(True)', '(Tru... |
# -*- coding: utf-8 -*-
###############################################################################
# This file is part of metalibm (https://github.com/kalray/metalibm)
###############################################################################
# MIT License
#
# Copyright (c) 2018 Kalray
#
# Permission is here... | [
"metalibm_core.core.target.TargetRegister.register_new_target"
] | [((12149, 12225), 'metalibm_core.core.target.TargetRegister.register_new_target', 'TargetRegister.register_new_target', (['target_name', '(lambda _: FixedPointBackend)'], {}), '(target_name, lambda _: FixedPointBackend)\n', (12183, 12225), False, 'from metalibm_core.core.target import TargetRegister\n')] |
#!/usr/bin/env python3
# Purpose: Say hello
import argparse
parser = argparse.ArgumentParser(description='Say hello')
parser.add_argument('-n', '--name', metavar='name',
default='World', help='Name to greet')
args = parser.parse_args()
print('Hello, ' + args.name + '!')
| [
"argparse.ArgumentParser"
] | [((76, 124), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Say hello"""'}), "(description='Say hello')\n", (99, 124), False, 'import argparse\n')] |
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by <NAME>
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
from __future__... | [
"lib.datasets.cckw.cckw",
"lib.datasets.cityscape_DG.cityscape"
] | [((954, 985), 'lib.datasets.cityscape_DG.cityscape', 'cityscape', (['split', '"""2007"""', 'domin'], {}), "(split, '2007', domin)\n", (963, 985), False, 'from lib.datasets.cityscape_DG import cityscape\n'), ((1178, 1196), 'lib.datasets.cckw.cckw', 'cckw', (['split', 'domin'], {}), '(split, domin)\n', (1182, 1196), Fals... |
import logging
from elasticsearch import Elasticsearch
from nose.tools import (
eq_,
set_trace,
)
from api.elastic_search import (
ExternalSearchIndex,
MockExternalSearchIndex,
)
from api.app import app
class TestExternalSearchIndex():
def setup(self):
es_url = app.config["TEST_ELASTIC_SEARCH_URL"]
s... | [
"nose.tools.eq_",
"api.elastic_search.MockExternalSearchIndex"
] | [((329, 360), 'api.elastic_search.MockExternalSearchIndex', 'MockExternalSearchIndex', (['es_url'], {}), '(es_url)\n', (352, 360), False, 'from api.elastic_search import ExternalSearchIndex, MockExternalSearchIndex\n'), ((619, 810), 'nose.tools.eq_', 'eq_', (['self.es.docs', "{(self.es.DEFAULT_INDEX, self.es.DEFAULT_TY... |
'''
'''
import os
import sys
import configparser
from typing import List
class ConfigOption:
@staticmethod
def get_short_n_full_form(option: str) -> str:
full = '_'.join(option.strip().split())
short = ''.join([w[0] for w in full.split('_')])
return short, full
de... | [
"os.path.isfile",
"configparser.ConfigParser"
] | [((2144, 2190), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {'allow_no_value': '(True)'}), '(allow_no_value=True)\n', (2169, 2190), False, 'import configparser\n'), ((2765, 2792), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (2790, 2792), False, 'import configparser\n')... |
"""Wrappers to call kaldi's utils/ scripts"""
from ..script_utils import run
import subprocess
def split_data(data_folder, num_jobs):
run([
'utils/split_data.sh',
data_folder,
f'{num_jobs}',
])
sdata = '{}/split{}'.format(data_folder, num_jobs)
return sdata
def get_frame_shift(... | [
"subprocess.run"
] | [((1533, 1593), 'subprocess.run', 'subprocess.run', (["['utils/split_scp.pl', input_file, *out_scp]"], {}), "(['utils/split_scp.pl', input_file, *out_scp])\n", (1547, 1593), False, 'import subprocess\n'), ((983, 1014), 'subprocess.run', 'subprocess.run', (['cmd'], {'stdout': 'opf'}), '(cmd, stdout=opf)\n', (997, 1014),... |
import os
files = os.listdir()
for f in files:
if f.endswith(".tdms"):
temp = f.split("_")[3][:-1]
dir = "CoNb206-" + temp + "K"
os.rename(f,os.path.join(dir,f))
print("[Finished]")
| [
"os.path.join",
"os.listdir"
] | [((20, 32), 'os.listdir', 'os.listdir', ([], {}), '()\n', (30, 32), False, 'import os\n'), ((171, 191), 'os.path.join', 'os.path.join', (['dir', 'f'], {}), '(dir, f)\n', (183, 191), False, 'import os\n')] |
from django.db import models
from django.core.exceptions import ValidationError
from string import Template
from mozdns.soa.models import SOA
from mozdns.mixins import ObjectUrlMixin, DisplayMixin
from mozdns.validation import validate_domain_name
from mozdns.validation import do_zone_validation
from mozdns.search_ut... | [
"django.core.exceptions.ValidationError",
"mozdns.validation.do_zone_validation",
"mozdns.ip.utils.ip_to_domain_name",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"mozdns.domain.utils.name_to_domain",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"mozdns.search_util... | [((3557, 3591), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (3573, 3591), False, 'from django.db import models\n'), ((3603, 3688), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)', 'validators': '[validate_do... |
import re
import sys
from typing import Tuple
SEMVER_PATTERN = re.compile( r'(\d+)\.(\d+)\.(\d+)' )
def parse_semver( ver: str ) -> Tuple[int, int, int]:
m = SEMVER_PATTERN.match( ver )
if not m:
raise Exception( f"Not a compatible version: {ver}" )
return int( m.group( 1 ) ), int( m.group( ... | [
"re.compile"
] | [((64, 102), 're.compile', 're.compile', (['"""(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)"""'], {}), "('(\\\\d+)\\\\.(\\\\d+)\\\\.(\\\\d+)')\n", (74, 102), False, 'import re\n')] |
"""
Test for Sentinel Hub WFS
"""
import datetime
import pytest
from shapely.geometry import MultiPolygon
from sentinelhub import CRS, BBox, DataCollection, WebFeatureService
pytestmark = pytest.mark.sh_integration
@pytest.mark.parametrize(
"args, kwargs, expected_len",
[
(
[
... | [
"sentinelhub.BBox",
"datetime.date",
"sentinelhub.WebFeatureService"
] | [((847, 881), 'sentinelhub.WebFeatureService', 'WebFeatureService', (['*args'], {}), '(*args, **kwargs)\n', (864, 881), False, 'from sentinelhub import CRS, BBox, DataCollection, WebFeatureService\n'), ((326, 379), 'sentinelhub.BBox', 'BBox', ([], {'bbox': '(-5.23, 48.0, -5.03, 48.17)', 'crs': 'CRS.WGS84'}), '(bbox=(-5... |
# Copyright 2021 TestProject (https://testproject.io)
#
# 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 ... | [
"selenium.webdriver.ChromeOptions"
] | [((885, 900), 'selenium.webdriver.ChromeOptions', 'ChromeOptions', ([], {}), '()\n', (898, 900), False, 'from selenium.webdriver import ChromeOptions\n')] |
#!/usr/bin python3
# Imports
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Python:
from typing import Iterator
from enum import IntEnum
# 3rd party:
# Internal:
try:
from __app__.caching import RedisClient
except ImportError:
from caching import RedisClient
# ~... | [
"caching.RedisClient"
] | [((1224, 1253), 'caching.RedisClient', 'RedisClient', ([], {'db': "payload['db']"}), "(db=payload['db'])\n", (1235, 1253), False, 'from caching import RedisClient\n')] |
from paddle import Paddle
from scoreboard import ScoreBoard
from ball import Ball
PADDLE_LENGTH = 20
BOARD_LENGTH = 800
class Board:
def __init__(self):
self.ball = Ball(400, 300, 3, 4, "random", 1)
#self.ball.launch()
self.paddle1 = Paddle(10, 250)
self.paddle2 = Paddl... | [
"scoreboard.ScoreBoard",
"paddle.Paddle",
"ball.Ball"
] | [((188, 221), 'ball.Ball', 'Ball', (['(400)', '(300)', '(3)', '(4)', '"""random"""', '(1)'], {}), "(400, 300, 3, 4, 'random', 1)\n", (192, 221), False, 'from ball import Ball\n'), ((275, 290), 'paddle.Paddle', 'Paddle', (['(10)', '(250)'], {}), '(10, 250)\n', (281, 290), False, 'from paddle import Paddle\n'), ((315, 36... |
from PIL import Image
import numpy as np
from sklearn.metrics import average_precision_score
from sklearn.metrics import precision_recall_curve
import matplotlib.pyplot as plt
from inspect import signature
from scipy import ndimage
from numpy import random,argsort,sqrt
from sklearn.metrics import jaccard_score, recall... | [
"numpy.absolute",
"numpy.sum",
"scipy.ndimage.binary_erosion",
"numpy.logical_not",
"numpy.zeros",
"skimage.morphology.disk",
"sklearn.metrics.precision_recall_curve",
"numpy.argsort",
"numpy.logical_xor",
"numpy.where",
"sklearn.metrics.average_precision_score",
"numpy.vstack"
] | [((785, 805), 'numpy.absolute', 'np.absolute', (['im_diff'], {}), '(im_diff)\n', (796, 805), True, 'import numpy as np\n'), ((819, 834), 'numpy.sum', 'np.sum', (['im_diff'], {}), '(im_diff)\n', (825, 834), True, 'import numpy as np\n'), ((1316, 1347), 'sklearn.metrics.average_precision_score', 'average_precision_score'... |
import uuid
import json
import pandas as pd
import numpy as np
from gibbon.utility import Convert
class Buildings:
def __init__(self, sensor, path=None):
self.sensor = sensor
self.df = None
self.selected = None
if path:
self.load_dataframe(path)
def load_dataframe... | [
"pandas.DataFrame",
"json.dump",
"json.load",
"gibbon.maps.MapSensor",
"uuid.uuid4",
"gibbon.utility.Convert.lnglat_to_mercator",
"numpy.array"
] | [((2421, 2446), 'gibbon.maps.MapSensor', 'MapSensor', (['origin', 'radius'], {}), '(origin, radius)\n', (2430, 2446), False, 'from gibbon.maps import MapSensor\n'), ((918, 953), 'pandas.DataFrame', 'pd.DataFrame', (['buildings'], {'index': 'uids'}), '(buildings, index=uids)\n', (930, 953), True, 'import pandas as pd\n'... |
from time import time
from flask_pymongo import DESCENDING
class MongoHelper:
def __init__(self, mongo_db):
self.mongo_db = mongo_db
def create_order(self, data):
new_order = {
'_id': int(time()),
'start_loc': data['start'],
'destination': data[... | [
"time.time"
] | [((237, 243), 'time.time', 'time', ([], {}), '()\n', (241, 243), False, 'from time import time\n')] |
# coding=utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns('front.views',
url(r'^$', 'index', name='index'),
url(r'^clientes/$', 'clientes', name='clientes'),
url(r'^categorias/$', 'categorias', name='categorias'),
... | [
"django.conf.urls.url"
] | [((124, 156), 'django.conf.urls.url', 'url', (['"""^$"""', '"""index"""'], {'name': '"""index"""'}), "('^$', 'index', name='index')\n", (127, 156), False, 'from django.conf.urls import patterns, url\n'), ((183, 230), 'django.conf.urls.url', 'url', (['"""^clientes/$"""', '"""clientes"""'], {'name': '"""clientes"""'}), "... |
from collections import OrderedDict
import torch
import torch.nn as nn
__all__ = ['googlenet']
class Inception_v1_GoogLeNet(nn.Module):
input_side = 227
rescale = 255.0
rgb_mean = [122.7717, 115.9465, 102.9801]
rgb_std = [1, 1, 1]
def __init__(self, num_classes=1000):
super(Inception_v1_G... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.AvgPool2d"
] | [((2292, 2325), 'torch.nn.Linear', 'nn.Linear', (['(1024)', 'self.num_classes'], {}), '(1024, self.num_classes)\n', (2301, 2325), True, 'import torch.nn as nn\n'), ((1484, 1528), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(3, 3)', '(2, 2)'], {'padding': '(1, 1)'}), '((3, 3), (2, 2), padding=(1, 1))\n', (1496, 1528), True... |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Created by <NAME>(<EMAIL>), <NAME>
# ------------------------------------------------------------------------------
import os
import random
import torch
import torch.utils.dat... | [
"pandas.read_csv",
"torch.Tensor",
"os.path.join",
"PIL.Image.open"
] | [((1241, 1267), 'pandas.read_csv', 'pd.read_csv', (['self.csv_file'], {}), '(self.csv_file)\n', (1252, 1267), True, 'import pandas as pd\n'), ((1438, 1473), 'os.path.join', 'os.path.join', (['self.data_root', 'fname'], {}), '(self.data_root, fname)\n', (1450, 1473), False, 'import os\n'), ((1648, 1682), 'torch.Tensor',... |
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
from pathlib import Path
from project_paths import paths
def test_from_b():
"""
Same test as test_from_a, but making sure that a DIFFERENT pyproject.toml gets loaded
"""
assert paths.filename.resolve().samefile(Path(__file__))
| [
"pathlib.Path",
"project_paths.paths.filename.resolve"
] | [((279, 293), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (283, 293), False, 'from pathlib import Path\n'), ((245, 269), 'project_paths.paths.filename.resolve', 'paths.filename.resolve', ([], {}), '()\n', (267, 269), False, 'from project_paths import paths\n')] |
# Copyright (C) 2020 CyberSIEM(R)
#
# 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 agree... | [
"telnetlib.Telnet",
"time.sleep"
] | [((1877, 1933), 'telnetlib.Telnet', 'Telnet', (['self.__host', 'self.__port'], {'timeout': 'self.__timeout'}), '(self.__host, self.__port, timeout=self.__timeout)\n', (1883, 1933), False, 'from telnetlib import Telnet\n'), ((2103, 2131), 'time.sleep', 'sleep', (['self.__retry_suspense'], {}), '(self.__retry_suspense)\n... |
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
from logging import getLogger
from os import environ, path
from pathlib import Path
from threading import Condition
from awsiot.greengrasscoreipc.model import QOS
# Set all the constants
SCORE_THRESHOLD = 0.3
M... | [
"threading.Condition",
"os.environ.get",
"pathlib.Path",
"os.path.join",
"logging.getLogger"
] | [((678, 689), 'logging.getLogger', 'getLogger', ([], {}), '()\n', (687, 689), False, 'from logging import getLogger\n'), ((912, 954), 'os.path.join', 'path.join', (['artifacts_path', '"""sample_images"""'], {}), "(artifacts_path, 'sample_images')\n", (921, 954), False, 'from os import environ, path\n'), ((1023, 1034), ... |
from algDev.preprocessing.feature_generation import *
from algDev.preprocessing import data_generator
import matplotlib.pyplot as plt
import numpy as np
from algDev.models.equity import Equity
from algDev.algorithms.cnn import CNN
from algDev.algorithms.svm import SVM
from algDev.API.indicators import get_indicator_val... | [
"algDev.tests.test_svm.run_2",
"algDev.tests.trading_alg_test.test_conf_matrix_model_coll",
"matplotlib.pyplot.show",
"algDev.tests.trading_alg_test.grid_search",
"algDev.tests.test_backtest.run_test",
"algDev.API.models.loadTradingAlgorithm",
"algDev.models.equity.Equity",
"algDev.tests.trading_alg_t... | [((666, 680), 'algDev.models.equity.Equity', 'Equity', (['"""QCOM"""'], {}), "('QCOM')\n", (672, 680), False, 'from algDev.models.equity import Equity\n'), ((771, 785), 'algDev.models.equity.Equity', 'Equity', (['"""AAPL"""'], {}), "('AAPL')\n", (777, 785), False, 'from algDev.models.equity import Equity\n'), ((883, 89... |
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
import time
chrome_driver_path = 'C:/Development/chromedriver.exe'
driver = webdriver.Chrome(chrome_driver_path)
driver.set_window_size(1440, 720)
driver.get('http://orteil.dashnet.org/experiments/cookie/')
cookie = dr... | [
"selenium.webdriver.Chrome",
"time.time"
] | [((176, 212), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['chrome_driver_path'], {}), '(chrome_driver_path)\n', (192, 212), False, 'from selenium import webdriver\n'), ((615, 626), 'time.time', 'time.time', ([], {}), '()\n', (624, 626), False, 'import time\n'), ((643, 654), 'time.time', 'time.time', ([], {}), '(... |
from django.db import models
from squalaetp.models import Xelon
from dashboard.models import UserProfile, User
class Raspeedi(models.Model):
TYPE_CHOICES = [('RAD', 'Radio'), ('NAV', 'Navigation')]
CON_CHOICES = [(1, '1'), (2, '2')]
MEDIA_CHOICES = [
('N/A', 'Vide'),
('HDD', 'Disque Dur'... | [
"django.db.models.OneToOneField",
"django.db.models.BigIntegerField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((698, 759), 'django.db.models.BigIntegerField', 'models.BigIntegerField', (['"""référence boîtier"""'], {'primary_key': '(True)'}), "('référence boîtier', primary_key=True)\n", (720, 759), False, 'from django.db import models\n'), ((774, 841), 'django.db.models.CharField', 'models.CharField', (['"""produit"""'], {'ma... |
from windows import Window, top_five_en, top_five_he
from db_python_file import DBClass
__author__ = "<NAME>"
class LeaderBoardWin(Window):
def __init__(self, english_img, hebrew_img, language_app, play_music,
cur_w, cur_h):
super().__init__(english_img, hebrew_img, language_a... | [
"db_python_file.DBClass"
] | [((685, 694), 'db_python_file.DBClass', 'DBClass', ([], {}), '()\n', (692, 694), False, 'from db_python_file import DBClass\n')] |
from flask import Flask
from flask_stache import render_view, render_template
from example.admin import create_blueprint
class Home(object):
def msg(self):
return "Home"
def msg2(self):
return "Partial Content"
class About(object):
def msg(self):
return "About"
def create_ap... | [
"example.admin.create_blueprint",
"flask_stache.render_template",
"flask.Flask"
] | [((335, 350), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (340, 350), False, 'from flask import Flask\n'), ((583, 627), 'flask_stache.render_template', 'render_template', (['"""custom"""', "{'msg': 'Custom'}"], {}), "('custom', {'msg': 'Custom'})\n", (598, 627), False, 'from flask_stache import render_v... |
import sys, os
import subprocess
import queue
import threading
from nextnanopy.utils.misc import get_filename, mkdir_if_not_exist
from nextnanopy import defaults
def command(
inputfile,
exe,
license,
database,
outputdirectory,
**opt_kwargs,
):
kwargs = dict(
... | [
"nextnanopy.defaults.get_command",
"threading.Thread",
"subprocess.Popen",
"os.path.abspath",
"nextnanopy.utils.misc.mkdir_if_not_exist",
"sys.stdout.write",
"os.getcwd",
"nextnanopy.defaults.input_file_type",
"os.chdir",
"os.path.split",
"os.path.join",
"queue.Queue",
"nextnanopy.utils.misc... | [((502, 537), 'nextnanopy.defaults.input_file_type', 'defaults.input_file_type', (['inputfile'], {}), '(inputfile)\n', (526, 537), False, 'from nextnanopy import defaults\n'), ((548, 577), 'nextnanopy.defaults.get_command', 'defaults.get_command', (['product'], {}), '(product)\n', (568, 577), False, 'from nextnanopy im... |
import itertools
import re
def parse_data():
with open('2020/14/input.txt') as f:
data = f.read()
mem = dict()
previous = None
values = list()
for line in data.splitlines():
if match := re.fullmatch(r'mask = (.+)', line):
if previous is not None:
mem[... | [
"itertools.combinations",
"re.fullmatch"
] | [((227, 260), 're.fullmatch', 're.fullmatch', (['"""mask = (.+)"""', 'line'], {}), "('mask = (.+)', line)\n", (239, 260), False, 'import re\n'), ((423, 469), 're.fullmatch', 're.fullmatch', (['"""mem\\\\[(\\\\d+)\\\\] = (\\\\d+)"""', 'line'], {}), "('mem\\\\[(\\\\d+)\\\\] = (\\\\d+)', line)\n", (435, 469), False, 'impo... |
from minik.core import Minik
app = Minik()
req_type_by_name = {
'api_request': 'API Gateway!',
'alb_request': 'ALB!'
}
@app.get("/events")
def get_events():
"""
The view handler for the `/events` route, this function will return an html
response with a list of events. Each event points to anothe... | [
"minik.core.Minik"
] | [((36, 43), 'minik.core.Minik', 'Minik', ([], {}), '()\n', (41, 43), False, 'from minik.core import Minik\n')] |
from infi.asi import create_platform_command_executer
from infi.asi.cdb.write import Write6Command, Write10Command
from infi.asi.coroutines.sync_adapter import sync_wait
from infi.asi import create_os_file
from infi.exceptools import print_exc
if len(sys.argv) not in (5, 6):
sys.stderr.write("usage: %s device_name... | [
"infi.exceptools.print_exc",
"infi.asi.create_os_file",
"infi.asi.create_platform_command_executer"
] | [((555, 575), 'infi.asi.create_os_file', 'create_os_file', (['path'], {}), '(path)\n', (569, 575), False, 'from infi.asi import create_os_file\n'), ((598, 633), 'infi.asi.create_platform_command_executer', 'create_platform_command_executer', (['f'], {}), '(f)\n', (630, 633), False, 'from infi.asi import create_platform... |
from setuptools import setup, find_packages
setup(
name='operon_predictor',
version='0.0.1',
description=(
'predict operon'
),
author='<SeraphZ>',
author_email='<<EMAIL>>',
license='MIT',
packages=find_packages(),
install_requires=[
'numpy>=1.14',
'scipy',
... | [
"setuptools.find_packages"
] | [((238, 253), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (251, 253), False, 'from setuptools import setup, find_packages\n')] |
# coding: utf8
import copy
import os
import pytest
import numpy as np
import numpy.testing as npt
import openturns as ot
import matplotlib.pyplot as plt
from batman.space import (Space, Doe, dists_to_ot)
from batman.functions import Ishigami
from batman.surrogate import SurrogateModel
from batman.space.refiner import R... | [
"batman.space.Space",
"batman.space.refiner.Refiner",
"numpy.empty",
"batman.space.dists_to_ot",
"os.path.join",
"numpy.testing.assert_almost_equal",
"pytest.raises",
"batman.functions.Ishigami",
"openturns.Uniform",
"numpy.testing.assert_equal",
"copy.deepcopy",
"numpy.testing.assert_array_eq... | [((5774, 5844), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'AssertionError', 'reason': '"""Global optimization"""'}), "(raises=AssertionError, reason='Global optimization')\n", (5791, 5844), False, 'import pytest\n'), ((7846, 7916), 'pytest.mark.xfail', 'pytest.mark.xfail', ([], {'raises': 'AssertionErro... |
from django.db import models
# Create your models here.
class Number(models.Model):
phone_number = models.CharField(max_length=255)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.phone_number
class Message(m... | [
"django.db.models.CharField",
"django.db.models.DateTimeField"
] | [((104, 136), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (120, 136), False, 'from django.db import models\n'), ((154, 193), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (174, 193), False, ... |
# каждый день
# каждый день с 29.12.1983
# каждый день, начиная с 29.12.1983
import modules.conditions as conditions
def is_task_current(task, date):
def is_type_correct():
return task['condition'].startswith('каждый день')
def is_date_correct():
return conditions.is_task_started(task, dat... | [
"modules.conditions.is_task_started"
] | [((284, 322), 'modules.conditions.is_task_started', 'conditions.is_task_started', (['task', 'date'], {}), '(task, date)\n', (310, 322), True, 'import modules.conditions as conditions\n')] |
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.annotate = True
from Cython.Distutils import build_ext
import os
import sys
import shutil
import numpy
folder = "."
if len(sys.argv) >3:
f... | [
"os.remove",
"Cython.Build.cythonize",
"os.makedirs",
"os.path.basename",
"distutils.extension.Extension",
"numpy.get_include",
"os.path.splitext",
"shutil.move",
"shutil.copy",
"shutil.movetree",
"shutil.rmtree",
"os.chdir",
"os.scandir"
] | [((516, 532), 'os.chdir', 'os.chdir', (['folder'], {}), '(folder)\n', (524, 532), False, 'import os\n'), ((544, 574), 'os.makedirs', 'os.makedirs', (['"""backfiles"""', '(1877)'], {}), "('backfiles', 1877)\n", (555, 574), False, 'import os\n'), ((1348, 1369), 'os.chdir', 'os.chdir', (['"""backfiles"""'], {}), "('backfi... |
from urllib import request
from os import listdir, path
from time import sleep
import sys
src = 'https://thispersondoesnotexist.com/image'
def is_integer(n):
try:
float(n)
except ValueError:
return False
else:
return float(n).is_integer()
def get_all_file_nbr(path):
file_list ... | [
"os.path.isdir",
"urllib.request.build_opener",
"time.sleep",
"urllib.request.install_opener",
"os.listdir"
] | [((477, 485), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (482, 485), False, 'from time import sleep\n'), ((1908, 1930), 'urllib.request.build_opener', 'request.build_opener', ([], {}), '()\n', (1928, 1930), False, 'from urllib import request\n'), ((2084, 2114), 'urllib.request.install_opener', 'request.install_open... |
from operator import itemgetter
import Plane
import Polygon
import Receiver
import numpy as np
class Space(object):
def __init__(self):
self.polygons = []
self.__axes = np.zeros((3, 3))
def vertical_plane(self, origin, facing_angle): # compass direction, degrees
angle = (90 - facing... | [
"Polygon.Polygon",
"Receiver.Receiver",
"numpy.asarray",
"numpy.zeros",
"numpy.cross",
"numpy.sin",
"numpy.linalg.norm",
"numpy.cos",
"Plane.Plane",
"operator.itemgetter",
"numpy.sqrt"
] | [((193, 209), 'numpy.zeros', 'np.zeros', (['(3, 3)'], {}), '((3, 3))\n', (201, 209), True, 'import numpy as np\n'), ((358, 371), 'numpy.sin', 'np.sin', (['angle'], {}), '(angle)\n', (364, 371), True, 'import numpy as np\n'), ((388, 401), 'numpy.cos', 'np.cos', (['angle'], {}), '(angle)\n', (394, 401), True, 'import num... |
# -*- coding: utf-8 -*-
def make_info_str(args):
s = ''
for k in vars(args):
s += '# ' + str(k) + ': ' + str(getattr(args,k)) + '\n'
return s
def print_stats(steps,dm, meta=False):
from time import strftime
from time import time
if isinstance(meta, str):
meta = ' | {:s}'.format(meta)
else:
... | [
"numpy.zeros",
"numpy.ones",
"time.strftime",
"time.time",
"numpy.random.random",
"numpy.array",
"numpy.arange"
] | [((780, 805), 'numpy.zeros', 'zeros', (['(nmax, 3)', '"""float"""'], {}), "((nmax, 3), 'float')\n", (785, 805), False, 'from numpy import zeros\n'), ((818, 841), 'numpy.zeros', 'zeros', (['(nmax, 3)', '"""int"""'], {}), "((nmax, 3), 'int')\n", (823, 841), False, 'from numpy import zeros\n'), ((853, 873), 'numpy.zeros',... |
import glob
import sys
from os import chdir, environ, mkdir, path, system
from shutil import copyfile, rmtree
from setuptools import Command, find_packages, setup
from setuptools.command.test import test as TestCommand
README = path.abspath(path.join(path.dirname(__file__), 'README.md'))
classifiers = [
'License... | [
"os.mkdir",
"setuptools.find_packages",
"os.path.isdir",
"os.path.dirname",
"os.path.exists",
"os.system",
"pytest.main",
"setuptools.command.test.test.finalize_options",
"glob.glob",
"shutil.rmtree",
"os.path.join",
"os.chdir",
"sys.exit"
] | [((253, 275), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (265, 275), False, 'from os import chdir, environ, mkdir, path, system\n'), ((807, 841), 'setuptools.command.test.test.finalize_options', 'TestCommand.finalize_options', (['self'], {}), '(self)\n', (835, 841), True, 'from setuptools.co... |
# type: ignore
import os
from pytest_mock import MockFixture
from modules.aws_k8s_base.aws_k8s_base import AwsK8sBaseProcessor
from opta.layer import Layer
class TestAwsK8sBaseProcessor:
def test_add_admin_roles(self, mocker: MockFixture):
layer = Layer.load_from_yaml(
os.path.join(
... | [
"os.getcwd",
"modules.aws_k8s_base.aws_k8s_base.AwsK8sBaseProcessor"
] | [((328, 339), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (337, 339), False, 'import os\n'), ((2407, 2450), 'modules.aws_k8s_base.aws_k8s_base.AwsK8sBaseProcessor', 'AwsK8sBaseProcessor', (['k8s_base_module', 'layer'], {}), '(k8s_base_module, layer)\n', (2426, 2450), False, 'from modules.aws_k8s_base.aws_k8s_base impor... |
# file: share/when-wizard/templates/cond-event-connectstorage.py
# -*- coding: utf-8 -*-
#
# Condition plugin for external storage connection
# Copyright (c) 2015-2018 <NAME>
# Released under the BSD License (see LICENSE file)
import locale
from plugin import EventConditionPlugin, PLUGIN_CONST, plugin_name
# setup i1... | [
"locale.textdomain",
"locale.getlocale",
"plugin.plugin_name",
"locale.bindtextdomain"
] | [((408, 458), 'locale.bindtextdomain', 'locale.bindtextdomain', (['APP_NAME', 'APP_LOCALE_FOLDER'], {}), '(APP_NAME, APP_LOCALE_FOLDER)\n', (429, 458), False, 'import locale\n'), ((459, 486), 'locale.textdomain', 'locale.textdomain', (['APP_NAME'], {}), '(APP_NAME)\n', (476, 486), False, 'import locale\n'), ((388, 406)... |
import requests
import json
import base64
import uuid
headers = {
'Accept-Language': 'en-us',
'Accept': '*/*',
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
'Accept-Encoding': 'br, gzip, deflate',
'AppVersion': '2.1.0',
'User-Agent': 'Arc-mobile/2.1.0.0 CFNetwork/976 Darwi... | [
"uuid.uuid4",
"json.loads",
"json.dumps",
"requests.get",
"requests.post"
] | [((1331, 1379), 'requests.post', 'requests.post', (['char_upgrade_url'], {'headers': 'headers'}), '(char_upgrade_url, headers=headers)\n', (1344, 1379), False, 'import requests\n'), ((1404, 1445), 'json.loads', 'json.loads', (['char_upgrade_response.content'], {}), '(char_upgrade_response.content)\n', (1414, 1445), Fal... |
import pandas as pd
import json
from nltk.tokenize import word_tokenize
import numpy as np
def sum_java_words(X: pd.DataFrame) -> pd.DataFrame:
'''Sums the total number of java keywords present on a test token file.'''
java_words = ['abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char'... | [
"pandas.DataFrame",
"json.load",
"nltk.tokenize.word_tokenize",
"pandas.SparseArray"
] | [((1072, 1099), 'pandas.DataFrame', 'pd.DataFrame', (['keyword_count'], {}), '(keyword_count)\n', (1084, 1099), True, 'import pandas as pd\n'), ((2947, 2962), 'json.load', 'json.load', (['path'], {}), '(path)\n', (2956, 2962), False, 'import json\n'), ((2111, 2129), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['ro... |
from math import ceil
from selenium import webdriver
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver.common.keys import Keys
import re
from wordle import wordleSolver
ws = wordleSolver("wordle-solutions.txt", "wordle-guesses.txt", 32, False)
driver = webdriver.Firefox()
driver.get... | [
"selenium.webdriver.Firefox",
"wordle.wordleSolver"
] | [((210, 279), 'wordle.wordleSolver', 'wordleSolver', (['"""wordle-solutions.txt"""', '"""wordle-guesses.txt"""', '(32)', '(False)'], {}), "('wordle-solutions.txt', 'wordle-guesses.txt', 32, False)\n", (222, 279), False, 'from wordle import wordleSolver\n'), ((290, 309), 'selenium.webdriver.Firefox', 'webdriver.Firefox'... |
"""herethere.magic"""
from herethere.here.magic import MagicHere
from herethere.there.magic import MagicThere
import herethere.there.commands.log # noqa
def load_ipython_extension(ipython):
"""Hook for `%load_extension` IPython command."""
ipython.register_magics(MagicHere(ipython))
ipython.register_magi... | [
"herethere.there.magic.MagicThere",
"herethere.here.magic.MagicHere"
] | [((275, 293), 'herethere.here.magic.MagicHere', 'MagicHere', (['ipython'], {}), '(ipython)\n', (284, 293), False, 'from herethere.here.magic import MagicHere\n'), ((323, 342), 'herethere.there.magic.MagicThere', 'MagicThere', (['ipython'], {}), '(ipython)\n', (333, 342), False, 'from herethere.there.magic import MagicT... |
# Read a data file and apply min/max scaling to a
# selected column, writing the min/max values to a proto.
# Ultimately not used because too slow compared to C++, and
# would need to implement unscaling and have the ability to
# read from a pipe.
import csv
from absl import app
from absl import flags
from google.pro... | [
"pandas.read_csv",
"Utilities.General.feature_scaling_pb2.FeatureScaling",
"absl.flags.mark_flag_as_required",
"absl.flags.DEFINE_string",
"numpy.min",
"numpy.max",
"absl.flags.DEFINE_integer",
"numpy.array",
"numpy.mean",
"absl.app.run",
"google.protobuf.json_format.MessageToJson"
] | [((518, 582), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""input"""', 'None', '"""Input data file to process"""'], {}), "('input', None, 'Input data file to process')\n", (537, 582), False, 'from absl import flags\n'), ((583, 660), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""output"""', 'None',... |
# MIT License
#
# Copyright (c) 2019 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publi... | [
"pymitter.EventEmitter",
"copy.deepcopy",
"io.StringIO",
"yaml.load",
"os.path.abspath",
"json5.load",
"toml.load",
"collections.OrderedDict"
] | [((1976, 1990), 'pymitter.EventEmitter', 'EventEmitter', ([], {}), '()\n', (1988, 1990), False, 'from pymitter import EventEmitter\n'), ((3992, 4017), 'io.StringIO', 'StringIO', (['merged_template'], {}), '(merged_template)\n', (4000, 4017), False, 'from io import StringIO\n'), ((2804, 2845), 'yaml.load', 'yaml.load', ... |
'''
Generating calibrated stimuli using factories
=============================================
This demonstrates how to combine the factories to create calibrated stimuli.
The calibrated stimuli are then generated in blocks. This block-based approach
allows us to create infinite-duration stimuli that are "fed" into t... | [
"psiaudio.calibration.FlatCalibration.from_mv_pa",
"matplotlib.pylab.specgram",
"psiaudio.stim.SAMEnvelopeFactory",
"matplotlib.pylab.figure",
"matplotlib.pylab.plot",
"psiaudio.stim.Cos2EnvelopeFactory",
"psiaudio.stim.BandlimitedNoiseFactory",
"psiaudio.stim.ToneFactory",
"psiaudio.stim.ChirpFacto... | [((1528, 1561), 'psiaudio.calibration.FlatCalibration.from_mv_pa', 'FlatCalibration.from_mv_pa', (['(100.0)'], {}), '(100.0)\n', (1554, 1561), False, 'from psiaudio.calibration import FlatCalibration\n'), ((2522, 2591), 'psiaudio.stim.ToneFactory', 'ToneFactory', ([], {'fs': 'fs', 'frequency': '(1000)', 'level': '(80)'... |
"""Collection of utils for generation of propagation-related Cypher queries."""
import networkx as nx
import warnings
from regraph.exceptions import (TypingWarning, InvalidHomomorphism)
from regraph.utils import (keys_by_value,
generate_new_id,
attrs_intersection,
... | [
"regraph.utils.keys_by_value",
"regraph.category_utils.pullback",
"regraph.primitives.add_nodes_from",
"regraph.rules.Rule.identity_rule",
"regraph.rules.Rule",
"regraph.primitives.exists_edge",
"regraph.primitives.get_edge",
"regraph.primitives.get_node",
"warnings.warn",
"networkx.DiGraph",
"r... | [((11917, 11959), 'warnings.warn', 'warnings.warn', (['warn_message', 'TypingWarning'], {}), '(warn_message, TypingWarning)\n', (11930, 11959), False, 'import warnings\n'), ((35043, 35055), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (35053, 35055), True, 'import networkx as nx\n'), ((35068, 35094), 'regraph.pr... |
"""
A child of Job, the Diag class is the parent for all diagnostic jobs
"""
import json
import os
from shutil import copytree, rmtree
from subprocess import call
from lib.jobstatus import JobStatus
from lib.util import print_line
from jobs.job import Job
class Diag(Job):
def __init__(self, *args, **kwargs):
... | [
"lib.util.print_line",
"shutil.rmtree",
"os.path.exists",
"json.dumps",
"subprocess.call",
"shutil.copytree",
"os.path.split"
] | [((649, 955), 'json.dumps', 'json.dumps', (["{'type': self._job_type, 'start_year': self._start_year, 'end_year': self.\n _end_year, 'data_required': self._data_required, 'depends_on': self.\n _depends_on, 'id': self._id, 'comparison': self._comparison, 'status':\n self._status.name, 'case': self._case}"], {'s... |
# -*- coding: utf-8 -*-
# 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, softw... | [
"paunch.builder.compose1.ComposeV1Builder",
"mock.call",
"mock.patch",
"json.dumps",
"paunch.runner.DockerRunner",
"mock.Mock",
"collections.OrderedDict"
] | [((10464, 10519), 'mock.patch', 'mock.patch', (['"""paunch.runner.DockerRunner"""'], {'autospec': '(True)'}), "('paunch.runner.DockerRunner', autospec=True)\n", (10474, 10519), False, 'import mock\n'), ((13348, 13403), 'mock.patch', 'mock.patch', (['"""paunch.runner.DockerRunner"""'], {'autospec': '(True)'}), "('paunch... |
import pytest
import gdsfactory as gf
def test_duplicated_cells_error():
w = h = 10
points = [
[-w / 2.0, -h / 2.0],
[-w / 2.0, h / 2],
[w / 2, h / 2],
[w / 2, -h / 2.0],
]
c1 = gf.Component("demo1")
c1.add_polygon(points)
w = h = 20
points = [
[-w... | [
"pytest.raises",
"gdsfactory.Component"
] | [((229, 250), 'gdsfactory.Component', 'gf.Component', (['"""demo1"""'], {}), "('demo1')\n", (241, 250), True, 'import gdsfactory as gf\n'), ((433, 454), 'gdsfactory.Component', 'gf.Component', (['"""demo1"""'], {}), "('demo1')\n", (445, 454), True, 'import gdsfactory as gf\n'), ((492, 506), 'gdsfactory.Component', 'gf.... |
import unittest
import unittest.mock
import functools
from g1.asyncs import kernels
from g1.operations.databases.bases import interfaces
from g1.operations.databases.servers import connections
# I am not sure why pylint cannot lint contextlib.asynccontextmanager
# correctly; let us disable this check for now.
#
# py... | [
"unittest.main",
"unittest.mock.patch.multiple",
"unittest.mock.Mock",
"unittest.mock.patch.stopall",
"functools.wraps",
"g1.operations.databases.servers.connections.ConnectionManager"
] | [((423, 451), 'functools.wraps', 'functools.wraps', (['test_method'], {}), '(test_method)\n', (438, 451), False, 'import functools\n'), ((7999, 8014), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8012, 8014), False, 'import unittest\n'), ((644, 664), 'unittest.mock.Mock', 'unittest.mock.Mock', ([], {}), '()\n',... |
from time import sleep
import pytest
from pyvirtualdisplay import Display
from pyvirtualdisplay.abstractdisplay import XStartError
from pyvirtualdisplay.xephyr import XephyrDisplay
from pyvirtualdisplay.xvfb import XvfbDisplay
from pyvirtualdisplay.xvnc import XvncDisplay
from tutil import has_xvnc, rfbport
def tes... | [
"tutil.rfbport",
"time.sleep",
"pyvirtualdisplay.Display",
"pytest.raises",
"pyvirtualdisplay.xvnc.XvncDisplay",
"pyvirtualdisplay.xephyr.XephyrDisplay",
"tutil.has_xvnc",
"pyvirtualdisplay.xvfb.XvfbDisplay"
] | [((1395, 1405), 'tutil.has_xvnc', 'has_xvnc', ([], {}), '()\n', (1403, 1405), False, 'from tutil import has_xvnc, rfbport\n'), ((3196, 3206), 'tutil.has_xvnc', 'has_xvnc', ([], {}), '()\n', (3204, 3206), False, 'from tutil import has_xvnc, rfbport\n'), ((339, 348), 'pyvirtualdisplay.Display', 'Display', ([], {}), '()\n... |
from collections import defaultdict
from re import compile as reg_compile
from typing import List, Set, Tuple
def input_reader(path: str) -> List[List[str]]:
with open(path) as f:
lines = f.read(-1).split()
reg = reg_compile('e|se|sw|w|nw|ne')
return [reg.findall(line) for line in lines]
def tra... | [
"collections.defaultdict",
"re.compile"
] | [((231, 261), 're.compile', 'reg_compile', (['"""e|se|sw|w|nw|ne"""'], {}), "('e|se|sw|w|nw|ne')\n", (242, 261), True, 'from re import compile as reg_compile\n'), ((1212, 1228), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (1223, 1228), False, 'from collections import defaultdict\n')] |
# coding: utf-8
from caty.template.core.vm import Bytecode
from StringIO import StringIO
import caty
class BytecodeIOError(Exception):
pass
class IBytecodeLoader(object):
u"""バイトコードローダーインターフェース。
バイトコードローダーは以下の機能に付いての責務を負うものとする。
* 指定されたパスのデータをコンパイルし、メモリとファイルシステムに保存する
* 指定されたパスに対応するバイトコードを呼出側に返す
... | [
"StringIO.StringIO"
] | [((1161, 1171), 'StringIO.StringIO', 'StringIO', ([], {}), '()\n', (1169, 1171), False, 'from StringIO import StringIO\n')] |
#!/usr/bin/env python3
# testRingProtoSerialization.py
""" Test the protocol used for communications around the ring. """
import time
import unittest
# from io import StringIO
from rnglib import SimpleRNG
# from fieldz.parser import StringProtoSpecParser
# import fieldz.fieldTypes as F
import fieldz.msg_spec as M
#... | [
"unittest.main",
"fieldz.msg_impl.make_msg_class",
"time.time",
"wireops.chan.Channel",
"fieldz.msg_impl.MsgImpl.read"
] | [((498, 509), 'time.time', 'time.time', ([], {}), '()\n', (507, 509), False, 'import time\n'), ((8644, 8659), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8657, 8659), False, 'import unittest\n'), ((1788, 1804), 'wireops.chan.Channel', 'Channel', (['BUFSIZE'], {}), '(BUFSIZE)\n', (1795, 1804), False, 'from wire... |
import cv2
import mxnet as mx
import numpy as np
import scipy as sc
from utils.math import Distances
from dataProcessor.tiffReader import GEOMAP
from validation.osmClasses import OSMClasses
from utils.labelProcessor import LabelProcessor
from validation.clcClasses import CLCClasses
from sklearn.neighbors import KNeigh... | [
"numpy.sum",
"numpy.abs",
"numpy.corrcoef",
"lib.mapar.mapar.Mapar.score",
"scipy.cluster.hierarchy.linkage",
"sklearn.neighbors.DistanceMetric.get_metric",
"numpy.expand_dims",
"numpy.clip",
"utils.labelProcessor.LabelProcessor",
"numpy.min",
"numpy.max",
"sklearn.neighbors.KNeighborsClassifi... | [((1138, 1174), 'utils.labelProcessor.LabelProcessor', 'LabelProcessor', (['size', 'validation_map'], {}), '(size, validation_map)\n', (1152, 1174), False, 'from utils.labelProcessor import LabelProcessor\n'), ((3552, 3575), 'numpy.min', 'np.min', (['a_dists'], {'axis': '(0)'}), '(a_dists, axis=0)\n', (3558, 3575), Tru... |
import os
import sys
base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
sys.path.append(base_path)
from torch import optim
from metallic.data.benchmarks import get_benchmarks
from metallic.data.dataloader import MetaDataLoader
from metallic.models import OmniglotCNN
from metallic.metalearners... | [
"sys.path.append",
"os.path.dirname",
"metallic.models.OmniglotCNN",
"metallic.data.dataloader.MetaDataLoader",
"os.path.join",
"metallic.trainer.Trainer"
] | [((97, 123), 'sys.path.append', 'sys.path.append', (['base_path'], {}), '(base_path)\n', (112, 123), False, 'import sys\n'), ((903, 970), 'metallic.data.dataloader.MetaDataLoader', 'MetaDataLoader', (['train_dataset'], {'batch_size': 'BATCH_SIZE', 'shuffle': '(False)'}), '(train_dataset, batch_size=BATCH_SIZE, shuffle=... |
import pysketcher as ps
from pysketcher.backend.matplotlib import MatplotlibBackend
R = 1 # radius of wheel
L = 4 # distance between wheels
H = 2 # height of vehicle body
w_1 = 5 # position of front wheel
# TODO : draw grids
# drawing_tool.set_grid(True)
c = ps.Point(w_1, R)
wheel1 = ps.Circle(c, R)
wheel2 = wh... | [
"pysketcher.Circle",
"pysketcher.Figure",
"pysketcher.Point",
"pysketcher.Composition"
] | [((266, 282), 'pysketcher.Point', 'ps.Point', (['w_1', 'R'], {}), '(w_1, R)\n', (274, 282), True, 'import pysketcher as ps\n'), ((293, 308), 'pysketcher.Circle', 'ps.Circle', (['c', 'R'], {}), '(c, R)\n', (302, 308), True, 'import pysketcher as ps\n'), ((686, 790), 'pysketcher.Composition', 'ps.Composition', (["{'wheel... |
import unittest
from structures.graph import GraphNode
from searches.breadth_first_search import breadth_first_search_graph
class TestBfsGraph(unittest.TestCase):
def make_graph(self):
head = GraphNode(0)
one = GraphNode(1)
two = GraphNode(2)
three = GraphNode(3)
four = Gra... | [
"searches.breadth_first_search.breadth_first_search_graph",
"structures.graph.GraphNode"
] | [((206, 218), 'structures.graph.GraphNode', 'GraphNode', (['(0)'], {}), '(0)\n', (215, 218), False, 'from structures.graph import GraphNode\n'), ((233, 245), 'structures.graph.GraphNode', 'GraphNode', (['(1)'], {}), '(1)\n', (242, 245), False, 'from structures.graph import GraphNode\n'), ((260, 272), 'structures.graph.... |
import numpy as np
import pytest
import emcee
import os
from lenstronomy.Cosmo.lens_cosmo import LensCosmo
from hierarc.Sampling.mcmc_sampling import MCMCSampler
from astropy.cosmology import FlatLambdaCDM
class TestMCMCSampling(object):
def setup(self):
np.random.seed(seed=41)
self.z_L = 0.8
... | [
"astropy.cosmology.FlatLambdaCDM",
"numpy.random.seed",
"lenstronomy.Cosmo.lens_cosmo.LensCosmo",
"os.getcwd",
"emcee.backends.HDFBackend",
"hierarc.Sampling.mcmc_sampling.MCMCSampler",
"pytest.main",
"numpy.random.normal",
"os.path.join"
] | [((3310, 3323), 'pytest.main', 'pytest.main', ([], {}), '()\n', (3321, 3323), False, 'import pytest\n'), ((271, 294), 'numpy.random.seed', 'np.random.seed', ([], {'seed': '(41)'}), '(seed=41)\n', (285, 294), True, 'import numpy as np\n'), ((421, 484), 'astropy.cosmology.FlatLambdaCDM', 'FlatLambdaCDM', ([], {'H0': 'sel... |
from distutils.command.build_clib import build_clib
import os
from Cython.Distutils import build_ext
from Cython.Build import cythonize
cyserver_project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
build_dir = os.path.join(cyserver_project_dir, 'build')
cyserver_package_dir = os.path.join(c... | [
"os.path.dirname",
"Cython.Build.cythonize",
"os.path.join"
] | [((238, 281), 'os.path.join', 'os.path.join', (['cyserver_project_dir', '"""build"""'], {}), "(cyserver_project_dir, 'build')\n", (250, 281), False, 'import os\n'), ((306, 352), 'os.path.join', 'os.path.join', (['cyserver_project_dir', '"""cyserver"""'], {}), "(cyserver_project_dir, 'cyserver')\n", (318, 352), False, '... |
import argparse
import joblib as jl
import numpy as np
import basty.project.experiment_processing as experiment_processing
parser = argparse.ArgumentParser(
description="Report details about active and dormant masks."
)
parser.add_argument(
"--main-cfg-path",
type=str,
required=True,
help="Path t... | [
"numpy.load",
"numpy.count_nonzero",
"argparse.ArgumentParser",
"numpy.logical_and",
"basty.project.experiment_processing.Project",
"joblib.load",
"numpy.unique"
] | [((135, 225), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Report details about active and dormant masks."""'}), "(description=\n 'Report details about active and dormant masks.')\n", (158, 225), False, 'import argparse\n'), ((2314, 2363), 'numpy.unique', 'np.unique', (['annotations... |
from pagarme import plan
from tests.resources.dictionaries import plan_dictionary
import time
def test_create_boleto_plan():
_plan = plan.create(plan_dictionary.BOLETO_PLAN)
assert _plan['payment_methods'] == ["boleto"]
def test_create_credit_card_plan():
_plan = plan.create(plan_dictionary.CREDIT_CARD_... | [
"pagarme.plan.create",
"pagarme.plan.find_by",
"pagarme.plan.find_all",
"pagarme.plan.update"
] | [((139, 179), 'pagarme.plan.create', 'plan.create', (['plan_dictionary.BOLETO_PLAN'], {}), '(plan_dictionary.BOLETO_PLAN)\n', (150, 179), False, 'from pagarme import plan\n'), ((280, 325), 'pagarme.plan.create', 'plan.create', (['plan_dictionary.CREDIT_CARD_PLAN'], {}), '(plan_dictionary.CREDIT_CARD_PLAN)\n', (291, 325... |
from app import get_db
def save(id, link):
conn = get_db()
with conn.cursor() as cur:
cur.execute('INSERT INTO link (id, link) VALUES (%s, %s)', (id, link))
conn.commit()
def all():
conn = get_db()
with conn.cursor() as cur:
cur.execute('SELECT * FROM link')
return cur.fetchall()
def get_link... | [
"app.get_db"
] | [((53, 61), 'app.get_db', 'get_db', ([], {}), '()\n', (59, 61), False, 'from app import get_db\n'), ((205, 213), 'app.get_db', 'get_db', ([], {}), '()\n', (211, 213), False, 'from app import get_db\n'), ((342, 350), 'app.get_db', 'get_db', ([], {}), '()\n', (348, 350), False, 'from app import get_db\n')] |
import socket
ip = "192.168.0.110"
port = 3333
# Create a UDP socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind the socket to the port
server_address = (ip, port)
s.bind(server_address)
print("Do Ctrl+c to exit the program !!")
while True:
print("####### Server is listening #######")
data, a... | [
"socket.socket"
] | [((75, 123), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (88, 123), False, 'import socket\n')] |
from __future__ import print_function
import boto3
import os
def handler(event, context):
for message in event['Records']:
print("The message {0} for event source {1} = {2}".format(message['messageId'], message['eventSource'], str(message['body'])))
sns = boto3.client('sns')
message = "Hello... | [
"boto3.client"
] | [((279, 298), 'boto3.client', 'boto3.client', (['"""sns"""'], {}), "('sns')\n", (291, 298), False, 'import boto3\n')] |
from time import sleep
print("Contagem Regresiva")
print('--'*10)
for c in range(10, 0, -1):
print(c)
sleep(1)
print('Lançamento!') | [
"time.sleep"
] | [((111, 119), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (116, 119), False, 'from time import sleep\n')] |
#!/usr/bin/env python
from numpy.distutils.core import Extension, setup
setup(name='hw',
description='Simple example on calling F77 from Python',
author='<NAME>',
author_email='<EMAIL>',
ext_modules=[Extension(name='hw', sources=['../hw.f'])],
)
| [
"numpy.distutils.core.Extension"
] | [((225, 266), 'numpy.distutils.core.Extension', 'Extension', ([], {'name': '"""hw"""', 'sources': "['../hw.f']"}), "(name='hw', sources=['../hw.f'])\n", (234, 266), False, 'from numpy.distutils.core import Extension, setup\n')] |
# Generated by Django 3.0.7 on 2020-07-12 16:14
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('stdZone', '0004_answer'),
]
operations = [
migrations.RenameField(
model_name='answer',
old_name='question',
new... | [
"django.db.migrations.RenameField"
] | [((215, 303), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""answer"""', 'old_name': '"""question"""', 'new_name': '"""answer"""'}), "(model_name='answer', old_name='question', new_name=\n 'answer')\n", (237, 303), False, 'from django.db import migrations\n')] |
import os
# os.environ['CUDA_VISIBLE_DEVICES'] = '1'
import matplotlib
matplotlib.use('Agg')
from tqdm import tqdm
import time
import numpy as np
from utils.Config import opt
from models.faster_rcnn_vgg16 import FasterRCNNVGG16
from models.faster_rcnn_resnet import FasterRCNNResNet50
from torch.autograd import Variable... | [
"utils.array_tool.tonumpy",
"data.dataset.get_test_loader",
"data.dataset.get_train_val_loader",
"utils.array_tool.scalar",
"utils.vis_tool.save_gt_pred",
"models.faster_rcnn_vgg16.FasterRCNNVGG16",
"numpy.zeros",
"torch.autograd.Variable",
"time.time",
"utils.vis_tool.save_pred_fig",
"matplotli... | [((71, 92), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (85, 92), False, 'import matplotlib\n'), ((1220, 1237), 'models.faster_rcnn_vgg16.FasterRCNNVGG16', 'FasterRCNNVGG16', ([], {}), '()\n', (1235, 1237), False, 'from models.faster_rcnn_vgg16 import FasterRCNNVGG16\n'), ((2053, 2191), 'data.... |
# Dependencies
from bs4 import BeautifulSoup as bs
import pandas as pd
import requests
from splinter import Browser
from webdriver_manager.chrome import ChromeDriverManager
import re
import csv
def init_browser():
executable_path = {'executable_path': ChromeDriverManager().install()}
browser = Browser('chrome'... | [
"pandas.DataFrame",
"pandas.read_csv",
"webdriver_manager.chrome.ChromeDriverManager",
"bs4.BeautifulSoup",
"splinter.Browser",
"re.sub"
] | [((304, 356), 'splinter.Browser', 'Browser', (['"""chrome"""'], {'headless': '(False)'}), "('chrome', **executable_path, headless=False)\n", (311, 356), False, 'from splinter import Browser\n'), ((638, 661), 'bs4.BeautifulSoup', 'bs', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (640, 661), True, 'fr... |
# Copyright (c) 2018 Copyright holder of the paper Generative Adversarial Model Learning
# submitted to NeurIPS 2019 for review
# All rights reserved.
from rllab.misc.instrument import run_experiment_custom
from rllab.dynamic_models.cartpole_model import CartPoleModel
from rllab.torch.models.nn_discriminator import NN... | [
"rllab.torch.models.nn_discriminator.NNDiscriminator",
"argparse.ArgumentParser",
"numpy.concatenate",
"rllab.torch.utils.misc.str2bool",
"rllab.misc.instrument.run_experiment_custom",
"rllab.torch.algos.gaml_episode_based_modellearning.GAMLEpisodeBasedModelLearning",
"pathlib.Path",
"pathlib.Path.joi... | [((736, 772), 'joblib.load', 'joblib.load', (["v['expert_policy_path']"], {}), "(v['expert_policy_path'])\n", (747, 772), False, 'import joblib\n'), ((956, 978), 'joblib.load', 'joblib.load', (['file_name'], {}), '(file_name)\n', (967, 978), False, 'import joblib\n'), ((1142, 1211), 'rllab.torch.models.nn_discriminator... |
import numpy as np
from keras.models import load_model
from PIL import Image
from keras.applications import mobilenet_v2
from keras.utils.data_utils import get_file
import frederic.utils.general
import frederic.utils.image
BASE_MODEL_URL = 'https://github.com/zylamarek/frederic-models/raw/master/models/'
class Pred... | [
"keras.models.load_model",
"numpy.asarray",
"keras.utils.data_utils.get_file",
"numpy.max",
"numpy.round"
] | [((2611, 2657), 'numpy.max', 'np.max', (['(bbox[2] - bbox[0], bbox[3] - bbox[1])'], {}), '((bbox[2] - bbox[0], bbox[3] - bbox[1]))\n', (2617, 2657), True, 'import numpy as np\n'), ((1413, 1476), 'keras.models.load_model', 'load_model', (['self.bbox_model_path'], {'custom_objects': 'custom_objects'}), '(self.bbox_model_... |
import json
import discord
import asyncio
from discord.ext import commands
class GuildEvents(commands.Cog):
def __init__(self, client):
self.client = client
@commands.Cog.listener()
async def on_guild_remove(self, guild):
role = discord.utils.get(guild.roles, name='Muted') ... | [
"discord.utils.get",
"json.dump",
"json.load",
"discord.Permissions",
"discord.Embed",
"discord.ext.commands.Cog.listener"
] | [((187, 210), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (208, 210), False, 'from discord.ext import commands\n'), ((584, 607), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (605, 607), False, 'from discord.ext import commands\n'), ((272, 316), 'dis... |
import os
import argparse
import datetime
import torch
def int_tuple(s):
return tuple(int(i) for i in s.split(','))
def bool_flag(s):
if s == '1':
return True
elif s == '0':
return False
msg = 'Invalid value "%s" for bool flag (should be 0 or 1)'
raise ValueError(msg % s)
par... | [
"torch.cuda.set_device",
"os.getcwd",
"argparse.ArgumentParser",
"datetime.datetime.now"
] | [((326, 351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (349, 351), False, 'import argparse\n'), ((11797, 11835), 'torch.cuda.set_device', 'torch.cuda.set_device', (['args.gpu_ids[0]'], {}), '(args.gpu_ids[0])\n', (11818, 11835), False, 'import torch\n'), ((4936, 4947), 'os.getcwd', 'os.ge... |