Add strict typing for WLED (#79822)

* Add strict typing for WLED

* Update backoff constraint
This commit is contained in:
Marc Mueller 2022-10-07 20:56:29 +02:00 committed by GitHub
parent 14d2bbfcd6
commit 33c94b0052
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 7 deletions

View File

@ -285,6 +285,7 @@ homeassistant.components.websocket_api.*
homeassistant.components.wemo.*
homeassistant.components.whois.*
homeassistant.components.wiz.*
homeassistant.components.wled.*
homeassistant.components.worldclock.*
homeassistant.components.yale_smart_alarm.*
homeassistant.components.zeroconf.*

View File

@ -92,7 +92,7 @@ class WLEDNumber(WLEDEntity, NumberEntity):
@property
def native_value(self) -> float | None:
"""Return the current WLED segment number value."""
return getattr(
return getattr( # type: ignore[no-any-return]
self.coordinator.data.state.segments[self._segment],
self.entity_description.key,
)

View File

@ -114,9 +114,8 @@ multidict>=6.0.2
# https://github.com/home-assistant/core/pull/68176
authlib<1.0
# Pin backoff for compatibility until most libraries have been updated
# https://github.com/home-assistant/core/pull/70817
backoff<2.0
# Version 2.0 added typing, prevent accidental fallbacks
backoff>=2.0
# Breaking change in version
# https://github.com/samuelcolvin/pydantic/issues/4092

View File

@ -2604,6 +2604,16 @@ disallow_untyped_defs = true
warn_return_any = true
warn_unreachable = true
[mypy-homeassistant.components.wled.*]
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.worldclock.*]
check_untyped_defs = true
disallow_incomplete_defs = true

View File

@ -124,9 +124,8 @@ multidict>=6.0.2
# https://github.com/home-assistant/core/pull/68176
authlib<1.0
# Pin backoff for compatibility until most libraries have been updated
# https://github.com/home-assistant/core/pull/70817
backoff<2.0
# Version 2.0 added typing, prevent accidental fallbacks
backoff>=2.0
# Breaking change in version
# https://github.com/samuelcolvin/pydantic/issues/4092