text stringlengths 213 32.3k |
|---|
import pytest
from tests.async_mock import patch
@pytest.fixture()
def ping_client():
"""Define a patched client that returns a successful ping response."""
with patch(
"homeassistant.components.guardian.async_setup_entry", return_value=True
), patch("aioguardian.client.Client.connect"), patch(
... |
from PyQt5.QtCore import QDir, Qt
from PyQt5.QtGui import QDesktopServices, QGuiApplication
from PyQt5.QtWidgets import QTextBrowser
from ReText import globalSettings
class ReTextPreview(QTextBrowser):
def __init__(self, tab):
QTextBrowser.__init__(self)
self.tab = tab
# if set to True, links to other files w... |
import tempfile
import pytest
import t.skip
from kombu import Connection, Exchange, Queue, Consumer, Producer
@t.skip.if_win32
class test_FilesystemTransport:
def setup(self):
self.channels = set()
try:
data_folder_in = tempfile.mkdtemp()
data_folder_out = tempfile.mkdt... |
from decimal import Decimal, DecimalException
import logging
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_UNIT_OF_MEASUREMENT,
CONF_NAME,
CONF_SOURCE,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
TIME_DAYS,
TIME_HOURS,
... |
import weakref
import inspect
from ._loop import loop
from . import logger
def action(func):
""" Decorator to turn a method of a Component into an
:class:`Action <flexx.event.Action>`.
Actions change the state of the application by
:func:`mutating <flexx.event.Component._mutate>`
:class:`proper... |
__docformat__ = "restructuredtext en"
import sys
import os
from os.path import (splitext, join, abspath, isdir, dirname, exists,
basename, expanduser, normcase, realpath)
from imp import find_module, load_module, C_BUILTIN, PY_COMPILED, PKG_DIRECTORY
from distutils.sysconfig import get_config_var... |
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.utils.translation import gettext as _
from django.views.decorators.http import require_POST
from weblate.trans.tasks import perform_commit
from weblate.trans.util import redirect_param
from weblat... |
from datetime import datetime, timedelta
from os import path
import statistics
import unittest
import pytest
from homeassistant import config as hass_config
from homeassistant.components import recorder
from homeassistant.components.statistics.sensor import DOMAIN, StatisticsSensor
from homeassistant.const import (
... |
import inspect
import logging
import socket
import sys
import time
from queue import Empty
from typing import Any
from typing import List
from typing import Type
import service_configuration_lib
from kazoo.client import KazooClient
from paasta_tools.deployd import watchers
from paasta_tools.deployd.common import Del... |
from datetime import timedelta
import logging
import github
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_NAME,
CONF_ACCESS_TOKEN,
CONF_NAME,
CONF_PATH,
CONF_URL,
)
import homeassistant.helpers.config_validation as cv
f... |
from absl import flags
from perfkitbenchmarker import resource
from perfkitbenchmarker import vm_util
FLAGS = flags.FLAGS
class RedshiftClusterSubnetGroup(resource.BaseResource):
"""Cluster Subnet Group associated with a Redshift cluster launched in a vpc.
A cluster subnet group allows you to specify a set of ... |
import asyncio
import logging
from aiohttp import ClientError
from smart_meter_texas import Account, Client
from smart_meter_texas.exceptions import (
SmartMeterTexasAPIError,
SmartMeterTexasAuthError,
)
import voluptuous as vol
from homeassistant import config_entries, core, exceptions
from homeassistant.co... |
import datetime
import json
import logging
import time
from absl import flags
from perfkitbenchmarker import errors
from perfkitbenchmarker import relational_db
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.providers import azure
from perfkitbenchmarker.providers.azure import azure_network
from perfki... |
from __future__ import absolute_import
from xml.sax.handler import ContentHandler
from lxml import etree
from lxml.etree import ElementTree, SubElement
from lxml.etree import Comment, ProcessingInstruction
class SaxError(etree.LxmlError):
"""General SAX error.
"""
def _getNsTag(tag):
if tag[0] == '{':... |
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import unittest
import requests
import fs.memoryfs
from instalooter.looters import InstaLooter, ProfileLooter
USERNAME = os.getenv("IG_USERNAME")
PASSWORD = os.getenv("IG_PASSWORD")
try:
CONNECTION_FAILURE = not requests... |
from datetime import timedelta
from homeassistant import data_entry_flow
from homeassistant.components.geonetnz_quakes import (
CONF_MINIMUM_MAGNITUDE,
CONF_MMI,
DOMAIN,
)
from homeassistant.const import (
CONF_LATITUDE,
CONF_LONGITUDE,
CONF_RADIUS,
CONF_SCAN_INTERVAL,
CONF_UNIT_SYSTEM... |
from gitsweep.tests.testcases import GitSweepTestCase, InspectorTestCase
class TestInspector(GitSweepTestCase, InspectorTestCase):
"""
Inspector can find merged branches and present them for cleaning.
"""
def test_no_branches(self):
"""
If only the master branch is present, nothing ... |
from io import BytesIO
from urllib.parse import urlparse, urlencode, urlunparse
import copy
import json
import zlib
from .util import CaseInsensitiveDict
def replace_headers(request, replacements):
"""Replace headers in request according to replacements.
The replacements should be a list of (key, value) pai... |
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_BATTERY,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_OPENING,
DEVICE_CLASS_PRESENCE,
DEVICE_CLASS_SMOKE,
BinarySensorEntity,
)
from .const import ATTR_DISCOVER_DEVICES, ATTR_DISCOVERY_TYPE, DISCOVER_BATTERY
from .entity import HMDevice
S... |
import attr
import pytest
from qutebrowser.misc import split
# Most tests copied from Python's shlex.
# The original test data set was from shellwords, by Hartmut Goebel.
# Format: input/split|output|without|keep/split|output|with|keep/
test_data_str = r"""
one two/one|two/one| two/
one "two three" four/one|two t... |
import asyncio
import logging
from typing import Any, Dict, Iterable, Optional
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType
from ... |
import asyncio
import itertools as it
import logging
import voluptuous as vol
from homeassistant.auth.permissions.const import CAT_ENTITIES, POLICY_CONTROL
import homeassistant.config as conf_util
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_LATITUDE,
ATTR_LONGITUDE,
RESTART_EXIT_CODE,
... |
import asyncio
import json
import logging
from pysqueezebox import Server, async_discover
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
ATTR_MEDIA_ENQ... |
from __future__ import absolute_import
import sys
import vim # noqa
try:
from importlib.machinery import PathFinder as _PathFinder
if not hasattr(vim, 'find_module'):
vim.find_module = _PathFinder.find_module
except ImportError:
pass
def auto():
"""Fix PEP8 erorrs in current buffer.
pym... |
import argparse
import logging
import os
import pwd
from multiprocessing import Pool
from arctic.decorators import _get_host
from arctic.store.audit import ArcticTransaction
from .utils import setup_logging
from ..date import DateRange, to_pandas_closed_closed, CLOSED_OPEN, OPEN_CLOSED
from ..hosts import get_arctic_... |
from datetime import timedelta
from typing import Any, Mapping
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import DATA_BYTES, DATA_RATE_KIBIBYTES_PER_SECOND
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers.typing import HomeAssistantType
from homeass... |
import logging
from pylutron_caseta.smartbridge import Smartbridge
from homeassistant import config_entries
from homeassistant.const import CONF_HOST
from . import DOMAIN # pylint: disable=unused-import
from .const import (
ABORT_REASON_ALREADY_CONFIGURED,
ABORT_REASON_CANNOT_CONNECT,
CONF_CA_CERTS,
... |
import pytest
from requests_toolbelt import sessions
import cherrypy._cpnative_server
pytestmark = pytest.mark.skipif(
'sys.platform == "win32"',
reason='tests fail on Windows',
)
@pytest.fixture
def cp_native_server(request):
"""A native server."""
class Root(object):
@cherrypy.expose
... |
from arcam.fmj.client import ConnectionFailed
import pytest
from homeassistant import data_entry_flow
from homeassistant.components import ssdp
from homeassistant.components.arcam_fmj.config_flow import get_entry_client
from homeassistant.components.arcam_fmj.const import DOMAIN, DOMAIN_DATA_ENTRIES
from homeassistan... |
from pscript import this_is_js, RawJS
from pscript.stubs import window, undefined, time, console, JSON
# This module gets transpiled to JavaScript as a whole
__pscript__ = True
class Flexx:
""" JavaScript Flexx module. This provides the connection between
the Python and JS (via a websocket).
"""
de... |
import json
import logging
from perfkitbenchmarker import errors
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.linux_packages import memcached_server
from perfkitbenchmarker.memcache_service import MemcacheService
from perfkitbenchmarker.providers import aws
from perfkitbenchmarker.providers.aws impo... |
from ReText import globalSettings
from ReText.preview import ReTextWebPreview
from ReText.syncscroll import SyncScroll
from PyQt5.QtCore import QEvent, Qt
from PyQt5.QtGui import QDesktopServices, QGuiApplication
from PyQt5.QtWebEngineWidgets import QWebEnginePage, QWebEngineView, QWebEngineSettings
class ReTextWebE... |
from pycfdns.exceptions import (
CloudflareAuthenticationException,
CloudflareConnectionException,
CloudflareZoneException,
)
from homeassistant.components.cloudflare.const import CONF_RECORDS, DOMAIN
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_API_TOKEN, CONF... |
import pickle
import sys
import unittest
from absl import flags
from absl.testing import flagsaver
from perfkitbenchmarker import benchmark_spec
from perfkitbenchmarker import configs
from perfkitbenchmarker import linux_benchmarks
from perfkitbenchmarker import providers
from perfkitbenchmarker.configs import benchma... |
import asyncio
import logging
from typing import Any, Dict, Iterable, Optional
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import Context, State
from homeassistant.helpers.typing import HomeAssistantType
from ... |
from homeassistant.components.cover import ATTR_POSITION, CoverEntity
from . import XiaomiDevice
from .const import DOMAIN, GATEWAYS_KEY
ATTR_CURTAIN_LEVEL = "curtain_level"
DATA_KEY_PROTO_V1 = "status"
DATA_KEY_PROTO_V2 = "curtain_status"
async def async_setup_entry(hass, config_entry, async_add_entities):
"... |
import numpy as np
class BacktestDataHandler(object):
"""
"""
def __init__(
self,
universe,
data_sources=None
):
self.universe = universe
self.data_sources = data_sources
def get_asset_latest_bid_price(self, dt, asset_symbol):
"""
"""
... |
from typing import Any, Dict, List, Optional
from homeassistant.components.climate import DOMAIN as CLIMATE_DOMAIN, ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_TEMPERATURE, TEMP_CELSIUS
from . import DOM... |
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Dict, Tuple, Union, cast
from redbot import VersionInfo, version_info as red_version_info
from . import installable
from .log import log
if TYPE_CHECKING:
from .json_mixins import RepoJSONMixin
__all_... |
import logging
from homeassistant.const import PERCENTAGE
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
)
from homeassistant.helpers.entity import Entity
from . import (
ATTR_ABV,
ATTR_BATCH_VOLUME,
ATTR_BPM,
ATTR_CO2_VOLUME,
ATTR_TEMP,
... |
from tests.components.homekit_controller.common import (
Helper,
setup_accessories_from_file,
setup_test_accessories,
)
async def test_ecobee_occupancy_setup(hass):
"""Test that an Ecbobee occupancy sensor be correctly setup in HA."""
accessories = await setup_accessories_from_file(hass, "ecobee_... |
import logging
from pylutron import Button, Lutron
import voluptuous as vol
from homeassistant.const import ATTR_ID, CONF_HOST, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import discovery
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassist... |
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.db.models import Count
from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.loader import render_to_string
from django.urls import reve... |
from __future__ import division
import warnings
import matplotlib.animation as animation
import matplotlib.pyplot as plt
from .._shared.helpers import *
from .._shared.params import default_params
from ..tools.analyze import analyze
from ..tools.cluster import cluster as clusterer
from ..tools.reduce import reduce as ... |
from os import path
import re
import pytest
from homeassistant import config as hass_config
import homeassistant.components.notify as notify
from homeassistant.components.smtp import DOMAIN
from homeassistant.components.smtp.notify import MailNotificationService
from homeassistant.const import SERVICE_RELOAD
from ho... |
import collections
from typing import MutableSequence, cast
import attr
from PyQt5.QtCore import QObject
from PyQt5.QtWidgets import QApplication
from qutebrowser.config import config
from qutebrowser.mainwindow import mainwindow
instance = cast('WindowUndoManager', None)
@attr.s
class _WindowUndoEntry:
"""... |
from datetime import timedelta
import logging
from pyombi import OmbiError
from homeassistant.helpers.entity import Entity
from .const import DOMAIN, SENSOR_TYPES
_LOGGER = logging.getLogger(__name__)
SCAN_INTERVAL = timedelta(seconds=60)
def setup_platform(hass, config, add_entities, discovery_info=None):
... |
import re
from openrazer_daemon.hardware.device_base import RazerDevice as __RazerDevice, RazerDeviceBrightnessSuspend as __RazerDeviceBrightnessSuspend
from openrazer_daemon.dbus_services.dbus_methods import kraken as _dbus_kraken, chroma_keyboard as _dbus_chroma
class RazerKraken71(__RazerDevice):
"""
Cla... |
import credstash
import pytest
import botocore.exceptions
@pytest.yield_fixture
def secret():
secret = {
'name': 'test',
'version': '0000000000000000000',
'value': 'secret'
}
credstash.putSecret(secret['name'], secret['value'])
try:
yield secret
finally:
cre... |
from __future__ import unicode_literals
from base64 import b16encode
def b16_encode(item):
"""base16 encode"""
try:
return (b16encode(item.encode('utf-8'))).decode()
except:
return ''
|
import os
import io
import sys
import zipfile
import requests
DEPLOYER_ACCESS_TOKEN = os.getenv('DEPLOYER_ACCESS_TOKEN_SITE')
SITE_DIR = os.path.dirname(os.path.abspath(__file__))
def deploy():
imagename = 'flexxdemo:1'
# Zip it up
f = io.BytesIO()
with zipfile.ZipFile(f, 'w') as zf:
... |
import argparse
import numpy as np
import os
import chainer
from chainer.links.caffe.caffe_function import CaffeFunction
from chainercv.links import SEResNet101
from chainercv.links import SEResNet152
from chainercv.links import SEResNet50
from chainercv.links import SEResNeXt101
from chainercv.links import SEResNe... |
import unittest
from absl import flags
from perfkitbenchmarker import disk
from perfkitbenchmarker import smb_service
from tests import pkb_common_test_case
FLAGS = flags.FLAGS
class _FakeSmbService(smb_service.BaseSmbService):
CLOUD = 'mock'
def __init__(self, disk_spec, zone):
super(_FakeSmbService, sel... |
from homeassistant.core import State
from tests.common import async_mock_service
async def test_reproducing_states(hass, caplog):
"""Test reproducing Alert states."""
hass.states.async_set("alert.entity_off", "off", {})
hass.states.async_set("alert.entity_on", "on", {})
turn_on_calls = async_mock_s... |
import pytest
import numpy as np
import functools
from tensornetwork.backends.abstract_backend import AbstractBackend
from tensornetwork.backends import backend_factory
from tensornetwork import backends
import tensornetwork
def jittest_init(backend):
"""
Helper to initialize data for the other Jit tests.
"""
... |
import os
import json
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from test import run_only
try:
from docker import Client
except ImportError:
Client = None
from docker_collector import DockerCollector
dirname = os.path.dirname(__file__)
fixtures_path =... |
import datetime
import logging
from concord232 import client as concord232_client
import requests
import voluptuous as vol
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.components.alarm_control_panel import PLATFORM_SCHEMA
from homeassistant.components.alarm_control_panel.const impo... |
from datetime import date, timedelta
import logging
import recollect_waste
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
_LOGGER = log... |
from redbot import core
from redbot.core import VersionInfo
def test_version_working():
assert hasattr(core, "__version__")
assert core.__version__[0] == "3"
# When adding more of these, ensure they are added in ascending order of precedence
version_tests = (
"3.0.0a32.post10.dev12",
"3.0.0rc1.dev1... |
import logging
import multiprocessing
import queue
import time
from gi.repository import GLib
from meld.matchers import myers
log = logging.getLogger(__name__)
class MatcherWorker(multiprocessing.Process):
END_TASK = -1
matcher_class = myers.InlineMyersSequenceMatcher
def __init__(self, tasks, resu... |
import json
import mock
import pytest
from kazoo.client import KazooClient
from kazoo.exceptions import BadVersionError
from kazoo.exceptions import NodeExistsError
from kazoo.exceptions import NoNodeError
from paasta_tools.frameworks.task_store import DictTaskStore
from paasta_tools.frameworks.task_store import Mes... |
import argparse
import time
from typing import Any
from typing import Iterable
from typing import Mapping
from typing import MutableMapping
from typing import NamedTuple
from typing import Optional
from typing import Tuple
import a_sync
import simplejson as json
from kubernetes.client import V1Pod
from kubernetes.cli... |
import pytest
from hangups import channel
@pytest.mark.parametrize('input_,expected', [
(b'79\n[[0,["c","98803CAAD92268E8","",8]\n]\n,'
b'[1,[{"gsid":"7tCoFHumSL-IT6BHpCaxLA"}]]\n]\n',
('98803CAAD92268E8', '7tCoFHumSL-IT6BHpCaxLA')),
])
def test_parse_sid_response(input_, expected):
assert channel... |
from __future__ import absolute_import, unicode_literals
import os
import pytest
import kaptan
from libtmux import Window
from libtmux.common import has_gte_version
from libtmux.test import retry, temp_session
from tmuxp import config, exc
from tmuxp._compat import text_type
from tmuxp.workspacebuilder import Work... |
import asyncio
import base64
import io
import pytest
from homeassistant.components import camera
from homeassistant.components.camera.const import DOMAIN, PREF_PRELOAD_STREAM
from homeassistant.components.camera.prefs import CameraEntityPreferences
from homeassistant.components.websocket_api.const import TYPE_RESULT... |
from openzwavemqtt.const import CommandClass, ValueIndex, ValueType
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_DOOR,
DEVICE_CLASS_GAS,
DEVICE_CLASS_HEAT,
DEVICE_CLASS_LOCK,
DEVICE_CLASS_MOISTURE,
DEVICE_CLASS_MOTION,
DEVICE_CLASS_POWER,
DEVICE_CLASS_PROBLEM,
... |
import json
import logging
from homeassistant.components import mqtt
from homeassistant.const import DEGREE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from homeassistant.core import callback
from homeassistant.helpers.entity import Entity
from homeassistant.util import slugify
_LOGGER = logging.getLogger(__name__)
DOMAIN = "ar... |
import argparse
from src.training_data import download_and_serialize
def create_parser():
"""Create the argparse parser."""
parser = argparse.ArgumentParser()
parser.add_argument("--tile-size",
default=64,
type=int,
help="tile the NA... |
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
import alembic_autogenerate_enums
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
#... |
import os.path
from datetime import timedelta
from io import StringIO
from django.core import mail
from django.core.exceptions import ValidationError
from django.core.management import call_command
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from dj... |
import sys
import uuid
from .utils import LOGGER
class ParsingError(Exception):
"""Used for forwarding parsing error messages to apply_shortcodes."""
pass
def _format_position(data, pos):
"""Return position formatted as line/column.
This is used for prettier error messages.
"""
line = 0
... |
import genmsg
import genpy.message # for wrapping get_message_class, get_service_class
# forward a bunch of old symbols from genpy for backwards compat
from genpy import DeserializationError # noqa: F401
from genpy import Duration # noqa: F401
from genpy import Message # noqa: F401
from genpy import Serialization... |
import os.path as op
import numpy as np
from numpy.random import randn
import matplotlib.pyplot as plt
import mne
from mne.stats import (spatio_temporal_cluster_test, f_threshold_mway_rm,
f_mway_rm, summarize_clusters_stc)
from mne.minimum_norm import apply_inverse, read_inverse_operator
from ... |
import logging
import pysdcp
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import CONF_HOST, CONF_NAME, STATE_OFF, STATE_ON
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
DEFAULT_NAME = "Sony P... |
import logging
from hyperion import client, const
import voluptuous as vol
from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_EFFECT,
ATTR_HS_COLOR,
PLATFORM_SCHEMA,
SUPPORT_BRIGHTNESS,
SUPPORT_COLOR,
SUPPORT_EFFECT,
LightEntity,
)
from homeassistant.const import CONF_... |
import csv
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404
from django.urls import reverse
from django.utils.http import urlencode
from django.utils.translation im... |
import logging
import lupupy
from lupupy.exceptions import LupusecException
import voluptuous as vol
from homeassistant.const import CONF_IP_ADDRESS, CONF_NAME, CONF_PASSWORD, CONF_USERNAME
from homeassistant.helpers import config_validation as cv, discovery
from homeassistant.helpers.entity import Entity
_LOGGER =... |
from sqlalchemy.orm.exc import NoResultFound
from marshmallow import fields, post_load, pre_load, post_dump
from marshmallow.exceptions import ValidationError
from lemur.common import validators
from lemur.common.schema import LemurSchema, LemurInputSchema, LemurOutputSchema
from lemur.common.fields import (
Key... |
import base64
import logging
import requests
import voluptuous as vol
from homeassistant.components.image_processing import (
ATTR_CONFIDENCE,
CONF_ENTITY_ID,
CONF_NAME,
CONF_SOURCE,
PLATFORM_SCHEMA,
ImageProcessingFaceEntity,
)
from homeassistant.const import (
ATTR_ENTITY_ID,
ATTR_N... |
from pyinsteon.constants import FanSpeed
from homeassistant.components.fan import (
DOMAIN as FAN_DOMAIN,
SPEED_HIGH,
SPEED_LOW,
SPEED_MEDIUM,
SPEED_OFF,
SUPPORT_SET_SPEED,
FanEntity,
)
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import SIGNAL_ADD_ENT... |
import os
import sys
sys.path = [os.path.abspath(os.path.dirname(__file__))] + sys.path
sys.path = [os.path.abspath(os.path.dirname(os.path.dirname(__file__)))] + sys.path
os.environ['is_test_suite'] = 'True'
from auto_ml import Predictor
import dill
import numpy as np
from nose.tools import assert_equal, assert_no... |
import pytest
from kombu import version_info_t
from kombu.utils.text import version_string_as_tuple
def test_dir():
import kombu
assert dir(kombu)
@pytest.mark.parametrize('version,expected', [
('3', version_info_t(3, 0, 0, '', '')),
('3.3', version_info_t(3, 3, 0, '', '')),
('3.3.1', version_i... |
import asyncio
from json import JSONEncoder
import logging
import os
from typing import Any, Callable, Dict, List, Optional, Type, Union
from homeassistant.const import EVENT_HOMEASSISTANT_FINAL_WRITE
from homeassistant.core import CALLBACK_TYPE, CoreState, HomeAssistant, callback
from homeassistant.helpers.event imp... |
import asyncio
import unittest
import pytest
import voluptuous as vol
import yaml
from homeassistant import config
import homeassistant.components as comps
from homeassistant.components.homeassistant import (
SERVICE_CHECK_CONFIG,
SERVICE_RELOAD_CORE_CONFIG,
SERVICE_SET_LOCATION,
)
from homeassistant.con... |
import numpy as np
import unittest
import chainer
from chainer import testing
from chainer.testing import attr
from chainercv.links import PixelwiseSoftmaxClassifier
class DummySemanticSegmentationModel(chainer.Chain):
def __init__(self, n_class):
super(DummySemanticSegmentationModel, self).__init__()
... |
import mock
import pytest
from kubernetes.client.rest import ApiException
from paasta_tools.kubernetes.bin.paasta_secrets_sync import main
from paasta_tools.kubernetes.bin.paasta_secrets_sync import parse_args
from paasta_tools.kubernetes.bin.paasta_secrets_sync import sync_all_secrets
from paasta_tools.kubernetes.bi... |
import sys
import datetime
from Handler import Handler
from configobj import Section
try:
import boto
import boto.ec2.cloudwatch
import boto.utils
except ImportError:
boto = None
class cloudwatchHandler(Handler):
"""
Implements the abstract Handler class
Sending data to a AWS CloudW... |
import argparse
import glob
import os
import struct
import sys
def clamp_to_min_max(value, min, max):
if value > max:
value = max
elif value < min:
value = min
return value
def clamp_to_u8(value):
return clamp_to_min_max(value, 0, 255)
def parse_args():
parser = argparse.Argum... |
import six
from six.moves import zip
from pyVmomi import VmomiSupport, types
import logging
from VmomiSupport import GetWsdlName, Type
__Log__ = logging.getLogger('ObjDiffer')
def LogIf(condition, message):
"""Log a message if the condition is met"""
if condition:
__Log__.debug(message)
def IsPrimitive... |
from pmsensor import co2sensor
from pmsensor.co2sensor import read_mh_z19_with_temperature
import homeassistant.components.mhz19.sensor as mhz19
from homeassistant.components.sensor import DOMAIN
from homeassistant.const import (
CONCENTRATION_PARTS_PER_MILLION,
TEMP_CELSIUS,
TEMP_FAHRENHEIT,
)
from homea... |
from __future__ import (absolute_import, division, print_function,
unicode_literals)
"""Copyright 2015 Roger R Labbe Jr.
FilterPy library.
http://github.com/rlabbe/filterpy
Documentation at:
https://filterpy.readthedocs.org
Supporting book at:
https://github.com/rlabbe/Kalman-and-Bayesian-... |
import logging
from pyinsteon import devices
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import (
async_dispatcher_connect,
async_dispatcher_send,
)
from homeassistant.helpers.entity import Entity
from .const import (
DOMAIN,
SIGNAL_ADD_DEFAULT_LINKS,
SIGNAL_LOA... |
import json
from absl import flags
from perfkitbenchmarker import errors
from perfkitbenchmarker import vm_util
from perfkitbenchmarker.providers.aws import redshift
from perfkitbenchmarker.providers.aws import util
FLAGS = flags.FLAGS
READY_STATUSES = ['available']
SNAPSHOT_READY_STATUSES = ['completed']
def Ad... |
from homeassistant.components.light import ATTR_BRIGHTNESS
from homeassistant.components.rflink import EVENT_BUTTON_PRESSED
from homeassistant.const import (
ATTR_ENTITY_ID,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
STATE_OFF,
STATE_ON,
)
from homeassistant.core import CoreState, State, callback
from tes... |
import unittest
from mock import Mock, call
from datetime import datetime
from trashcli.put import GlobalTrashCan
import os
class TestTopDirRules:
def test(self):
parent_path = lambda _:None
volume_of = lambda _:'/volume'
realpath = lambda _: None
fs = Mock(['move',
... |
from Handler import Handler
import logging
try:
import gmetric
except ImportError:
gmetric = None
class GmetricHandler(Handler):
"""
Implements the abstract Handler class, sending data the same way that
gmetric does.
"""
def __init__(self, config=None):
"""
Create a new i... |
from homeassistant.components.vacuum import STATE_DOCKED
from homeassistant.const import DEVICE_CLASS_BATTERY, PERCENTAGE
from homeassistant.helpers.icon import icon_for_battery_level
from .const import BLID, DOMAIN, ROOMBA_SESSION
from .irobot_base import IRobotEntity
async def async_setup_entry(hass, config_entry... |
from traceback import format_exc, print_exc
import docutils.core
import pygal
from docutils.parsers.rst import Directive
from sphinx.directives.code import CodeBlock
# Patch default style
pygal.config.Config.style.value = pygal.style.RotateStyle(
'#2980b9',
background='#fcfcfc',
plot_background='#ffffff... |
from __future__ import print_function
try:
import cStringIO as stringio
except ImportError:
import io as stringio
import sys
from contextlib import contextmanager
from datetime import datetime as dt
import dateutil
import numpy as np
import pandas
from dateutil.rrule import rrule, DAILY
def dt_or_str_parser... |
import diamond.collector
import re
import os
_RE = re.compile(r'(\d+)\s+(\d+)\s+(\d+)')
class FilestatCollector(diamond.collector.Collector):
PROC = '/proc/sys/fs/file-nr'
def get_default_config_help(self):
config_help = super(FilestatCollector, self).get_default_config_help()
config_help.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.