use isort to sort imports according to PEP8 for automation (#29620)
parent
a38f3ac9c6
commit
d3f67c3841
|
@ -27,13 +27,12 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.helpers.config_validation import make_entity_service_schema
|
||||
from homeassistant.helpers.entity import ToggleEntity
|
||||
from homeassistant.helpers.entity_component import EntityComponent
|
||||
from homeassistant.helpers.service import async_register_admin_service
|
||||
from homeassistant.helpers.restore_state import RestoreEntity
|
||||
from homeassistant.helpers.service import async_register_admin_service
|
||||
from homeassistant.helpers.typing import TemplateVarsType
|
||||
from homeassistant.loader import bind_hass
|
||||
from homeassistant.util.dt import parse_datetime, utcnow
|
||||
|
||||
|
||||
# mypy: allow-untyped-calls, allow-untyped-defs
|
||||
# mypy: no-check-untyped-defs, no-warn-return-any
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import voluptuous as vol
|
|||
from homeassistant.components.device_automation.exceptions import (
|
||||
InvalidDeviceAutomationConfig,
|
||||
)
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.config import async_log_exception, config_without_domain
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers import condition, config_per_platform, script
|
||||
from homeassistant.loader import IntegrationNotFound
|
||||
|
|
|
@ -7,7 +7,6 @@ from homeassistant.components.device_automation import (
|
|||
)
|
||||
from homeassistant.const import CONF_DOMAIN
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
TRIGGER_SCHEMA = TRIGGER_BASE_SCHEMA.extend({}, extra=vol.ALLOW_EXTRA)
|
||||
|
|
|
@ -3,11 +3,10 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
CONF_EVENT_TYPE = "event_type"
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.geo_location import DOMAIN
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import (
|
||||
CONF_EVENT,
|
||||
CONF_PLATFORM,
|
||||
|
@ -10,10 +9,10 @@ from homeassistant.const import (
|
|||
CONF_ZONE,
|
||||
EVENT_STATE_CHANGED,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import condition, config_validation as cv
|
||||
from homeassistant.helpers.config_validation import entity_domain
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
EVENT_ENTER = "enter"
|
||||
|
|
|
@ -3,9 +3,8 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback, CoreState
|
||||
from homeassistant.const import CONF_PLATFORM, CONF_EVENT, EVENT_HOMEASSISTANT_STOP
|
||||
|
||||
from homeassistant.const import CONF_EVENT, CONF_PLATFORM, EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import CoreState, callback
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.helpers.event import track_point_in_utc_time
|
||||
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@ import json
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.components import mqtt
|
||||
from homeassistant.const import CONF_PLATFORM, CONF_PAYLOAD
|
||||
from homeassistant.const import CONF_PAYLOAD, CONF_PLATFORM
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
CONF_ENCODING = "encoding"
|
||||
|
|
|
@ -4,18 +4,17 @@ import logging
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.const import (
|
||||
CONF_VALUE_TEMPLATE,
|
||||
CONF_PLATFORM,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_BELOW,
|
||||
CONF_ABOVE,
|
||||
CONF_BELOW,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_FOR,
|
||||
CONF_PLATFORM,
|
||||
CONF_VALUE_TEMPLATE,
|
||||
)
|
||||
from homeassistant.helpers.event import async_track_state_change, async_track_same_state
|
||||
from homeassistant.core import CALLBACK_TYPE, callback
|
||||
from homeassistant.helpers import condition, config_validation as cv, template
|
||||
|
||||
from homeassistant.helpers.event import async_track_same_state, async_track_state_change
|
||||
|
||||
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
||||
# mypy: no-check-untyped-defs
|
||||
|
|
|
@ -5,10 +5,10 @@ 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
|
||||
|
|
|
@ -6,11 +6,10 @@ from typing import Dict
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.core import HomeAssistant, CALLBACK_TYPE, callback
|
||||
from homeassistant.const import MATCH_ALL, CONF_PLATFORM, CONF_FOR
|
||||
from homeassistant.const import CONF_FOR, CONF_PLATFORM, MATCH_ALL
|
||||
from homeassistant.core import CALLBACK_TYPE, HomeAssistant, callback
|
||||
from homeassistant.helpers import config_validation as cv, template
|
||||
from homeassistant.helpers.event import async_track_state_change, async_track_same_state
|
||||
|
||||
from homeassistant.helpers.event import async_track_same_state, async_track_state_change
|
||||
|
||||
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
||||
# mypy: no-check-untyped-defs
|
||||
|
|
|
@ -4,16 +4,15 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import (
|
||||
CONF_EVENT,
|
||||
CONF_OFFSET,
|
||||
CONF_PLATFORM,
|
||||
SUN_EVENT_SUNRISE,
|
||||
)
|
||||
from homeassistant.helpers.event import async_track_sunrise, async_track_sunset
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.helpers.event import async_track_sunrise, async_track_sunset
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
|
|
|
@ -3,13 +3,11 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_VALUE_TEMPLATE, CONF_PLATFORM, CONF_FOR
|
||||
from homeassistant import exceptions
|
||||
from homeassistant.helpers import condition
|
||||
from homeassistant.const import CONF_FOR, CONF_PLATFORM, CONF_VALUE_TEMPLATE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import condition, config_validation as cv, template
|
||||
from homeassistant.helpers.event import async_track_same_state, async_track_template
|
||||
from homeassistant.helpers import config_validation as cv, template
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
|
|
|
@ -3,12 +3,11 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_AT, CONF_PLATFORM
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_time_change
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -3,12 +3,11 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_PLATFORM
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.event import async_track_time_change
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
CONF_HOURS = "hours"
|
||||
|
|
|
@ -5,13 +5,12 @@ import logging
|
|||
from aiohttp import hdrs
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import CONF_PLATFORM, CONF_WEBHOOK_ID
|
||||
from homeassistant.core import callback
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import DOMAIN as AUTOMATION_DOMAIN
|
||||
|
||||
|
||||
# mypy: allow-untyped-defs
|
||||
|
||||
DEPENDENCIES = ("webhook",)
|
||||
|
|
|
@ -1,17 +1,16 @@
|
|||
"""Offer zone automation rules."""
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import (
|
||||
CONF_EVENT,
|
||||
CONF_ENTITY_ID,
|
||||
CONF_EVENT,
|
||||
CONF_PLATFORM,
|
||||
CONF_ZONE,
|
||||
MATCH_ALL,
|
||||
CONF_PLATFORM,
|
||||
)
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import condition, config_validation as cv, location
|
||||
|
||||
from homeassistant.helpers.event import async_track_state_change
|
||||
|
||||
# mypy: allow-untyped-defs, no-check-untyped-defs
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ components. Instead call the service directly.
|
|||
from homeassistant.components.automation import DOMAIN, SERVICE_TRIGGER
|
||||
from homeassistant.const import (
|
||||
ATTR_ENTITY_ID,
|
||||
SERVICE_TURN_ON,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_RELOAD,
|
||||
ENTITY_MATCH_ALL,
|
||||
SERVICE_RELOAD,
|
||||
SERVICE_TOGGLE,
|
||||
SERVICE_TURN_OFF,
|
||||
SERVICE_TURN_ON,
|
||||
)
|
||||
from homeassistant.loader import bind_hass
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""The tests for the Event automation."""
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import mock_component
|
||||
from tests.common import async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -5,9 +5,8 @@ from homeassistant.components import automation, zone
|
|||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import mock_component
|
||||
from tests.common import async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""The tests for the Event automation."""
|
||||
from unittest.mock import patch, Mock
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import CoreState
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import async_mock_service, mock_coro
|
||||
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
"""The tests for the litejet component."""
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from unittest import mock
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant import setup
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components import litejet
|
||||
import homeassistant.components.automation as automation
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed, async_mock_service
|
||||
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
"""The tests for the MQTT automation."""
|
||||
import pytest
|
||||
from unittest import mock
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from tests.common import (
|
||||
async_fire_mqtt_message,
|
||||
mock_component,
|
||||
async_mock_service,
|
||||
async_mock_mqtt_component,
|
||||
async_mock_service,
|
||||
mock_component,
|
||||
)
|
||||
from tests.components.automation import common
|
||||
|
||||
|
|
|
@ -1,18 +1,19 @@
|
|||
"""The tests for numeric state automation."""
|
||||
from datetime import timedelta
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import (
|
||||
mock_component,
|
||||
async_fire_time_changed,
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
async_mock_service,
|
||||
mock_component,
|
||||
)
|
||||
from tests.components.automation import common
|
||||
|
||||
|
|
|
@ -1,17 +1,21 @@
|
|||
"""The test for state automation."""
|
||||
from datetime import timedelta
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import async_fire_time_changed, assert_setup_component, mock_component
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
async_mock_service,
|
||||
mock_component,
|
||||
)
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
"""The tests for the sun automation."""
|
||||
from datetime import datetime
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
|
||||
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
|
||||
from homeassistant.setup import async_setup_component
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import sun
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.const import SUN_EVENT_SUNRISE, SUN_EVENT_SUNSET
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from tests.common import async_fire_time_changed, mock_component, async_mock_service
|
||||
from tests.common import async_fire_time_changed, async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
|
||||
ORIG_TIME_ZONE = dt_util.DEFAULT_TIME_ZONE
|
||||
|
|
|
@ -4,14 +4,18 @@ from unittest import mock
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import async_fire_time_changed, assert_setup_component, mock_component
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
async_mock_service,
|
||||
mock_component,
|
||||
)
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -4,12 +4,16 @@ from unittest.mock import patch
|
|||
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import async_fire_time_changed, assert_setup_component, mock_component
|
||||
from tests.common import async_mock_service
|
||||
from tests.common import (
|
||||
assert_setup_component,
|
||||
async_fire_time_changed,
|
||||
async_mock_service,
|
||||
mock_component,
|
||||
)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
"""The tests for the time_pattern automation."""
|
||||
import pytest
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.setup import async_setup_component
|
||||
import homeassistant.util.dt as dt_util
|
||||
import homeassistant.components.automation as automation
|
||||
|
||||
from tests.common import async_fire_time_changed, mock_component
|
||||
from tests.common import async_fire_time_changed, async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
"""The tests for the location automation."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.components import automation, zone
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import automation, zone
|
||||
|
||||
from tests.components.automation import common
|
||||
from tests.common import async_mock_service, mock_component
|
||||
from tests.components.automation import common
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
Loading…
Reference in New Issue