From 0ffdf9fb6e60e37e480c4c3da9f839af8a42274f Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 4 Aug 2022 21:03:13 +0200 Subject: [PATCH] Add device_tracker checks to pylint plugin (#76228) --- pylint/plugins/hass_enforce_type_hints.py | 73 +++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index d0d20cedd7c..527c9358971 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1135,6 +1135,79 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ], ), ], + "device_tracker": [ + ClassTypeHintMatch( + base_class="Entity", + matches=_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="BaseTrackerEntity", + matches=[ + TypeHintMatch( + function_name="battery_level", + return_type=["int", None], + ), + TypeHintMatch( + function_name="source_type", + return_type=["SourceType", "str"], + ), + ], + ), + ClassTypeHintMatch( + base_class="TrackerEntity", + matches=[ + TypeHintMatch( + function_name="force_update", + return_type="bool", + ), + TypeHintMatch( + function_name="location_accuracy", + return_type="int", + ), + TypeHintMatch( + function_name="location_name", + return_type=["str", None], + ), + TypeHintMatch( + function_name="latitude", + return_type=["float", None], + ), + TypeHintMatch( + function_name="longitude", + return_type=["float", None], + ), + TypeHintMatch( + function_name="state", + return_type=["str", None], + ), + ], + ), + ClassTypeHintMatch( + base_class="ScannerEntity", + matches=[ + TypeHintMatch( + function_name="ip_address", + return_type=["str", None], + ), + TypeHintMatch( + function_name="mac_address", + return_type=["str", None], + ), + TypeHintMatch( + function_name="hostname", + return_type=["str", None], + ), + TypeHintMatch( + function_name="state", + return_type="str", + ), + TypeHintMatch( + function_name="is_connected", + return_type="bool", + ), + ], + ), + ], "fan": [ ClassTypeHintMatch( base_class="Entity",