From 33c94b005291643ca78aac3ee07a63d80d85eab7 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Fri, 7 Oct 2022 20:56:29 +0200 Subject: [PATCH] Add strict typing for WLED (#79822) * Add strict typing for WLED * Update backoff constraint --- .strict-typing | 1 + homeassistant/components/wled/number.py | 2 +- homeassistant/package_constraints.txt | 5 ++--- mypy.ini | 10 ++++++++++ script/gen_requirements_all.py | 5 ++--- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.strict-typing b/.strict-typing index 13b2752e09c..2c193bb5173 100644 --- a/.strict-typing +++ b/.strict-typing @@ -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.* diff --git a/homeassistant/components/wled/number.py b/homeassistant/components/wled/number.py index 33b27777c7e..60317003f19 100644 --- a/homeassistant/components/wled/number.py +++ b/homeassistant/components/wled/number.py @@ -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, ) diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 56700d017c3..38ff17b38c7 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -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 diff --git a/mypy.ini b/mypy.ini index c83f6cd048e..b63931d6c79 100644 --- a/mypy.ini +++ b/mypy.ini @@ -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 diff --git a/script/gen_requirements_all.py b/script/gen_requirements_all.py index d0eb830f088..dc55b37b956 100755 --- a/script/gen_requirements_all.py +++ b/script/gen_requirements_all.py @@ -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