mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +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.const import (
|
||||
ATTR_ASSUMED_STATE,
|
||||
ATTR_ENTITY_ID,
|
||||
ATTR_ICON,
|
||||
ATTR_NAME,
|
||||
CONF_ICON,
|
||||
CONF_NAME,
|
||||
SERVICE_RELOAD,
|
||||
STATE_CLOSED,
|
||||
STATE_HOME,
|
||||
STATE_LOCKED,
|
||||
STATE_NOT_HOME,
|
||||
STATE_OFF,
|
||||
STATE_OK,
|
||||
STATE_ON,
|
||||
STATE_OPEN,
|
||||
STATE_LOCKED,
|
||||
STATE_UNLOCKED,
|
||||
STATE_OK,
|
||||
STATE_PROBLEM,
|
||||
STATE_UNKNOWN,
|
||||
ATTR_ASSUMED_STATE,
|
||||
SERVICE_RELOAD,
|
||||
ATTR_NAME,
|
||||
ATTR_ICON,
|
||||
STATE_UNLOCKED,
|
||||
)
|
||||
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_component import EntityComponent
|
||||
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.loader import bind_hass
|
||||
|
||||
# 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
|
||||
|
||||
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 (
|
||||
ATTR_CURRENT_POSITION,
|
||||
ATTR_CURRENT_TILT_POSITION,
|
||||
@ -41,7 +29,17 @@ from homeassistant.components.cover import (
|
||||
SUPPORT_STOP_TILT,
|
||||
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: no-check-untyped-defs
|
||||
|
@ -8,20 +8,6 @@ from typing import Any, Callable, Iterator, List, Optional, Tuple, cast
|
||||
import voluptuous as vol
|
||||
|
||||
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 (
|
||||
ATTR_BRIGHTNESS,
|
||||
ATTR_COLOR_TEMP,
|
||||
@ -42,7 +28,19 @@ from homeassistant.components.light import (
|
||||
SUPPORT_TRANSITION,
|
||||
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: no-check-untyped-defs
|
||||
|
@ -6,9 +6,6 @@ import logging
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import ATTR_SERVICE
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from homeassistant.components.notify import (
|
||||
ATTR_DATA,
|
||||
ATTR_MESSAGE,
|
||||
@ -16,7 +13,8 @@ from homeassistant.components.notify import (
|
||||
PLATFORM_SCHEMA,
|
||||
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
|
||||
|
||||
|
@ -2,15 +2,16 @@
|
||||
from typing import Iterable, Optional
|
||||
|
||||
from homeassistant.core import Context, State
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
from homeassistant.helpers.typing import HomeAssistantType
|
||||
|
||||
from . import get_entity_ids
|
||||
|
||||
|
||||
async def async_reproduce_states(
|
||||
hass: HomeAssistantType, states: Iterable[State], context: Optional[Context] = None
|
||||
) -> None:
|
||||
"""Reproduce component states."""
|
||||
from . import get_entity_ids
|
||||
from homeassistant.helpers.state import async_reproduce_state
|
||||
|
||||
states_copy = []
|
||||
for state in states:
|
||||
|
@ -21,7 +21,9 @@ async def test_reproduce_group(hass):
|
||||
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.set_result(None)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user