From bcdf880364faa93cdd94c10f08b84f8887cc87a3 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 9 Aug 2022 16:55:52 +0200 Subject: [PATCH] Add siren checks to pylint plugin (#76460) --- pylint/plugins/hass_enforce_type_hints.py | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index 527c9358971..f7a109507d8 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1477,6 +1477,58 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ], ), ], + "select": [ + ClassTypeHintMatch( + base_class="Entity", + matches=_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="SelectEntity", + matches=[ + TypeHintMatch( + function_name="capability_attributes", + return_type="dict[str, Any]", + ), + TypeHintMatch( + function_name="options", + return_type="list[str]", + ), + TypeHintMatch( + function_name="current_option", + return_type=["str", None], + ), + TypeHintMatch( + function_name="select_option", + return_type=None, + ), + TypeHintMatch( + function_name="select_option", + arg_types={1: "str"}, + return_type=None, + has_async_counterpart=True, + ), + ], + ), + ], + "siren": [ + ClassTypeHintMatch( + base_class="Entity", + matches=_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="ToggleEntity", + matches=_TOGGLE_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="SirenEntity", + matches=[ + TypeHintMatch( + function_name="available_tones", + return_type=["dict[int, str]", "list[int | str]", None], + ), + ], + ), + ], }