From 7dfe8591c493c486233de06cfa56cf4f978d7c80 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Wed, 27 Apr 2022 17:19:06 +0200 Subject: [PATCH] Improve typing [helpers.event] (#70891) --- .strict-typing | 1 + homeassistant/helpers/event.py | 4 ++-- mypy.ini | 3 +++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.strict-typing b/.strict-typing index cda4f9e12fc..546e99a96b8 100644 --- a/.strict-typing +++ b/.strict-typing @@ -17,6 +17,7 @@ homeassistant.helpers.area_registry homeassistant.helpers.condition homeassistant.helpers.discovery homeassistant.helpers.entity_values +homeassistant.helpers.event homeassistant.helpers.reload homeassistant.helpers.script_variables homeassistant.helpers.translation diff --git a/homeassistant/helpers/event.py b/homeassistant/helpers/event.py index b85af09cfb9..427297b2f1d 100644 --- a/homeassistant/helpers/event.py +++ b/homeassistant/helpers/event.py @@ -558,7 +558,7 @@ class _TrackStateChangeFiltered: self._setup_entities_listener(track_states.domains, track_states.entities) @property - def listeners(self) -> dict: + def listeners(self) -> dict[str, bool | set[str]]: """State changes that will cause a re-render.""" track_states = self._last_track_states return { @@ -853,7 +853,7 @@ class _TrackTemplateResultInfo: ) @property - def listeners(self) -> dict: + def listeners(self) -> dict[str, bool | set[str]]: """State changes that will cause a re-render.""" assert self._track_state_changes return { diff --git a/mypy.ini b/mypy.ini index 6010475602d..519191a77cd 100644 --- a/mypy.ini +++ b/mypy.ini @@ -62,6 +62,9 @@ disallow_any_generics = true [mypy-homeassistant.helpers.entity_values] disallow_any_generics = true +[mypy-homeassistant.helpers.event] +disallow_any_generics = true + [mypy-homeassistant.helpers.reload] disallow_any_generics = true