text stringlengths 213 32.3k |
|---|
from homeassistant import auth, data_entry_flow
from homeassistant.auth.mfa_modules import auth_mfa_module_from_config
from homeassistant.auth.models import Credentials
from tests.common import MockUser
async def test_validate(hass):
"""Test validating pin."""
auth_module = await auth_mfa_module_from_config... |
import os
import tempfile
import unittest
import homeassistant.components.notify as notify
from homeassistant.setup import async_setup_component, setup_component
from tests.async_mock import patch
from tests.common import assert_setup_component, get_test_home_assistant
class TestCommandLine(unittest.TestCase):
... |
import pytest
from redbot.core import data_manager
__all__ = ["cleanup_datamanager", "data_mgr_config", "cog_instance"]
@pytest.fixture(autouse=True)
def cleanup_datamanager():
data_manager.basic_config = None
@pytest.fixture()
def data_mgr_config(tmpdir):
default = data_manager.basic_config_default.copy... |
import asyncio
import os
import pytest
from homeassistant.components import onboarding
from homeassistant.components.onboarding import const, views
from homeassistant.const import HTTP_FORBIDDEN
from homeassistant.setup import async_setup_component
from . import mock_storage
from tests.async_mock import patch
from... |
from io import BytesIO
import os
import os.path as op
from functools import reduce, partial
import numpy as np
from numpy.testing import (assert_array_almost_equal, assert_array_equal,
assert_allclose, assert_equal)
import pytest
from mne.datasets import testing
from mne.io import read_raw... |
from test import CollectorTestCase
from test import get_collector_config
from test import run_only
from test import unittest
from mock import patch
from pgbouncer import PgbouncerCollector
##########################################################################
def run_only_if_psycopg2_is_available(func):
tr... |
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_HS_COLOR,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
LightEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from . import WiLightDevice
from .const import (
DOMAIN,
ITEM_LIG... |
import datetime
from typing import TYPE_CHECKING, Optional, Union
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from homeassistant.util import dt as dt_util
from .typing import HomeAssistantType
if TYPE_CHECKING... |
import os
import unittest
from unittest import mock
def get_test_path(file_path):
"""
return the path of a file with "Tests" depending of the current location of the execution
:return: string path
"""
current_path = os.getcwd()
if "/Tests" in current_path:
return current_path + os.sep... |
from datetime import timedelta
import logging
from locationsharinglib import Service
from locationsharinglib.locationsharinglibexceptions import InvalidCookies
import voluptuous as vol
from homeassistant.components.device_tracker import PLATFORM_SCHEMA, SOURCE_TYPE_GPS
from homeassistant.const import (
ATTR_BATT... |
import pytest
from mock import patch, sentinel, Mock, MagicMock
from pymongo.errors import AutoReconnect, OperationFailure, DuplicateKeyError, ServerSelectionTimeoutError
from arctic.decorators import mongo_retry, _get_host
from arctic.hooks import register_log_exception_hook
def test_mongo_retry():
retries = [... |
from typing import Any
from homeassistant.components.scene import Scene
from homeassistant.helpers import entity_platform
from . import UpbEntity
from .const import DOMAIN, UPB_BLINK_RATE_SCHEMA, UPB_BRIGHTNESS_RATE_SCHEMA
SERVICE_LINK_DEACTIVATE = "link_deactivate"
SERVICE_LINK_FADE_STOP = "link_fade_stop"
SERVICE... |
from absl import flags
from perfkitbenchmarker import configs
from perfkitbenchmarker import sample
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.linux_packages import wrk2
FLAGS = flags.FLAGS
_FLAG_FORMAT_DESCRIPTION = (
'The format is "target_request_rate:duration:threads:connections", with '
... |
import os
import time
import cloudpickle
import numpy as np
import spacy
import tensorflow as tf
from sklearn.preprocessing import LabelBinarizer
from tensorflow.python.keras import Sequential
from tensorflow.python.layers.core import Dense
from tensorflow.python.layers.core import Dropout
np.random.seed(1)
class ... |
from kombu.mixins import ConsumerMixin
from kombu.log import get_logger
from kombu.utils.functional import reprcall
from .queues import task_queues
logger = get_logger(__name__)
class Worker(ConsumerMixin):
def __init__(self, connection):
self.connection = connection
def get_consumers(self, Consu... |
import io
import pytest
import warnings
import socket
from time import monotonic
from unittest.mock import MagicMock, Mock, patch
from kombu import Connection
from kombu.compression import compress
from kombu.exceptions import ResourceError, ChannelError
from kombu.transport import virtual
from kombu.utils.uuid impo... |
import os.path
import cherrypy
class Page:
# Store the page title in a class attribute
title = 'Untitled Page'
def header(self):
return '''
<html>
<head>
<title>%s</title>
<head>
<body>
<h2>%s</h2>
''' % (self.t... |
from simplipy import API
from simplipy.errors import (
InvalidCredentialsError,
PendingAuthorizationError,
SimplipyError,
)
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_CODE, CONF_PASSWORD, CONF_TOKEN, CONF_USERNAME
from homeassistant.core import c... |
import gettext
import os
import re
import sys
from io import BytesIO
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.validators import validate_email as validate_email_django
from django.utils.translation import gettext as _
from PIL import Image
from weblate.tran... |
import logging
import os
import pytest
from qutebrowser.browser.webengine import spell
from qutebrowser.utils import usertypes
def test_version(message_mock, caplog):
"""Tests parsing dictionary version from its file name."""
assert spell.version('en-US-8-0.bdic') == (8, 0)
assert spell.version('pl-PL-... |
from abc import ABC, abstractmethod
from typing import List, Tuple, Optional
import discord
from redbot.core import Config, commands
from redbot.core.bot import Red
class MixinMeta(ABC):
"""
Base class for well behaved type hint detection with composite class.
Basically, to keep developers sane when no... |
import json
import urllib
import xmlrpc.client
from .util import read_body
import logging
log = logging.getLogger(__name__)
def method(r1, r2):
assert r1.method == r2.method, "{} != {}".format(r1.method, r2.method)
def uri(r1, r2):
assert r1.uri == r2.uri, "{} != {}".format(r1.uri, r2.uri)
def host(r1,... |
import os
import tempfile
import unittest
from pysignalclirestapi import SignalCliRestApi
import requests_mock
import homeassistant.components.signal_messenger.notify as signalmessenger
from homeassistant.setup import async_setup_component
from tests.async_mock import patch
BASE_COMPONENT = "notify"
async def te... |
import pytest
import vcr
from urllib.request import urlopen
def test_once_record_mode(tmpdir, httpbin):
testfile = str(tmpdir.join("recordmode.yml"))
with vcr.use_cassette(testfile, record_mode=vcr.mode.ONCE):
# cassette file doesn't exist, so create.
urlopen(httpbin.url).read()
with vcr... |
from .common import MQTTMessage, setup_ozw
from tests.common import async_capture_events
async def test_scenes(hass, generic_data, sent_messages):
"""Test setting up config entry."""
receive_message = await setup_ozw(hass, fixture=generic_data)
events = async_capture_events(hass, "ozw.scene_activated")... |
import asyncio
from homeassistant.components import camera, image_processing as ip
from homeassistant.components.openalpr_cloud.image_processing import OPENALPR_API_URL
from homeassistant.core import callback
from homeassistant.setup import setup_component
from tests.async_mock import PropertyMock, patch
from tests.... |
import logging
from aiopvapi.helpers.aiorequest import AioRequest
import async_timeout
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.const import CONF_HOST, CONF_NAME
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from . import async... |
import textwrap
from coverage import env
from coverage.misc import NotPython
from coverage.parser import PythonParser
from tests.coveragetest import CoverageTest, xfail
from tests.helpers import arcz_to_arcs
class PythonParserTest(CoverageTest):
"""Tests for coverage.py's Python code parsing."""
run_in_te... |
from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN
from homeassistant.setup import async_setup_component
from tests.async_mock import MagicMock, patch
MOCK_CONFIG = {
"sensor": {
"platform": "openerz",
"name": "test_name",
"zip": 1234,
"waste_type": "glass",
}... |
import io
import os
import shutil
from ..helper import cd
__all__ = ["add_post_without_text", "append_config", "cd", "create_simple_post", "patch_config"]
def add_post_without_text(directory):
"""Add a post without text."""
# File for Issue #374 (empty post text)
create_simple_post(directory, "empty.tx... |
import asyncio
from collections import deque
from datetime import datetime, timedelta
import functools as ft
import logging
import re
import sys
from typing import Any, Callable, Container, List, Optional, Set, Union, cast
from homeassistant.components import zone as zone_cmp
from homeassistant.components.device_auto... |
from datetime import timedelta
import logging
from pyeight.eight import EightSleep
import voluptuous as vol
from homeassistant.const import (
ATTR_ENTITY_ID,
CONF_BINARY_SENSORS,
CONF_PASSWORD,
CONF_SENSORS,
CONF_USERNAME,
EVENT_HOMEASSISTANT_STOP,
)
from homeassistant.core import callback
fr... |
import logging
from datetime import datetime, timezone
import click
import dateutil.parser
from twtxt.models import Tweet
logger = logging.getLogger(__name__)
def make_aware(dt):
"""Appends tzinfo and assumes UTC, if datetime object has no tzinfo already."""
return dt if dt.tzinfo else dt.replace(tzinfo=t... |
import attr
from PyQt5.QtCore import Qt
@attr.s
class Key:
"""A key with expected values.
Attributes:
attribute: The name of the Qt::Key attribute ('Foo' -> Qt.Key_Foo)
name: The name returned by str(KeyInfo) with that key.
text: The text returned by KeyInfo.text().
uppertex... |
from urllib.parse import urlparse
from pyheos import HeosError
from homeassistant import data_entry_flow
from homeassistant.components import heos, ssdp
from homeassistant.components.heos.config_flow import HeosFlowHandler
from homeassistant.components.heos.const import DATA_DISCOVERED_HOSTS, DOMAIN
from homeassista... |
import logging
import unittest
import numpy as np
from gensim.parsing.preprocessing import \
remove_stopwords, strip_punctuation2, strip_tags, strip_short, strip_numeric, strip_non_alphanum, \
strip_multiple_whitespaces, split_alphanum, stem_text
# several documents
doc1 = """C'est un trou de verdure où chan... |
from pyecobee.const import ECOBEE_STATE_CALIBRATING, ECOBEE_STATE_UNKNOWN
from homeassistant.const import (
DEVICE_CLASS_HUMIDITY,
DEVICE_CLASS_TEMPERATURE,
PERCENTAGE,
TEMP_FAHRENHEIT,
)
from homeassistant.helpers.entity import Entity
from .const import _LOGGER, DOMAIN, ECOBEE_MODEL_TO_NAME, MANUFAC... |
import hashlib
import os.path
from ssl import CertificateError
from urllib.parse import quote
from django.conf import settings
from django.contrib.staticfiles import finders
from django.core.cache import InvalidCacheBackendError, caches
from django.urls import reverse
from django.utils.html import escape
from django.... |
import numpy as np
import matplotlib.pyplot as plt
import mne
from mne.datasets import sample
from mne.time_frequency import fit_iir_model_raw
from mne.viz import plot_sparse_source_estimates
from mne.simulation import simulate_sparse_stc, simulate_evoked
print(__doc__)
#############################################... |
import time
import mock
from behave import given
from behave import then
from behave import when
from itest_utils import get_service_connection_string
from paasta_tools import drain_lib
@given("a working hacheck container")
def a_working_hacheck_container(context):
connection_string = get_service_connection_st... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
from absl import logging
import tensorflow as tf
class AsyncCheckpointSaverHook(tf.contrib.tpu.AsyncCheckpointSaverHook):
"""Saves checkpoints every N steps in a asynchronous thread.
This i... |
from django.contrib.auth.models import Group as DjangoGroup
from weblate.auth.data import SELECTION_ALL, SELECTION_MANUAL
from weblate.auth.models import Group, Role, User
from weblate.lang.models import Language
from weblate.trans.models import ComponentList, Project
from weblate.trans.tests.test_views import Fixtur... |
from __future__ import print_function
import itertools
import re
import os
import urwid
class FlagFileWidget(urwid.TreeWidget):
# apply an attribute to the expand/unexpand icons
unexpanded_icon = urwid.AttrMap(urwid.TreeWidget.unexpanded_icon,
'dirmark')
expanded_icon = urwid.AttrMap(urwid.Tree... |
import argparse
import asyncio
from collections import OrderedDict
from collections.abc import Mapping, Sequence
from glob import glob
import logging
import os
from typing import Any, Callable, Dict, List, Tuple
from unittest.mock import patch
from homeassistant import bootstrap, core
from homeassistant.config import... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from perfkitbenchmarker import sample
from six.moves import range
class SampleTestCase(unittest.TestCase):
def testMetadataOptional(self):
instance = sample.Sample(metric='Test', valu... |
from typing import Tuple, Dict, Optional, List, Union
from re import findall
import discord
from discord.ext.commands.view import StringView
from redbot.core import commands, Config
from redbot.core.i18n import Translator
from redbot.core.utils import AsyncIter
_ = Translator("Alias", __file__)
class ArgParseError... |
from lemur import database
from lemur.authorizations.models import Authorization
def get(authorization_id):
"""
Retrieve dns authorization by ID
"""
return database.get(Authorization, authorization_id)
def create(account_number, domains, dns_provider_type, options=None):
"""
Creates a new ... |
from flask import Flask, jsonify, request
from flask_jwt import JWT, jwt_required, current_identity, JWTError
from werkzeug.security import safe_str_cmp
from flasgger import Swagger
class User(object):
def __init__(self, user_id, username, password):
self.id = user_id
self.username = username
... |
from __future__ import unicode_literals
import datetime
from lib.fun.fun import cool, is_en
from lib.data.data import pyoptions
from lib.fun.decorator import magic
from rules.BaseTrick import dateshaper
def birthday_magic(*args):
"""[begin_date] [end_date], date format: [yyyyMMdd or ddMMyyyy(--dmy option)]"""
... |
from datetime import timedelta
import logging
from typing import Any, Callable, Iterable, List
from directv import DIRECTV, DIRECTVError
from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssista... |
import unittest
import numpy as np
from numpy.distutils.system_info import get_info
class TestNumpy(unittest.TestCase):
def test_array(self):
array = np.array([1, 3])
self.assertEqual((2,), array.shape)
# Numpy must be linked to the MKL. (Occasionally, a third-party package will muck up... |
import os.path as op
import numpy as np
import pytest
from numpy.testing import assert_array_equal
import mne
from mne.utils import requires_good_network
from mne.utils import requires_pandas, requires_version
from mne.datasets.sleep_physionet import age, temazepam
from mne.datasets.sleep_physionet._utils import _up... |
from homeassistant.components.sonarr.const import DOMAIN
from homeassistant.config_entries import (
ENTRY_STATE_LOADED,
ENTRY_STATE_NOT_LOADED,
ENTRY_STATE_SETUP_ERROR,
ENTRY_STATE_SETUP_RETRY,
SOURCE_REAUTH,
)
from homeassistant.const import CONF_SOURCE
from homeassistant.core import HomeAssistant... |
from mlpatches.base import FunctionPatch, PatchGroup
from mlpatches.os_popen import popen, popen2, popen3, popen4, system
from mlpatches.os_process import getpid, getppid, kill
# define patches
class PopenPatch(FunctionPatch):
PY2 = True
PY3 = False
module = "os"
function = "popen"
replacement ... |
from gitless import core
from . import helpers, pprint
def parser(subparsers, repo):
desc = 'merge the divergent changes of one branch onto another'
merge_parser = subparsers.add_parser(
'merge', help=desc, description=desc.capitalize(), aliases=['mg'])
group = merge_parser.add_mutually_exclusive_group(... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
import mock
from perfkitbenchmarker import provider_info
from perfkitbenchmarker import providers
import six
class ProviderBenchmarkChecks(unittest.TestCase):
def setUp(self):
p = mo... |
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne.time_frequency import morlet
from mne.preprocessing.ctps_ import (ctps, _prob_kuiper,
_compute_normalized_phase)
###############################################################################
... |
from typing import cast, Dict, List, Optional, Tuple
from qutebrowser.commands import runners
from qutebrowser.api import cmdutils
from qutebrowser.keyinput import modeman
from qutebrowser.utils import message, objreg, usertypes
_CommandType = Tuple[str, int] # command, type
macro_recorder = cast('MacroRecorder',... |
from kalliope.core.Models.settings.SettingsEntry import SettingsEntry
class Resources(SettingsEntry):
"""
"""
def __init__(self, neuron_folder=None, stt_folder=None, tts_folder=None, trigger_folder=None, signal_folder=None):
super(Resources, self).__init__("Resources")
self.neuron_folder... |
import time
import unittest
from queue import Empty
import mock
from pytest import fixture
from pytest import raises
from paasta_tools.deployd.common import DelayDeadlineQueue
from paasta_tools.deployd.common import exponential_back_off
from paasta_tools.deployd.common import get_marathon_clients_from_config
from pa... |
from datetime import datetime
from datetime import timedelta
from datetime import timezone
import mock
import pytest
from paasta_tools import check_marathon_services_replication
from paasta_tools.utils import compose_job_id
check_marathon_services_replication.log = mock.Mock()
@pytest.fixture
def instance_config(... |
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ImproperlyConfigured
from django.db.models import Count
from django.shortcuts import redirect
from django.urls import reverse
from django.utils import translation
from django.utils.html import escape
from django.uti... |
import json
import logging
import os
from babelfish import Language, language_converters
from requests import Session
from . import Provider
from ..subtitle import Subtitle, fix_line_ending
logger = logging.getLogger(__name__)
language_converters.register('shooter = subliminal.converters.shooter:ShooterConverter')... |
from hashlib import sha1
import logging
import os
from homeassistant.components.mailbox import CONTENT_TYPE_MPEG, Mailbox, StreamError
from homeassistant.util import dt
_LOGGER = logging.getLogger(__name__)
MAILBOX_NAME = "DemoMailbox"
async def async_get_handler(hass, config, discovery_info=None):
"""Set up ... |
from serial import SerialException
from homeassistant import config_entries, data_entry_flow, setup
from homeassistant.components.monoprice.const import (
CONF_SOURCE_1,
CONF_SOURCE_4,
CONF_SOURCE_5,
CONF_SOURCES,
DOMAIN,
)
from homeassistant.const import CONF_PORT
from tests.async_mock import pa... |
import typing
import csv
from pathlib import Path
import keras
import pandas as pd
import matchzoo
_url = "https://download.microsoft.com/download/E/5/F/" \
"E5FCFCEE-7005-4814-853D-DAA7C66507E0/WikiQACorpus.zip"
def load_data(
stage: str = 'train',
task: str = 'ranking',
filtered: bool = False... |
import argparse
import os
import shutil
import signal
import sys
import time
import logging
from openrazer_daemon.daemon import RazerDaemon, __version__
from subprocess import check_output
from time import sleep
from daemonize import Daemonize
# Basically copied from https://github.com/jleclanche/python-xdg/blob/mas... |
from homeassistant.components.surepetcare.const import DOMAIN
from homeassistant.setup import async_setup_component
from . import MOCK_API_DATA, MOCK_CONFIG, _patch_sensor_setup
EXPECTED_ENTITY_IDS = {
"binary_sensor.pet_flap_pet_flap_connectivity": "household-id-13576-connectivity",
"binary_sensor.pet_flap_... |
import asyncio
from aiohttp.client_exceptions import ClientConnectorError
from async_timeout import timeout
from gios import ApiError, Gios, InvalidSensorsData, NoStationError
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_NAME
from homeassistant.helpers.aiohtt... |
import time
from tempfile import NamedTemporaryFile
import itest_utils
import mock
from behave import given
from behave import then
from behave import when
import paasta_tools
from paasta_tools import marathon_tools
from paasta_tools.utils import _run
from paasta_tools.utils import decompose_job_id
from paasta_tools... |
class Framework:
def __init__(self, items):
self.__items = items
def __getitem__(self, name):
return self.__items[name]
def __str__(self):
return f"{self.name}:{self.id}"
def get(self, name, default=None):
try:
return self[name]
except KeyError:
... |
from __future__ import absolute_import
import unittest
from lxml import etree
from .common_imports import HelperTestCase
from lxml.doctestcompare import LXMLOutputChecker, PARSE_HTML, PARSE_XML
class DummyInput:
def __init__(self, **kw):
for name, value in kw.items():
setattr(self, name, va... |
import logging
import pyloopenergy
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_UNIT_SYSTEM_IMPERIAL,
CONF_UNIT_SYSTEM_METRIC,
EVENT_HOMEASSISTANT_STOP,
)
import homeassistant.helpers.config_validation as cv
from homeassistant... |
from typing import Iterable, Optional, MutableMapping
from PyQt5.QtWidgets import QApplication, QLineEdit
from qutebrowser.api import cmdutils
class _ReadlineBridge:
"""Bridge which provides readline-like commands for the current QLineEdit.
Attributes:
_deleted: Mapping from widgets to their last... |
from __future__ import print_function
import argparse
import sys
from os import getcwd, mkdir, remove, rename
from shutil import rmtree
import requests
cwd = getcwd()
documentsIndex = cwd.index("Documents")
documentsIndex += len("Documents")
ROOT = cwd[:documentsIndex]
class stansi: # Collection of Stash's ANSI ... |
from flexx.util.testing import run_tests_if_main, raises, skip
import re
from flexx.util.logging import logger, capture_log, set_log_level
def test_debug():
logger.debug('test')
def test_info():
logger.info('test')
def test_warning():
logger.warning('test')
def test_set_log_level():
with r... |
from io import StringIO
from django import template
from django.utils.safestring import mark_safe
from lxml import etree
from weblate.utils.site import get_site_url
register = template.Library()
@register.filter
def add_site_url(content):
"""Automatically add site URL to any relative links or images."""
p... |
from __future__ import annotations
import inspect
import functools
from typing import (
TypeVar,
Callable,
Awaitable,
Coroutine,
Union,
Type,
TYPE_CHECKING,
List,
Any,
Generator,
Protocol,
overload,
)
import discord
from discord.ext import commands as dpy_commands
# So... |
from homeassistant.components.device_tracker import SOURCE_TYPE_GPS
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from . import DOMAIN as LT_DOMAIN, TRACKER_UPDATE
async def... |
from __future__ import unicode_literals
import os
import sys
import time
from collections import OrderedDict
from lib.data.datatype import AttribDict
from lib.fun.osjudger import py_ver_egt_3
def init_paths():
try:
root_path = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0]))).encode('utf-8').d... |
import asyncio
import logging
from total_connect_client import TotalConnectClient
import voluptuous as vol
from homeassistant.config_entries import SOURCE_IMPORT, ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
import homeassistant.helpers.config_... |
import asyncio
from datetime import timedelta
import logging
from uuid import uuid4
from aiohttp import ClientError, ClientResponseError
from aiohttp.web import Request, Response
import jwt
# Typing imports
from homeassistant.components.http import HomeAssistantView
from homeassistant.const import (
CLOUD_NEVER_... |
import json
from django.core.management.base import CommandError
from weblate.addons.models import ADDONS, Addon
from weblate.auth.models import User, get_anonymous
from weblate.trans.management.commands import WeblateComponentCommand
class Command(WeblateComponentCommand):
help = "installs addon to all listed... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from absl import flags
import mock
from perfkitbenchmarker import disk
from perfkitbenchmarker import errors
from tests import pkb_common_test_case
import six
FLAGS = flags.FLAGS
_COMPONENT ... |
from flexx import event
class Test(event.Component):
foo = event.IntProp(0, settable=True)
@event.reaction
def react_to_foo_a(self):
print('A: foo changed to %i' % self.foo)
@event.reaction('foo')
def react_to_foo_b(self, *events):
# This function
print('B: foo changed ... |
import voluptuous as vol
from homeassistant.components.device_automation import TRIGGER_BASE_SCHEMA
from homeassistant.components.device_automation.exceptions import (
InvalidDeviceAutomationConfig,
)
from homeassistant.components.homeassistant.triggers import event as event_trigger
from homeassistant.const impor... |
import asyncio
from functools import partial
from VL53L1X2 import VL53L1X # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components import rpi_gpio
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, LENGTH_MILLIMETERS
import homeassista... |
import numpy as np
import pytest
from mne import create_info
from mne.io import RawArray
from mne.utils import logger, catch_logging, run_tests_if_main
def bad_1(x):
"""Fail."""
return # bad return type
def bad_2(x):
"""Fail."""
return x[:-1] # bad shape
def bad_3(x):
"""Fail."""
retur... |
import os
import shutil
import subprocess
import tempfile
import unittest
PKG_PATH = os.getcwd()
TEST_PATH = os.path.join(PKG_PATH, 'test')
def make_bash_pre_command(strings, currentword):
return "bash -c '. %s; export COMP_WORDS=(%s); export COMP_CWORD=%s;" % (os.path.join(PKG_PATH, 'rosbash'), ' '.join(['"%s"... |
from hyperion import const
from homeassistant.components.hyperion import light as hyperion_light
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
ATTR_HS_COLOR,
DOMAIN,
)
from homeassistant.const import ATTR_ENTITY_ID, SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.setu... |
from __future__ import division
import argparse
import multiprocessing
import numpy as np
import chainer
from chainer.training import extensions
from chainer.training.triggers import ManualScheduleTrigger
import chainermn
from chainercv.chainer_experimental.datasets.sliceable \
import ConcatenatedDataset
from c... |
import pytest
from PyQt5.QtCore import QUrl
from qutebrowser.browser import navigate
from qutebrowser.utils import urlutils
class TestIncDec:
pytestmark = pytest.mark.usefixtures('config_stub')
@pytest.mark.parametrize('incdec', ['increment', 'decrement'])
@pytest.mark.parametrize('value', [
... |
from matplotlib.font_manager import FontProperties
import matplotlib.pyplot as plt
from chainercv.experimental.links import YOLOv2Tiny
from chainercv.links import FasterRCNNVGG16
from chainercv.links import SSD300
from chainercv.links import SSD512
from chainercv.links import YOLOv2
from chainercv.links import YOLOv3... |
import sys as _sys
import io
import cherrypy as _cherrypy
from cherrypy._cpcompat import ntou
from cherrypy import _cperror
from cherrypy.lib import httputil
from cherrypy.lib import is_closable_iterator
def downgrade_wsgi_ux_to_1x(environ):
"""Return a new environ dict for WSGI 1.x from the given WSGI u.x envi... |
from datetime import timedelta
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import ssdp
from homeassistant.components.upnp.const import (
CONFIG_ENTRY_SCAN_INTERVAL,
CONFIG_ENTRY_ST,
CONFIG_ENTRY_UDN,
DEFAULT_SCAN_INTERVAL,
DISCOVERY_LOCATION,
DISCOVE... |
import io
import os
import google.cloud.storage
from six.moves.urllib import parse as urlparse
import smart_open
_GCS_URL = os.environ.get('SO_GCS_URL')
assert _GCS_URL is not None, 'please set the SO_GCS_URL environment variable'
def initialize_bucket():
client = google.cloud.storage.Client()
parsed = ur... |
import logging
import requests
from homeassistant.components.device_tracker import DOMAIN
import homeassistant.components.xiaomi.device_tracker as xiaomi
from homeassistant.components.xiaomi.device_tracker import get_scanner
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PLATFORM, CONF_USERNAME
from... |
import pytest
from synology_dsm.exceptions import (
SynologyDSMException,
SynologyDSMLogin2SAFailedException,
SynologyDSMLogin2SARequiredException,
SynologyDSMLoginInvalidException,
SynologyDSMRequestException,
)
from homeassistant import data_entry_flow, setup
from homeassistant.components import... |
import logging
from typing import Any, Dict, Optional
from urllib.parse import urlparse
from rokuecp import Roku, RokuError
import voluptuous as vol
from homeassistant.components.ssdp import (
ATTR_SSDP_LOCATION,
ATTR_UPNP_FRIENDLY_NAME,
ATTR_UPNP_SERIAL,
)
from homeassistant.config_entries import CONN_C... |
from __future__ import annotations
import contextlib
import functools
import io
import os
import logging
import discord
from pathlib import Path
from typing import Callable, TYPE_CHECKING, Union, Dict, Optional
from contextvars import ContextVar
import babel.localedata
from babel.core import Locale
if TYPE_CHECKIN... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.