mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Use new syntax for TypeVar defaults (#135780)
This commit is contained in:
@@ -7,7 +7,7 @@ from collections.abc import Callable, Iterable
|
||||
from datetime import timedelta
|
||||
import logging
|
||||
from types import ModuleType
|
||||
from typing import Any, Generic, TypeVar
|
||||
from typing import Any
|
||||
|
||||
from homeassistant import config as conf_util
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
@@ -37,8 +37,6 @@ from .typing import ConfigType, DiscoveryInfoType, VolDictType, VolSchemaType
|
||||
DEFAULT_SCAN_INTERVAL = timedelta(seconds=15)
|
||||
DATA_INSTANCES = "entity_components"
|
||||
|
||||
_EntityT = TypeVar("_EntityT", bound=entity.Entity, default=entity.Entity)
|
||||
|
||||
|
||||
@bind_hass
|
||||
async def async_update_entity(hass: HomeAssistant, entity_id: str) -> None:
|
||||
@@ -62,7 +60,7 @@ async def async_update_entity(hass: HomeAssistant, entity_id: str) -> None:
|
||||
await entity_obj.async_update_ha_state(True)
|
||||
|
||||
|
||||
class EntityComponent(Generic[_EntityT]):
|
||||
class EntityComponent[_EntityT: entity.Entity = entity.Entity]:
|
||||
"""The EntityComponent manages platforms that manage entities.
|
||||
|
||||
An example of an entity component is 'light', which manages platforms such
|
||||
|
||||
Reference in New Issue
Block a user