code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#Async code
#Async runs in the same thread
'''
Async uses CoRoutines which run on the same thread
"async" and "await"
'''
import logging
import multiprocessing
import threading
import time
import asyncio
import random
logging.basicConfig(format='%(asctime)s.%(msecs)03d - %(levelname)s - %(message)s', date... | [
"asyncio.gather",
"multiprocessing.current_process",
"asyncio.get_event_loop",
"logging.basicConfig",
"random.randint",
"logging.info",
"threading.current_thread"
] | [((232, 366), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s.%(msecs)03d - %(levelname)s - %(message)s"""', 'datefmt': '"""%H:%M:%S"""', 'level': 'logging.DEBUG'}), "(format=\n '%(asctime)s.%(msecs)03d - %(levelname)s - %(message)s', datefmt=\n '%H:%M:%S', level=logging.DEBUG)\n", (... |
# # simple script to batch convert collada to obj.
# # run as:
# # blender --background --python data_scripts/tpose_dae_to_obj.py
# # or:
# # ./run_data_preprocess.sh
import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import shutil
import bpy
import mathutils
import math
im... | [
"os.makedirs",
"mathutils.Matrix.Translation",
"os.path.isdir",
"os.path.dirname",
"bpy.ops.object.delete",
"os.path.isfile",
"bpy.ops.import_scene.fbx",
"bpy.ops.object.mode_set",
"bpy.ops.object.convert",
"bpy.ops.export_scene.obj",
"bpy.ops.transform.rotate",
"bpy.ops.wm.collada_import",
... | [((514, 551), 'mathutils.Matrix.Translation', 'mathutils.Matrix.Translation', (['(-center)'], {}), '(-center)\n', (542, 551), False, 'import mathutils\n'), ((3148, 3190), 'bpy.ops.object.select_all', 'bpy.ops.object.select_all', ([], {'action': '"""SELECT"""'}), "(action='SELECT')\n", (3173, 3190), False, 'import bpy\n... |
'''
Copyright 2022 Airbus SAS
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, software
dis... | [
"sos_trades_core.tools.post_processing.pareto_front_optimal_charts.instanciated_pareto_front_optimal_chart.InstantiatedParetoFrontOptimalChart",
"sos_trades_core.tools.post_processing.charts.chart_filter.ChartFilter",
"numpy.arange",
"sos_trades_core.tools.post_processing.charts.two_axes_instanciated_chart.Tw... | [((17569, 17697), 'sos_trades_core.tools.post_processing.charts.two_axes_instanciated_chart.TwoAxesInstanciatedChart', 'TwoAxesInstanciatedChart', (['x_axis_name', 'y_axis_name', '[min_x - 5, max_x + 5]', '[min_y - max_y * 0.05, max_y * 1.05]', 'chart_name'], {}), '(x_axis_name, y_axis_name, [min_x - 5, max_x + 5],\n ... |
# Copyright (c) Facebook, Inc. All Rights Reserved
# -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ upstream/hubert/expert.py ]
# Synopsis [ the HuBERT wrapper ]
# Author [ <NAME> ]
"""************************... | [
"fairseq.checkpoint_utils.load_model_ensemble_and_task",
"torch.nn.utils.rnn.pad_sequence",
"packaging.version.parse",
"torch.nn.functional.layer_norm"
] | [((1060, 1121), 'fairseq.checkpoint_utils.load_model_ensemble_and_task', 'fairseq.checkpoint_utils.load_model_ensemble_and_task', (['[ckpt]'], {}), '([ckpt])\n', (1113, 1121), False, 'import fairseq\n'), ((2407, 2443), 'torch.nn.utils.rnn.pad_sequence', 'pad_sequence', (['wavs'], {'batch_first': '(True)'}), '(wavs, bat... |
import pruebas, prueba_simple
print(pruebas.Clase1_1().Clase1_2().firstn(5))
| [
"pruebas.Clase1_1"
] | [((37, 55), 'pruebas.Clase1_1', 'pruebas.Clase1_1', ([], {}), '()\n', (53, 55), False, 'import pruebas, prueba_simple\n')] |
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import rc
from matplotlib.pyplot import MultipleLocator
rc('mathtext', default='regular')
plt.rcParams['axes.unicode_minus'] = False
plt.rcParams['font.family'] = ['Times New Roman'] #
Name = ["REIN", "HEM", "Simple", "TAMA", "Ada-R... | [
"matplotlib.rc",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tick_params",
"matplotlib.pyplot.gcf"
] | [((142, 175), 'matplotlib.rc', 'rc', (['"""mathtext"""'], {'default': '"""regular"""'}), "('mathtext', default='regular')\n", (144, 175), False, 'from matplotlib import rc\n'), ((924, 950), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(5, 4)'}), '(figsize=(5, 4))\n', (934, 950), True, 'import matplotlib.... |
"""
======================
CSA Histogram Approach
======================
Static Chemical Shift Powder Pattern using a Histogram Approach
The equation for the static powder pattern for a simple chemical shift anisotropy interation is given by the following equation
.. math::
H = \\delta_{iso} + \\frac {1}{2} ... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.yticks",
"numpy.zeros",
"numpy.sin",
"numpy.cos",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.xlabel",
"sys.exit"
] | [((1718, 1729), 'numpy.zeros', 'np.zeros', (['n'], {}), '(n)\n', (1726, 1729), True, 'import numpy as np\n'), ((3505, 3565), 'matplotlib.pyplot.hist', 'plt.hist', (['omega'], {'bins': '(200)', 'weights': 'solid_angle', 'density': '(True)'}), '(omega, bins=200, weights=solid_angle, density=True)\n', (3513, 3565), True, ... |
import logging
from ipaddress import ip_address
from django.conf import settings
from django.db import models
from django.utils.module_loading import import_string
from swapper import get_model_name, load_model
from openwisp_utils.base import UUIDModel
logger = logging.getLogger(__name__)
trigger_device_checks_path... | [
"django.utils.module_loading.import_string",
"swapper.get_model_name",
"django.db.models.Q",
"ipaddress.ip_address",
"swapper.load_model",
"logging.getLogger"
] | [((265, 292), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (282, 292), False, 'import logging\n'), ((460, 494), 'swapper.get_model_name', 'get_model_name', (['"""topology"""', '"""Node"""'], {}), "('topology', 'Node')\n", (474, 494), False, 'from swapper import get_model_name, load_mode... |
from diskord.ext import commands
import diskord
from utils.functions import *
class prefix_cmds(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command(name="bump", description="Command to bumps your server")
async def _bump(self, ctx):
#add_command_stats... | [
"diskord.ext.commands.command"
] | [((188, 261), 'diskord.ext.commands.command', 'commands.command', ([], {'name': '"""bump"""', 'description': '"""Command to bumps your server"""'}), "(name='bump', description='Command to bumps your server')\n", (204, 261), False, 'from diskord.ext import commands\n')] |
"""Rewrited Legacy Email backend.
Original Legacy Email backend docs at:
http://psa.matiasaguirre.net/docs/backends/email.html
"""
from social_core.backends.legacy import LegacyAuth
from social_core.exceptions import AuthMissingParameter
from psa.custom_django_storage import CustomCode
class EmailAuth(LegacyAuth):
... | [
"psa.custom_django_storage.CustomCode.objects.filter",
"social_core.exceptions.AuthMissingParameter"
] | [((1293, 1332), 'social_core.exceptions.AuthMissingParameter', 'AuthMissingParameter', (['self', 'self.ID_KEY'], {}), '(self, self.ID_KEY)\n', (1313, 1332), False, 'from social_core.exceptions import AuthMissingParameter\n'), ((890, 942), 'psa.custom_django_storage.CustomCode.objects.filter', 'CustomCode.objects.filter... |
import os
def read_ids(ids_file):
file = open(ids_file, 'r', encoding='utf8')
ids_list = list()
for line in file.readlines():
params = line.strip('\n').split('\t')
assert len(params) == 2
id = int(params[0])
ids_list.append(id)
return ids_list
def embedding2file(embed... | [
"os.path.exists",
"os.makedirs"
] | [((812, 832), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (826, 832), False, 'import os\n'), ((842, 859), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (853, 859), False, 'import os\n')] |
"""
A script to grid search all parameters provided in parameters.py
including both classifiers and regressors.
Note that the execution of this script may take hours to search the
best possible model parameters for various algorithms, feel free
to edit parameters.py on your need ( e.g remove some parameters for
... | [
"parameters.classification_grid_parameters.items",
"parameters.regression_grid_parameters.items",
"emotion_recognition.EmotionRecognizer"
] | [((701, 739), 'parameters.classification_grid_parameters.items', 'classification_grid_parameters.items', ([], {}), '()\n', (737, 739), False, 'from parameters import classification_grid_parameters, regression_grid_parameters\n'), ((1513, 1547), 'parameters.regression_grid_parameters.items', 'regression_grid_parameters.... |
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class LoadFactOperator(BaseOperator):
ui_color = '#F98866'
@apply_defaults
def __init__(self,
redshift_conn_id,
queries,
... | [
"airflow.hooks.postgres_hook.PostgresHook"
] | [((681, 707), 'airflow.hooks.postgres_hook.PostgresHook', 'PostgresHook', (['self.conn_id'], {}), '(self.conn_id)\n', (693, 707), False, 'from airflow.hooks.postgres_hook import PostgresHook\n')] |
import os
import pandas as pd
import torch
from torch.utils.data import Dataset
DATA_DIR = os.path.join("..", "data")
class Digits(Dataset):
def __init__(self, split: str):
self._load_data(split)
def __len__(self):
return len(self.labels)
def __getitem__(self, idx):
return sel... | [
"os.path.join",
"torch.from_numpy"
] | [((93, 119), 'os.path.join', 'os.path.join', (['""".."""', '"""data"""'], {}), "('..', 'data')\n", (105, 119), False, 'import os\n'), ((414, 452), 'os.path.join', 'os.path.join', (['DATA_DIR', 'f"""{split}.csv"""'], {}), "(DATA_DIR, f'{split}.csv')\n", (426, 452), False, 'import os\n'), ((510, 545), 'torch.from_numpy',... |
# -*- coding: utf-8 -*-
from django.conf import settings
from django.db import models
from threads.models import Thread
# Create your models here.
class Poll(models.Model):
question = models.TextField()
thread = models.OneToOneField(Thread, null=True)
def __unicode__(self):
return self.question
... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.OneToOneField"
] | [((191, 209), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (207, 209), False, 'from django.db import models\n'), ((223, 262), 'django.db.models.OneToOneField', 'models.OneToOneField', (['Thread'], {'null': '(True)'}), '(Thread, null=True)\n', (243, 262), False, 'from django.db import models\n'), ... |
import logging
from datetime import datetime, timedelta
import requests
from flask import current_app as app
from iso8601 import ParseError, parse_date
from structlog import wrap_logger
from frontstage.exceptions.exceptions import ApiError
logger = wrap_logger(logging.getLogger(__name__))
date_format = "%d %b %Y"
... | [
"frontstage.exceptions.exceptions.ApiError",
"iso8601.parse_date",
"datetime.datetime",
"datetime.timedelta",
"requests.get",
"datetime.datetime.now",
"logging.getLogger"
] | [((264, 291), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (281, 291), False, 'import logging\n'), ((597, 645), 'requests.get', 'requests.get', (['url'], {'auth': "app.config['BASIC_AUTH']"}), "(url, auth=app.config['BASIC_AUTH'])\n", (609, 645), False, 'import requests\n'), ((1507, 155... |
import pandas as pd
class LoadCSV():
'''Class for loading a CSV file into a Pandas Dataframe'''
def __init__(self, data_path, encoding=None):
'''
Initialization Method
:param data_path: local disk path where the data is located
:param encoding: CSV encoding
#Python stand... | [
"pandas.DataFrame",
"pandas.read_csv"
] | [((511, 525), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (523, 525), True, 'import pandas as pd\n'), ((991, 1039), 'pandas.read_csv', 'pd.read_csv', (['self.data_path'], {'encoding': 'l_encoding'}), '(self.data_path, encoding=l_encoding)\n', (1002, 1039), True, 'import pandas as pd\n'), ((3161, 3204), 'panda... |
"""
Exposes regular rest commands as services.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/hassio/
"""
import asyncio
import logging
import os
import aiohttp
from aiohttp import web
from aiohttp.web_exceptions import HTTPBadGateway
import async_timeo... | [
"voluptuous.Optional",
"aiohttp.web_exceptions.HTTPBadGateway",
"voluptuous.Required",
"os.path.dirname",
"aiohttp.web.json_response",
"async_timeout.timeout",
"logging.getLogger",
"homeassistant.helpers.aiohttp_client.async_get_clientsession"
] | [((644, 671), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (661, 671), False, 'import logging\n'), ((2289, 2318), 'homeassistant.helpers.aiohttp_client.async_get_clientsession', 'async_get_clientsession', (['hass'], {}), '(hass)\n', (2312, 2318), False, 'from homeassistant.helpers.aioht... |
# terraform-provider-vcloud-director
# Copyright (c) 2017 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: BSD-2-Clause
from setuptools import setup
setup(
setup_requires=['pbr>=1.9', 'setuptools>=17.1'],
pbr=True,
)
| [
"setuptools.setup"
] | [((163, 227), 'setuptools.setup', 'setup', ([], {'setup_requires': "['pbr>=1.9', 'setuptools>=17.1']", 'pbr': '(True)'}), "(setup_requires=['pbr>=1.9', 'setuptools>=17.1'], pbr=True)\n", (168, 227), False, 'from setuptools import setup\n')] |
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE
"""
Source and Resource for plain file handle physical I/O.
"""
from __future__ import absolute_import
import os
import os.path
import uproot4.source.chunk
import uproot4.source.futures
class FileResource(uproot4.source.chunk.Re... | [
"os.path.getsize"
] | [((1776, 1808), 'os.path.getsize', 'os.path.getsize', (['self._file_path'], {}), '(self._file_path)\n', (1791, 1808), False, 'import os\n')] |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, dict_output, _arg_split
@click.command('paste_content')
@click.argument("content", type=str)
@click.argument("history_id", type=str)
@pass_context
@custom_exception
@dict_output
def cli(ctx, content, history_... | [
"click.argument",
"click.command"
] | [((135, 165), 'click.command', 'click.command', (['"""paste_content"""'], {}), "('paste_content')\n", (148, 165), False, 'import click\n'), ((167, 202), 'click.argument', 'click.argument', (['"""content"""'], {'type': 'str'}), "('content', type=str)\n", (181, 202), False, 'import click\n'), ((204, 242), 'click.argument... |
from gtts import gTTS
import os
tts = gTTS(text='Hello sir, how can I help you?', lang='en')
tts.save("good.mp3")
os.system("mpg321 good.mp3") | [
"gtts.gTTS",
"os.system"
] | [((38, 92), 'gtts.gTTS', 'gTTS', ([], {'text': '"""Hello sir, how can I help you?"""', 'lang': '"""en"""'}), "(text='Hello sir, how can I help you?', lang='en')\n", (42, 92), False, 'from gtts import gTTS\n'), ((114, 142), 'os.system', 'os.system', (['"""mpg321 good.mp3"""'], {}), "('mpg321 good.mp3')\n", (123, 142), F... |
"""Using as Instance properties"""
import weakref
class IntegerValue:
def __init__(self):
self.values = weakref.WeakKeyDictionary()
def __set__(self, instance, value):
self.values[instance] = int(value)
def __get__(self, instance, owner):
if instance is None:
return s... | [
"weakref.ref",
"weakref.WeakKeyDictionary"
] | [((118, 145), 'weakref.WeakKeyDictionary', 'weakref.WeakKeyDictionary', ([], {}), '()\n', (143, 145), False, 'import weakref\n'), ((661, 688), 'weakref.WeakKeyDictionary', 'weakref.WeakKeyDictionary', ([], {}), '()\n', (686, 688), False, 'import weakref\n'), ((1302, 1344), 'weakref.ref', 'weakref.ref', (['instance', 's... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
"""
The MetadataWizard(pymdwizard) software was developed by the
U.S. Geological Survey Fort Collins Science Center.
See: https://github.com/usgs/fort-pymdwizard for current project source code
See: https://usgs.github.io/fort-pymdwizard/ for current user documentation
See: ... | [
"subprocess.Popen",
"pymdwizard.gui.ui_files.UI_jupyterstarter.Ui_Form",
"pymdwizard.core.utils.get_install_dname",
"PyQt5.QtWidgets.QFileDialog.getExistingDirectory",
"subprocess.check_output",
"os.environ.copy",
"os.path.exists",
"pymdwizard.core.utils.set_window_icon",
"conda.core.envs_manager.li... | [((9744, 9850), 'pymdwizard.core.utils.launch_widget', 'utils.launch_widget', (['JupyterStarter', '"""JupyterStarter"""'], {'previous_dnames': "['c:\\\\temp', 'c:\\\\temp\\\\junk']"}), "(JupyterStarter, 'JupyterStarter', previous_dnames=[\n 'c:\\\\temp', 'c:\\\\temp\\\\junk'])\n", (9763, 9850), False, 'from pymdwiza... |
#!/usr/bin/env python3
from setuptools import setup
from sys import version_info
if version_info < (3, 5, 2):
# 3.5.2 is when __aiter__ became a synchronous function
raise SystemExit('Sorry! asks requires python 3.5.2 or later.')
setup(
name='asks',
description='asks - async http',
long_descripti... | [
"setuptools.setup"
] | [((241, 862), 'setuptools.setup', 'setup', ([], {'name': '"""asks"""', 'description': '"""asks - async http"""', 'long_description': '"""asks is an async http lib for curio and trio"""', 'license': '"""MIT"""', 'version': '"""2.0.0"""', 'author': '"""<NAME> - aka theelous3"""', 'url': '"""https://github.com/theelous3/a... |
# Generated by Django 2.2.16 on 2020-09-12 22:38
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [migrations.swappable_dependency(settings.AUTH_USER_MODEL)]
operations = [
... | [
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((239, 296), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (270, 296), False, 'from django.db import migrations, models\n'), ((464, 557), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import asyncio
from kuknos_sdk import AiohttpClient, Server
HORIZON_URL = "https://horizon.kuknos.org"
async def payments():
async with Server(HORIZON_URL, AiohttpClient()) as server:
async for payment in server.payments().cursor(cursor="now").stream():
print(f"Payment: {payment}")
async d... | [
"kuknos_sdk.AiohttpClient"
] | [((164, 179), 'kuknos_sdk.AiohttpClient', 'AiohttpClient', ([], {}), '()\n', (177, 179), False, 'from kuknos_sdk import AiohttpClient, Server\n'), ((369, 384), 'kuknos_sdk.AiohttpClient', 'AiohttpClient', ([], {}), '()\n', (382, 384), False, 'from kuknos_sdk import AiohttpClient, Server\n'), ((573, 588), 'kuknos_sdk.Ai... |
# -*- coding: utf-8 -*-
# Copyright 2006 <NAME>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
"""
since 1.9: mutage... | [
"warnings.warn"
] | [((591, 683), 'warnings.warn', 'warnings.warn', (['"""mutagen.m4a is deprecated; use mutagen.mp4 instead."""', 'DeprecationWarning'], {}), "('mutagen.m4a is deprecated; use mutagen.mp4 instead.',\n DeprecationWarning)\n", (604, 683), False, 'import warnings\n')] |
import argparse
import sys
import asyncio
import sc2
from sc2 import Race
from sc2.player import Bot
from zerg.zerg_rush import ZergRushBot
def main():
portconfig = sc2.portconfig.Portconfig()
print(portconfig.as_json)
player_config = [
Bot(Race.Zerg, ZergRushBot()),
Bot(Race.Zerg, None... | [
"sc2.player.Bot",
"zerg.zerg_rush.ZergRushBot",
"sc2.portconfig.Portconfig",
"sc2.maps.get"
] | [((173, 200), 'sc2.portconfig.Portconfig', 'sc2.portconfig.Portconfig', ([], {}), '()\n', (198, 200), False, 'import sc2\n'), ((301, 321), 'sc2.player.Bot', 'Bot', (['Race.Zerg', 'None'], {}), '(Race.Zerg, None)\n', (304, 321), False, 'from sc2.player import Bot\n'), ((376, 407), 'sc2.maps.get', 'sc2.maps.get', (['"""A... |
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"opentelemetry.sdk.metrics._internal.sdk_configuration.SdkConfiguration",
"opentelemetry.sdk.util.instrumentation.InstrumentationScope",
"opentelemetry.sdk.metrics._internal.instrument.UpDownCounter",
"opentelemetry.sdk.metrics._internal.instrument.ObservableUpDownCounter",
"atexit.register",
"opentelemet... | [((2032, 2051), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (2041, 2051), False, 'from logging import getLogger\n'), ((11936, 11942), 'threading.Lock', 'Lock', ([], {}), '()\n', (11940, 11942), False, 'from threading import Lock\n'), ((2522, 2528), 'threading.Lock', 'Lock', ([], {}), '()\n', (... |
from __future__ import absolute_import, unicode_literals
import csv
import datetime
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils.encoding import smart_str
from django.utils.translation import... | [
"wagtail.utils.pagination.paginate",
"django.http.HttpResponse",
"csv.writer",
"django.shortcuts.redirect",
"django.utils.translation.ungettext",
"django.utils.encoding.smart_str",
"django.shortcuts.get_object_or_404",
"datetime.timedelta",
"wagtail.wagtailforms.models.get_forms_for_user",
"django... | [((616, 648), 'wagtail.wagtailforms.models.get_forms_for_user', 'get_forms_for_user', (['request.user'], {}), '(request.user)\n', (634, 648), False, 'from wagtail.wagtailforms.models import get_forms_for_user\n'), ((678, 707), 'wagtail.utils.pagination.paginate', 'paginate', (['request', 'form_pages'], {}), '(request, ... |
from flask import Flask, render_template, url_for, request, redirect, flash
from werkzeug.utils import secure_filename
from utils import classify_image
import os
from flask_wtf.csrf import CSRFProtect
from config import Config
app = Flask(__name__)
app.config.from_object(Config)
csrf = CSRFProtect(app)
# On IBM Clo... | [
"os.listdir",
"flask.flash",
"os.unlink",
"flask_wtf.csrf.CSRFProtect",
"flask.redirect",
"os.getcwd",
"flask.Flask",
"werkzeug.utils.secure_filename",
"utils.classify_image",
"os.path.isfile",
"flask.render_template",
"os.path.join",
"os.getenv"
] | [((236, 251), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (241, 251), False, 'from flask import Flask, render_template, url_for, request, redirect, flash\n'), ((290, 306), 'flask_wtf.csrf.CSRFProtect', 'CSRFProtect', (['app'], {}), '(app)\n', (301, 306), False, 'from flask_wtf.csrf import CSRFProtect\n'... |
from .config import *
from contextlib import contextmanager
from functools import wraps
import json
import os
import pathlib
import random
import shutil
import string
import tempfile
import bpy
import io_scene_previz
from previz import PrevizProject
class ApiDecorators(object):
def __init__(
self,
... | [
"bpy.ops.export_scene.previz",
"json.load",
"previz.PrevizProject",
"random.choice",
"pathlib.Path",
"tempfile.mkdtemp",
"bpy.ops.export_scene.previz_new_project",
"functools.wraps",
"io_scene_previz.previz_preferences"
] | [((6142, 6189), 'io_scene_previz.previz_preferences', 'io_scene_previz.previz_preferences', (['bpy.context'], {}), '(bpy.context)\n', (6176, 6189), False, 'import io_scene_previz\n'), ((6575, 6612), 'bpy.ops.export_scene.previz', 'bpy.ops.export_scene.previz', ([], {}), '(**kwargs)\n', (6602, 6612), False, 'import bpy\... |
import typing
import gettext
import numpy
from nion.data import Core
from nion.data import DataAndMetadata
from nion.swift.model import Symbolic
from nion.typeshed import API_1_0
_ = gettext.gettext
class AlignMultiDimensionalSequence:
label = _("Align multi-dimensional sequence")
inputs = {"si_sequence_dat... | [
"nion.swift.model.Symbolic.register_computation_type",
"nion.data.Core.function_sequence_measure_relative_translation",
"nion.data.DataAndMetadata.new_data_and_metadata",
"numpy.zeros",
"numpy.empty_like",
"numpy.unravel_index",
"numpy.product"
] | [((7815, 7915), 'nion.swift.model.Symbolic.register_computation_type', 'Symbolic.register_computation_type', (['"""nion.align_multi_d_sequence"""', 'AlignMultiDimensionalSequence'], {}), "('nion.align_multi_d_sequence',\n AlignMultiDimensionalSequence)\n", (7849, 7915), False, 'from nion.swift.model import Symbolic\... |
import sys, re, requests
from bs4 import BeautifulSoup as BS
url = f'https://cctld.uz/whois/?domain={sys.argv[1]}&zone=uz'
r = requests.get(url)
html = BS(r.content, 'html.parser')
if len(html.select('.table-responsive'))>0:
for el in html.select('tbody > tr:nth-child(5) > td:nth-child(2)'):
date = '-'.j... | [
"bs4.BeautifulSoup",
"re.search",
"requests.get"
] | [((129, 146), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (141, 146), False, 'import sys, re, requests\n'), ((154, 182), 'bs4.BeautifulSoup', 'BS', (['r.content', '"""html.parser"""'], {}), "(r.content, 'html.parser')\n", (156, 182), True, 'from bs4 import BeautifulSoup as BS\n'), ((364, 420), 're.search'... |
import unittest
from katas.kyu_7.genetic_algorithm_series_1_generate import generate
class GenerateTestCase(unittest.TestCase):
def test_equals(self):
self.assertEqual(len(generate(16)), 16)
def test_equals_2(self):
self.assertEqual(len(generate(32)), 32)
def test_equals_3(self):
... | [
"katas.kyu_7.genetic_algorithm_series_1_generate.generate"
] | [((187, 199), 'katas.kyu_7.genetic_algorithm_series_1_generate.generate', 'generate', (['(16)'], {}), '(16)\n', (195, 199), False, 'from katas.kyu_7.genetic_algorithm_series_1_generate import generate\n'), ((265, 277), 'katas.kyu_7.genetic_algorithm_series_1_generate.generate', 'generate', (['(32)'], {}), '(32)\n', (27... |
# Copyright (c) 2018-2019 <NAME>, <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish,... | [
"numpy.conj",
"numpy.random.rand",
"numpy.zeros",
"numpy.mean",
"numpy.matmul",
"numpy.dot",
"numpy.eye",
"numpy.linalg.solve",
"numpy.sqrt"
] | [((3600, 3635), 'numpy.zeros', 'np.zeros', (['(n_src, n_freq, n_frames)'], {}), '((n_src, n_freq, n_frames))\n', (3608, 3635), True, 'import numpy as np\n'), ((3644, 3664), 'numpy.eye', 'np.eye', (['n_src', 'n_src'], {}), '(n_src, n_src)\n', (3650, 3664), True, 'import numpy as np\n'), ((3673, 3729), 'numpy.zeros', 'np... |
# coding: utf8
"""Securely hash and check passwords using PBKDF2.
Use random salts to protect againt rainbow tables, many iterations against
brute-force, and constant-time comparaison againt timing attacks.
Keep parameters to the algorithm together with the hash so that we can
change the parameters and keep older has... | [
"os.urandom",
"itertools.izip",
"base64.b64decode"
] | [((1707, 1724), 'base64.b64decode', 'b64decode', (['hash_a'], {}), '(hash_a)\n', (1716, 1724), False, 'from base64 import b64encode, b64decode\n'), ((2090, 2110), 'itertools.izip', 'izip', (['hash_a', 'hash_b'], {}), '(hash_a, hash_b)\n', (2094, 2110), False, 'from itertools import izip\n'), ((1162, 1182), 'os.urandom'... |
# Copyright (c) 2019 PaddlePaddle 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 app... | [
"parl.utils.logger.warning",
"parl.remote.grpc_heartbeat.HeartbeatClientThread",
"parl.utils.logger.info",
"cloudpickle.loads",
"parl.remote.cluster_monitor.ClusterMonitor",
"parl.remote.job_center.JobCenter",
"collections.defaultdict",
"parl.utils.to_byte",
"parl.utils.to_str",
"parl.utils.get_ip... | [((2496, 2509), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (2507, 2509), False, 'import zmq\n'), ((2535, 2551), 'parl.utils.get_ip_address', 'get_ip_address', ([], {}), '()\n', (2549, 2551), False, 'from parl.utils import to_str, to_byte, logger, get_ip_address\n'), ((3059, 3084), 'parl.remote.job_center.JobCenter... |
#!/usr/bin/env python
# coding=utf-8
#!/usr/bin/env python
# coding=utf-8
import ansible.playbook
from ansible import callbacks
from ansible import utils
import json
stats = callbacks.AggregateStats()
playbook_cb = callbacks.PlaybookCallbacks(verbose=utils.VERBOSITY)
runner_cb = callbacks.PlaybookRunnerCallbacks(stats... | [
"ansible.callbacks.AggregateStats",
"ansible.callbacks.PlaybookRunnerCallbacks",
"ansible.callbacks.PlaybookCallbacks",
"json.dumps"
] | [((175, 201), 'ansible.callbacks.AggregateStats', 'callbacks.AggregateStats', ([], {}), '()\n', (199, 201), False, 'from ansible import callbacks\n'), ((216, 268), 'ansible.callbacks.PlaybookCallbacks', 'callbacks.PlaybookCallbacks', ([], {'verbose': 'utils.VERBOSITY'}), '(verbose=utils.VERBOSITY)\n', (243, 268), False... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos.core.Attach",
"numpy.radians",
"nicos_sinq.amor.devices.logical_motor.InterfaceLogicalMotorHandler.doPreinit",
"nicos.core.dictwith",
"nicos.core.Override",
"numpy.arctan",
"nicos.core.utils.multiStatus",
"nicos.core.oneof"
] | [((3633, 3649), 'numpy.arctan', 'arctan', (['(top / xs)'], {}), '(top / xs)\n', (3639, 3649), False, 'from numpy import arctan, radians, tan\n'), ((3656, 3675), 'numpy.arctan', 'arctan', (['(bottom / xs)'], {}), '(bottom / xs)\n', (3662, 3675), False, 'from numpy import arctan, radians, tan\n'), ((1957, 1996), 'nicos.c... |
from typing import Dict, List, Optional
from pydantic import BaseModel
from xpresso import App, FromJson, Path
class Item(BaseModel):
name: str
price: float
tax: Optional[float] = None
async def create_receipt(items: FromJson[List[Item]]) -> Dict[str, float]:
return {item.name: item.price + (item.... | [
"xpresso.Path"
] | [((383, 419), 'xpresso.Path', 'Path', (['"""/items/"""'], {'post': 'create_receipt'}), "('/items/', post=create_receipt)\n", (387, 419), False, 'from xpresso import App, FromJson, Path\n')] |
"""
Created by: <NAME>
Email: <EMAIL>
"""
import turtle
import math
def golden_spiral1():
# fibbionaci
a = 0
b = 1
# go up
turtle.left(90)
while b < 610:
b += a
a = b - a
# create 90 degrees circle with radius b
turtle.circle(b, extent = 90)
turtle.done(... | [
"turtle.circle",
"turtle.left",
"turtle.done",
"turtle.forward"
] | [((146, 161), 'turtle.left', 'turtle.left', (['(90)'], {}), '(90)\n', (157, 161), False, 'import turtle\n'), ((308, 321), 'turtle.done', 'turtle.done', ([], {}), '()\n', (319, 321), False, 'import turtle\n'), ((399, 414), 'turtle.left', 'turtle.left', (['(90)'], {}), '(90)\n', (410, 414), False, 'import turtle\n'), ((8... |
# Copyright (c) 2015 Rackspace, 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 wr... | [
"uuid.uuid4",
"mock.patch.object",
"ddt.data",
"hypothesis.strategies.text"
] | [((1885, 1954), 'ddt.data', 'ddt.data', (['u"""create_in_progress"""', 'u"""deployed"""', 'u"""failed"""', 'u"""cancelled"""'], {}), "(u'create_in_progress', u'deployed', u'failed', u'cancelled')\n", (1893, 1954), False, 'import ddt\n'), ((913, 930), 'hypothesis.strategies.text', 'strategies.text', ([], {}), '()\n', (9... |
#!/usr/bin/env python2.7
"""
Module to interact with Xpedite device driver to program H/W performance counters
This module provides logic to
1. Detect and interact with Xpedite device driver
2. Build and serialize requests from a list of pmc events
Author: <NAME>, <NAME>
"""
import os
import struct
import loggin... | [
"xpedite.pmu.request.PmuRequestFactory",
"xpedite.pmu.event.EventState",
"xpedite.pmu.request.RequestSorter.sort",
"xpedite.pmu.request.OffcorePmuRequest.defaultMask",
"xpedite.pmu.request.GenericPmuRequest.defaultMask",
"os.path.exists",
"socket.gethostname",
"xpedite.pmu.request.FixedPmuRequest.defa... | [((598, 625), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (615, 625), False, 'import logging\n'), ((734, 765), 'os.path.exists', 'os.path.exists', (['PMU_CTRL_DEVICE'], {}), '(PMU_CTRL_DEVICE)\n', (748, 765), False, 'import os\n'), ((770, 805), 'os.access', 'os.access', (['PMU_CTRL_DEV... |
# coding=utf-8
# Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | [
"subprocess.Popen"
] | [((1216, 1327), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT', 'bufsize': '(1)', 'universal_newlines': '(True)'}), '(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,\n bufsize=1, universal_newlines=True)\n', (1232, 1327), False, 'import subprocess... |
import json
import sys
import os
from pprint import pprint
from cassandra.cluster import Cluster
from cassandra.policies import DCAwareRoundRobinPolicy
cluster = Cluster(load_balancing_policy=DCAwareRoundRobinPolicy())
session = cluster.connect()
session.execute('drop keyspace if exists de')
session.execute(
"""
... | [
"cassandra.policies.DCAwareRoundRobinPolicy",
"os.listdir"
] | [((789, 805), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (799, 805), False, 'import os\n'), ((192, 217), 'cassandra.policies.DCAwareRoundRobinPolicy', 'DCAwareRoundRobinPolicy', ([], {}), '()\n', (215, 217), False, 'from cassandra.policies import DCAwareRoundRobinPolicy\n')] |
import base64
import datetime
import json
import logging
import os
import time
import traceback
from urllib.parse import urlparse, quote
from boto3.dynamodb.types import TypeDeserializer
from algoliasearch.search_client import SearchClient
# Logger
logger = logging.getLogger()
logger.setLevel(logging.DEBUG if os.geten... | [
"json.loads",
"base64.b64decode",
"datetime.datetime.utcnow",
"json.JSONEncoder.default",
"traceback.format_exc",
"algoliasearch.search_client.SearchClient.create",
"os.getenv",
"logging.getLogger"
] | [((259, 278), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (276, 278), False, 'import logging\n'), ((1440, 1483), 'os.getenv', 'os.getenv', (['"""ALGOLIA_PROJECT_ID"""'], {'default': '""""""'}), "('ALGOLIA_PROJECT_ID', default='')\n", (1449, 1483), False, 'import os\n'), ((1630, 1669), 'os.getenv', 'os.g... |
import os
import numpy as np
import codecs
import pandas as pd
import json
from glob import glob
import cv2
import shutil
from sklearn.model_selection import train_test_split
#1.标签路径
csv_file = "annotations.csv"
saved_path = "./VOCdevkit/VOC2007/" #保存路径
image_save_path = "./JPEGImages/"
image_raw_parh ... | [
"os.makedirs",
"numpy.concatenate",
"codecs.open",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"os.path.exists",
"cv2.imread",
"numpy.array",
"glob.glob",
"shutil.copy"
] | [((3978, 4018), 'glob.glob', 'glob', (["(saved_path + './Annotations/*.xml')"], {}), "(saved_path + './Annotations/*.xml')\n", (3982, 4018), False, 'from glob import glob\n'), ((4220, 4251), 'glob.glob', 'glob', (["(image_raw_parh + '/*.jpg')"], {}), "(image_raw_parh + '/*.jpg')\n", (4224, 4251), False, 'from glob impo... |
from tests.cli.commands.helpers import WORKSPACE_ROOT, run
class TestPipenvE2E:
@staticmethod
def should_manage_pipenv_projects():
# WHEN I create two pipenv projects
projects = ["library-one", "library-two"]
for project in projects:
run(["workspace", "new", "--type", "pipe... | [
"tests.cli.commands.helpers.run"
] | [((1092, 1179), 'tests.cli.commands.helpers.run', 'run', (["['pipenv', 'install', '--editable', '../library-two']"], {'cwd': '"""libs/library-one"""'}), "(['pipenv', 'install', '--editable', '../library-two'], cwd=\n 'libs/library-one')\n", (1095, 1179), False, 'from tests.cli.commands.helpers import WORKSPACE_ROOT,... |
import torch
import torch.nn as nn
from mmcv.cnn import normal_init
from torch import Tensor
import numpy as np
from mmdet.core import distance2bbox, force_fp32, multi_apply, multiclass_nms_with_mask
from mmdet.ops import ModulatedDeformConvPack
from ..builder import build_loss
from ..registry import HEADS
from ..uti... | [
"torch.sqrt",
"torch.cat",
"torch.cos",
"mmdet.core.distance2bbox",
"torch.arange",
"torch.range",
"mmdet.core.multiclass_nms_with_mask",
"mmcv.cnn.normal_init",
"torch.zeros",
"torch.atan2",
"mmdet.core.multi_apply",
"mmdet.ops.ModulatedDeformConvPack",
"torch.where",
"torch.nn.ModuleList... | [((1861, 1904), 'torch.stack', 'torch.stack', (['(left, top, right, bottom)', '(-1)'], {}), '((left, top, right, bottom), -1)\n', (1872, 1904), False, 'import torch\n'), ((2346, 2373), 'torch.sqrt', 'torch.sqrt', (['(x ** 2 + y ** 2)'], {}), '(x ** 2 + y ** 2)\n', (2356, 2373), False, 'import torch\n'), ((2391, 2408), ... |
from __future__ import division
import numpy as np
from rwt import dwt, idwt, dwtaxis, idwtaxis
from rwt.wavelets import waveletCoeffs
from rwt.utilities import softThreshold, hardThreshold
import matplotlib.pyplot as plt
from scipy.misc import lena
import os
IMAGES_BASE = 'images'
def savefig(title):
... | [
"scipy.misc.lena",
"matplotlib.pyplot.gray",
"matplotlib.pyplot.show",
"rwt.wavelets.waveletCoeffs",
"matplotlib.pyplot.imshow",
"rwt.dwt",
"matplotlib.pyplot.figure",
"os.path.join"
] | [((400, 406), 'scipy.misc.lena', 'lena', ([], {}), '()\n', (404, 406), False, 'from scipy.misc import lena\n'), ((435, 455), 'rwt.wavelets.waveletCoeffs', 'waveletCoeffs', (['"""db1"""'], {}), "('db1')\n", (448, 455), False, 'from rwt.wavelets import waveletCoeffs\n'), ((478, 499), 'rwt.dwt', 'dwt', (['img', 'cl', 'ch'... |
# Copyright (C) 2019 TU Dresden
# Licensed under the ISC license (see LICENSE.txt)
#
# Authors: <NAME>, <NAME>
from mocasin.common.trace import (
DataflowTrace,
ComputeSegment,
ReadTokenSegment,
WriteTokenSegment,
)
class TgffTrace(DataflowTrace):
"""Represents the behavior of an SDF3 applicatio... | [
"mocasin.common.trace.WriteTokenSegment",
"mocasin.common.trace.ComputeSegment",
"mocasin.common.trace.ReadTokenSegment"
] | [((2220, 2252), 'mocasin.common.trace.ComputeSegment', 'ComputeSegment', (['processor_cycles'], {}), '(processor_cycles)\n', (2234, 2252), False, 'from mocasin.common.trace import DataflowTrace, ComputeSegment, ReadTokenSegment, WriteTokenSegment\n'), ((2116, 2168), 'mocasin.common.trace.ReadTokenSegment', 'ReadTokenSe... |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import six
from fnmatch import fnmatchcase
import sys
from . import Command
from .. import console
from ..console impor... | [
"six.iteritems",
"sys.exit",
"fnmatch.fnmatchcase"
] | [((2189, 2219), 'six.iteritems', 'six.iteritems', (['global_patterns'], {}), '(global_patterns)\n', (2202, 2219), False, 'import six\n'), ((3592, 3603), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (3600, 3603), False, 'import sys\n'), ((2948, 2988), 'fnmatch.fnmatchcase', 'fnmatchcase', (['benchmark', 'single_bench... |
#!/usr/bin/env python
# _*_ coding: utf-8 _*_
import argparse
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import StratifiedKFold
def RF_Classifier(X, y, indep=None, fold=5, n_trees=100, out='RF_output'):
"""
Parameters:
----------
:... | [
"sklearn.ensemble.RandomForestClassifier",
"numpy.array",
"sklearn.model_selection.StratifiedKFold"
] | [((1023, 1035), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (1031, 1035), True, 'import numpy as np\n'), ((1410, 1471), 'sklearn.ensemble.RandomForestClassifier', 'RandomForestClassifier', ([], {'n_estimators': 'n_trees', 'bootstrap': '(False)'}), '(n_estimators=n_trees, bootstrap=False)\n', (1432, 1471), False,... |
import pytest
from gpmap import GenotypePhenotypeMap
import numpy as np
@pytest.fixture(scope="module")
def gpvolve_gpm():
wildtype = "AAA"
genotypes = [
"AAA",
"AAB",
"ABA",
"BAA",
"ABB",
"BAB",
"BBA",
"BBB"
]
mutations = {
0:... | [
"gpmap.GenotypePhenotypeMap",
"pytest.fixture",
"numpy.iinfo",
"numpy.finfo",
"numpy.arange"
] | [((75, 105), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (89, 105), False, 'import pytest\n'), ((605, 635), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (619, 635), False, 'import pytest\n'), ((791, 821), 'pytest.fixture', 'pyt... |
import os
import cv2
import torch
import time
import ujson as json
import numpy as np
from tqdm import tqdm
from torch.cuda.amp import autocast, GradScaler
from torchvision_models.segmentation import erfnet_resnet, deeplabv1_vgg16, deeplabv1_resnet18, deeplabv1_resnet34, \
deeplabv1_resnet50, deeplabv1_resnet101, e... | [
"numpy.argmax",
"torchvision_models.segmentation.deeplabv1_vgg16",
"utils.all_utils_semseg.save_checkpoint",
"torch.no_grad",
"torchvision_models.segmentation.erfnet_resnet",
"torch.cuda.amp.autocast",
"torch.utils.data.DataLoader",
"os.path.exists",
"utils.all_utils_semseg.ConfusionMatrix",
"ujso... | [((706, 881), 'torchvision_models.segmentation.erfnet_resnet', 'erfnet_resnet', ([], {'pretrained_weights': 'pretrained_weights', 'num_classes': 'num_classes', 'num_lanes': '(num_classes - 1)', 'dropout_1': '(0.3)', 'dropout_2': '(0.3)', 'flattened_size': '(4400)', 'scnn': 'scnn'}), '(pretrained_weights=pretrained_weig... |
import os.path as osp
from cytokit.ops.op import CytokitOp, get_tf_config
from cytokit.miq import prediction
from cytokit import data as cytokit_data
from cytokit import io as cytokit_io
import tensorflow as tf
import numpy as np
import logging
DEFAULT_PATCH_SIZE = 84
DEFAULT_N_CLASSES = 11
logger = logging.getLogger(... | [
"numpy.argmax",
"cytokit.data.initialize_best_focus_model",
"cytokit.io.get_best_focus_img_path",
"numpy.array",
"numpy.arange",
"tensorflow.Graph",
"cytokit.ops.op.get_tf_config",
"os.path.join",
"logging.getLogger"
] | [((302, 329), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (319, 329), False, 'import logging\n'), ((1594, 1636), 'cytokit.data.initialize_best_focus_model', 'cytokit_data.initialize_best_focus_model', ([], {}), '()\n', (1634, 1636), True, 'from cytokit import data as cytokit_data\n'), ... |
"""ops.syncretism.io model"""
__docformat__ = "numpy"
import configparser
import logging
from typing import Tuple
import pandas as pd
import requests
import yfinance as yf
from gamestonk_terminal.decorators import log_start_end
from gamestonk_terminal.rich_config import console
from gamestonk_terminal.stocks.options... | [
"pandas.DataFrame",
"logging.exception",
"configparser.RawConfigParser",
"logging.getLogger",
"gamestonk_terminal.stocks.options.yfinance_model.get_option_chain",
"pandas.to_datetime",
"requests.get",
"gamestonk_terminal.rich_config.console.print",
"gamestonk_terminal.decorators.log_start_end"
] | [((353, 380), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (370, 380), False, 'import logging\n'), ((577, 602), 'gamestonk_terminal.decorators.log_start_end', 'log_start_end', ([], {'log': 'logger'}), '(log=logger)\n', (590, 602), False, 'from gamestonk_terminal.decorators import log_st... |
from django.conf.urls import url
from . import views
app_name = 'code'
urlpatterns = [
url(r'^(?P<pk>[0-9]+)/(?P<question>[0-9]+)/$',views.submission, name='submission'),
]
| [
"django.conf.urls.url"
] | [((94, 181), 'django.conf.urls.url', 'url', (['"""^(?P<pk>[0-9]+)/(?P<question>[0-9]+)/$"""', 'views.submission'], {'name': '"""submission"""'}), "('^(?P<pk>[0-9]+)/(?P<question>[0-9]+)/$', views.submission, name=\n 'submission')\n", (97, 181), False, 'from django.conf.urls import url\n')] |
import torch
import numpy as np
class Uniform_Buffer:
def __init__(self, buffer_size, state_shape, action_shape, device, mix=1):
self._n = 0
self._p = 0
self.mix = mix
self.buffer_size = buffer_size
self.total_size = mix * buffer_size
self.states = torch.empty(
... | [
"numpy.random.randint",
"torch.empty",
"torch.from_numpy"
] | [((305, 383), 'torch.empty', 'torch.empty', (['(self.total_size, *state_shape)'], {'dtype': 'torch.float', 'device': 'device'}), '((self.total_size, *state_shape), dtype=torch.float, device=device)\n', (316, 383), False, 'import torch\n'), ((420, 499), 'torch.empty', 'torch.empty', (['(self.total_size, *action_shape)']... |
"""
Linear State Space Assembler
"""
from sharpy.utils.solver_interface import solver, BaseSolver
import sharpy.linear.utils.ss_interface as ss_interface
import sharpy.utils.settings as settings
import sharpy.utils.h5utils as h5
import warnings
@solver
class LinearAssembler(BaseSolver):
r"""
Warnings:
... | [
"numpy.log",
"sharpy.utils.settings.SettingsTable",
"sharpy.utils.settings.to_custom_types",
"numpy.linalg.eig",
"sharpy.linear.utils.ss_interface.initialise_system",
"numpy.argsort",
"sharpy.utils.h5utils.readh5"
] | [((2890, 2914), 'sharpy.utils.settings.SettingsTable', 'settings.SettingsTable', ([], {}), '()\n', (2912, 2914), True, 'import sharpy.utils.settings as settings\n'), ((3441, 3529), 'sharpy.utils.settings.to_custom_types', 'settings.to_custom_types', (['self.settings', 'self.settings_types', 'self.settings_default'], {}... |
#!/usr/bin/env python3
# Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2020.
# Licensed under MIT License
"""
Usage:
edl.py -h | --help
edl.py [--vid=vid] [--pid=pid]
edl.py [--loader=filename] [--memory=memtype]
edl.py [--debugmode]
edl.py [--gpt-num-part-entries=number] [--gpt-part-entry-siz... | [
"Library.sahara.qualcomm_sahara",
"Library.streaming.qualcomm_streaming",
"docopt.docopt",
"socket.socket",
"struct.unpack",
"Library.firehose.qualcomm_firehose.cfg",
"time.sleep",
"Library.xmlparser.xmlparser",
"Library.usblib.usb_class"
] | [((9714, 9748), 'docopt.docopt', 'docopt', (['__doc__'], {'version': '"""EDL 2.1"""'}), "(__doc__, version='EDL 2.1')\n", (9720, 9748), False, 'from docopt import docopt\n'), ((19723, 19767), 'Library.usblib.usb_class', 'usb_class', ([], {'vid': 'vid', 'pid': 'pid', 'verbose': 'verbose'}), '(vid=vid, pid=pid, verbose=v... |
""" Game fix for Persona 4 Golden
"""
#pylint: disable=C0103
from protonfixes import util
def main():
""" installs devenum, quartz, wmp9 and adjust pulse latency
"""
# Fix pre-rendered cutscene playback
util.protontricks('devenum')
util.protontricks('quartz')
util.protontricks('wmp9')
# ... | [
"protonfixes.util.set_environment",
"protonfixes.util.protontricks"
] | [((222, 250), 'protonfixes.util.protontricks', 'util.protontricks', (['"""devenum"""'], {}), "('devenum')\n", (239, 250), False, 'from protonfixes import util\n'), ((255, 282), 'protonfixes.util.protontricks', 'util.protontricks', (['"""quartz"""'], {}), "('quartz')\n", (272, 282), False, 'from protonfixes import util\... |
import pyxhook
import os
import bluetooth
import time
global s
# function that finds the MAC address of the RC car
def Find_RC():
needed = "ESP32" #name of the car
while True:
nearby_devices = bluetooth.discover_devices(lookup_names = True)
#print("found %d devices" % len(nearby_devices))
... | [
"bluetooth.BluetoothSocket",
"bluetooth.discover_devices",
"time.sleep",
"pyxhook.HookManager",
"pyxhook.print_err"
] | [((1192, 1213), 'pyxhook.HookManager', 'pyxhook.HookManager', ([], {}), '()\n', (1211, 1213), False, 'import pyxhook\n'), ((585, 628), 'bluetooth.BluetoothSocket', 'bluetooth.BluetoothSocket', (['bluetooth.RFCOMM'], {}), '(bluetooth.RFCOMM)\n', (610, 628), False, 'import bluetooth\n'), ((211, 256), 'bluetooth.discover_... |
# 3p
import pymemcache
from pymemcache.exceptions import MemcacheClientError
from pymemcache.exceptions import MemcacheIllegalInputError
from pymemcache.exceptions import MemcacheServerError
from pymemcache.exceptions import MemcacheUnknownCommandError
from pymemcache.exceptions import MemcacheUnknownError
import pytes... | [
"tests.utils.DummyTracer",
"ddtrace.contrib.pymemcache.patch.unpatch",
"pytest.raises",
"pymemcache.client.base.Client",
"ddtrace.Pin.override",
"pymemcache.client.base.PooledClient",
"pymemcache.client.hash.HashClient",
"ddtrace.Pin.get_from",
"pymemcache.pool.ObjectPool",
"ddtrace.contrib.pymemc... | [((1280, 1289), 'ddtrace.contrib.pymemcache.patch.unpatch', 'unpatch', ([], {}), '()\n', (1287, 1289), False, 'from ddtrace.contrib.pymemcache.patch import unpatch\n'), ((3050, 3083), 'pytest.raises', 'pytest.raises', (['Exception', '_delete'], {}), '(Exception, _delete)\n', (3063, 3083), False, 'import pytest\n'), ((3... |
"""
Copyright (c) 2020-2021 Intel Corporation
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... | [
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.PReLU",
"math.sqrt",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torch.nn.AvgPool2d",
"torch.nn.Sigmoid"
] | [((975, 992), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(3)'], {}), '(3)\n', (989, 992), True, 'import torch.nn as nn\n'), ((1002, 1064), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels', '(3)', 'stride', '(1)'], {'bias': '(False)'}), '(in_channels, out_channels, 3, stride, 1, bias=False)\n', (1011, 1... |
import logging
import logging.handlers
def set_logger(header,fn):
logger = logging.getLogger(header)
handler1 = logging.StreamHandler()
handler2 = logging.handlers.RotatingFileHandler(filename=fn, maxBytes=10000000, backupCount=10)
logger.setLevel(logging.DEBUG)
handler1.setLevel(logging.... | [
"logging.Formatter",
"logging.StreamHandler",
"logging.handlers.RotatingFileHandler",
"logging.getLogger"
] | [((80, 105), 'logging.getLogger', 'logging.getLogger', (['header'], {}), '(header)\n', (97, 105), False, 'import logging\n'), ((126, 149), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (147, 149), False, 'import logging\n'), ((165, 253), 'logging.handlers.RotatingFileHandler', 'logging.handlers.Ro... |
from pygame import image, transform
class TileLoader:
def __init__(self, tile_size):
self.images = [
transform.scale(image.load('assets/water-deep.png'), (tile_size, tile_size)),
transform.scale(image.load('assets/water-shallow.png'), (tile_size, tile_size)),
transform.s... | [
"pygame.image.load"
] | [((142, 177), 'pygame.image.load', 'image.load', (['"""assets/water-deep.png"""'], {}), "('assets/water-deep.png')\n", (152, 177), False, 'from pygame import image, transform\n'), ((232, 270), 'pygame.image.load', 'image.load', (['"""assets/water-shallow.png"""'], {}), "('assets/water-shallow.png')\n", (242, 270), Fals... |
"""
This platform provides binary sensors for OpenUV data.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/binary_sensor.openuv/
"""
import logging
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.core import callb... | [
"homeassistant.util.dt.utcnow",
"homeassistant.util.dt.parse_datetime",
"homeassistant.helpers.dispatcher.async_dispatcher_connect",
"logging.getLogger"
] | [((672, 699), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (689, 699), False, 'import logging\n'), ((2839, 2907), 'homeassistant.helpers.dispatcher.async_dispatcher_connect', 'async_dispatcher_connect', (['self.hass', 'TOPIC_UPDATE', 'self._update_data'], {}), '(self.hass, TOPIC_UPDATE,... |
from os import environ
from shlex import split
from subprocess import DEVNULL, CalledProcessError, Popen, TimeoutExpired, run
from pitop.common.current_session_info import get_first_display
from pitop.common.logger import PTLogger
def __get_env():
env_plus_display = environ.copy()
first_display = get_first_d... | [
"pitop.common.current_session_info.get_first_display",
"os.environ.copy",
"pitop.common.logger.PTLogger.debug",
"shlex.split"
] | [((274, 288), 'os.environ.copy', 'environ.copy', ([], {}), '()\n', (286, 288), False, 'from os import environ\n'), ((309, 328), 'pitop.common.current_session_info.get_first_display', 'get_first_display', ([], {}), '()\n', (326, 328), False, 'from pitop.common.current_session_info import get_first_display\n'), ((524, 60... |
# -*- coding: utf-8 -*-
from convlab2.util.multiwoz.paraphrase_span_detection import phrase_idx_utt
def paraphrase_span_detection(new_text,span_info):
new_words=new_text.split()
new_span_info=[]
for span in span_info:
span_words=span[2].split()
result=phrase_idx_utt(span_words,new_w... | [
"convlab2.util.multiwoz.paraphrase_span_detection.phrase_idx_utt"
] | [((289, 326), 'convlab2.util.multiwoz.paraphrase_span_detection.phrase_idx_utt', 'phrase_idx_utt', (['span_words', 'new_words'], {}), '(span_words, new_words)\n', (303, 326), False, 'from convlab2.util.multiwoz.paraphrase_span_detection import phrase_idx_utt\n')] |
# Python 2.7 requires pygame
import pygame, sys
pygame.init()
dots = [[221, 432], [225, 331], [133, 342], [141, 310],
[51, 230], [74, 217], [58, 153], [114, 164],
[123, 135], [176, 190], [159, 77], [193, 93],
[230, 28], [267, 93], [301, 77], [284, 190],
[327, 135], [336, 164], [402, 153], [386, 217],
[409, 230], [319,... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.display.flip",
"pygame.draw.lines"
] | [((49, 62), 'pygame.init', 'pygame.init', ([], {}), '()\n', (60, 62), False, 'import pygame, sys\n'), ((373, 408), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[640, 480]'], {}), '([640, 480])\n', (396, 408), False, 'import pygame, sys\n'), ((438, 491), 'pygame.draw.lines', 'pygame.draw.lines', (['screen', ... |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plot
import simpy, numpy
from mds_sim import *
from rvs import *
from patch import *
# ######################## Models ######################## #
def ar_ub_fj(n, X):
return float(1/moment_i_n_k(1, n, n, X) )
def E_T_fj(ar, n, X):
# def max_cdf... | [
"matplotlib.pyplot.legend",
"matplotlib.use",
"numpy.linspace",
"simpy.Environment",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.gcf",
"matplotlib.pyplot.xlabel"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((2525, 2556), 'numpy.linspace', 'numpy.linspace', (['(0.05)', 'ar_ub', '(15)'], {}), '(0.05, ar_ub, 15)\n', (2539, 2556), False, 'import simpy, numpy\n'), ((3030, 3060), 'matplotlib.pyplot.legend'... |
#!/usr/bin/env python
#-------------------------------------------------------------------------------
# Name: Gear Generator
# Purpose: Just for fun
#
# Author: <NAME>
# Email: <EMAIL>
# Web: https://sites.google.com/view/interpolation/home
#
# Created: 25/06/2021
# C... | [
"PyQt5.QtWidgets.QVBoxLayout",
"matplotlib.figure.Figure",
"PyQt5.QtWidgets.QWidget.__init__",
"matplotlib.pyplot.Circle"
] | [((1072, 1112), 'matplotlib.figure.Figure', 'Figure', ([], {'figsize': '(width, height)', 'dpi': 'dpi'}), '(figsize=(width, height), dpi=dpi)\n', (1078, 1112), False, 'from matplotlib.figure import Figure\n'), ((1289, 1319), 'PyQt5.QtWidgets.QWidget.__init__', 'QWidget.__init__', (['self', 'parent'], {}), '(self, paren... |
"""
A file to contain specific logic to handle version upgrades in Kolibri.
"""
import logging
import os
from le_utils.constants import content_kinds
from sqlalchemy import and_
from sqlalchemy import cast
from sqlalchemy import exists
from sqlalchemy import func
from sqlalchemy import Integer
from sqlalchemy import s... | [
"kolibri.core.content.models.ContentNode.objects.filter",
"sqlalchemy.func.sum",
"kolibri.core.content.models.ChannelMetadata.objects.get",
"kolibri.core.content.models.ChannelMetadata.objects.all",
"sqlalchemy.exists",
"sqlalchemy.and_",
"sqlalchemy.select",
"sqlalchemy.Integer",
"sqlalchemy.func.m... | [((1216, 1243), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1233, 1243), False, 'import logging\n'), ((1357, 1394), 'kolibri.core.upgrade.version_upgrade', 'version_upgrade', ([], {'old_version': '"""<0.6.0"""'}), "(old_version='<0.6.0')\n", (1372, 1394), False, 'from kolibri.core.upg... |
# Copyright 2022 The KerasCV Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.ones",
"keras_cv.layers.preprocessing.Grayscale"
] | [((739, 764), 'tensorflow.ones', 'tf.ones', (['(2, 512, 512, 3)'], {}), '((2, 512, 512, 3))\n', (746, 764), True, 'import tensorflow as tf\n'), ((782, 824), 'keras_cv.layers.preprocessing.Grayscale', 'preprocessing.Grayscale', ([], {'output_channels': '(1)'}), '(output_channels=1)\n', (805, 824), False, 'from keras_cv.... |
"""
Program: randomnumber.py
Author: <NAME>
Date: October 9, 2017
"""
import random
smaller = int(input("Enter the smaller number: "))
larger = int(input("Enter the larger number: "))
myNumber = random.randint(smaller, larger)
count = 0
while True:
count += 1
userNumber = int(input("Enter your guess: "))... | [
"random.randint"
] | [((202, 233), 'random.randint', 'random.randint', (['smaller', 'larger'], {}), '(smaller, larger)\n', (216, 233), False, 'import random\n')] |
import uuid
class Team:
"""
A seeded entry in the tournament. Create these through the Tournament class.
"""
def __init__(self, seed, players = None, **kwargs):
"""
Team data:
id: BrawlBracket id (uuid)
seed: Tournament seeding (int)
name: Team name (string)
... | [
"uuid.uuid1"
] | [((574, 586), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (584, 586), False, 'import uuid\n')] |
# Copyright 2020 The TensorFlow 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 applica... | [
"tensorflow.io.gfile.GFile",
"tensorflow_examples.lite.model_maker.third_party.recommendation.ml.model.recommendation_model_launcher.get_callbacks",
"numpy.zeros",
"tensorflow.__version__.split",
"tensorflow.compat.v1.logging.info",
"tensorflow_examples.lite.model_maker.core.api.mm_export",
"tensorflow_... | [((1620, 1662), 'tensorflow_examples.lite.model_maker.core.api.mm_export', 'mm_export', (['"""recommendation.Recommendation"""'], {}), "('recommendation.Recommendation')\n", (1629, 1662), False, 'from tensorflow_examples.lite.model_maker.core.api import mm_export\n'), ((5207, 5253), 'tensorflow_examples.lite.model_make... |
import time
import datetime
import itertools
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.autograd as autograd
from torch.utils.data import DataLoader
import torch.backends.cudnn as cudnn
import dataset
import utils
import sys
import networks.pwcnet as pwcnet
... | [
"utils.repackage_hidden",
"numpy.ones",
"utils.create_generator",
"utils.create_dataloader",
"utils.create_discriminator",
"networks.pwcnet.PWCEstimate",
"torch.nn.MSELoss",
"dataset.ColorizationDataset",
"torch.utils.data.DataLoader",
"torch.zeros",
"networks.pwcnet.PWCNetBackward",
"utils.te... | [((702, 729), 'utils.create_generator', 'utils.create_generator', (['opt'], {}), '(opt)\n', (724, 729), False, 'import utils\n'), ((750, 781), 'utils.create_discriminator', 'utils.create_discriminator', (['opt'], {}), '(opt)\n', (776, 781), False, 'import utils\n'), ((4021, 4062), 'dataset.ColorizationDataset', 'datase... |
#!/usr/bin/env python3
from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup
# for your packages to be recognized by python
d = generate_distutils_setup(
packages=['rosplan_planning_system'],
package_dir={'rosplan_planning_system': 'src/rosplan_planning_system'}
)
setup(**... | [
"distutils.core.setup",
"catkin_pkg.python_setup.generate_distutils_setup"
] | [((170, 309), 'catkin_pkg.python_setup.generate_distutils_setup', 'generate_distutils_setup', ([], {'packages': "['rosplan_planning_system']", 'package_dir': "{'rosplan_planning_system': 'src/rosplan_planning_system'}"}), "(packages=['rosplan_planning_system'], package_dir=\n {'rosplan_planning_system': 'src/rosplan... |
# coding: utf-8
#
from __future__ import absolute_import, print_function
import threading
import re
import time
import datetime
import csv
import sys
import atexit
from collections import namedtuple
_MEM_PATTERN = re.compile(r'TOTAL[:\s]+(\d+)')
# acct_tag_hex is a socket tag
# cnt_set==0 are for background data
# c... | [
"atexit.register",
"matplotlib.pyplot.clf",
"pandas.read_csv",
"time.strftime",
"uiautomator2.plugin_register",
"matplotlib.pyplot.gca",
"os.path.join",
"threading.Condition",
"os.path.exists",
"threading.Event",
"datetime.datetime.now",
"threading.Thread",
"csv.writer",
"matplotlib.pyplot... | [((217, 249), 're.compile', 're.compile', (['"""TOTAL[:\\\\s]+(\\\\d+)"""'], {}), "('TOTAL[:\\\\s]+(\\\\d+)')\n", (227, 249), False, 'import re\n'), ((11830, 11871), 'uiautomator2.plugin_register', 'u2.plugin_register', (['"""perf"""', 'Perf', 'pkgname'], {}), "('perf', Perf, pkgname)\n", (11848, 11871), True, 'import ... |
"""Tests for distutils.filelist."""
import unittest
from distutils.filelist import glob_to_re, FileList
from test.support import captured_stdout, run_unittest
from distutils import debug
class FileListTestCase(unittest.TestCase):
def test_glob_to_re(self):
# simple cases
self.assertEqual(glob_to_... | [
"distutils.filelist.glob_to_re",
"test.support.captured_stdout",
"unittest.makeSuite",
"distutils.filelist.FileList"
] | [((1317, 1353), 'unittest.makeSuite', 'unittest.makeSuite', (['FileListTestCase'], {}), '(FileListTestCase)\n', (1335, 1353), False, 'import unittest\n'), ((865, 875), 'distutils.filelist.FileList', 'FileList', ([], {}), '()\n', (873, 875), False, 'from distutils.filelist import glob_to_re, FileList\n'), ((312, 330), '... |
#!/usr/bin/env python3
import sys
# import osgeo.utils.ogrmerge as a convenience to use as a script
from osgeo.utils.ogrmerge import * # noqa
from osgeo.utils.ogrmerge import main
from osgeo.gdal import deprecation_warn
deprecation_warn('ogrmerge', 'utils')
sys.exit(main(sys.argv))
| [
"osgeo.utils.ogrmerge.main",
"osgeo.gdal.deprecation_warn"
] | [((224, 261), 'osgeo.gdal.deprecation_warn', 'deprecation_warn', (['"""ogrmerge"""', '"""utils"""'], {}), "('ogrmerge', 'utils')\n", (240, 261), False, 'from osgeo.gdal import deprecation_warn\n'), ((271, 285), 'osgeo.utils.ogrmerge.main', 'main', (['sys.argv'], {}), '(sys.argv)\n', (275, 285), False, 'from osgeo.utils... |
import argparse
from debug import debug_assert
from accounting import Ledger, data_path
parser = argparse.ArgumentParser(description="For a certain ledger, performs a mapping of transactions into derived accounts")
parser.add_argument("--ledger", nargs=1, required=True, help="The ledger the accounts are mapped in", m... | [
"accounting.Ledger",
"accounting.data_path.joinpath",
"argparse.ArgumentParser"
] | [((99, 226), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""For a certain ledger, performs a mapping of transactions into derived accounts"""'}), "(description=\n 'For a certain ledger, performs a mapping of transactions into derived accounts'\n )\n", (122, 226), False, 'import arg... |
# !!! Change: this is a new file
import os
import pathlib
import random
import time
import pprint
from torch.utils.tensorboard import SummaryWriter
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torch.utils.data.distri... | [
"torch.cuda.synchronize",
"utils.net_utils.set_model_prune_rate",
"utils.net_utils.freeze_model_weights",
"time.time",
"os.path.isfile",
"utils.logging.AverageMeter",
"torch.cuda.is_available",
"torch.device",
"torch.cuda.set_device",
"torch.nn.DataParallel",
"torch.no_grad",
"numpy.concatenat... | [((1274, 1304), 'utils.feature_extractor.FeatureExtractor', 'FeatureExtractor', (['model.module'], {}), '(model.module)\n', (1290, 1304), False, 'from utils.feature_extractor import FeatureExtractor\n'), ((1761, 1807), 'utils.logging.AverageMeter', 'AverageMeter', (['"""Time"""', '""":6.3f"""'], {'write_val': '(False)'... |
import networkx as nx
import numpy as np
from pyquil.api import QPUCompiler
from pyquil.gates import H, RY, CZ, CNOT, MEASURE
from pyquil.quil import Program
from pyquil.quilbase import Pragma
from forest.benchmarking.compilation import basic_compile
def create_ghz_program(tree: nx.DiGraph):
"""
Create a Bel... | [
"pyquil.quilbase.Pragma",
"pyquil.gates.CZ",
"pyquil.gates.MEASURE",
"numpy.asarray",
"pyquil.gates.H",
"networkx.topological_sort",
"pyquil.gates.RY",
"forest.benchmarking.compilation.basic_compile",
"pyquil.gates.CNOT",
"pyquil.quil.Program",
"networkx.is_tree",
"numpy.all"
] | [((495, 511), 'networkx.is_tree', 'nx.is_tree', (['tree'], {}), '(tree)\n', (505, 511), True, 'import networkx as nx\n'), ((1210, 1232), 'numpy.asarray', 'np.asarray', (['bitstrings'], {}), '(bitstrings)\n', (1220, 1232), True, 'import numpy as np\n'), ((2729, 2738), 'pyquil.quil.Program', 'Program', ([], {}), '()\n', ... |
# ex:ts=4:sw=4:sts=4:et
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
#
# BitBake Tests for the Event implementation (event.py)
#
# Copyright (C) 2017 Intel Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License vers... | [
"bb.event.fire_ui_handlers",
"bb.event.unregister_UIHhandler",
"unittest.mock.call",
"bb.event.OperationStarted",
"bb.compat.OrderedDict",
"bb.event.clean_class_handlers",
"bb.event.fire_class_handlers",
"bb.event.fire_from_worker",
"bb.event.set_class_handlers",
"bb.event.register",
"bb.event.e... | [((1771, 1777), 'unittest.mock.Mock', 'Mock', ([], {}), '()\n', (1775, 1777), False, 'from unittest.mock import Mock\n'), ((1875, 1897), 'unittest.mock.Mock', 'Mock', ([], {'wraps': 'ui_client1'}), '(wraps=ui_client1)\n', (1879, 1897), False, 'from unittest.mock import Mock\n'), ((1923, 1945), 'unittest.mock.Mock', 'Mo... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
conan.stacker was created on 2017/10/17.
Author: Charles_Lai
Email: <EMAIL>
"""
import numpy as np
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import roc_auc_score
from diego.ensemble_net.base import Ensemble
from diego.ensemble_net.combin... | [
"diego.ensemble_net.combination.Combiner",
"numpy.mean",
"numpy.zeros",
"sklearn.model_selection.StratifiedKFold"
] | [((3956, 3976), 'numpy.mean', 'np.mean', (['out'], {'axis': '(2)'}), '(out, axis=2)\n', (3963, 3976), True, 'import numpy as np\n'), ((2395, 2416), 'diego.ensemble_net.combination.Combiner', 'Combiner', ([], {'rule': '"""mean"""'}), "(rule='mean')\n", (2403, 2416), False, 'from diego.ensemble_net.combination import Com... |
import gzip
import ujson as json
import click
from tqdm import tqdm
from joblib import Parallel, delayed
from _config import Config
from utils import json_paths_iter, sanitize_numpy_types, write_dicts_to_csv
from tree_conversions import tree_to_nx_user_graph
from graph_metrics import compute_undirected_graph_metrics
... | [
"utils.sanitize_numpy_types",
"tqdm.tqdm",
"graph_metrics.compute_undirected_graph_metrics",
"tree_conversions.tree_to_nx_user_graph",
"gzip.open",
"graph_metrics.compute_directed_graph_metrics",
"_config.Config",
"click.option",
"click.command",
"click.Choice",
"utils.json_paths_iter",
"utils... | [((3208, 3223), 'click.command', 'click.command', ([], {}), '()\n', (3221, 3223), False, 'import click\n'), ((3312, 3361), 'click.option', 'click.option', (['"""--n_jobs"""'], {'required': '(True)', 'type': 'int'}), "('--n_jobs', required=True, type=int)\n", (3324, 3361), False, 'import click\n'), ((3363, 3410), 'click... |
import click
from app.celery.tasks import publish_govuk_alerts
def setup_commands(app):
app.cli.add_command(publish)
@click.command('publish')
def publish():
publish_govuk_alerts()
| [
"app.celery.tasks.publish_govuk_alerts",
"click.command"
] | [((127, 151), 'click.command', 'click.command', (['"""publish"""'], {}), "('publish')\n", (140, 151), False, 'import click\n'), ((171, 193), 'app.celery.tasks.publish_govuk_alerts', 'publish_govuk_alerts', ([], {}), '()\n', (191, 193), False, 'from app.celery.tasks import publish_govuk_alerts\n')] |
from pathlib import Path
BASE_DIR = Path(__file__).parent
| [
"pathlib.Path"
] | [((38, 52), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (42, 52), False, 'from pathlib import Path\n')] |
import numpy as np
import astropy.units as u
from astropy.table import QTable
from jdaviz import Specviz
from specutils import Spectrum1D
def test_line_lists():
viz = Specviz()
spec = Spectrum1D(flux=np.random.rand(100)*u.Jy,
spectral_axis=np.arange(6000, 7000, 10)*u.AA)
viz.load_sp... | [
"astropy.units.Quantity",
"jdaviz.Specviz",
"astropy.table.QTable",
"numpy.arange",
"numpy.random.rand",
"numpy.all"
] | [((174, 183), 'jdaviz.Specviz', 'Specviz', ([], {}), '()\n', (181, 183), False, 'from jdaviz import Specviz\n'), ((343, 351), 'astropy.table.QTable', 'QTable', ([], {}), '()\n', (349, 351), False, 'from astropy.table import QTable\n'), ((449, 466), 'astropy.units.Quantity', 'u.Quantity', (['(0.046)'], {}), '(0.046)\n',... |
from splinter import Browser
from bs4 import BeautifulSoup
from webdriver_manager.chrome import ChromeDriverManager
import time
import pandas as pd
def init_browser():
# @NOTE: Replace the path with your actual path to the chromedriver
executable_path = {"executable_path": ChromeDriverManager().install()}
... | [
"pandas.read_html",
"time.sleep",
"webdriver_manager.chrome.ChromeDriverManager",
"bs4.BeautifulSoup",
"splinter.Browser"
] | [((328, 380), 'splinter.Browser', 'Browser', (['"""chrome"""'], {'headless': '(False)'}), "('chrome', **executable_path, headless=False)\n", (335, 380), False, 'from splinter import Browser\n'), ((530, 543), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (540, 543), False, 'import time\n'), ((585, 619), 'bs4.Beaut... |
from sklearn.decomposition import LatentDirichletAllocation
from sklearn.datasets import make_multilabel_classification
X, Y = make_multilabel_classification(n_samples=100, n_features=20, n_classes=5, n_labels=2, random_state=1)
LDAModel = LatentDirichletAllocation(n_components=5, random_state=1)
LDAModel.fit(X)
# ge... | [
"sklearn.datasets.make_multilabel_classification",
"sklearn.decomposition.LatentDirichletAllocation"
] | [((128, 233), 'sklearn.datasets.make_multilabel_classification', 'make_multilabel_classification', ([], {'n_samples': '(100)', 'n_features': '(20)', 'n_classes': '(5)', 'n_labels': '(2)', 'random_state': '(1)'}), '(n_samples=100, n_features=20, n_classes=5,\n n_labels=2, random_state=1)\n', (158, 233), False, 'from ... |
"""
Simple utils to save and load from disk.
"""
import joblib
import gzip
import pickle
import os
import tempfile
import tarfile
import zipfile
import logging
from urllib.request import urlretrieve
from typing import Any, Iterator, List, Optional, Tuple, Union, cast, IO
import pandas as pd
import numpy as np
import ... | [
"pickle.dump",
"numpy.load",
"pandas.read_csv",
"typing.cast",
"joblib.dump",
"os.path.isfile",
"pickle.load",
"rdkit.Chem.MolToSmiles",
"os.path.join",
"numpy.pad",
"pandas.DataFrame",
"os.path.exists",
"tarfile.open",
"pandas.concat",
"numpy.save",
"numpy.asarray",
"zipfile.ZipFile... | [((345, 372), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (362, 372), False, 'import logging\n'), ((1004, 1017), 'numpy.asarray', 'np.asarray', (['x'], {}), '(x)\n', (1014, 1017), True, 'import numpy as np\n'), ((1351, 1404), 'numpy.pad', 'np.pad', (['x', 'pad'], {'mode': '"""constant"... |
import sys
sys.path.append("..")
import logging
import operator
import os
import remi.gui as gui
from remi import start, App
from remidatatable import DataTableWithServerSideProcessing
sample_data = (
("Soul Man", "Blues Brothers", "Blues", "2:52"),
("Another Brick in the Wall", "Pink Floyd", "Progressive... | [
"sys.path.append",
"remidatatable.DataTableWithServerSideProcessing.get_res_path",
"logging.StreamHandler",
"remi.start",
"operator.itemgetter",
"logging.getLogger",
"remi.gui.HBox"
] | [((11, 32), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (26, 32), False, 'import sys\n'), ((1411, 1447), 'logging.getLogger', 'logging.getLogger', (['"""server_side_app"""'], {}), "('server_side_app')\n", (1428, 1447), False, 'import logging\n'), ((1463, 1486), 'logging.StreamHandler', 'loggin... |
# Generated by Django 3.0.4 on 2020-03-30 12:04
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... | [
"django.db.models.TextField",
"django.db.models.OneToOneField",
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.IntegerField"
] | [((247, 304), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (278, 304), False, 'from django.db import migrations, models\n'), ((2936, 3025), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'djang... |
from django.db import models
class Actor(models.Model):
name = models.CharField(max_length=70)
name_beautified = models.CharField(max_length=70)
link = models.CharField(max_length=255)
class Movie(models.Model):
name = models.CharField(max_length=70)
name_beautified = models.CharField(max_length... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((69, 100), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (85, 100), False, 'from django.db import models\n'), ((123, 154), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(70)'}), '(max_length=70)\n', (139, 154), False, 'from django.db impo... |