From eec0f3351a5be10a0e0b1a1822339c7582b74a76 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 17 Aug 2022 16:27:47 +0200 Subject: [PATCH] Add weather checks to pylint plugin (#76915) --- pylint/plugins/hass_enforce_type_hints.py | 71 +++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/pylint/plugins/hass_enforce_type_hints.py b/pylint/plugins/hass_enforce_type_hints.py index b34b88c27c9..3d86767df43 100644 --- a/pylint/plugins/hass_enforce_type_hints.py +++ b/pylint/plugins/hass_enforce_type_hints.py @@ -1968,6 +1968,77 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = { ], ), ], + "weather": [ + ClassTypeHintMatch( + base_class="Entity", + matches=_ENTITY_MATCH, + ), + ClassTypeHintMatch( + base_class="WeatherEntity", + matches=[ + TypeHintMatch( + function_name="native_temperature", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_temperature_unit", + return_type=["str", None], + ), + TypeHintMatch( + function_name="native_pressure", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_pressure_unit", + return_type=["str", None], + ), + TypeHintMatch( + function_name="humidity", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_wind_speed", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_wind_speed_unit", + return_type=["str", None], + ), + TypeHintMatch( + function_name="wind_bearing", + return_type=["float", "str", None], + ), + TypeHintMatch( + function_name="ozone", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_visibility", + return_type=["float", None], + ), + TypeHintMatch( + function_name="native_visibility_unit", + return_type=["str", None], + ), + TypeHintMatch( + function_name="forecast", + return_type=["list[Forecast]", None], + ), + TypeHintMatch( + function_name="native_precipitation_unit", + return_type=["str", None], + ), + TypeHintMatch( + function_name="precision", + return_type="float", + ), + TypeHintMatch( + function_name="condition", + return_type=["str", None], + ), + ], + ), + ], }