diff --git a/homeassistant/components/google_photos/media_source.py b/homeassistant/components/google_photos/media_source.py index 997220fbb88..7ee81b51bc0 100644 --- a/homeassistant/components/google_photos/media_source.py +++ b/homeassistant/components/google_photos/media_source.py @@ -1,5 +1,7 @@ """Media source for Google Photos.""" +from __future__ import annotations + from dataclasses import dataclass from enum import StrEnum import logging @@ -46,7 +48,7 @@ class PhotosIdentifierType(StrEnum): ALBUM = "a" @classmethod - def of(cls, name: str) -> "PhotosIdentifierType": + def of(cls, name: str) -> PhotosIdentifierType: """Parse a PhotosIdentifierType by string value.""" for enum in PhotosIdentifierType: if enum.value == name: diff --git a/homeassistant/components/html5/config_flow.py b/homeassistant/components/html5/config_flow.py index 1dae0102d05..66c7be6736d 100644 --- a/homeassistant/components/html5/config_flow.py +++ b/homeassistant/components/html5/config_flow.py @@ -1,5 +1,7 @@ """Config flow for the html5 component.""" +from __future__ import annotations + import binascii from typing import Any, cast @@ -42,7 +44,7 @@ class HTML5ConfigFlow(ConfigFlow, domain=DOMAIN): @callback def _async_create_html5_entry( - self: "HTML5ConfigFlow", data: dict[str, str] + self: HTML5ConfigFlow, data: dict[str, str] ) -> tuple[dict[str, str], ConfigFlowResult | None]: """Create an HTML5 entry.""" errors = {} @@ -68,7 +70,7 @@ class HTML5ConfigFlow(ConfigFlow, domain=DOMAIN): return errors, flow_result async def async_step_user( - self: "HTML5ConfigFlow", user_input: dict[str, Any] | None = None + self: HTML5ConfigFlow, user_input: dict[str, Any] | None = None ) -> ConfigFlowResult: """Handle a flow initialized by the user.""" errors: dict[str, str] = {} @@ -92,7 +94,7 @@ class HTML5ConfigFlow(ConfigFlow, domain=DOMAIN): ) async def async_step_import( - self: "HTML5ConfigFlow", import_config: dict + self: HTML5ConfigFlow, import_config: dict ) -> ConfigFlowResult: """Handle config import from yaml.""" _, flow_result = self._async_create_html5_entry(import_config) diff --git a/homeassistant/components/knx/storage/config_store.py b/homeassistant/components/knx/storage/config_store.py index ce7a705e629..2899448a128 100644 --- a/homeassistant/components/knx/storage/config_store.py +++ b/homeassistant/components/knx/storage/config_store.py @@ -19,8 +19,8 @@ _LOGGER = logging.getLogger(__name__) STORAGE_VERSION: Final = 1 STORAGE_KEY: Final = f"{DOMAIN}/config_store.json" -KNXPlatformStoreModel = dict[str, dict[str, Any]] # unique_id: configuration -KNXEntityStoreModel = dict[ +type KNXPlatformStoreModel = dict[str, dict[str, Any]] # unique_id: configuration +type KNXEntityStoreModel = dict[ str, KNXPlatformStoreModel ] # platform: KNXPlatformStoreModel diff --git a/homeassistant/components/zha/helpers.py b/homeassistant/components/zha/helpers.py index b91565835a7..06899296991 100644 --- a/homeassistant/components/zha/helpers.py +++ b/homeassistant/components/zha/helpers.py @@ -170,7 +170,7 @@ if TYPE_CHECKING: from .entity import ZHAEntity from .update import ZHAFirmwareUpdateCoordinator - _LogFilterType = Filter | Callable[[LogRecord], bool] + type _LogFilterType = Filter | Callable[[LogRecord], bool] _LOGGER = logging.getLogger(__name__) diff --git a/tests/components/knx/__init__.py b/tests/components/knx/__init__.py index 76ae91a193d..fc19741d190 100644 --- a/tests/components/knx/__init__.py +++ b/tests/components/knx/__init__.py @@ -1,7 +1,8 @@ """Tests for the KNX integration.""" -from collections.abc import Awaitable, Callable +from collections.abc import Callable, Coroutine +from typing import Any from homeassistant.helpers import entity_registry as er -KnxEntityGenerator = Callable[..., Awaitable[er.RegistryEntry]] +type KnxEntityGenerator = Callable[..., Coroutine[Any, Any, er.RegistryEntry]] diff --git a/tests/components/plugwise/conftest.py b/tests/components/plugwise/conftest.py index 2504f4d90bd..ace3ccbda60 100644 --- a/tests/components/plugwise/conftest.py +++ b/tests/components/plugwise/conftest.py @@ -310,7 +310,7 @@ def mock_smile_p1_2() -> Generator[MagicMock]: @pytest.fixture -def mock_smile_legacy_anna() -> Generator[None, MagicMock, None]: +def mock_smile_legacy_anna() -> Generator[MagicMock]: """Create a Mock legacy Anna environment for testing exceptions.""" chosen_env = "legacy_anna" with patch(