Add ClimateEntity checks to pylint plugin (#74275)

* Add ClimateEntity checks to pylint plugin

* Update pylint/plugins/hass_enforce_type_hints.py
This commit is contained in:
epenet 2022-06-30 23:49:23 +02:00 committed by GitHub
parent 11cdf542ac
commit 2c171e30fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -856,6 +856,179 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
],
),
],
"climate": [
ClassTypeHintMatch(
base_class="Entity",
matches=_ENTITY_MATCH,
),
ClassTypeHintMatch(
base_class="ClimateEntity",
matches=[
TypeHintMatch(
function_name="precision",
return_type="float",
),
TypeHintMatch(
function_name="temperature_unit",
return_type="str",
),
TypeHintMatch(
function_name="current_humidity",
return_type=["int", None],
),
TypeHintMatch(
function_name="target_humidity",
return_type=["int", None],
),
TypeHintMatch(
function_name="hvac_mode",
return_type=["HVACMode", "str", None],
),
TypeHintMatch(
function_name="hvac_modes",
return_type=["list[HVACMode]", "list[str]"],
),
TypeHintMatch(
function_name="hvac_action",
return_type=["HVACAction", "str", None],
),
TypeHintMatch(
function_name="current_temperature",
return_type=["float", None],
),
TypeHintMatch(
function_name="target_temperature",
return_type=["float", None],
),
TypeHintMatch(
function_name="target_temperature_step",
return_type=["float", None],
),
TypeHintMatch(
function_name="target_temperature_high",
return_type=["float", None],
),
TypeHintMatch(
function_name="target_temperature_low",
return_type=["float", None],
),
TypeHintMatch(
function_name="preset_mode",
return_type=["str", None],
),
TypeHintMatch(
function_name="preset_modes",
return_type=["list[str]", None],
),
TypeHintMatch(
function_name="is_aux_heat",
return_type=["bool", None],
),
TypeHintMatch(
function_name="fan_mode",
return_type=["str", None],
),
TypeHintMatch(
function_name="fan_modes",
return_type=["list[str]", None],
),
TypeHintMatch(
function_name="swing_mode",
return_type=["str", None],
),
TypeHintMatch(
function_name="swing_modes",
return_type=["list[str]", None],
),
TypeHintMatch(
function_name="set_temperature",
kwargs_type="Any",
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="set_humidity",
arg_types={
1: "int",
},
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="set_fan_mode",
arg_types={
1: "str",
},
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="set_hvac_mode",
arg_types={
1: "HVACMode",
},
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="set_swing_mode",
arg_types={
1: "str",
},
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="set_preset_mode",
arg_types={
1: "str",
},
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="turn_aux_heat_on",
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="turn_aux_heat_off",
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="turn_on",
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="turn_off",
return_type="None",
has_async_counterpart=True,
),
TypeHintMatch(
function_name="supported_features",
return_type="int",
),
TypeHintMatch(
function_name="min_temp",
return_type="float",
),
TypeHintMatch(
function_name="max_temp",
return_type="float",
),
TypeHintMatch(
function_name="min_humidity",
return_type="int",
),
TypeHintMatch(
function_name="max_humidity",
return_type="int",
),
],
),
],
"cover": [
ClassTypeHintMatch(
base_class="Entity",