mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Move imports to top for group (#29485)
* Move imports to top for group * Fix failing test for group
This commit is contained in:
parent
ed464a75b2
commit
ed5cdb528c
@ -7,34 +7,33 @@ import voluptuous as vol
|
|||||||
|
|
||||||
from homeassistant import core as ha
|
from homeassistant import core as ha
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
ATTR_ASSUMED_STATE,
|
||||||
ATTR_ENTITY_ID,
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_ICON,
|
||||||
|
ATTR_NAME,
|
||||||
CONF_ICON,
|
CONF_ICON,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
SERVICE_RELOAD,
|
||||||
STATE_CLOSED,
|
STATE_CLOSED,
|
||||||
STATE_HOME,
|
STATE_HOME,
|
||||||
|
STATE_LOCKED,
|
||||||
STATE_NOT_HOME,
|
STATE_NOT_HOME,
|
||||||
STATE_OFF,
|
STATE_OFF,
|
||||||
|
STATE_OK,
|
||||||
STATE_ON,
|
STATE_ON,
|
||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_LOCKED,
|
|
||||||
STATE_UNLOCKED,
|
|
||||||
STATE_OK,
|
|
||||||
STATE_PROBLEM,
|
STATE_PROBLEM,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
ATTR_ASSUMED_STATE,
|
STATE_UNLOCKED,
|
||||||
SERVICE_RELOAD,
|
|
||||||
ATTR_NAME,
|
|
||||||
ATTR_ICON,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.loader import bind_hass
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.config_validation import make_entity_service_schema
|
||||||
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
from homeassistant.helpers.entity import Entity, async_generate_entity_id
|
||||||
from homeassistant.helpers.entity_component import EntityComponent
|
from homeassistant.helpers.entity_component import EntityComponent
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.helpers.config_validation import make_entity_service_schema
|
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
from homeassistant.loader import bind_hass
|
||||||
|
|
||||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
||||||
|
|
||||||
|
@ -4,18 +4,6 @@ from typing import Dict, Optional, Set
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
|
||||||
ATTR_ASSUMED_STATE,
|
|
||||||
ATTR_ENTITY_ID,
|
|
||||||
ATTR_SUPPORTED_FEATURES,
|
|
||||||
CONF_ENTITIES,
|
|
||||||
CONF_NAME,
|
|
||||||
STATE_CLOSED,
|
|
||||||
)
|
|
||||||
from homeassistant.core import callback, State
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
|
||||||
|
|
||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_CURRENT_POSITION,
|
ATTR_CURRENT_POSITION,
|
||||||
ATTR_CURRENT_TILT_POSITION,
|
ATTR_CURRENT_TILT_POSITION,
|
||||||
@ -41,7 +29,17 @@ from homeassistant.components.cover import (
|
|||||||
SUPPORT_STOP_TILT,
|
SUPPORT_STOP_TILT,
|
||||||
CoverDevice,
|
CoverDevice,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import (
|
||||||
|
ATTR_ASSUMED_STATE,
|
||||||
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_SUPPORTED_FEATURES,
|
||||||
|
CONF_ENTITIES,
|
||||||
|
CONF_NAME,
|
||||||
|
STATE_CLOSED,
|
||||||
|
)
|
||||||
|
from homeassistant.core import State, callback
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
|
|
||||||
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
||||||
# mypy: no-check-untyped-defs
|
# mypy: no-check-untyped-defs
|
||||||
|
@ -8,20 +8,6 @@ from typing import Any, Callable, Iterator, List, Optional, Tuple, cast
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import light
|
from homeassistant.components import light
|
||||||
from homeassistant.const import (
|
|
||||||
ATTR_ENTITY_ID,
|
|
||||||
ATTR_SUPPORTED_FEATURES,
|
|
||||||
CONF_ENTITIES,
|
|
||||||
CONF_NAME,
|
|
||||||
STATE_ON,
|
|
||||||
STATE_UNAVAILABLE,
|
|
||||||
)
|
|
||||||
from homeassistant.core import CALLBACK_TYPE, State, callback
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.helpers.event import async_track_state_change
|
|
||||||
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
|
||||||
from homeassistant.util import color as color_util
|
|
||||||
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_COLOR_TEMP,
|
ATTR_COLOR_TEMP,
|
||||||
@ -42,7 +28,19 @@ from homeassistant.components.light import (
|
|||||||
SUPPORT_TRANSITION,
|
SUPPORT_TRANSITION,
|
||||||
SUPPORT_WHITE_VALUE,
|
SUPPORT_WHITE_VALUE,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import (
|
||||||
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_SUPPORTED_FEATURES,
|
||||||
|
CONF_ENTITIES,
|
||||||
|
CONF_NAME,
|
||||||
|
STATE_ON,
|
||||||
|
STATE_UNAVAILABLE,
|
||||||
|
)
|
||||||
|
from homeassistant.core import CALLBACK_TYPE, State, callback
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.event import async_track_state_change
|
||||||
|
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
|
||||||
|
from homeassistant.util import color as color_util
|
||||||
|
|
||||||
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
# mypy: allow-incomplete-defs, allow-untyped-calls, allow-untyped-defs
|
||||||
# mypy: no-check-untyped-defs
|
# mypy: no-check-untyped-defs
|
||||||
|
@ -6,9 +6,6 @@ import logging
|
|||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import ATTR_SERVICE
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
from homeassistant.components.notify import (
|
from homeassistant.components.notify import (
|
||||||
ATTR_DATA,
|
ATTR_DATA,
|
||||||
ATTR_MESSAGE,
|
ATTR_MESSAGE,
|
||||||
@ -16,7 +13,8 @@ from homeassistant.components.notify import (
|
|||||||
PLATFORM_SCHEMA,
|
PLATFORM_SCHEMA,
|
||||||
BaseNotificationService,
|
BaseNotificationService,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import ATTR_SERVICE
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
|
||||||
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
# mypy: allow-untyped-calls, allow-untyped-defs, no-check-untyped-defs
|
||||||
|
|
||||||
|
@ -2,15 +2,16 @@
|
|||||||
from typing import Iterable, Optional
|
from typing import Iterable, Optional
|
||||||
|
|
||||||
from homeassistant.core import Context, State
|
from homeassistant.core import Context, State
|
||||||
|
from homeassistant.helpers.state import async_reproduce_state
|
||||||
from homeassistant.helpers.typing import HomeAssistantType
|
from homeassistant.helpers.typing import HomeAssistantType
|
||||||
|
|
||||||
|
from . import get_entity_ids
|
||||||
|
|
||||||
|
|
||||||
async def async_reproduce_states(
|
async def async_reproduce_states(
|
||||||
hass: HomeAssistantType, states: Iterable[State], context: Optional[Context] = None
|
hass: HomeAssistantType, states: Iterable[State], context: Optional[Context] = None
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Reproduce component states."""
|
"""Reproduce component states."""
|
||||||
from . import get_entity_ids
|
|
||||||
from homeassistant.helpers.state import async_reproduce_state
|
|
||||||
|
|
||||||
states_copy = []
|
states_copy = []
|
||||||
for state in states:
|
for state in states:
|
||||||
|
@ -21,7 +21,9 @@ async def test_reproduce_group(hass):
|
|||||||
context=state.context,
|
context=state.context,
|
||||||
)
|
)
|
||||||
|
|
||||||
with patch("homeassistant.helpers.state.async_reproduce_state") as fun:
|
with patch(
|
||||||
|
"homeassistant.components.group.reproduce_state.async_reproduce_state"
|
||||||
|
) as fun:
|
||||||
fun.return_value = Future()
|
fun.return_value = Future()
|
||||||
fun.return_value.set_result(None)
|
fun.return_value.set_result(None)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user