text
stringlengths
213
32.3k
import re from typing import TYPE_CHECKING, Any, Iterable, Sequence, Tuple from homeassistant.const import CONF_PLATFORM if TYPE_CHECKING: from .typing import ConfigType def config_per_platform(config: "ConfigType", domain: str) -> Iterable[Tuple[Any, Any]]: """Break a component config into different platf...
import re from typing import Dict import aiohttp from mypy_extensions import TypedDict from paasta_tools.utils import get_user_agent HACHECK_TIMEOUT = aiohttp.ClientTimeout(total=45, connect=30, sock_read=10) SpoolInfo = TypedDict( "SpoolInfo", {"service": str, "state": str, "since": float, "until": float,...
from datetime import timedelta import logging import threading import time from aqualogic.core import AquaLogic import voluptuous as vol from homeassistant.const import ( CONF_HOST, CONF_PORT, EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP, ) from homeassistant.helpers import config_validation a...
revision = 'c301c59688d2' down_revision = '434c29e40511' from alembic import op from sqlalchemy.sql import text import time import datetime from flask import current_app from logging import Formatter, FileHandler, getLogger from lemur.common import utils log = getLogger(__name__) handler = FileHandler(current_app....
import asyncio from dsmr_parser.clients.protocol import DSMRProtocol from dsmr_parser.obis_references import EQUIPMENT_IDENTIFIER, EQUIPMENT_IDENTIFIER_GAS from dsmr_parser.objects import CosemObject import pytest from tests.async_mock import MagicMock, patch @pytest.fixture async def dsmr_connection_fixture(hass)...
import sys from io import StringIO from unittest import SkipTest import requests from django.core.management import call_command from django.core.management.base import CommandError, SystemCheckError from django.test import SimpleTestCase, TestCase from weblate.accounts.models import Profile from weblate.runner impo...
import unittest import logging import sys import mock from kalliope import parse_args, configure_logging, main class TestInit(unittest.TestCase): def test_parse_args(self): # start option parser = parse_args(['value']) self.assertEqual(parser.action, "value") # no option ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function from collections import OrderedDict import json import logging import re import tempfile from absl import flags from perfkitbenchmarker import errors from perfkitbenchmarker import linux_virtual_machine from p...
import os import os.path import sys import shutil import inspect import subprocess import tempfile import argparse sys.path.insert(0, os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) # We import qutebrowser.app so all @cmdutils-register decorators are run. import qutebro...
from lemur.plugins.base import Plugin, plugins class DestinationPlugin(Plugin): type = "destination" requires_key = True sync_as_source = False sync_as_source_name = "" def upload(self, name, body, private_key, cert_chain, options, **kwargs): raise NotImplementedError class ExportDesti...
from marshmallow import fields from lemur.common.schema import LemurOutputSchema from lemur.authorities.schemas import AuthorityNestedOutputSchema class DefaultOutputSchema(LemurOutputSchema): authority = fields.Nested(AuthorityNestedOutputSchema) country = fields.String() state = fields.String() loc...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import abc from collections import deque import ctypes import functools import logging import os import signal import threading import time import traceback from concurrent import futures from perfkitbenchmar...
import asyncio import logging import async_timeout from roomba import Roomba, RoombaConnectionError import voluptuous as vol from homeassistant import config_entries, exceptions from homeassistant.const import CONF_HOST, CONF_PASSWORD from homeassistant.core import callback from homeassistant.helpers import config_v...
import ast import pytest from script.hassfest.dependencies import ImportCollector @pytest.fixture def mock_collector(): """Fixture with import collector that adds all referenced nodes.""" collector = ImportCollector(None) collector.unfiltered_referenced = set() collector._add_reference = collector....
from __future__ import absolute_import from __future__ import division from __future__ import print_function import re from absl import flags import numpy from perfkitbenchmarker import configs from perfkitbenchmarker import flag_util from perfkitbenchmarker import regex_util from perfkitbenchmarker import sample from...
from itertools import count from . import messaging from .entity import Exchange, Queue __all__ = ('Publisher', 'Consumer') # XXX compat attribute entry_to_queue = Queue.from_dict def _iterconsume(connection, consumer, no_ack=False, limit=None): consumer.consume(no_ack=no_ack) for iteration in count(0): ...
from homeassistant.components.flo.const import DOMAIN as FLO_DOMAIN from homeassistant.const import ( ATTR_FRIENDLY_NAME, CONF_PASSWORD, CONF_USERNAME, STATE_ON, ) from homeassistant.setup import async_setup_component from .common import TEST_PASSWORD, TEST_USER_ID async def test_binary_sensors(hass...
from functools import lru_cache from django.contrib.auth import get_user_model from zinnia.settings import COMMENT_FLAG_USER_ID PINGBACK = 'pingback' TRACKBACK = 'trackback' FLAGGER_USERNAME = 'Zinnia-Flagger' @lru_cache(1) def get_user_flagger(): """ Return an User instance used by the system when fl...
from homeassistant.components.media_player.const import ( SUPPORT_PAUSE, SUPPORT_PLAY, SUPPORT_SELECT_SOURCE, ) from tests.common import async_get_device_automations from tests.components.homekit_controller.common import ( Helper, setup_accessories_from_file, setup_test_accessories, ) async ...
from docutils import nodes from docutils.parsers.rst import Directive, directives from nikola.plugins.compile.rest import _align_choice, _align_options_base from nikola.plugin_categories import RestExtension class Plugin(RestExtension): """Plugin for the youtube directive.""" name = "rest_youtube" def...
import unittest import datatable as dt from datatable.internal import frame_integrity_check from datatable import ltype class TestDatatable(unittest.TestCase): def test_fread(self): d0 = dt.fread( "L,T,U,D\n" "true,True,TRUE,1\n" "false,False,FALSE,0\n" ...
from collections import Counter from unittest import TestCase from scattertext.features.UnigramsFromSpacyDoc import UnigramsFromSpacyDoc from scattertext.WhitespaceNLP import whitespace_nlp class TestUnigramsFromSpacyDoc(TestCase): def test_get_feats(self): doc = whitespace_nlp("A a bb cc.") term_freq = Unigr...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import os.path from absl import flags from absl.testing import flagsaver from absl.testing import parameterized from compare_gan import datasets from compare_gan import eval_gan_lib from compare_ga...
import pytest from hyperopt import STATUS_OK from hyperas.distributions import choice, uniform import six.moves.cPickle as pickle from elephas.hyperparam import HyperParamModel pytest.mark.usefixtures("spark_context") def data(): from keras.datasets import mnist from keras.utils import np_utils (x_trai...
import datetime import unittest.mock import dateutil import pytest from nikola.nikola import LEGAL_VALUES from nikola.utils import ( LocaleBorg, LocaleBorgUninitializedException, TranslatableSetting, ) TESLA_BIRTHDAY = datetime.date(1856, 7, 10) TESLA_BIRTHDAY_DT = datetime.datetime(1856, 7, 10, 12, 34,...
import io import logging import os import unittest import pytest from homeassistant.config import YAML_CONFIG_FILE, load_yaml_config_file from homeassistant.exceptions import HomeAssistantError import homeassistant.util.yaml as yaml from homeassistant.util.yaml import loader as yaml_loader from tests.async_mock imp...
import datetime import logging import math import threading import time # pylint: disable=import-error from openrazer_daemon.keyboard import KeyboardColour class RippleEffectThread(threading.Thread): """ Ripple thread. This thread contains the run loop which performs all the circle calculations and gen...
import docker_registry.core.driver as engine import tempfile from ..lib import config __all__ = ['load'] def temp_store_handler(): tmpf = tempfile.TemporaryFile() def fn(buf): tmpf.write(buf) return tmpf, fn _storage = {} def load(kind=None): """Returns the right storage class accor...
import matplotlib.pyplot as plt from contextlib import contextmanager from ...fixes import nullcontext from ._pyvista import _Renderer as _PyVistaRenderer from ._pyvista import \ _close_all, _set_3d_view, _set_3d_title # noqa: F401 analysis:ignore class _Renderer(_PyVistaRenderer): def __init__(self, *args,...
try: from future_builtins import filter except ImportError: pass from copy import deepcopy ###{standalone from collections import OrderedDict class Meta: def __init__(self): self.empty = True class Tree(object): """The main tree class. Creates a new tree, and stores "data" and "chil...
from mlpatches.base import PatchGroup from mlpatches import mount_base from stashutils import mount_ctrl _BASE_PATCHES = list(filter(None, [getattr(mount_base, p) if p.endswith("PATCH") else None for p in dir(mount_base)])) class MountPatches(PatchGroup): """All mount patches.""" patches = [] + _BASE_PATCHE...
import operator import numpy as np from . import dtypes, duck_array_ops from .nputils import array_eq, array_ne try: import bottleneck as bn has_bottleneck = True except ImportError: # use numpy methods instead bn = np has_bottleneck = False UNARY_OPS = ["neg", "pos", "abs", "invert"] CMP_BIN...
from Handler import Handler from graphitepickle import GraphitePickleHandler from copy import deepcopy class MultiGraphitePickleHandler(Handler): """ Implements the abstract Handler class, sending data to multiple graphite servers by using two instances of GraphitePickleHandler """ def __init__(...
import logging import threading import traceback from configobj import ConfigObj import time class Handler(object): """ Handlers process metrics that are collected by Collectors. """ def __init__(self, config=None, log=None): """ Create a new instance of the Handler class """...
import html import fnmatch import re from PyQt5.QtWidgets import QLabel, QSizePolicy from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt from qutebrowser.config import config, stylesheet from qutebrowser.utils import utils, usertypes from qutebrowser.misc import objects from qutebrowser.keyinput import keyutils clas...
from datetime import datetime, timedelta from sqlalchemy.exc import OperationalError from homeassistant.components.recorder import ( CONFIG_SCHEMA, DOMAIN, Recorder, run_information, run_information_from_instance, run_information_with_session, ) from homeassistant.components.recorder.const im...
import string from collections import Counter import numpy as np from scattertext.CSRMatrixTools import CSRMatrixFactory from scattertext.TermDocMatrix import TermDocMatrix from scattertext.features.FeatsFromSpacyDoc import FeatsFromSpacyDoc from scattertext.indexstore.IndexStore import IndexStore class CategoryTe...
import shlex import subprocess import sys import textwrap import click import pkg_resources from twtxt.mentions import format_mentions from twtxt.parser import parse_iso8601 def style_timeline(tweets, porcelain=False): if porcelain: return "\n".join(style_tweet(tweet, porcelain) for tweet in tweets) ...
from datetime import datetime, timedelta from enturclient import EnturPublicTransportData import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_ATTRIBUTION, CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, CONF_SHOW_ON_MAP, TIME_M...
import logging from homeassistant.components.binary_sensor import BinarySensorEntity from homeassistant.core import callback from homeassistant.util.dt import as_local, parse_datetime, utcnow from . import ( DATA_OPENUV_CLIENT, DATA_PROTECTION_WINDOW, DOMAIN, TYPE_PROTECTION_WINDOW, OpenUvEntity,...
import datetime import voluptuous as vol from homeassistant.components import pilight from homeassistant.components.binary_sensor import PLATFORM_SCHEMA, BinarySensorEntity from homeassistant.const import ( CONF_DISARM_AFTER_TRIGGER, CONF_NAME, CONF_PAYLOAD, CONF_PAYLOAD_OFF, CONF_PAYLOAD_ON, ) f...
import contextlib import inspect import io import os.path import re from . import compression from . import transport PLACEHOLDER = ' smart_open/doctools.py magic goes here' def extract_kwargs(docstring): """Extract keyword argument documentation from a function's docstring. Parameters ---------- ...
from __future__ import absolute_import from __future__ import division from __future__ import print_function import json import logging from absl import flags from perfkitbenchmarker import errors from perfkitbenchmarker import managed_memory_store from perfkitbenchmarker import vm_util from perfkitbenchmarker.provi...
from absl import flags from perfkitbenchmarker import disk from perfkitbenchmarker import errors from perfkitbenchmarker import providers from perfkitbenchmarker.providers.digitalocean import util FLAGS = flags.FLAGS BLOCK_STORAGE = 'block-storage' LOCAL_DISK_METADATA = { disk.MEDIA: disk.SSD, disk.REPLICA...
import time from zigpy.device import Device as zigpy_dev from zigpy.endpoint import Endpoint as zigpy_ep import zigpy.profiles.zha import zigpy.types import zigpy.zcl import zigpy.zcl.clusters.general import zigpy.zcl.foundation as zcl_f import zigpy.zdo.types import homeassistant.components.zha.core.const as zha_co...
import warnings from typing import Optional, Sequence, Tuple, Any, Union, Type, Callable, List from typing import Text import numpy as np from tensornetwork.backends import abstract_backend from tensornetwork import backend_contextmanager from tensornetwork import backends from tensornetwork.tensor import Tensor Abst...
from typing import Any, Mapping, Optional, Sequence, Union import attr from qutebrowser.utils import usertypes, log class Error(Exception): """Base exception for config-related errors.""" class NoAutoconfigError(Error): """Raised when this option can't be set in autoconfig.yml.""" def __init__(self...
from datetime import datetime as dt import pytest import pytz from pandas.util.testing import assert_frame_equal from arctic.date import mktz, DateRange from arctic.exceptions import OverlappingDataException DUMMY_DATA = [ {'a': 1., 'b': 2., 'index': dt(2013, 1, 1, tzinfo...
import asyncio from asyncio import TimeoutError as AsyncIOTimeoutError from aiohttp import ClientError from py_nightscout import Api as NightscoutAPI from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_API_KEY, CONF_URL from homeassistant.core import HomeAssistant from homeassis...
import numpy as np import chainer from chainer.backends import cuda import chainer.functions as F from chainercv.links.model.faster_rcnn.utils.anchor_target_creator import\ AnchorTargetCreator from chainercv.links.model.faster_rcnn.utils.proposal_target_creator import\ ProposalTargetCreator class FasterRCN...
from absl import flags # Sentinel value for unspecified platform. GCP_MIN_CPU_PLATFORM_NONE = 'none' flags.DEFINE_string('gcloud_path', 'gcloud', 'The path for the gcloud utility.') flags.DEFINE_list('additional_gcloud_flags', [], 'Additional flags to pass to gcloud.') flags.DEFINE_integer( 'gc...
import fnmatch import os from absl import flags from perfkitbenchmarker import dpb_service from perfkitbenchmarker import errors from perfkitbenchmarker import vm_util BEAM_JAVA_SDK = 'java' BEAM_PYTHON_SDK = 'python' flags.DEFINE_string('gradle_binary', None, 'Set to use a different gradle bina...
from django.http import HttpResponse from django.utils.timezone import now from django.views.generic.edit import FormView from .formats import base_formats from .forms import ExportForm from .resources import modelresource_factory from .signals import post_export class ExportViewMixin: formats = base_formats.DE...
from typing import cast, TYPE_CHECKING, Iterator, List, Optional, Set from PyQt5.QtCore import QRect, Qt from PyQt5.QtWebKit import QWebElement, QWebSettings from PyQt5.QtWebKitWidgets import QWebFrame from qutebrowser.config import config from qutebrowser.utils import log, utils, javascript, usertypes from qutebrow...
import os import platform import re import stat import mimetypes import urllib.parse import unicodedata from email.generator import _make_boundary as make_boundary from io import UnsupportedOperation import cherrypy from cherrypy._cpcompat import ntob from cherrypy.lib import cptools, httputil, file_generator_limite...
from __future__ import annotations from typing import Dict, List, Optional, Union, Set, Iterable, Tuple, overload import asyncio from argparse import Namespace from collections import defaultdict import discord from .config import Config from .utils import AsyncIter class PrefixManager: def __init__(self, con...
from copy import copy from .connection import maybe_channel from .exceptions import NotBoundError from .utils.functional import ChannelPromise __all__ = ('Object', 'MaybeChannelBound') def unpickle_dict(cls, kwargs): return cls(**kwargs) def _any(v): return v class Object: """Common base class. ...
import numpy as np import unittest from chainer.backends import cuda from chainer import testing from chainer.testing import attr from chainercv.links.model.ssd import MultiboxCoder def _random_array(shape): return np.random.uniform(-1, 1, size=shape).astype(np.float32) @testing.parameterize(*testing.product...
import json import logging from typing import Dict, Optional from absl import flags import dataclasses from perfkitbenchmarker import resource from perfkitbenchmarker.configs import option_decoders from perfkitbenchmarker.configs import spec from perfkitbenchmarker.providers.gcp import util FLAGS = flags.FLAGS flag...
import unittest from check_release_installation import (CheckInstallation, Pip3Installation, PipInstallation) from mock import call class TestCheckBothInstallations(unittest.TestCase): def setUp(self): self.calls = [] ...
from collections import OrderedDict from typing import Optional from aioesphomeapi import APIClient, APIConnectionError import voluptuous as vol from homeassistant.components import zeroconf from homeassistant.config_entries import CONN_CLASS_LOCAL_PUSH, ConfigFlow from homeassistant.const import CONF_HOST, CONF_NAM...
import os import unittest from perfkitbenchmarker.scripts.database_scripts import plot_sysbench_results TEST_FILE_1 = '../tests/data/sysbench_stderr_output_sample.txt' TEST_FILE_1_RUN_SECONDS = 480 TEST_FILE_1_REPORT_INTERVAL = 2 TEST_FILE_1_FIRST_TPS_VALUE = 144.13 TEST_RUN_URI = 'abcdefgh' class PlotterTestCase(u...
import logging from homeassistant.components.binary_sensor import ENTITY_ID_FORMAT, BinarySensorEntity from homeassistant.const import CONF_ID from homeassistant.core import callback from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.entity import async_generate_entity_id...
import pygogo as gogo from . import reactor try: from twisted.test.proto_helpers import MemoryReactorClock except ImportError: MemoryReactorClock = object FakeReactor = lambda _: lambda: None logger = gogo.Gogo(__name__, monolog=True).logger class FakeReactor(MemoryReactorClock): """A fake reactor...
import logging import typing import voluptuous as vol from homeassistant.const import ( ATTR_EDITABLE, ATTR_MODE, ATTR_UNIT_OF_MEASUREMENT, CONF_ICON, CONF_ID, CONF_MODE, CONF_NAME, SERVICE_RELOAD, ) from homeassistant.core import callback from homeassistant.helpers import collection ...
import itertools import logging from absl import flags from perfkitbenchmarker import configs from perfkitbenchmarker import regex_util from perfkitbenchmarker import sample from perfkitbenchmarker.linux_packages import lmbench FLAGS = flags.FLAGS BENCHMARK_NAME = 'lmbench' BENCHMARK_CONFIG = """ lmbench: descript...
import logging from homeassistant.components.binary_sensor import BinarySensorEntity from . import CONF_BINARY_SENSORS, DATA_EIGHT, NAME_MAP, EightSleepHeatEntity _LOGGER = logging.getLogger(__name__) async def async_setup_platform(hass, config, async_add_entities, discovery_info=None): """Set up the eight sl...
import os from typing import Any, Dict, Optional import serial.tools.list_ports import voluptuous as vol from zigpy.config import CONF_DEVICE, CONF_DEVICE_PATH from homeassistant import config_entries from .core.const import ( # pylint:disable=unused-import CONF_BAUDRATE, CONF_FLOWCONTROL, CONF_RADIO_T...
from pylatex.utils import _latex_item_to_string from pylatex.base_classes import LatexObject TEST_STR = 'hello' def test_string(): name = 'abc' assert _latex_item_to_string(name) == name def test_user_latex_object(): class TestLatexObject(LatexObject): def dumps(self): return TEST_...
import os import pytest from homeassistant import loader, setup from homeassistant.requirements import ( CONSTRAINT_FILE, RequirementsNotFound, async_get_integration_with_requirements, async_process_requirements, ) from tests.async_mock import call, patch from tests.common import MockModule, mock_in...
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.core import callback from .const import DOMAIN, DOOR_STATION, DOOR_STATION_EVENT_ENTITY_IDS @callback def async_describe_events(hass, async_describe_event): """Describe logbook events.""" @callback def async_describe_logbook_event(event)...
from google_nest_sdm.auth import AbstractAuth from google_nest_sdm.device import Device from homeassistant.components import camera from homeassistant.components.camera import STATE_IDLE from .common import async_setup_sdm_platform PLATFORM = "camera" CAMERA_DEVICE_TYPE = "sdm.devices.types.CAMERA" DEVICE_ID = "som...
import os import time from datetime import timedelta from email.mime.image import MIMEImage from celery.schedules import crontab from django.conf import settings from django.core.mail import EmailMultiAlternatives, get_connection from django.utils.timezone import now from html2text import HTML2Text from social_django...
import numpy as np import pytest import xarray as xr from xarray import DataArray from xarray.tests import assert_allclose, assert_equal, raises_regex from . import raise_if_dask_computes, requires_cftime, requires_dask @pytest.mark.parametrize("as_dataset", (True, False)) def test_weighted_non_DataArray_weights(a...
import pytest import pytz import re from datetime import timedelta from django import VERSION as DJANGO_VERSION from django.conf import settings from django.urls import reverse from django.core import mail from django.utils.timezone import datetime from shop.serializers.auth import PasswordResetRequestSerializer from ...
import unittest from mock import MagicMock, patch import os import subprocess from uiautomator import Adb class TestAdb(unittest.TestCase): def setUp(self): self.os_name = os.name def tearDown(self): os.name = self.os_name def test_serial(self): serial = "abcdef1234567890" ...
import os import sys import pytest @pytest.fixture(params=[ 'favicon.ico', 'scaffold/static/made_with_cherrypy_small.png', 'tutorial/tutorial.conf', 'tutorial/custom_error.html', ]) def data_file_path(request): 'generates data file paths expected to be found in the package' return request.pa...
import os import pytest from molecule.command.init import template @pytest.fixture def _command_args(): return { 'role_name': 'test-role', 'url': 'https://github.com/ansible/molecule-cookiecutter.git', 'no_input': True, 'subcommand': __name__, } @pytest.fixture def _instan...
from datetime import timedelta import logging import telnetlib import voluptuous as vol from homeassistant.components.switch import ( ENTITY_ID_FORMAT, PLATFORM_SCHEMA, SwitchEntity, ) from homeassistant.const import ( CONF_COMMAND_OFF, CONF_COMMAND_ON, CONF_COMMAND_STATE, CONF_NAME, ...
from pysmartthings import Attribute, Capability from homeassistant.components.cover import ( ATTR_CURRENT_POSITION, ATTR_POSITION, DOMAIN as COVER_DOMAIN, SERVICE_CLOSE_COVER, SERVICE_OPEN_COVER, SERVICE_SET_COVER_POSITION, STATE_CLOSED, STATE_CLOSING, STATE_OPEN, STATE_OPENING...
from enum import IntEnum SAN_NAMING_TEMPLATE = "SAN-{subject}-{issuer}-{not_before}-{not_after}" DEFAULT_NAMING_TEMPLATE = "{subject}-{issuer}-{not_before}-{not_after}" NONSTANDARD_NAMING_TEMPLATE = "{issuer}-{not_before}-{not_after}" SUCCESS_METRIC_STATUS = "success" FAILURE_METRIC_STATUS = "failure" CERTIFICATE_K...
import pytest import socket from unittest.mock import Mock, patch from case import ContextMock from kombu.mixins import ConsumerMixin def Message(body, content_type='text/plain', content_encoding='utf-8'): m = Mock(name='Message') m.body = body m.content_type = content_type m.content_encoding = con...
from datetime import timedelta import logging from aioeafm import get_station import async_timeout from homeassistant.const import ATTR_ATTRIBUTION, LENGTH_METERS from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.helpers.update_coordinator import ( CoordinatorEntity, ...
import warnings import numpy as np import pandas as pd from numpy.core.multiarray import normalize_axis_index try: import bottleneck as bn _USE_BOTTLENECK = True except ImportError: # use numpy methods instead bn = np _USE_BOTTLENECK = False def _select_along_axis(values, idx, axis): other...
import json from homeassistant.components.climate.const import ( HVAC_MODE_COOL, HVAC_MODE_DRY, HVAC_MODE_FAN_ONLY, HVAC_MODE_HEAT, HVAC_MODE_OFF, SUPPORT_FAN_MODE, SUPPORT_TARGET_TEMPERATURE, ) from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM from homeassistant...
__author__ = 'p3rf@google.com' from absl import flags flags.DEFINE_string('host', None, 'Redshift host.') flags.DEFINE_string('database', None, 'Redshift Database.') flags.DEFINE_string('user', None, 'Redshift User.') flags.DEFINE_string('password', None, 'Redshift Password.') flags.mark_flags_as_required(['host', ...
import json from test import CollectorTestCase from test import get_collector_config from mock import Mock, patch from scribe import ScribeCollector class ScribeCollectorTestCase(CollectorTestCase): def setUp(self): config = get_collector_config('ScribeCollector', {}) self.collector = ScribeC...
from django.db import models from django.template.loader import select_template from django.utils.translation import gettext_lazy as _ from shop.conf import app_settings from shop.models.customer import BaseCustomer class Customer(BaseCustomer): """ Default materialized model for Customer, adding a customer'...
import unittest from ReText import tablemode class TestTableMode(unittest.TestCase): def performEdit(self, text, offset, editSize, paddingchar=None, fragment=None): if editSize < 0: text = text[:offset + editSize] + text[offset:] else: fragment = paddingchar * editSize if not fragment else fragment te...
from lemur.plugins.base import Plugin class NotificationPlugin(Plugin): """ This is the base class from which all of the supported issuers will inherit from. """ type = "notification" def send(self, notification_type, message, targets, options, **kwargs): raise NotImplementedError ...
import glob import os import sh from molecule import logger from molecule import util from molecule.verifier import base LOG = logger.get_logger(__name__) class Testinfra(base.Base): """ `Testinfra`_ is the default test runner. Additional options can be passed to ``testinfra`` through the options ...
import json import homeassistant.components.mqtt_eventstream as eventstream from homeassistant.const import EVENT_STATE_CHANGED from homeassistant.core import State, callback from homeassistant.helpers.json import JSONEncoder from homeassistant.setup import async_setup_component import homeassistant.util.dt as dt_uti...
import time from unittest.mock import patch from django.core.cache import cache from django.test import SimpleTestCase from ..checks import is_celery_queue_long class CeleryQueueTest(SimpleTestCase): @staticmethod def set_cache(value): cache.set("celery_queue_stats", value) def test_empty(self...
import asyncio import datetime import json from collections import Counter from pathlib import Path from typing import Mapping import aiohttp import discord from redbot.core import Config from redbot.core.bot import Red from redbot.core.commands import Cog from redbot.core.data_manager import cog_data_path from red...
import json import pytest from app.database import model from . import WEBHOOKDATA, success, load_data def test_server_new(tester, create_server): resp = tester.post('/api/server/new', data={}) assert not success(resp) server = create_server() assert server['ip'] == '127.0.0.1' def test_server_dele...
import asyncio from datetime import timedelta import logging import async_timeout from poolsense import PoolSense from poolsense.exceptions import PoolSenseError from homeassistant.config_entries import ConfigEntry from homeassistant.const import CONF_EMAIL, CONF_PASSWORD from homeassistant.core import HomeAssistant...
import os import re import testinfra.utils.ansible_runner testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner( os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all') def test_hostname(host): assert re.search(r'instance-[12]', host.check_output('hostname -s')) def test_etc_molecule_directory(h...
import hangups from common import run_example async def send_map_location(client, args): request = hangups.hangouts_pb2.SendChatMessageRequest( request_header=client.get_request_header(), event_request_header=hangups.hangouts_pb2.EventRequestHeader( conversation_id=hangups.hangouts_p...
from typing import Callable, List from homeassistant.components.remote import ATTR_NUM_REPEATS, RemoteEntity from homeassistant.config_entries import ConfigEntry from homeassistant.helpers.typing import HomeAssistantType from . import RokuDataUpdateCoordinator, RokuEntity, roku_exception_handler from .const import D...
import os import unittest import mock from perfkitbenchmarker.linux_benchmarks import hpcg_benchmark class HpcgBenchmarkTestCase(unittest.TestCase): def setUp(self): p = mock.patch(hpcg_benchmark.__name__ + '.FLAGS') p.start() self.addCleanup(p.stop) path = os.path.join(os.path.dirname(__file__...