diff --git a/homeassistant/components/air_quality/group.py b/homeassistant/components/air_quality/group.py index 2bc4a122fdc..8dc92ef6d07 100644 --- a/homeassistant/components/air_quality/group.py +++ b/homeassistant/components/air_quality/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.core import HomeAssistant, callback @@ -12,7 +14,7 @@ from .const import DOMAIN @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.exclude_domain(DOMAIN) diff --git a/homeassistant/components/alarm_control_panel/group.py b/homeassistant/components/alarm_control_panel/group.py index 5b90b255ada..5504294c4b9 100644 --- a/homeassistant/components/alarm_control_panel/group.py +++ b/homeassistant/components/alarm_control_panel/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import ( @@ -22,7 +24,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/climate/group.py b/homeassistant/components/climate/group.py index 9ac4519ff0c..927bd2768f2 100644 --- a/homeassistant/components/climate/group.py +++ b/homeassistant/components/climate/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_OFF, STATE_ON @@ -13,7 +15,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/cover/group.py b/homeassistant/components/cover/group.py index 8beb0b6837c..8d7b860bc94 100644 --- a/homeassistant/components/cover/group.py +++ b/homeassistant/components/cover/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_CLOSED, STATE_OPEN @@ -13,7 +15,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" # On means open, Off means closed diff --git a/homeassistant/components/device_tracker/group.py b/homeassistant/components/device_tracker/group.py index 1c28887c2ca..8143251e7fa 100644 --- a/homeassistant/components/device_tracker/group.py +++ b/homeassistant/components/device_tracker/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_HOME, STATE_NOT_HOME @@ -13,7 +15,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME) diff --git a/homeassistant/components/homekit/models.py b/homeassistant/components/homekit/models.py index fee081c9e51..f3fa8b7504c 100644 --- a/homeassistant/components/homekit/models.py +++ b/homeassistant/components/homekit/models.py @@ -1,5 +1,7 @@ """Models for the HomeKit component.""" +from __future__ import annotations + from dataclasses import dataclass from typing import TYPE_CHECKING @@ -11,6 +13,6 @@ if TYPE_CHECKING: class HomeKitEntryData: """Class to hold HomeKit data.""" - homekit: "HomeKit" + homekit: HomeKit pairing_qr: bytes | None = None pairing_qr_secret: str | None = None diff --git a/homeassistant/components/hue/v2/device.py b/homeassistant/components/hue/v2/device.py index 38c5724d4a8..25a027f9ebe 100644 --- a/homeassistant/components/hue/v2/device.py +++ b/homeassistant/components/hue/v2/device.py @@ -1,5 +1,7 @@ """Handles Hue resource of type `device` mapping to Home Assistant device.""" +from __future__ import annotations + from typing import TYPE_CHECKING from aiohue.v2 import HueBridgeV2 @@ -27,7 +29,7 @@ if TYPE_CHECKING: from ..bridge import HueBridge -async def async_setup_devices(bridge: "HueBridge"): +async def async_setup_devices(bridge: HueBridge): """Manage setup of devices from Hue devices.""" entry = bridge.config_entry hass = bridge.hass diff --git a/homeassistant/components/hue/v2/hue_event.py b/homeassistant/components/hue/v2/hue_event.py index 6aee6c67bf3..b0e0de234f1 100644 --- a/homeassistant/components/hue/v2/hue_event.py +++ b/homeassistant/components/hue/v2/hue_event.py @@ -1,5 +1,7 @@ """Handle forward of events transmitted by Hue devices to HASS.""" +from __future__ import annotations + import logging from typing import TYPE_CHECKING @@ -25,7 +27,7 @@ if TYPE_CHECKING: LOGGER = logging.getLogger(__name__) -async def async_setup_hue_events(bridge: "HueBridge"): +async def async_setup_hue_events(bridge: HueBridge): """Manage listeners for stateless Hue sensors that emit events.""" hass = bridge.hass api: HueBridgeV2 = bridge.api # to satisfy typing diff --git a/homeassistant/components/lock/group.py b/homeassistant/components/lock/group.py index b69d916781f..ad5ee15c2bd 100644 --- a/homeassistant/components/lock/group.py +++ b/homeassistant/components/lock/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import ( @@ -20,7 +22,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/media_player/group.py b/homeassistant/components/media_player/group.py index 1987ecf3470..1ac5f6aa594 100644 --- a/homeassistant/components/media_player/group.py +++ b/homeassistant/components/media_player/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import ( @@ -19,7 +21,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/person/group.py b/homeassistant/components/person/group.py index 1c28887c2ca..8143251e7fa 100644 --- a/homeassistant/components/person/group.py +++ b/homeassistant/components/person/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_HOME, STATE_NOT_HOME @@ -13,7 +15,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states(DOMAIN, {STATE_HOME}, STATE_HOME, STATE_NOT_HOME) diff --git a/homeassistant/components/plant/group.py b/homeassistant/components/plant/group.py index abd24a2c23f..93944659e03 100644 --- a/homeassistant/components/plant/group.py +++ b/homeassistant/components/plant/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_OK, STATE_PROBLEM @@ -13,7 +15,7 @@ if TYPE_CHECKING: @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states(DOMAIN, {STATE_PROBLEM}, STATE_PROBLEM, STATE_OK) diff --git a/homeassistant/components/recorder/table_managers/__init__.py b/homeassistant/components/recorder/table_managers/__init__.py index c6dcc1cffad..bc053562c14 100644 --- a/homeassistant/components/recorder/table_managers/__init__.py +++ b/homeassistant/components/recorder/table_managers/__init__.py @@ -1,5 +1,7 @@ """Managers for each table.""" +from __future__ import annotations + from typing import TYPE_CHECKING, Any from lru import LRU @@ -13,9 +15,9 @@ if TYPE_CHECKING: class BaseTableManager[_DataT]: """Base class for table managers.""" - _id_map: "LRU[EventType[Any] | str, int]" + _id_map: LRU[EventType[Any] | str, int] - def __init__(self, recorder: "Recorder") -> None: + def __init__(self, recorder: Recorder) -> None: """Initialize the table manager. The table manager is responsible for managing the id mappings @@ -55,7 +57,7 @@ class BaseTableManager[_DataT]: class BaseLRUTableManager[_DataT](BaseTableManager[_DataT]): """Base class for LRU table managers.""" - def __init__(self, recorder: "Recorder", lru_size: int) -> None: + def __init__(self, recorder: Recorder, lru_size: int) -> None: """Initialize the LRU table manager. We keep track of the most recently used items diff --git a/homeassistant/components/sensor/group.py b/homeassistant/components/sensor/group.py index 2bc4a122fdc..8dc92ef6d07 100644 --- a/homeassistant/components/sensor/group.py +++ b/homeassistant/components/sensor/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.core import HomeAssistant, callback @@ -12,7 +14,7 @@ from .const import DOMAIN @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.exclude_domain(DOMAIN) diff --git a/homeassistant/components/vacuum/group.py b/homeassistant/components/vacuum/group.py index f8cd790e623..43d77995d1c 100644 --- a/homeassistant/components/vacuum/group.py +++ b/homeassistant/components/vacuum/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_OFF, STATE_ON @@ -13,7 +15,7 @@ from .const import DOMAIN, STATE_CLEANING, STATE_ERROR, STATE_RETURNING @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/water_heater/group.py b/homeassistant/components/water_heater/group.py index f74bf8a9ae4..c4e415462e4 100644 --- a/homeassistant/components/water_heater/group.py +++ b/homeassistant/components/water_heater/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.const import STATE_OFF, STATE_ON @@ -21,7 +23,7 @@ from .const import ( @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.on_off_states( diff --git a/homeassistant/components/weather/group.py b/homeassistant/components/weather/group.py index 2bc4a122fdc..8dc92ef6d07 100644 --- a/homeassistant/components/weather/group.py +++ b/homeassistant/components/weather/group.py @@ -1,5 +1,7 @@ """Describe group states.""" +from __future__ import annotations + from typing import TYPE_CHECKING from homeassistant.core import HomeAssistant, callback @@ -12,7 +14,7 @@ from .const import DOMAIN @callback def async_describe_on_off_states( - hass: HomeAssistant, registry: "GroupIntegrationRegistry" + hass: HomeAssistant, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" registry.exclude_domain(DOMAIN) diff --git a/homeassistant/components/wemo/models.py b/homeassistant/components/wemo/models.py index 59de2d2152c..80213c9ba33 100644 --- a/homeassistant/components/wemo/models.py +++ b/homeassistant/components/wemo/models.py @@ -1,5 +1,7 @@ """Common data structures and helpers for accessing them.""" +from __future__ import annotations + from collections.abc import Sequence from dataclasses import dataclass from typing import TYPE_CHECKING, cast @@ -19,9 +21,9 @@ if TYPE_CHECKING: # Avoid circular dependencies. class WemoConfigEntryData: """Config entry state data.""" - device_coordinators: dict[str, "DeviceCoordinator"] - discovery: "WemoDiscovery" - dispatcher: "WemoDispatcher" + device_coordinators: dict[str, DeviceCoordinator] + discovery: WemoDiscovery + dispatcher: WemoDispatcher @dataclass @@ -29,7 +31,7 @@ class WemoData: """Component state data.""" discovery_enabled: bool - static_config: Sequence["HostPortTuple"] + static_config: Sequence[HostPortTuple] registry: pywemo.SubscriptionRegistry # config_entry_data is set when the config entry is loaded and unset when it's # unloaded. It's a programmer error if config_entry_data is accessed when the