code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Copyright 2014-2017 ARM 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 agreed to in w... | [
"os.path.join",
"wa.framework.exception.InstrumentError"
] | [((1346, 1402), 'wa.framework.exception.InstrumentError', 'InstrumentError', (['"""Need root to collect dmesg on Android"""'], {}), "('Need root to collect dmesg on Android')\n", (1361, 1402), False, 'from wa.framework.exception import InstrumentError\n'), ((1648, 1705), 'os.path.join', 'os.path.join', (['context.outpu... |
from flask import Flask
from flask_restplus import Api, Resource, Namespace, reqparse
from server.instance import server
from models.models import delete_parser, create_addon_parser
from environment.logger_flask import logger
from environment.logger_aws import Logger
from environment.template import write_jinja_file, z... | [
"lib.s3.S3Client",
"os.getcwd",
"models.models.delete_parser.parse_args",
"environment.template.streaming_output",
"time.sleep",
"environment.logger_aws.Logger",
"lib.cloudformation.Cloudformation",
"lib.iam.IAM",
"flask_restplus.Namespace",
"lib.s3.S3"
] | [((643, 666), 'environment.logger_aws.Logger', 'Logger', ([], {'loglevel': '"""info"""'}), "(loglevel='info')\n", (649, 666), False, 'from environment.logger_aws import Logger\n'), ((823, 908), 'flask_restplus.Namespace', 'Namespace', ([], {'name': '"""Delete"""', 'description': '"""My create related routes"""', 'path'... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
"""Utility methods."""
import numpy as np
import pandas as pd
import scipy.sparse
import sparse as sp
import itertools
from operator import getitem
from collections import defaultdict, Counter
from sklearn import clone
from ... | [
"statsmodels.iolib.summary.summary_return",
"numpy.sum",
"numpy.ravel",
"numpy.iinfo",
"numpy.ones",
"collections.defaultdict",
"numpy.shape",
"numpy.arange",
"numpy.tile",
"sklearn.model_selection.GroupKFold",
"sparse.concatenate",
"sklearn.clone",
"sklearn.linear_model.MultiTaskLassoCV",
... | [((959, 977), 'numpy.iinfo', 'np.iinfo', (['np.int32'], {}), '(np.int32)\n', (967, 977), True, 'import numpy as np\n'), ((14297, 14357), 'sklearn.utils.check_X_y', 'check_X_y', (['X', 'T'], {'multi_output': 'multi_output_T', 'y_numeric': '(True)'}), '(X, T, multi_output=multi_output_T, y_numeric=True)\n', (14306, 14357... |
import os
import dialogflow
from google.api_core.exceptions import InvalidArgument
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = 'private_key.json'
DIALOGFLOW_PROJECT_ID = 'smartcar-sykc'
DIALOGFLOW_LANGUAGE_CODE = 'en'
SESSION_ID = 'me'
def doDialogFlow(text_to_be_analyzed):
session_client = dialogflow.Sessio... | [
"dialogflow.SessionsClient",
"dialogflow.types.TextInput",
"dialogflow.types.QueryInput"
] | [((303, 330), 'dialogflow.SessionsClient', 'dialogflow.SessionsClient', ([], {}), '()\n', (328, 330), False, 'import dialogflow\n'), ((425, 522), 'dialogflow.types.TextInput', 'dialogflow.types.TextInput', ([], {'text': 'text_to_be_analyzed', 'language_code': 'DIALOGFLOW_LANGUAGE_CODE'}), '(text=text_to_be_analyzed, la... |
import datetime
import time
import logging
from ..db.models import TradingOrder
logger = logging.getLogger(__name__)
class Order:
"""Class that represents an order. Order executes on instantiation by a thread pool"""
def __init__(self, market, side, type, amount, price, session=None):
self.market = m... | [
"logging.getLogger"
] | [((90, 117), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (107, 117), False, 'import logging\n')] |
from typing import Any, Tuple, Union
import numpy as np
import pandas as pd
def named_aggregate_summary(series: pd.Series, key: str):
summary = {
f"max_{key}": np.max(series),
f"mean_{key}": np.mean(series),
f"median_{key}": np.median(series),
f"min_{key}": np.min(series),
}
... | [
"numpy.abs",
"numpy.sum",
"numpy.count_nonzero",
"numpy.median",
"numpy.std",
"numpy.isfinite",
"numpy.isnan",
"numpy.max",
"numpy.mean",
"numpy.min"
] | [((1053, 1080), 'numpy.isfinite', 'np.isfinite', (['present_values'], {}), '(present_values)\n', (1064, 1080), True, 'import numpy as np\n'), ((175, 189), 'numpy.max', 'np.max', (['series'], {}), '(series)\n', (181, 189), True, 'import numpy as np\n'), ((214, 229), 'numpy.mean', 'np.mean', (['series'], {}), '(series)\n... |
"""Get NWP data for NWCSAF
"""
import os
import sys
import argparse
import pandas
from .. import sky
from sattools import log
def get_parser():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
... | [
"sys.exit",
"os.getenv",
"argparse.ArgumentParser",
"sattools.log.setup_main_handler"
] | [((161, 266), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(description=__doc__, formatter_class=argparse.\n ArgumentDefaultsHelpFormatter)\n', (184, 266), False, 'import argparse\n'), ((499, 518), 'os.getenv', '... |
#!/usr/bin/env python
import io
import json
import os
import re
import setuptools
import setuptools.command.build_py
import distutils.command.build
node_dependencies = [
( 'netron', [
'node_modules/d3/dist/d3.js',
'node_modules/dagre/dist/dagre.js'
]
)
]
class build(distutils.command.bu... | [
"json.load",
"os.makedirs",
"setuptools.command.build_py.build_py.finalize_options",
"setuptools.command.build_py.build_py.build_module",
"os.path.exists",
"setuptools.command.build_py.build_py.initialize_options",
"setuptools.command.build_py.build_py.run",
"os.path.join"
] | [((970, 1031), 'setuptools.command.build_py.build_py.initialize_options', 'setuptools.command.build_py.build_py.initialize_options', (['self'], {}), '(self)\n', (1025, 1031), False, 'import setuptools\n'), ((1100, 1159), 'setuptools.command.build_py.build_py.finalize_options', 'setuptools.command.build_py.build_py.fina... |
import boto3
import json
import sys
client = boto3.client('codecommit', region_name=sys.argv[1])
results = client.list_repositories()
for item in results['repositories']:
branch_results = client.list_branches(repositoryName=item['repositoryName'])
print(f"{item['repositoryName']}: {len(branch_results['branch... | [
"boto3.client"
] | [((47, 98), 'boto3.client', 'boto3.client', (['"""codecommit"""'], {'region_name': 'sys.argv[1]'}), "('codecommit', region_name=sys.argv[1])\n", (59, 98), False, 'import boto3\n')] |
import pytest
from heedy import App
# These tests are of bugfixes to heedy, making sure that things are working
def test_appscope():
# Makes sure that removing owner's access doesn't affect the App's access
a = App("testkey")
o = a.objects.create("myobj")
assert o.access == "*"
o.key = "lol"
... | [
"heedy.App"
] | [((222, 236), 'heedy.App', 'App', (['"""testkey"""'], {}), "('testkey')\n", (225, 236), False, 'from heedy import App\n'), ((466, 480), 'heedy.App', 'App', (['"""testkey"""'], {}), "('testkey')\n", (469, 480), False, 'from heedy import App\n')] |
import itertools
import random
UnoccupiedEmoji = "🌲"
class Unoccupied:
def __repr__(self):
return UnoccupiedEmoji
class Park:
""" A class to represent the wildlife park which is being simulated.
Parameters
==========
width : `int`
The park's width.
height : `int`
... | [
"random.shuffle"
] | [((1053, 1085), 'random.shuffle', 'random.shuffle', (['self.coordinates'], {}), '(self.coordinates)\n', (1067, 1085), False, 'import random\n')] |
from wcf import train, TrainValConfigBase, val, t, EasyTransform, models_names
from wk import PointDict
from vtgui.app import make_app, SelectDir, SelectFile, VirtualField
from wcf import models_names
import sys
def make_trainval_config(
cfg, data_cfg
):
cfg=PointDict(**cfg)
data_cfg=PointDict(**data_... | [
"wcf.t.RandomShear",
"wcf.t.RandomSPNoise",
"wcf.t.RandomTranslate",
"wcf.t.ColorJitter",
"vtgui.app.make_app",
"wcf.t.RandomVerticalFlip",
"wcf.t.RandomHorizontalFlip",
"wcf.t.SaveToDir",
"wcf.t.RandomRotate",
"wcf.t.ToTensor",
"vtgui.app.VirtualField",
"wcf.train",
"wk.PointDict",
"vtgui... | [((273, 289), 'wk.PointDict', 'PointDict', ([], {}), '(**cfg)\n', (282, 289), False, 'from wk import PointDict\n'), ((303, 324), 'wk.PointDict', 'PointDict', ([], {}), '(**data_cfg)\n', (312, 324), False, 'from wk import PointDict\n'), ((3356, 3366), 'wcf.train', 'train', (['cfg'], {}), '(cfg)\n', (3361, 3366), False, ... |
import unittest
import sys
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.chrome.options import Options
class SeleniumScrape:
def run(self,... | [
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"selenium.webdriver.ChromeOptions",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.Chrome"
] | [((347, 372), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (370, 372), False, 'from selenium import webdriver\n'), ((431, 500), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""chromedriver/chromedriver"""'], {'chrome_options': 'options'}), "('chromedriver/chromedriver', chrome... |
#
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"BeautifulSoup.BeautifulSoup",
"eclipse_gis.eclipse_gis.generate_polygon",
"eclipse_gis.eclipse_gis.EclipseGIS",
"eclipse_gis.eclipse_gis.load_data",
"shapely.geometry.shape",
"shapefile.Reader"
] | [((792, 869), 'BeautifulSoup.BeautifulSoup', 'BeautifulSoup', (['eclipse_path_html'], {'convertEntities': 'BeautifulSoup.HTML_ENTITIES'}), '(eclipse_path_html, convertEntities=BeautifulSoup.HTML_ENTITIES)\n', (805, 869), False, 'from BeautifulSoup import BeautifulSoup\n'), ((960, 987), 'eclipse_gis.eclipse_gis.load_dat... |
from pyxdsm.XDSM import XDSM, OPT, SOLVER, FUNC
# Change `use_sfmath` to False to use computer modern
x = XDSM(use_sfmath=True)
x.add_system("opt", OPT, r"\text{Optimizer}")
x.add_system("solver", SOLVER, r"\text{Newton}")
x.add_system("D1", FUNC, "D_1")
x.add_system("D2", FUNC, "D_2")
x.add_system("F", FUNC, "F")
x.... | [
"pyxdsm.XDSM.XDSM"
] | [((107, 128), 'pyxdsm.XDSM.XDSM', 'XDSM', ([], {'use_sfmath': '(True)'}), '(use_sfmath=True)\n', (111, 128), False, 'from pyxdsm.XDSM import XDSM, OPT, SOLVER, FUNC\n')] |
import unittest
from os.path import join
from unittest import mock
from pythonforandroid.recipes.python3 import (
NDK_API_LOWER_THAN_SUPPORTED_MESSAGE,
)
from pythonforandroid.util import BuildInterruptingException
from tests.recipes.recipe_lib_test import RecipeCtx
class TestPython3Recipe(RecipeCtx, unittest.T... | [
"pythonforandroid.recipes.python3.NDK_API_LOWER_THAN_SUPPORTED_MESSAGE.format",
"os.path.join",
"unittest.mock.patch",
"unittest.mock.mock_open",
"unittest.mock.call"
] | [((612, 671), 'unittest.mock.patch', 'mock.patch', (['"""pythonforandroid.recipes.python3.Path.is_file"""'], {}), "('pythonforandroid.recipes.python3.Path.is_file')\n", (622, 671), False, 'from unittest import mock\n'), ((1552, 1614), 'unittest.mock.patch', 'mock.patch', (['"""pythonforandroid.recipes.python3.subproces... |
# All rights reserved by forest fairy.
# You cannot modify or share anything without sacrifice.
# If you don't agree, keep calm and don't look on text below...
__author__ = "VirtualV <github.com/virtualvfix>"
__date__ = "$Dec 9, 2015 1:16:20 PM$"
# Compile line
# sudo pip install -U cython or sudo apt-get install cyt... | [
"distutils.extension.Extension",
"distutils.core.setup"
] | [((649, 737), 'distutils.core.setup', 'setup', ([], {'name': '"""EncImport"""', 'cmdclass': "{'build_ext': build_ext}", 'ext_modules': 'ext_modules'}), "(name='EncImport', cmdclass={'build_ext': build_ext}, ext_modules=\n ext_modules)\n", (654, 737), False, 'from distutils.core import setup\n'), ((599, 644), 'distut... |
import traceback
from pycompss.api.task import task
from pycompss.api.constraint import constraint
from pycompss.api.parameter import FILE_IN, FILE_OUT
from biobb_common.tools import file_utils as fu
from biobb_model.model import mutate
@task(input_pdb_path=FILE_IN, output_pdb_path=FILE_OUT, on_failure="IGNORE")
def m... | [
"biobb_common.tools.file_utils.write_failed_output",
"pycompss.api.task.task",
"biobb_model.model.mutate.Mutate",
"traceback.print_exc"
] | [((239, 314), 'pycompss.api.task.task', 'task', ([], {'input_pdb_path': 'FILE_IN', 'output_pdb_path': 'FILE_OUT', 'on_failure': '"""IGNORE"""'}), "(input_pdb_path=FILE_IN, output_pdb_path=FILE_OUT, on_failure='IGNORE')\n", (243, 314), False, 'from pycompss.api.task import task\n'), ((552, 573), 'traceback.print_exc', '... |
from jivago.config.production_jivago_context import ProductionJivagoContext
from jivago.config.router.router_builder import RouterBuilder
from jivago.lang.annotations import Override
from jivago.wsgi.routing.routing_rule import RoutingRule
from jivago.wsgi.routing.serving.static_file_routing_table import StaticFileRout... | [
"jivago.wsgi.routing.serving.static_file_routing_table.StaticFileRoutingTable"
] | [((617, 689), 'jivago.wsgi.routing.serving.static_file_routing_table.StaticFileRoutingTable', 'StaticFileRoutingTable', (['"""/var/www"""'], {'allowed_extensions': "['.html', '.xml']"}), "('/var/www', allowed_extensions=['.html', '.xml'])\n", (639, 689), False, 'from jivago.wsgi.routing.serving.static_file_routing_tabl... |
from django import template
register = template.Library()
@register.filter
def first_word(string, arg=" "):
return string.split(arg)[0]
| [
"django.template.Library"
] | [((40, 58), 'django.template.Library', 'template.Library', ([], {}), '()\n', (56, 58), False, 'from django import template\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.translation import gettext_lazy as _
from django.db import models
from .osprocess import osprocess
import sys
# Create your models here.
class User(models.Model):
name = models.CharField(max_length=128)
password = models.CharFi... | [
"django.db.models.CharField",
"django.db.models.ManyToManyField",
"django.utils.translation.gettext_lazy"
] | [((259, 291), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)'}), '(max_length=128)\n', (275, 291), False, 'from django.db import models\n'), ((307, 373), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'default': '""""""', 'blank': '(True)', 'null': '(True)'})... |
"""
The :mod:`ramp_frontend.forms` module defines the different forms used on the
website.
"""
from flask_wtf import FlaskForm
from wtforms import BooleanField
from wtforms import DateField
from wtforms import DateTimeField
from wtforms import FileField
from wtforms import IntegerField
from wtforms import PasswordFie... | [
"wtforms.ValidationError",
"wtforms.widgets.CheckboxInput",
"wtforms.validators.Length",
"wtforms.validators.Email",
"wtforms.BooleanField",
"wtforms.DateTimeField",
"wtforms.widgets.ListWidget",
"wtforms.FileField",
"wtforms.validators.NumberRange",
"wtforms.StringField",
"wtforms.validators.Da... | [((2361, 2388), 'wtforms.StringField', 'StringField', (['"""linkedin_url"""'], {}), "('linkedin_url')\n", (2372, 2388), False, 'from wtforms import StringField\n'), ((2407, 2433), 'wtforms.StringField', 'StringField', (['"""twitter_url"""'], {}), "('twitter_url')\n", (2418, 2433), False, 'from wtforms import StringFiel... |
import os
from mock import patch, MagicMock
from restkit import RequestError
from requests import RequestException
from gevent.event import Event
from openprocurement.medicines.registry.tests.base import BaseServersTest, config
from openprocurement.medicines.registry.databridge.bridge import MedicinesRegistryBridge
f... | [
"openprocurement.medicines.registry.utils.file_is_empty",
"openprocurement.medicines.registry.utils.file_exists",
"os.path.exists",
"mock.patch",
"openprocurement.medicines.registry.databridge.bridge.MedicinesRegistryBridge",
"openprocurement.medicines.registry.tests.base.config.get",
"restkit.RequestEr... | [((5463, 5486), 'mock.patch', 'patch', (['"""gevent.killall"""'], {}), "('gevent.killall')\n", (5468, 5486), False, 'from mock import patch, MagicMock\n'), ((5890, 5913), 'mock.patch', 'patch', (['"""gevent.killall"""'], {}), "('gevent.killall')\n", (5895, 5913), False, 'from mock import patch, MagicMock\n'), ((5919, 5... |
# Copyright 2018 SAP SE
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... | [
"unittest.main"
] | [((2992, 3007), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3005, 3007), False, 'import unittest\n')] |
'''
Linux discovery tool..
'''
import socket
from socket import AF_INET, SOCK_STREAM, SOCK_DGRAM
import platform
import os
import psutil
import json
import csv
import datetime
import argparse
def getListOfProcessSortedByMemory():
'''
Get list of running process sorted by Memory Usage
'''
listOfProc... | [
"psutil.disk_partitions",
"psutil.process_iter",
"psutil.virtual_memory",
"argparse.ArgumentParser",
"psutil.disk_usage",
"platform.uname",
"psutil.net_connections",
"datetime.datetime.now",
"psutil.cpu_count",
"csv.DictWriter"
] | [((377, 398), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (396, 398), False, 'import psutil\n'), ((1209, 1230), 'psutil.process_iter', 'psutil.process_iter', ([], {}), '()\n', (1228, 1230), False, 'import psutil\n'), ((2041, 2065), 'psutil.disk_partitions', 'psutil.disk_partitions', ([], {}), '()\n'... |
import pytest
from furrycorn import config
from furrycorn.model.common import resource_identifier
def test_mk(mocker):
obj = { 'type': 'foo', 'id': '1234' } # mock
cfg = config.mk('https://api', 'ABCDEF')
result = resource_identifier.mk(obj, cfg)
assert type(result) is resource_identifier.ResourceI... | [
"furrycorn.model.common.resource_identifier.mk",
"furrycorn.config.mk"
] | [((181, 215), 'furrycorn.config.mk', 'config.mk', (['"""https://api"""', '"""ABCDEF"""'], {}), "('https://api', 'ABCDEF')\n", (190, 215), False, 'from furrycorn import config\n'), ((230, 262), 'furrycorn.model.common.resource_identifier.mk', 'resource_identifier.mk', (['obj', 'cfg'], {}), '(obj, cfg)\n', (252, 262), Fa... |
import tensorflow.keras as keras
import tensorflow as tf
from keras import layers, models
class SEBlock(keras.Model):
def __init__(self, ratio=16):
super().__init__()
self.ratio = ratio
self.gap = layers.GlobalAveragePooling2D()
def build(self, input_shape):
filters = input_sh... | [
"tensorflow.multiply",
"tensorflow.keras.Sequential",
"keras.layers.Reshape",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"tensorflow.keras.Input",
"tensorflow.concat",
"keras.layers.ELU",
"keras.layers.GlobalAveragePooling2D",
"keras.layers.GlobalMaxPooling2D",
"keras.layers.MaxPooling2D",
... | [((5605, 5635), 'tensorflow.keras.Input', 'keras.Input', ([], {'shape': 'input_shape'}), '(shape=input_shape)\n', (5616, 5635), True, 'import tensorflow.keras as keras\n'), ((5788, 5801), 'tensorflow.nn.relu', 'tf.nn.relu', (['x'], {}), '(x)\n', (5798, 5801), True, 'import tensorflow as tf\n'), ((6963, 6985), 'tensorfl... |
'''
Classes for BMI decoding using the Kalman filter.
'''
import numpy as np
from scipy.io import loadmat
from . import bmi
import pickle
import re
class KalmanFilter(bmi.GaussianStateHMM):
"""
Low-level KF, agnostic to application
Model:
x_{t+1} = Ax_t + w_t; w_t ~ N(0, W)
y_t = C... | [
"numpy.trace",
"numpy.sum",
"random.shuffle",
"numpy.ones",
"numpy.linalg.svd",
"numpy.linalg.norm",
"numpy.mean",
"numpy.diag",
"numpy.linalg.pinv",
"numpy.linalg.solve",
"numpy.mat",
"numpy.multiply",
"numpy.ndim",
"numpy.linalg.det",
"numpy.cov",
"numpy.hstack",
"scipy.optimize.fm... | [((28104, 28115), 'numpy.mat', 'np.mat', (['C_v'], {}), '(C_v)\n', (28110, 28115), True, 'import numpy as np\n'), ((28128, 28141), 'numpy.mat', 'np.mat', (['Q_hat'], {}), '(Q_hat)\n', (28134, 28141), True, 'import numpy as np\n'), ((31330, 31394), 'scipy.optimize.fmin_bfgs', 'fmin_bfgs', (['cost_fn', 'nu_0'], {'fprime'... |
# -*- coding: utf-8 -*-
# This file is part of fintie.
# Copyright (C) 2018-present qytz <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICE... | [
"pandas.DataFrame",
"json.dump",
"os.makedirs",
"click.option",
"datetime.date.today",
"click.echo",
"time.time",
"pathlib.Path",
"click.Path",
"logging.getLogger"
] | [((1117, 1144), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (1134, 1144), False, 'import logging\n'), ((3527, 3572), 'click.option', 'click.option', (['"""-s"""', '"""--symbol"""'], {'required': '(True)'}), "('-s', '--symbol', required=True)\n", (3539, 3572), False, 'import click\n'), ... |
import logging
from datetime import datetime
log = logging.getLogger(__name__)
class Timer(object):
def __init__(self, name, in_millis=True, init_message='',
log_warning_step_threshold=-1, log_warning_total_threshold=-1):
super(Timer, self).__init__()
self.name = name
se... | [
"datetime.datetime.utcnow",
"logging.getLogger"
] | [((53, 80), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (70, 80), False, 'import logging\n'), ((335, 352), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (350, 352), False, 'from datetime import datetime\n'), ((743, 760), 'datetime.datetime.utcnow', 'datetime.utcnow',... |
import pytest
PREDICTION_TEXT = "This is a test prediction. If a finetune model predicts on this we may get an empty list as result."
@pytest.fixture(scope="module")
def model_group(indico):
results = indico.model_groups()
try:
return next(
result
for result in results
... | [
"pytest.fixture"
] | [((138, 168), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (152, 168), False, 'import pytest\n')] |
import numpy as np
from .real_ffts import _RealFFTBasis
class LegendreBasis(_RealFFTBasis):
r"""
Discretize a continuous field into `deg` local states using a
Legendre polynomial basis such that,
.. math::
\frac{1}{\Delta x} \int_s m(h, x) dx =
\sum_0^{L-1} m[l, s] P_l(h)
where t... | [
"numpy.array"
] | [((2494, 2517), 'numpy.array', 'np.array', (['self.n_states'], {}), '(self.n_states)\n', (2502, 2517), True, 'import numpy as np\n')] |
"""
The point of this module is to run a series of tests on the bricklayer program passed,
so that the end user can be alerted if there are some issues happening
"""
import ast
import subprocess
import py_compile
import importlib
from bricklayer.utils.logger import Logger
from bricklayer.doctor.constants import Help... | [
"difflib.get_close_matches",
"importlib.import_module",
"py_compile.compile",
"bricklayer.utils.logger.Logger.debug",
"ast.parse",
"bricklayer.doctor.constants.HelpMessages.INCORRECT_FUNCTION_NAME.format"
] | [((817, 863), 'py_compile.compile', 'py_compile.compile', (['program_name'], {'doraise': '(True)'}), '(program_name, doraise=True)\n', (835, 863), False, 'import py_compile\n'), ((1577, 1646), 'difflib.get_close_matches', 'get_close_matches', (['func', '(user_defined_functions + available_functions)'], {}), '(func, use... |
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 2 10:58:30 2020
@author: <NAME>
"""
#%%importing libraries
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
#%% read csv
dataset = pd.read_csv("svm_dataset.csv")
#%%
dataset.drop(["id","Unnamed: 32"],axis = 1, inplace = True)
# Malignant = 'M'
# ... | [
"matplotlib.pyplot.show",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.legend",
"sklearn.model_selection.train_test_split",
"numpy.min",
"numpy.max",
"sklearn.svm.SVC",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((204, 234), 'pandas.read_csv', 'pd.read_csv', (['"""svm_dataset.csv"""'], {}), "('svm_dataset.csv')\n", (215, 234), True, 'import pandas as pd\n'), ((433, 522), 'matplotlib.pyplot.scatter', 'plt.scatter', (['M.radius_mean', 'M.texture_mean'], {'color': '"""red"""', 'label': '"""Malignant"""', 'alpha': '(0.3)'}), "(M.... |
from Store import Store
import math
def main(function_name, request_id, runtime, input, output, to, keys):
store = Store(function_name, request_id, input, output, to, keys)
param = store.fetch(['x'])
x = int(param['x'])
res = {'sqrt_result': round(math.sqrt(x), 3)}
store.put(res, {})
| [
"Store.Store",
"math.sqrt"
] | [((124, 181), 'Store.Store', 'Store', (['function_name', 'request_id', 'input', 'output', 'to', 'keys'], {}), '(function_name, request_id, input, output, to, keys)\n', (129, 181), False, 'from Store import Store\n'), ((273, 285), 'math.sqrt', 'math.sqrt', (['x'], {}), '(x)\n', (282, 285), False, 'import math\n')] |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from sunpy.image.util import to_norm, un_norm
def test_to_norm():
array_simple = np.array([10., 20., 30., 100.])
assert_allclose(to_norm(array_simple), np.array([0.1, 0.2, 0.3, 1.]))
array_simple_neg = np.array([-10., 0., 10., 90... | [
"sunpy.image.util.to_norm",
"numpy.array"
] | [((164, 199), 'numpy.array', 'np.array', (['[10.0, 20.0, 30.0, 100.0]'], {}), '([10.0, 20.0, 30.0, 100.0])\n', (172, 199), True, 'import numpy as np\n'), ((293, 327), 'numpy.array', 'np.array', (['[-10.0, 0.0, 10.0, 90.0]'], {}), '([-10.0, 0.0, 10.0, 90.0])\n', (301, 327), True, 'import numpy as np\n'), ((441, 470), 'n... |
import torch
from torch import Tensor
from torch import nn
from torch import functional as F
from typing import Union, Tuple, List, Iterable, Dict
import os,sys
import json
from .utils import fullname,import_from_string
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from log import logg... | [
"torch.nn.Parameter",
"json.load",
"os.makedirs",
"log.logging.getLogger",
"torch.nn.Tanh",
"os.path.realpath",
"torch.nn.Linear",
"torch.device",
"os.path.join"
] | [((331, 358), 'log.logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (348, 358), False, 'from log import logging\n'), ((540, 549), 'torch.nn.Tanh', 'nn.Tanh', ([], {}), '()\n', (547, 549), False, 'from torch import nn\n'), ((873, 920), 'torch.nn.Linear', 'nn.Linear', (['in_features', 'out_fea... |
#!/usr/bin/env python
"""
MetaWIBELE: summary_function_annotation module
Summary function annotations
Copyright (c) 2019 Harvard School of Public Health
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the So... | [
"argparse.ArgumentParser",
"os.path.basename",
"metawibele.config.logger.info",
"os.path.isfile",
"re.sub",
"re.search",
"sys.exit"
] | [((1696, 1744), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (1719, 1744), False, 'import argparse\n'), ((12309, 12378), 'metawibele.config.logger.info', 'config.logger.info', (['"""### Start summary_function_annotation step ####"""'], {}), "... |
"""
The ``risk_models`` module provides functions for estimating the covariance matrix given
historical returns. Because of the complexity of estimating covariance matrices
(and the importance of efficient computations), this module mostly provides a convenient
wrapper around the underrated `sklearn.covariance` module.... | [
"pandas.DataFrame",
"numpy.fmin",
"numpy.trace",
"numpy.sum",
"numpy.nan_to_num",
"numpy.eye",
"numpy.zeros",
"numpy.identity",
"numpy.shape",
"numpy.append",
"numpy.linalg.norm",
"numpy.tile",
"numpy.dot",
"warnings.warn",
"numpy.diag",
"numpy.sqrt"
] | [((2751, 2788), 'numpy.fmin', 'np.fmin', (['(daily_returns - benchmark)', '(0)'], {}), '(daily_returns - benchmark, 0)\n', (2758, 2788), True, 'import numpy as np\n'), ((4556, 4572), 'numpy.zeros', 'np.zeros', (['(N, N)'], {}), '((N, N))\n', (4564, 4572), True, 'import numpy as np\n'), ((4771, 4828), 'pandas.DataFrame'... |
import pygame, os, sys
from Game import *
from pygame.locals import *
pygame.init()
class MainMenu:
def __init__(self):
self.main()
def main(self):
class Button:
def create_button(self, surface, color, x, y, length, height, width, text, text_color):
su... | [
"pygame.quit",
"pygame.font.Font",
"pygame.Surface",
"pygame.draw.rect",
"pygame.display.set_mode",
"pygame.event.get",
"pygame.Rect",
"pygame.mixer.music.play",
"pygame.init",
"pygame.display.flip",
"pygame.mixer.music.get_busy",
"pygame.mixer.music.load",
"pygame.image.load",
"pygame.mou... | [((75, 88), 'pygame.init', 'pygame.init', ([], {}), '()\n', (86, 88), False, 'import pygame, os, sys\n'), ((7671, 7704), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(10, 10)'], {}), '((10, 10))\n', (7694, 7704), False, 'import pygame, os, sys\n'), ((7714, 7755), 'pygame.mixer.music.load', 'pygame.mixer.mus... |
# Copyright (c) 2016 Cisco Systems
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless require... | [
"sqlalchemy.Index",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.sql.expression.func.now",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.Column",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String"
] | [((1173, 1225), 'sqlalchemy.Column', 'sa.Column', (['"""resource_id"""', 'sa.Integer'], {'nullable': '(False)'}), "('resource_id', sa.Integer, nullable=False)\n", (1182, 1225), True, 'import sqlalchemy as sa\n'), ((1299, 1345), 'sqlalchemy.Column', 'sa.Column', (['"""sync_message"""', 'sa.TEXT'], {'default': '""""""'})... |
# -*- coding: utf-8 -*-
from openregistry.lots.core.utils import (
update_file_content_type,
json_view,
context_unpack,
APIResource,
)
from openregistry.lots.core.utils import (
save_lot, oplotsresource, apply_patch,
)
from openregistry.lots.core.validation import (
validate_decision_post,
v... | [
"openregistry.lots.core.utils.save_lot",
"openregistry.lots.core.utils.oplotsresource",
"openregistry.lots.core.utils.json_view",
"openregistry.lots.core.utils.update_file_content_type",
"openregistry.lots.core.utils.context_unpack"
] | [((742, 954), 'openregistry.lots.core.utils.oplotsresource', 'oplotsresource', ([], {'name': '"""bargain:Lot Decisions"""', 'collection_path': '"""/lots/{lot_id}/decisions"""', 'path': '"""/lots/{lot_id}/decisions/{decision_id}"""', '_internal_type': '"""bargain"""', 'description': '"""Lot related decisions"""'}), "(na... |
# coding=utf-8
# Copyright (c) DIRECT Contributors
import argparse
import pathlib
from direct.cli.utils import file_or_url
from direct.environment import Args
from direct.train import train_from_argparse
def register_parser(parser: argparse._SubParsersAction):
"""Register wsi commands to a root parser."""
e... | [
"direct.environment.Args"
] | [((965, 985), 'direct.environment.Args', 'Args', ([], {'add_help': '(False)'}), '(add_help=False)\n', (969, 985), False, 'from direct.environment import Args\n')] |
#!/bin/python
# -*- coding: utf-8 -*-
import time
import numpy as np
import scipy.linalg as sl
import pandas as pd
from econsieve import KalmanFilter, TEnKF
from grgrlib.core import timeprint
from grgrlib.multiprocessing import serializer
from econsieve.stats import logpdf
def create_obs_cov(self, scale_obs=0.1):
... | [
"econsieve.KalmanFilter",
"numpy.random.seed",
"numpy.diagflat",
"numpy.empty",
"numpy.isnan",
"numpy.random.randint",
"sys.exc_info",
"numpy.linalg.pinv",
"econsieve.TEnKF",
"numpy.pad",
"pandas.DataFrame",
"numpy.ndim",
"grgrlib.multiprocessing.serializer",
"numpy.var",
"numpy.random.s... | [((332, 351), 'numpy.array', 'np.array', (['self.data'], {}), '(self.data)\n', (340, 351), True, 'import numpy as np\n'), ((416, 436), 'numpy.diagflat', 'np.diagflat', (['sig_obs'], {}), '(sig_obs)\n', (427, 436), True, 'import numpy as np\n'), ((565, 642), 'numpy.vstack', 'np.vstack', (['(pmat[1, 0][:, :-self.neps], q... |
#!/usr/bin/env python
import pyttsx3
import rospy
from std_msgs.msg import String
import time
from Speech2Text import Speech2Text
class Speaker(object):
def __init__(self, speed=130, volume=1.0, voice_id=10):
self.engine = pyttsx3.init()
self.set_speed(speed)
self.set_volume(volume)
... | [
"pyttsx3.init",
"Speech2Text.Speech2Text",
"rospy.Publisher",
"time.sleep",
"rospy.init_node"
] | [((1395, 1446), 'rospy.init_node', 'rospy.init_node', (['"""home_edu_speaker"""'], {'anonymous': '(True)'}), "('home_edu_speaker', anonymous=True)\n", (1410, 1446), False, 'import rospy\n'), ((1490, 1503), 'Speech2Text.Speech2Text', 'Speech2Text', ([], {}), '()\n', (1501, 1503), False, 'from Speech2Text import Speech2T... |
import pandas as pd
data = pd.read_csv('data/T_UWWTPS.csv')
df_toclean = pd.DataFrame(data = {'Member State': data['rptMStateKey'], 'Latitude': data['uwwLatitude'],
'Longitude': data['uwwLongitude'], 'LoadEntering': data['uwwLoadEnteringUWWTP'], 'Capacity':
data['uwwCapacity'], 'NRemoval': data['uwwNRemoval'], 'PRemo... | [
"pandas.read_csv",
"pandas.DataFrame"
] | [((27, 59), 'pandas.read_csv', 'pd.read_csv', (['"""data/T_UWWTPS.csv"""'], {}), "('data/T_UWWTPS.csv')\n", (38, 59), True, 'import pandas as pd\n'), ((73, 357), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': "{'Member State': data['rptMStateKey'], 'Latitude': data['uwwLatitude'],\n 'Longitude': data['uwwLongitud... |
import re
from tracardi_dot_notation.dot_accessor import DotAccessor
from tracardi_dot_notation.utils.singleton import Singleton
class DotTemplate(metaclass=Singleton):
def __init__(self):
self._regex = re.compile(r"\{{2}\s*((?:payload|profile|event|session|flow|memory)"
... | [
"re.compile"
] | [((219, 349), 're.compile', 're.compile', (['"""\\\\{{2}\\\\s*((?:payload|profile|event|session|flow|memory)@[\\\\[\\\\]0-9a-zA-a_\\\\-\\\\.]+(?<![\\\\.\\\\[]))\\\\s*\\\\}{2}"""'], {}), "(\n '\\\\{{2}\\\\s*((?:payload|profile|event|session|flow|memory)@[\\\\[\\\\]0-9a-zA-a_\\\\-\\\\.]+(?<![\\\\.\\\\[]))\\\\s*\\\\}{2... |
import pprint
from .constants import HostPrograms, Ports, ServerCommands
import requests
try:
import websockets
import asyncio
except:
print("failed to import websockets/asyncio")
class Client(object):
"""
Base client from which all other Clients will inherit
"""
def __init__(self):
... | [
"requests.put",
"requests.post",
"pprint.pprint"
] | [((3131, 3153), 'pprint.pprint', 'pprint.pprint', (['payload'], {}), '(payload)\n', (3144, 3153), False, 'import pprint\n'), ((3201, 3224), 'pprint.pprint', 'pprint.pprint', (['response'], {}), '(response)\n', (3214, 3224), False, 'import pprint\n'), ((6414, 6436), 'pprint.pprint', 'pprint.pprint', (['payload'], {}), '... |
"""Construction of 2D data tables from ASCII files obtained from models/simulations
or other sources.
Currently supported are the files generated for the papers:
| Nuclear Physics Meets the Sources of the Ultra-High Energy Cosmic Rays
| <NAME>, <NAME>, <NAME>
| Sci.Rep. 7 (2017) 1, 4882
| e-Print: 160... | [
"numpy.stack",
"numpy.full",
"numpy.load",
"numpy.concatenate",
"prince.util.info",
"numpy.array",
"numpy.loadtxt",
"os.path.join",
"numpy.all"
] | [((2030, 2074), 'os.path.join', 'join', (['resource_path', '"""photo-nuclear"""', 'f_root'], {}), "(resource_path, 'photo-nuclear', f_root)\n", (2034, 2074), False, 'from os.path import join\n'), ((2082, 2120), 'prince.util.info', 'info', (['(0)', '"""Loading files"""', "(f_root + '*')"], {}), "(0, 'Loading files', f_r... |
import os
from mushroom_rl.utils.preprocessors import MinMaxPreprocessor
from mushroom_rl.utils.callbacks import PlotDataset
import numpy as np
from mushroom_rl.algorithms.policy_search import REINFORCE
from mushroom_rl.approximators.parametric import LinearApproximator
from mushroom_rl.approximators.regressor impor... | [
"mushroom_rl.utils.dataset.compute_J",
"mushroom_rl.core.Logger",
"numpy.random.seed",
"mushroom_rl.environments.LQR.generate",
"mushroom_rl.algorithms.policy_search.REINFORCE",
"os.makedirs",
"mushroom_rl.utils.preprocessors.MinMaxPreprocessor.load",
"numpy.ones",
"mushroom_rl.utils.preprocessors.M... | [((778, 794), 'numpy.random.seed', 'np.random.seed', ([], {}), '()\n', (792, 794), True, 'import numpy as np\n'), ((809, 858), 'mushroom_rl.core.Logger', 'Logger', (['"""plot_and_norm_example"""'], {'results_dir': 'None'}), "('plot_and_norm_example', results_dir=None)\n", (815, 858), False, 'from mushroom_rl.core impor... |
import dictionary
# HW 7
def main_menu():
print('Inventory Menu')
print('[1]: Add/Update Inventory')
print('[2]: Delete Inventory')
print('[3]: Exit')
user_input = input('Select an option: ')
if user_input == '1':
option1()
elif user_input == '2':
option2()
elif user_inpu... | [
"dictionary.remove_inventory_widget",
"dictionary.add_inventory"
] | [((697, 761), 'dictionary.add_inventory', 'dictionary.add_inventory', (['type_dictionary', 'widget_name', 'quantity'], {}), '(type_dictionary, widget_name, quantity)\n', (721, 761), False, 'import dictionary\n'), ((1713, 1777), 'dictionary.remove_inventory_widget', 'dictionary.remove_inventory_widget', (['type_dictiona... |
import pygame
from src.const import *
from src.game_objects.foes.foe import Foe
from src.game_objects.projectiles.projectile import Projectile
class Bullet(Projectile):
def __init__(self, *args,
dim=(10,10),
depth=BULLET_DEPTH,
**kwargs):
self.images... | [
"pygame.Surface"
] | [((332, 351), 'pygame.Surface', 'pygame.Surface', (['dim'], {}), '(dim)\n', (346, 351), False, 'import pygame\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2018-04-08 12:16
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('teams', '0036_auto_2018040... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField"
] | [((479, 672), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'help_text': '"""Maintained by the IRC bot, do not edit manually. True if the teammembers NickServ username has been added to the Team IRC channels ACL."""'}), "(default=False, help_text=\n 'Maintained by the IRC bot, d... |
# -*- coding: utf-8 -*-
# Copyright 2015 www.suishouguan.com
#
# Licensed under the Private License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/samuelbaizg/ssguan/blob/master/LICENSE
#
# Unless ... | [
"tornado.ioloop.IOLoop.current",
"ssguan.ignitor.sched.scheduler.get_cronjob",
"ssguan.ignitor.utility.kind.utcnow",
"ssguan.ignitor.orm.config.get_default_dbinfo",
"ssguan.ignitor.sched.scheduler.create_cronjob",
"ssguan.ignitor.orm.update.install",
"ssguan.ignitor.orm.update.upgrade",
"ssguan.ignito... | [((2127, 2143), 'ssguan.ignitor.orm.update.install', 'update.install', ([], {}), '()\n', (2141, 2143), False, 'from ssguan.ignitor.orm import dbpool, config as orm_config, update\n'), ((2153, 2184), 'ssguan.ignitor.orm.update.upgrade', 'update.upgrade', (['"""ignitor.audit"""'], {}), "('ignitor.audit')\n", (2167, 2184)... |
# Taken from: https://github.com/UKPLab/sentence-transformers/blob/master/sentence_transformers/util.py
import os
import requests
from tqdm.autonotebook import tqdm
import tarfile
def http_get(url, path):
"""
Downloads a URL to a given path on disc
"""
if os.path.dirname(path) != '':
os.makedi... | [
"tqdm.autonotebook.tqdm",
"os.rename",
"os.path.dirname",
"requests.get",
"tarfile.open"
] | [((372, 402), 'requests.get', 'requests.get', (['url'], {'stream': '(True)'}), '(url, stream=True)\n', (384, 402), False, 'import requests\n'), ((1088, 1122), 'os.rename', 'os.rename', (['download_filepath', 'path'], {}), '(download_filepath, path)\n', (1097, 1122), False, 'import os\n'), ((274, 295), 'os.path.dirname'... |
# Generated by Django 2.0.7 on 2018-08-02 13:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0006_usertask_is_file_answer'),
]
operations = [
migrations.CreateModel(
name='UserValidateCode',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField",
"django.db.models.AutoField"
] | [((342, 435), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (358, 435), False, 'from django.db import migrations, models\... |
"""
Tests for EmbargoMiddleware
"""
from contextlib import contextmanager
from unittest import mock
from unittest.mock import patch, MagicMock
import geoip2.database
import maxminddb
import ddt
import pytest
from django.conf import settings
from django.test.utils import override_settings
from django.core.cache impor... | [
"unittest.mock.patch.object",
"ddt.data",
"unittest.mock.MagicMock",
"common.djangoapps.student.tests.factories.UserFactory.create",
"django.core.cache.cache.clear",
"xmodule.modulestore.tests.django_utils.mixed_store_config",
"unittest.mock.patch.dict",
"django.db.connection.cursor",
"pytest.raises... | [((1054, 1108), 'xmodule.modulestore.tests.django_utils.mixed_store_config', 'mixed_store_config', (['settings.COMMON_TEST_DATA_ROOT', '{}'], {}), '(settings.COMMON_TEST_DATA_ROOT, {})\n', (1072, 1108), False, 'from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_store_config\n'), ((1121, 1170)... |
from prody import *
from numpy import *
from random import random
import os.path
import sys
import time
time.sleep(10)
ar = []
for arg in sys.argv:
ar.append(arg)
initial_pdbn=ar[1]
final_pdbn=ar[2]
initial_pdb_id = initial_pdbn[:initial_pdbn.rfind('.')]
final_pdb_id = final_pdbn[:final_pdbn.rfind('.')]
original... | [
"sys.stdout.write",
"random.random",
"time.sleep"
] | [((105, 119), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (115, 119), False, 'import time\n'), ((3813, 3955), 'sys.stdout.write', 'sys.stdout.write', (["(' ' * 2 + 'rmsd' + ' ' * 2 + 'rand' + ' ' * 2 + 'ID' + ' ' * 3 + 'step' + \n ' ' * 2 + 'accept_para' + ' ' * 5 + 'f' + '\\n')"], {}), "(' ' * 2 + 'rmsd' ... |
"""
__author__: HashTagML
license: MIT
Created: Monday, 29th March 2021
"""
import os
import warnings
from pathlib import Path
from typing import Union
import imagesize
import yaml
import numpy as np
import pandas as pd
from .base import FormatSpec
from .utils import exists, get_image_dir, get_annotation_dir
clas... | [
"pandas.DataFrame",
"yaml.load",
"imagesize.get",
"pathlib.Path",
"warnings.warn",
"pandas.concat"
] | [((2240, 2381), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['split', 'image_id', 'image_width', 'image_height', 'x_min', 'y_min',\n 'width', 'height', 'category', 'image_path']"}), "(columns=['split', 'image_id', 'image_width', 'image_height',\n 'x_min', 'y_min', 'width', 'height', 'category', 'image_p... |
"""
Authors: <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mo... | [
"tensorflow.reshape",
"pytest.mark.parametrize",
"tests.utils.Compiler",
"tensorflow.split",
"pytest.mark.skip",
"numpy.random.randn",
"os.path.dirname",
"tensorflow.pad",
"tensorflow.concat",
"tests.utils.assert_almost_equal",
"tensorflow.compat.v1.Session",
"tensorflow.squeeze",
"tensorflo... | [((1331, 1505), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""a_shape, out_shape"""', '[([2, 3], [6]), ([6], [2, 3]), ([2, 3], [3, 2]), ([2, 3], [-1]), ([1], []),\n ([3, 2, 3], [2, -1]), ([3, 2, 3], [-1, 9])]'], {}), "('a_shape, out_shape', [([2, 3], [6]), ([6], [2, 3]),\n ([2, 3], [3, 2]), ([2, 3],... |
#!/usr/bin/python
# Author: <NAME> <<EMAIL>>
# Copyright (c) 2016 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the ... | [
"atexit.register",
"time.sleep",
"sys.exit",
"upm.pyupm_ozw.AeotecDSB09104"
] | [((1416, 1444), 'atexit.register', 'atexit.register', (['exitHandler'], {}), '(exitHandler)\n', (1431, 1444), False, 'import time, sys, signal, atexit\n'), ((1803, 1831), 'upm.pyupm_ozw.AeotecDSB09104', 'sensorObj.AeotecDSB09104', (['(12)'], {}), '(12)\n', (1827, 1831), True, 'from upm import pyupm_ozw as sensorObj\n')... |
#!/usr/bin/env python
"""
_Conditions_t_
Condition job splitting test
"""
import unittest
import threading
import logging
import time
from WMCore.WMBS.File import File
from WMCore.WMBS.Fileset import Fileset
from WMCore.WMBS.Subscription import Subscription
from WMCore.WMBS.Workflow import Workflow
from WMCore.Data... | [
"unittest.main",
"WMCore.WMBS.Workflow.Workflow",
"WMCore.WMBS.File.File",
"WMCore.DAOFactory.DAOFactory",
"WMCore.WMBS.Subscription.Subscription",
"time.time",
"WMQuality.TestInit.TestInit",
"WMCore.DataStructs.Run.Run",
"WMCore.WMBS.Fileset.Fileset",
"WMCore.JobSplitting.SplitterFactory.Splitter... | [((8955, 8970), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8968, 8970), False, 'import unittest\n'), ((793, 811), 'WMQuality.TestInit.TestInit', 'TestInit', (['__file__'], {}), '(__file__)\n', (801, 811), False, 'from WMQuality.TestInit import TestInit\n'), ((1013, 1055), 'WMCore.JobSplitting.SplitterFactory.... |
import json
import os
ROOT = "/scratch/cluster/ishann/data/detectron2/output"
ret0006_json = os.path.join(ROOT, "inference_ret0006/model_0089999/lvis_v0.5_val/class_aps_ret0006_model_0089999.json")
ret0011_json = os.path.join(ROOT, "inference_ret0011/model_0089999/inference/lvis_v0.5_val/class_aps_ret0011_model_00899... | [
"math.isnan",
"json.load",
"os.path.join"
] | [((95, 208), 'os.path.join', 'os.path.join', (['ROOT', '"""inference_ret0006/model_0089999/lvis_v0.5_val/class_aps_ret0006_model_0089999.json"""'], {}), "(ROOT,\n 'inference_ret0006/model_0089999/lvis_v0.5_val/class_aps_ret0006_model_0089999.json'\n )\n", (107, 208), False, 'import os\n'), ((215, 338), 'os.path.j... |
import unittest
import SentimentAnalysis
class SentimentAnalysis_Test(unittest.TestCase):
def setUp(self):
self.sa = SentimentAnalysis.SentimentAnalysis()
def test(self):
params = [
'All too much of the man-made is ugly, inefficient, depressing chaos.'
]
response =... | [
"unittest.main",
"SentimentAnalysis.SentimentAnalysis"
] | [((417, 432), 'unittest.main', 'unittest.main', ([], {}), '()\n', (430, 432), False, 'import unittest\n'), ((131, 168), 'SentimentAnalysis.SentimentAnalysis', 'SentimentAnalysis.SentimentAnalysis', ([], {}), '()\n', (166, 168), False, 'import SentimentAnalysis\n')] |
#!/usr/bin/python2
import time
import sys
sys.path.append("./")
from irc.bot import IRCBot
channels = ["#pricktest"]
bot = IRCBot('localhost',
6667,
channels=channels,
bot_nick='prickbot'
)
def main():
global bot
bot.start()
while bot.isAli... | [
"sys.path.append",
"irc.bot.IRCBot",
"time.sleep"
] | [((42, 63), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (57, 63), False, 'import sys\n'), ((125, 190), 'irc.bot.IRCBot', 'IRCBot', (['"""localhost"""', '(6667)'], {'channels': 'channels', 'bot_nick': '"""prickbot"""'}), "('localhost', 6667, channels=channels, bot_nick='prickbot')\n", (131, 190... |
import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from statsmodels.tsa.base.datetools import dates_from_str
import datetime
import time
from sklearn import svm
import json
feature_file_cases = '/Users/edwardgent/Downloads/NYT_US_COVID19.csv'
feature_file_tests = '/Users/edwardgent/Down... | [
"pandas.DataFrame",
"csv.reader",
"json.loads",
"statsmodels.tsa.base.datetools.dates_from_str",
"json.dumps",
"pandas.DatetimeIndex",
"numpy.array",
"sklearn.svm.SVC"
] | [((464, 552), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': "['New Cases', 'New Deaths', 'New Tests', 'Ventilators', 'ICU']"}), "(columns=['New Cases', 'New Deaths', 'New Tests', 'Ventilators',\n 'ICU'])\n", (476, 552), True, 'import pandas as pd\n'), ((997, 1026), 'statsmodels.tsa.base.datetools.dates_from_s... |
#
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2008-2022 <NAME> r.c.i.m<EMAIL>enzie at googlemail.com
#
# https://www.gpvdm.com
#
# This program is free software; you can redistribute it and/... | [
"inp.inp_load_file",
"quiver.quiver",
"str2bool.str2bool",
"util_zip.zip_get_data_file",
"triangle.triangle",
"os.path.isfile",
"os.path.getmtime",
"util_text.is_number",
"re.sub"
] | [((5200, 5223), 're.sub', 're.sub', (['""" +"""', '""" """', 'line'], {}), "(' +', ' ', line)\n", (5206, 5223), False, 'import re\n'), ((5302, 5325), 're.sub', 're.sub', (['"""\t"""', '""" """', 'line'], {}), "('\\t', ' ', line)\n", (5308, 5325), False, 'import re\n'), ((5753, 5781), 'util_zip.zip_get_data_file', 'zip_... |
"""
WebDjangular URL Configuration
"""
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib.sitemaps import views as sitemaps_views
# settings.ANGULAR_CLIENT_APP_DIR, settings.ANGULAR_ADMIN_APP_DIR
from django.contrib.staticfil... | [
"django.conf.urls.include",
"django.urls.path",
"django.conf.urls.url",
"django.conf.urls.static.static",
"rest_framework.routers.DefaultRouter"
] | [((1341, 1356), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (1354, 1356), False, 'from rest_framework.routers import DefaultRouter\n'), ((2539, 2633), 'django.urls.path', 'path', (['"""sitemap.xml"""', 'sitemap_index', "{'sitemaps': sitemaps, 'sitemap_url_name': 'sitemaps'}"], {}), "('sit... |
import json, codecs
import numpy as np
def load_data(root, path):
'''Load data from path'''
data = codecs.open(root + path, encoding = 'utf8')
relations = [json.loads(x) for x in data]
data.close()
return relations
def convert2id(root):
'''Convert training data into indices'''
wdict = {'<p... | [
"codecs.open",
"json.loads"
] | [((108, 149), 'codecs.open', 'codecs.open', (['(root + path)'], {'encoding': '"""utf8"""'}), "(root + path, encoding='utf8')\n", (119, 149), False, 'import json, codecs\n'), ((169, 182), 'json.loads', 'json.loads', (['x'], {}), '(x)\n', (179, 182), False, 'import json, codecs\n'), ((363, 422), 'codecs.open', 'codecs.op... |
from dataclasses import dataclass, field
from uuid import UUID
from dataclasses_json import config, dataclass_json
@dataclass_json
@dataclass
class Owner:
id: UUID = field(metadata=config(field_name="uuid"))
username: str
name: str
lastname: str
logo: str
kyc: bool
bio: str
| [
"dataclasses_json.config"
] | [((188, 213), 'dataclasses_json.config', 'config', ([], {'field_name': '"""uuid"""'}), "(field_name='uuid')\n", (194, 213), False, 'from dataclasses_json import config, dataclass_json\n')] |
import icalendar
import morepath
import sedate
from collections import OrderedDict, namedtuple
from datetime import datetime, timedelta
from isodate import parse_date, ISO8601Error
from itertools import groupby
from morepath.request import Response
from onegov.core.security import Public, Private
from onegov.core.util... | [
"onegov.org._",
"icalendar.Event",
"webob.exc.HTTPMethodNotAllowed",
"onegov.org.OrgApp.form",
"sqlalchemy.orm.object_session",
"onegov.ticket.TicketCollection",
"onegov.reservation.ResourceCollection",
"sqlalchemy.select",
"datetime.timedelta",
"onegov.org.utils.render_time_range",
"onegov.org.... | [((2107, 2193), 'onegov.org.OrgApp.html', 'OrgApp.html', ([], {'model': 'ResourceCollection', 'template': '"""resources.pt"""', 'permission': 'Public'}), "(model=ResourceCollection, template='resources.pt', permission=\n Public)\n", (2118, 2193), False, 'from onegov.org import _, OrgApp, utils\n'), ((2557, 2626), 'o... |
# -*- coding: utf-8 -*-
'''
训练材料预处理,保存成单个脸部图片
只有当你的训练材料中有很多多人照片才这么做
请将训练材料放在Prescreen文件夹中。
结构要求:
-+-PersonA-+-1.jpg
| +-2.jpg
| +-...
|
+-PersonB-+-1.jpg
| +-2.jpg
| +-...
|
+-PersonC-+-1.jpg
+-2.jpg
+-...
'''
fro... | [
"psutil.process_iter",
"threading.Thread.__init__",
"os.rename",
"os.popen",
"time.sleep",
"os.path.splitext",
"PIL.Image.fromarray",
"face_recognition.face_locations",
"face_recognition.load_image_file",
"datetime.datetime.now",
"os.listdir"
] | [((526, 539), 'time.sleep', 'time.sleep', (['n'], {}), '(n)\n', (536, 539), False, 'import time\n'), ((696, 711), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (706, 711), False, 'import os\n'), ((3462, 3477), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (3472, 3477), False, 'import os\n'), ((6040, 605... |
import os.path
import pygame
from pygame.sprite import Sprite
from game_stats import GameStats
from settings import Settings
class Ship(Sprite):
def __init__(self, ai_settings: Settings, screen: pygame.SurfaceType
, size=(0, 0), image_name="alien-invasion/images/ship1.png"):
"... | [
"pygame.image.load",
"pygame.transform.scale"
] | [((887, 927), 'pygame.transform.scale', 'pygame.transform.scale', (['self.image', 'size'], {}), '(self.image, size)\n', (909, 927), False, 'import pygame\n'), ((624, 653), 'pygame.image.load', 'pygame.image.load', (['image_name'], {}), '(image_name)\n', (641, 653), False, 'import pygame\n')] |
# coding: utf-8
import datetime
import pytest
import numpy as np
from ...models.transition.linear import ConstantVelocity
from ...predictor.information import InformationKalmanPredictor
from ...predictor.kalman import KalmanPredictor
from ...types.state import InformationState, GaussianState
from ...types.array import... | [
"numpy.allclose",
"numpy.linalg.inv",
"datetime.datetime.now",
"datetime.timedelta"
] | [((903, 926), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (924, 926), False, 'import datetime\n'), ((1358, 1384), 'numpy.linalg.inv', 'np.linalg.inv', (['prior_covar'], {}), '(prior_covar)\n', (1371, 1384), True, 'import numpy as np\n'), ((1901, 1936), 'numpy.linalg.inv', 'np.linalg.inv', (['pre... |
'''Set of functions to construct a graph as a combination of
smaller subgraphs (of aparticular shape, defined in the shapes.py file)
'''
import graphwave
import math
import networkx as nx
import numpy as np
from shapes import *
from utils.utils import *
from shapes.shapes import *
def build_structure(width_basis, bas... | [
"networkx.set_node_attributes",
"math.floor",
"numpy.max",
"networkx.Graph",
"numpy.array",
"numpy.random.choice",
"networkx.number_of_nodes"
] | [((1827, 1863), 'networkx.set_node_attributes', 'nx.set_node_attributes', (['basis', 'attrs'], {}), '(basis, attrs)\n', (1849, 1863), True, 'import networkx as nx\n'), ((5620, 5630), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (5628, 5630), True, 'import networkx as nx\n'), ((1888, 1913), 'networkx.number_of_nodes'... |
# coding: utf-8
from __future__ import division, print_function, unicode_literals
import unittest
from disjoint_set import DisjointSet
class TestDisjointSet(unittest.TestCase):
def test_no_merge(self):
s = DisjointSet(3)
self.assertEqual(s._parent, [-1, -1, -1])
self.assertEqual(s._root(0)... | [
"unittest.main",
"disjoint_set.DisjointSet"
] | [((1327, 1342), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1340, 1342), False, 'import unittest\n'), ((220, 234), 'disjoint_set.DisjointSet', 'DisjointSet', (['(3)'], {}), '(3)\n', (231, 234), False, 'from disjoint_set import DisjointSet\n'), ((909, 923), 'disjoint_set.DisjointSet', 'DisjointSet', (['(3)'], {... |
import hues.dpda as DPDA
def test_zero_negation():
func = DPDA.zero_break
assert func((1, 2, 3, 4, 0, 10, 1)) == (10, 1)
assert func((1, 2, 3, 4, 5, 0)) == tuple()
def test_order_annihilation():
func = DPDA.annihilate
assert func(range(0, 10), (1, 2, 3, 4, 4, 3)) == (3,)
assert func(range(5, 12), (1, 2, 1... | [
"hues.dpda.apply"
] | [((1008, 1032), 'hues.dpda.apply', 'DPDA.apply', (['funcs', 'stack'], {}), '(funcs, stack)\n', (1018, 1032), True, 'import hues.dpda as DPDA\n'), ((1054, 1082), 'hues.dpda.apply', 'DPDA.apply', (['funcs', '(1, 1, 0)'], {}), '(funcs, (1, 1, 0))\n', (1064, 1082), True, 'import hues.dpda as DPDA\n')] |
"""Install Foremast Lathe."""
from setuptools import find_packages, setup
with open('README.rst') as readme_handle:
LONG_DESCRIPTION = readme_handle.read()
setup(
name='foremast ui',
description='Foremast configuration generator web UI.',
long_description=LONG_DESCRIPTION,
author='',
author_em... | [
"setuptools.find_packages"
] | [((429, 455), 'setuptools.find_packages', 'find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (442, 455), False, 'from setuptools import find_packages, setup\n')] |
# -*- coding: utf-8 -*-
from django.db import models
class TimeModelMixin(models.Model):
"""Model内时间维护信息插件
注意!!:因为此mixin继承自models.Model,所以子类在继承时要确保此mixin在models.Model`出现`之前使用,
否则会出现method resolution order (MRO) 报错"""
created_time = models.DateTimeField("创建时间", auto_now_add=True, editable=False)
l... | [
"django.db.models.DateTimeField",
"django.db.models.IntegerField"
] | [((251, 314), 'django.db.models.DateTimeField', 'models.DateTimeField', (['"""创建时间"""'], {'auto_now_add': '(True)', 'editable': '(False)'}), "('创建时间', auto_now_add=True, editable=False)\n", (271, 314), False, 'from django.db import models\n'), ((333, 394), 'django.db.models.DateTimeField', 'models.DateTimeField', (['""... |
"""This module defines metaclasses used to trace the parameters passed through operation-critical classes that are members of
other libraries. These are only used in cases where it is impractical or impossible to effectively retrieve the arguments
explicitly provided by a user, as well as the default arguments for the ... | [
"inspect.signature"
] | [((1950, 1979), 'inspect.signature', 'signature', (['class_obj.__init__'], {}), '(class_obj.__init__)\n', (1959, 1979), False, 'from inspect import signature, _empty\n')] |
import unittest
from auction_system.auction import Auction
from auction_system.auction_house import AuctionHouse
from auction_system.item import Item
class TestAuctionHouse(unittest.TestCase):
def setUp(self):
self.auction_house = AuctionHouse()
def tearDown(self):
self.auction_house = None... | [
"unittest.main",
"auction_system.auction_house.AuctionHouse",
"auction_system.item.Item"
] | [((834, 849), 'unittest.main', 'unittest.main', ([], {}), '()\n', (847, 849), False, 'import unittest\n'), ((247, 261), 'auction_system.auction_house.AuctionHouse', 'AuctionHouse', ([], {}), '()\n', (259, 261), False, 'from auction_system.auction_house import AuctionHouse\n'), ((385, 418), 'auction_system.item.Item', '... |
#
# Copyright (c) 2015-2020 <NAME> <tflorac AT ulthar.net>
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE... | [
"pyams_form._",
"zope.interface.implementer",
"pyams_utils.adapter.adapter_config",
"operator.attrgetter",
"pyams_form.button.Buttons"
] | [((1275, 1313), 'zope.interface.implementer', 'implementer', (['IButtonForm', 'IHandlerForm'], {}), '(IButtonForm, IHandlerForm)\n', (1286, 1313), False, 'from zope.interface import implementer\n'), ((1361, 1386), 'zope.interface.implementer', 'implementer', (['IMultiWidget'], {}), '(IMultiWidget)\n', (1372, 1386), Fal... |
"""mcpython - a minecraft clone written in python licenced under MIT-licence
authors: uuk, xkcdjerry
original game by forgleman licenced under MIT-licence
minecraft by Mojang
blocks based on 1.14.4.jar of minecraft, downloaded on 20th of July, 2019"""
import state.StatePart
import globals as G
class UIPart(state.St... | [
"globals.window.get_size"
] | [((686, 705), 'globals.window.get_size', 'G.window.get_size', ([], {}), '()\n', (703, 705), True, 'import globals as G\n')] |
# Generated by Django 4.0.1 on 2022-02-03 07:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Hub', '0014_alter_appointment_id_alter_customer_id_and_more'),
]
operations = [
migrations.AlterField(
model_name='photographer'... | [
"django.db.models.CharField"
] | [((369, 841), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'choices': "[('Event', 'Event'), ('Fashion', 'Fashion'), ('Sports', 'Sports'), ('Food',\n 'Food'), ('Art_and_Portrait', 'Art_and_Portrait'), ('Architecture',\n 'Architecture'), ('Documentary', 'Documentary'), ('Travel', 'Trav... |
# Copyright (c) Facebook, Inc. and its affiliates.
"""
MultiDatasetLoader class is used by DatasetLoader class to load multiple datasets
and more granular
"""
import logging
import warnings
import numpy as np
from mmf.common.registry import registry
from mmf.utils.build import build_dataloader_and_sampler, build_data... | [
"numpy.random.choice",
"mmf.utils.distributed.is_master",
"logging.getLogger",
"mmf.utils.general.get_batch_size",
"mmf.common.registry.registry.get",
"mmf.utils.build.build_dataset",
"mmf.utils.build.build_dataloader_and_sampler",
"warnings.warn",
"mmf.utils.distributed.is_dist_initialized"
] | [((462, 489), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (479, 489), False, 'import logging\n'), ((735, 746), 'mmf.utils.distributed.is_master', 'is_master', ([], {}), '()\n', (744, 746), False, 'from mmf.utils.distributed import broadcast_scalar, is_dist_initialized, is_master\n'), (... |
from setuptools import setup
setup(
name='linkedin',
version='0.1',
description='A package to assist in collecting data from linkedin pages.',
author='kohlert',
license='MIT',
keywords='webscraper job search linkedin selenium',
url='https://github.com/kohlert/data_science/tree/master/Web_Sc... | [
"setuptools.setup"
] | [((30, 428), 'setuptools.setup', 'setup', ([], {'name': '"""linkedin"""', 'version': '"""0.1"""', 'description': '"""A package to assist in collecting data from linkedin pages."""', 'author': '"""kohlert"""', 'license': '"""MIT"""', 'keywords': '"""webscraper job search linkedin selenium"""', 'url': '"""https://github.... |
import os
import pandas as pd
from sklearn import ensemble
from sklearn import preprocessing
from sklearn import metrics
import joblib
import numpy as np
from . import dispatcher
def predict(test_data_path, model_type, model_path):
df = pd.read_csv(test_data_path)
test_idx = df["id"].values
predictions =... | [
"pandas.read_csv",
"os.path.join",
"numpy.column_stack"
] | [((244, 271), 'pandas.read_csv', 'pd.read_csv', (['test_data_path'], {}), '(test_data_path)\n', (255, 271), True, 'import pandas as pd\n'), ((366, 393), 'pandas.read_csv', 'pd.read_csv', (['test_data_path'], {}), '(test_data_path)\n', (377, 393), True, 'import pandas as pd\n'), ((1086, 1126), 'numpy.column_stack', 'np.... |
from django import template
register = template.Library()
@register.filter
def leading_zeros(value, desired_digits):
"""
Given an integer, returns a string representation, padded with [desired_digits] zeros.
"""
num_zeros = int(desired_digits) - len(str(value))
padded_value = []
while num_zeros >= 1:
... | [
"django.template.Library"
] | [((41, 59), 'django.template.Library', 'template.Library', ([], {}), '()\n', (57, 59), False, 'from django import template\n')] |
import numpy as np
import tensorflow as tf
from utils.layers import PrimaryCaps, FCCaps, Length, Mask
from keras import regularizers
def efficient_capsnet_graph(input_shape):
"""
Efficient-CapsNet graph architecture.
Parameters
----------
input_shape: list
network input shape
"""
... | [
"utils.layers.Mask",
"keras.regularizers.l2",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Input",
"utils.layers.Length",
"utils.layers.FCCaps",
"tensorflow.keras.Model",
"tensorflow.keras.models.Model",
"tens... | [((332, 359), 'tensorflow.keras.Input', 'tf.keras.Input', (['input_shape'], {}), '(input_shape)\n', (346, 359), True, 'import tensorflow as tf\n'), ((3204, 3302), 'tensorflow.keras.Model', 'tf.keras.Model', ([], {'inputs': 'inputs', 'outputs': '[digit_caps, digit_caps_len]', 'name': '"""Efficient_CapsNet"""'}), "(input... |
import numpy as np
import servo2
import math
import time
savedir="Camera_Data/"
map_A = np.load(savedir+'servoA.npy')
map_B = np.load(savedir+'servoB.npy')
steps = len(map_A)
wait = 0.3
def vect_to_deg(x, y):
servo_A, servo_B = 0, 0
try:
A = list(map(lambda k: k >= y, map_A)).index(True)-1
if map_A[A] == ... | [
"servo2.A",
"numpy.load",
"math.sqrt",
"time.sleep",
"servo2.B",
"servo2.home"
] | [((90, 121), 'numpy.load', 'np.load', (["(savedir + 'servoA.npy')"], {}), "(savedir + 'servoA.npy')\n", (97, 121), True, 'import numpy as np\n'), ((128, 159), 'numpy.load', 'np.load', (["(savedir + 'servoB.npy')"], {}), "(savedir + 'servoB.npy')\n", (135, 159), True, 'import numpy as np\n'), ((772, 785), 'servo2.home',... |
"""
Tests for the Woopra template tags and filters.
"""
from django.contrib.auth.models import User, AnonymousUser
from django.http import HttpRequest
from django.template import Context
from analytical.templatetags.woopra import WoopraNode
from analytical.tests.utils import TagTestCase, override_settings, \
... | [
"django.contrib.auth.models.AnonymousUser",
"analytical.templatetags.woopra.WoopraNode",
"django.contrib.auth.models.User",
"django.template.Context",
"django.http.HttpRequest",
"analytical.tests.utils.override_settings"
] | [((388, 434), 'analytical.tests.utils.override_settings', 'override_settings', ([], {'WOOPRA_DOMAIN': '"""example.com"""'}), "(WOOPRA_DOMAIN='example.com')\n", (405, 434), False, 'from analytical.tests.utils import TagTestCase, override_settings, SETTING_DELETED\n'), ((844, 892), 'analytical.tests.utils.override_settin... |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"akg.utils.validation_check.check_input_type",
"akg.utils.validation_check.ops_dtype_check",
"akg.tvm.truncdiv",
"akg.tvm.const",
"akg.tvm.compute",
"akg.utils.format_transform.get_shape",
"akg.utils.validation_check.check_shape",
"akg.lang.cce.floor",
"akg.utils.validation_check.check_equal"
] | [((3124, 3186), 'akg.utils.validation_check.check_input_type', 'vc_util.check_input_type', (['akg.tvm.tensor.Tensor', '(list, tuple)'], {}), '(akg.tvm.tensor.Tensor, (list, tuple))\n', (3148, 3186), True, 'from akg.utils import validation_check as vc_util\n'), ((945, 1058), 'akg.tvm.compute', 'akg.tvm.compute', (['outp... |
from django.conf import settings
from django.db import models
from django.db.models import Max
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.urls import reverse
from factory.django import mute_signals
from bibliography.models import Source
from brit.models import Named... | [
"django.db.models.Max",
"distributions.models.TemporalDistribution.objects.default",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.dispatch.receiver",
"factory.django.mute_signals",
"django.db.models.FloatField",
"django.db.models.BooleanFie... | [((1825, 1870), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'MaterialComponent'}), '(post_save, sender=MaterialComponent)\n', (1833, 1870), False, 'from django.dispatch import receiver\n'), ((8958, 8998), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'SampleSeries'}), '(post_... |
# Generated by Django 3.1.7 on 2021-04-10 15:11
from django.db import migrations, models
import phone_field.models
class Migration(migrations.Migration):
dependencies = [
('authentication', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
... | [
"django.db.models.BooleanField"
] | [((363, 397), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (382, 397), False, 'from django.db import migrations, models\n'), ((518, 552), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)'}), '(default=False)\n', (537, 552), F... |
import turtle
WIDTH = 50
HEIGHT = 100
SIZE = 5
GAP = 15
BEGIN = -280
def goto(x):
t.setposition(x, 0)
def dot(start, color):
goto(start)
t.pencolor(color)
t.down()
for _ in range(4):
t.forward(SIZE)
t.left(90)
t.up()
def zero(start, color):
goto(start)
t.pencolor(c... | [
"turtle.Screen",
"turtle.Pen"
] | [((1531, 1543), 'turtle.Pen', 'turtle.Pen', ([], {}), '()\n', (1541, 1543), False, 'import turtle\n'), ((2024, 2039), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (2037, 2039), False, 'import turtle\n')] |
import os
notes = []
for file in os.listdir('.'):
if file.endswith(".py"):
continue
filename_w_ext = os.path.basename(file).lower()
filename, file_extension = os.path.splitext(filename_w_ext)
notes.append(filename.split("_"))
sortedNotes = sorted(notes, key=lambda note:int(note[2]))
f... | [
"os.path.splitext",
"os.listdir",
"os.path.basename"
] | [((35, 50), 'os.listdir', 'os.listdir', (['"""."""'], {}), "('.')\n", (45, 50), False, 'import os\n'), ((182, 214), 'os.path.splitext', 'os.path.splitext', (['filename_w_ext'], {}), '(filename_w_ext)\n', (198, 214), False, 'import os\n'), ((120, 142), 'os.path.basename', 'os.path.basename', (['file'], {}), '(file)\n', ... |
"""
Daemonize a process.
Based on: http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
Taken from: https://github.com/WIPACrepo/iceprod/blob/master/iceprod/server/daemon.py
"""
import sys
import os
import time
import atexit
import signal
from builtins import str
class Daemon(object):
"""
... | [
"sys.stdout.write",
"atexit.register",
"os.remove",
"sys.stderr.fileno",
"sys.stdout.flush",
"os.chdir",
"sys.stdout.fileno",
"os.path.exists",
"os.umask",
"os.fork",
"sys.stderr.flush",
"time.sleep",
"sys.stdin.fileno",
"builtins.str",
"os.getpgrp",
"sys.exit",
"os.getpid",
"os.ki... | [((2017, 2037), 'os.chdir', 'os.chdir', (['self.chdir'], {}), '(self.chdir)\n', (2025, 2037), False, 'import os\n'), ((2047, 2058), 'os.setsid', 'os.setsid', ([], {}), '()\n', (2056, 2058), False, 'import os\n'), ((2068, 2088), 'os.umask', 'os.umask', (['self.umask'], {}), '(self.umask)\n', (2076, 2088), False, 'import... |
import os
from ..xjson import XJson
def test_json_eq_xjson():
json = XJson(os.path.join("examples", "countries", "single_file.json"))
yaml_file = XJson(os.path.join("examples","countries", "single_file.yaml"))
assert json.structure == yaml_file.structure | [
"os.path.join"
] | [((86, 143), 'os.path.join', 'os.path.join', (['"""examples"""', '"""countries"""', '"""single_file.json"""'], {}), "('examples', 'countries', 'single_file.json')\n", (98, 143), False, 'import os\n'), ((169, 226), 'os.path.join', 'os.path.join', (['"""examples"""', '"""countries"""', '"""single_file.yaml"""'], {}), "('... |
# encoding = utf-8
import os
import re
import sys
import time
import json
import logging
from datetime import datetime, timedelta
'''
IMPORTANT
Edit only the validate_input and collect_events functions.
Do not edit any other part in this file.
This file is generated only once when creating the modula... | [
"os.path.exists",
"json.dumps",
"time.sleep",
"time.time",
"datetime.datetime.strptime",
"datetime.datetime.now",
"re.sub"
] | [((595, 646), 'datetime.datetime.strptime', 'datetime.strptime', (['iso8601', '"""%Y-%m-%dT%H:%M:%S.%fZ"""'], {}), "(iso8601, '%Y-%m-%dT%H:%M:%S.%fZ')\n", (612, 646), False, 'from datetime import datetime, timedelta\n'), ((18378, 18392), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (18390, 18392), False, ... |
# -*- coding: future_fstrings -*-
import threading
from flask_mail import Message
from flask import render_template, current_app
from app.extensions import mail
def send_reset_password(user, pin, callback_url):
send(f'{pin} is your Typer account recovery code',
sender = current_app.config['MAIL_USERNAME'],
... | [
"flask.current_app._get_current_object",
"app.extensions.mail.send",
"flask.render_template",
"flask_mail.Message"
] | [((611, 665), 'flask_mail.Message', 'Message', (['subject'], {'sender': 'sender', 'recipients': 'recipients'}), '(subject, sender=sender, recipients=recipients)\n', (618, 665), False, 'from flask_mail import Message\n'), ((537, 551), 'app.extensions.mail.send', 'mail.send', (['msg'], {}), '(msg)\n', (546, 551), False, ... |