code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#! /usr/bin/env python3
# Copyright(c) 2017-2018 Intel Corporation.
# License: MIT See LICENSE file in root directory.
GREEN = '\033[1;32m'
RED = '\033[1;31m'
NOCOLOR = '\033[0m'
YELLOW = '\033[1;33m'
try:
from openvino.inference_engine import IENetwork, ExecutableNetwork, IECore
import openvino.inference_en... | [
"os.listdir",
"sys.exit",
"openvino.inference_engine.IENetwork",
"queue.Queue",
"numpy.argsort",
"datetime.datetime.now",
"os.path.isfile",
"openvino.inference_engine.IECore",
"os.path.isdir",
"time.time",
"threading.Thread",
"cv2.resize",
"threading.Barrier",
"cv2.imread"
] | [((14365, 14391), 'cv2.imread', 'cv2.imread', (['image_filename'], {}), '(image_filename)\n', (14375, 14391), False, 'import cv2\n'), ((14404, 14429), 'cv2.resize', 'cv2.resize', (['image', '(w, h)'], {}), '(image, (w, h))\n', (14414, 14429), False, 'import cv2\n'), ((15411, 15444), 'queue.Queue', 'queue.Queue', (['INF... |
# yellowbrick.cluster.silhouette
# Implements visualizers using the silhouette metric for cluster evaluation.
#
# Author: <NAME> <<EMAIL>>
# Created: Mon Mar 27 10:09:24 2017 -0400
#
# Copyright (C) 2016 District Data Labs
# For license information, see LICENSE.txt
#
# ID: silhouette.py [57b563b] <EMAIL> $
"""
Impl... | [
"matplotlib.ticker.MultipleLocator",
"sklearn.metrics.silhouette_samples",
"sklearn.metrics.silhouette_score",
"numpy.arange"
] | [((4916, 4943), 'sklearn.metrics.silhouette_score', 'silhouette_score', (['X', 'labels'], {}), '(X, labels)\n', (4932, 4943), False, 'from sklearn.metrics import silhouette_score, silhouette_samples\n'), ((4979, 5008), 'sklearn.metrics.silhouette_samples', 'silhouette_samples', (['X', 'labels'], {}), '(X, labels)\n', (... |
import numpy as np
import pytest
from ome_zarr.scale import Scaler
class TestScaler:
@pytest.fixture(
params=(
(1, 2, 1, 256, 256),
(3, 512, 512),
(256, 256),
),
ids=["5D", "3D", "2D"],
)
def shape(self, request):
return request.param
... | [
"pytest.fixture",
"pytest.mark.skip",
"numpy.random.default_rng",
"ome_zarr.scale.Scaler"
] | [((93, 193), 'pytest.fixture', 'pytest.fixture', ([], {'params': '((1, 2, 1, 256, 256), (3, 512, 512), (256, 256))', 'ids': "['5D', '3D', '2D']"}), "(params=((1, 2, 1, 256, 256), (3, 512, 512), (256, 256)), ids\n =['5D', '3D', '2D'])\n", (107, 193), False, 'import pytest\n'), ((1794, 1849), 'pytest.mark.skip', 'pyte... |
from setuptools import setup
NAME = 'passsafe'
VERSION = '0.1.0'
install_requires = [
'cryptography',
'flask',
'pyotp',
'requests',
'waitress'
]
setup(
name=NAME,
version=VERSION,
description="A client-server app to safely handle a password in "
"analytical application... | [
"setuptools.setup"
] | [((168, 606), 'setuptools.setup', 'setup', ([], {'name': 'NAME', 'version': 'VERSION', 'description': '"""A client-server app to safely handle a password in analytical applications."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/DrGFreeman/passsafe"""', 'license': '"""MIT"... |
# BSD 3-Clause License
# Copyright (c) 2019, regain authors
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright notice, this
# lis... | [
"sklearn.model_selection.StratifiedShuffleSplit",
"numpy.sqrt",
"sklearn.model_selection._validation._aggregate_score_dicts",
"numpy.array",
"netanalytics.graphlets.GCD",
"sklearn.utils._joblib.delayed",
"sklearn.metrics.scorer._check_multimetric_scoring",
"sklearn.base.is_classifier",
"numpy.sort",... | [((2350, 2381), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (2371, 2381), False, 'import warnings\n'), ((6401, 6418), 'numpy.sum', 'np.sum', (['xi_matrix'], {}), '(xi_matrix)\n', (6407, 6418), True, 'import numpy as np\n'), ((2940, 2978), 'numpy.triu_indices_from', 'np.triu... |
# coding=utf-8
import random
import rdkit.Chem as rkc
from rdkit.Chem import AllChem
from rdkit.Chem import MolStandardize
from rdkit.Chem import SaltRemover
from rdkit.Chem import rdmolops
def disable_rdkit_logging():
"""
Disables RDKit whiny logging.
"""
import rdkit.RDLogger as rkl
logger = r... | [
"random.shuffle",
"rdkit.Chem.rdmolops.Cleanup",
"rdkit.Chem.rdmolops.RemoveHs",
"rdkit.Chem.SaltRemover.SaltRemover",
"rdkit.Chem.rdmolops.SanitizeMol",
"rdkit.Chem.MolFromSmiles",
"rdkit.RDLogger.logger",
"rdkit.Chem.MolToSmiles",
"rdkit.Chem.RenumberAtoms",
"rdkit.Chem.MolStandardize.canonicali... | [((319, 331), 'rdkit.RDLogger.logger', 'rkl.logger', ([], {}), '()\n', (329, 331), True, 'import rdkit.RDLogger as rkl\n'), ((400, 430), 'rdkit.rdBase.DisableLog', 'rkrb.DisableLog', (['"""rdApp.error"""'], {}), "('rdApp.error')\n", (415, 430), True, 'import rdkit.rdBase as rkrb\n'), ((1582, 1640), 'rdkit.Chem.rdmolops... |
"""
Module to contain all the project's Flask server plumbing.
"""
from flask import Flask
from flask import render_template, session
from bitshift import assets
# from bitshift.database import Database
# from bitshift.query import parse_query
app = Flask(__name__)
app.config.from_object("bitshift.config")
app_env ... | [
"flask.render_template",
"flask.Flask"
] | [((253, 268), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (258, 268), False, 'from flask import Flask\n'), ((476, 505), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (491, 505), False, 'from flask import render_template, session\n'), ((671, 700), 'flask.rend... |
"""File for defining commands for the sampler."""
import argparse
import logging
import sampler.trees as trees
import sampler.nodes as nodes
def main():
parser = argparse.ArgumentParser(
description="Sample trees or nodes from a crawler file.",
)
subparsers = parser.add_subparsers(help='sub-comm... | [
"argparse.ArgumentParser"
] | [((170, 256), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Sample trees or nodes from a crawler file."""'}), "(description=\n 'Sample trees or nodes from a crawler file.')\n", (193, 256), False, 'import argparse\n')] |
from __future__ import absolute_import, print_function
from sentry.signals import project_created
from sentry.models import Rule
DEFAULT_RULE_LABEL = "Send a notification for new issues"
DEFAULT_RULE_DATA = {
"match": "all",
"conditions": [{"id": "sentry.rules.conditions.first_seen_event.FirstSeenEventCondit... | [
"sentry.signals.project_created.connect"
] | [((719, 818), 'sentry.signals.project_created.connect', 'project_created.connect', (['create_default_rules'], {'dispatch_uid': '"""create_default_rules"""', 'weak': '(False)'}), "(create_default_rules, dispatch_uid=\n 'create_default_rules', weak=False)\n", (742, 818), False, 'from sentry.signals import project_crea... |
#!/usr/bin/env python
# -*- noplot -*-
"""
This example demonstrates how to set a hyperlinks on various kinds of elements.
This currently only works with the SVG backend.
"""
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
f = plt.figure()
s = plt.scatter... | [
"matplotlib.pyplot.imshow",
"matplotlib.mlab.bivariate_normal",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"numpy.meshgrid",
"numpy.arange"
] | [((292, 304), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (302, 304), True, 'import matplotlib.pyplot as plt\n'), ((309, 342), 'matplotlib.pyplot.scatter', 'plt.scatter', (['[1, 2, 3]', '[4, 5, 6]'], {}), '([1, 2, 3], [4, 5, 6])\n', (320, 342), True, 'import matplotlib.pyplot as plt\n'), ((451, 463), 'm... |
"""First migration, User and Task table
Revision ID: ea9755d7d366
Revises:
Create Date: 2021-10-12 22:38:53.623711
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "ea9755d7d366"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"alembic.op.f",
"sqlalchemy.Boolean",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.String"
] | [((1884, 1905), 'alembic.op.drop_table', 'op.drop_table', (['"""task"""'], {}), "('task')\n", (1897, 1905), False, 'from alembic import op\n'), ((1973, 1994), 'alembic.op.drop_table', 'op.drop_table', (['"""user"""'], {}), "('user')\n", (1986, 1994), False, 'from alembic import op\n'), ((622, 651), 'sqlalchemy.PrimaryK... |
from setuptools import setup, find_packages
version = '0.2'
setup(name='coanno',
version=version,
description="""Given a pair of gff files, and a pair of fasta files, use
one to annotate the other for missed exons""",
long_description="""\
""",
classifiers=[], # Get strings from http://p... | [
"setuptools.find_packages"
] | [((503, 559), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['ez_setup', 'examples', 'tests']"}), "(exclude=['ez_setup', 'examples', 'tests'])\n", (516, 559), False, 'from setuptools import setup, find_packages\n')] |
from time import sleep
import requests
headers = {
"Accept": "application/vnd.github.v3+json",
"Authorization": "token <PASSWORD>", # github授权token
"X-OAuth-Scopes": "repo"
}
with open('./repos.txt', 'r', encoding='utf-8') as f:
data = f.readlines()
url = "https://api.github.com/repos/{}/{}"
urls = ... | [
"requests.delete"
] | [((475, 516), 'requests.delete', 'requests.delete', ([], {'url': 'url', 'headers': 'headers'}), '(url=url, headers=headers)\n', (490, 516), False, 'import requests\n')] |
"""
sqmpy.manager
~~~~~
Provides user management
"""
import flask_login as flask_login
from flask import current_app, session, request, g
from sqmpy.security import constants
from sqmpy.security.models import User, _AnonymousUserMixin
from sqmpy.security.exceptions import SecurityManagerException
from sqm... | [
"sqmpy.security.models.User.query.filter_by",
"sqmpy.security.models.User.query.get",
"sqmpy.database.db.session.add",
"sqmpy.security.models.User.query.filter",
"sqmpy.security.models.User",
"flask.request.form.get",
"sqmpy.database.db.session.commit",
"sqmpy.security.exceptions.SecurityManagerExcept... | [((534, 574), 'flask.current_app.config.get', 'current_app.config.get', (['"""USE_LDAP_LOGIN"""'], {}), "('USE_LDAP_LOGIN')\n", (556, 574), False, 'from flask import current_app, session, request, g\n'), ((1170, 1210), 'flask.current_app.config.get', 'current_app.config.get', (['"""LOGIN_DISABLED"""'], {}), "('LOGIN_DI... |
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
#intensity of green
blue_lower=np.array([100,150,0])
blue_upper=np.array([140,255,255])
kernel_open=np.ones((5,5))
kernel_close=np.ones((15,15))
while True:
ret,photo= cap.read()
img=cv2.resize(photo,(340,220))
# convert image to HSv
imgHsv=cv2.c... | [
"cv2.rectangle",
"cv2.drawContours",
"numpy.ones",
"cv2.inRange",
"cv2.imshow",
"numpy.array",
"cv2.morphologyEx",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.findContours",
"cv2.resize",
"cv2.waitKey",
"cv2.boundingRect"
] | [((37, 56), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (53, 56), False, 'import cv2\n'), ((88, 111), 'numpy.array', 'np.array', (['[100, 150, 0]'], {}), '([100, 150, 0])\n', (96, 111), True, 'import numpy as np\n'), ((121, 146), 'numpy.array', 'np.array', (['[140, 255, 255]'], {}), '([140, 255, 255... |
import inspect
from abc import ABCMeta, abstractmethod
from functools import update_wrapper
from fixate.core.discover import discover_sub_classes, open_visa_instrument
from fixate.core.exceptions import InstrumentFeatureUnavailable
try:
import typing
number = typing.Union[float, int]
except ImportError:
n... | [
"fixate.core.discover.open_visa_instrument",
"inspect.currentframe",
"inspect.signature",
"fixate.core.discover.discover_sub_classes",
"functools.update_wrapper"
] | [((728, 769), 'fixate.core.discover.open_visa_instrument', 'open_visa_instrument', (['"""DSO"""', 'restrictions'], {}), "('DSO', restrictions)\n", (748, 769), False, 'from fixate.core.discover import discover_sub_classes, open_visa_instrument\n'), ((869, 894), 'fixate.core.discover.discover_sub_classes', 'discover_sub_... |
# Copyright 2019 Illumio, 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 t... | [
"json.dumps",
"os.path.join"
] | [((847, 880), 'os.path.join', 'os.path.join', (['pce', '"""orgs"""', 'org_id'], {}), "(pce, 'orgs', org_id)\n", (859, 880), False, 'import os\n'), ((1645, 1760), 'os.path.join', 'os.path.join', (["('https://' + os.environ['ILLUMIO_SERVER'] + ':' + os.environ['ILO_PORT'])", '"""api"""', "('v%d' % pce_api)"], {}), "('htt... |
"""Manage the Ceph Dashboard service via ceph CLI."""
import json
import logging
import tempfile
from time import sleep
import requests
LOG = logging.getLogger(__name__)
def enable_dashboard(cls, config):
"""Method to enable the dashboard module.
if user bootstrap with skip-dashboard option
then enabli... | [
"logging.getLogger",
"json.loads",
"requests.Session",
"json.dumps",
"time.sleep",
"tempfile.NamedTemporaryFile"
] | [((144, 171), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (161, 171), False, 'import logging\n'), ((718, 760), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'suffix': '""".txt"""'}), "(suffix='.txt')\n", (745, 760), False, 'import tempfile\n'), ((2131, 2141), 'tim... |
"""This file defines the model."""
import logging
import numpy as np
import tensorflow as tf
from dan.losses import get_adv_losses
from dan.utils import load_component
LOGGER = logging.getLogger(__name__)
def get_l2_norm(tensor):
"""Return the l2 norm of a tensor."""
return tf.sqrt(1e-8 + tf.reduce_sum(
... | [
"logging.getLogger",
"tensorflow.equal",
"tensorflow.shape",
"tensorflow.gradients",
"tensorflow.control_dependencies",
"tensorflow.reduce_mean",
"dan.losses.get_adv_losses",
"dan.utils.load_component",
"tensorflow.square",
"tensorflow.maximum",
"tensorflow.summary.scalar",
"tensorflow.trainab... | [((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'import logging\n'), ((521, 570), 'tensorflow.variable_scope', 'tf.variable_scope', (['self.name'], {'reuse': 'tf.AUTO_REUSE'}), '(self.name, reuse=tf.AUTO_REUSE)\n', (538, 570), True, 'import tensorflow as tf... |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
"torch.randperm",
"torch.stack",
"deprecate.void",
"torchmetrics.utilities.rank_zero_warn",
"torchmetrics.utilities.data.dim_zero_cat",
"torch.diag",
"deprecate.deprecated"
] | [((1275, 1291), 'torch.diag', 'torch.diag', (['k_xx'], {}), '(k_xx)\n', (1285, 1291), False, 'import torch\n'), ((1305, 1321), 'torch.diag', 'torch.diag', (['k_yy'], {}), '(k_yy)\n', (1315, 1321), False, 'import torch\n'), ((12674, 12783), 'deprecate.deprecated', 'deprecated', ([], {'target': 'KernelInceptionDistance',... |
import numpy as np
import pandas as pd
class Simulation:
''' Simulate a process of randomly selecting one of N coins, flipping the
selected coin a certain number of times, and then repeating this a few times
'''
def __init__(self,
n_sequences=10,
n_reps_per_sequence=7... | [
"numpy.ones",
"numpy.log",
"numpy.exp",
"numpy.array",
"numpy.sum",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.uniform",
"numpy.random.binomial"
] | [((387, 407), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (401, 407), True, 'import numpy as np\n'), ((2258, 2320), 'numpy.concatenate', 'np.concatenate', (["(theta['bernoulli_p'], theta['multinomial_p'])"], {}), "((theta['bernoulli_p'], theta['multinomial_p']))\n", (2272, 2320), True, 'import nu... |
import os
import pytest
from lib.clients.GcpClient import GcpClient
from lib.clients.BaseClient import BaseClient
from unittest.mock import patch
from googleapiclient.http import HttpRequest
from googleapiclient.model import JsonModel
from googleapiclient.http import HttpMock
from google.cloud.exceptions import NotFoun... | [
"googleapiclient.model.JsonModel",
"googleapiclient.http.HttpRequest",
"google.cloud.exceptions.NotFound",
"lib.clients.GcpClient.GcpClient",
"lib.models.Volume.Volume",
"pytest.raises",
"googleapiclient.http.HttpMock",
"lib.models.Snapshot.Snapshot",
"unittest.mock.patch.object",
"unittest.mock.p... | [((5834, 5876), 'unittest.mock.patch.object', 'patch.object', (['BaseClient', '"""last_operation"""'], {}), "(BaseClient, 'last_operation')\n", (5846, 5876), False, 'from unittest.mock import patch\n'), ((5977, 6053), 'unittest.mock.patch', 'patch', (['"""google.oauth2.service_account.Credentials.from_service_account_i... |
import random
import types
import typing
import torch
class Preprocessing(object):
def __init__(self, augmentation: str='hvr') -> None:
self.augmentation = augmentation
return
def _apply(self, f: typing.Callable, **kwargs) -> dict:
applied = {k: f(v) for k, v in kwargs.items()}
... | [
"torch.no_grad",
"random.random"
] | [((345, 360), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (358, 360), False, 'import torch\n'), ((557, 572), 'random.random', 'random.random', ([], {}), '()\n', (570, 572), False, 'import random\n'), ((619, 634), 'random.random', 'random.random', ([], {}), '()\n', (632, 634), False, 'import random\n'), ((681, 6... |
# Copyright IBM Corp. 2016 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 required by applicable law or ag... | [
"bdd_test_util.cli_call",
"peer_basic_impl.ContainerData",
"os.environ.copy",
"uuid.uuid1"
] | [((1316, 1333), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (1331, 1333), False, 'import os\n'), ((2126, 2236), 'bdd_test_util.cli_call', 'bdd_test_util.cli_call', (["['docker', 'inspect', '--format', '{{ .Name }}', containerID]"], {'expect_success': '(True)'}), "(['docker', 'inspect', '--format', '{{ .Name... |
import datetime
from dataclasses import dataclass, field, fields
from typing import Dict
from loguru import logger
from contracts.fields import asdict, STATE, TELEMETRY
from contracts.lights import LightGroup
from contracts.sensor import Sensors
"""
todo make a base class from this to use for other data sources
"""
... | [
"dataclasses.fields",
"loguru.logger.warning",
"contracts.sensor.Sensors.from_raw",
"contracts.lights.LightGroup.from_raw",
"datetime.datetime.now",
"contracts.fields.asdict",
"dataclasses.field"
] | [((417, 444), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (422, 444), False, 'from dataclasses import dataclass, field, fields\n'), ((468, 495), 'dataclasses.field', 'field', ([], {'default_factory': 'list'}), '(default_factory=list)\n', (473, 495), False, 'from dataclas... |
from iara.system.date import date_base as date
from iara.system.info import ram
__cpu_show__ = False
def puts(args,sep:str=' ',path_file:str=None)->None:
input = args
cpu = f'[CPU: {ram()[2]}%_{ram()[3]}ms]\n' if(__cpu_show__) else ''
text = (f'{cpu}{date()}-> {input}')
print(text)
if path_file:
path = ... | [
"iara.system.date.date_base",
"iara.system.info.ram"
] | [((259, 265), 'iara.system.date.date_base', 'date', ([], {}), '()\n', (263, 265), True, 'from iara.system.date import date_base as date\n'), ((188, 193), 'iara.system.info.ram', 'ram', ([], {}), '()\n', (191, 193), False, 'from iara.system.info import ram\n'), ((200, 205), 'iara.system.info.ram', 'ram', ([], {}), '()\n... |
# -*- coding: utf-8 -*-
from django import forms
from django.conf import settings
from django.utils.translation import get_language_bidi
__all__ = ['ChosenWidgetMixin', 'ChosenSelect', 'ChosenSelectMultiple',
'ChosenGroupSelect', 'DateWidget', 'RelatedFieldWidgetWrapper',
'TimeWidget', 'SplitDateTime', 'ArrayFieldS... | [
"django.forms.MultiWidget.__init__",
"django.forms.Media",
"django.utils.translation.get_language_bidi"
] | [((908, 927), 'django.utils.translation.get_language_bidi', 'get_language_bidi', ([], {}), '()\n', (925, 927), False, 'from django.utils.translation import get_language_bidi\n'), ((3419, 3483), 'django.forms.Media', 'forms.Media', ([], {'js': "[('bootstrap/dist/js/%s' % path) for path in js]"}), "(js=[('bootstrap/dist/... |
# https://www.hackerrank.com/challenges/computing-the-correlation
import math
import sys
def computing_the_correlation(n, x, y, z):
Sxi = Sxi2 = 0
Syi = Syi2 = 0
Szi = Szi2 = 0
Sxiyi = Syizi = Szixi = 0
for i in range(n):
Sxi += x[i]
Sxi2 += x[i] ** 2
Syi += y[i]
... | [
"math.sqrt"
] | [((573, 603), 'math.sqrt', 'math.sqrt', (['(n * Sai2 - Sai ** 2)'], {}), '(n * Sai2 - Sai ** 2)\n', (582, 603), False, 'import math\n'), ((616, 646), 'math.sqrt', 'math.sqrt', (['(n * Sbi2 - Sbi ** 2)'], {}), '(n * Sbi2 - Sbi ** 2)\n', (625, 646), False, 'import math\n')] |
import requests
from bs4 import BeautifulSoup
from models import Joke
class TwitterScraper(object):
BASE_URL = 'https://twitter.com/'
def __init__(self, user='baddadjokes'):
self.user = user
def scrape(self):
for tweet in self._tweets():
Joke(
self._tweet_ref(... | [
"bs4.BeautifulSoup"
] | [((1169, 1203), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page', '"""html.parser"""'], {}), "(page, 'html.parser')\n", (1182, 1203), False, 'from bs4 import BeautifulSoup\n')] |
#!/usr/bin/env python
# ase.py
# Created by <NAME> on 2017-09-12.
# Email: <EMAIL>
# Copyright (c) 2017. All rights reserved.
import numpy as np
from typing import Sequence, TypeVar, Union, Dict
import networkx
import os
from scipy.stats import norm
from scipy.stats import rankdata
from sklearn.decomposition import... | [
"graspy.utils.pass_to_ranks",
"d3m.primitive_interfaces.base.CallResult",
"numpy.mean",
"d3m.container.ndarray",
"graspy.embed.AdjacencySpectralEmbed",
"graspy.embed.OmnibusEmbed",
"numpy.sum",
"os.path.dirname",
"numpy.random.seed"
] | [((5340, 5360), 'numpy.random.seed', 'np.random.seed', (['(1234)'], {}), '(1234)\n', (5354, 5360), True, 'import numpy as np\n'), ((6930, 6986), 'graspy.embed.AdjacencySpectralEmbed', 'graspyASE', ([], {'n_components': 'max_dimension', 'n_elbows': 'n_elbows'}), '(n_components=max_dimension, n_elbows=n_elbows)\n', (6939... |
from helpers.AuxiliarFuncs import *
import time
# Retrieves the information to start spamming users
def spammyGUI(user):
msg = input("Message to spam: ")
success = False
userL = []
choiceF = 69
while not success:
try:
delay = int(input("Time between messages (seconds): "))
... | [
"time.sleep"
] | [((3625, 3642), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (3635, 3642), False, 'import time\n')] |
import sys, os, pytest
sys.path.append('.')
import submit
output_worked = 'Your submission has been accepted and will be graded shortly.'
from io import StringIO
class TestCorrectMetadata:
def test_001(self):
meta_data = submit.load_metadata('test/_coursera')
assert len(meta_data.part_data) == ... | [
"submit.part_prompt",
"submit.login_prompt",
"submit.load_metadata",
"sys.path.insert",
"submit.output",
"os.rmdir",
"pytest.raises",
"sys.path.append",
"io.StringIO",
"submit.build_parser",
"os.remove"
] | [((24, 44), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (39, 44), False, 'import sys, os, pytest\n'), ((238, 276), 'submit.load_metadata', 'submit.load_metadata', (['"""test/_coursera"""'], {}), "('test/_coursera')\n", (258, 276), False, 'import submit\n'), ((692, 713), 'submit.build_parser', 's... |
"""This module defines the DataSeries class, the elementary data structure of ixdat
An ixdat DataSeries is a wrapper around a numpy array containing the metadata needed
to combine it with other DataSeries. Typically this means a reference to the time
variable corresponding to the rows of the array. The time variable i... | [
"numpy.array",
"numpy.ones"
] | [((10044, 10071), 'numpy.ones', 'np.ones', (['tseries.data.shape'], {}), '(tseries.data.shape)\n', (10051, 10071), True, 'import numpy as np\n'), ((9765, 9777), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (9773, 9777), True, 'import numpy as np\n'), ((9794, 9809), 'numpy.array', 'np.array', (['value'], {}), '(va... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... | [
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set",
"pulumi.get"
] | [((3443, 3484), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""failedLocationCount"""'}), "(name='failedLocationCount')\n", (3456, 3484), False, 'import pulumi\n'), ((3700, 3731), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""odataType"""'}), "(name='odataType')\n", (3713, 3731), False, 'import pulumi\n'), (... |
"""
confirmationdialog
==================
**Module** : ``confirmationdialog.confirmationdialog.py``
Contains the class :py:class:`.ConfirmationDialog`, used to show
a confirmation dialog.
"""
from kivy.uix.popup import Popup
from kivy.properties import ObjectProperty
from kivy.properties import BooleanProperty
impo... | [
"kivy.properties.BooleanProperty",
"kivy.properties.ObjectProperty"
] | [((519, 539), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {}), '(None)\n', (533, 539), False, 'from kivy.properties import ObjectProperty\n'), ((671, 691), 'kivy.properties.ObjectProperty', 'ObjectProperty', (['None'], {}), '(None)\n', (685, 691), False, 'from kivy.properties import ObjectProperty\n'... |
from gpiozero import Button
button_right = Button(2)
button_left = Button(18)
button_down = Button(25)
button_up = Button(8)
while True:
if button_right.is_pressed:
print('turn right')
elif button_left.is_pressed:
print('turn left')
elif button_down.is_pressed:
print('turn down')
... | [
"gpiozero.Button"
] | [((43, 52), 'gpiozero.Button', 'Button', (['(2)'], {}), '(2)\n', (49, 52), False, 'from gpiozero import Button\n'), ((67, 77), 'gpiozero.Button', 'Button', (['(18)'], {}), '(18)\n', (73, 77), False, 'from gpiozero import Button\n'), ((92, 102), 'gpiozero.Button', 'Button', (['(25)'], {}), '(25)\n', (98, 102), False, 'f... |
""" Defines the User repository """
from models.user import User
from models import db
class UserRepository:
""" The repository for the user model """
@staticmethod
def get(email):
""" Query a user by last and first name """
return User.query.filter_by(email=email).one_or_none()
def... | [
"models.user.User",
"models.user.User.query.filter_by"
] | [((609, 666), 'models.user.User', 'User', ([], {'last_name': 'last_name', 'first_name': 'first_name', 'age': 'age'}), '(last_name=last_name, first_name=first_name, age=age)\n', (613, 666), False, 'from models.user import User\n'), ((264, 297), 'models.user.User.query.filter_by', 'User.query.filter_by', ([], {'email': '... |
import numpy as np
from numpy.testing import assert_array_equal
from nose.tools import assert_raises
from pyriemann.classification import (MDM, FgMDM, KNearestNeighbor,
TSclassifier)
def generate_cov(Nt, Ne):
"""Generate a set of cavariances matrices for test purpose."""
... | [
"pyriemann.classification.KNearestNeighbor",
"pyriemann.classification.FgMDM",
"numpy.testing.assert_array_equal",
"numpy.diag",
"nose.tools.assert_raises",
"numpy.array",
"numpy.sum",
"pyriemann.classification.TSclassifier",
"numpy.empty",
"numpy.random.RandomState",
"pyriemann.classification.M... | [((325, 352), 'numpy.random.RandomState', 'np.random.RandomState', (['(1234)'], {}), '(1234)\n', (346, 352), True, 'import numpy as np\n'), ((489, 511), 'numpy.empty', 'np.empty', (['(Nt, Ne, Ne)'], {}), '((Nt, Ne, Ne))\n', (497, 511), True, 'import numpy as np\n'), ((672, 693), 'pyriemann.classification.MDM', 'MDM', (... |
# -*- coding: utf-8 -*-
'''
Created on 2015年8月25日
@author: 10256603
'''
from distutils.core import setup
import encodings
import py2exe
setup(windows=[ {
"script":"batch_print.py",
}]) | [
"distutils.core.setup"
] | [((138, 183), 'distutils.core.setup', 'setup', ([], {'windows': "[{'script': 'batch_print.py'}]"}), "(windows=[{'script': 'batch_print.py'}])\n", (143, 183), False, 'from distutils.core import setup\n')] |
import cv2
import sys, os, glob, re
import json
from os.path import join, dirname, abspath, realpath, isdir
from os import makedirs
import numpy as np
from shutil import rmtree
from ipdb import set_trace
from .bench_utils.bbox_helper import rect_2_cxy_wh, cxy_wh_2_rect
def center_error(rects1, rects2):
"""Center e... | [
"numpy.clip",
"numpy.prod",
"cv2.rectangle",
"numpy.less_equal",
"cv2.imshow",
"numpy.array",
"cv2.destroyAllWindows",
"numpy.arange",
"os.walk",
"numpy.mean",
"numpy.greater",
"cv2.moveWindow",
"numpy.asarray",
"numpy.stack",
"numpy.linspace",
"os.path.isdir",
"numpy.maximum",
"cv... | [((1192, 1234), 'numpy.maximum', 'np.maximum', (['rects1[..., 0]', 'rects2[..., 0]'], {}), '(rects1[..., 0], rects2[..., 0])\n', (1202, 1234), True, 'import numpy as np\n'), ((1244, 1286), 'numpy.maximum', 'np.maximum', (['rects1[..., 1]', 'rects2[..., 1]'], {}), '(rects1[..., 1], rects2[..., 1])\n', (1254, 1286), True... |
import os
import re
import sys, time
import numpy as np
final=''#global vars to save results of op
fresult=''#global vars to save results of for
fcall=''#global vars to save results of call
def check(newcontext):
nc=newcontext
#TODO:cannot deal with multiple problems,need help
lk=nc.count('(')
rk=nc.count(')')
l... | [
"sys.stdout.flush",
"re.compile",
"re.match",
"numpy.exp",
"re.sub",
"re.findall",
"os.system",
"sys.stdout.write"
] | [((728, 755), 're.sub', 're.sub', (['"""return """', '""""""', 'line'], {}), "('return ', '', line)\n", (734, 755), False, 'import re\n'), ((760, 790), 're.sub', 're.sub', (['"""\\\\[\'.*\'\\\\]"""', '""""""', 'line'], {}), '("\\\\[\'.*\'\\\\]", \'\', line)\n', (766, 790), False, 'import re\n'), ((795, 825), 're.sub', ... |
from collections import defaultdict
class Graph:
def __init__(self,no_of_vertices,list_of_v):
self.no_of_vertices = no_of_vertices
self.graph = defaultdict(list)
for v in list_of_v:
self.graph[v] = []
def addEdge(self, u, v):
self.graph[u].append(v)
def isSink(self):
keys = list(self... | [
"collections.defaultdict"
] | [((156, 173), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (167, 173), False, 'from collections import defaultdict\n')] |
from pyspark.sql.types import (
StructType,
StructField,
IntegerType,
DoubleType,
StringType,
DateType
)
schema_part = StructType([
StructField("P_PARTKEY", IntegerType(), nullable=False),
StructField("P_NAME", StringType(), True),
StructField("P_MFGR", StringType(), True),
Stru... | [
"pyspark.sql.types.IntegerType",
"pyspark.sql.types.DoubleType",
"pyspark.sql.types.StringType",
"pyspark.sql.types.DateType"
] | [((186, 199), 'pyspark.sql.types.IntegerType', 'IntegerType', ([], {}), '()\n', (197, 199), False, 'from pyspark.sql.types import StructType, StructField, IntegerType, DoubleType, StringType, DateType\n'), ((244, 256), 'pyspark.sql.types.StringType', 'StringType', ([], {}), '()\n', (254, 256), False, 'from pyspark.sql.... |
# -*- coding: utf-8 -*-
import pytest
from h.presenters.user_json import TrustedUserJSONPresenter, UserJSONPresenter
class TestUserJSONPresenter:
def test_asdict(self, user):
presenter = UserJSONPresenter(user)
assert presenter.asdict() == {
"authority": user.authority,
... | [
"h.presenters.user_json.UserJSONPresenter",
"h.presenters.user_json.TrustedUserJSONPresenter"
] | [((203, 226), 'h.presenters.user_json.UserJSONPresenter', 'UserJSONPresenter', (['user'], {}), '(user)\n', (220, 226), False, 'from h.presenters.user_json import TrustedUserJSONPresenter, UserJSONPresenter\n'), ((530, 560), 'h.presenters.user_json.TrustedUserJSONPresenter', 'TrustedUserJSONPresenter', (['user'], {}), '... |
from unittest import TestCase
from pii.vendors.pii_dsl import PiiDsl
from service.device_service import DeviceService
class TestTSdbUtil(TestCase):
def c(self, a, b, ctx: dict = None):
self.assertEqual(a, PiiDsl(b).out(ctx), b)
def test_1_base(self):
self.c(66, "33 * 2")
self.c(4.0, ... | [
"service.device_service.DeviceService.getOneSpec",
"pii.vendors.pii_dsl.PiiDsl"
] | [((1181, 1210), 'service.device_service.DeviceService.getOneSpec', 'DeviceService.getOneSpec', (['(126)'], {}), '(126)\n', (1205, 1210), False, 'from service.device_service import DeviceService\n'), ((1418, 1447), 'service.device_service.DeviceService.getOneSpec', 'DeviceService.getOneSpec', (['(126)'], {}), '(126)\n',... |
import os
from statistics import mean
import multiprocessing as mp
import numpy as np
import datetime
from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels
my_frame = np.expand_dims(np.full((300,300,3), 1, np.uint8), axis=0)
labels = load_labels('/labelmap.txt')
######
# Minima... | [
"statistics.mean",
"frigate.edgetpu.EdgeTPUProcess",
"multiprocessing.Process",
"datetime.datetime.now",
"numpy.full",
"frigate.edgetpu.load_labels"
] | [((275, 303), 'frigate.edgetpu.load_labels', 'load_labels', (['"""/labelmap.txt"""'], {}), "('/labelmap.txt')\n", (286, 303), False, 'from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels\n'), ((1848, 1864), 'frigate.edgetpu.EdgeTPUProcess', 'EdgeTPUProcess', ([], {}), '()\n', (1... |
from rest_framework import serializers
from authx.models import User
from rest_framework_jwt.utils import jwt_payload_handler as drf_jwt_payload_handler
class UserSerializer(serializers.ModelSerializer):
password = serializers.CharField(
style={'input_type': 'password'},
wr... | [
"rest_framework_jwt.utils.jwt_payload_handler",
"rest_framework.serializers.CharField"
] | [((221, 293), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'style': "{'input_type': 'password'}", 'write_only': '(True)'}), "(style={'input_type': 'password'}, write_only=True)\n", (242, 293), False, 'from rest_framework import serializers\n'), ((934, 963), 'rest_framework_jwt.utils.jwt_payloa... |
import requests
import sys
import json
url = "https://www.fast2sms.com/dev/bulk"
payload = "sender_id=FSTSMS&message=Dear "+sys.argv[3]+",Welcome+to+CC+Basket+IIT+Jodhpur\nYour+OTP+is+"+sys.argv[2]+"&language=english&route=p&numbers="+sys.argv[1]
headers = {
'authorization': "<KEY>",
'Content-Type': "application/... | [
"requests.request"
] | [((399, 459), 'requests.request', 'requests.request', (['"""POST"""', 'url'], {'data': 'payload', 'headers': 'headers'}), "('POST', url, data=payload, headers=headers)\n", (415, 459), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
from django.forms import ModelForm
from django.core.exceptions import ValidationError
from django import forms
from apps.titulos.models import CohorteEstablecimiento
class CohorteEstablecimientoConfirmarForm(forms.ModelForm):
inscriptos = forms.IntegerField(required=True, min_value=1)
class... | [
"django.forms.IntegerField"
] | [((266, 312), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'required': '(True)', 'min_value': '(1)'}), '(required=True, min_value=1)\n', (284, 312), False, 'from django import forms\n')] |
"""Animated cocktail shaker sort
Copyright (C) <NAME> | MIT License | https://luke-zhang-04.github.io/
"""
from time import sleep
from typing import List
from tkinter import Tk
from animated import Animator
class CocktailShakerSort(Animator):
def sort(self, array: List[int]) -> None:
"""Main cocktail sha... | [
"utils.randomSequence",
"sys.path.insert",
"os.path.join",
"time.sleep",
"os.path.realpath",
"tkinter.Tk"
] | [((2150, 2172), 'utils.randomSequence', 'randomSequence', (['(0)', '(100)'], {}), '(0, 100)\n', (2164, 2172), False, 'from utils import randomSequence\n'), ((2185, 2189), 'tkinter.Tk', 'Tk', ([], {}), '()\n', (2187, 2189), False, 'from tkinter import Tk\n'), ((2052, 2087), 'sys.path.insert', 'sys.path.insert', (['(0)',... |
# -------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ----------------------------------------------------------------------... | [
"psbutils.misc.find_subrepo_directory",
"staticchar.config.load"
] | [((430, 454), 'psbutils.misc.find_subrepo_directory', 'find_subrepo_directory', ([], {}), '()\n', (452, 454), False, 'from psbutils.misc import find_subrepo_directory\n'), ((683, 746), 'staticchar.config.load', 'ch.config.load', (['spec_filename', 'ch.config.CharacterizationConfig'], {}), '(spec_filename, ch.config.Cha... |
import analogio
from digitalio import DigitalInOut, Direction
import time
class Battery():
def __init__(self, pin):
self._adc = analogio.AnalogIn(pin)
def voltage(self):
return self._adc.value * 3.3 / 65536.0 * 2.0
class PowerSwitch():
def __init__(self, pin):
self._done = Digita... | [
"digitalio.DigitalInOut",
"analogio.AnalogIn",
"time.sleep"
] | [((142, 164), 'analogio.AnalogIn', 'analogio.AnalogIn', (['pin'], {}), '(pin)\n', (159, 164), False, 'import analogio\n'), ((314, 331), 'digitalio.DigitalInOut', 'DigitalInOut', (['pin'], {}), '(pin)\n', (326, 331), False, 'from digitalio import DigitalInOut, Direction\n'), ((525, 540), 'time.sleep', 'time.sleep', (['(... |
import queue
import time
import threading
import bornPig
class MyThreadPool:
def __init__(self, maxsize=5):
self.maxsize = maxsize
self._pool = queue.Queue(maxsize) # 使用queue队列,创建一个线程池
for _ in range(maxsize):
self._pool.put(threading.Thread)
def get_thread(self):
... | [
"bornPig.smsSAR",
"threading.active_count",
"queue.Queue"
] | [((463, 482), 'bornPig.smsSAR', 'bornPig.smsSAR', (['arg'], {}), '(arg)\n', (477, 482), False, 'import bornPig\n'), ((166, 186), 'queue.Queue', 'queue.Queue', (['maxsize'], {}), '(maxsize)\n', (177, 186), False, 'import queue\n'), ((920, 944), 'threading.active_count', 'threading.active_count', ([], {}), '()\n', (942, ... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 TH<NAME>, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in complianc... | [
"backend.utils.cache.region.cache_on_arguments",
"backend.utils.decorators.parse_response_data",
"backend.components.utils.http_post"
] | [((979, 1015), 'backend.utils.decorators.parse_response_data', 'parse_response_data', ([], {'default_data': '{}'}), '(default_data={})\n', (998, 1015), False, 'from backend.utils.decorators import parse_response_data\n'), ((1173, 1225), 'backend.utils.cache.region.cache_on_arguments', 'cache.region.cache_on_arguments',... |
from rest_framework.routers import SimpleRouter
from django.conf.urls import url, include
from . import views
router = SimpleRouter()
router.register(r'video', views.VideoViewSet, base_name='videos')
router.register(r'activity', views.ActivityViewSet, base_name='activities')
router.register(r'option', views.OptionView... | [
"rest_framework.routers.SimpleRouter",
"django.conf.urls.include"
] | [((120, 134), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (132, 134), False, 'from rest_framework.routers import SimpleRouter\n'), ((464, 484), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (471, 484), False, 'from django.conf.urls import url, include\n')] |
# -*- coding: utf-8 -*-
from returns.io import IOFailure, IOResult, IOResultE, IOSuccess
from returns.pipeline import is_successful
def _function(arg: int) -> IOResultE[float]:
if arg == 0:
return IOFailure(ZeroDivisionError('Divided by 0'))
return IOSuccess(10 / arg)
def test_ioresulte():
"""E... | [
"returns.io.IOSuccess",
"returns.pipeline.is_successful"
] | [((268, 287), 'returns.io.IOSuccess', 'IOSuccess', (['(10 / arg)'], {}), '(10 / arg)\n', (277, 287), False, 'from returns.io import IOFailure, IOResult, IOResultE, IOSuccess\n'), ((446, 461), 'returns.io.IOSuccess', 'IOSuccess', (['(10.0)'], {}), '(10.0)\n', (455, 461), False, 'from returns.io import IOFailure, IOResul... |
# coding: UTF-8
import math
import matplotlib.pyplot as plt
# シグモイド関数
def sigmoid(a):
return 1.0 / (1.0 + math.exp(-a))
# ニューロン
class Neuron:
input_sum = 0.0
output = 0.0
def setInput(self, inp):
self.input_sum += inp
def getOutput(self):
self.output = sigmoid(self.input_sum)
... | [
"matplotlib.pyplot.legend",
"math.exp",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.show"
] | [((2510, 2599), 'matplotlib.pyplot.scatter', 'plt.scatter', (['position_tokyo[0]', 'position_tokyo[1]'], {'c': '"""red"""', 'label': '"""Tokyo"""', 'marker': '"""+"""'}), "(position_tokyo[0], position_tokyo[1], c='red', label='Tokyo',\n marker='+')\n", (2521, 2599), True, 'import matplotlib.pyplot as plt\n'), ((2599... |
import numpy as np
import scipy
import scipy.stats as stats
import torch
from sklearn.metrics import roc_auc_score
from netquery.decoders import BilinearMetapathDecoder, TransEMetapathDecoder, BilinearDiagMetapathDecoder, BilinearBlockDiagMetapathDecoder, BilinearBlockDiagPos2FeatMatMetapathDecoder, SetIntersection, Si... | [
"logging.getLogger",
"logging.StreamHandler",
"math.floor",
"netquery.decoders.BilinearDiagMetapathDecoder",
"torch.LongTensor",
"torch.cuda.device_count",
"netquery.decoders.BilinearBlockDiagMetapathDecoder",
"torch.cuda.is_available",
"numpy.mean",
"netquery.attention.IntersectDotProductAttentio... | [((4537, 4554), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (4548, 4554), False, 'import random\n'), ((7060, 7077), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (7071, 7077), False, 'import random\n'), ((26140, 26278), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO... |
import logging
import platform
import subprocess
import time
from elasticsearch import Elasticsearch
def launch_ES(hostname = "localhost", port = "9200"):
logging.info("Search for Elasticsearch ...")
es = Elasticsearch([f"http://{hostname}:{port}/"], verify_certs=True)
if not es.ping():
logging... | [
"elasticsearch.Elasticsearch",
"subprocess.run",
"time.sleep",
"platform.system",
"logging.info"
] | [((164, 208), 'logging.info', 'logging.info', (['"""Search for Elasticsearch ..."""'], {}), "('Search for Elasticsearch ...')\n", (176, 208), False, 'import logging\n'), ((218, 282), 'elasticsearch.Elasticsearch', 'Elasticsearch', (["[f'http://{hostname}:{port}/']"], {'verify_certs': '(True)'}), "([f'http://{hostname}:... |
from typing import TYPE_CHECKING
from django.contrib.postgres.search import SearchVector
from django.db.models import Q, Value, prefetch_related_objects
if TYPE_CHECKING:
from .models import Address, User
USER_SEARCH_FIELDS = ["email", "first_name", "last_name"]
ADDRESS_SEARCH_FIELDS = [
"first_name",
"... | [
"django.db.models.Value",
"django.db.models.prefetch_related_objects",
"django.db.models.Q"
] | [((1917, 1942), 'django.db.models.Value', 'Value', (['address.first_name'], {}), '(address.first_name)\n', (1922, 1942), False, 'from django.db.models import Q, Value, prefetch_related_objects\n'), ((1952, 1976), 'django.db.models.Value', 'Value', (['address.last_name'], {}), '(address.last_name)\n', (1957, 1976), Fals... |
import rospy
from pid import PID
from lowpass import LowPassFilter
from yaw_controller import YawController
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, cp):
self.cp = cp
self.yaw_controller = YawController(
wheel_base=cp.wheel_base,
s... | [
"yaw_controller.YawController",
"rospy.get_time",
"lowpass.LowPassFilter",
"pid.PID"
] | [((254, 422), 'yaw_controller.YawController', 'YawController', ([], {'wheel_base': 'cp.wheel_base', 'steer_ratio': 'cp.steer_ratio', 'min_speed': 'cp.min_speed', 'max_lat_accel': 'cp.max_lat_accel', 'max_steer_angle': 'cp.max_steer_angle'}), '(wheel_base=cp.wheel_base, steer_ratio=cp.steer_ratio,\n min_speed=cp.min_... |
import requests
import shutil
import os
class Data():
def __init__(self, Requests, directory, log):
self.Requests = Requests
self.directory = directory
self.log = log
self.icons = {}
def set_icons(self, icons):
self.icons = icons
def set_data(self, agent, name, ran... | [
"os.path.exists",
"shutil.copyfileobj",
"os.makedirs",
"requests.get"
] | [((931, 961), 'os.path.exists', 'os.path.exists', (['self.directory'], {}), '(self.directory)\n', (945, 961), False, 'import os\n'), ((979, 1006), 'os.makedirs', 'os.makedirs', (['self.directory'], {}), '(self.directory)\n', (990, 1006), False, 'import os\n'), ((1383, 1413), 'requests.get', 'requests.get', (['url'], {'... |
import os
import pytest
from helpers.runner import generate_project, run_main
from helpers.cli import cmdout
TEST_MODULE = """import lemoncheesecake.api as lcc
@lcc.suite("My Suite")
@lcc.prop("suite_prop", "suite_prop_value")
@lcc.tags("suite_tag")
@lcc.link("http://bug.tra.cker/1234", "#1234")
class mysuite:
... | [
"helpers.cli.cmdout.assert_substrs_in_line",
"helpers.runner.run_main",
"os.getcwd",
"os.chdir",
"pytest.fixture",
"helpers.runner.generate_project"
] | [((506, 522), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (520, 522), False, 'import pytest\n'), ((548, 604), 'helpers.runner.generate_project', 'generate_project', (['tmpdir.strpath', '"""mysuite"""', 'TEST_MODULE'], {}), "(tmpdir.strpath, 'mysuite', TEST_MODULE)\n", (564, 604), False, 'from helpers.runner i... |
from _token import Token, get_chars_of, get as get_tgi, get_tokens_by_replies as get_ttr, get_eof_token, get_token_by_priority as get_ttp, max_prio
from _constant import DIGITS
from _error import IllegalCharError, InvalidSyntaxError, RTError
from _node import NumberNode, BinOpNode, UnaryOpNode
from _value_type import N... | [
"_token.get_tokens_by_replies",
"_node.UnaryOpNode",
"_value_type.Number",
"_node.NumberNode",
"_token.get_token_by_priority",
"_error.IllegalCharError",
"_token.get_chars_of",
"_token.get",
"_node.BinOpNode",
"_context.Context",
"_token.get_eof_token"
] | [((8089, 8109), '_context.Context', 'Context', (['"""<program>"""'], {}), "('<program>')\n", (8096, 8109), False, 'from _context import Context\n'), ((7265, 7281), '_token.get_tokens_by_replies', 'get_ttr', (['"""MINUS"""'], {}), "('MINUS')\n", (7272, 7281), True, 'from _token import Token, get_chars_of, get as get_tgi... |
# -*- coding: utf-8 -*-
"""
Created on 12 April, 2019
@author: Tarpelite
"""
import requests,re,collections
from bs4 import BeautifulSoup
import json
# choose your demand
Max_page = 2
key = 'sparse+autoencoder'
start = '2000'
final = '2018'
text_title = 'GStitle.txt'
text_keyword = 'GSkw.txt'
headers = {'User-Agen... | [
"bs4.BeautifulSoup",
"json.dump",
"requests.get"
] | [((789, 823), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (801, 823), False, 'import requests, re, collections\n'), ((840, 878), 'bs4.BeautifulSoup', 'BeautifulSoup', (['start_html.text', '"""lxml"""'], {}), "(start_html.text, 'lxml')\n", (853, 878), False, 'from bs4 i... |
import argparse
# This file is a template file for all of my Advent of Code 2020 puzzle solutions.
# The parse_args function here generally just parses for two things: input file and puzzle part.
# I believe every AOC puzzle comes in two parts and so sometimes requires two code paths.
# Sometimes it is easier to imp... | [
"argparse.ArgumentParser"
] | [((733, 758), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (756, 758), False, 'import argparse\n')] |
import sys
from phonemizer import phonemize
backend='espeak'
lang=sys.argv[1]
if lang=="en":
lang="en-us"
elif lang=="fr":
lang="fr-fr"
#for line in sys.stdin:
# print(phonemize(line, language=lang, backend=backend))
# try:
# print(phonemize(line, language=lang, backend=backend))
# except:
# ... | [
"phonemizer.phonemize",
"sys.stdin.readlines"
] | [((368, 389), 'sys.stdin.readlines', 'sys.stdin.readlines', ([], {}), '()\n', (387, 389), False, 'import sys\n'), ((495, 556), 'phonemizer.phonemize', 'phonemize', (['sentences'], {'language': 'lang', 'backend': 'backend', 'njobs': '(4)'}), '(sentences, language=lang, backend=backend, njobs=4)\n', (504, 556), False, 'f... |
import torch
import pytest
from greattunes import TuneSession
@pytest.mark.parametrize(
"max_iter, max_response, error_lim, model_type",
[
[10, 4.81856, 5e-2, "SingleTaskGP"],
[50, 6.02073, 1e-3, "SingleTaskGP"],
[50, 5.99716, 9e-3, "SimpleCustomMaternGP"],
]
)
def test_sample_prob... | [
"torch.sin",
"torch.exp",
"pytest.mark.parametrize",
"torch.cos",
"greattunes.TuneSession"
] | [((65, 270), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""max_iter, max_response, error_lim, model_type"""', "[[10, 4.81856, 0.05, 'SingleTaskGP'], [50, 6.02073, 0.001, 'SingleTaskGP'],\n [50, 5.99716, 0.009, 'SimpleCustomMaternGP']]"], {}), "('max_iter, max_response, error_lim, model_type', [[\n 1... |
import os
import sys
TRASH = [
'bottle',
'cup',
'fork',
'knife',
'spoon'
'banana',
'apple',
'sandwich',
'orange',
'broccoli',
'carrot',
'hot dog',
'pizza',
'donut',
'cake'
]
YOLO_PATH = os.path.join(sys.path[0], 'yc')
IMAGE_PATH = os.path.join(sys.path[0]... | [
"cv2.dnn.blobFromImage",
"keras.preprocessing.image.img_to_array",
"cv2.rectangle",
"keras.backend.image_data_format",
"os.path.join",
"numpy.argmax",
"model_def.load_model",
"cv2.putText",
"keras.preprocessing.image.ImageDataGenerator",
"numpy.array",
"PIL.ImageDraw.Draw",
"numpy.random.seed"... | [((251, 282), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""yc"""'], {}), "(sys.path[0], 'yc')\n", (263, 282), False, 'import os\n'), ((296, 334), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""input.jpg"""'], {}), "(sys.path[0], 'input.jpg')\n", (308, 334), False, 'import os\n'), ((905, 936), 'model_def.l... |
# -*- coding: utf-8 -*-
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# Copyright (C) 2014-2016 <NAME> <<EMAIL>>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public... | [
"csv.DictWriter",
"taiga.projects.tasks.apps.connect_tasks_signals",
"taiga.base.utils.text.split_in_lines",
"taiga.projects.tasks.apps.disconnect_tasks_signals",
"taiga.projects.votes.utils.attach_total_voters_to_queryset",
"django.db.connection.ops.compiler",
"taiga.projects.services.apply_order_updat... | [((2505, 2531), 'taiga.projects.tasks.apps.disconnect_tasks_signals', 'disconnect_tasks_signals', ([], {}), '()\n', (2529, 2531), False, 'from taiga.projects.tasks.apps import disconnect_tasks_signals\n'), ((3412, 3461), 'taiga.projects.services.apply_order_updates', 'apply_order_updates', (['task_orders', 'new_task_or... |
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: PROJ
# Purpose: Tool to check consistency of database regarding grids and against
# what is available in proj-datumgrid
# Author: <NAME> <even.rouault at spatialys.com>
#
#########... | [
"fnmatch.filter",
"os.walk",
"sqlite3.connect",
"argparse.ArgumentParser"
] | [((1672, 1762), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Check database and proj-datumgrid consistency."""'}), "(description=\n 'Check database and proj-datumgrid consistency.')\n", (1695, 1762), False, 'import argparse\n'), ((2774, 2797), 'sqlite3.connect', 'sqlite3.connect', (... |
"""
Component Web Controller
"""
# Standard Library
import os
# Third Party Library
from django.views import View
from django.http import Http404
from django.shortcuts import render
from django.utils.translation import gettext as _
# Local Library
from app.modules.core.context import Context
from app.modules.core.de... | [
"app.modules.core.context.Context",
"django.utils.translation.gettext",
"os.getenv",
"app.modules.core.component.Component",
"django.http.Http404"
] | [((535, 544), 'app.modules.core.context.Context', 'Context', ([], {}), '()\n', (542, 544), False, 'from app.modules.core.context import Context\n'), ((563, 580), 'app.modules.core.component.Component', 'ComponentModule', ([], {}), '()\n', (578, 580), True, 'from app.modules.core.component import Component as ComponentM... |
from PyQt5.QtCore import QRunnable, QObject, pyqtSignal, pyqtSlot
class BTaskSignals(QObject):
done = pyqtSignal()
fail = pyqtSignal()
class BTask(QRunnable):
def __init__(self, func, *args, **kwargs):
super(BTask, self).__init__()
self.func = func
self.args = args
self.k... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtCore.pyqtSlot"
] | [((108, 120), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (118, 120), False, 'from PyQt5.QtCore import QRunnable, QObject, pyqtSignal, pyqtSlot\n'), ((132, 144), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (142, 144), False, 'from PyQt5.QtCore import QRunnable, QObject, pyqtSignal, pyqtSlo... |
import base64
import hashlib
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.algorithms import AES
from cryptography.hazmat.primitives.ciphers.modes import ECB
__all__ = ['get_encryption_key', 'decrypt_fiel... | [
"base64.b64decode",
"cryptography.hazmat.primitives.ciphers.modes.ECB",
"cryptography.hazmat.primitives.ciphers.algorithms.AES",
"hashlib.sha1",
"cryptography.hazmat.backends.default_backend"
] | [((785, 799), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (797, 799), False, 'import hashlib\n'), ((1326, 1351), 'base64.b64decode', 'base64.b64decode', (['b64data'], {}), '(b64data)\n', (1342, 1351), False, 'import base64\n'), ((1375, 1394), 'cryptography.hazmat.primitives.ciphers.algorithms.AES', 'AES', (['encr... |
"""
Basic Unit testing for helper_functions.py
"""
import random
import pandas as pd
import numpy as np
import pytest
from lambdata import helper_functions
df = pd.DataFrame(
np.random.randint(0, 100, size=(100, 4)),
columns=list('ABCD'))
def test_null_count():
"""
testing null count is zero
"""... | [
"numpy.random.randint",
"lambdata.helper_functions.WrangledDataFrame"
] | [((182, 222), 'numpy.random.randint', 'np.random.randint', (['(0)', '(100)'], {'size': '(100, 4)'}), '(0, 100, size=(100, 4))\n', (199, 222), True, 'import numpy as np\n'), ((339, 377), 'lambdata.helper_functions.WrangledDataFrame', 'helper_functions.WrangledDataFrame', (['df'], {}), '(df)\n', (373, 377), False, 'from ... |
#!/usr/bin/env python3
import database
from notify import Notifier
from service import MontaguService
from settings import get_settings
from os.path import abspath, dirname
from os import chdir
from cli import add_test_user
import bb8_backup
def restore_db():
settings = get_settings()
service = MontaguService... | [
"database.setup",
"notify.Notifier",
"bb8_backup.restore",
"service.MontaguService",
"os.path.dirname",
"os.path.abspath",
"settings.get_settings"
] | [((277, 291), 'settings.get_settings', 'get_settings', ([], {}), '()\n', (289, 291), False, 'from settings import get_settings\n'), ((306, 330), 'service.MontaguService', 'MontaguService', (['settings'], {}), '(settings)\n', (320, 330), False, 'from service import MontaguService\n'), ((346, 382), 'notify.Notifier', 'No... |
#!/usr/bin/env python
import numpy as np
from pars import Inp_Pars
class Forward_Rates(object):
"""
Description:
------------
For a given fitted financial model, compute a realization of future
IRs (or transformed IRs).
Parameters:
-----------
X_0 : ~float
The current IR (or t... | [
"numpy.exp",
"numpy.cumprod"
] | [((1199, 1274), 'numpy.exp', 'np.exp', (['((mu - sigma ** 2.0 / 2.0) * Inp_Pars.dt + sigma * self.random_array)'], {}), '((mu - sigma ** 2.0 / 2.0) * Inp_Pars.dt + sigma * self.random_array)\n', (1205, 1274), True, 'import numpy as np\n'), ((1349, 1365), 'numpy.cumprod', 'np.cumprod', (['step'], {}), '(step)\n', (1359,... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | [
"logging.getLogger",
"collections.defaultdict",
"weakref.ref",
"functools.wraps"
] | [((669, 696), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (686, 696), False, 'import logging\n'), ((14914, 14922), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (14919, 14922), False, 'from functools import wraps\n'), ((3461, 3482), 'weakref.ref', 'weakref.ref', (['document'], {}),... |
import gammu
from phonebook import phonebook
#configure gammu
state_machine = gammu.StateMachine()
state_machine.ReadConfig()
state_machine.Init()
#send message to all numbers in phonebook when the power goes out
def power_out():
out_message = {
'Text': 'URGENT: Power outage in SPL has been recorded.',
... | [
"gammu.StateMachine",
"phonebook.phonebook.items"
] | [((81, 101), 'gammu.StateMachine', 'gammu.StateMachine', ([], {}), '()\n', (99, 101), False, 'import gammu\n'), ((392, 409), 'phonebook.phonebook.items', 'phonebook.items', ([], {}), '()\n', (407, 409), False, 'from phonebook import phonebook\n'), ((761, 778), 'phonebook.phonebook.items', 'phonebook.items', ([], {}), '... |
import json
from typing import Any, List
from unittest import TestCase
from unittest.mock import patch
from zoloto.cameras.marker import MarkerCamera
from zoloto.exceptions import MissingCalibrationsError
from zoloto.marker import BaseMarker, EagerMarker, UncalibratedMarker
from zoloto.marker_type import MAX_ALL_ALLOW... | [
"unittest.mock.patch",
"zoloto.cameras.marker.MarkerCamera"
] | [((5889, 5933), 'unittest.mock.patch', 'patch', (['"""cv2.aruco.estimatePoseSingleMarkers"""'], {}), "('cv2.aruco.estimatePoseSingleMarkers')\n", (5894, 5933), False, 'from unittest.mock import patch\n'), ((561, 658), 'zoloto.cameras.marker.MarkerCamera', 'MarkerCamera', (['self.MARKER_ID'], {'marker_size': 'self.MARKE... |
import copy
import pickle
import random
import os
import torch
import torch.nn.functional as F
import torch.distributed as dist
import numpy as np
from torch.autograd import Variable
from gym.spaces import Discrete, Box
import ped_env
import rl
from rl.utils.miscellaneous import str_key
def set_dict(target_dict, v... | [
"torch.from_numpy",
"numpy.array",
"torch.nn.functional.softmax",
"numpy.mean",
"torch.eye",
"numpy.stack",
"numpy.vstack",
"numpy.random.seed",
"numpy.concatenate",
"torch.distributed.get_world_size",
"random.choice",
"pickle.load",
"torch.distributed.all_reduce",
"torch.cuda.manual_seed_... | [((788, 804), 'random.choice', 'random.choice', (['A'], {}), '(A)\n', (801, 804), False, 'import random\n'), ((3819, 3852), 'torch.nn.functional.softmax', 'F.softmax', (['(y / temperature)'], {'dim': '(1)'}), '(y / temperature, dim=1)\n', (3828, 3852), True, 'import torch.nn.functional as F\n'), ((5075, 5114), 'numpy.v... |
import shutil
import os
from pathlib import Path
from tkinter import *
arrayFolder = ["130-170","202-232","265-295","397-427","460-490","592-622","659-689",
"774-838","950-980","1013-1043","1157-1187","1220-1250","1364-1394",
"1434-1464","1516-1576","1606-1646","1688-1718","1751-1781","18... | [
"pathlib.Path"
] | [((816, 830), 'pathlib.Path', 'Path', (['pathLoad'], {}), '(pathLoad)\n', (820, 830), False, 'from pathlib import Path\n')] |
'''
Created on Jan 8, 2016
@author: <NAME>
'''
import caffe
from fast_rcnn.config import cfg
from roi_data_layer.minibatch import get_minibatch
import numpy as np
import yaml
from multiprocessing import Process, Queue
class PoseLossLayer(caffe.Layer):
"""
Pose loss layer that computes the biternion loss... | [
"numpy.where",
"numpy.sum",
"numpy.dot",
"numpy.zeros",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"numpy.zeros_like"
] | [((1360, 1393), 'numpy.zeros', 'np.zeros', (['bottom[0].data.shape[0]'], {}), '(bottom[0].data.shape[0])\n', (1368, 1393), True, 'import numpy as np\n'), ((1453, 1486), 'numpy.zeros', 'np.zeros', (['bottom[0].data.shape[0]'], {}), '(bottom[0].data.shape[0])\n', (1461, 1486), True, 'import numpy as np\n'), ((1543, 1581)... |
#!/usr/bin/env python3
'''verify classes defined in xml have correct ordering where needed
Looks for comment lines in the classes.xml file that match the string:
*NEXT n CLASSES MUST MATCH*
where n is the number of upcoming class definitions that must result in the
same glyph alignment when glyph names are sorted by... | [
"silfont.core.execute",
"re.compile"
] | [((2101, 2156), 're.compile', 're.compile', (['"""\\\\*NEXT ([1-9]\\\\d*) CLASSES MUST MATCH\\\\*"""'], {}), "('\\\\*NEXT ([1-9]\\\\d*) CLASSES MUST MATCH\\\\*')\n", (2111, 2156), False, 'import re\n'), ((5749, 5777), 'silfont.core.execute', 'execute', (['None', 'doit', 'argspec'], {}), '(None, doit, argspec)\n', (5756... |
# -*- coding: utf-8 -*-
import numpy as np
import cv2, os, lda
if __name__ == "__main__":
# set parameter for experiment
nTopics = 8
# create folder for saving result
if not os.path.exists("result"):
os.mkdir("result")
# create folder for showing fitting process
if not os.path.exists("visualization"):
os... | [
"os.path.exists",
"numpy.zeros",
"os.mkdir",
"lda.LDA",
"cv2.imread"
] | [((401, 437), 'numpy.zeros', 'np.zeros', (['(1000, 16)'], {'dtype': 'np.uint8'}), '((1000, 16), dtype=np.uint8)\n', (409, 437), True, 'import numpy as np\n'), ((651, 660), 'lda.LDA', 'lda.LDA', ([], {}), '()\n', (658, 660), False, 'import cv2, os, lda\n'), ((182, 206), 'os.path.exists', 'os.path.exists', (['"""result""... |
from tft import window, game
TestWindowName = "TFTAnalyzer Test Window"
def initialize_screenshot(file_name, window_name=TestWindowName):
gameWindow = window.StaticImageWindow(window_name, file_name)
gameWindow.showWindow()
gameBoard = game.initialize_game_board(gameWindow)
return gameWindow, gameBoa... | [
"tft.window.PreRecordedGameplayWindow",
"tft.game.initialize_game_board",
"tft.window.StaticImageWindow"
] | [((158, 206), 'tft.window.StaticImageWindow', 'window.StaticImageWindow', (['window_name', 'file_name'], {}), '(window_name, file_name)\n', (182, 206), False, 'from tft import window, game\n'), ((251, 289), 'tft.game.initialize_game_board', 'game.initialize_game_board', (['gameWindow'], {}), '(gameWindow)\n', (277, 289... |
# -*- coding: utf-8 -*-
""" This is the script to generate a Circle dataset. Credits to
https://github.com/hyounesy/TFPlaygroundPSA/blob/master/src/dataset.py.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import random
import os
im... | [
"os.path.exists",
"random.uniform",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.use",
"numpy.zeros",
"os.mkdir",
"matplotlib.pyplot.scatter",
"numpy.cos",
"numpy.sin",
"numpy.load",
"numpy.save"
] | [((336, 357), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (350, 357), False, 'import matplotlib\n'), ((937, 963), 'numpy.zeros', 'np.zeros', (['[num_samples, 2]'], {}), '([num_samples, 2])\n', (945, 963), True, 'import numpy as np\n'), ((1992, 2016), 'os.path.exists', 'os.path.exists', (['""".... |
import os
import sys
import PIL
import math
import time
import json
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import torch
import torchvision
from pathlib import Path
from PIL import Image, ImageOps, ImageFilter
from torch import nn, optim
from torchvision import transforms,... | [
"torch.nn.CrossEntropyLoss",
"pandas.read_csv",
"torch.cuda.is_available",
"os.listdir",
"pathlib.Path",
"json.dumps",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomResizedCrop",
"torchvision.models.resnet50",
"torch.utils.data.sampler.SubsetRandomSampler",
"numpy.floor",
"t... | [((653, 677), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (675, 677), False, 'import torch\n'), ((678, 699), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (695, 699), False, 'import torch\n'), ((1630, 1655), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), ... |
'''
Random Breakout AI player
@author: <NAME> <<EMAIL>>
'''
import gym
import numpy
import random
import pandas
if __name__ == '__main__':
env = gym.make('Breakout-v0')
env.monitor.start('/tmp/breakout-experiment-1', force=True)
# video_callable=lambda count: count % 10 == 0)
goal_average_ste... | [
"numpy.ndarray",
"gym.make"
] | [((155, 178), 'gym.make', 'gym.make', (['"""Breakout-v0"""'], {}), "('Breakout-v0')\n", (163, 178), False, 'import gym\n'), ((381, 397), 'numpy.ndarray', 'numpy.ndarray', (['(0)'], {}), '(0)\n', (394, 397), False, 'import numpy\n'), ((514, 530), 'numpy.ndarray', 'numpy.ndarray', (['(0)'], {}), '(0)\n', (527, 530), Fals... |
import pytest
from ipyplotly.basevalidators import StringValidator
import numpy as np
# Fixtures
# --------
@pytest.fixture()
def validator():
return StringValidator('prop', 'parent')
@pytest.fixture()
def validator_values():
return StringValidator('prop', 'parent', values=['foo', 'BAR', ''])
@pytest.fixt... | [
"ipyplotly.basevalidators.StringValidator",
"pytest.mark.parametrize",
"numpy.array",
"pytest.raises",
"pytest.fixture"
] | [((111, 127), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (125, 127), False, 'import pytest\n'), ((193, 209), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (207, 209), False, 'import pytest\n'), ((309, 325), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (323, 325), False, 'import pytest\n'), (... |
import io
import re
from setuptools import setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read()
with io.open('battenberg/__init__.py', 'rt', encoding='utf8') as f:
version = re.search(r'__version__ = \'(.*?)\'', f... | [
"setuptools.setup",
"io.open"
] | [((563, 1863), 'setuptools.setup', 'setup', ([], {'name': '"""battenberg"""', 'version': 'version', 'description': '"""Providing updates to cookiecutter projects."""', 'long_description': "(readme + '\\n\\n' + history)", 'long_description_content_type': '"""text/markdown"""', 'author': '"""Zillow"""', 'url': '"""https:... |
# -*- coding: utf-8 -*-
# ex: set sts=4 ts=4 sw=4 noet:
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See COPYING file distributed along with the datalad package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##... | [
"datalad.tests.utils.assert_result_count",
"datalad.support.annexrepo.AnnexRepo",
"datalad.utils.Path",
"datalad.tests.utils.with_tempfile",
"datalad.utils.path_startswith",
"datalad.tests.utils.assert_not_in_results",
"datalad.core.distributed.clone.Clone.__call__",
"datalad.tests.utils.assert_not_in... | [((1485, 1510), 'datalad.tests.utils.with_tempfile', 'with_tempfile', ([], {'mkdir': '(True)'}), '(mkdir=True)\n', (1498, 1510), False, 'from datalad.tests.utils import assert_false, assert_in, assert_in_results, assert_not_in, assert_not_in_results, assert_raises, assert_repo_status, assert_result_count, assert_status... |
import os
import sys
from pathlib import Path
conf_dir = Path(os.path.realpath(__file__)).parent
root = conf_dir.parent.parent / 'src'
sys.path.insert(0, str(root))
project = 'mold'
author = '<NAME>'
copyright = '2021, <NAME>'
release = Path(root, 'mold', 'VERSION').read_text().strip()
extensions = [
'sphinx.ext... | [
"os.path.realpath",
"mold.doc.render_docs",
"textwrap.indent",
"pathlib.Path"
] | [((1530, 1897), 'mold.doc.render_docs', 'render_docs', (['"""Builtin Mold plugins."""'], {'domain_locations': "[('mold.plugins.domains.' + domain) for domain in domains]", 'tool_locations': "[f'mold.plugins.tools.{tool}.tool' for tool in tools]", 'category_locations': "[('mold.plugins.categories.' + cat) for cat in cat... |
# -*- coding: utf-8 -*-
# Tahoe-LAFS -- secure, distributed storage grid
#
# Copyright © 2020 The Tahoe-LAFS Software Foundation
#
# Copyright 2019 PrivateStorage.io, LLC
"""
Support code for applying token-based HTTP authorization rules to a
Twisted Web resource hierarchy.
"""
# https://github.com/twisted/nevow/issu... | [
"cryptography.hazmat.primitives.constant_time.bytes_eq",
"zope.interface.implementer",
"attr.ib",
"twisted.cred.error.UnauthorizedLogin",
"twisted.internet.defer.succeed"
] | [((1280, 1299), 'zope.interface.implementer', 'implementer', (['IToken'], {}), '(IToken)\n', (1291, 1299), False, 'from zope.interface import implementer\n'), ((1835, 1866), 'zope.interface.implementer', 'implementer', (['ICredentialFactory'], {}), '(ICredentialFactory)\n', (1846, 1866), False, 'from zope.interface imp... |
import os
from ocr import OCR
class receiptParser:
ocr = OCR()
raw_tickets = None
def __init__(self, image_folder_path):
self.image_files = [f for f in os.listdir(image_folder_path) if bool(os.path.isfile(os.path.join(image_folder_path, f)) and '.jpg' in f)]
print(self.image_files)
def scrape_tickets(sel... | [
"os.path.join",
"os.listdir",
"ocr.OCR"
] | [((62, 67), 'ocr.OCR', 'OCR', ([], {}), '()\n', (65, 67), False, 'from ocr import OCR\n'), ((162, 191), 'os.listdir', 'os.listdir', (['image_folder_path'], {}), '(image_folder_path)\n', (172, 191), False, 'import os\n'), ((215, 249), 'os.path.join', 'os.path.join', (['image_folder_path', 'f'], {}), '(image_folder_path,... |
# Copyright 2015 The Shaderc Authors. 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 required by applicable... | [
"placeholder.FileShader",
"environment.File",
"glslc_test_framework.inside_glslc_testsuite"
] | [((4768, 4805), 'glslc_test_framework.inside_glslc_testsuite', 'inside_glslc_testsuite', (['"""OptionsCapM"""'], {}), "('OptionsCapM')\n", (4790, 4805), False, 'from glslc_test_framework import inside_glslc_testsuite\n'), ((5284, 5321), 'glslc_test_framework.inside_glslc_testsuite', 'inside_glslc_testsuite', (['"""Opti... |
# Copyright (c) 2020
# [This program is licensed under the "MIT License"]
# Please see the file LICENSE in the source
# distribution of this software for license terms.
import pygame as pg
import sys
import ruamel.yaml
from os import path, environ
from src.sprites.player import Player
from src.sprites.sprites import *... | [
"src.sprites.grouping.Grouping",
"src.sprites.cursor.Cursor",
"src.forge.Forge",
"pygame.sprite.groupcollide",
"pygame.sprite.spritecollide",
"pygame.time.get_ticks",
"src.sprites.grave.Grave",
"src.sprites.player.Player",
"pygame.color.Color",
"src.sprites.item.Item",
"random.random",
"src.ca... | [((1208, 1218), 'src.sprites.grouping.Grouping', 'Grouping', ([], {}), '()\n', (1216, 1218), False, 'from src.sprites.grouping import Grouping\n'), ((3093, 3192), 'src.forge.Forge', 'Forge', (['self.settings', 'self.sprite_grouping', 'self.data', 'self.character', 'self.player', 'lvl_pieces'], {}), '(self.settings, sel... |
##############################################################################
#
# Copyright (c) 2004, 2005 Zope Corporation and Contributors.
# 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.
# T... | [
"zope.interface.implementer",
"AccessControl.class_init.InitializeClass",
"zope.i18nmessageid.MessageFactory"
] | [((959, 985), 'zope.i18nmessageid.MessageFactory', 'MessageFactory', (['"""formtest"""'], {}), "('formtest')\n", (973, 985), False, 'from zope.i18nmessageid import MessageFactory\n'), ((1467, 1488), 'zope.interface.implementer', 'implementer', (['IContent'], {}), '(IContent)\n', (1478, 1488), False, 'from zope.interfac... |
from django.db import models
from . import managers
# Create your models here.
class TimeStampedModel(models.Model):
""" TimeStampedModel Model Definition """
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
objects = managers.CustomModelManager()
c... | [
"django.db.models.DateTimeField"
] | [((180, 219), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (200, 219), False, 'from django.db import models\n'), ((234, 269), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (254, 269), F... |
import pandas as pd
from constants import HEADERS
data = pd.read_csv('data/data.csv',sep=';')
data.columns=HEADERS
data.to_csv('data/data_with_headers.csv',index=False)
| [
"pandas.read_csv"
] | [((57, 94), 'pandas.read_csv', 'pd.read_csv', (['"""data/data.csv"""'], {'sep': '""";"""'}), "('data/data.csv', sep=';')\n", (68, 94), True, 'import pandas as pd\n')] |