code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"typing.TypeVar",
"logging.getLogger"
] | [((1259, 1301), 'typing.TypeVar', 'TypeVar', (['"""InstrumentT"""'], {'bound': '"""Instrument"""'}), "('InstrumentT', bound='Instrument')\n", (1266, 1301), False, 'from typing import Callable, Generator, Generic, Iterable, Optional, TypeVar, Union\n'), ((1314, 1333), 'logging.getLogger', 'getLogger', (['__name__'], {})... |
#from clientController import ClientController
from client.clientController import ClientController
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
def main():
try:
app = QtWidgets.QApplication([])
controller = ClientController()
controller.show()
app.exec_()
except Except... | [
"PyQt5.QtWidgets.QApplication",
"client.clientController.ClientController"
] | [((190, 216), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['[]'], {}), '([])\n', (212, 216), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((238, 256), 'client.clientController.ClientController', 'ClientController', ([], {}), '()\n', (254, 256), False, 'from client.clientController import Clien... |
import numpy as np
def day_1(file: str):
"""Read in day 1 part 1 input and count increasing values"""
with open(file) as f:
data_in = f.read()
# convert data to float
data = [float(i) for i in data_in.split()]
# Part 1
print(sum(np.diff(np.array(data)) > 0))
# Part 2
convolut... | [
"numpy.diff",
"numpy.array"
] | [((443, 463), 'numpy.diff', 'np.diff', (['convolution'], {}), '(convolution)\n', (450, 463), True, 'import numpy as np\n'), ((272, 286), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (280, 286), True, 'import numpy as np\n')] |
from __future__ import unicode_literals
import logging
from django.db import models
from django.contrib.gis.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from django.db.models import Max
from django.utils.encoding import python_2_unicode_compatible
from ledger.accounts.models import EmailU... | [
"django.contrib.postgres.fields.jsonb.JSONField",
"django.contrib.gis.db.models.ManyToManyField",
"django.contrib.gis.db.models.FileField",
"django.contrib.gis.db.models.TimeField",
"django.contrib.gis.db.models.ForeignKey",
"wildlifecompliance.components.main.email.prepare_mail",
"django.contrib.gis.db... | [((1213, 1240), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1230, 1240), False, 'import logging\n'), ((39782, 39861), 'reversion.register', 'reversion.register', (['Artifact'], {'follow': "['comms_logs', 'action_logs', 'documents']"}), "(Artifact, follow=['comms_logs', 'action_logs', ... |
from bokeh.models import HoverTool
from bokeh.plotting import figure, output_file, show
from bokeh.sampledata.glucose import data
x = data.loc['2010-10-06'].index.to_series()
y = data.loc['2010-10-06']['glucose']
# Basic plot setup
p = figure(width=800, height=400, x_axis_type="datetime",
tools="", toolbar... | [
"bokeh.plotting.output_file",
"bokeh.plotting.figure",
"bokeh.plotting.show",
"bokeh.models.HoverTool"
] | [((238, 355), 'bokeh.plotting.figure', 'figure', ([], {'width': '(800)', 'height': '(400)', 'x_axis_type': '"""datetime"""', 'tools': '""""""', 'toolbar_location': 'None', 'title': '"""Hover over points"""'}), "(width=800, height=400, x_axis_type='datetime', tools='',\n toolbar_location=None, title='Hover over point... |
import setuptools
import os
import re
with open("README.rst", "r", encoding="utf-8") as fh:
long_description = fh.read()
def load_version():
""" Loads a file content """
filename = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "katie", "__init__.py"))
with open(filename, "r... | [
"os.path.abspath",
"re.search",
"setuptools.find_packages"
] | [((1892, 1927), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""."""'}), "(where='.')\n", (1916, 1927), False, 'import setuptools\n'), ((241, 266), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (256, 266), False, 'import os\n'), ((399, 452), 're.search', 're.search... |
from util import get_dataset
from sklearn.metrics import classification_report
import numpy as np
from keras.layers import Dense, Input, concatenate
from keras.models import Model
from keras import backend as K
def recall_m(y_true, y_pred):
true_positives = K.sum(K.round(K.clip(y_true * y_pred, 0, 1)))
po... | [
"keras.backend.epsilon",
"util.get_dataset",
"keras.models.Model",
"keras.layers.Dense",
"numpy.array",
"keras.layers.Input",
"keras.layers.concatenate",
"keras.backend.clip"
] | [((988, 1012), 'keras.layers.Input', 'Input', ([], {'shape': '(bert_dim,)'}), '(shape=(bert_dim,))\n', (993, 1012), False, 'from keras.layers import Dense, Input, concatenate\n'), ((1326, 1353), 'keras.layers.Input', 'Input', ([], {'shape': '(profile_dim,)'}), '(shape=(profile_dim,))\n', (1331, 1353), False, 'from kera... |
# -*- coding: utf-8 -*-
################################################################################
## Form generated from reading UI file 'mainWindowWYIqrE.ui'
##
## Created by: Qt User Interface Compiler version 5.14.1
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
#########... | [
"PySide2.QtCore.QSize",
"PySide2.QtCore.QMetaObject.connectSlotsByName",
"PySide2.QtCore.QRect",
"PySide2.QtCore.QCoreApplication.translate",
"PySide2.QtGui.QFont"
] | [((1749, 1756), 'PySide2.QtGui.QFont', 'QFont', ([], {}), '()\n', (1754, 1756), False, 'from PySide2.QtGui import QBrush, QColor, QConicalGradient, QCursor, QFont, QFontDatabase, QIcon, QLinearGradient, QPalette, QPainter, QPixmap, QRadialGradient\n'), ((2753, 2760), 'PySide2.QtGui.QFont', 'QFont', ([], {}), '()\n', (2... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Abstract Parser for Zoncolan like output"""
import logging
import pprint
from collections import defaultdict
from typing import (
Any,... | [
"json.load",
"pprint.pformat",
"typing.cast",
"collections.defaultdict",
"xxhash.xxh64",
"logging.getLogger"
] | [((810, 835), 'logging.getLogger', 'logging.getLogger', (['"""sapp"""'], {}), "('sapp')\n", (827, 835), False, 'import logging\n'), ((8660, 8674), 'xxhash.xxh64', 'xxhash.xxh64', ([], {}), '()\n', (8672, 8674), False, 'import xxhash\n'), ((5015, 5032), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in September 2017
@author: mmalekzadeh
"""
import numpy as np
from keras.models import model_from_json
from keras import backend as K
def mcor(y_true, y_pred):
#matthews_correlation
y_pred_pos = K.round(K.clip(y_pred, 0, 1))
y_pred_neg = 1 - y_... | [
"matplotlib.pyplot.title",
"numpy.load",
"numpy.argmax",
"keras.backend.epsilon",
"matplotlib.pyplot.tight_layout",
"keras.backend.sqrt",
"numpy.set_printoptions",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.colorbar",
"numpy.append",
"matplotlib.pyplot.xticks",
... | [((1666, 1695), 'numpy.load', 'np.load', (['"""all_inferences.npy"""'], {}), "('all_inferences.npy')\n", (1673, 1695), True, 'import numpy as np\n'), ((2014, 2044), 'numpy.load', 'np.load', (['"""data_test_white.npy"""'], {}), "('data_test_white.npy')\n", (2021, 2044), True, 'import numpy as np\n'), ((2061, 2091), 'num... |
import json
class JSON:
@staticmethod
def readFromURL(url):
import requests
print("Downloading data...")
response = requests.get(url)
return json.loads(response.text)
@staticmethod
def readFromFile(filename):
file = open(filename, "r")
data = file.rea... | [
"json.dump",
"json.loads",
"requests.get"
] | [((151, 168), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (163, 168), False, 'import requests\n'), ((184, 209), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (194, 209), False, 'import json\n'), ((369, 385), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (379, 385), Fa... |
from datetime import datetime
from typing import Optional
from opyapi.schema.errors import NotWithinMaximumBoundaryError
from opyapi.schema.errors import NotWithinMinimumBoundaryError
from opyapi.schema.errors import ValidationError
from opyapi.schema.formatters import format_datetime
def validate_datetime(
valu... | [
"opyapi.schema.errors.NotWithinMaximumBoundaryError",
"opyapi.schema.errors.NotWithinMinimumBoundaryError",
"opyapi.schema.formatters.format_datetime",
"opyapi.schema.errors.ValidationError"
] | [((444, 466), 'opyapi.schema.formatters.format_datetime', 'format_datetime', (['value'], {}), '(value)\n', (459, 466), False, 'from opyapi.schema.formatters import format_datetime\n'), ((636, 755), 'opyapi.schema.errors.NotWithinMinimumBoundaryError', 'NotWithinMinimumBoundaryError', (['f"""Passed date `{datetime_value... |
import json
from enum import Enum
import pytest
from parameterized import ParameterizedInterface
@pytest.fixture
def example_enum():
class TestEnum(Enum):
ONE = 1
TWO = 2
THREE = 3
return TestEnum
class TestParameterizedInterface:
def test_abc(self, example_enum):
clas... | [
"pytest.raises"
] | [((920, 944), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (933, 944), False, 'import pytest\n'), ((1034, 1058), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (1047, 1058), False, 'import pytest\n'), ((1150, 1174), 'pytest.raises', 'pytest.raises', (['TypeError'], {}... |
#! python2.7
from . import do_support, util
from .io import fix_relative_symlinks
import argparse
import copy
import importlib
import inspect
import json
import logging
import os
import pprint
import re
import string
import sys
import time
from pipes import quote # shlex in python3.3+
DONE = 'done'
STATUS = 'status'
TI... | [
"os.path.isabs",
"pprint.pformat",
"getpass.getuser",
"argparse.ArgumentParser",
"importlib.import_module",
"string.Formatter",
"os.getcwd",
"os.getpid",
"os.path.dirname",
"os.path.abspath",
"os.path.exists",
"copy.copy",
"time.sleep",
"inspect.getargspec",
"os.path.splitext",
"os.pat... | [((337, 356), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (354, 356), False, 'import logging\n'), ((1490, 1585), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'DESCRIPTION', 'epilog': 'EPILOG', 'formatter_class': '_Formatter'}), '(description=DESCRIPTION, epilog=EPILOG,\n ... |
import gym
import sys
import rlschool.metamaze
def test_2d_maze(max_iteration):
print("Testing 2D Maze...")
maze_env = gym.make("meta-maze-2D-v0", enable_render=False)
cell_scale = 9
task = maze_env.sample_task(cell_scale=cell_scale)
maze_env.set_task(task)
iteration = 0
while iteration < m... | [
"gym.make"
] | [((128, 176), 'gym.make', 'gym.make', (['"""meta-maze-2D-v0"""'], {'enable_render': '(False)'}), "('meta-maze-2D-v0', enable_render=False)\n", (136, 176), False, 'import gym\n'), ((968, 1016), 'gym.make', 'gym.make', (['"""meta-maze-3D-v0"""'], {'enable_render': '(False)'}), "('meta-maze-3D-v0', enable_render=False)\n"... |
import random
import time
from front_base.host_manager import HostManagerBase
class HostManager(HostManagerBase):
def __init__(self, logger, appids=[]):
self.logger = logger
self.appids = appids
def set_appids(self, appids):
self.appids = appids
def get_sni_host(self, ip):
... | [
"random.choice",
"time.sleep"
] | [((407, 420), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (417, 420), False, 'import time\n'), ((486, 512), 'random.choice', 'random.choice', (['self.appids'], {}), '(self.appids)\n', (499, 512), False, 'import random\n')] |
import unittest
import mock
import requests
from cla_public import app
from cla_public.apps.base import healthchecks
class DiskSpaceHealthcheckTest(unittest.TestCase):
@mock.patch("os.statvfs")
def test_disk_space_check_reports_on_available_and_total_space(self, stat_mock):
stat_mock.return_value.f_b... | [
"cla_public.app.create_app",
"cla_public.apps.base.healthchecks.check_backend_api",
"requests.exceptions.ConnectionError",
"mock.patch",
"cla_public.apps.base.healthchecks.check_disk"
] | [((176, 200), 'mock.patch', 'mock.patch', (['"""os.statvfs"""'], {}), "('os.statvfs')\n", (186, 200), False, 'import mock\n'), ((604, 628), 'mock.patch', 'mock.patch', (['"""os.statvfs"""'], {}), "('os.statvfs')\n", (614, 628), False, 'import mock\n'), ((1024, 1048), 'mock.patch', 'mock.patch', (['"""os.statvfs"""'], {... |
"""
=============================
kikola.templatetags.json_tags
=============================
Template filter to dumps Python var to JSON in templates.
Installation
============
Just add ``kikola`` to ``INSTALLED_APPS`` var of your project settings.
Filters
=======
jsonify
-------
Custom template filter ``jsonify... | [
"django.template.Library",
"django.utils.simplejson.dumps"
] | [((1099, 1108), 'django.template.Library', 'Library', ([], {}), '()\n', (1106, 1108), False, 'from django.template import Library\n'), ((1169, 1213), 'django.utils.simplejson.dumps', 'simplejson.dumps', (['obj'], {'cls': 'DjangoJSONEncoder'}), '(obj, cls=DjangoJSONEncoder)\n', (1185, 1213), False, 'from django.utils im... |
import numpy as np
from scipy.integrate import odeint
from matplotlib import pyplot as plt
def calc_derivative(ypos, time):
return -2*ypos
time_vec = np.linspace(0, 4, 40)
yvec = odeint(calc_derivative, 1, time_vec)
plt.figure(figsize=(4, 3))
plt.plot(time_vec, yvec)
plt.xlabel('t: Time')
plt.ylabel('y: Position... | [
"matplotlib.pyplot.plot",
"scipy.integrate.odeint",
"matplotlib.pyplot.figure",
"numpy.linspace",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout"
] | [((156, 177), 'numpy.linspace', 'np.linspace', (['(0)', '(4)', '(40)'], {}), '(0, 4, 40)\n', (167, 177), True, 'import numpy as np\n'), ((185, 221), 'scipy.integrate.odeint', 'odeint', (['calc_derivative', '(1)', 'time_vec'], {}), '(calc_derivative, 1, time_vec)\n', (191, 221), False, 'from scipy.integrate import odein... |
import apsw
import boto3
import os
import json
from flask import Blueprint, Response, abort, current_app, render_template, url_for
from . import setup_logger
from .webcommon import log_application_errors, flask_log_level
from .webhooks import get_memcache_client
dots = Blueprint('dots', __name__)
# https://stackove... | [
"flask.Blueprint",
"boto3.client",
"flask.abort",
"os.environ.get",
"flask.url_for",
"apsw.VFS.__init__",
"flask.render_template",
"flask.Response"
] | [((272, 299), 'flask.Blueprint', 'Blueprint', (['"""dots"""', '__name__'], {}), "('dots', __name__)\n", (281, 299), False, 'from flask import Blueprint, Response, abort, current_app, render_template, url_for\n'), ((5828, 5859), 'flask.Response', 'Response', (['body'], {'headers': 'headers'}), '(body, headers=headers)\n... |
"""
Code (partially) based on:
https://github.com/fastai/fastai/blob/master/fastai/layers.py
"""
import torch
import torch.nn as nn
from vel.util.tensor_util import one_hot_encoding
class AdaptiveConcatPool2d(nn.Module):
""" Concat pooling - combined average pool and max pool """
def __init__(self, sz=None):... | [
"torch.nn.AdaptiveMaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"vel.util.tensor_util.one_hot_encoding"
] | [((392, 416), 'torch.nn.AdaptiveAvgPool2d', 'nn.AdaptiveAvgPool2d', (['sz'], {}), '(sz)\n', (412, 416), True, 'import torch.nn as nn\n'), ((435, 459), 'torch.nn.AdaptiveMaxPool2d', 'nn.AdaptiveMaxPool2d', (['sz'], {}), '(sz)\n', (455, 459), True, 'import torch.nn as nn\n'), ((1305, 1342), 'vel.util.tensor_util.one_hot_... |
#!/usr/bin/env python3
"""
OpenPeyote. A program for designing patterns to be made with the
Peyote beading technique.
Author: <NAME> (<EMAIL>)
Date: 10.11.2014
"""
from PyQt5.QtCore import *
from PyQt5.QtGui import *
import json
from design_widget import *
from catalog_widget import *
from wizards_and_dialogs import ... | [
"json.load"
] | [((4204, 4219), 'json.load', 'json.load', (['file'], {}), '(file)\n', (4213, 4219), False, 'import json\n')] |
from testcontainers.compose import DockerCompose
import pytest
def pytest_addoption(parser):
parser.addoption(
"--publish-pact", type=str, action="store",
help="Upload generated pact file to pact broker with version"
)
parser.addoption(
"--provider-url", type=str, action="store",... | [
"testcontainers.compose.DockerCompose",
"pytest.fixture"
] | [((543, 588), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (557, 588), False, 'import pytest\n'), ((809, 888), 'testcontainers.compose.DockerCompose', 'DockerCompose', (['"""../broker"""'], {'compose_file_name': "['docker-compose.yml']",... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import scipy.io as sio
import seaborn as sns
import matplotlib.pyplot as plt
import wget
import os
from random import shuffle
import cv2
from PIL import Image
sns.set_style("white")
# ----------------------Downloading DATA-------------... | [
"matplotlib.pyplot.title",
"os.mkdir",
"scipy.io.loadmat",
"random.shuffle",
"matplotlib.pyplot.tight_layout",
"numpy.unique",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.yticks",
"numpy.transpose",
"os.path.exists",
"matplotlib.pyplot.xticks",
"cv2.resize",
"seaborn.set_style",
"cv2.eq... | [((17, 50), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (40, 50), False, 'import warnings\n'), ((241, 263), 'seaborn.set_style', 'sns.set_style', (['"""white"""'], {}), "('white')\n", (254, 263), True, 'import seaborn as sns\n'), ((2080, 2120), 'scipy.io.loadmat', 'sio.... |
import socket
def init_server(server_ip,server_port):
global server,i
try:
server=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
server_address=(server_ip,server_port)
server.bind(server_address)
i=0
print("Hello!! Im on {} at port {} :3".format(*server_address))
e... | [
"socket.socket"
] | [((99, 147), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (112, 147), False, 'import socket\n')] |
from flask_restful import Resource
from flask import request
import events
from os import environ
import hmac
import hashlib
import logging
logger = logging.getLogger("bbgc")
def not_implemented(event_key):
logger.error("%s is not currently supported.", event_key)
return {"Error": event_key + " is not curre... | [
"os.environ.get",
"events.handle_event",
"logging.getLogger",
"flask.request.headers.get"
] | [((151, 176), 'logging.getLogger', 'logging.getLogger', (['"""bbgc"""'], {}), "('bbgc')\n", (168, 176), False, 'import logging\n'), ((400, 432), 'os.environ.get', 'environ.get', (['"""BBGC_SECRET_TOKEN"""'], {}), "('BBGC_SECRET_TOKEN')\n", (411, 432), False, 'from os import environ\n'), ((494, 532), 'flask.request.head... |
# -----------------------------------------------------------------------------
# This class is for HAT-MDD10
# https://www.cytron.io/p-hat-mdd10
# -----------------------------------------------------------------------------
import RPi.GPIO as GPIO
import time
class motor:
def __init__(self, motorDir1=26, motor... | [
"RPi.GPIO.setmode",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"time.sleep",
"RPi.GPIO.PWM",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings"
] | [((488, 510), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (500, 510), True, 'import RPi.GPIO as GPIO\n'), ((519, 542), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (535, 542), True, 'import RPi.GPIO as GPIO\n'), ((552, 565), 'time.sleep', 'time.sleep', (['(1)']... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typi... | [
"isodate.parse_datetime",
"azure.core.exceptions.raise_with_traceback",
"os.fstat",
"logging.getLogger"
] | [((625, 652), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (642, 652), False, 'import logging\n'), ((946, 974), 'isodate.parse_datetime', 'isodate.parse_datetime', (['attr'], {}), '(attr)\n', (968, 974), False, 'import isodate\n'), ((1418, 1460), 'azure.core.exceptions.raise_with_traceb... |
"""A module to provides the class Item.
TODO: Better documentation
"""
import html
from re import sub
from re import search
from datetime import datetime
from markdown import markdown
from template import Template
from mutil import link_h1, downgrade_headings, wrap_it_in_a_link, strip_tags_from_html, \
first_imag... | [
"markdown.markdown",
"datetime.datetime.strptime",
"mutil.downgrade_headings",
"mutil.wrap_it_in_a_link",
"re.search",
"mutil.link_h1",
"re.sub"
] | [((5302, 5371), 're.search', 'search', (['"""<!-- *META_DESCRIPTION *= *(.*?) *-->"""', 'self.markdown_source'], {}), "('<!-- *META_DESCRIPTION *= *(.*?) *-->', self.markdown_source)\n", (5308, 5371), False, 'from re import search\n'), ((6605, 6681), 're.search', 'search', (['""".*<!-- (\\\\d\\\\d?/\\\\d\\\\d?/\\\\d\\\... |
import numpy as np
from mmdet.datasets import PIPELINES
from mmdet.datasets.pipelines.formating import Collect
from ssod.core import TrimapMasks
@PIPELINES.register_module()
class ExtraAttrs(object):
def __init__(self, **attrs):
self.attrs = attrs
def __call__(self, results):
for k, v in sel... | [
"numpy.zeros",
"mmdet.datasets.PIPELINES.register_module",
"numpy.ones"
] | [((149, 176), 'mmdet.datasets.PIPELINES.register_module', 'PIPELINES.register_module', ([], {}), '()\n', (174, 176), False, 'from mmdet.datasets import PIPELINES\n'), ((426, 453), 'mmdet.datasets.PIPELINES.register_module', 'PIPELINES.register_module', ([], {}), '()\n', (451, 453), False, 'from mmdet.datasets import PI... |
# # ⚠ Warning
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
# NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIA... | [
"pandas.DataFrame",
"dateutil.parser.parse",
"decimal.Decimal",
"pandas.read_csv",
"time.sleep",
"solana.publickey.PublicKey",
"os.path.isfile",
"numpy.where",
"datetime.timedelta",
"requests.get",
"pandas.concat",
"logging.getLogger"
] | [((2888, 2930), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (2905, 2930), False, 'import logging\n'), ((3061, 3107), 'pandas.DataFrame', 'pandas.DataFrame', ([], {'columns': 'TradeHistory.COLUMNS'}), '(columns=TradeHistory.COLUMNS)\n', (3077, 3107), False,... |
import numpy as np
import pandas as pd
import os
from collections import Counter
from scipy.stats import hypergeom
fdr_threshold = 0.05
def main():
os.makedirs('results/enrichment', exist_ok=True)
os.makedirs('results/GO', exist_ok=True)
# LOAD
# single cell gene data
all_gene_data = pd.read_cs... | [
"scipy.stats.hypergeom.sf",
"pandas.DataFrame",
"os.makedirs",
"pandas.read_csv",
"numpy.savetxt",
"numpy.hstack",
"numpy.array",
"numpy.squeeze",
"numpy.unique",
"numpy.repeat"
] | [((156, 204), 'os.makedirs', 'os.makedirs', (['"""results/enrichment"""'], {'exist_ok': '(True)'}), "('results/enrichment', exist_ok=True)\n", (167, 204), False, 'import os\n'), ((209, 249), 'os.makedirs', 'os.makedirs', (['"""results/GO"""'], {'exist_ok': '(True)'}), "('results/GO', exist_ok=True)\n", (220, 249), Fals... |
"""
Mask R-CNN
------------------------------------------------------------
Usage: import the module (see Jupyter notebooks for examples), or run from
the command line as such:
# Train a new model starting from pre-trained COCO weights
python3 auto.py train --dataset=/path/to/auto/dataset --weights=coc... | [
"numpy.sum",
"argparse.ArgumentParser",
"cv2.VideoWriter_fourcc",
"numpy.arange",
"mrcnn.model.MaskRCNN",
"os.path.join",
"sys.path.append",
"mrcnn.utils.download_trained_weights",
"os.path.abspath",
"os.path.exists",
"datetime.datetime.now",
"numpy.stack",
"math.isnan",
"os.listdir",
"n... | [((1002, 1024), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (1017, 1024), False, 'import os\n'), ((1045, 1070), 'sys.path.append', 'sys.path.append', (['ROOT_DIR'], {}), '(ROOT_DIR)\n', (1060, 1070), False, 'import sys\n'), ((1262, 1305), 'os.path.join', 'os.path.join', (['ROOT_DIR', '"""mas... |
import datetime
from keras import layers
from keras import models
from keras.datasets import mnist
from keras.utils import to_categorical
import tensorflow as tf
import os
if __name__ == '__main__':
os.environ["XLA_FLAGS"] = '--xla_gpu_cuda_data_dir="D:/Program Files/CUDA/v11.2/development"'
physical_devices ... | [
"tensorflow.config.optimizer.set_jit",
"keras.datasets.mnist.load_data",
"tensorflow.config.list_physical_devices",
"tensorflow.config.experimental.set_memory_growth",
"keras.layers.Dense",
"keras.models.Sequential",
"tensorflow.keras.callbacks.TensorBoard",
"datetime.datetime.now",
"keras.utils.to_... | [((322, 360), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (353, 360), True, 'import tensorflow as tf\n'), ((365, 432), 'tensorflow.config.experimental.set_memory_growth', 'tf.config.experimental.set_memory_growth', (['physical_devices[0]', '(True)'], {... |
import cv2
import numpy as np
from skimage.viewer import ImageViewer
def remove_rows(image, rows, cols):
newrows = int(rows / 2)
newimg = np.zeros((newrows, cols), np.uint8)
for r in range(1, newrows + 1):
newimg[r - 1:r, :] = image[r * 2 - 1:r * 2, :]
return newimg
img = cv2.imread('pirate.... | [
"cv2.imread",
"skimage.viewer.ImageViewer",
"numpy.zeros"
] | [((301, 347), 'cv2.imread', 'cv2.imread', (['"""pirate.jpg"""', 'cv2.IMREAD_GRAYSCALE'], {}), "('pirate.jpg', cv2.IMREAD_GRAYSCALE)\n", (311, 347), False, 'import cv2\n'), ((426, 442), 'skimage.viewer.ImageViewer', 'ImageViewer', (['img'], {}), '(img)\n', (437, 442), False, 'from skimage.viewer import ImageViewer\n'), ... |
import os
from scrapy import Request
class RandomPayloadMiddleware:
def __init__(self, size):
"""
Middleware adds a random payload to request's meta. Such behaviour
simulates requests with large size and helps understand performance
impact during usage of external storages (disk, ... | [
"os.urandom"
] | [((836, 857), 'os.urandom', 'os.urandom', (['self.size'], {}), '(self.size)\n', (846, 857), False, 'import os\n')] |
from tkinter import Tk, Label
from tkinter.filedialog import askopenfilename
import fileinput
import threading
import pyaudio
import wave
import mywindows as win
root = Tk()
root.withdraw()
win.showReg(root)
root.mainloop()
| [
"mywindows.showReg",
"tkinter.Tk"
] | [((186, 190), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (188, 190), False, 'from tkinter import Tk, Label\n'), ((209, 226), 'mywindows.showReg', 'win.showReg', (['root'], {}), '(root)\n', (220, 226), True, 'import mywindows as win\n')] |
import logging
from datetime import datetime
log = logging.getLogger('Cache')
class Cache(object):
def __init__(self):
self._mon_hist = {}
self._egg_hist = {}
self._raid_hist = {}
def monster_expiration(self, mon_id, expiration=None):
if expiration is not None:
s... | [
"datetime.datetime.utcnow",
"logging.getLogger"
] | [((52, 78), 'logging.getLogger', 'logging.getLogger', (['"""Cache"""'], {}), "('Cache')\n", (69, 78), False, 'import logging\n'), ((961, 978), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (976, 978), False, 'from datetime import datetime\n')] |
# -*- coding: utf-8 -*-
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as p
import numpy as n
import pylab
import scipy.stats as stats
import networkx as nwx
import glob
import builtins
from matplotlib.pyplot import margins
import os.path
import json
from sklearn import svm, cross_validation, datas... | [
"matplotlib.pyplot.subplot",
"sklearn.cross_validation.train_test_split",
"sklearn.svm.SVC",
"numpy.genfromtxt",
"matplotlib.use",
"glob.glob",
"matplotlib.pyplot.savefig"
] | [((50, 64), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (57, 64), True, 'import matplotlib as mpl\n'), ((870, 884), 'matplotlib.pyplot.subplot', 'p.subplot', (['(111)'], {}), '(111)\n', (879, 884), True, 'import matplotlib.pyplot as p\n'), ((1182, 1214), 'matplotlib.pyplot.savefig', 'p.savefig', (['"... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import csv
import numpy as np
import os
import sys
from observations.util import maybe_download_and_extract
def davis(path):
"""Self-Reports of Height and Weight
The `Davis` data... | [
"observations.util.maybe_download_and_extract",
"os.path.expanduser",
"os.path.join"
] | [((1165, 1189), 'os.path.expanduser', 'os.path.expanduser', (['path'], {}), '(path)\n', (1183, 1189), False, 'import os\n'), ((1329, 1408), 'observations.util.maybe_download_and_extract', 'maybe_download_and_extract', (['path', 'url'], {'save_file_name': '"""davis.csv"""', 'resume': '(False)'}), "(path, url, save_file_... |
# MIT License.
# Copyright (c) 2021 by BioicDL. All rights reserved.
# Created by LiuXb on 2021/1/5
# -*- coding:utf-8 -*-
"""
@Modified:
@Description:
"""
import time
import cv2
import numpy as np
class BackgroundDetector(object):
def __init__(self):
self.fgmask = None
self.fgbg = None
de... | [
"cv2.GaussianBlur",
"cv2.medianBlur",
"deepclaw.driver.sensors.camera.Realsense_L515.Realsense",
"cv2.erode",
"cv2.imshow",
"cv2.inRange",
"cv2.dilate",
"cv2.cvtColor",
"cv2.imwrite",
"numpy.max",
"cv2.drawContours",
"numpy.uint8",
"cv2.bitwise_not",
"numpy.ones_like",
"cv2.waitKey",
"... | [((6489, 6547), 'deepclaw.driver.sensors.camera.Realsense_L515.Realsense', 'Realsense', (['"""./configs/basic_config/camera_rs_d435_c1.yaml"""'], {}), "('./configs/basic_config/camera_rs_d435_c1.yaml')\n", (6498, 6547), False, 'from deepclaw.driver.sensors.camera.Realsense_L515 import Realsense\n'), ((6616, 6629), 'tim... |
import hashlib
import lib.event
import logging
import queue
import select
import socket
import ssl
import time
class BotError(Exception):
pass
class UnknownCertError(Exception):
"""Raised when a previously unknown certificate is encountered.
Only used with the known_hosts SSL authentication method.
... | [
"ssl.match_hostname",
"hashlib.sha1",
"socket.socket",
"time.sleep",
"select.select",
"ssl.wrap_socket",
"hashlib.sha512",
"ssl.CertificateError",
"queue.Queue",
"logging.getLogger"
] | [((1250, 1263), 'queue.Queue', 'queue.Queue', ([], {}), '()\n', (1261, 1263), False, 'import queue\n'), ((1284, 1311), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1301, 1311), False, 'import logging\n'), ((1428, 1477), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK... |
import json
import logging
import os
import sys
default_log_format = "[{levelname}][{name}] {message}"
file_log_format = "{asctime} [{levelname}][{name}] {message}"
date_format = "%Y-%m-%dT%H:%M:%S"
def configure_logging(log_level):
logging.root.setLevel(log_level)
logging.addLevelName(logging.DEBUG, "Debug")
l... | [
"logging.root.setLevel",
"json.load",
"logging.FileHandler",
"logging.StreamHandler",
"logging.addLevelName",
"os.path.exists",
"logging.Formatter",
"os.path.expanduser",
"logging.root.addHandler"
] | [((238, 270), 'logging.root.setLevel', 'logging.root.setLevel', (['log_level'], {}), '(log_level)\n', (259, 270), False, 'import logging\n'), ((273, 317), 'logging.addLevelName', 'logging.addLevelName', (['logging.DEBUG', '"""Debug"""'], {}), "(logging.DEBUG, 'Debug')\n", (293, 317), False, 'import logging\n'), ((319, ... |
import robinhood
import reddit
import twitter
#prompt = input('What you want?')
def MAIN():
#reddit.CROSS_CHECK()
twitter.search()
MAIN() | [
"twitter.search"
] | [((137, 153), 'twitter.search', 'twitter.search', ([], {}), '()\n', (151, 153), False, 'import twitter\n')] |
from dash.dependencies import Input, Output
from .. import dashboard
import pandas as pd
YELLOW_THREASHOLD = 0.9
RED_THREASHOLD = 0.5
@dashboard.app.callback(
Output("volcview-sectors", "figure"), [Input("volcview-sectors-update", "n_clicks")]
)
def gen_volcview_sectors(n_clicks):
pdnow = pd.to_datetime("no... | [
"dash.dependencies.Input",
"dash.dependencies.Output",
"pandas.to_datetime",
"pandas.Timedelta"
] | [((302, 323), 'pandas.to_datetime', 'pd.to_datetime', (['"""now"""'], {}), "('now')\n", (316, 323), True, 'import pandas as pd\n'), ((167, 203), 'dash.dependencies.Output', 'Output', (['"""volcview-sectors"""', '"""figure"""'], {}), "('volcview-sectors', 'figure')\n", (173, 203), False, 'from dash.dependencies import I... |
import itertools
from collections import Counter
import math
from skdd.config import logger
# generate all rules for number of columns
def combinations(ncols):
l = list(range(0, ncols))
comb_list = []
for dilimeter in range(0, ncols):
sublist = list(l)
sublist.remove(dilimeter)
co... | [
"itertools.combinations",
"collections.Counter",
"skdd.config.logger.debug",
"math.factorial"
] | [((1963, 2017), 'skdd.config.logger.debug', 'logger.debug', (['""" ----------------------------------"""'], {}), "(' ----------------------------------')\n", (1975, 2017), False, 'from skdd.config import logger\n'), ((2326, 2362), 'skdd.config.logger.debug', 'logger.debug', (['"""Generate rules start"""'], {}), "... |
from django.shortcuts import render
from rest_framework import (
viewsets,
decorators
)
from rest_framework import exceptions
from flight.serializers import (
FlightSerializer,
BookFlightSerializer
)
from user.serializers import UserSerializer
from rest_framework import authentication, permissions
from ... | [
"flight.serializers.FlightSerializer",
"flight.services.ticket_payment",
"flight.serializers.BookFlightSerializer",
"flight.services.create_flight",
"flight.services.book_ticket",
"rest_framework.decorators.action",
"rest_framework.exceptions.NotAcceptable",
"api.response.FlightBoookingAPIResponse",
... | [((802, 912), 'rest_framework.decorators.action', 'decorators.action', ([], {'methods': "['get']", 'detail': '(False)', 'url_path': '"""users/(?P<type>\\\\d+)/day/(?P<day>[0-9+\\\\-]+)"""'}), "(methods=['get'], detail=False, url_path=\n 'users/(?P<type>\\\\d+)/day/(?P<day>[0-9+\\\\-]+)')\n", (819, 912), False, 'from... |
from pydata import Data, h5todata
import numpy as np
import os
import h5py
def test_Data(tmpdir):
o = Data(x=np.ones(3), y=np.ones(3), a=5, b='hh')
assert o.b=='hh'
assert o['a']==5
o.append(np.ones(5),np.ones(5))
o.save(os.path.join(tmpdir, 'test.txt'))
o.save(os.path.join(tmpdir, 'test.h5'))
... | [
"os.path.join",
"pydata.h5todata",
"numpy.ones"
] | [((510, 533), 'pydata.h5todata', 'h5todata', (["f['data0000']"], {}), "(f['data0000'])\n", (518, 533), False, 'from pydata import Data, h5todata\n'), ((208, 218), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (215, 218), True, 'import numpy as np\n'), ((219, 229), 'numpy.ones', 'np.ones', (['(5)'], {}), '(5)\n', (22... |
from __future__ import unicode_literals
from functools import wraps
from os import chmod, mkdir, getuid
from os.path import dirname, exists, join
import socket
from subprocess import Popen, PIPE, call
import time
import pwd
from fabric.api import env, cd, run, local as run_local, task
from fabric.colors import cyan, ... | [
"os.mkdir",
"fabric.colors.red",
"os.chmod",
"fabric.api.task",
"socket.create_connection",
"os.path.dirname",
"fabric.api.env.box_environments.keys",
"os.path.exists",
"fabric.api.env.setdefault",
"fabric.api.env.get",
"time.sleep",
"os.getuid",
"subprocess.call",
"functools.wraps",
"fa... | [((2826, 2835), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (2831, 2835), False, 'from functools import wraps\n'), ((3931, 3940), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (3936, 3940), False, 'from functools import wraps\n'), ((6013, 6049), 'fabric.api.env.get', 'env.get', (['"""box_hardwired_environ... |
__author__ = "<NAME>"
__license__ = "MIT"
__email__ = "<EMAIL>"
"""
Todo:
[Organized HIGH to LOW priority...]
Organize in Functions better -
Remove Redundant Code & Optimize -
"""
# Modules required
import pygame
import time
import numpy
from typing import List
# Initialize global variables
pygame... | [
"pygame.draw.line",
"pygame.event.get",
"pygame.Rect",
"pygame.display.update",
"pygame.font.Font",
"pygame.mouse.get_pos",
"numpy.copy",
"pygame.display.set_mode",
"pygame.quit",
"pygame.mouse.get_pressed",
"pygame.draw.rect",
"pygame.init",
"numpy.sort",
"numpy.random.permutation",
"py... | [((314, 327), 'pygame.init', 'pygame.init', ([], {}), '()\n', (325, 327), False, 'import pygame\n'), ((376, 417), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(SQ_DIM, SQ_DIM)'], {}), '((SQ_DIM, SQ_DIM))\n', (399, 417), False, 'import pygame\n'), ((425, 444), 'pygame.time.Clock', 'pygame.time.Clock', ([], {... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class Encoder(nn.Module):
def __init__(self,no_channels=1):
super().__init__()
self.conv1 = nn.Conv2d(no_channels, 16, 7, stride=3, padding=1)
self.conv2 = nn.Conv2d(16, 32, 7, stride=3,... | [
"torch.nn.ConvTranspose2d",
"torch.randn_like",
"torch.nn.Conv2d",
"torch.exp",
"torch.nn.Linear",
"torch.nn.Flatten"
] | [((218, 268), 'torch.nn.Conv2d', 'nn.Conv2d', (['no_channels', '(16)', '(7)'], {'stride': '(3)', 'padding': '(1)'}), '(no_channels, 16, 7, stride=3, padding=1)\n', (227, 268), True, 'import torch.nn as nn\n'), ((290, 331), 'torch.nn.Conv2d', 'nn.Conv2d', (['(16)', '(32)', '(7)'], {'stride': '(3)', 'padding': '(1)'}), '... |
# coding: utf-8
"""
Arduino IoT Cloud API
Provides a set of endpoints to manage Arduino IoT Cloud **Devices**, **Things**, **Properties** and **Timeseries**. This API can be called just with any HTTP Client, or using one of these clients: * [Javascript NPM package](https://www.npmjs.com/package/@arduino/ard... | [
"six.iteritems",
"arduino_iot_rest.configuration.Configuration"
] | [((8860, 8893), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (8873, 8893), False, 'import six\n'), ((1948, 1963), 'arduino_iot_rest.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1961, 1963), False, 'from arduino_iot_rest.configuration import Configuration... |
import os , sys , glob, argparse , itertools
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import pandas as pd
import numpy as np
from Bio.SeqRecord import SeqRecord
from Bio.Alphabet import IUPAC
import subprocess
accession_table = pd.read_csv("../refseq_download.txt", sep='\t', ... | [
"Bio.SeqIO.write",
"pandas.read_csv",
"os.path.getsize",
"os.path.exists",
"glob.glob"
] | [((272, 329), 'pandas.read_csv', 'pd.read_csv', (['"""../refseq_download.txt"""'], {'sep': '"""\t"""', 'header': '(0)'}), "('../refseq_download.txt', sep='\\t', header=0)\n", (283, 329), True, 'import pandas as pd\n'), ((852, 893), 'glob.glob', 'glob.glob', (["(seqdir + '/*_18S_output.fasta')"], {}), "(seqdir + '/*_18S... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
#
from __future__ import print_function
import math
import eigen
import sva
import rbdyn
import tasks
import sch
def makeZXZArm(isFixed = True, X_base = sva.PTransformd.Identity()):
mbg = rbdyn.MultiBodyGraph()
m... | [
"eigen.Vector3d",
"rbdyn.MultiBodyConfig",
"eigen.Vector3d.UnitX",
"rbdyn.MultiBodyGraph",
"rbdyn.forwardKinematics",
"tasks.qp.SetPointTask",
"eigen.Vector3d.UnitZ",
"rbdyn.eulerIntegration",
"rbdyn.MultiBodyConfigVector",
"sva.PTransformd.Identity",
"rbdyn.MultiBodyVector",
"rbdyn.forwardVel... | [((256, 282), 'sva.PTransformd.Identity', 'sva.PTransformd.Identity', ([], {}), '()\n', (280, 282), False, 'import sva\n'), ((293, 315), 'rbdyn.MultiBodyGraph', 'rbdyn.MultiBodyGraph', ([], {}), '()\n', (313, 315), False, 'import rbdyn\n'), ((336, 361), 'eigen.Matrix3d.Identity', 'eigen.Matrix3d.Identity', ([], {}), '(... |
import unittest
from classtime.brain.scheduling import Schedule
class TestSchedule(unittest.TestCase): #pylint: disable=R0904
@classmethod
def setup_class(cls):
pass
@classmethod
def teardown_class(cls):
pass
def test_section_add(self):
def assert_section_add(section, nu... | [
"classtime.brain.scheduling.Schedule"
] | [((8006, 8050), 'classtime.brain.scheduling.Schedule', 'Schedule', ([], {'preferences': "{'no-marathons': None}"}), "(preferences={'no-marathons': None})\n", (8014, 8050), False, 'from classtime.brain.scheduling import Schedule\n'), ((7865, 7919), 'classtime.brain.scheduling.Schedule', 'Schedule', ([], {'sections': '[]... |
from textwrap import dedent
import pytest
from pytest_mark_no_py3.add import main
@pytest.mark.parametrize("directory", [True, False])
def test_main_no_results_file(directory, runner, testdir):
pyfile = testdir.makepyfile(
dedent(
"""\
@pytest.mark.no_py3
def test_already_mar... | [
"textwrap.dedent",
"pytest.mark.parametrize"
] | [((87, 138), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""directory"""', '[True, False]'], {}), "('directory', [True, False])\n", (110, 138), False, 'import pytest\n'), ((456, 656), 'textwrap.dedent', 'dedent', (['""" @pytest.mark.no_py3\n def test_already_marked():\n assert Fals... |
import os
import re
import subprocess
import sys
import warnings
import setuptools
import setuptools.command.build_ext
import wheel.bdist_wheel
_this_dir = os.path.dirname(os.path.abspath(__file__))
_clib_dir = os.path.join(_this_dir, 'python', 'opencc', 'clib')
_build_dir = os.path.join(_this_dir, 'build', 'python')... | [
"os.path.abspath",
"sys.version.lower",
"os.uname",
"os.path.isfile",
"subprocess.call",
"distutils.util.get_platform",
"setuptools.Extension.__init__",
"warnings.warn",
"os.path.join",
"re.compile"
] | [((213, 264), 'os.path.join', 'os.path.join', (['_this_dir', '"""python"""', '"""opencc"""', '"""clib"""'], {}), "(_this_dir, 'python', 'opencc', 'clib')\n", (225, 264), False, 'import os\n'), ((278, 320), 'os.path.join', 'os.path.join', (['_this_dir', '"""build"""', '"""python"""'], {}), "(_this_dir, 'build', 'python'... |
# standard imports
from contextlib import contextmanager
from urllib2 import urlopen
from urlparse import urlparse
import copy
import os
import shutil
import sys
import tempfile
import time
# third-party imports
import createrepo
import yum
# local imports
from yumsync.yumbase import YumBase
import yumsync.util as util... | [
"createrepo.MetaDataConfig",
"os.unlink",
"time.strftime",
"yum.rpmUtils.miscutils.hdrFromPackage",
"os.path.isfile",
"os.path.islink",
"shutil.rmtree",
"yumsync.util.hardlink",
"os.path.join",
"urllib2.urlopen",
"yum.rpmUtils.transaction.initReadOnlyTransaction",
"os.path.dirname",
"os.path... | [((1778, 1812), 'os.path.join', 'os.path.join', (['self.dir', '"""packages"""'], {}), "(self.dir, 'packages')\n", (1790, 1812), False, 'import os\n'), ((7156, 7165), 'yumsync.yumbase.YumBase', 'YumBase', ([], {}), '()\n', (7163, 7165), False, 'from yumsync.yumbase import YumBase\n'), ((7902, 7928), 'copy.copy', 'copy.c... |
from karabo_bridge import Client
from .utils import compare_nested_dict
def test_req_rep(server, data):
for _ in range(3):
server.feed(data)
with Client(server.endpoint) as client:
for _ in range(3):
d, m = client.next()
compare_nested_dict(data, d)
| [
"karabo_bridge.Client"
] | [((166, 189), 'karabo_bridge.Client', 'Client', (['server.endpoint'], {}), '(server.endpoint)\n', (172, 189), False, 'from karabo_bridge import Client\n')] |
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import platform
from spack import *
class Ispc(Package):
"""ispc is a compiler for a variant of the C pro... | [
"platform.system",
"os.path.isdir"
] | [((1232, 1249), 'platform.system', 'platform.system', ([], {}), '()\n', (1247, 1249), False, 'import platform\n'), ((2374, 2390), 'os.path.isdir', 'os.path.isdir', (['d'], {}), '(d)\n', (2387, 2390), False, 'import os\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
The basic algorithm simulation archtecture of the C/C++ system
"""
import numpy as np
PRIME= np.array([2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
157, 163, 167, ... | [
"numpy.array"
] | [((142, 2882), 'numpy.array', 'np.array', (['[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,\n 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, \n 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, \n 229, 233, 239, 241, 251, 257, 263, 269, 2... |
from builtins import zip
import math
import sympy
from itertools import chain
from .base import BaseVisitor, BaseDualVisitor, DualWithContextMixin
from nineml.exceptions import (NineMLDualVisitException,
NineMLDualVisitValueException,
NineMLDualVisitTypeExce... | [
"nineml.exceptions.NineMLDualVisitNoneChildException",
"nineml.exceptions.NineMLDualVisitException",
"nineml.exceptions.NineMLDualVisitKeysMismatchException",
"sympy.Equivalent",
"sympy.expand",
"nineml.exceptions.NineMLDualVisitAnnotationsMismatchException",
"math.frexp",
"builtins.zip",
"nineml.ex... | [((5427, 5453), 'nineml.exceptions.NineMLDualVisitException', 'NineMLDualVisitException', ([], {}), '()\n', (5451, 5453), False, 'from nineml.exceptions import NineMLDualVisitException, NineMLDualVisitValueException, NineMLDualVisitTypeException, NineMLDualVisitKeysMismatchException, NineMLDualVisitNoneChildException, ... |
from functools import lru_cache
from pydantic import BaseSettings, BaseModel
class StringConstraint(BaseModel):
min_length: int = None
max_length: int = None
regex: str = None
class _Constraints(BaseSettings):
user_id: StringConstraint = StringConstraint(
min_length=4, max_length=32, regex=r... | [
"functools.lru_cache"
] | [((507, 518), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (516, 518), False, 'from functools import lru_cache\n')] |
import numpy as np
import scipy as sp
import scipy.stats
from ngboost.distns import Normal, Laplace, LogNormal, LogLaplace
from ngboost.ngboost import NGBoost
from ngboost.scores import MLE, CRPS, MLE_SURV, CRPS_SURV
from ngboost.learners import default_tree_learner, default_linear_learner
from ngboost.evaluation impor... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"scipy.stats.laplace.rvs",
"matplotlib.pyplot.show",
"argparse.ArgumentParser",
"numpy.log",
"numpy.random.randn",
"matplotlib.pyplot.figure",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"ngboost.scores.CRPS",
"matplotlib.pyplot.savefi... | [((480, 496), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (494, 496), False, 'from argparse import ArgumentParser\n'), ((866, 887), 'numpy.random.randn', 'np.random.randn', (['n', '(1)'], {}), '(n, 1)\n', (881, 887), True, 'import numpy as np\n'), ((939, 969), 'numpy.exp', 'np.exp', (['(X @ beta + 0.... |
from django.db import models
from django.conf import settings
class Product(models.Model):
product_id = models.AutoField(primary_key=True)
product_name = models.CharField(max_length=100)
product_category = models.TextField()
product_price = models.FloatField()
product_discount_price = models.Float... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((110, 144), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (126, 144), False, 'from django.db import models\n'), ((164, 196), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (180, 196), False, 'from djan... |
#-----------------------------------------------------
# Mimas: conference submission and review system
# (c) <NAME> 2016-2020 http://www.allankelly.net
# Licensed under MIT License, see LICENSE file
# -----------------------------------------------------
# System imports
# Google imports
import logging
# Local impo... | [
"logging.info",
"submission_lib.submissions_aux.change_all_expenses",
"submission_lib.submissionrecord.retrieve_conference_submissions"
] | [((1220, 1278), 'submission_lib.submissionrecord.retrieve_conference_submissions', 'submissionrecord.retrieve_conference_submissions', (['conf_key'], {}), '(conf_key)\n', (1268, 1278), False, 'from submission_lib import submissions_aux, submissionrecord, submissionnotifynames\n'), ((1748, 1814), 'submission_lib.submiss... |
from __future__ import print_function
import sys
import os
import numpy as np
from multiprocessing import Pool, freeze_support
import tempfile
from impy.definitions import *
from impy.constants import *
from impy.kinematics import EventKinematics
from impy import impy_config, pdata
from impy.util import info
# AF: T... | [
"numpy.abs",
"impy.util.info",
"tempfile.mkstemp",
"impy.kinematics.EventKinematics",
"numpy.histogram",
"os.path.splitext",
"numpy.linspace",
"multiprocessing.Pool",
"multiprocessing.freeze_support"
] | [((608, 663), 'impy.kinematics.EventKinematics', 'EventKinematics', ([], {'ecm': '(7000 * GeV)', 'p1pdg': '(2212)', 'p2pdg': '(2212)'}), '(ecm=7000 * GeV, p1pdg=2212, p2pdg=2212)\n', (623, 663), False, 'from impy.kinematics import EventKinematics\n'), ((1144, 1165), 'numpy.linspace', 'np.linspace', (['(0)', '(1)', '(21... |
# -*- coding: utf-8 -*-
"""
@author: abhilash
"""
import numpy as np
import cv2
# load the image to detect, get width, height
# resize to match input size, convert to blob to pass into model
img_to_detect = cv2.imread('images/testing/scene3.jpg')
img_height = img_to_detect.shape[0]
img_width = img_to_... | [
"cv2.putText",
"cv2.dnn.blobFromImage",
"cv2.rectangle",
"cv2.imread",
"numpy.arange",
"numpy.array",
"cv2.dnn.readNetFromCaffe",
"cv2.imshow",
"cv2.resize"
] | [((223, 262), 'cv2.imread', 'cv2.imread', (['"""images/testing/scene3.jpg"""'], {}), "('images/testing/scene3.jpg')\n", (233, 262), False, 'import cv2\n'), ((361, 398), 'cv2.resize', 'cv2.resize', (['img_to_detect', '(300, 300)'], {}), '(img_to_detect, (300, 300))\n', (371, 398), False, 'import cv2\n'), ((409, 482), 'c... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name='aiohttp-request-id-logging',
version='0.0.1',
description='Setup proper request id logging for your Aiohttp app',
classifiers=[
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.... | [
"setuptools.find_packages"
] | [((393, 433), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['doc', 'tests*']"}), "(exclude=['doc', 'tests*'])\n", (406, 433), False, 'from setuptools import setup, find_packages\n')] |
from utils.data_loader import MNIST
from models.gru import GRU
from models.tcn import TCN
import torch
import torch.nn.functional as F
from torch.autograd import Variable
import torch.optim as optim
import numpy as np
# 1エポック学習します
def train(model, optimizer, train_loader, log_interval=10):
model.train()
loss_... | [
"numpy.random.seed",
"models.tcn.TCN",
"torch.manual_seed",
"torch.autograd.Variable",
"torch.load",
"utils.data_loader.MNIST",
"torch.nn.functional.nll_loss",
"numpy.random.permutation",
"models.gru.GRU",
"torch.no_grad"
] | [((2284, 2389), 'utils.data_loader.MNIST', 'MNIST', ([], {'batch_size': 'batch_size', 'sequential': "(arch == 'tcn')", 'sequential_rnn': "(arch != 'tcn')", 'permute': 'permute'}), "(batch_size=batch_size, sequential=arch == 'tcn', sequential_rnn=arch !=\n 'tcn', permute=permute)\n", (2289, 2389), False, 'from utils.... |
import unittest
from src import Book
class TestBookClass(unittest.TestCase):
BOOK_DATA = {"title": "Просто Книга", "author": "<NAME>",
"genre": "Боевик", "year": "2020"}
def setUp(self):
self.book = Book(self.BOOK_DATA)
def test_book_attributes(self):
self.assertEqual(s... | [
"src.Book"
] | [((236, 256), 'src.Book', 'Book', (['self.BOOK_DATA'], {}), '(self.BOOK_DATA)\n', (240, 256), False, 'from src import Book\n')] |
from django.test import TestCase
from django.urls import reverse
from ..core.models import Portal
USERNAME = "username_test"
PASSWORD = "<PASSWORD>"
class PortalTestCase(TestCase):
@classmethod
def setUpTestData(self):
portal = Portal.objects.create()
portal.email = "<EMAIL>"
portal.nome_solicitante... | [
"django.urls.reverse"
] | [((3156, 3204), 'django.urls.reverse', 'reverse', (['"""core:editar"""'], {'kwargs': "{'id': portal.id}"}), "('core:editar', kwargs={'id': portal.id})\n", (3163, 3204), False, 'from django.urls import reverse\n'), ((3642, 3663), 'django.urls.reverse', 'reverse', (['"""core:login"""'], {}), "('core:login')\n", (3649, 36... |
"""Test ASDF serialization of AWS schema definitions."""
import pytest
# weld design -----------------------------------------------------------------
from weldx.asdf.tags.weldx.aws.design.base_metal import BaseMetal
from weldx.asdf.tags.weldx.aws.design.connection import Connection
# weld design --------------------... | [
"weldx.asdf.tags.weldx.aws.design.weldment.Weldment",
"weldx.asdf.tags.weldx.aws.design.connection.Connection",
"weldx.asdf.tags.weldx.aws.process.arc_welding_process.ArcWeldingProcess",
"pytest.raises",
"weldx.asdf.tags.weldx.aws.process.shielding_gas_type.ShieldingGasType",
"weldx.constants.WELDX_QUANTI... | [((1719, 1777), 'weldx.asdf.tags.weldx.aws.process.shielding_gas_type.ShieldingGasType', 'ShieldingGasType', ([], {'gas_component': 'gas_comp', 'common_name': '"""SG"""'}), "(gas_component=gas_comp, common_name='SG')\n", (1735, 1777), False, 'from weldx.asdf.tags.weldx.aws.process.shielding_gas_type import ShieldingGas... |
'''This module performs operations related to the re module.
Its functions are:
run_re - Run the requested re and format the input data with
highlighting.
check_re - Check if the re is valid (can be compiled).
clean_data - Remove all span tags from the input test data.
get_flags_value - C... | [
"html.unescape",
"re.sub",
"html.escape",
"re.compile"
] | [((1833, 1868), 're.sub', 're.sub', (['"""<span(.*?)>"""', '""""""', 'testdata'], {}), "('<span(.*?)>', '', testdata)\n", (1839, 1868), False, 'import re\n'), ((2336, 2359), 'html.unescape', 'html.unescape', (['testdata'], {}), '(testdata)\n', (2349, 2359), False, 'import html\n'), ((3691, 3722), 're.sub', 're.sub', ([... |
import streamlit as st
import numpy as np
import pickle
from sklearn.tree import DecisionTreeClassifier
#model = DecisionTreeClassifier(max_depth=8)
model = pickle.load(open('model.pickle','rb'))
st.write("""
# CoverMyMeds - PA Approval Chances
""")
st.write("This project was done as part of the Erdos Data Science... | [
"streamlit.header",
"numpy.round",
"streamlit.radio",
"streamlit.write"
] | [((200, 253), 'streamlit.write', 'st.write', (['"""\n# CoverMyMeds - PA Approval Chances\n"""'], {}), '("""\n# CoverMyMeds - PA Approval Chances\n""")\n', (208, 253), True, 'import streamlit as st\n'), ((255, 390), 'streamlit.write', 'st.write', (['"""This project was done as part of the Erdos Data Science bootcamp Fal... |
import datetime
from sqlalchemy.orm import relationship
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
from .base import Base
class Post(Base):
__tablename__ = "post"
id = Column(Integer, primary_key=True, autoincrement=True,)
title = Column(String)
content = Column(String)
... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((207, 260), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'autoincrement': '(True)'}), '(Integer, primary_key=True, autoincrement=True)\n', (213, 260), False, 'from sqlalchemy import Column, Integer, String, DateTime, ForeignKey\n'), ((274, 288), 'sqlalchemy.Column', 'Column', (['String'], {}... |
# Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... | [
"absl.testing.absltest.main",
"alphafold_paddle.common.protein.from_pdb_string",
"alphafold_paddle.relax.utils.overwrite_b_factors",
"absl.testing.absltest.get_default_test_srcdir",
"numpy.where",
"numpy.arange"
] | [((1994, 2009), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (2007, 2009), False, 'from absl.testing import absltest\n'), ((1181, 1226), 'alphafold_paddle.relax.utils.overwrite_b_factors', 'utils.overwrite_b_factors', (['test_pdb', 'bfactors'], {}), '(test_pdb, bfactors)\n', (1206, 1226), False, 'fr... |
#!/usr/bin/env python
# -*- coding: utf-8; py-indent-offset:4 -*-
###############################################################################
#
# Copyright (C) 2015, 2016, 2017 <NAME>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as p... | [
"backtrader.with_metaclass",
"backtrader.utils.date.Localizer"
] | [((1762, 1805), 'backtrader.with_metaclass', 'bt.with_metaclass', (['MetaChainer', 'bt.DataBase'], {}), '(MetaChainer, bt.DataBase)\n', (1779, 1805), True, 'import backtrader as bt\n'), ((2799, 2833), 'backtrader.utils.date.Localizer', 'bt.utils.date.Localizer', (['self.p.tz'], {}), '(self.p.tz)\n', (2822, 2833), True,... |
from __future__ import print_function
import numpy as np
from numpy import cos, sin
from numpy.testing import assert_equal
import unittest
import pcl
from pcl.registration import icp, gicp, icp_nl, ia_ransac
bun0Tobun4 = [[0.85250509, -0.03745676, -0.52137518, 0.04118973],
[0.03552843, 0.999... | [
"pcl.registration.icp",
"numpy.testing.assert_allclose",
"numpy.allclose",
"numpy.random.RandomState",
"numpy.sin",
"numpy.testing.assert_equal",
"numpy.cos",
"numpy.dot",
"pcl.PointCloud"
] | [((1603, 1620), 'pcl.PointCloud', 'pcl.PointCloud', (['a'], {}), '(a)\n', (1617, 1620), False, 'import pcl\n'), ((1670, 1686), 'pcl.PointCloud', 'pcl.PointCloud', ([], {}), '()\n', (1684, 1686), False, 'import pcl\n'), ((1757, 1773), 'pcl.PointCloud', 'pcl.PointCloud', ([], {}), '()\n', (1771, 1773), False, 'import pcl... |
from public.socket import handle_connect, handle_disconnect, handle_receive
async def websocket_application(scope, receive, send):
while True:
event = await receive()
# This is the implementation of our business logic
# Each function is located in socket.py to be more clean
if eve... | [
"public.socket.handle_connect",
"public.socket.handle_receive",
"public.socket.handle_disconnect"
] | [((373, 416), 'public.socket.handle_connect', 'handle_connect', (['event', 'scope', 'receive', 'send'], {}), '(event, scope, receive, send)\n', (387, 416), False, 'from public.socket import handle_connect, handle_disconnect, handle_receive\n'), ((488, 534), 'public.socket.handle_disconnect', 'handle_disconnect', (['eve... |
# License: BSD 3 clause
import unittest
import numpy as np
from scipy.sparse import csr_matrix
from tick.robust import ModelHuber
from tick.base_model.tests.generalized_linear_model import TestGLM
from tick.linear_model import SimuLinReg
class Test(TestGLM):
def test_ModelHuber(self):
"""...Numerical c... | [
"unittest.main",
"tick.linear_model.SimuLinReg",
"numpy.random.seed",
"numpy.random.randn",
"scipy.sparse.csr_matrix",
"tick.robust.ModelHuber"
] | [((3225, 3240), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3238, 3240), False, 'import unittest\n'), ((394, 412), 'numpy.random.seed', 'np.random.seed', (['(12)'], {}), '(12)\n', (408, 412), True, 'import numpy as np\n'), ((467, 494), 'numpy.random.randn', 'np.random.randn', (['n_features'], {}), '(n_features... |
"""
Tests for CameraCalibrator and related functions
"""
import numpy as np
import pytest
from scipy.stats import norm
from traitlets.config.configurable import Config
from astropy import units as u
from ctapipe.calib.camera.calibrator import CameraCalibrator
from ctapipe.image.extractor import LocalPeakWindowSum, Ful... | [
"numpy.full",
"ctapipe.instrument.CameraGeometry.from_name",
"ctapipe.image.extractor.FullWaveformSum",
"ctapipe.containers.DataContainer",
"ctapipe.calib.camera.calibrator.CameraCalibrator",
"pytest.warns",
"pytest.fixture",
"scipy.stats.norm.pdf",
"numpy.random.RandomState",
"ctapipe.image.extra... | [((427, 459), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (441, 459), False, 'import pytest\n'), ((642, 677), 'ctapipe.calib.camera.calibrator.CameraCalibrator', 'CameraCalibrator', ([], {'subarray': 'subarray'}), '(subarray=subarray)\n', (658, 677), False, 'from ctapi... |
import urllib.request
from os import rename, mkdir
web_url = input("請輸入Youtube網址: ")
# web_url = input("Enter Youtube video url: ")
img_file = open("ytimg.txt", "a", encoding="utf-8")
video_link = web_url[32:]
img_link = ("https://img.youtube.com/vi/" + video_link + "/maxresdefault.jpg" + "\n")
img_file.wr... | [
"os.mkdir",
"os.rename"
] | [((493, 558), 'os.rename', 'rename', (['"""Image/maxresdefault.jpg"""', "('Image/' + video_link + '.jpg')"], {}), "('Image/maxresdefault.jpg', 'Image/' + video_link + '.jpg')\n", (499, 558), False, 'from os import rename, mkdir\n'), ((365, 379), 'os.mkdir', 'mkdir', (['"""Image"""'], {}), "('Image')\n", (370, 379), Fal... |
from __future__ import unicode_literals
import base64
import json
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
mimetype2ext,
qualities,
traverse_obj,
try_get,
url_or_none,
)
class ImdbIE(InfoExtractor):
IE_NAME = 'imdb'
IE_DESC = '... | [
"re.findall",
"json.dumps"
] | [((5222, 5294), 're.findall', 're.findall', (['(\'href="(/list/ls%s/videoplayer/vi[^"]+)"\' % list_id)', 'webpage'], {}), '(\'href="(/list/ls%s/videoplayer/vi[^"]+)"\' % list_id, webpage)\n', (5232, 5294), False, 'import re\n'), ((2629, 2721), 'json.dumps', 'json.dumps', (["{'type': 'VIDEO_PLAYER', 'subType': 'FORCE_LE... |
# from django.contrib.auth.models import User
# from django.contrib.auth.models import User
import uuid
from django.core.exceptions import ObjectDoesNotExist
from django.db import transaction
from .models import Trade, Sale, Purchase, ApplicationVersion
from accounts.models import CustomUser
from rest_framework impor... | [
"rest_framework.serializers.SerializerMethodField",
"accounts.models.CustomUser.objects.filter",
"accounts.models.CustomUser.objects.get",
"rest_framework.serializers.CharField",
"accounts.models.CustomUser.objects.create",
"accounts.models.CustomUser.objects.select_for_update",
"rest_framework.serializ... | [((601, 652), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'min_length': '(34)', 'max_length': '(34)'}), '(min_length=34, max_length=34)\n', (622, 652), False, 'from rest_framework import serializers\n'), ((2414, 2462), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'so... |
__author__ = '<NAME>'
import os
import sqlite3 as lite
def open_database(db):
"""
:rtype : sqlite3 database connection
"""
if os.path.isfile(db):
db_connection = lite.connect(db)
else:
db_connection = lite.connect(db)
db_cursor = db_connection.cursor()
db_cursor.ex... | [
"os.path.isfile",
"sqlite3.connect"
] | [((144, 162), 'os.path.isfile', 'os.path.isfile', (['db'], {}), '(db)\n', (158, 162), False, 'import os\n'), ((188, 204), 'sqlite3.connect', 'lite.connect', (['db'], {}), '(db)\n', (200, 204), True, 'import sqlite3 as lite\n'), ((239, 255), 'sqlite3.connect', 'lite.connect', (['db'], {}), '(db)\n', (251, 255), True, 'i... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import logging
import numpy as np
import torch
from d2go.data.dataset_mappers.d2go_dataset_mapper import D2GoDatasetMapper
from detectron2.data import detection_utils as utils, transforms as T
from detectron2.st... | [
"copy.deepcopy",
"detectron2.structures.RotatedBoxes",
"detectron2.data.transforms.apply_transform_gens",
"detectron2.data.detection_utils.check_image_size",
"numpy.array",
"detectron2.structures.Instances",
"numpy.random.choice",
"torch.tensor",
"detectron2.structures.BoxMode.convert",
"logging.g... | [((426, 453), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (443, 453), False, 'import logging\n'), ((702, 729), 'copy.deepcopy', 'copy.deepcopy', (['dataset_dict'], {}), '(dataset_dict)\n', (715, 729), False, 'import copy\n'), ((886, 929), 'detectron2.data.detection_utils.check_image_si... |
import base64
import collections
import itertools
import os
import math
import struct
import pprint # pylint: disable=unused-import
from panda3d.core import * # pylint: disable=wildcard-import
try:
from panda3d import bullet
HAVE_BULLET = True
except ImportError:
HAVE_BULLET = False
load_prc_file_data(
... | [
"panda3d.bullet.BulletConvexHullShape",
"tempfile.NamedTemporaryFile",
"panda3d.bullet.BulletCylinderShape",
"json.load",
"panda3d.bullet.BulletTriangleMeshShape",
"os.getcwd",
"panda3d.bullet.BulletRigidBodyNode",
"panda3d.bullet.BulletTriangleMesh",
"base64.b64decode",
"collections.namedtuple",
... | [((380, 481), 'collections.namedtuple', 'collections.namedtuple', (['"""GltfSettings"""', "('physics_engine', 'print_scene', 'skip_axis_conversion')"], {}), "('GltfSettings', ('physics_engine', 'print_scene',\n 'skip_axis_conversion'))\n", (402, 481), False, 'import collections\n'), ((30723, 30782), 'itertools.group... |
# -*- coding: utf-8 -*-
"""
Folium interact with GeoJSON data
Examples: overlay another GeoJSON zipcode map to the original map
Author: <NAME>
"""
import pandas as pd
import folium
def show_zipcode_map(zipcode_path, data, col):
"""
Interact zipcode GeoJSON data with other data set (house price o... | [
"pandas.read_csv",
"pandas.groupby"
] | [((1456, 1518), 'pandas.read_csv', 'pd.read_csv', (['"""../Data/kc_house_data.csv"""'], {'parse_dates': "['date']"}), "('../Data/kc_house_data.csv', parse_dates=['date'])\n", (1467, 1518), True, 'import pandas as pd\n'), ((1708, 1741), 'pandas.groupby', 'pd.groupby', (['house_data', '"""zipcode"""'], {}), "(house_data,... |
import os
import sys
from polzyFunctions.utils import get_file_path
from polzyFunctions.tests.utils import company, user
from polzyFunctions.scripts.AddNotification import *
from polzyFunctions.LogLevelUpdater import LogLevelUpdater
from polzyFunctions.FileManager.AddressParser import Parser
def test_get_file_path():... | [
"os.getcwd",
"sys.argv.append",
"sys.argv.extend",
"polzyFunctions.LogLevelUpdater.LogLevelUpdater",
"polzyFunctions.utils.get_file_path",
"polzyFunctions.FileManager.AddressParser.Parser"
] | [((325, 354), 'polzyFunctions.utils.get_file_path', 'get_file_path', (['"""test_misc.py"""'], {}), "('test_misc.py')\n", (338, 354), False, 'from polzyFunctions.utils import get_file_path\n'), ((406, 433), 'polzyFunctions.utils.get_file_path', 'get_file_path', (['"""testing.py"""'], {}), "('testing.py')\n", (419, 433),... |
from datetime import datetime
import pytest
from sqlalchemy import select
from learning.database import get_session
from learning.entities import Todo
from learning.repositories import TodoRepository
from learning.schemas import CreateTodo
from .utils import create_todo
pytestmark = [pytest.mark.asyncio, pytest.mar... | [
"sqlalchemy.select",
"learning.schemas.CreateTodo",
"learning.database.get_session",
"learning.entities.Todo",
"datetime.datetime.now",
"learning.repositories.TodoRepository"
] | [((403, 419), 'learning.repositories.TodoRepository', 'TodoRepository', ([], {}), '()\n', (417, 419), False, 'from learning.repositories import TodoRepository\n'), ((677, 691), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (689, 691), False, 'from datetime import datetime\n'), ((703, 719), 'learning.reposi... |
"""Implementation of utilities for metrics."""
from typing import Tuple
import torch
from einops import reduce
class _BaseMetric:
"""A Class which decides type of classification i.e. binary,multilabel or multiclass."""
def __init__(self, multilabel: bool = False):
"""Constructor class for BaseMetric... | [
"torch.mean",
"torch.eq",
"torch.argmax",
"torch.sigmoid",
"einops.reduce",
"torch.zeros",
"torch.sum"
] | [((6624, 6662), 'torch.sum', 'torch.sum', (['(outputs * targets)'], {'dim': 'dims'}), '(outputs * targets, dim=dims)\n', (6633, 6662), False, 'import torch\n'), ((6685, 6729), 'torch.sum', 'torch.sum', (['(outputs * (1 - targets))'], {'dim': 'dims'}), '(outputs * (1 - targets), dim=dims)\n', (6694, 6729), False, 'impor... |
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
from ansible.module_utils.basic import AnsibleModule
from pprint import pprint
import pytest
import ansible.utils
import ansible.errors
import ansible.constants
import warnings
import os
import sys
CURR_DIR = os.path.dirname(__f... | [
"sys.path.append",
"os.path.dirname"
] | [((361, 386), 'sys.path.append', 'sys.path.append', (['CURR_DIR'], {}), '(CURR_DIR)\n', (376, 386), False, 'import sys\n'), ((301, 326), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (316, 326), False, 'import os\n')] |
from tmodules.Prediction import ImagePrediction
import os
import threading
class PredictionThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
def run(self):
multiple_prediction = ImagePrediction()
multiple_prediction.setModelTypeAsDenseNet()
multiple... | [
"threading.Thread.__init__",
"os.path.join",
"os.getcwd",
"tmodules.Prediction.ImagePrediction",
"os.listdir"
] | [((2459, 2470), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (2468, 2470), False, 'import os\n'), ((152, 183), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (177, 183), False, 'import threading\n'), ((233, 250), 'tmodules.Prediction.ImagePrediction', 'ImagePrediction', ([], {}), '... |
# coding: utf-8
"""
Hydrogen Integration API
The Hydrogen Integration API # noqa: E501
OpenAPI spec version: 1.2.1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class Identification(object):
"""NOTE... | [
"six.iteritems"
] | [((6314, 6347), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (6327, 6347), False, 'import six\n')] |
import html
from typing import List
from telegram import Bot, Update, ParseMode
from telegram.ext import CommandHandler, MessageHandler, Filters, run_async
from cinderella import ALLOW_EXCL, dispatcher, CustomCommandHandler
from cinderella.modules.disable import DisableAbleCommandHandler
from cinderella.modules.help... | [
"cinderella.modules.sql.cleaner_sql.global_ignore_command",
"cinderella.modules.sql.cleaner_sql.is_enabled",
"cinderella.modules.sql.cleaner_sql.get_all_ignored",
"cinderella.modules.sql.cleaner_sql.is_command_ignored",
"cinderella.dispatcher.add_handler",
"telegram.ext.MessageHandler",
"cinderella.modu... | [((6826, 6895), 'telegram.ext.CommandHandler', 'CommandHandler', (['"""cleanblue"""', 'set_blue_text_must_click'], {'pass_args': '(True)'}), "('cleanblue', set_blue_text_must_click, pass_args=True)\n", (6840, 6895), False, 'from telegram.ext import CommandHandler, MessageHandler, Filters, run_async\n'), ((6926, 6991), ... |
import pickle
import os
import copy
import shutil
import hashlib
from .exceptions import *
# External Variables
dumpdir = '.dlo_dump'
force_on_disk = False
reportmode = None
# Internal Variables
dlo_memory = {}
prefix_list = []
keytable = {}
# Common
def _generate_keystring(is_method, prefix, args, kwargs):
if... | [
"pickle.dump",
"copy.deepcopy",
"os.makedirs",
"os.path.isdir",
"pickle.load",
"shutil.rmtree",
"os.path.join"
] | [((1338, 1371), 'os.path.join', 'os.path.join', (['dumpdir', '"""keytable"""'], {}), "(dumpdir, 'keytable')\n", (1350, 1371), False, 'import os\n'), ((1841, 1863), 'os.path.isdir', 'os.path.isdir', (['dumpdir'], {}), '(dumpdir)\n', (1854, 1863), False, 'import os\n'), ((1130, 1152), 'os.path.isdir', 'os.path.isdir', ([... |
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
"""
The base image interface.
"""
import numpy as np
from scipy import ndimage
# Local imports
from .image import Image
from ..transforms.affines import to_matrix_vector
from ..reference.coordinate_system... | [
"copy.deepcopy",
"numpy.set_printoptions",
"numpy.abs",
"numpy.empty",
"numpy.asarray",
"numpy.identity",
"numpy.array",
"numpy.reshape",
"numpy.atleast_1d",
"numpy.all",
"numpy.get_printoptions"
] | [((2983, 3001), 'numpy.asarray', 'np.asarray', (['affine'], {}), '(affine)\n', (2993, 3001), True, 'import numpy as np\n'), ((4689, 4711), 'numpy.asarray', 'np.asarray', (['self._data'], {}), '(self._data)\n', (4699, 4711), True, 'import numpy as np\n'), ((11743, 11759), 'numpy.atleast_1d', 'np.atleast_1d', (['x'], {})... |
import numpy as np
from mayavi import mlab
import os
from roots.swcToolkit import swcToolkit
class swcVisualizer():
"""
mfile = 'fileonpath.swc'
visualizer = swcVisualizer()
visualizer.mplot_mfile(mfile)
"""
def __init__(self):
self.swcTool = swcToolkit()
def create_cylinders(self,coords,diams,data... | [
"mayavi.mlab.figure",
"mayavi.mlab.show",
"roots.swcToolkit.swcToolkit",
"numpy.zeros",
"mayavi.mlab.plot3d",
"mayavi.mlab.points3d",
"mayavi.mlab.close",
"numpy.sin",
"numpy.array",
"numpy.arange",
"numpy.linalg.norm",
"numpy.cos",
"numpy.dot",
"mayavi.mlab.view",
"mayavi.mlab.triangula... | [((261, 273), 'roots.swcToolkit.swcToolkit', 'swcToolkit', ([], {}), '()\n', (271, 273), False, 'from roots.swcToolkit import swcToolkit\n'), ((2611, 2622), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2619, 2622), True, 'import numpy as np\n'), ((2629, 2640), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (2637... |
from docx import Document
from docx.enum.style import WD_STYLE_TYPE
document = Document()
styles = document.styles
for i in styles:
if i.type == WD_STYLE_TYPE.TABLE:
document.add_paragraph("表格样式 : " + i.name)
table = document.add_table(4, 5, style=i)
document.add_paragraph("\n\n")
docume... | [
"docx.Document"
] | [((80, 90), 'docx.Document', 'Document', ([], {}), '()\n', (88, 90), False, 'from docx import Document\n')] |