Fix circular import (#34441)

pull/30283/head^2
Paulus Schoutsen 2020-04-19 14:41:52 -07:00 committed by GitHub
parent f492a7678d
commit 26f78132ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 4 deletions

View File

@ -2,7 +2,17 @@
import asyncio import asyncio
from functools import partial, wraps from functools import partial, wraps
import logging import logging
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Tuple from typing import (
TYPE_CHECKING,
Any,
Callable,
Dict,
Iterable,
List,
Optional,
Set,
Tuple,
)
import voluptuous as vol import voluptuous as vol
@ -24,12 +34,15 @@ from homeassistant.exceptions import (
) )
from homeassistant.helpers import template from homeassistant.helpers import template
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.typing import ConfigType, HomeAssistantType, TemplateVarsType from homeassistant.helpers.typing import ConfigType, HomeAssistantType, TemplateVarsType
from homeassistant.loader import async_get_integration, bind_hass from homeassistant.loader import async_get_integration, bind_hass
from homeassistant.util.yaml import load_yaml from homeassistant.util.yaml import load_yaml
from homeassistant.util.yaml.loader import JSON_TYPE from homeassistant.util.yaml.loader import JSON_TYPE
if TYPE_CHECKING:
from homeassistant.helpers.entity import Entity # noqa
# mypy: allow-untyped-defs, no-check-untyped-defs # mypy: allow-untyped-defs, no-check-untyped-defs
CONF_SERVICE_ENTITY_ID = "entity_id" CONF_SERVICE_ENTITY_ID = "entity_id"
@ -143,10 +156,10 @@ def extract_entity_ids(
@bind_hass @bind_hass
async def async_extract_entities( async def async_extract_entities(
hass: HomeAssistantType, hass: HomeAssistantType,
entities: Iterable[Entity], entities: Iterable["Entity"],
service_call: ha.ServiceCall, service_call: ha.ServiceCall,
expand_group: bool = True, expand_group: bool = True,
) -> List[Entity]: ) -> List["Entity"]:
"""Extract a list of entity objects from a service call. """Extract a list of entity objects from a service call.
Will convert group entity ids to the entity ids it represents. Will convert group entity ids to the entity ids it represents.