diff --git a/.strict-typing b/.strict-typing index a304f771cd8..2516beaf36a 100644 --- a/.strict-typing +++ b/.strict-typing @@ -74,6 +74,7 @@ homeassistant.components.apcupsd.* homeassistant.components.apprise.* homeassistant.components.aprs.* homeassistant.components.aqualogic.* +homeassistant.components.aquostv.* homeassistant.components.aranet.* homeassistant.components.aseko_pool_live.* homeassistant.components.assist_pipeline.* diff --git a/homeassistant/components/aquostv/media_player.py b/homeassistant/components/aquostv/media_player.py index 34d5e4161fb..a87756334e2 100644 --- a/homeassistant/components/aquostv/media_player.py +++ b/homeassistant/components/aquostv/media_player.py @@ -1,7 +1,9 @@ """Support for interface with an Aquos TV.""" from __future__ import annotations +from collections.abc import Callable import logging +from typing import Any, Concatenate, ParamSpec, TypeVar import sharp_aquos_rc import voluptuous as vol @@ -25,6 +27,9 @@ import homeassistant.helpers.config_validation as cv from homeassistant.helpers.entity_platform import AddEntitiesCallback from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType +_SharpAquosTVDeviceT = TypeVar("_SharpAquosTVDeviceT", bound="SharpAquosTVDevice") +_P = ParamSpec("_P") + _LOGGER = logging.getLogger(__name__) DEFAULT_NAME = "Sharp Aquos TV" @@ -79,10 +84,12 @@ def setup_platform( add_entities([SharpAquosTVDevice(name, remote, power_on_enabled)]) -def _retry(func): +def _retry( + func: Callable[Concatenate[_SharpAquosTVDeviceT, _P], Any], +) -> Callable[Concatenate[_SharpAquosTVDeviceT, _P], None]: """Handle query retries.""" - def wrapper(obj, *args, **kwargs): + def wrapper(obj: _SharpAquosTVDeviceT, *args: _P.args, **kwargs: _P.kwargs) -> None: """Wrap all query functions.""" update_retries = 5 while update_retries > 0: @@ -125,7 +132,7 @@ class SharpAquosTVDevice(MediaPlayerEntity): # Assume that the TV is not muted self._remote = remote - def set_state(self, state): + def set_state(self, state: MediaPlayerState) -> None: """Set TV state.""" self._attr_state = state diff --git a/mypy.ini b/mypy.ini index bc7c33396ff..3e4385fddcb 100644 --- a/mypy.ini +++ b/mypy.ini @@ -500,6 +500,16 @@ disallow_untyped_defs = true warn_return_any = true warn_unreachable = true +[mypy-homeassistant.components.aquostv.*] +check_untyped_defs = true +disallow_incomplete_defs = true +disallow_subclassing_any = true +disallow_untyped_calls = true +disallow_untyped_decorators = true +disallow_untyped_defs = true +warn_return_any = true +warn_unreachable = true + [mypy-homeassistant.components.aranet.*] check_untyped_defs = true disallow_incomplete_defs = true