Add ToggleEntity to pylint fan checks (#73886)
This commit is contained in:
parent
0df0533cd4
commit
d19fc0622b
1 changed files with 28 additions and 4 deletions
|
@ -435,15 +435,39 @@ _CLASS_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
}
|
}
|
||||||
# Overriding properties and functions are normally checked by mypy, and will only
|
# Overriding properties and functions are normally checked by mypy, and will only
|
||||||
# be checked by pylint when --ignore-missing-annotations is False
|
# be checked by pylint when --ignore-missing-annotations is False
|
||||||
|
_TOGGLE_ENTITY_MATCH: list[TypeHintMatch] = [
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="is_on",
|
||||||
|
return_type=["bool", None],
|
||||||
|
),
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="turn_on",
|
||||||
|
kwargs_type="Any",
|
||||||
|
return_type=None,
|
||||||
|
has_async_counterpart=True,
|
||||||
|
),
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="turn_off",
|
||||||
|
kwargs_type="Any",
|
||||||
|
return_type=None,
|
||||||
|
has_async_counterpart=True,
|
||||||
|
),
|
||||||
|
TypeHintMatch(
|
||||||
|
function_name="toggle",
|
||||||
|
kwargs_type="Any",
|
||||||
|
return_type=None,
|
||||||
|
has_async_counterpart=True,
|
||||||
|
),
|
||||||
|
]
|
||||||
_INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
_INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||||
"fan": [
|
"fan": [
|
||||||
|
ClassTypeHintMatch(
|
||||||
|
base_class="ToggleEntity",
|
||||||
|
matches=_TOGGLE_ENTITY_MATCH,
|
||||||
|
),
|
||||||
ClassTypeHintMatch(
|
ClassTypeHintMatch(
|
||||||
base_class="FanEntity",
|
base_class="FanEntity",
|
||||||
matches=[
|
matches=[
|
||||||
TypeHintMatch(
|
|
||||||
function_name="is_on",
|
|
||||||
return_type=["bool", None],
|
|
||||||
),
|
|
||||||
TypeHintMatch(
|
TypeHintMatch(
|
||||||
function_name="percentage",
|
function_name="percentage",
|
||||||
return_type=["int", None],
|
return_type=["int", None],
|
||||||
|
|
Loading…
Add table
Reference in a new issue