mirror of
https://github.com/home-assistant/core
synced 2024-09-03 08:14:07 +02:00
use isort to sort imports according to PEP8 for light (#29648)
This commit is contained in:
parent
ce5072fc91
commit
aeff27680b
@ -17,7 +17,7 @@ from homeassistant.const import (
|
||||
SERVICE_TURN_ON,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.exceptions import UnknownUser, Unauthorized
|
||||
from homeassistant.exceptions import Unauthorized, UnknownUser
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.config_validation import ( # noqa: F401
|
||||
PLATFORM_SCHEMA,
|
||||
@ -29,7 +29,6 @@ from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.loader import bind_hass
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
DOMAIN = "light"
|
||||
|
@ -1,13 +1,14 @@
|
||||
"""Provides device actions for lights."""
|
||||
from typing import List
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import HomeAssistant, Context
|
||||
from homeassistant.components.device_automation import toggle_entity
|
||||
from homeassistant.const import CONF_DOMAIN
|
||||
from homeassistant.helpers.typing import TemplateVarsType, ConfigType
|
||||
from . import DOMAIN
|
||||
from homeassistant.core import Context, HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType, TemplateVarsType
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
ACTION_SCHEMA = toggle_entity.ACTION_SCHEMA.extend({vol.Required(CONF_DOMAIN): DOMAIN})
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
"""Provides device conditions for lights."""
|
||||
from typing import Dict, List
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.components.device_automation import toggle_entity
|
||||
from homeassistant.const import CONF_DOMAIN
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.condition import ConditionCheckerType
|
||||
from . import DOMAIN
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
CONDITION_SCHEMA = toggle_entity.CONDITION_SCHEMA.extend(
|
||||
{vol.Required(CONF_DOMAIN): DOMAIN}
|
||||
|
@ -1,14 +1,15 @@
|
||||
"""Provides device trigger for lights."""
|
||||
from typing import List
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import HomeAssistant, CALLBACK_TYPE
|
||||
from homeassistant.components.automation import AutomationActionType
|
||||
from homeassistant.components.device_automation import toggle_entity
|
||||
from homeassistant.const import CONF_DOMAIN
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
from . import DOMAIN
|
||||
|
||||
from . import DOMAIN
|
||||
|
||||
TRIGGER_SCHEMA = toggle_entity.TRIGGER_SCHEMA.extend(
|
||||
{vol.Required(CONF_DOMAIN): DOMAIN}
|
||||
|
@ -3,20 +3,19 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import intent
|
||||
import homeassistant.util.color as color_util
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
from . import (
|
||||
ATTR_ENTITY_ID,
|
||||
SUPPORT_COLOR,
|
||||
ATTR_RGB_COLOR,
|
||||
ATTR_BRIGHTNESS_PCT,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_RGB_COLOR,
|
||||
DOMAIN,
|
||||
SERVICE_TURN_ON,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
)
|
||||
|
||||
|
||||
INTENT_SET = "HassLightSet"
|
||||
|
||||
|
||||
|
@ -6,16 +6,15 @@ from typing import Iterable, Optional
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
STATE_ON,
|
||||
STATE_OFF,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import (
|
||||
DOMAIN,
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_BRIGHTNESS_PCT,
|
||||
ATTR_COLOR_NAME,
|
||||
@ -29,6 +28,7 @@ from . import (
|
||||
ATTR_TRANSITION,
|
||||
ATTR_WHITE_VALUE,
|
||||
ATTR_XY_COLOR,
|
||||
DOMAIN,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
@ -15,7 +15,8 @@ from homeassistant.components.mqtt.discovery import (
|
||||
clear_discovery_hash,
|
||||
)
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.typing import HomeAssistantType, ConfigType
|
||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||
|
||||
from .schema import CONF_SCHEMA, MQTT_LIGHT_SCHEMA_SCHEMA
|
||||
from .schema_basic import PLATFORM_SCHEMA_BASIC, async_setup_entity_basic
|
||||
from .schema_json import PLATFORM_SCHEMA_JSON, async_setup_entity_json
|
||||
|
@ -8,7 +8,6 @@ import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
@ -16,29 +15,12 @@ from homeassistant.components.light import (
|
||||
ATTR_EFFECT,
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_WHITE_VALUE,
|
||||
Light,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_COLOR_TEMP,
|
||||
SUPPORT_EFFECT,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_WHITE_VALUE,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_BRIGHTNESS,
|
||||
CONF_COLOR_TEMP,
|
||||
CONF_DEVICE,
|
||||
CONF_EFFECT,
|
||||
CONF_HS,
|
||||
CONF_NAME,
|
||||
CONF_OPTIMISTIC,
|
||||
CONF_PAYLOAD_OFF,
|
||||
CONF_PAYLOAD_ON,
|
||||
STATE_ON,
|
||||
CONF_RGB,
|
||||
CONF_STATE,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
CONF_WHITE_VALUE,
|
||||
CONF_XY,
|
||||
Light,
|
||||
)
|
||||
from homeassistant.components.mqtt import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
@ -52,8 +34,26 @@ from homeassistant.components.mqtt import (
|
||||
MqttEntityDeviceInfo,
|
||||
subscription,
|
||||
)
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.const import (
|
||||
CONF_BRIGHTNESS,
|
||||
CONF_COLOR_TEMP,
|
||||
CONF_DEVICE,
|
||||
CONF_EFFECT,
|
||||
CONF_HS,
|
||||
CONF_NAME,
|
||||
CONF_OPTIMISTIC,
|
||||
CONF_PAYLOAD_OFF,
|
||||
CONF_PAYLOAD_ON,
|
||||
CONF_RGB,
|
||||
CONF_STATE,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
CONF_WHITE_VALUE,
|
||||
CONF_XY,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
from .schema import MQTT_LIGHT_SCHEMA_SCHEMA
|
||||
|
@ -5,9 +5,9 @@ For more details about this platform, please refer to the documentation at
|
||||
https://home-assistant.io/components/light.mqtt_template/
|
||||
"""
|
||||
import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.components.light import (
|
||||
ATTR_BRIGHTNESS,
|
||||
@ -17,21 +17,14 @@ from homeassistant.components.light import (
|
||||
ATTR_HS_COLOR,
|
||||
ATTR_TRANSITION,
|
||||
ATTR_WHITE_VALUE,
|
||||
Light,
|
||||
SUPPORT_BRIGHTNESS,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_COLOR_TEMP,
|
||||
SUPPORT_EFFECT,
|
||||
SUPPORT_FLASH,
|
||||
SUPPORT_COLOR,
|
||||
SUPPORT_TRANSITION,
|
||||
SUPPORT_WHITE_VALUE,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_NAME,
|
||||
CONF_OPTIMISTIC,
|
||||
STATE_ON,
|
||||
STATE_OFF,
|
||||
Light,
|
||||
)
|
||||
from homeassistant.components.mqtt import (
|
||||
CONF_COMMAND_TOPIC,
|
||||
@ -45,9 +38,17 @@ from homeassistant.components.mqtt import (
|
||||
MqttEntityDeviceInfo,
|
||||
subscription,
|
||||
)
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
CONF_NAME,
|
||||
CONF_OPTIMISTIC,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.color as color_util
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
import homeassistant.util.color as color_util
|
||||
|
||||
from .schema import MQTT_LIGHT_SCHEMA_SCHEMA
|
||||
|
||||
|
@ -21,10 +21,10 @@ from homeassistant.components.light import (
|
||||
)
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
ENTITY_MATCH_ALL,
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
ENTITY_MATCH_ALL,
|
||||
)
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
"""The test for light device automation."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automations,
|
||||
async_mock_service,
|
||||
mock_device_registry,
|
||||
mock_registry,
|
||||
async_get_device_automations,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
"""The test for light device automation."""
|
||||
from datetime import timedelta
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
|
||||
from homeassistant.setup import async_setup_component
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_get_device_automation_capabilities,
|
||||
async_get_device_automations,
|
||||
async_mock_service,
|
||||
mock_device_registry,
|
||||
mock_registry,
|
||||
async_get_device_automations,
|
||||
async_get_device_automation_capabilities,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,22 +1,23 @@
|
||||
"""The test for light device automation."""
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import STATE_ON, STATE_OFF, CONF_PLATFORM
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.light import DOMAIN
|
||||
from homeassistant.const import CONF_PLATFORM, STATE_OFF, STATE_ON
|
||||
from homeassistant.helpers import device_registry
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_fire_time_changed,
|
||||
async_get_device_automation_capabilities,
|
||||
async_get_device_automations,
|
||||
async_mock_service,
|
||||
mock_device_registry,
|
||||
mock_registry,
|
||||
async_get_device_automations,
|
||||
async_get_device_automation_capabilities,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1,31 +1,27 @@
|
||||
"""The tests for the Light component."""
|
||||
# pylint: disable=protected-access
|
||||
from io import StringIO
|
||||
import os
|
||||
import unittest
|
||||
import unittest.mock as mock
|
||||
import os
|
||||
from io import StringIO
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import core
|
||||
from homeassistant.exceptions import Unauthorized
|
||||
from homeassistant.setup import setup_component, async_setup_component
|
||||
from homeassistant.components import light
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
STATE_ON,
|
||||
STATE_OFF,
|
||||
CONF_PLATFORM,
|
||||
SERVICE_TURN_ON,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
STATE_OFF,
|
||||
STATE_ON,
|
||||
)
|
||||
from homeassistant.components import light
|
||||
from homeassistant.exceptions import Unauthorized
|
||||
from homeassistant.setup import async_setup_component, setup_component
|
||||
|
||||
from tests.common import (
|
||||
mock_service,
|
||||
get_test_home_assistant,
|
||||
mock_storage,
|
||||
)
|
||||
from tests.common import get_test_home_assistant, mock_service, mock_storage
|
||||
from tests.components.light import common
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
"""Tests for the light intents."""
|
||||
from homeassistant.helpers.intent import IntentHandleError
|
||||
|
||||
from homeassistant.const import ATTR_SUPPORTED_FEATURES, SERVICE_TURN_ON, ATTR_ENTITY_ID
|
||||
from homeassistant.components import light
|
||||
from homeassistant.components.light import intent
|
||||
from homeassistant.const import ATTR_ENTITY_ID, ATTR_SUPPORTED_FEATURES, SERVICE_TURN_ON
|
||||
from homeassistant.helpers.intent import IntentHandleError
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user