diff --git a/homeassistant/components/edl21/sensor.py b/homeassistant/components/edl21/sensor.py index 090b2780ec4..64f78530ffa 100644 --- a/homeassistant/components/edl21/sensor.py +++ b/homeassistant/components/edl21/sensor.py @@ -1,4 +1,5 @@ """Support for EDL21 Smart Meters.""" +from __future__ import annotations from datetime import timedelta import logging @@ -16,7 +17,6 @@ from homeassistant.helpers.dispatcher import ( async_dispatcher_send, ) from homeassistant.helpers.entity_registry import async_get_registry -from homeassistant.helpers.typing import Optional from homeassistant.util.dt import utcnow _LOGGER = logging.getLogger(__name__) @@ -258,7 +258,7 @@ class EDL21Entity(SensorEntity): return self._obis @property - def name(self) -> Optional[str]: + def name(self) -> str | None: """Return a name.""" return self._name diff --git a/homeassistant/components/isy994/entity.py b/homeassistant/components/isy994/entity.py index f3dbe579dd8..25a2dc428a6 100644 --- a/homeassistant/components/isy994/entity.py +++ b/homeassistant/components/isy994/entity.py @@ -1,4 +1,5 @@ """Representation of ISYEntity Types.""" +from __future__ import annotations from pyisy.constants import ( COMMAND_FRIENDLY_NAME, @@ -11,7 +12,6 @@ from pyisy.helpers import NodeProperty from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.helpers.entity import Entity -from homeassistant.helpers.typing import Dict from .const import _LOGGER, DOMAIN @@ -134,7 +134,7 @@ class ISYNodeEntity(ISYEntity): """Representation of a ISY Nodebase (Node/Group) entity.""" @property - def extra_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> dict: """Get the state attributes for the device. The 'aux_properties' in the pyisy Node class are combined with the @@ -186,7 +186,7 @@ class ISYProgramEntity(ISYEntity): self._actions = actions @property - def extra_state_attributes(self) -> Dict: + def extra_state_attributes(self) -> dict: """Get the state attributes for the device.""" attr = {} if self._actions: diff --git a/homeassistant/components/kodi/config_flow.py b/homeassistant/components/kodi/config_flow.py index 0f5509a4e66..4c0b6bb0da1 100644 --- a/homeassistant/components/kodi/config_flow.py +++ b/homeassistant/components/kodi/config_flow.py @@ -1,4 +1,6 @@ """Config flow for Kodi integration.""" +from __future__ import annotations + import logging from pykodi import CannotConnectError, InvalidAuthError, Kodi, get_kodi_connection @@ -16,7 +18,7 @@ from homeassistant.const import ( ) from homeassistant.core import callback from homeassistant.helpers.aiohttp_client import async_get_clientsession -from homeassistant.helpers.typing import DiscoveryInfoType, Optional +from homeassistant.helpers.typing import DiscoveryInfoType from .const import ( CONF_WS_PORT, @@ -90,14 +92,14 @@ class KodiConfigFlow(config_entries.ConfigFlow, domain=DOMAIN): def __init__(self): """Initialize flow.""" - self._host: Optional[str] = None - self._port: Optional[int] = DEFAULT_PORT - self._ws_port: Optional[int] = DEFAULT_WS_PORT - self._name: Optional[str] = None - self._username: Optional[str] = None - self._password: Optional[str] = None - self._ssl: Optional[bool] = DEFAULT_SSL - self._discovery_name: Optional[str] = None + self._host: str | None = None + self._port: int | None = DEFAULT_PORT + self._ws_port: int | None = DEFAULT_WS_PORT + self._name: str | None = None + self._username: str | None = None + self._password: str | None = None + self._ssl: bool | None = DEFAULT_SSL + self._discovery_name: str | None = None async def async_step_zeroconf(self, discovery_info: DiscoveryInfoType): """Handle zeroconf discovery.""" diff --git a/tests/components/command_line/test_binary_sensor.py b/tests/components/command_line/test_binary_sensor.py index 21209a8b60d..aa6395096c3 100644 --- a/tests/components/command_line/test_binary_sensor.py +++ b/tests/components/command_line/test_binary_sensor.py @@ -1,12 +1,16 @@ """The tests for the Command line Binary sensor platform.""" +from __future__ import annotations + +from typing import Any + from homeassistant import setup from homeassistant.components.binary_sensor import DOMAIN from homeassistant.const import STATE_OFF, STATE_ON -from homeassistant.helpers.typing import Any, Dict, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType async def setup_test_entity( - hass: HomeAssistantType, config_dict: Dict[str, Any] + hass: HomeAssistantType, config_dict: dict[str, Any] ) -> None: """Set up a test command line binary_sensor entity.""" assert await setup.async_setup_component( diff --git a/tests/components/command_line/test_cover.py b/tests/components/command_line/test_cover.py index 093c1e86212..8ee69e8b5cb 100644 --- a/tests/components/command_line/test_cover.py +++ b/tests/components/command_line/test_cover.py @@ -1,6 +1,9 @@ """The tests the cover command line platform.""" +from __future__ import annotations + import os import tempfile +from typing import Any from unittest.mock import patch from homeassistant import config as hass_config, setup @@ -12,14 +15,14 @@ from homeassistant.const import ( SERVICE_RELOAD, SERVICE_STOP_COVER, ) -from homeassistant.helpers.typing import Any, Dict, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType import homeassistant.util.dt as dt_util from tests.common import async_fire_time_changed async def setup_test_entity( - hass: HomeAssistantType, config_dict: Dict[str, Any] + hass: HomeAssistantType, config_dict: dict[str, Any] ) -> None: """Set up a test command line notify service.""" assert await setup.async_setup_component( diff --git a/tests/components/command_line/test_notify.py b/tests/components/command_line/test_notify.py index 4166b9e8bbf..b22b0323aad 100644 --- a/tests/components/command_line/test_notify.py +++ b/tests/components/command_line/test_notify.py @@ -1,16 +1,19 @@ """The tests for the command line notification platform.""" +from __future__ import annotations + import os import subprocess import tempfile +from typing import Any from unittest.mock import patch from homeassistant import setup from homeassistant.components.notify import DOMAIN -from homeassistant.helpers.typing import Any, Dict, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType async def setup_test_service( - hass: HomeAssistantType, config_dict: Dict[str, Any] + hass: HomeAssistantType, config_dict: dict[str, Any] ) -> None: """Set up a test command line notify service.""" assert await setup.async_setup_component( diff --git a/tests/components/command_line/test_sensor.py b/tests/components/command_line/test_sensor.py index 66472c5feba..7e1f7707ca1 100644 --- a/tests/components/command_line/test_sensor.py +++ b/tests/components/command_line/test_sensor.py @@ -1,13 +1,16 @@ """The tests for the Command line sensor platform.""" +from __future__ import annotations + +from typing import Any from unittest.mock import patch from homeassistant import setup from homeassistant.components.sensor import DOMAIN -from homeassistant.helpers.typing import Any, Dict, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType async def setup_test_entities( - hass: HomeAssistantType, config_dict: Dict[str, Any] + hass: HomeAssistantType, config_dict: dict[str, Any] ) -> None: """Set up a test command line sensor entity.""" assert await setup.async_setup_component( diff --git a/tests/components/command_line/test_switch.py b/tests/components/command_line/test_switch.py index 0e31999f928..4439e6fdcb5 100644 --- a/tests/components/command_line/test_switch.py +++ b/tests/components/command_line/test_switch.py @@ -1,8 +1,11 @@ """The tests for the Command line switch platform.""" +from __future__ import annotations + import json import os import subprocess import tempfile +from typing import Any from unittest.mock import patch from homeassistant import setup @@ -14,14 +17,14 @@ from homeassistant.const import ( STATE_OFF, STATE_ON, ) -from homeassistant.helpers.typing import Any, Dict, HomeAssistantType +from homeassistant.helpers.typing import HomeAssistantType import homeassistant.util.dt as dt_util from tests.common import async_fire_time_changed async def setup_test_entity( - hass: HomeAssistantType, config_dict: Dict[str, Any] + hass: HomeAssistantType, config_dict: dict[str, Any] ) -> None: """Set up a test command line switch entity.""" assert await setup.async_setup_component(