code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import re
from collections import OrderedDict
import pandas as pd
import numpy as np
import probablepeople
import usaddress
STATES = {"AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DC", "DE", "FL", "GA",
"HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD",
"MA", "MI", "MN", "MS", "MO", "MT", "N... | [
"pandas.isnull",
"collections.OrderedDict",
"usaddress.parse",
"probablepeople.tag",
"probablepeople.parse",
"usaddress.tag",
"re.sub"
] | [((1085, 1106), 'usaddress.parse', 'usaddress.parse', (['addr'], {}), '(addr)\n', (1100, 1106), False, 'import usaddress\n'), ((3080, 3166), 're.sub', 're.sub', (['"""(not\\\\s*available|not\\\\s*provided|n/a)"""', '""""""', 'concat'], {'flags': 're.IGNORECASE'}), "('(not\\\\s*available|not\\\\s*provided|n/a)', '', con... |
import librosa
import numpy as np
import extract_feat as ef
local_config = {
'batch_size': 1,
'eps': 1e-5,
'sample_rate': 22050,
'load_size': 22050*20,
'name_scope': 'SoundNet',
'phase': 'extract',
}
def analyse_sound(path):
x,... | [
"numpy.reshape",
"librosa.get_duration",
"numpy.load",
"extract_feat.extract_feat",
"librosa.load"
] | [((326, 344), 'librosa.load', 'librosa.load', (['path'], {}), '(path)\n', (338, 344), False, 'import librosa\n'), ((354, 377), 'librosa.get_duration', 'librosa.get_duration', (['x'], {}), '(x)\n', (374, 377), False, 'import librosa\n'), ((428, 456), 'numpy.reshape', 'np.reshape', (['x', '[1, -1, 1, 1]'], {}), '(x, [1, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
File: aapt2/aapt.py
Project: aapt
Description:
Created By: Tao.Hu 2019-07-08
-----
Last Modified: 2020-10-14 02:03:42 pm
Modified By: <NAME>
-----
'''
import os
import re
import stat
import subprocess
import platform
import io
def aapt(args='--help'):
try:
... | [
"subprocess.check_output",
"subprocess.getoutput",
"re.compile",
"os.access",
"io.BytesIO",
"os.chmod",
"os.path.dirname",
"platform.system"
] | [((376, 393), 'platform.system', 'platform.system', ([], {}), '()\n', (391, 393), False, 'import platform\n'), ((912, 956), 'subprocess.getoutput', 'subprocess.getoutput', (["(aapt_path + ' ' + args)"], {}), "(aapt_path + ' ' + args)\n", (932, 956), False, 'import subprocess\n'), ((625, 650), 'os.path.dirname', 'os.pat... |
from typing import List
from flask import current_app
from models.game import Game
from models.game_word import GameWord
import services.token_service as token_service
import services.user_service as user_service
import services.lobby_service as lobby_service
db = current_app.db
def get_game(game_id: int = None, ga... | [
"services.lobby_service.get_lobby",
"services.token_service.generate_token",
"services.user_service.get_user",
"models.game.Game.query.filter",
"models.game_word.GameWord",
"models.game.Game",
"models.game_word.GameWord.query.filter"
] | [((1051, 1083), 'services.token_service.generate_token', 'token_service.generate_token', (['(16)'], {}), '(16)\n', (1079, 1083), True, 'import services.token_service as token_service\n'), ((1100, 1135), 'services.user_service.get_user', 'user_service.get_user', (['moderator_id'], {}), '(moderator_id)\n', (1121, 1135), ... |
from PyQt5.QtWidgets import QPushButton
from ..._base_layer import QtLayer
class QtLabelsLayer(QtLayer):
def __init__(self, layer):
super().__init__(layer)
self.layer.events.colormap.connect(self._on_colormap_change)
self.colormap_update = QPushButton('shuffle colors')
self.color... | [
"PyQt5.QtWidgets.QPushButton"
] | [((272, 301), 'PyQt5.QtWidgets.QPushButton', 'QPushButton', (['"""shuffle colors"""'], {}), "('shuffle colors')\n", (283, 301), False, 'from PyQt5.QtWidgets import QPushButton\n')] |
#
# Copyright 2019 The FATE 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 appli... | [
"fate_flow.utils.service_utils.ServiceUtils.get_item",
"arch.api.utils.file_utils.load_json_conf_real_time"
] | [((1394, 1438), 'fate_flow.utils.service_utils.ServiceUtils.get_item', 'ServiceUtils.get_item', (['"""fatemanager"""', '"""host"""'], {}), "('fatemanager', 'host')\n", (1415, 1438), False, 'from fate_flow.utils.service_utils import ServiceUtils\n'), ((1456, 1500), 'fate_flow.utils.service_utils.ServiceUtils.get_item', ... |
import numpy as np
from system_env import system_models
def random_intelligent_agent(network_hp, system, controller, channels, policy, horizon, epochs, system_noise,
channel_init, channel_transitions):
resources = sum(network_hp['model_quantities'])
action_size = system... | [
"system_env.system_models.BaseNetworkGE",
"numpy.reshape",
"numpy.random.choice",
"numpy.array",
"numpy.zeros",
"numpy.sum"
] | [((347, 384), 'system_env.system_models.BaseNetworkGE', 'system_models.BaseNetworkGE', (['channels'], {}), '(channels)\n', (374, 384), False, 'from system_env import system_models\n'), ((736, 770), 'numpy.zeros', 'np.zeros', (['(resources, action_size)'], {}), '((resources, action_size))\n', (744, 770), True, 'import n... |
from __future__ import absolute_import
import collections
import time
from .cache import Cache
# Python 2 and 3 compatibility
if hasattr(dict(), "iteritems"):
iteritems = lambda d, *args, **kwargs: d.iteritems(*args, **kwargs) # noqa
else:
iteritems = lambda d, *args, **kwargs: iter(d.items(*args, **kwargs))... | [
"collections.OrderedDict"
] | [((1237, 1262), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1260, 1262), False, 'import collections\n'), ((1286, 1311), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (1309, 1311), False, 'import collections\n')] |
#!/usr/bin/env python
#
# Copyright 2019 DFKI GmbH.
#
# 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, merg... | [
"collections.OrderedDict",
"numpy.array",
"numpy.zeros",
"copy.deepcopy",
"json.load"
] | [((1610, 1651), 'numpy.zeros', 'np.zeros', (['skeleton.reference_frame_length'], {}), '(skeleton.reference_frame_length)\n', (1618, 1651), True, 'import numpy as np\n'), ((3048, 3069), 'numpy.zeros', 'np.zeros', (['(n_j * 4 + 3)'], {}), '(n_j * 4 + 3)\n', (3056, 3069), True, 'import numpy as np\n'), ((3874, 3889), 'num... |
# Copyright 2014 Cisco Systems, Inc. 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 requir... | [
"mock.patch",
"mock.Mock",
"testtools.ExpectedException",
"neutron.openstack.common.log.getLogger",
"neutron.plugins.cisco.cfg_agent.cfg_agent.CiscoCfgAgentWithStateReport",
"oslo.config.cfg.ConfigOpts",
"oslo.config.cfg.CONF.set_override",
"neutron.agent.common.config.register_agent_state_opts_helper... | [((1096, 1123), 'neutron.openstack.common.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1113, 1123), True, 'from neutron.openstack.common import log as logging\n'), ((5510, 5624), 'mock.patch', 'mock.patch', (['"""neutron.plugins.cisco.cfg_agent.cfg_agent.CiscoCfgAgentWithStateReport._agent_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import spacy
nlp = spacy.load('./models/model-best')
doc = nlp('sô solte ime ouch di burc wesen vile tiure ne hæte si mit den viure unde mit den mangen niet bestân')
for w in doc:
print(f'{w.text} – {w.tag_}')
| [
"spacy.load"
] | [((68, 101), 'spacy.load', 'spacy.load', (['"""./models/model-best"""'], {}), "('./models/model-best')\n", (78, 101), False, 'import spacy\n')] |
from pyrogram import Client, Message
from bot import LOCAL, CONFIG
from bot.handlers import help_message_handler
async def func(client : Client, message: Message):
try:
await message.delete()
except:
pass
if ' '.join(message.command[1:]) == CONFIG.BOT_PASSWORD:
CONFIG.CHAT_ID.append... | [
"bot.handlers.help_message_handler.func",
"bot.CONFIG.CHAT_ID.append"
] | [((299, 337), 'bot.CONFIG.CHAT_ID.append', 'CONFIG.CHAT_ID.append', (['message.chat.id'], {}), '(message.chat.id)\n', (320, 337), False, 'from bot import LOCAL, CONFIG\n'), ((352, 394), 'bot.handlers.help_message_handler.func', 'help_message_handler.func', (['client', 'message'], {}), '(client, message)\n', (377, 394),... |
import os
import autocleus.cmd as cmd
import jinja2
from jinja2 import Environment, PackageLoader, select_autoescape, StrictUndefined
def find_license(license):
"""
Return base license class
Args:
license(str): name of license file (Apache2, BSD3, MIT)
"""
return cmd.get_module('licens... | [
"autocleus.cmd.get_module"
] | [((298, 388), 'autocleus.cmd.get_module', 'cmd.get_module', (['"""licenses"""'], {'modpath': '"""autocleus.library"""', 'mod': 'f"""{license}LicenseClass"""'}), "('licenses', modpath='autocleus.library', mod=\n f'{license}LicenseClass')\n", (312, 388), True, 'import autocleus.cmd as cmd\n')] |
import svgwrite
DEFAULTS = {"stroke_width" : "3", "stroke" : "black",
"fill" : "white", "fill_opacity" : "1",
"font_size" : "36pt"}
class SVGEngine():
def __init__(self, width, height, filename = None):
self.size = (width,height)
self.filename = filename
self.svg_do... | [
"svgwrite.Drawing"
] | [((324, 361), 'svgwrite.Drawing', 'svgwrite.Drawing', (['filename', 'self.size'], {}), '(filename, self.size)\n', (340, 361), False, 'import svgwrite\n')] |
# ----------------------------------------------------------------------
# |
# | EnumTypeInfo_UnitTest.py
# |
# | <NAME> <<EMAIL>>
# | 2016-09-06 17:31:15
# |
# ----------------------------------------------------------------------
# |
# | Copyright <NAME> 2016-18.
# | Distributed under the B... | [
"sys.executable.lower",
"unittest.main",
"os.path.split",
"CommonEnvironment.Package.NameInfo",
"os.path.abspath"
] | [((821, 852), 'os.path.split', 'os.path.split', (['_script_fullpath'], {}), '(_script_fullpath)\n', (834, 852), False, 'import os\n'), ((708, 733), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (723, 733), False, 'import os\n'), ((935, 964), 'CommonEnvironment.Package.NameInfo', 'Package.Nam... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import numpy as np
def calc_model(indexes, dt, n_preds, mvals, parvals, mults, heats, heatsinks):
deriv = np.zeros(n_preds)
def dT_dt(j, y):
deriv[:] = 0.0
# Couplings with other nodes
for i in xrange(len(mults)):
... | [
"numpy.zeros"
] | [((175, 192), 'numpy.zeros', 'np.zeros', (['n_preds'], {}), '(n_preds)\n', (183, 192), True, 'import numpy as np\n')] |
import logging
import numpy as np
import sklearn.preprocessing as prep
from sklearn.linear_model import LogisticRegression
from sklearn.svm import LinearSVC
from sklearn.utils import check_random_state
from csrank.objectranking.object_ranker import ObjectRanker
from csrank.tunable import Tunable
from csrank.util impo... | [
"logging.getLogger",
"sklearn.utils.check_random_state",
"sklearn.svm.LinearSVC",
"sklearn.linear_model.LogisticRegression",
"sklearn.preprocessing.StandardScaler",
"numpy.array",
"numpy.sum",
"numpy.append",
"csrank.util.print_dictionary"
] | [((1818, 1846), 'logging.getLogger', 'logging.getLogger', (['"""RankSVM"""'], {}), "('RankSVM')\n", (1835, 1846), False, 'import logging\n'), ((1875, 1907), 'sklearn.utils.check_random_state', 'check_random_state', (['random_state'], {}), '(random_state)\n', (1893, 1907), False, 'from sklearn.utils import check_random_... |
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import copy
import torchvision
import torchvision.transforms as transforms
import numpy as np
from PyHessian.pyhessian import hessian # Hessian computation
from ResNet_CIFAR10 import *
fro... | [
"torchvision.datasets.CIFAR100",
"torch.nn.CrossEntropyLoss",
"numpy.sqrt",
"numpy.array",
"torch.cuda.is_available",
"copy.deepcopy",
"argparse.ArgumentParser",
"os.path.isdir",
"os.mkdir",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomHorizontalFlip",
"torch.Tensor",
"to... | [((1852, 1924), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Finetuning for verification error"""'}), "(description='Finetuning for verification error')\n", (1875, 1924), False, 'import argparse\n'), ((6082, 6175), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['hessia... |
# -*- coding:utf-8 -*-
"""
服务配置
Author: HuangTao
Date: 2018/05/03
"""
import json
from quant.utils import logger
class Config:
""" 服务配置
"""
def __init__(self):
""" 配置项
`SERVER_ID` 服务ID
`RUN_TIME_UPDATE` 是否支持配置动态更新
`LOG` 日志配置
`R... | [
"quant.event.EventConfig",
"json.loads",
"quant.utils.logger.error",
"quant.utils.logger.info"
] | [((1772, 1822), 'quant.utils.logger.info', 'logger.info', (['"""config update success!"""'], {'caller': 'self'}), "('config update success!', caller=self)\n", (1783, 1822), False, 'from quant.utils import logger\n'), ((1595, 1666), 'quant.utils.logger.error', 'logger.error', (['"""params format error! params:"""', 'eve... |
#!/usr/bin/env python
#----------------------------------------------------------------------------
#
# TSDuck sample Python application running a chain of plugins:
# Filter tables using --log-hexa-line to get binary tables in a Python class.
#
# See sample-filter-tables-event.py for an equivalent example using plugin
... | [
"tsduck.TSProcessor"
] | [((1126, 1149), 'tsduck.TSProcessor', 'tsduck.TSProcessor', (['rep'], {}), '(rep)\n', (1144, 1149), False, 'import tsduck\n')] |
from django.test import TestCase
from .models import baseModel
from .helpers import *
from apps.user.models import User
# Create your tests here.
USER_DATA = {
'email': '<EMAIL>',
'first_name': 'test_user1',
'last_name': 'user1',
'mobile_no': '1111111',
}
def prepare_dummy_user_data():
user_obj =... | [
"apps.user.models.User.objects.first",
"apps.user.models.User.objects.create"
] | [((321, 353), 'apps.user.models.User.objects.create', 'User.objects.create', ([], {}), '(**USER_DATA)\n', (340, 353), False, 'from apps.user.models import User\n'), ((854, 874), 'apps.user.models.User.objects.first', 'User.objects.first', ([], {}), '()\n', (872, 874), False, 'from apps.user.models import User\n')] |
from django.urls import path
from django.conf import settings
from django.conf.urls.static import static
from .views import CampaignListView
urlpatterns = [
path('', CampaignListView.as_view(), name='campaign_list'),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
| [
"django.conf.urls.static.static"
] | [((227, 288), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (233, 288), False, 'from django.conf.urls.static import static\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-03 06:29
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('bpay', '0008_auto_20170203_1045'),
]
operations = ... | [
"django.db.models.EmailField",
"django.db.models.AutoField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((1107, 1202), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""bpay.BillerCodeSystem"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'bpay.BillerCodeSystem')\n", (1124, 1202), False, 'from django.db import migrations, models\n'), ((43... |
import pytest
import asyncio
from contextlib import asynccontextmanager
import pathlib
import os.path
from dask.distributed import Client
DIR = pathlib.Path(__file__).parent.absolute()
@pytest.fixture()
async def gen_cluster(k8s_cluster):
"""Yields an instantiated context manager for creating/deleting a simpl... | [
"pathlib.Path",
"dask.distributed.Client",
"asyncio.sleep",
"pytest.fixture",
"pytest.mark.timeout"
] | [((192, 208), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (206, 208), False, 'import pytest\n'), ((3100, 3124), 'pytest.mark.timeout', 'pytest.mark.timeout', (['(180)'], {}), '(180)\n', (3119, 3124), False, 'import pytest\n'), ((148, 170), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (1... |
"""
Refresh token controller class
"""
from flask import request
from flask_restx import Resource, marshal
from ..service.refresh_token_service import refresh_token
from ..dto.token_to import TokenDto
api = TokenDto.api
_token_payload = TokenDto.token_payload
_token_response = TokenDto.token_response
_token_response_p... | [
"flask_restx.marshal"
] | [((865, 908), 'flask_restx.marshal', 'marshal', (['jwt_token', '_token_response_payload'], {}), '(jwt_token, _token_response_payload)\n', (872, 908), False, 'from flask_restx import Resource, marshal\n'), ((966, 1022), 'flask_restx.marshal', 'marshal', (["{'description': 'BAD REQUEST'}", '_token_response'], {}), "({'de... |
'''
Created on 29 Mar 2019
@author: ssg37927
'''
from numpy import meshgrid, linspace, concatenate, zeros_like, sqrt, int16
def build_cubemap_vector_array(com, mesh_size=10,
min_radius=200,
max_radius=800,
radial_steps=1000... | [
"numpy.sqrt",
"numpy.linspace",
"numpy.zeros_like",
"numpy.concatenate"
] | [((577, 591), 'numpy.zeros_like', 'zeros_like', (['xt'], {}), '(xt)\n', (587, 591), False, 'from numpy import meshgrid, linspace, concatenate, zeros_like, sqrt, int16\n'), ((1380, 1419), 'numpy.sqrt', 'sqrt', (['(xmap ** 2 + ymap ** 2 + zmap ** 2)'], {}), '(xmap ** 2 + ymap ** 2 + zmap ** 2)\n', (1384, 1419), False, 'f... |
import math
rr, x, y = list(map(int, input().split()))
r = math.sqrt(x * x + y * y)
print(math.ceil(rr * x // r), math.ceil(rr * y // r)) | [
"math.ceil",
"math.sqrt"
] | [((60, 84), 'math.sqrt', 'math.sqrt', (['(x * x + y * y)'], {}), '(x * x + y * y)\n', (69, 84), False, 'import math\n'), ((91, 113), 'math.ceil', 'math.ceil', (['(rr * x // r)'], {}), '(rr * x // r)\n', (100, 113), False, 'import math\n'), ((115, 137), 'math.ceil', 'math.ceil', (['(rr * y // r)'], {}), '(rr * y // r)\n... |
# Keplerian fit configuration file for HIP11915
# 15 Mar 2022
# Packages
import pandas as pd
import os
import numpy as np
import radvel
import astropy.units as u
# Global planetary system and datasets parameters
starname = 'HIP11915'
nplanets = 2
instnames = ['HARPS-A', 'HARPS-B']
ntels = len(instnames... | [
"numpy.median",
"pandas.read_csv",
"radvel.prior.EccentricityPrior",
"radvel.Parameters",
"numpy.array",
"radvel.Parameter",
"radvel.prior.Gaussian"
] | [((512, 620), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/thiagofst/HIP11915/main/A/HIP11915_A.txt"""'], {'sep': '""","""'}), "(\n 'https://raw.githubusercontent.com/thiagofst/HIP11915/main/A/HIP11915_A.txt'\n , sep=',')\n", (523, 620), True, 'import pandas as pd\n'), ((620, 642), 'n... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more details.
"""Test identifier schema."""
import pytest
from marshmallow import ValidationError
from invenio_rdm_records... | [
"invenio_rdm_records.services.schemas.metadata.IdentifierSchema",
"pytest.raises",
"invenio_rdm_records.services.schemas.metadata.MetadataSchema"
] | [((1027, 1057), 'pytest.raises', 'pytest.raises', (['ValidationError'], {}), '(ValidationError)\n', (1040, 1057), False, 'import pytest\n'), ((2056, 2086), 'pytest.raises', 'pytest.raises', (['ValidationError'], {}), '(ValidationError)\n', (2069, 2086), False, 'import pytest\n'), ((2294, 2324), 'pytest.raises', 'pytest... |
#!/usr/bin/env python
# coding: utf-8
from __future__ import unicode_literals
import mock
import os
import unittest
from mkdocs import nav, legacy
from mkdocs.exceptions import ConfigurationError
from mkdocs.tests.base import dedent
class SiteNavigationTests(unittest.TestCase):
def test_simple_toc(self):
... | [
"mkdocs.nav.SiteNavigation",
"mkdocs.tests.base.dedent",
"mock.patch.object",
"mkdocs.nav._generate_site_navigation",
"mkdocs.legacy.pages_compat_shim",
"mkdocs.nav.URLContext"
] | [((3270, 3309), 'mock.patch.object', 'mock.patch.object', (['os.path', '"""sep"""', '"""\\\\"""'], {}), "(os.path, 'sep', '\\\\')\n", (3287, 3309), False, 'import mock\n'), ((9463, 9502), 'mock.patch.object', 'mock.patch.object', (['os.path', '"""sep"""', '"""\\\\"""'], {}), "(os.path, 'sep', '\\\\')\n", (9480, 9502), ... |
#!/usr/bin/env python
# coding=utf-8
import numpy as np
def information_entropy(x, p):
ret = [0] * (len(x)+1)
for i in range(len(x)):
ret[i] = -p[i] * np.log2(p[i])
result = np.sum(ret[i])
return result
| [
"numpy.sum",
"numpy.log2"
] | [((200, 214), 'numpy.sum', 'np.sum', (['ret[i]'], {}), '(ret[i])\n', (206, 214), True, 'import numpy as np\n'), ((169, 182), 'numpy.log2', 'np.log2', (['p[i]'], {}), '(p[i])\n', (176, 182), True, 'import numpy as np\n')] |
from random import randint
class Student:
_id = str()
_name = str()
_lastname = str()
def __init__(self, id: int = None, name: str = "", lastname: str = ""):
self.setId(id)
self.setName(name)
self.setLastname(lastname)
def setId(self, id: int) -> None:
if id:
... | [
"random.randint"
] | [((397, 413), 'random.randint', 'randint', (['(0)', '(9999)'], {}), '(0, 9999)\n', (404, 413), False, 'from random import randint\n')] |
# Copyright 2015, Google Inc.
# 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 list of conditions and the f... | [
"threading.Condition"
] | [((1819, 1840), 'threading.Condition', 'threading.Condition', ([], {}), '()\n', (1838, 1840), False, 'import threading\n')] |
# (c) 2021 <NAME>
import jax.numpy as jnp
import numpy as np
from jax import vmap
from jax.flatten_util import ravel_pytree
from myriad.config import Config, HParams
from myriad.custom_types import Control, Cost, DState, Params, State, Timestep, DStates
from myriad.trajectory_optimizers.base import TrajectoryOptimize... | [
"jax.numpy.zeros",
"jax.numpy.hstack",
"jax.numpy.vstack",
"jax.flatten_util.ravel_pytree",
"numpy.empty",
"numpy.expand_dims",
"myriad.utils.integrate_time_independent",
"jax.numpy.linspace",
"jax.vmap"
] | [((1217, 1262), 'jax.numpy.zeros', 'jnp.zeros', (['(num_intervals + 1, control_shape)'], {}), '((num_intervals + 1, control_shape))\n', (1226, 1262), True, 'import jax.numpy as jnp\n'), ((2191, 2223), 'jax.flatten_util.ravel_pytree', 'ravel_pytree', (['(x_guess, u_guess)'], {}), '((x_guess, u_guess))\n', (2203, 2223), ... |
"""Test the collective reducescatter API on a distributed Ray cluster."""
import pytest
import ray
import cupy as cp
import torch
from ray.util.collective.tests.util import \
create_collective_multigpu_workers, \
init_tensors_for_gather_scatter_multigpu
@pytest.mark.parametrize("tensor_backend", ["cupy", "t... | [
"cupy.ones",
"ray.util.collective.tests.util.init_tensors_for_gather_scatter_multigpu",
"ray.util.collective.tests.util.create_collective_multigpu_workers",
"pytest.main",
"pytest.mark.parametrize",
"torch.ones"
] | [((267, 327), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""tensor_backend"""', "['cupy', 'torch']"], {}), "('tensor_backend', ['cupy', 'torch'])\n", (290, 327), False, 'import pytest\n'), ((329, 429), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""array_size"""', '[2, 2 ** 5, 2 ** 10, 2 ** 1... |
import re
from os import environ
import boto3
import pytest
from botocore.exceptions import ClientError
from moto import mock_efs
from tests.test_efs.junk_drawer import has_status_code
ARN_PATT = r"^arn:(?P<Partition>[^:\n]*):(?P<Service>[^:\n]*):(?P<Region>[^:\n]*):(?P<AccountID>[^:\n]*):(?P<Ignore>(?P<ResourceType... | [
"boto3.client",
"tests.test_efs.junk_drawer.has_status_code",
"re.match",
"moto.mock_efs",
"pytest.raises",
"pytest.fixture"
] | [((966, 998), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (980, 998), False, 'import pytest\n'), ((1253, 1285), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (1267, 1285), False, 'import pytest\n'), ((1735, 1771), 'tests... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
import pytest
from astropy.coordinates import SkyCoord
import astropy.units as u
from regions import CircleSkyRegion
from ...data i... | [
"astropy.coordinates.SkyCoord"
] | [((881, 921), 'astropy.coordinates.SkyCoord', 'SkyCoord', (['(83.633083)', '(22.0145)'], {'unit': '"""deg"""'}), "(83.633083, 22.0145, unit='deg')\n", (889, 921), False, 'from astropy.coordinates import SkyCoord\n'), ((1971, 2023), 'astropy.coordinates.SkyCoord', 'SkyCoord', (['(83.63 * u.deg)', '(22.01 * u.deg)'], {'f... |
import math
r =3
R =4
d =3**0.5
part1 = r*r*math.acos((d*d + r*r - R*R)/(2*d*r));
part2 = R*R*math.acos((d*d + R*R - r*r)/(2*d*R));
part3 = 0.5*math.sqrt((-d+r+R)*(d+r-R)*(d-r+R)*(d+r+R));
intersectionArea = part1 + part2 - part3;
print(intersectionArea)
| [
"math.sqrt",
"math.acos"
] | [((51, 99), 'math.acos', 'math.acos', (['((d * d + r * r - R * R) / (2 * d * r))'], {}), '((d * d + r * r - R * R) / (2 * d * r))\n', (60, 99), False, 'import math\n'), ((102, 150), 'math.acos', 'math.acos', (['((d * d + R * R - r * r) / (2 * d * R))'], {}), '((d * d + R * R - r * r) / (2 * d * R))\n', (111, 150), Fals... |
import logging
from django.core.management.base import BaseCommand
from sqlalchemy.exc import DatabaseError
from ...utils.annotation import annotate_content
from ...utils.channel_import import FutureSchemaError
from ...utils.channel_import import import_channel_from_local_db
from ...utils.channel_import import Invali... | [
"logging.getLogger",
"kolibri.core.content.utils.paths.get_content_database_dir_path",
"kolibri.core.content.models.ChannelMetadata.objects.all"
] | [((552, 579), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (569, 579), False, 'import logging\n'), ((1037, 1068), 'kolibri.core.content.utils.paths.get_content_database_dir_path', 'get_content_database_dir_path', ([], {}), '()\n', (1066, 1068), False, 'from kolibri.core.content.utils.pa... |
#!/usr/bin/env python2.6
#-*- coding: utf-8 -*-
# Copyright [OnePanel]
#
# 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 b... | [
"com.set_ui.SetUI",
"os.path.join",
"os.path.dirname",
"com.config.Config",
"os.getpid",
"com.utils.make_cookie_secret"
] | [((715, 745), 'os.path.join', 'os.path.join', (['root_path', '"""lib"""'], {}), "(root_path, 'lib')\n", (727, 745), False, 'import os\n'), ((1397, 1453), 'com.config.Config', 'com.config.Config', (["(settings['data_path'] + '/config.ini')"], {}), "(settings['data_path'] + '/config.ini')\n", (1414, 1453), False, 'import... |
"""
Missile Defence Game
Building generation, drawing and destruction module.
Copyright (C) 2011-2012 <NAME>.
See LICENSE (GNU GPL version 3 or later).
"""
import numpy
from random import uniform
def generate_city(resolution):
# create a byte array for buildings info
# we will use 0 for e... | [
"numpy.ma.shape",
"numpy.zeros",
"random.uniform"
] | [((356, 391), 'numpy.zeros', 'numpy.zeros', (['resolution', 'numpy.int8'], {}), '(resolution, numpy.int8)\n', (367, 391), False, 'import numpy\n'), ((1365, 1390), 'numpy.ma.shape', 'numpy.ma.shape', (['pixeldata'], {}), '(pixeldata)\n', (1379, 1390), False, 'import numpy\n'), ((458, 471), 'random.uniform', 'uniform', (... |
from agent import *
from monitor import interact
import gym
import numpy as np
env = gym.make('Taxi-v2')
agent = Sarsa()
avg_rewards, best_avg_reward = interact(env, agent) | [
"gym.make",
"monitor.interact"
] | [((86, 105), 'gym.make', 'gym.make', (['"""Taxi-v2"""'], {}), "('Taxi-v2')\n", (94, 105), False, 'import gym\n'), ((153, 173), 'monitor.interact', 'interact', (['env', 'agent'], {}), '(env, agent)\n', (161, 173), False, 'from monitor import interact\n')] |
from abc import ABCMeta, abstractmethod
from collections import defaultdict
from counter_backport import Counter
from elfstatsd import utils, settings
class Storage():
"""Abstract class used as a parent for statistics storages"""
__metaclass__ = ABCMeta
def __init__(self, name):
self.name = name... | [
"collections.defaultdict",
"elfstatsd.utils.format_value_for_munin"
] | [((582, 599), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (593, 599), False, 'from collections import defaultdict\n'), ((2867, 2887), 'collections.defaultdict', 'defaultdict', (['Counter'], {}), '(Counter)\n', (2878, 2887), False, 'from collections import defaultdict\n'), ((7885, 7905), 'colle... |
# This file is part of COFFEE
#
# COFFEE is Copyright (c) 2014, Imperial College London.
# Please see the AUTHORS file in the main source directory for
# a full list of copyright holders. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided ... | [
"six.moves.zip"
] | [((7094, 7163), 'six.moves.zip', 'zip', (['[l.dim for l, p in to_replace_loops_info]', 'to_replace_loops_info'], {}), '([l.dim for l, p in to_replace_loops_info], to_replace_loops_info)\n', (7097, 7163), False, 'from six.moves import zip\n'), ((3157, 3183), 'six.moves.zip', 'zip', (['self.dims', 'self.loops'], {}), '(s... |
#code
from collections import Counter
def majority(array,n):
Dictfreq = Counter(array)
for (element,value) in Dictfreq.items():
if (value > (n/2)):
return element
return -1
if __name__ == "__main__":
t = int(input())
arr=[]
for j in range(0,t):
n = int(input())
... | [
"collections.Counter"
] | [((77, 91), 'collections.Counter', 'Counter', (['array'], {}), '(array)\n', (84, 91), False, 'from collections import Counter\n')] |
"""
============
Radian ticks
============
Plot with radians from the basic_units mockup example package.
This example shows how the unit class can determine the tick locating,
formatting and axis labeling.
"""
import numpy as np
from basic_units import radians, degrees, cos
from matplotlib.pyplot import figure, show... | [
"matplotlib.pyplot.figure",
"basic_units.cos",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((381, 389), 'matplotlib.pyplot.figure', 'figure', ([], {}), '()\n', (387, 389), False, 'from matplotlib.pyplot import figure, show\n'), ((565, 571), 'matplotlib.pyplot.show', 'show', ([], {}), '()\n', (569, 571), False, 'from matplotlib.pyplot import figure, show\n'), ((469, 475), 'basic_units.cos', 'cos', (['x'], {}... |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2013 <NAME> <<EMAIL>>
# Copyright (c) 2016 <NAME> <<EMAIL>>
# Copyright (c) 2019 Ansible Project
# Copyright (c) 2020 <NAME> <<EMAIL>>
# Copyright (c) 2021 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Parts... | [
"ansible.module_utils.common.validation.check_required_arguments",
"ansible.module_utils.parsing.convert_bool.BOOLEANS_TRUE.intersection",
"copy.deepcopy",
"ansible.module_utils.basic.remove_values",
"ansible.errors.AnsibleError",
"ansible.module_utils.common.validation.check_type_str",
"ansible.module_... | [((30332, 30362), 'ansible.module_utils.six.add_metaclass', 'six.add_metaclass', (['abc.ABCMeta'], {}), '(abc.ABCMeta)\n', (30349, 30362), False, 'from ansible.module_utils import six\n'), ((4004, 4043), 'copy.deepcopy', 'copy.deepcopy', (['action_plugin._task.args'], {}), '(action_plugin._task.args)\n', (4017, 4043), ... |
# -*- coding: utf-8 -*-
import FWCore.ParameterSet.Config as cms
process = cms.Process("MUSCLEFITMUONPRODUCER")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(1000)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untrac... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.string",
"FWCore.ParameterSet.Config.EndPath",
"FWCore.ParameterSet.Config.InputTag",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.Process",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.P... | [((76, 112), 'FWCore.ParameterSet.Config.Process', 'cms.Process', (['"""MUSCLEFITMUONPRODUCER"""'], {}), "('MUSCLEFITMUONPRODUCER')\n", (87, 112), True, 'import FWCore.ParameterSet.Config as cms\n'), ((1376, 1415), 'FWCore.ParameterSet.Config.Path', 'cms.Path', (['process.MuScleFitMuonProducer'], {}), '(process.MuScleF... |
from setuptools import setup, find_packages
VERSION_NUMBER = '0.1.0'
with open('requirements.txt', 'rb') as handle:
REQUIREMENTS = [
x.decode('utf8') for x in handle.readlines()
]
with open('dev_requirements.txt', 'rb') as handle:
TEST_REQUIREMENTS = [
x.decode('utf8') for x in handle.r... | [
"setuptools.find_packages"
] | [((737, 752), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (750, 752), False, 'from setuptools import setup, find_packages\n')] |
from typing import List, cast
import hither2 as hi
import numpy as np
import spikeextractors as se
import kachery_client as kc
from sortingview.config import job_cache, job_handler
from sortingview.extractors import LabboxEphysSortingExtractor
@hi.function(
'sorting_info', '0.1.3'
)
def sorting_info(sorting_uri):
... | [
"hither2.Job",
"hither2.Config",
"numpy.array",
"hither2.function",
"kachery_client.taskfunction",
"sortingview.extractors.LabboxEphysSortingExtractor"
] | [((246, 282), 'hither2.function', 'hi.function', (['"""sorting_info"""', '"""0.1.3"""'], {}), "('sorting_info', '0.1.3')\n", (257, 282), True, 'import hither2 as hi\n'), ((548, 606), 'kachery_client.taskfunction', 'kc.taskfunction', (['"""sorting_info.3"""'], {'type': '"""pure-calculation"""'}), "('sorting_info.3', typ... |
from functools import reduce
from operator import xor
input()
xs = list(map(int, input().strip().split()))
print(reduce(xor, xs) ^ reduce(xor, range(1, len(xs) + 2)))
| [
"functools.reduce"
] | [((114, 129), 'functools.reduce', 'reduce', (['xor', 'xs'], {}), '(xor, xs)\n', (120, 129), False, 'from functools import reduce\n')] |
from setuptools import setup, find_packages
import os
# provide correct path for version
__version__ = None
here = os.path.dirname(os.path.dirname(__file__))
#exec(open(os.path.join(here, 'weibull\\version.py')).read())
with open('readme.md', 'r') as f:
readme = f.read()
requirements = [
'pandas >= 0.20.0',
... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((132, 157), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (147, 157), False, 'import os\n'), ((822, 837), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (835, 837), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2018 Google LLC
#
# 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, s... | [
"datetime.datetime.strptime",
"compatibility_lib.compatibility_checker.CompatibilityChecker"
] | [((4341, 4387), 'datetime.datetime.strptime', 'datetime.strptime', (['short_date', 'DATETIME_FORMAT'], {}), '(short_date, DATETIME_FORMAT)\n', (4358, 4387), False, 'from datetime import datetime\n'), ((1753, 1797), 'compatibility_lib.compatibility_checker.CompatibilityChecker', 'compatibility_checker.CompatibilityCheck... |
#!/usr/bin/env python
'''
graph a MAVLink log file
<NAME> August 2011
'''
from __future__ import print_function
from builtins import input
from builtins import range
import datetime
import matplotlib
import os
import re
import sys
import time
from math import *
try:
from pymavlink.mavextra import *
except:
pr... | [
"re.compile",
"pylab.savefig",
"pymavlink.mavutil.evaluate_expression",
"sys.exit",
"pymavlink.mavutil.mavlink_connection",
"os.path.exists",
"pylab.draw",
"argparse.ArgumentParser",
"matplotlib.use",
"matplotlib.dates.DateFormatter",
"os.path.splitext",
"pylab.figure",
"re.findall",
"matp... | [((6049, 6084), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (6063, 6084), False, 'from argparse import ArgumentParser\n'), ((8596, 8626), 're.compile', 're.compile', (['"""[A-Z_][A-Z0-9_]+"""'], {}), "('[A-Z_][A-Z0-9_]+')\n", (8606, 8626), False, 'import re\... |
# -*- coding: utf-8 -*-
"""
Seamless Polymorphic Inheritance for Django Models
==================================================
Please see README.rst and DOCS.rst for further information.
Or on the Web:
http://chrisglass.github.com/django_polymorphic/
http://github.com/chrisglass/django_polymorphic
Copyright:
This... | [
"django.db.models.Manager",
"django.contrib.contenttypes.models.ContentType.objects.get_for_id",
"django.contrib.contenttypes.models.ContentType.objects.get_for_model",
"django.db.models.ForeignKey",
"django.utils.six.with_metaclass"
] | [((879, 933), 'django.utils.six.with_metaclass', 'six.with_metaclass', (['PolymorphicModelBase', 'models.Model'], {}), '(PolymorphicModelBase, models.Model)\n', (897, 933), False, 'from django.utils import six\n'), ((2041, 2159), 'django.db.models.ForeignKey', 'models.ForeignKey', (['ContentType'], {'null': '(True)', '... |
import json
from os import write
w = open("json.txt","r",encoding="utf-8")
f = open("dict.txt","w",encoding="utf-8")
arr = json.load(w)
s = dict()
f.write('{')
for item in arr:
s[item["value"]] = item["key"]
print(s)
for key in s:
f.write('"'+str(key)+'"'+':')
f.write('"'+str(s[key])+'"'+',\n')
f.write("}"... | [
"json.load"
] | [((123, 135), 'json.load', 'json.load', (['w'], {}), '(w)\n', (132, 135), False, 'import json\n')] |
# @copyright@
# Copyright (c) 2006 - 2019 Teradata
# All rights reserved. Stacki(r) v5.x stacki.com
# https://github.com/Teradata/stacki/blob/master/LICENSE.txt
# @copyright@
import json
import signal
import zmq
import pprint
import stack.mq
import stack.commands.sync.host
class Subscriber(stack.mq.Subscriber):
def... | [
"signal.signal",
"json.loads",
"signal.pause",
"pprint.PrettyPrinter",
"zmq.Context"
] | [((969, 991), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {}), '()\n', (989, 991), False, 'import pprint\n'), ((1888, 1901), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (1899, 1901), False, 'import zmq\n'), ((2122, 2164), 'signal.signal', 'signal.signal', (['signal.SIGINT', 'self.handler'], {}), '(signal.S... |
import ee
# Initialize the GEE API
# try:
# ee.Initialize()
# except Exception as ee:
# ee.Authenticate()
# ee.Initialize()
# geemap:A Python package for interactive mapping with Google Earth Engine, ipyleaflet, and ipywidgets
# Documentation: https://geemap.org
import geemap
from geemap import ml
import p... | [
"IPython.display.display",
"ee.Image",
"ipywidgets.VBox",
"ipywidgets.Dropdown",
"ipywidgets.Tab",
"ee.ImageCollection",
"geetools.tools.imagecollection.mosaicSameDay",
"ee.Image.pixelArea",
"ee.Reducer.sum",
"geemap.ml.strings_to_classifier",
"ipywidgets.RadioButtons",
"datetime.timedelta",
... | [((1760, 1884), 'ipywidgets.HTML', 'ipw.HTML', (['"""<h3 class= \'text-center\'><font color = \'blue\'>Python-GEE Surface Water Analysis Toolbox v.1.0.3</font>"""'], {}), '(\n "<h3 class= \'text-center\'><font color = \'blue\'>Python-GEE Surface Water Analysis Toolbox v.1.0.3</font>"\n )\n', (1768, 1884), True, '... |
#!/usr/bin/env python
from distutils.core import setup
setup(name='xreco',
version='0.1.0',
description='Utility to record experiment information',
author='<NAME>',
url='https://github.com/t-hanya/xreco',
license='MIT',
packages=['xreco'],
)
| [
"distutils.core.setup"
] | [((57, 251), 'distutils.core.setup', 'setup', ([], {'name': '"""xreco"""', 'version': '"""0.1.0"""', 'description': '"""Utility to record experiment information"""', 'author': '"""<NAME>"""', 'url': '"""https://github.com/t-hanya/xreco"""', 'license': '"""MIT"""', 'packages': "['xreco']"}), "(name='xreco', version='0.1... |
# Configuration file for the Sphinx documentation builder.
# -- Path setup --------------------------------------------------------------
import os
import sys
sys.path.insert(0, os.path.abspath('./..'))
# -- Project information -----------------------------------------------------
project = 'crosslingual-informati... | [
"os.path.abspath"
] | [((180, 203), 'os.path.abspath', 'os.path.abspath', (['"""./.."""'], {}), "('./..')\n", (195, 203), False, 'import os\n')] |
import torch
import torch.nn as nn
def adaptive_head(in_features, num_classes, dropout_p):
"""Creates the head of a model that can accept images of any size.
Modified from fastai:
https://github.com/fastai/fastai/blob/1ad3caafc123cb35fea8b63fee3b82301310207b/fastai/vision/learner.py
Arguments:
... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.BatchNorm1d",
"torch.nn.AdaptiveAvgPool2d",
"torch.nn.Linear",
"torch.nn.AdaptiveMaxPool2d"
] | [((855, 886), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['(in_features * 2)'], {}), '(in_features * 2)\n', (869, 886), True, 'import torch.nn as nn\n'), ((896, 917), 'torch.nn.Dropout', 'nn.Dropout', (['dropout_p'], {}), '(dropout_p)\n', (906, 917), True, 'import torch.nn as nn\n'), ((927, 966), 'torch.nn.Linear', 'nn... |
from django.contrib import admin
from .models import Post, Category, Tag
from mdeditor.widgets import MDEditorWidget
from django.db import models
# Register your models here.
# 在Admin界面注册展示
class PostAdmin(admin.ModelAdmin):
list_display = ['title', 'category', 'created_time', 'modified_time', 'author']
# cl... | [
"django.contrib.admin.site.register"
] | [((805, 841), 'django.contrib.admin.site.register', 'admin.site.register', (['Post', 'PostAdmin'], {}), '(Post, PostAdmin)\n', (824, 841), False, 'from django.contrib import admin\n'), ((842, 886), 'django.contrib.admin.site.register', 'admin.site.register', (['Category', 'CategoryAdmin'], {}), '(Category, CategoryAdmi... |
"""
Django settings for app project.
Generated by 'django-admin startproject' using Django 2.1.15.
For more information on this file, see
https://docs.djangoproject.com/en/2.1/ref/settings/
"""
import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
from typing import List
BASE_DIR = os.p... | [
"os.path.join",
"os.environ.get",
"os.path.abspath",
"os.getenv"
] | [((593, 637), 'os.environ.get', 'os.environ.get', (['"""DJANGO_SECRET_KEY"""', '"""<KEY>"""'], {}), "('DJANGO_SECRET_KEY', '<KEY>')\n", (607, 637), False, 'import os\n'), ((719, 748), 'os.environ.get', 'os.environ.get', (['"""DEBUG"""', '(True)'], {}), "('DEBUG', True)\n", (733, 748), False, 'import os\n'), ((4660, 470... |
import serial
import time
import requests
# ポートの指定
def initialize(port, bps):
port = serial.Serial(port, bps)
#print('圧力センサとの接続を開始しました')
time.sleep(1)
return port
# arduinoへのデータ送信
def send_command(port, byte):
write = port.write(byte)
data = wait_response(port)
#pass
... | [
"requests.post",
"serial.Serial",
"time.sleep"
] | [((96, 120), 'serial.Serial', 'serial.Serial', (['port', 'bps'], {}), '(port, bps)\n', (109, 120), False, 'import serial\n'), ((158, 171), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (168, 171), False, 'import time\n'), ((1320, 1363), 'requests.post', 'requests.post', (['"""http://192.168.11.37/ledon"""'], {}),... |
"""Traditional-based search space.
"""
import copy
import opytimizer.utils.logging as l
from opytimizer.core import Space
logger = l.get_logger(__name__)
class SearchSpace(Space):
"""A SearchSpace class for agents, variables and methods
related to the search space.
"""
def __init__(self, n_agents... | [
"opytimizer.utils.logging.get_logger",
"copy.deepcopy"
] | [((134, 156), 'opytimizer.utils.logging.get_logger', 'l.get_logger', (['__name__'], {}), '(__name__)\n', (146, 156), True, 'import opytimizer.utils.logging as l\n'), ((1264, 1293), 'copy.deepcopy', 'copy.deepcopy', (['self.agents[0]'], {}), '(self.agents[0])\n', (1277, 1293), False, 'import copy\n')] |
from mgz.fast.header import decompress, parse_version
from mgz.summary.full import FullSummary
from mgz.model.compat import ModelSummary
from mgz.util import Version
import logging
import zlib
logger = logging.getLogger(__name__)
class SummaryStub:
def __call__(self, data, playback=None, fallback=False):
... | [
"logging.getLogger",
"mgz.fast.header.decompress",
"mgz.model.compat.ModelSummary",
"mgz.summary.full.FullSummary",
"mgz.fast.header.parse_version"
] | [((203, 230), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (220, 230), False, 'import logging\n'), ((939, 966), 'mgz.summary.full.FullSummary', 'FullSummary', (['data', 'playback'], {}), '(data, playback)\n', (950, 966), False, 'from mgz.summary.full import FullSummary\n'), ((347, 363),... |
# Copyright 2021 Google LLC
#
# 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, ... | [
"jax.numpy.abs",
"jax.numpy.nanmedian",
"jax.numpy.log",
"scipy.interpolate.interp1d",
"jax.tree_map",
"numpy.array",
"numpy.linalg.norm",
"jax.numpy.matmul",
"numpy.mean",
"scipy.spatial.transform.Rotation.from_dcm",
"scipy.interpolate.CubicSpline",
"numpy.max",
"jax.tree_util.tree_map",
... | [((1744, 1804), 'functools.partial', 'functools.partial', (['jax.custom_jvp'], {'nondiff_argnums': '(1, 2, 3)'}), '(jax.custom_jvp, nondiff_argnums=(1, 2, 3))\n', (1761, 1804), False, 'import functools\n'), ((1653, 1706), 'jax.numpy.matmul', 'jnp.matmul', (['a', 'b'], {'precision': 'jax.lax.Precision.HIGHEST'}), '(a, b... |
import json
import pandas as pd
import pytest
from transformers import AutoTokenizer, T5ForConditionalGeneration, DataCollatorForSeq2Seq, T5Config
from datasets import load_dataset
from pathlib import Path
from omegaconf import OmegaConf
from src.common.util import PROJECT_ROOT
import shutil
from promptsource.template... | [
"pandas.DataFrame.from_records",
"src.tracking.get_metrics_for_wandb",
"pathlib.Path",
"json.dumps",
"pandas._testing.assert_frame_equal",
"json.dump"
] | [((2562, 2630), 'src.tracking.get_metrics_for_wandb', 'tracking.get_metrics_for_wandb', (['met_path', 'pred_path'], {'choices': 'choices'}), '(met_path, pred_path, choices=choices)\n', (2592, 2630), False, 'from src import tracking\n'), ((2740, 2780), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['exp... |
# Python 2.7 script to convert text protocol to binary protocol.
#
# Usage:
# python jsonrpc_to_binary.py < jsonrpc-t.bin > jsonrpc-b.bin
import sys
import struct
data = sys.stdin.read()
msgs = [line for line in data.split('\x00') if line.strip()]
for msg in msgs:
hdr = struct.pack('>L', (len(msg) << 8) | 0xF5... | [
"sys.stdin.read",
"sys.stdout.write"
] | [((174, 190), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (188, 190), False, 'import sys\n'), ((326, 353), 'sys.stdout.write', 'sys.stdout.write', (['(hdr + msg)'], {}), '(hdr + msg)\n', (342, 353), False, 'import sys\n')] |
"""
These functions are originally located at `Catalyst. Reproducible and fast DL & RL`_
Some methods were formatted and simplified.
.. _`Catalyst. Reproducible and fast DL & RL`:
https://github.com/catalyst-team/catalyst
"""
import argparse
import copy
import json
import re
from collections import OrderedDict, M... | [
"json.loads",
"argparse.ArgumentParser",
"pathlib.Path",
"yaml.dump",
"re.match",
"safitty.core.set",
"yaml.load",
"pydoc.locate",
"copy.deepcopy",
"copy.copy",
"json.dump"
] | [((997, 1040), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '(**argparser_kwargs)\n', (1020, 1040), False, 'import argparse\n'), ((2072, 2082), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (2076, 2082), False, 'from pathlib import Path\n'), ((2891, 2901), 'pathlib.Path', 'Path', (['path'], {})... |
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from app import errors
if TYPE_CHECKING:
from app.database.database import Database
class Autoredeem:
def __init__(self, db: "Database"):
self.db = db
async def get(
self, guild_id: int, user_id: int
) -> Optional[Dict[str,... | [
"app.errors.AutoRedeemAlreadyOn"
] | [((1250, 1278), 'app.errors.AutoRedeemAlreadyOn', 'errors.AutoRedeemAlreadyOn', ([], {}), '()\n', (1276, 1278), False, 'from app import errors\n')] |
import os
import json
import base64
import lzma
import black
import urllib
from flask import Flask, render_template, request, redirect, url_for, jsonify
from flask_cors import cross_origin
BASE_URL = "https://black.now.sh"
BLACK_VERSION = os.getenv("BLACK_VERSION")
def get_black_version():
lockfile = json.load(... | [
"flask.render_template",
"flask.request.args.get",
"black.format_str",
"base64.urlsafe_b64decode",
"os.getenv",
"flask.Flask",
"black.FileMode",
"base64.urlsafe_b64encode",
"json.dumps",
"flask_cors.cross_origin",
"flask.request.get_json",
"lzma.decompress",
"flask.jsonify"
] | [((241, 267), 'os.getenv', 'os.getenv', (['"""BLACK_VERSION"""'], {}), "('BLACK_VERSION')\n", (250, 267), False, 'import os\n'), ((551, 566), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (556, 566), False, 'from flask import Flask, render_template, request, redirect, url_for, jsonify\n'), ((1169, 1183), ... |
#!/usr/bin/env python
# coding: utf-8
import logging, os, gc, fnmatch, zipfile, glob, shutil, sys, time
from snappy import (ProductIO, GPF, jpy)
from snappy_operator import *
import xml.etree.ElementTree as etree
import config
import datetime
if config.classification_mode == 1:
target_name = config.target_name_dtw... | [
"snappy.ProductIO.readProduct",
"os.path.exists",
"os.listdir",
"os.makedirs",
"datetime.datetime.strptime",
"os.path.splitext",
"time.sleep",
"os.getcwd",
"snappy.jpy.get_type",
"datetime.timedelta"
] | [((819, 830), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (828, 830), False, 'import logging, os, gc, fnmatch, zipfile, glob, shutil, sys, time\n'), ((1227, 1270), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['date1', '"""%Y%m%d"""'], {}), "(date1, '%Y%m%d')\n", (1253, 1270), False, 'import datetime\n'... |
import setuptools
setuptools.setup(
name="photo-organizer",
description="A quick and dirty script/application designed to allow my wife to quickly pre-process 10s of gigabytes of photos she found on some old hard drives. These drives had different organization patterns and many drives contained duplicates.",
... | [
"setuptools.find_packages"
] | [((332, 358), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (356, 358), False, 'import setuptools\n')] |
import sys
import argparse
import time
import torch
import PIL.ImageOps
from tqdm import tqdm
import torch.nn as nn
from torch import optim
import torchvision.utils
from helpers import show_plot
from datetime import datetime
import torch.nn.functional as F
from torch.utils.data import DataLoader, Dataset
import torchvi... | [
"argparse.ArgumentParser",
"helpers.show_plot",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.datasets.ImageFolder",
"siamesenetwork.SiameseNetwork",
"torch.cuda.is_available",
"loss.ContrastiveLoss",
"torch.save",
"torch.utils.data.DataLoader",
"torchvision.transforms.Resize",
"to... | [((707, 732), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (730, 732), False, 'import argparse\n'), ((957, 999), 'torchvision.datasets.ImageFolder', 'dset.ImageFolder', ([], {'root': 'Config.training_dir'}), '(root=Config.training_dir)\n', (973, 999), True, 'import torchvision.datasets as dse... |
"""
PROGRAM TO GET SCARP VIEW COUNT OF ss AND sl
"""
import re
import time
import datetime
import requests
from bs4 import BeautifulSoup
import pandas as pd
scrapeList = [
"https://www.etsy.com/shop/SSweddings",
"https://www.etsy.com/shop/SelineLounge",
"https://www.etsy.com/shop/LeRoseGifts",
"https://www.etsy.com/sh... | [
"time.sleep",
"requests.get",
"bs4.BeautifulSoup",
"datetime.datetime.now",
"re.findall"
] | [((1064, 1081), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1076, 1081), False, 'import requests\n'), ((1090, 1128), 'bs4.BeautifulSoup', 'BeautifulSoup', (['req.content', '"""html5lib"""'], {}), "(req.content, 'html5lib')\n", (1103, 1128), False, 'from bs4 import BeautifulSoup\n'), ((1031, 1054), 'datet... |
import json
import urllib
def get_lat_long(location):
location = urllib.quote_plus(location)
request = "https://maps.googleapis.com/maps/api/geocode/json?address=%s&sensor=false" % location
try:
response = urllib.urlopen(request)
except:
return ''
data = json.load(response)
tr... | [
"json.load",
"urllib.urlopen",
"urllib.quote_plus"
] | [((71, 98), 'urllib.quote_plus', 'urllib.quote_plus', (['location'], {}), '(location)\n', (88, 98), False, 'import urllib\n'), ((294, 313), 'json.load', 'json.load', (['response'], {}), '(response)\n', (303, 313), False, 'import json\n'), ((228, 251), 'urllib.urlopen', 'urllib.urlopen', (['request'], {}), '(request)\n'... |
import unittest
from nose.tools import (assert_in, assert_raises, assert_equals)
import logging
import numpy
from sknn.mlp import Regressor as MLPR
from sknn.mlp import Layer as L, Convolution as C
class TestDataAugmentation(unittest.TestCase):
def setUp(self):
self.called = 0
self.value = 1.0
... | [
"nose.tools.assert_raises",
"sknn.mlp.Layer",
"numpy.zeros",
"nose.tools.assert_equals"
] | [((737, 778), 'nose.tools.assert_equals', 'assert_equals', (['a_in.shape[0]', 'self.called'], {}), '(a_in.shape[0], self.called)\n', (750, 778), False, 'from nose.tools import assert_in, assert_raises, assert_equals\n'), ((915, 969), 'nose.tools.assert_raises', 'assert_raises', (['RuntimeError', 'self.nn._fit', 'a_in',... |
import time
import Adafruit_ADS1x15
adc = Adafruit_ADS1x15.ADS1015()
GAIN = 1
logName = raw_input('Please enter a filename to log the data to: ')
logName = logName + '.txt'
sampleRate = raw_input('Please enter the sample rate (in milliseconds, 10 minimum): ')
fout = open(logName, 'w')
print('Reading ADS... | [
"Adafruit_ADS1x15.ADS1015",
"time.time"
] | [((48, 74), 'Adafruit_ADS1x15.ADS1015', 'Adafruit_ADS1x15.ADS1015', ([], {}), '()\n', (72, 74), False, 'import Adafruit_ADS1x15\n'), ((1324, 1335), 'time.time', 'time.time', ([], {}), '()\n', (1333, 1335), False, 'import time\n')] |
# -*- coding: utf-8 -*-
import activation as a
import numpy as np
import forwardpropagate as fp
import copy
def back_propagation(X, y, al, L, parameters, caches,dropout=False):
m = X.shape[1]
grads = {}
da3 = (-np.divide(y, caches["a3"]) + np.divide(1 - y, 1 - caches["a3"]))
dz3 =... | [
"forwardpropagate.cost",
"activation.relu_back",
"activation.sigmoid_back",
"numpy.sum",
"copy.deepcopy",
"forwardpropagate.forward_propagate",
"numpy.divide"
] | [((275, 309), 'numpy.divide', 'np.divide', (['(1 - y)', "(1 - caches['a3'])"], {}), "(1 - y, 1 - caches['a3'])\n", (284, 309), True, 'import numpy as np\n'), ((327, 355), 'activation.sigmoid_back', 'a.sigmoid_back', (["caches['a3']"], {}), "(caches['a3'])\n", (341, 355), True, 'import activation as a\n'), ((440, 474), ... |
#!/usr/bin/env python
import time
import matplotlib.pyplot as plt
from simple_pid import PID
class WaterBoiler:
"""
Simple simulation of a water boiler which can heat up water
and where the heat dissipates slowly over time
"""
def __init__(self):
self.water_temp = 20
def update(self... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"simple_pid.PID",
"time.time",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((679, 717), 'simple_pid.PID', 'PID', (['(5)', '(0.01)', '(0.1)'], {'setpoint': 'water_temp'}), '(5, 0.01, 0.1, setpoint=water_temp)\n', (682, 717), False, 'from simple_pid import PID\n'), ((769, 780), 'time.time', 'time.time', ([], {}), '()\n', (778, 780), False, 'import time\n'), ((1291, 1323), 'matplotlib.pyplot.pl... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import pytest
from plugins.filter.normalize_pyvenv_apps import convert_string
def test_convert_string():
assert convert_string('foo') == {'name': 'foo'}
def test_foo():
assert True
| [
"plugins.filter.normalize_pyvenv_apps.convert_string"
] | [((205, 226), 'plugins.filter.normalize_pyvenv_apps.convert_string', 'convert_string', (['"""foo"""'], {}), "('foo')\n", (219, 226), False, 'from plugins.filter.normalize_pyvenv_apps import convert_string\n')] |
import argparse
import time
import random
import logging
from live_recorder import you_live
from live_recorder import version
args = None
def arg_parser():
parser = argparse.ArgumentParser(prog='you-live', description="version %s : %s"%(version.__version__, version.__descriptrion__))
parser.add_arg... | [
"random.uniform",
"live_recorder.you_live.Recorder.createRecorder",
"argparse.ArgumentParser",
"time.sleep",
"live_recorder.you_live.MonitoringThread",
"live_recorder.you_live.DownloadThread"
] | [((181, 307), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""you-live"""', 'description': "('version %s : %s' % (version.__version__, version.__descriptrion__))"}), "(prog='you-live', description='version %s : %s' % (\n version.__version__, version.__descriptrion__))\n", (204, 307), False, '... |
import math
import numpy as np
import pandas as pd
from ..custom_types import *
from torchtable.utils import *
from torchtable.field import Field, FieldCollection, CategoricalField, NumericField
from torchtable.dataset import TabularDataset
import torch
import torch.nn as nn
class BatchHandlerModel(nn.Module):
... | [
"torch.nn.ModuleList",
"torch.cat"
] | [((832, 851), 'torch.nn.ModuleList', 'nn.ModuleList', (['embs'], {}), '(embs)\n', (845, 851), True, 'import torch.nn as nn\n'), ((2490, 2527), 'torch.cat', 'torch.cat', (['(cat_data + num_data)'], {'dim': '(1)'}), '(cat_data + num_data, dim=1)\n', (2499, 2527), False, 'import torch\n')] |
import os,sys
from scipy.stats.stats import pearsonr
import numpy as np
try:
bacteriaF = sys.argv[1]
phageF = sys.argv[2]
except:
sys.exit(sys.argv[0] + " <bacterial file> <phage file>")
bact={}
with open(bacteriaF, 'r') as bin:
l=bin.readline()
bactheaders = l.strip().split("\t")
for l in ... | [
"scipy.stats.stats.pearsonr",
"sys.exit"
] | [((146, 202), 'sys.exit', 'sys.exit', (["(sys.argv[0] + ' <bacterial file> <phage file>')"], {}), "(sys.argv[0] + ' <bacterial file> <phage file>')\n", (154, 202), False, 'import os, sys\n'), ((1660, 1689), 'scipy.stats.stats.pearsonr', 'pearsonr', (['phage[ph]', 'bact[ba]'], {}), '(phage[ph], bact[ba])\n', (1668, 1689... |
#--------------------------------------------------------------------------------
# Authors:
# - <NAME>: <EMAIL>
# - <NAME>: <EMAIL>
#
# MIT License
# Copyright (c) 2021 CORSMAL
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (t... | [
"pybullet.getMatrixFromQuaternion",
"pybullet.computeViewMatrix",
"libs.simulation.ur5.ur5",
"pybullet_data.getDataPath",
"pybullet.setTimeStep",
"pybullet.setGravity",
"math.cos",
"numpy.array",
"pybullet.setPhysicsEngineParameter",
"pybullet.disconnect",
"time.sleep",
"numpy.linalg.norm",
... | [((1742, 1827), 'pybullet.computeProjectionMatrixFOV', 'p.computeProjectionMatrixFOV', ([], {'fov': '(90)', 'aspect': '(1.777777778)', 'nearVal': '(0.01)', 'farVal': '(10)'}), '(fov=90, aspect=1.777777778, nearVal=0.01,\n farVal=10)\n', (1770, 1827), True, 'import pybullet as p\n'), ((1882, 1893), 'os.getcwd', 'os.g... |
# coding=utf-8
# Copyright 2021 The TensorFlow Datasets Authors and the HuggingFace Datasets Authors.
# Copyright 2021 Phonetics and Speech Laboratory, Trinity College, Dublin
#
# Based on Corpus Crawler (utils.py):
# Copyright 2017 Google Inc. All rights reserved.
#
# Based on Corpus Crawler's Irish crawler (crawl_ga.... | [
"os.path.exists",
"datasets.SplitGenerator",
"collections.namedtuple",
"hashlib.sha256",
"urllib.parse.urlparse",
"pathlib.Path",
"re.compile",
"datasets.utils.logging.get_logger",
"datasets.BuilderConfig",
"email.message_from_string",
"re.match",
"base64.urlsafe_b64encode",
"struct.pack",
... | [((1543, 1586), 'datasets.utils.logging.get_logger', 'datasets.utils.logging.get_logger', (['__name__'], {}), '(__name__)\n', (1576, 1586), False, 'import datasets\n'), ((5809, 5849), 're.compile', 're.compile', (['"""\\\\<.+?\\\\>"""'], {'flags': 're.DOTALL'}), "('\\\\<.+?\\\\>', flags=re.DOTALL)\n", (5819, 5849), Fal... |
#!/usr/bin/env python3
# ===============================================================================
# NAME: EnumGenerator.py
#
# DESCRIPTION: A generator to produce serializable enum's
#
# AUTHOR: jishii
# EMAIL: <EMAIL>
# DATE CREATED : May 28, 2020
#
# Copyright 2020, California Institute of Technology.
# ALL ... | [
"os.path.exists",
"os.makedirs",
"fprime_ac.generators.templates.arrays.array_hpp.array_hpp",
"os.chdir",
"fprime_ac.parsers.XmlParser.XmlParser",
"fprime_ac.generators.templates.arrays.array_cpp.array_cpp",
"fprime_ac.parsers.XmlArrayParser.XmlArrayParser"
] | [((2284, 2313), 'fprime_ac.parsers.XmlParser.XmlParser', 'XmlParser.XmlParser', (['xml_file'], {}), '(xml_file)\n', (2303, 2313), False, 'from fprime_ac.parsers import XmlParser\n'), ((1104, 1142), 'os.chdir', 'os.chdir', (['gse_serializable_install_dir'], {}), '(gse_serializable_install_dir)\n', (1112, 1142), False, '... |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | [
"logging.getLogger",
"openerp.osv.fields.char",
"dateutil.relativedelta.relativedelta",
"openerp.tools.ustr",
"openerp.osv.fields.many2one",
"openerp.osv.fields.date",
"openerp.osv.fields.datetime",
"openerp.osv.fields.selection",
"operator.itemgetter",
"openerp.osv.fields.boolean",
"openerp.too... | [((1408, 1435), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1425, 1435), False, 'import logging\n'), ((1695, 1935), 'openerp.osv.fields.char', 'fields.char', (['"""Name"""'], {'size': '(64)', 'required': '(True)', 'help': '"""Incoterms are series of sales terms.They are used to divide... |
# TODO: Argparse main
from readme_analyzer import ReadmeAnalyzer
analyzer = ReadmeAnalyzer('src/readme_analyzer_config.cfg')
analyzer.runAll() | [
"readme_analyzer.ReadmeAnalyzer"
] | [((77, 125), 'readme_analyzer.ReadmeAnalyzer', 'ReadmeAnalyzer', (['"""src/readme_analyzer_config.cfg"""'], {}), "('src/readme_analyzer_config.cfg')\n", (91, 125), False, 'from readme_analyzer import ReadmeAnalyzer\n')] |
#!/usr/bin/env python3
import json
import subprocess
import sys
def list_databases():
if len(sys.argv) == 1:
process = subprocess.run(["./terminusdb", "list", "--json"], capture_output=True)
else:
process = subprocess.run(["sudo", "docker", "exec", "-it", "terminusdb", "./terminusdb", "list", ... | [
"json.loads",
"subprocess.run"
] | [((363, 389), 'json.loads', 'json.loads', (['process.stdout'], {}), '(process.stdout)\n', (373, 389), False, 'import json\n'), ((133, 204), 'subprocess.run', 'subprocess.run', (["['./terminusdb', 'list', '--json']"], {'capture_output': '(True)'}), "(['./terminusdb', 'list', '--json'], capture_output=True)\n", (147, 204... |
'''A module for interacting with the bspwm X window manager'''
from subprocess import Popen, PIPE, run, TimeoutExpired
import json
def __process_stdout_generator(proc):
'''Create a generator for a Popen object's STDOUT'''
while proc.poll() is None:
yield from proc.stdout
def subscribe(*subscribe_arg... | [
"subprocess.Popen",
"json.loads",
"subprocess.run"
] | [((920, 943), 'json.loads', 'json.loads', (['proc.stdout'], {}), '(proc.stdout)\n', (930, 943), False, 'import json\n'), ((548, 585), 'subprocess.run', 'run', (['cmd'], {'check': '(True)', 'timeout': 'timeout'}), '(cmd, check=True, timeout=timeout)\n', (551, 585), False, 'from subprocess import Popen, PIPE, run, Timeou... |
from flask.ext.bootstrap import Bootstrap
from flask.ext.moment import Moment
from datetime import datetime
from flask import Flask,render_template,url_for,session,redirect,flash
from flask.ext.script import Manager
from flask.ext.wtf import Form
from wtforms import StringField, SubmitField
from wtforms.validators imp... | [
"flask.render_template",
"flask.ext.script.Manager",
"flask.ext.bootstrap.Bootstrap",
"flask.session.get",
"flask.flash",
"flask.Flask",
"datetime.datetime.utcnow",
"wtforms.SubmitField",
"flask.url_for",
"wtforms.validators.Required",
"flask.ext.moment.Moment"
] | [((470, 485), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (475, 485), False, 'from flask import Flask, render_template, url_for, session, redirect, flash\n'), ((545, 557), 'flask.ext.script.Manager', 'Manager', (['app'], {}), '(app)\n', (552, 557), False, 'from flask.ext.script import Manager\n'), ((568... |
"""
This module contains device descriptions for custom entities.
"""
from __future__ import annotations
from copy import deepcopy
from enum import Enum
import logging
from typing import Any
from voluptuous import Invalid, Optional, Required, Schema
import hahomematic.device as hm_device
import hahomematic.entity as... | [
"logging.getLogger",
"voluptuous.Required",
"hahomematic.helpers.generate_unique_id",
"copy.deepcopy",
"voluptuous.Optional"
] | [((2402, 2429), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2419, 2429), False, 'import logging\n'), ((15220, 15359), 'hahomematic.helpers.generate_unique_id', 'generate_unique_id', ([], {'domain': 'device.central.domain', 'instance_name': 'device.central.instance_name', 'address': 'f... |
import pathlib
from typing import Dict
from app_types import WordSeq
from word import Word
class Words:
words: list[Word]
def __init__(self, letter_groups: str) -> None:
def find_paths(letters: str) -> Dict[str, str]:
'Build dictionary of valid letter-to-letter transitions'
d... | [
"pathlib.Path"
] | [((1071, 1106), 'pathlib.Path', 'pathlib.Path', (['"""resources/words.txt"""'], {}), "('resources/words.txt')\n", (1083, 1106), False, 'import pathlib\n')] |
from flask import Flask
from flask_socketio import SocketIO
from .boxoffice import *
app = Flask(__name__)
if not app.debug:
import os
base_dir = os.path.split(os.path.realpath(__file__))[0]
import logging
from logging.handlers import RotatingFileHandler
file_handler = RotatingFileHandler(base_dir... | [
"os.path.realpath",
"logging.handlers.RotatingFileHandler",
"flask_socketio.SocketIO",
"flask.Flask"
] | [((93, 108), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (98, 108), False, 'from flask import Flask\n'), ((471, 484), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {}), '(app)\n', (479, 484), False, 'from flask_socketio import SocketIO\n'), ((292, 387), 'logging.handlers.RotatingFileHandler', 'Rotati... |
import torch
import torch.nn as nn
# from torchsummary import summary
# from lib.medzoo.BaseModelClass import BaseModel
"""
Implementation od DenseVoxelNet based on https://arxiv.org/abs/1708.00573
Hyperparameters used:
batch size = 3
weight decay = 0.0005
momentum = 0.9
lr = 0.05
"""
def init_weights(m):
"""
... | [
"torch.nn.Dropout",
"torch.nn.ConvTranspose3d",
"torch.nn.LeakyReLU",
"torch.seed",
"torch.nn.Sequential",
"torch.nn.MaxPool3d",
"torch.nn.BatchNorm3d",
"torch.cat",
"torch.nn.Conv3d"
] | [((419, 434), 'torch.seed', 'torch.seed', (['(777)'], {}), '(777)\n', (429, 434), False, 'import torch\n'), ((1400, 1431), 'torch.cat', 'torch.cat', (['[x, new_features]', '(1)'], {}), '([x, new_features], 1)\n', (1409, 1431), False, 'import torch\n'), ((2073, 2107), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['num_inp... |
import numpy as np
import cv2
import os
def render(img_rgb):
img_rgb = cv2.resize(img_rgb, (500,500))
numDownSamples = 2 # number of downscaling steps
numBilateralFilters = 50 # number of bilateral filtering steps
# -- STEP 1 --
# downsample image using Gaussian pyramid
img_color =... | [
"cv2.bilateralFilter",
"cv2.bitwise_and",
"cv2.medianBlur",
"cv2.VideoWriter",
"os.path.isfile",
"cv2.pyrUp",
"cv2.adaptiveThreshold",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.VideoWriter_fourcc",
"cv2.cvtColor",
"cv2.resize",
"cv2.waitKey",
"cv2.pyrDown",
"os.re... | [((2037, 2064), 'os.path.isfile', 'os.path.isfile', (['FILE_OUTPUT'], {}), '(FILE_OUTPUT)\n', (2051, 2064), False, 'import os\n'), ((2101, 2128), 'cv2.VideoCapture', 'cv2.VideoCapture', (['"""pp2.avi"""'], {}), "('pp2.avi')\n", (2117, 2128), False, 'import cv2\n'), ((2308, 2339), 'cv2.VideoWriter_fourcc', 'cv2.VideoWri... |
import sys
sys.path.append('../')
import tensorflow as tf
from google.cloud import storage
from tempfile import TemporaryDirectory
import os
from mreserve.lowercase_encoder import get_encoder
import argparse
from PIL import Image
import numpy as np
from io import BytesIO
import random
encoder = get_encoder()
class GC... | [
"google.cloud.storage.Client",
"tempfile.TemporaryDirectory",
"argparse.ArgumentParser",
"io.BytesIO",
"tensorflow.io.TFRecordWriter",
"tensorflow.train.Int64List",
"tensorflow.train.BytesList",
"os.path.join",
"tensorflow.train.FloatList",
"mreserve.lowercase_encoder.get_encoder",
"sys.path.app... | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((297, 310), 'mreserve.lowercase_encoder.get_encoder', 'get_encoder', ([], {}), '()\n', (308, 310), False, 'from mreserve.lowercase_encoder import get_encoder\n'), ((4384, 4430), 'argparse.ArgumentParse... |
from collections import namedtuple
from math import sqrt, log
import random
from pandits import belief
###############################################################################
Observation = namedtuple("Observation", ["arm_id", "reward"])
#######################################################################... | [
"collections.namedtuple",
"pandits.belief.var_reward",
"pandits.belief.mean_reward",
"math.log",
"pandits.belief.n_played",
"random.random",
"random.randint"
] | [((199, 246), 'collections.namedtuple', 'namedtuple', (['"""Observation"""', "['arm_id', 'reward']"], {}), "('Observation', ['arm_id', 'reward'])\n", (209, 246), False, 'from collections import namedtuple\n'), ((2035, 2071), 'random.randint', 'random.randint', (['(0)', '(self.bandit.n - 1)'], {}), '(0, self.bandit.n - ... |