mirror of
https://github.com/home-assistant/core.git
synced 2025-04-19 14:57:52 +00:00
Enable strict typing for aquostv (#106836)
This commit is contained in:
parent
0077989169
commit
800351287b
@ -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.*
|
||||
|
@ -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
|
||||
|
||||
|
10
mypy.ini
10
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user