code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# coding: utf-8
"""
This tests the use of a view coming from installed
package.
"""
from flask import Flask, jsonify
from flasgger import Swagger
from flasgger_package import package_view
app = Flask(__name__)
swag = Swagger(app)
app.add_url_rule(
'/v1/decorated/<username>',
view_func=package_view
)
@app.... | [
"flasgger.Swagger",
"flask.jsonify",
"flask.Flask"
] | [((197, 212), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'from flask import Flask, jsonify\n'), ((220, 232), 'flasgger.Swagger', 'Swagger', (['app'], {}), '(app)\n', (227, 232), False, 'from flasgger import Swagger\n'), ((1025, 1056), 'flask.jsonify', 'jsonify', (["{'username': usern... |
# this project is licensed under the WTFPLv2, see COPYING.txt for details
"""Editor annotations from builders
This plugin will add annotations to open editors when a builder emits a warning or an error.
When a builder starts, it clears annotations of all open editors of files under the working directory of the builde... | [
"os.path.dirname"
] | [((703, 724), 'os.path.dirname', 'os.path.dirname', (['path'], {}), '(path)\n', (718, 724), False, 'import os\n')] |
from conans import ConanFile, CMake, tools
class EzaudioConan(ConanFile):
name = "ezmidi"
version = "565114c"
license = "MIT"
url = "https://github.com/matthewcpp/ezmidi"
description = "https://github.com/matthewcpp/ezmidi"
topics = ("midi", "windowsmm", "coreaudio", "alsa")
no_copy_source... | [
"conans.tools.chdir"
] | [((491, 514), 'conans.tools.chdir', 'tools.chdir', (['"""./ezmidi"""'], {}), "('./ezmidi')\n", (502, 514), False, 'from conans import ConanFile, CMake, tools\n')] |
#!/usr/bin/env python
import os
from distutils.core import setup, Extension
from subprocess import Popen, PIPE
this_dir = os.path.dirname(os.path.realpath(__file__))
cv2gpumodule = Extension('cv2gpu',
define_macros = [('MAJOR_VERSION', '1'),
('MINOR_VERSION', '0'... | [
"os.path.realpath",
"os.path.join",
"distutils.core.setup"
] | [((487, 756), 'distutils.core.setup', 'setup', ([], {'name': '"""cv2gpu"""', 'version': '"""1.0"""', 'description': '"""OpenCV GPU Bindings"""', 'author': '"""<NAME> and <NAME>"""', 'author_email': '"""<EMAIL>, <EMAIL>"""', 'url': '"""https://docs.python.org/extending/building"""', 'long_description': '"""\nOpenCV GPU ... |
import pandas as pd
cities_demography = pd.read_csv('datasets/us-cities-demographics.csv', sep=';');
airport_codes = pd.read_csv('datasets/airport-codes_csv.csv');
global_temperatures = pd.read_csv('datasets/GlobalLandTemperaturesByCountry.csv');
immigration_data = pd.read_csv('datasets/immigration_data_sample.csv');
... | [
"pandas.read_csv"
] | [((41, 100), 'pandas.read_csv', 'pd.read_csv', (['"""datasets/us-cities-demographics.csv"""'], {'sep': '""";"""'}), "('datasets/us-cities-demographics.csv', sep=';')\n", (52, 100), True, 'import pandas as pd\n'), ((118, 163), 'pandas.read_csv', 'pd.read_csv', (['"""datasets/airport-codes_csv.csv"""'], {}), "('datasets/... |
import numpy as np
import unyt as u
class APConstants:
"""Experimental data and other constants for Ammonium Perchlorate"""
def __init__(self):
assert (
self.expt_lattice_a.keys()
== self.expt_lattice_b.keys()
== self.expt_lattice_c.keys()
)
assert(
... | [
"numpy.asarray",
"numpy.array",
"numpy.vstack"
] | [((1257, 1317), 'numpy.asarray', 'np.asarray', (['[[3.5, 4.5], [0.5, 2.0], [2.5, 3.8], [2.5, 3.8]]'], {}), '([[3.5, 4.5], [0.5, 2.0], [2.5, 3.8], [2.5, 3.8]])\n', (1267, 1317), True, 'import numpy as np\n'), ((1466, 1529), 'numpy.asarray', 'np.asarray', (['[[0.1, 0.8], [0.0, 0.02], [0.01, 0.2], [0.02, 0.3]]'], {}), '([... |
# Based on https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/integrate
import torch
import torch.nn as nn
from torchdiffeq._impl.misc import (
_scaled_dot_product, _convert_to_tensor, _is_finite, _is_iterable,
_optimal_step_size, _compute_error_ratio
)
from torchdiffeq._impl.solvers impor... | [
"torchdiffeq._impl.misc._is_iterable",
"torchdiffeq._impl.misc._norm",
"torch.abs",
"torch.min",
"torch.tensor"
] | [((2790, 2813), 'torch.min', 'torch.min', (['(100 * h0)', 'h1'], {}), '(100 * h0, h1)\n', (2799, 2813), False, 'import torch\n'), ((1655, 1673), 'torchdiffeq._impl.misc._is_iterable', '_is_iterable', (['rtol'], {}), '(rtol)\n', (1667, 1673), False, 'from torchdiffeq._impl.misc import _scaled_dot_product, _convert_to_te... |
# Generated by Django 3.1.5 on 2021-04-25 10:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('globals', '0003_auto_20191024_1242'),
('ps1', '0004_auto_20210421_2305'),
]
operations = [
migratio... | [
"django.db.models.ForeignKey",
"django.db.models.OneToOneField"
] | [((431, 522), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""globals.extrainfo"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'globals.extrainfo')\n", (448, 522), False, 'from django.db import migrations, models\n'), ((644, 769), 'dj... |
from x_rebirth_station_calculator.station_data.station_base import Ware
names = {'L044': 'Novadrones',
'L049': 'Novadrohnen'}
Novadrones = Ware(names)
| [
"x_rebirth_station_calculator.station_data.station_base.Ware"
] | [((150, 161), 'x_rebirth_station_calculator.station_data.station_base.Ware', 'Ware', (['names'], {}), '(names)\n', (154, 161), False, 'from x_rebirth_station_calculator.station_data.station_base import Ware\n')] |
# -*- coding:utf-8 -*-
import os
from threading import Thread
from flask import Flask, request
from flask import redirect, url_for
from flask import flash
from flask import render_template
from flask_login import login_user, LoginManager, login_required, logout_user, current_user
from flask_bootstrap import Bootstrap... | [
"models.db.session.commit",
"flask.flash",
"flask_script.Manager",
"models.db.init_app",
"models.db.session.add",
"flask_mail.Mail",
"flask_moment.Moment",
"flask.url_for",
"flask_script.Shell",
"flask_bootstrap.Bootstrap",
"os.path.join",
"os.path.dirname",
"models.User.query.filter_by",
... | [((632, 647), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (637, 647), False, 'from flask import Flask, request\n'), ((1033, 1064), 'os.environ.get', 'os.environ.get', (['"""MAIL_USERNAME"""'], {}), "('MAIL_USERNAME')\n", (1047, 1064), False, 'import os\n'), ((1095, 1126), 'os.environ.get', 'os.environ.g... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.get",
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set"
] | [((9094, 9127), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""computeType"""'}), "(name='computeType')\n", (9107, 9127), False, 'import pulumi\n'), ((9316, 9347), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""createdOn"""'}), "(name='createdOn')\n", (9329, 9347), False, 'import pulumi\n'), ((9522, 9561), 'p... |
from numpy import array
A = array([[1,2,3],[4,5,6],[7,8,9]])
print('A[:,0] =',A[:,0])
print('A[:,2] =',A[:,2])
| [
"numpy.array"
] | [((28, 68), 'numpy.array', 'array', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (33, 68), False, 'from numpy import array\n')] |
import copy
import logging
import uuid
from datetime import datetime
import six
from channelstream.server_state import get_state
from channelstream.utils import process_catchup
from channelstream.validation import MSG_EDITABLE_KEYS
log = logging.getLogger(__name__)
class User(object):
""" represents a unique u... | [
"copy.deepcopy",
"uuid.uuid4",
"channelstream.utils.process_catchup",
"channelstream.server_state.get_state",
"datetime.datetime.utcnow",
"six.itervalues",
"six.iteritems",
"logging.getLogger"
] | [((241, 268), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (258, 268), False, 'import logging\n'), ((397, 409), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (407, 409), False, 'import uuid\n'), ((822, 839), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (837, 839), Fa... |
from PyQt5 import QtWidgets, uic
from SyntaxHighlight import syntax_highlight
from CanvasRendering import clear, add_all_items
class SettingsDialog(QtWidgets.QDialog):
def __init__(self, scene):
"""Construct SettingsDialog."""
super(SettingsDialog, self).__init__()
self.ui = uic.loadUi('se... | [
"CanvasRendering.clear",
"SyntaxHighlight.syntax_highlight",
"CanvasRendering.add_all_items",
"PyQt5.uic.loadUi"
] | [((306, 344), 'PyQt5.uic.loadUi', 'uic.loadUi', (['"""settings_dialog.ui"""', 'self'], {}), "('settings_dialog.ui', self)\n", (316, 344), False, 'from PyQt5 import QtWidgets, uic\n'), ((2115, 2156), 'SyntaxHighlight.syntax_highlight', 'syntax_highlight', (['self.scene.syntax', 'text'], {}), '(self.scene.syntax, text)\n... |
# -*- coding: utf8 -*-fr
# pylint: disable=too-many-instance-attributes, invalid-name
"""
HasPowerStart is a mixin representing the powerstart attached to some of the objects.
"""
from itopapi.model.prototype import ItopapiPrototype
__version__ = '1.0'
__authors__ = ['<NAME> <<EMAIL>>']
class HasPowerStart(object):... | [
"itopapi.model.prototype.ItopapiPrototype.get_itop_class"
] | [((1175, 1216), 'itopapi.model.prototype.ItopapiPrototype.get_itop_class', 'ItopapiPrototype.get_itop_class', (['"""Person"""'], {}), "('Person')\n", (1206, 1216), False, 'from itopapi.model.prototype import ItopapiPrototype\n')] |
#!/usr/bin/python
# Classification (U)
"""Program: load_log.py
Description: Unit testing of load_log in mysql_log_admin.py.
Usage:
test/unit/mysql_log_admin/load_log.py
Arguments:
"""
# Libraries and Global Variables
# Standard
import sys
import os
if sys.version_info < (2, 7):
import ... | [
"unittest.main",
"os.getcwd",
"mock.patch",
"lib.gen_libs.no_std_out",
"mock.Mock",
"mysql_log_admin.load_log"
] | [((420, 431), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (429, 431), False, 'import os\n'), ((2686, 2742), 'mock.patch', 'mock.patch', (['"""mysql_log_admin.mysql_libs.create_instance"""'], {}), "('mysql_log_admin.mysql_libs.create_instance')\n", (2696, 2742), False, 'import mock\n'), ((2748, 2795), 'mock.patch', 'moc... |
import sys
import time
import subprocess
import math
from threading import Thread
from collections import OrderedDict, deque
from ds4drv.actions import ActionRegistry
from ds4drv.backends import BluetoothBackend, HidrawBackend
from ds4drv.config import load_options
from ds4drv.daemon import Daemon
from ds4drv.eventl... | [
"ds4drv.backends.BluetoothBackend",
"ds4drv.backends.HidrawBackend",
"ds4drv.config.load_options",
"subprocess.run",
"math.sqrt",
"time.sleep",
"collections.OrderedDict",
"ds4drv.__main__.create_controller_thread"
] | [((1468, 1481), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1479, 1481), False, 'from collections import OrderedDict, deque\n'), ((2136, 2150), 'ds4drv.config.load_options', 'load_options', ([], {}), '()\n', (2148, 2150), False, 'from ds4drv.config import load_options\n'), ((2457, 2508), 'ds4drv.__main... |
import esphome.codegen as cg
import esphome.config_validation as cv
from esphome.components import sensor
from esphome.const import CONF_SENSOR, UNIT_OHM, ICON_FLASH, CONF_ID
resistance_ns = cg.esphome_ns.namespace('resistance')
ResistanceSensor = resistance_ns.class_('ResistanceSensor', cg.Component, sensor.Sensor)
... | [
"esphome.config_validation.declare_id",
"esphome.config_validation.use_id",
"esphome.components.sensor.sensor_schema",
"esphome.config_validation.Required",
"esphome.codegen.get_variable",
"esphome.components.sensor.register_sensor",
"esphome.config_validation.enum",
"esphome.codegen.new_Pvariable",
... | [((192, 229), 'esphome.codegen.esphome_ns.namespace', 'cg.esphome_ns.namespace', (['"""resistance"""'], {}), "('resistance')\n", (215, 229), True, 'import esphome.codegen as cg\n'), ((1063, 1096), 'esphome.codegen.new_Pvariable', 'cg.new_Pvariable', (['config[CONF_ID]'], {}), '(config[CONF_ID])\n', (1079, 1096), True, ... |
from flask import render_template, url_for, flash, redirect, request, Blueprint
from flask_login import login_user, current_user, logout_user, login_required
from blogs import db
from werkzeug.security import generate_password_hash,check_password_hash
from blogs.models import User, BlogPost
from blogs.users.forms impor... | [
"blogs.models.User",
"flask.flash",
"flask.Blueprint",
"blogs.models.User.query.filter_by",
"flask.request.args.get",
"flask.redirect",
"blogs.users.forms.LoginForm",
"blogs.db.session.add",
"flask_login.login_user",
"flask_login.logout_user",
"blogs.db.session.commit",
"blogs.users.forms.Regi... | [((432, 460), 'flask.Blueprint', 'Blueprint', (['"""users"""', '__name__'], {}), "('users', __name__)\n", (441, 460), False, 'from flask import render_template, url_for, flash, redirect, request, Blueprint\n'), ((540, 558), 'blogs.users.forms.RegistrationForm', 'RegistrationForm', ([], {}), '()\n', (556, 558), False, '... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2020-12-30 10:28
# @Author : Xelawk
# @FileName: parser.py
import os
from io import BytesIO
import numpy as np
import trimesh
import open3d as o3d
import uuid
from wand import image
from PIL import Image
class MeshParser(object):
def __init__(self, **kwa... | [
"trimesh.Trimesh",
"os.remove",
"io.BytesIO",
"open3d.utility.Vector3iVector",
"PIL.Image.open",
"open3d.visualization.draw_geometries",
"wand.image.Image",
"uuid.uuid1",
"open3d.geometry.TriangleMesh",
"numpy.array",
"open3d.io.read_image",
"open3d.utility.Vector3dVector",
"open3d.utility.V... | [((3941, 3961), 'PIL.Image.open', 'Image.open', (['path_tmp'], {}), '(path_tmp)\n', (3951, 3961), False, 'from PIL import Image\n'), ((4182, 4200), 'numpy.array', 'np.array', (['self.uvs'], {}), '(self.uvs)\n', (4190, 4200), True, 'import numpy as np\n'), ((4622, 4640), 'numpy.array', 'np.array', (['self.uvs'], {}), '(... |
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding: utf-8 -*-
# vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4 fileencoding=utf-8
#
# Capriqorn --- CAlculation of P(R) and I(Q) Of macRomolcules in solutioN
#
# Copyright (c) <NAME>, <NAME>, and contributors.
# See the file AUTHORS.rst for the full list ... | [
"MDAnalysis.Universe",
"copy.deepcopy"
] | [((1496, 1523), 'MDAnalysis.Universe', 'mda.Universe', (['topology_file'], {}), '(topology_file)\n', (1508, 1523), True, 'import MDAnalysis as mda\n'), ((2644, 2665), 'copy.deepcopy', 'copy.deepcopy', (['frm_in'], {}), '(frm_in)\n', (2657, 2665), False, 'import copy\n'), ((5803, 5847), 'MDAnalysis.Universe', 'mda.Unive... |
# -*- coding: utf-8 -*-
"""Utils package contains helper functions for the SDK API
Copyright 2020, Gradient Zero
All rights reserved
"""
from dq0.sdk.errors import DQ0SDKError
def check_signature(code, name):
"""check method signatures. Used by set_code functions."""
if code is None:
return None
... | [
"dq0.sdk.errors.DQ0SDKError"
] | [((2794, 2849), 'dq0.sdk.errors.DQ0SDKError', 'DQ0SDKError', (['"""Function to replace not found in py file"""'], {}), "('Function to replace not found in py file')\n", (2805, 2849), False, 'from dq0.sdk.errors import DQ0SDKError\n'), ((1275, 1315), 'dq0.sdk.errors.DQ0SDKError', 'DQ0SDKError', (['"""Wrong function defi... |
from __future__ import print_function
from __future__ import absolute_import
import pytest
from dead_easy_ui.ui_console_menu import parse_user_function_call
def test_parse_command_args():
assert parse_user_function_call("my_func 'a' 3 thing=4 thing2='strrring'") \
== ('my_func', ('a', 3), dict(thing=4, t... | [
"pytest.raises",
"dead_easy_ui.ui_console_menu.parse_user_function_call"
] | [((202, 269), 'dead_easy_ui.ui_console_menu.parse_user_function_call', 'parse_user_function_call', (['"""my_func \'a\' 3 thing=4 thing2=\'strrring\'"""'], {}), '("my_func \'a\' 3 thing=4 thing2=\'strrring\'")\n', (226, 269), False, 'from dead_easy_ui.ui_console_menu import parse_user_function_call\n'), ((351, 406), 'de... |
import asyncio
import json
from Errors.errors import AddressBannedException
from Errors.errors import BotStuckInPassiveDataGather
from Errors.errors import IssueGatheringServeData
from DataObjects.BasicResponse import BasicResponse
from AutoScheduling.auto_scheduler import Task
from SpecialActions.special_action_handle... | [
"Response.response_manager.ResponseManager",
"SpecialActions.special_action_handler.SpecialActionHandler",
"dateutil.parser.parse",
"json.loads",
"traceback.print_exc",
"asyncio.sleep",
"Errors.errors.BotStuckInPassiveDataGather",
"DataCapture.capture_object_creator.CaptureDictCreator.create_action_di... | [((954, 976), 'SpecialActions.special_action_handler.SpecialActionHandler', 'SpecialActionHandler', ([], {}), '()\n', (974, 976), False, 'from SpecialActions.special_action_handler import SpecialActionHandler\n'), ((1009, 1049), 'Response.response_manager.ResponseManager', 'ResponseManager', (['websocket', 'parent', 'n... |
#!/usr/bin/env python3
''' unit test suite for ytaformats '''
import pytest
import ytaformats
# --------------------------------------------------------------------------- #
@pytest.mark.network
@pytest.mark.tube
@pytest.mark.parametrize("mode", ["HD", "4K", "8K", "vid"],
ids=["channelHD", "channel4K", "channel8... | [
"ytaformats.secToTime",
"pytest.mark.parametrize",
"ytaformats.main"
] | [((217, 333), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""mode"""', "['HD', '4K', '8K', 'vid']"], {'ids': "['channelHD', 'channel4K', 'channel8K', 'video']"}), "('mode', ['HD', '4K', '8K', 'vid'], ids=['channelHD',\n 'channel4K', 'channel8K', 'video'])\n", (240, 333), False, 'import pytest\n'), ((267... |
import os
from dotenv import load_dotenv
import boto3
load_dotenv()
_AWS_ACCESS_KEY = os.getenv('AWS_ACCESS_KEY')
_AWS_SECRET_ACCESS_KEY = os.getenv('AWS_SECRET_ACCESS_KEY')
_AWS_REGION_KEY = os.getenv('REGION_NAME')
_AWS_KVS_ROLE_ARN = os.getenv('AWS_KVS_ROLE_ARN')
_KINESISVIDEO_ARN = os.getenv('AWS_KINESISVIDEO_AR... | [
"dotenv.load_dotenv",
"os.getenv",
"boto3.Session"
] | [((55, 68), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (66, 68), False, 'from dotenv import load_dotenv\n'), ((88, 115), 'os.getenv', 'os.getenv', (['"""AWS_ACCESS_KEY"""'], {}), "('AWS_ACCESS_KEY')\n", (97, 115), False, 'import os\n'), ((141, 175), 'os.getenv', 'os.getenv', (['"""AWS_SECRET_ACCESS_KEY"""']... |
import os
from ..utils.config_load_helpers import load_config
CONFIG_PATH = os.getenv("CONFIG_PATH") or 'collatorx.config:settings-test.yaml'
def load_settings(context: str, target: str = 'settings', provider: str = 'base'):
config = load_config(CONFIG_PATH)
if context == 'providers':
return config[t... | [
"os.getenv"
] | [((78, 102), 'os.getenv', 'os.getenv', (['"""CONFIG_PATH"""'], {}), "('CONFIG_PATH')\n", (87, 102), False, 'import os\n')] |
from types import ModuleType
from jsonasobj import as_json, loads
from rdflib import Graph
from biolinkml.generators.jsonldcontextgen import ContextGenerator
from biolinkml.generators.pythongen import PythonGenerator
from biolinkml.generators.shexgen import ShExGenerator
from biolinkml.generators.yumlgen import YumlG... | [
"rdflib.Graph",
"pyshex.evaluate.evaluate",
"biolinkml.generators.yumlgen.YumlGenerator",
"types.ModuleType",
"biolinkml.utils.yamlutils.as_json_object",
"biolinkml.generators.pythongen.PythonGenerator",
"biolinkml.generators.jsonldcontextgen.ContextGenerator",
"jsonasobj.as_json",
"biolinkml.genera... | [((2254, 2272), 'types.ModuleType', 'ModuleType', (['"""test"""'], {}), "('test')\n", (2264, 2272), False, 'from types import ModuleType\n'), ((2825, 2832), 'rdflib.Graph', 'Graph', ([], {}), '()\n', (2830, 2832), False, 'from rdflib import Graph\n'), ((2959, 3071), 'pyshex.evaluate.evaluate', 'evaluate', (['g', 'shex'... |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 5 23:46:02 2020
@author: sabbi
"""
#input file name to the function, data will be output into dataContainer object,
#which will have xml fopoter and wavelength calibration if applicable
#dataContainer.data will be a list of numpy arrays per ROI
import numpy ... | [
"xml.etree.ElementTree.fromstring",
"numpy.fromfile",
"numpy.dtype",
"numpy.int",
"numpy.reshape",
"numpy.fromstring",
"numpy.concatenate"
] | [((863, 903), 'numpy.fromfile', 'np.fromfile', (['f'], {'dtype': 'np.uint64', 'count': '(1)'}), '(f, dtype=np.uint64, count=1)\n', (874, 903), True, 'import numpy as np\n'), ((945, 986), 'numpy.fromfile', 'np.fromfile', (['f'], {'dtype': 'np.float32', 'count': '(1)'}), '(f, dtype=np.float32, count=1)\n', (956, 986), Tr... |
# Generated by Django 3.2.3 on 2021-05-23 09:38
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210523_1534'),
]
operations = [
migrations.CreateModel(
name='Consumer',
fields=[
... | [
"django.db.models.URLField",
"django.db.models.CharField",
"django.db.models.EmailField",
"django.db.models.IntegerField",
"django.db.models.UUIDField"
] | [((341, 432), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'default': 'uuid.uuid4', 'editable': '(False)', 'primary_key': '(True)', 'serialize': '(False)'}), '(default=uuid.uuid4, editable=False, primary_key=True,\n serialize=False)\n', (357, 432), False, 'from django.db import migrations, models\n'), ((4... |
"""
nbkode.testsuite.test_introspections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Capabilities of the package provide information about
the different solvers.
:copyright: 2020 by nbkode Authors, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import pytest
import n... | [
"pytest.warns",
"nbkode.__getattr__",
"pytest.raises",
"nbkode.get_solver",
"nbkode.get_solvers"
] | [((578, 611), 'nbkode.get_solvers', 'nbkode.get_solvers', ([], {'implicit': '(True)'}), '(implicit=True)\n', (596, 611), False, 'import nbkode\n'), ((670, 704), 'nbkode.get_solvers', 'nbkode.get_solvers', ([], {'implicit': '(False)'}), '(implicit=False)\n', (688, 704), False, 'import nbkode\n'), ((931, 966), 'nbkode.ge... |
from astropy.tests.helper import pytest
import numpy as np
from .. import Model
from .test_helpers import random_id, get_test_dust
from ...grid import AMRGrid
@pytest.mark.parametrize(('direction'), ['x', 'y', 'z'])
def test_amr_differing_widths(tmpdir, direction):
# Widths of grids in same level are not the sa... | [
"astropy.tests.helper.pytest.mark.parametrize",
"astropy.tests.helper.pytest.raises",
"numpy.ones"
] | [((163, 216), 'astropy.tests.helper.pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""direction"""', "['x', 'y', 'z']"], {}), "('direction', ['x', 'y', 'z'])\n", (186, 216), False, 'from astropy.tests.helper import pytest\n'), ((1540, 1593), 'astropy.tests.helper.pytest.mark.parametrize', 'pytest.mark.parametr... |
from django.db import models, transaction
from django.conf import settings
from kl_backend.utils import get_token
class Student(models.Model):
"""Students participate in conference rooms created by teachers."""
group = models.ForeignKey('kl_participants.Group', on_delete=models.PROTECT)
display_name = mo... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.CharField",
"kl_backend.utils.get_token"
] | [((230, 298), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""kl_participants.Group"""'], {'on_delete': 'models.PROTECT'}), "('kl_participants.Group', on_delete=models.PROTECT)\n", (247, 298), False, 'from django.db import models, transaction\n'), ((318, 350), 'django.db.models.CharField', 'models.CharField',... |
from typing import (
Any,
Callable,
Iterable,
NewType,
Tuple,
)
from dataclasses import dataclass
# Elements: name, out_kind, data
#
# out_kind is the type of data:
# - "data" for generic
# - "ssz" for SSZ encoded bytes
# - "meta" for generic data to collect into a meta data dict.
TestCasePart =... | [
"typing.NewType"
] | [((321, 366), 'typing.NewType', 'NewType', (['"""TestCasePart"""', 'Tuple[str, str, Any]'], {}), "('TestCasePart', Tuple[str, str, Any])\n", (328, 366), False, 'from typing import Any, Callable, Iterable, NewType, Tuple\n')] |
import pulsar as psr
def run_test():
tester=psr.PyTester("Testing MathSet and MathSet Iterator C++ Interface")
U1=psr.DoubleUniverse([1.0,2.0,3.0])
U2, U3=psr.DoubleUniverse([3.0,4.0,5.0]),psr.DoubleUniverse([3.0])
U4=psr.DoubleUniverse([9.0,51.0,100.0])
#Constructors
S1=psr.DoubleSet(... | [
"pulsar.PyTester",
"pulsar.DoubleUniverse",
"pulsar.DoubleSet"
] | [((53, 119), 'pulsar.PyTester', 'psr.PyTester', (['"""Testing MathSet and MathSet Iterator C++ Interface"""'], {}), "('Testing MathSet and MathSet Iterator C++ Interface')\n", (65, 119), True, 'import pulsar as psr\n'), ((132, 167), 'pulsar.DoubleUniverse', 'psr.DoubleUniverse', (['[1.0, 2.0, 3.0]'], {}), '([1.0, 2.0, ... |
import datetime
import os
import time
import warnings
from typing import List, Optional, Union
import google.auth
from google.auth.exceptions import TransportError
from google.cloud import bigquery
from google.cloud.bigquery import SchemaField
from pandas import DataFrame
from cryptofeed_werks.models import Symbol
f... | [
"google.cloud.bigquery.ScalarQueryParameter",
"warnings.simplefilter",
"google.cloud.bigquery.TimePartitioning",
"time.sleep",
"google.cloud.bigquery.LoadJobConfig",
"os.environ.get",
"google.cloud.bigquery.Table",
"warnings.catch_warnings"
] | [((1986, 2025), 'google.cloud.bigquery.Table', 'bigquery.Table', (['table_id'], {'schema': 'schema'}), '(table_id, schema=schema)\n', (2000, 2025), False, 'from google.cloud import bigquery\n'), ((2089, 2179), 'google.cloud.bigquery.TimePartitioning', 'bigquery.TimePartitioning', ([], {'field': '"""timestamp"""', 'type... |
import tornado.web
from app.domain.credit import Credit
from app.service import credit_service
from app.service import token_service
from app.database import credit_db
import json
class CreditApiA(tornado.web.RequestHandler):
async def get(self, *args, **kwargs):
token = token_service.get_token(self.requ... | [
"app.domain.credit.Credit",
"json.dumps",
"app.service.credit_service.find_user_credit",
"app.service.token_service.get_token",
"app.database.credit_db.get_credits",
"app.database.credit_db.get_credit",
"app.service.credit_service.update_credit"
] | [((287, 324), 'app.service.token_service.get_token', 'token_service.get_token', (['self.request'], {}), '(self.request)\n', (310, 324), False, 'from app.service import token_service\n'), ((805, 842), 'app.service.token_service.get_token', 'token_service.get_token', (['self.request'], {}), '(self.request)\n', (828, 842)... |
import cv2
import pytesseract
import os
import re
os.chdir("cropped/")
img_list = os.listdir()
for img in img_list:
if(os.path.splitext(img)[1] == ".jpg"):
image = cv2.imread(img)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
resized = cv2.resize(gray, (300, 50), interpolation=cv2.INTER_C... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.threshold",
"pytesseract.image_to_string",
"cv2.fastNlMeansDenoising",
"cv2.imread",
"os.path.splitext",
"os.chdir",
"cv2.imshow",
"re.sub",
"os.listdir",
"cv2.resize"
] | [((51, 71), 'os.chdir', 'os.chdir', (['"""cropped/"""'], {}), "('cropped/')\n", (59, 71), False, 'import os\n'), ((83, 95), 'os.listdir', 'os.listdir', ([], {}), '()\n', (93, 95), False, 'import os\n'), ((178, 193), 'cv2.imread', 'cv2.imread', (['img'], {}), '(img)\n', (188, 193), False, 'import cv2\n'), ((209, 248), '... |
from common_fixtures import * # NOQA
import time
from cattle import ApiError
@pytest.fixture(scope='module', autouse=True)
def update_event_settings(request, super_client):
settings = super_client.list_setting()
originals = []
def update_setting(new_value, s):
originals.append((setting, {'value'... | [
"time.time"
] | [((3219, 3230), 'time.time', 'time.time', ([], {}), '()\n', (3228, 3230), False, 'import time\n'), ((2381, 2392), 'time.time', 'time.time', ([], {}), '()\n', (2390, 2392), False, 'import time\n'), ((3059, 3070), 'time.time', 'time.time', ([], {}), '()\n', (3068, 3070), False, 'import time\n')] |
import cv2
import base64
import logging
import argparse
import numpy as np
from flask import Flask, Response, request, jsonify
from functions import DataSet
logging.basicConfig(level=logging.INFO)
app = Flask(
__name__
)
@app.route("/", methods=["POST"])
def index():
data = request.get_json()
src = da... | [
"base64.standard_b64decode",
"logging.basicConfig",
"argparse.ArgumentParser",
"numpy.frombuffer",
"flask.Flask",
"cv2.imdecode",
"functions.DataSet",
"flask.jsonify",
"flask.Response",
"flask.request.get_json"
] | [((159, 198), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (178, 198), False, 'import logging\n'), ((206, 221), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (211, 221), False, 'from flask import Flask, Response, request, jsonify\n'), ((288, 306)... |
from collections import defaultdict
sku_prices = {
'A': 50,
'B': 30,
'C': 20,
'D': 15,
'E': 40,
'F': 10,
'G': 20,
'H': 10,
'I': 35,
'J': 60,
'K': 70,
'L': 90,
'M': 15,
'N': 40,
'O': 10,
'P': 50,
'Q': 30,
'R': 50,
'S': 20,
'T': 20,
'U':... | [
"collections.defaultdict"
] | [((2372, 2395), 'collections.defaultdict', 'defaultdict', (['(lambda : 0)'], {}), '(lambda : 0)\n', (2383, 2395), False, 'from collections import defaultdict\n')] |
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return render(request, "hello/index.html")
def pratyaydeep(request):
return HttpResponse("Hello, Pratyaydeep")
def greet(request, name):
return render(request, "hello/... | [
"django.shortcuts.render",
"django.http.HttpResponse"
] | [((140, 175), 'django.shortcuts.render', 'render', (['request', '"""hello/index.html"""'], {}), "(request, 'hello/index.html')\n", (146, 175), False, 'from django.shortcuts import render\n'), ((219, 253), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello, Pratyaydeep"""'], {}), "('Hello, Pratyaydeep')\n", (231, 2... |
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APIClient
from core.models import Fish
from aquarium.serializers import FishSerializer
FISHES_URL = reverse('aquarium:fish-list')
class... | [
"django.contrib.auth.get_user_model",
"core.models.Fish.objects.all",
"core.models.Fish.objects.filter",
"django.urls.reverse",
"aquarium.serializers.FishSerializer",
"rest_framework.test.APIClient",
"core.models.Fish.objects.create"
] | [((283, 312), 'django.urls.reverse', 'reverse', (['"""aquarium:fish-list"""'], {}), "('aquarium:fish-list')\n", (290, 312), False, 'from django.urls import reverse\n'), ((446, 457), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (455, 457), False, 'from rest_framework.test import APIClient\n'), ((917, ... |
import json
from pathlib import Path
import numpy as np
import pandas as pd
from .utils import get_project_path, read_tsv
def _fetch_margulies_gradient():
"""Load Margulies gradients in Schaefer 100 space"""
path_dm_gradient = (
Path(get_project_path()) / "data/hcp/hcp_embed_1-10_Schaefer1000_7Netwo... | [
"numpy.corrcoef",
"pathlib.Path",
"json.load",
"pandas.concat"
] | [((1903, 1929), 'pandas.concat', 'pd.concat', (['collect'], {'axis': '(0)'}), '(collect, axis=0)\n', (1912, 1929), True, 'import pandas as pd\n'), ((812, 827), 'pathlib.Path', 'Path', (['data_path'], {}), '(data_path)\n', (816, 827), False, 'from pathlib import Path\n'), ((1035, 1055), 'json.load', 'json.load', (['json... |
#!/usr/bin/env python
import network
import mnist_loader
import pickle
training_data, validation_data, test_data = mnist_loader.load_data_wrapper()
net = network.Network([784, 100, 10])
net.SGD(training_data, 30, 10, 3.0, test_data=test_data)
with open('network.pkl', 'wb') as output: # Overwrites any existing fil... | [
"pickle.dump",
"network.Network",
"mnist_loader.load_data_wrapper"
] | [((117, 149), 'mnist_loader.load_data_wrapper', 'mnist_loader.load_data_wrapper', ([], {}), '()\n', (147, 149), False, 'import mnist_loader\n'), ((157, 188), 'network.Network', 'network.Network', (['[784, 100, 10]'], {}), '([784, 100, 10])\n', (172, 188), False, 'import network\n'), ((327, 376), 'pickle.dump', 'pickle.... |
"""
Functions for plotting datasets as 3D models in obj format for use in Blender.
"""
from sklearn import preprocessing
import pandas as pd
import sys
def add_cube_verticies(cube_str, x, y, z, point_size):
"""
Appends the described cube verticies to the given string.
Parameters
----------
cube_st... | [
"pandas.read_csv",
"pandas.DataFrame"
] | [((4830, 4873), 'pandas.read_csv', 'pd.read_csv', (['input_filename'], {'nrows': 'num_rows'}), '(input_filename, nrows=num_rows)\n', (4841, 4873), True, 'import pandas as pd\n'), ((5284, 5328), 'pandas.DataFrame', 'pd.DataFrame', (['original_data'], {'columns': 'columns'}), '(original_data, columns=columns)\n', (5296, ... |
# settings.py
from dotenv import load_dotenv
load_dotenv()
import os
Sharepoint_User = os.getenv("SHAREPOINT_USER")
Sharepoint_Pass = os.getenv("SHAREPOINT_PASS")
Sharepoint_Url = os.getenv("SHAREPOINT_URL") | [
"dotenv.load_dotenv",
"os.getenv"
] | [((45, 58), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (56, 58), False, 'from dotenv import load_dotenv\n'), ((88, 116), 'os.getenv', 'os.getenv', (['"""SHAREPOINT_USER"""'], {}), "('SHAREPOINT_USER')\n", (97, 116), False, 'import os\n'), ((135, 163), 'os.getenv', 'os.getenv', (['"""SHAREPOINT_PASS"""'], {}... |
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
import re
import time
output = subprocess.check_output(['dig', '@8.8.8.8', '+short', 'TXT', 'driver.wotlemons.com'])
print(output)
print(str(output))
dirty_driver = output.decode("utf-8")
print(dirty_driver)
current_driver = dirty... | [
"subprocess.check_output"
] | [((121, 210), 'subprocess.check_output', 'subprocess.check_output', (["['dig', '@8.8.8.8', '+short', 'TXT', 'driver.wotlemons.com']"], {}), "(['dig', '@8.8.8.8', '+short', 'TXT',\n 'driver.wotlemons.com'])\n", (144, 210), False, 'import subprocess\n')] |
from django.test import TestCase
from django.db import IntegrityError
from rebuc_app.models import Build
from .common import UnitTestHelper
class BuildUnitTestCase(TestCase, UnitTestHelper):
def check_is_later(self, version_to_compare, version_later):
build_to_compare_with = self.create_build(version_to_c... | [
"rebuc_app.models.Build.objects.get"
] | [((600, 630), 'rebuc_app.models.Build.objects.get', 'Build.objects.get', ([], {'pk': 'build.pk'}), '(pk=build.pk)\n', (617, 630), False, 'from rebuc_app.models import Build\n')] |
import jax
import jax.numpy as jnp
import numpy as onp
import haiku as hk
from jax.experimental import optix
from nsec.datasets.two_moons import get_two_moons
from nsec.datasets.gaussian_mixture import get_gm
from nsec.datasets.swiss_roll import get_swiss_roll
from nsec.utils import display_score_two_moons
from nsec.mo... | [
"matplotlib.pyplot.title",
"pickle.dump",
"matplotlib.pyplot.quiver",
"jax.random.PRNGKey",
"matplotlib.pyplot.tight_layout",
"nsec.models.dae.ardae.ARDAE",
"jax.experimental.optix.adam",
"numpy.random.randn",
"matplotlib.pyplot.imshow",
"jax.numpy.linspace",
"matplotlib.pyplot.colorbar",
"jax... | [((1829, 1846), 'jax.experimental.optix.adam', 'optix.adam', (['(0.001)'], {}), '(0.001)\n', (1839, 1846), False, 'from jax.experimental import optix\n'), ((1856, 1875), 'haiku.PRNGSequence', 'hk.PRNGSequence', (['(42)'], {}), '(42)\n', (1871, 1875), True, 'import haiku as hk\n'), ((4205, 4222), 'jax.experimental.optix... |
import pika
import sys
import base64
import json
import utils
import queue
class Consumer_Extern(object):
def __init__(self, server, user, password, queue_rabbit):
# Variables de RabbitMQ
self.connection = None
self.channel = None
self.server = server
self.user = user
... | [
"pika.credentials.PlainCredentials",
"pika.ConnectionParameters",
"json.loads"
] | [((586, 645), 'pika.credentials.PlainCredentials', 'pika.credentials.PlainCredentials', (['self.user', 'self.password'], {}), '(self.user, self.password)\n', (619, 645), False, 'import pika\n'), ((1447, 1463), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1457, 1463), False, 'import json\n'), ((722, 790), 'p... |
#!/usr/bin/env python
#
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distribu... | [
"BaseHTTPServer.BaseHTTPRequestHandler.__init__",
"json.loads",
"os.path.basename",
"os.path.realpath",
"BaseHTTPServer.BaseHTTPRequestHandler.log_message",
"json.dumps",
"time.sleep",
"re.match",
"base64.b64decode",
"urlparse.urlparse",
"sys.stdout.flush",
"traceback.format_exc",
"sys.stder... | [((6332, 6350), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (6348, 6350), False, 'import sys\n'), ((6505, 6523), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (6521, 6523), False, 'import sys\n'), ((2697, 2716), 'time.sleep', 'time.sleep', (['seconds'], {}), '(seconds)\n', (2707, 2716), False,... |
from __future__ import unicode_literals
from django.contrib import admin
from ietf.community.models import CommunityList, SearchRule, EmailSubscription
class CommunityListAdmin(admin.ModelAdmin):
list_display = [u'id', 'user', 'group']
raw_id_fields = ['user', 'group']
admin.site.register(CommunityList, Comm... | [
"django.contrib.admin.site.register"
] | [((281, 335), 'django.contrib.admin.site.register', 'admin.site.register', (['CommunityList', 'CommunityListAdmin'], {}), '(CommunityList, CommunityListAdmin)\n', (300, 335), False, 'from django.contrib import admin\n'), ((539, 587), 'django.contrib.admin.site.register', 'admin.site.register', (['SearchRule', 'SearchRu... |
import ckan.plugins.toolkit as tk
def get_package_source(package_id):
return tk.get_action('package_source_list')({}, {"package_id": package_id})
def get_package_reference(package_id):
return tk.get_action('package_reference_list')({}, {"package_id": package_id}) | [
"ckan.plugins.toolkit.get_action"
] | [((82, 118), 'ckan.plugins.toolkit.get_action', 'tk.get_action', (['"""package_source_list"""'], {}), "('package_source_list')\n", (95, 118), True, 'import ckan.plugins.toolkit as tk\n'), ((203, 242), 'ckan.plugins.toolkit.get_action', 'tk.get_action', (['"""package_reference_list"""'], {}), "('package_reference_list')... |
from sklearn.datasets import make_classification, make_blobs, load_iris
from sklearn.model_selection import train_test_split
import json
import numpy as np
def iris_dataset():
iris = load_iris()
X = iris.data[:, [0, 2]]
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(X, y,
... | [
"sklearn.datasets.load_iris",
"json.load",
"sklearn.model_selection.train_test_split",
"numpy.asarray",
"sklearn.datasets.make_classification",
"sklearn.datasets.make_blobs"
] | [((190, 201), 'sklearn.datasets.load_iris', 'load_iris', ([], {}), '()\n', (199, 201), False, 'from sklearn.datasets import make_classification, make_blobs, load_iris\n'), ((291, 346), 'sklearn.model_selection.train_test_split', 'train_test_split', (['X', 'y'], {'train_size': '(0.8)', 'random_state': '(42)'}), '(X, y, ... |
import logging
import sys
import os
from typing import List
from .core import BIBLIOGRAPHY
LOGGER = logging.getLogger(__name__)
def runtime_tracker(script: str, args: List[str], encoding: str):
BIBLIOGRAPHY.tracking()
sys.argv = [script, *args]
sys.path[0] = os.path.dirname(script)
try:
L... | [
"sys.exit",
"os.path.dirname",
"logging.getLogger"
] | [((103, 130), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (120, 130), False, 'import logging\n'), ((277, 300), 'os.path.dirname', 'os.path.dirname', (['script'], {}), '(script)\n', (292, 300), False, 'import os\n'), ((925, 988), 'sys.exit', 'sys.exit', (["('Cannot run file %r because: ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# $ sudo pip install impacket
'''
$ python2.7 ipc.py 192.168.206.130 '' ''
INFO:__main__:target ip: 192.168.206.130
INFO:__main__:target os: 32 bit
INFO:__main__: spoolss, True, {'ver_major': 5, 'ver_minor': 0, '_sec_trailer': 0, 'pduData': '\xb8\x10\xb8\x104\x17\x00\x00\x0... | [
"logging.basicConfig",
"logging.getLogger",
"impacket.dcerpc.v5.transport.SMBTransport",
"sys.exit",
"impacket.uuid.uuidtup_to_bin"
] | [((1478, 1517), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (1497, 1517), False, 'import logging\n'), ((1524, 1551), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1541, 1551), False, 'import logging\n'), ((4658, 4669), 'sys.ex... |
#!/usr/bin/python3
"""
simple module to manage the video files generated by the camera app
"""
from pootlestuff import watchables as wv
import os, pathlib, time, threading, queue
class fileManager(wv.watchablesmart):
def __init__(self, **kwargs):
self.diskfree=wv.floatWatch(app=self, value=float('nan'))
... | [
"threading.Thread",
"os.stat",
"os.statvfs",
"time.time",
"pathlib.Path",
"queue.Queue"
] | [((520, 531), 'time.time', 'time.time', ([], {}), '()\n', (529, 531), False, 'import os, pathlib, time, threading, queue\n'), ((548, 561), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (559, 561), False, 'import os, pathlib, time, threading, queue\n'), ((609, 663), 'threading.Thread', 'threading.Thread', ([], {'name'... |
import re
from bs4 import BeautifulSoup
class Parser:
@staticmethod
def get_enforcement_action_detail_links(html:str):
soup = BeautifulSoup(html, 'html.parser')
litigation_links = []
for a in soup.find_all('a', href=True):
if (re.search('\/enforcement\/actions\/.*/', a['h... | [
"bs4.BeautifulSoup",
"re.search"
] | [((144, 178), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (157, 178), False, 'from bs4 import BeautifulSoup\n'), ((495, 529), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (508, 529), False, 'from bs4 impor... |
import os
import argparse
import ast
import gc
import logging
import math
import sys
import time
import numpy as np
import pandas as pd
import hparameters
import utility
import json
def main(m_params, start_counter=0):
param_dictionary = {} #Format is key:value = htune_number: dict containing variable param... | [
"utility.get_script_directory",
"utility.parse_arguments",
"os.path.join",
"os.makedirs"
] | [((6301, 6353), 'os.path.join', 'os.path.join', (['"""./hypertune"""', 'f"""{mn}_param_dict.json"""'], {}), "('./hypertune', f'{mn}_param_dict.json')\n", (6313, 6353), False, 'import os\n'), ((6439, 6480), 'utility.get_script_directory', 'utility.get_script_directory', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (6467, 6... |
import datetime
import json
import logging
import multiprocessing
import os
import shutil
import tarfile
from collections import defaultdict
from functools import partial
from multiprocessing.pool import ThreadPool
from descriptions.descriptions_downloader import (check_and_get_checker,
... | [
"post_generation.hierarchy_to_countries.hierarchy_to_countries",
"json.dumps",
"collections.defaultdict",
"os.path.isfile",
"shutil.rmtree",
"os.path.join",
"multiprocessing.cpu_count",
"json.loads",
"os.path.exists",
"tarfile.open",
"descriptions.descriptions_downloader.download_from_wikipedia_... | [((1221, 1256), 'logging.getLogger', 'logging.getLogger', (['"""maps_generator"""'], {}), "('maps_generator')\n", (1238, 1256), False, 'import logging\n'), ((3101, 3141), 'os.path.exists', 'os.path.exists', (['env.packed_polygons_path'], {}), '(env.packed_polygons_path)\n', (3115, 3141), False, 'import os\n'), ((6129, ... |
#!/usr/bin/env python
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib as mpl
import matplotlib.dates as mdates
df = pd.read_csv("project/scox1/optical/data/vsolj29908_scox1_maehara.dat",
names=["source","time","magnitude","na"],
delimiter=" ")
print(df)
magnitude = df.magnitude.... | [
"pandas.read_csv",
"matplotlib.dates.DateFormatter",
"pandas.to_datetime",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((140, 274), 'pandas.read_csv', 'pd.read_csv', (['"""project/scox1/optical/data/vsolj29908_scox1_maehara.dat"""'], {'names': "['source', 'time', 'magnitude', 'na']", 'delimiter': '""" """'}), "('project/scox1/optical/data/vsolj29908_scox1_maehara.dat',\n names=['source', 'time', 'magnitude', 'na'], delimiter=' ')\n... |
try:
import struct
except ImportError:
import ustruct as struct
MPU6050_ADDR_BASE = 104
class MPU6050Error(Exception):
pass
class MPU6050(object):
def __init__(self, i2c, baudrate=400000, a0=0):
self.i2c = i2c
self.baudrate = baudrate
self.buf_accel = bytearray(6)
self... | [
"ustruct.unpack"
] | [((1036, 1073), 'ustruct.unpack', 'struct.unpack', (['""">hhh"""', 'self.buf_accel'], {}), "('>hhh', self.buf_accel)\n", (1049, 1073), True, 'import ustruct as struct\n'), ((1364, 1400), 'ustruct.unpack', 'struct.unpack', (['""">hhh"""', 'self.buf_gyro'], {}), "('>hhh', self.buf_gyro)\n", (1377, 1400), True, 'import us... |
import pytest
from appium import webdriver
from _pytest.fixtures import FixtureRequest
from ui.pages.main_page import MainPage
from ui.pages.settings_page import AboutApplicationPage, SettingsPage, SourcesNewsSettingsPage
class AndroidBaseTestCase(object):
main_page: MainPage = None
driver: webdriver.Remot... | [
"pytest.fixture"
] | [((366, 412), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (380, 412), False, 'import pytest\n'), ((713, 745), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (727, 745), False, 'import py... |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 29 20:44:27 2017
@author: finn
"""
import cv2
import sys
import cvutil as u
cap = u.source_video(sys.argv)
count = 0
while(count < 10):
count +=1
_, frame = cap.read()
cv2.imshow('frame',frame)
cv2.imwrite("../videos/frames/frame_{0}.png".format(count)... | [
"cv2.destroyAllWindows",
"cv2.imshow",
"cvutil.source_video"
] | [((133, 157), 'cvutil.source_video', 'u.source_video', (['sys.argv'], {}), '(sys.argv)\n', (147, 157), True, 'import cvutil as u\n'), ((333, 356), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (354, 356), False, 'import cv2\n'), ((232, 258), 'cv2.imshow', 'cv2.imshow', (['"""frame"""', 'frame'], {... |
from gridworld import GridWorld
import random
from collections import defaultdict
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from plot_utils import heatmap, annotate_heatmap, plotArrow
import math
def get_random_start_pos(gridworld):
width, height = len(gridworld.g... | [
"matplotlib.pyplot.title",
"math.isnan",
"matplotlib.pyplot.show",
"random.randint",
"plot_utils.plotArrow",
"numpy.argmax",
"numpy.empty",
"plot_utils.annotate_heatmap",
"collections.defaultdict",
"random.random",
"numpy.max",
"matplotlib.use",
"numpy.arange",
"random.seed",
"matplotlib... | [((119, 142), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (133, 142), False, 'import matplotlib\n'), ((558, 573), 'random.random', 'random.random', ([], {}), '()\n', (571, 573), False, 'import random\n'), ((848, 873), 'numpy.empty', 'np.empty', (['(width, height)'], {}), '((width, height))... |
import io
import json
import logging
import urllib.parse
from collections import namedtuple
import pytest
from google.auth.credentials import AnonymousCredentials
from google.cloud.storage import Client, Blob
from quetzal.app.api.data.file import create, details, details_w
from quetzal.app.api.exceptions import APIEx... | [
"io.BytesIO",
"json.loads",
"quetzal.app.api.data.file.create",
"quetzal.app.api.data.file.details_w",
"quetzal.app.models.Metadata.query.filter_by",
"pytest.raises",
"google.cloud.storage.Client",
"collections.namedtuple",
"quetzal.app.api.data.file.details",
"pytest.mark.parametrize",
"google.... | [((8154, 8282), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""state"""', '[ws for ws in WorkspaceState if ws not in [WorkspaceState.READY,\n WorkspaceState.CONFLICT]]'], {}), "('state', [ws for ws in WorkspaceState if ws not in\n [WorkspaceState.READY, WorkspaceState.CONFLICT]])\n", (8177, 8282), Fa... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.general import get_logger
from utils.test_env import EnvTest
from q2_schedule import LinearExploration, LinearSchedule
from q3_linear_torch import Linear
from configs.q4_nature import config
class NatureQN(Linear):
"""
Implementi... | [
"utils.test_env.EnvTest",
"q2_schedule.LinearSchedule",
"q2_schedule.LinearExploration"
] | [((2992, 3010), 'utils.test_env.EnvTest', 'EnvTest', (['(8, 8, 6)'], {}), '((8, 8, 6))\n', (2999, 3010), False, 'from utils.test_env import EnvTest\n'), ((3058, 3133), 'q2_schedule.LinearExploration', 'LinearExploration', (['env', 'config.eps_begin', 'config.eps_end', 'config.eps_nsteps'], {}), '(env, config.eps_begin,... |
from template.models import PersonModel
def test_model(db_session):
person = PersonModel(name='someone',
email='<EMAIL>')
db_session.add(person)
db_session.commit()
post_person = db_session.query(PersonModel).filter(PersonModel.name == 'someone').first()
assert post_perso... | [
"template.models.PersonModel"
] | [((82, 126), 'template.models.PersonModel', 'PersonModel', ([], {'name': '"""someone"""', 'email': '"""<EMAIL>"""'}), "(name='someone', email='<EMAIL>')\n", (93, 126), False, 'from template.models import PersonModel\n')] |
#!/usr/bin/python
# create QuantLib models from Python models
try:
import QuantLib as ql
except ModuleNotFoundError as e:
print('Error: Module QuantLibPayoffs requires a (custom) QuantLib installation.')
raise e
try:
from QuantLib import QuasiGaussianModel as qlQuasiGaussianModel
except ImportError a... | [
"sys.path.append",
"QuantLib.Actual365Fixed",
"QuantLib.Settings.instance",
"numpy.identity",
"numpy.array",
"QuantLib.QuasiGaussianModel"
] | [((627, 648), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (642, 648), False, 'import sys\n'), ((1384, 1423), 'numpy.array', 'np.array', (['[(0.0) for t in model._times]'], {}), '([(0.0) for t in model._times])\n', (1392, 1423), True, 'import numpy as np\n'), ((1498, 1523), 'numpy.identity', 'n... |
from util.Logger import Logger
from util.misc_util import *
import traceback
import sys
import numpy as np
import os
def _check_attr_is_None(attr):
def _check_attr_empty(f):
def wrapper(self, *args):
ret = f(self, *args)
if getattr(self, attr) is None:
... | [
"traceback.format_exception",
"os.makedirs",
"util.Logger.Logger",
"sys.exc_info",
"os.path.split",
"os.path.join",
"numpy.concatenate",
"numpy.repeat"
] | [((3317, 3366), 'util.Logger.Logger', 'Logger', (['self.__class__.__name__'], {'stdout_only': '(True)'}), '(self.__class__.__name__, stdout_only=True)\n', (3323, 3366), False, 'from util.Logger import Logger\n'), ((4100, 4117), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (4111, 4117), False, 'import os\n'... |
"""Test parser with a printer-like visitor."""
import nose.tools
import formast
class Printer(formast.Visitor):
def __init__(self):
formast.Visitor.__init__(self)
self.level = 0
self.lines = []
def __str__(self):
return "\n".join(self.lines)
def print_(self, txt):
... | [
"formast.Visitor.stats",
"formast.Module",
"formast.Visitor.enum_stats",
"formast.Visitor.__init__",
"formast.XmlParser"
] | [((146, 176), 'formast.Visitor.__init__', 'formast.Visitor.__init__', (['self'], {}), '(self)\n', (170, 176), False, 'import formast\n'), ((1007, 1037), 'formast.Visitor.stats', 'formast.Visitor.stats', (['self', 's'], {}), '(self, s)\n', (1028, 1037), False, 'import formast\n'), ((1736, 1771), 'formast.Visitor.enum_st... |
from django.conf import settings
import requests
import json
from mailchimp3 import MailChimp
def subscribe_user_to_mailer(profile):
status = True
if not settings.MAILERLITE_API_KEY:
return
content = json.dumps({"email": profile.user.email})
headers = {
"content-type": "application/j... | [
"requests.post",
"mailchimp3.MailChimp",
"json.dumps"
] | [((223, 264), 'json.dumps', 'json.dumps', (["{'email': profile.user.email}"], {}), "({'email': profile.user.email})\n", (233, 264), False, 'import json\n'), ((416, 513), 'requests.post', 'requests.post', (['"""https://api.mailerlite.com/api/v2/subscribers"""'], {'data': 'content', 'headers': 'headers'}), "('https://api... |
############################################################################
# Copyright (c) 2015-2017 Saint Petersburg State University
# Copyright (c) 2011-2015 Saint Petersburg Academic University
# All Rights Reserved
# See file LICENSE for details.
##################################################################... | [
"os.path.abspath",
"quast_libs.qutils.label_from_fpath",
"os.path.basename",
"quast_libs.plotter.draw_report_table",
"quast_libs.qutils.val_to_str",
"quast_libs.log.get_logger",
"os.path.join",
"quast_libs.qutils.name_from_fpath"
] | [((471, 510), 'quast_libs.log.get_logger', 'get_logger', (['qconfig.LOGGER_DEFAULT_NAME'], {}), '(qconfig.LOGGER_DEFAULT_NAME)\n', (481, 510), False, 'from quast_libs.log import get_logger\n'), ((12064, 12103), 'quast_libs.log.get_logger', 'get_logger', (['qconfig.LOGGER_DEFAULT_NAME'], {}), '(qconfig.LOGGER_DEFAULT_NA... |
# -*- coding: utf-8 -*-
"""Implements the RippleNet model."""
import logging
import math
import multiprocessing as mp
import time
from collections import defaultdict
from typing import Dict, Optional, Sequence, Tuple, Union
import numpy as np
import torch
from jsonargparse import Namespace
from jsonargparse.typing i... | [
"numpy.isin",
"sklearn.model_selection.train_test_split",
"torch.nn.init.uniform_",
"torch.empty",
"collections.defaultdict",
"sklearn.metrics.f1_score",
"numpy.random.choice",
"torch.nn.Linear",
"multiprocessing.JoinableQueue",
"torch.zeros_like",
"torch.nn.init.xavier_uniform_",
"time.perf_c... | [((739, 766), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (756, 766), False, 'import logging\n'), ((3972, 4015), 'torch.nn.Linear', 'nn.Linear', (['embed_dim', 'embed_dim'], {'bias': '(False)'}), '(embed_dim, embed_dim, bias=False)\n', (3981, 4015), False, 'from torch import nn\n'), ((... |
from click.testing import CliRunner
from hatch.cli import hatch
from hatch.settings import (
SETTINGS_FILE, copy_default_settings, load_settings, save_settings
)
from hatch.utils import temp_chdir, temp_move_path
def test_show_location():
with temp_chdir():
runner = CliRunner()
result = runne... | [
"hatch.settings.copy_default_settings",
"hatch.utils.temp_move_path",
"hatch.settings.load_settings",
"hatch.utils.temp_chdir",
"hatch.settings.save_settings",
"click.testing.CliRunner"
] | [((255, 267), 'hatch.utils.temp_chdir', 'temp_chdir', ([], {}), '()\n', (265, 267), False, 'from hatch.utils import temp_chdir, temp_move_path\n'), ((286, 297), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (295, 297), False, 'from click.testing import CliRunner\n'), ((519, 531), 'hatch.utils.temp_chdir', '... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
class Device(models.Model):
description = models.CharField(max_length=200, null=True, blank=True)
state = models.BooleanField(default=False)
def __str__(self):
return "id=" + str(self.id) + ", des=" + se... | [
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((142, 197), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)', 'null': '(True)', 'blank': '(True)'}), '(max_length=200, null=True, blank=True)\n', (158, 197), False, 'from django.db import models\n'), ((210, 244), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(F... |
# -*- coding:utf8 -*-
""""""
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from wechat_sdk import WechatC
conf = WechatConf(
token='<PASSWORD>',
appid='wx29533c7d857ec5ae',
appsecret='<KEY>',
encrypt_mode='normal', # 可选项:normal/compatible/safe,分别对应于 明文/兼容/安全 模式
encoding_aes_key='<KEY>' # ... | [
"wechat_sdk.WechatBasic",
"sys.setdefaultencoding"
] | [((52, 82), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (74, 82), False, 'import sys\n'), ((395, 417), 'wechat_sdk.WechatBasic', 'WechatBasic', ([], {'conf': 'conf'}), '(conf=conf)\n', (406, 417), False, 'from wechat_sdk import WechatBasic\n')] |
# coding: utf-8
# app/__init__.py
from flask import Flask
from flask_praetorian import Praetorian
from app.model import User
guard = Praetorian()
def create_app():
app = Flask(__name__)
app.config.from_object("config.Config")
guard.init_app(app, User)
from app.routes import api
app.register... | [
"flask.Flask",
"flask_praetorian.Praetorian"
] | [((137, 149), 'flask_praetorian.Praetorian', 'Praetorian', ([], {}), '()\n', (147, 149), False, 'from flask_praetorian import Praetorian\n'), ((180, 195), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (185, 195), False, 'from flask import Flask\n')] |
"""Microscoper is a wrapper around bioformats using a forked
python-bioformats to extract the raw images from Olympus IX83
CellSense .vsi format, into a more commonly used TIFF format.
Images are bundled together according to their channels.
This code is used internally in SCB Lab, TCIS, TIFR-H.
You're free to modify... | [
"tqdm.tqdm",
"javabridge.static_call",
"javabridge.get_static_field",
"os.makedirs",
"javabridge.kill_vm",
"os.path.basename",
"bioformats.get_omexml_metadata",
"os.path.realpath",
"os.walk",
"os.path.exists",
"numpy.asarray",
"tifffile.TiffWriter",
"javabridge.start_vm",
"bioformats.Image... | [((984, 1002), 'os.walk', 'os.walk', (['directory'], {}), '(directory)\n', (991, 1002), False, 'import os\n'), ((1294, 1326), 'bioformats.get_omexml_metadata', 'bf.get_omexml_metadata', (['filename'], {}), '(filename)\n', (1316, 1326), True, 'import bioformats as bf\n'), ((1342, 1364), 'bioformats.omexml.OMEXML', 'bf.o... |
import argparse
import numpy as np
import glob
import torch
import torch.nn.functional as F
import os
from kaldi_io import read_mat_scp
import model as model_
import scipy.io as sio
from utils import *
def prep_feats(data_):
#data_ = ( data_ - data_.mean(0) ) / data_.std(0)
features = data_.T
if features.shape[... | [
"model.DenseNet",
"model.cnn_lstm",
"os.remove",
"model.TDNN",
"argparse.ArgumentParser",
"model.MobileNetV3_Small",
"os.path.isfile",
"numpy.tile",
"model.lcnn_9layers",
"torch.no_grad",
"model.lcnn_29layers_v2_pca",
"model.Linear",
"model.FTDNN",
"model.VGG",
"torch.load",
"model.TDN... | [((554, 607), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Compute scores"""'}), "(description='Compute scores')\n", (577, 607), False, 'import argparse\n'), ((4587, 4616), 'os.path.isfile', 'os.path.isfile', (['args.out_path'], {}), '(args.out_path)\n', (4601, 4616), False, 'import os... |
""" If this operator needs to be run with the faster NMS implementation,
follow these steps:
1. Clone google/automl and tensorflow/models from Github.
2. Run the following commands in automl/efficientdet:
a. grep -lIR "from object_detection" ./* | xargs sed -i "s/from object_detection/from object_det/g"... | [
"pylot.perception.detection.utils.load_coco_labels",
"tensorflow.reshape",
"inference.image_preprocess",
"tensorflow.compat.v1.disable_eager_execution",
"tensorflow.ConfigProto",
"numpy.isclose",
"tensorflow.GPUOptions",
"erdos.profile_method",
"erdos.utils.setup_csv_logging",
"pylot.perception.me... | [((8167, 8189), 'erdos.profile_method', 'erdos.profile_method', ([], {}), '()\n', (8187, 8189), False, 'import erdos\n'), ((2318, 2388), 'erdos.utils.setup_logging', 'erdos.utils.setup_logging', (['self.config.name', 'self.config.log_file_name'], {}), '(self.config.name, self.config.log_file_name)\n', (2343, 2388), Fal... |
from flask import Flask, request, render_template, jsonify
app = Flask(__name__)
def get_image_urls(ids):
"""function to map ids to image URLS"""
return [f"http://127.0.0.1:8000/{id}" for id in ids]
@app.route('/', methods=['GET'])
def app_main():
ids = request.args.get('asset_ids').split(',')
ima... | [
"flask.request.args.get",
"flask.jsonify",
"flask.Flask",
"flask.render_template"
] | [((67, 82), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (72, 82), False, 'from flask import Flask, request, render_template, jsonify\n'), ((361, 413), 'flask.render_template', 'render_template', (['"""index.html"""'], {'image_urls': 'image_urls'}), "('index.html', image_urls=image_urls)\n", (376, 413), ... |
from slerp.logger import logging
from slerp.validator import Key, Number
from sqlalchemy import func, case
from flask import json
from constant.api_constant import ActivityType
from entity.models import Activity, Friend, UserPrincipal, SchoolClass, SchoolLevel, Lesson, LessonViewer
log = logging.getLogger(__name__)
... | [
"entity.models.LessonViewer.query.filter_by",
"entity.models.Activity.created_at.desc",
"entity.models.Activity",
"entity.models.Activity.query.with_entities",
"sqlalchemy.case",
"entity.models.UserPrincipal.fullname.label",
"entity.models.Activity.id.desc",
"slerp.validator.Number",
"entity.models.... | [((291, 318), 'slerp.logger.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (308, 318), False, 'from slerp.logger import logging\n'), ((419, 446), 'slerp.validator.Key', 'Key', (["['message', 'user_id']"], {}), "(['message', 'user_id'])\n", (422, 446), False, 'from slerp.validator import Ke... |
from __future__ import absolute_import
import click
import click_log
import json
import logging
import os
import sys
import signal
import traceback
import webfriend.info
from webfriend.browser import Chrome
from webfriend.scripting.parser.exceptions import UserError
from webfriend.scripting.environment import Environme... | [
"sys.stdin.isatty",
"click.argument",
"webfriend.scripting.environment.Environment",
"click_log.ColorFormatter",
"os.getcwd",
"os.path.dirname",
"logging.StreamHandler",
"click.option",
"click.File",
"webfriend.utils.docs.document_commands",
"json.dumps",
"traceback.format_exc",
"webfriend.r... | [((468, 487), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (485, 487), False, 'import logging\n'), ((494, 534), 'logging.StreamHandler', 'logging.StreamHandler', ([], {'stream': 'sys.stderr'}), '(stream=sys.stderr)\n', (515, 534), False, 'import logging\n'), ((603, 643), 'click.group', 'click.group', ([]... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2021, Amazon Web Services. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/li... | [
"tensorflow.summary.image",
"sagemakercv.core.BoxDetector",
"sagemakercv.utils.visualization.restore_image",
"sagemakercv.utils.visualization.build_image",
"tensorflow.summary.create_file_writer",
"concurrent.futures.ThreadPoolExecutor",
"tensorflow.expand_dims"
] | [((1368, 1414), 'sagemakercv.utils.visualization.restore_image', 'visualization.restore_image', (['image', 'image_info'], {}), '(image, image_info)\n', (1395, 1414), False, 'from sagemakercv.utils import visualization\n'), ((1441, 1557), 'sagemakercv.utils.visualization.build_image', 'visualization.build_image', (['ima... |
import torch.nn as nn
class DQN(nn.Module):
def __init__(self, input_size, hidden_size, actions):
super(DQN, self).__init__()
self.relu = nn.ReLU()
self.fc1 = nn.Linear(input_size, hidden_size)
self.fc2 = nn.Linear(hidden_size, hidden_size)
self.fc3 = nn.Linear(hidden_size,... | [
"torch.nn.ReLU",
"torch.nn.Linear"
] | [((160, 169), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (167, 169), True, 'import torch.nn as nn\n'), ((189, 223), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'hidden_size'], {}), '(input_size, hidden_size)\n', (198, 223), True, 'import torch.nn as nn\n'), ((243, 278), 'torch.nn.Linear', 'nn.Linear', (['hidden_... |
#!/usr/bin/env python
import atexit
import end_to_end_lib
import os
import signal
import subprocess
# Launch a server cluster with default setting (1 master + 3 chunk servers)
# Execute a client process that creates multiple different files in parallel
# Called when script exiting to prevent dangling processes
def ha... | [
"atexit.register",
"end_to_end_lib.kill_all_processes",
"subprocess.Popen",
"end_to_end_lib.start_master_and_chunk_servers",
"end_to_end_lib.setup_test_directory"
] | [((355, 395), 'end_to_end_lib.kill_all_processes', 'end_to_end_lib.kill_all_processes', (['procs'], {}), '(procs)\n', (388, 395), False, 'import end_to_end_lib\n'), ((507, 558), 'end_to_end_lib.setup_test_directory', 'end_to_end_lib.setup_test_directory', (['test_case_name'], {}), '(test_case_name)\n', (542, 558), Fals... |
import struct
from typing import Optional
from imageprobe.client import DownloadClient
from imageprobe.errors import CorruptedImage
from imageprobe.types import ImageData
async def gif(client: DownloadClient) -> Optional[ImageData]:
# Validate GIF signature
await client.read_from_start(6)
if client.buffe... | [
"imageprobe.types.ImageData",
"struct.unpack",
"imageprobe.errors.CorruptedImage"
] | [((615, 692), 'imageprobe.types.ImageData', 'ImageData', ([], {'width': 'width', 'height': 'height', 'extension': '"""gif"""', 'mime_type': '"""image/gif"""'}), "(width=width, height=height, extension='gif', mime_type='image/gif')\n", (624, 692), False, 'from imageprobe.types import ImageData\n'), ((471, 512), 'struct.... |
from flask import request,render_template
@app.route('/', methods=['GET', 'POST'])
def home():
return render_template('home.html') | [
"flask.render_template"
] | [((107, 135), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (122, 135), False, 'from flask import request, render_template\n')] |
#!/usr/bin/env python3
import re, random
from collections import defaultdict
from .utilities import BasePlugin
class PersonalityPlugin(BasePlugin):
"""
Personality plugin for Botty.
Adds a help command, responds to being thanked, and repeats things if two people say the same thing one after the other.
... | [
"random.random",
"re.search",
"random.choice"
] | [((4940, 4966), 're.search', 're.search', (['pattern', 'm.text'], {}), '(pattern, m.text)\n', (4949, 4966), False, 'import re, random\n'), ((5186, 5201), 'random.random', 'random.random', ([], {}), '()\n', (5199, 5201), False, 'import re, random\n'), ((5234, 5313), 'random.choice', 'random.choice', (["['lenny', 'boredp... |
import discord
import praw
import asyncio
import random
from discord.ext import commands
bot = commands.Bot(case_insensitive=True,description="test", command_prefix="./")
bot.remove_command("help")
reddit = praw.Reddit(client_id='Ir3M_dfRK9IrKA',
client_secret='<KEY>',
user_a... | [
"discord.Color.blurple",
"discord.Embed",
"asyncio.sleep",
"discord.Color.red",
"random.choice",
"discord.Color.blue",
"discord.ext.commands.Bot",
"praw.Reddit"
] | [((96, 172), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'case_insensitive': '(True)', 'description': '"""test"""', 'command_prefix': '"""./"""'}), "(case_insensitive=True, description='test', command_prefix='./')\n", (108, 172), False, 'from discord.ext import commands\n'), ((209, 305), 'praw.Reddit', 'praw.Redd... |
from entente.equality import have_same_topology
from lacecore import shapes
import numpy as np
def test_have_same_topology():
cube_1 = shapes.cube(np.zeros(3), 1.0)
cube_2 = shapes.cube(np.zeros(3), 1.0)
assert have_same_topology(cube_1, cube_2) is True
cube_1 = shapes.cube(np.zeros(3), 1.0)
cub... | [
"numpy.roll",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"entente.equality.have_same_topology"
] | [((511, 539), 'numpy.roll', 'np.roll', (['cube_2.f', '(1)'], {'axis': '(1)'}), '(cube_2.f, 1, axis=1)\n', (518, 539), True, 'import numpy as np\n'), ((697, 730), 'numpy.zeros', 'np.zeros', (['(0, 3)'], {'dtype': 'np.uint64'}), '((0, 3), dtype=np.uint64)\n', (705, 730), True, 'import numpy as np\n'), ((154, 165), 'numpy... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
"""
Unit tests for pointilist.graph.
"""
import os
import unittest
import urllib.request
from urllib.error import HTTPError
from io import StringIO
from pointilist import graph
STATIC_DIR = os.path.dirname(os.path.realpath(__file_... | [
"unittest.main",
"io.StringIO",
"pointilist.graph.Graph",
"os.path.realpath"
] | [((30318, 30336), 'io.StringIO', 'StringIO', (['"""foobar"""'], {}), "('foobar')\n", (30326, 30336), False, 'from io import StringIO\n'), ((34262, 34277), 'unittest.main', 'unittest.main', ([], {}), '()\n', (34275, 34277), False, 'import unittest\n'), ((296, 322), 'os.path.realpath', 'os.path.realpath', (['__file__'], ... |
from datetime import date, datetime
from django.core.mail import send_mail
from rest_framework import exceptions
from users.models import ContactDetails
from podcasts.models import Podcast
from .models import GuestSpeakingApplication, GuestPost
def get_number_of_posts_this_month(user):
current_month = date(year... | [
"users.models.ContactDetails.objects.filter",
"django.core.mail.send_mail",
"podcasts.models.Podcast.objects.filter",
"datetime.datetime.now",
"rest_framework.exceptions.ParseError"
] | [((2361, 2491), 'django.core.mail.send_mail', 'send_mail', (['"""You got a new Guest Speaking Application!"""', 'message', '"""<EMAIL>"""', "[f'{guest_post.owner.email}']"], {'fail_silently': '(False)'}), "('You got a new Guest Speaking Application!', message, '<EMAIL>',\n [f'{guest_post.owner.email}'], fail_silentl... |
import numpy as np
from gym_collision_avoidance.envs.config import Config
from gym_collision_avoidance.envs.util import wrap, find_nearest
from gym_collision_avoidance.envs.utils import end_conditions as ec
import operator
import math
class Agent(object):
def __init__(self, start_x, start_y, goal_x, goal_y, radius... | [
"numpy.arctan2",
"math.sqrt",
"numpy.roll",
"numpy.empty",
"numpy.zeros",
"numpy.ones",
"numpy.sin",
"numpy.array",
"numpy.linalg.norm",
"gym_collision_avoidance.envs.util.wrap",
"numpy.linalg.inv",
"numpy.cos",
"numpy.dot"
] | [((734, 779), 'numpy.array', 'np.array', (['[start_x, start_y]'], {'dtype': '"""float64"""'}), "([start_x, start_y], dtype='float64')\n", (742, 779), True, 'import numpy as np\n'), ((813, 856), 'numpy.array', 'np.array', (['[goal_x, goal_y]'], {'dtype': '"""float64"""'}), "([goal_x, goal_y], dtype='float64')\n", (821, ... |
#Based on https://www.kaggle.com/tezdhar/wordbatch-with-memory-test
import gc
import time
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix, hstack
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import LabelBinarizer
from sklearn.model_selection import t... | [
"sklearn.feature_extraction.text.CountVectorizer",
"wordbatch.WordBatch",
"pandas.read_csv",
"sklearn.feature_extraction.text.TfidfVectorizer",
"wordbatch.models.FM_FTRL",
"gc.collect",
"pickle.load",
"wordbatch.models.FTRL",
"pandas.DataFrame",
"re.findall",
"pandas.concat",
"numpy.log1p",
... | [((3793, 3821), 're.compile', 're.compile', (['u"""[^A-Za-z0-9]+"""'], {}), "(u'[^A-Za-z0-9]+')\n", (3803, 3821), False, 'import re\n'), ((4125, 4136), 'time.time', 'time.time', ([], {}), '()\n', (4134, 4136), False, 'import time\n'), ((4695, 4787), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {'ind... |
import unittest
import json
import os
from memcnn.experiment.factory import load_experiment_config, experiment_config_parser
from memcnn.config import Config
import memcnn.config
class ConfigTestCase(unittest.TestCase):
class ConfigTest(Config):
@staticmethod
def get_filename():
retur... | [
"unittest.main",
"json.load",
"memcnn.experiment.factory.experiment_config_parser",
"os.path.dirname",
"os.path.exists",
"memcnn.config.Config.get_dir",
"memcnn.config.Config.get_filename",
"memcnn.experiment.factory.load_experiment_config"
] | [((2124, 2139), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2137, 2139), False, 'import unittest\n'), ((490, 515), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (505, 515), False, 'import os\n'), ((592, 617), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', ... |
"""
The goal of this file is to Encode a document
We inspire ourselves from https://github.com/facebookresearch/LASER/blob/master/source/embed.py
The idea is to reproduce the Similarity Search task from LASER with XLM-R
XLM-R is the new SOTA in multilingual embeddings, hence it should outperform LASER in this task
"""... | [
"sys.path.append",
"indexing.IndexPrintConfusionMatrix",
"indexing.IndexSearchMultiple",
"argparse.ArgumentParser",
"indexing.IndexCreate"
] | [((499, 524), 'sys.path.append', 'sys.path.append', (['"""./lib/"""'], {}), "('./lib/')\n", (514, 524), False, 'import sys\n'), ((652, 781), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Multilingual encoding and cross-lingual similarity search with different models."""'}), "(descriptio... |
import click
@click.command()
def main(args=None):
"""Console script for flask_extension"""
click.echo("Replace this message by putting your code into "
"flask_extension.cli.main")
click.echo("See click documentation at http://click.pocoo.org/")
if __name__ == "__main__":
main()
| [
"click.echo",
"click.command"
] | [((16, 31), 'click.command', 'click.command', ([], {}), '()\n', (29, 31), False, 'import click\n'), ((102, 192), 'click.echo', 'click.echo', (['"""Replace this message by putting your code into flask_extension.cli.main"""'], {}), "(\n 'Replace this message by putting your code into flask_extension.cli.main')\n", (11... |