Fix pylint plugin for vacuum entity (#146467)

* Clean out legacy VacuumEntity from pylint plugins

* Fix

* Fix pylint for vacuum

* More fixes

* Revert partial

* Add back state
This commit is contained in:
G Johansson 2025-06-19 12:49:10 +02:00 committed by GitHub
parent 1baba8b880
commit 77dca49c75
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 72 deletions

View File

@ -4,6 +4,7 @@ from __future__ import annotations
from enum import StrEnum from enum import StrEnum
import logging import logging
from typing import Any
from thinqconnect import DeviceType from thinqconnect import DeviceType
from thinqconnect.integration import ExtendedProperty from thinqconnect.integration import ExtendedProperty
@ -154,7 +155,7 @@ class ThinQStateVacuumEntity(ThinQEntity, StateVacuumEntity):
) )
) )
async def async_return_to_base(self, **kwargs) -> None: async def async_return_to_base(self, **kwargs: Any) -> None:
"""Return device to dock.""" """Return device to dock."""
_LOGGER.debug( _LOGGER.debug(
"[%s:%s] async_return_to_base", "[%s:%s] async_return_to_base",

View File

@ -70,7 +70,7 @@ _MODULES: dict[str, set[str]] = {
"todo": {"TodoListEntity"}, "todo": {"TodoListEntity"},
"tts": {"TextToSpeechEntity"}, "tts": {"TextToSpeechEntity"},
"update": {"UpdateEntity", "UpdateEntityDescription"}, "update": {"UpdateEntity", "UpdateEntityDescription"},
"vacuum": {"StateVacuumEntity", "VacuumEntity", "VacuumEntityDescription"}, "vacuum": {"StateVacuumEntity", "VacuumEntityDescription"},
"wake_word": {"WakeWordDetectionEntity"}, "wake_word": {"WakeWordDetectionEntity"},
"water_heater": {"WaterHeaterEntity"}, "water_heater": {"WaterHeaterEntity"},
"weather": { "weather": {

View File

@ -2789,12 +2789,12 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
matches=_RESTORE_ENTITY_MATCH, matches=_RESTORE_ENTITY_MATCH,
), ),
ClassTypeHintMatch( ClassTypeHintMatch(
base_class="ToggleEntity", base_class="StateVacuumEntity",
matches=_TOGGLE_ENTITY_MATCH,
),
ClassTypeHintMatch(
base_class="_BaseVacuum",
matches=[ matches=[
TypeHintMatch(
function_name="state",
return_type=["str", None],
),
TypeHintMatch( TypeHintMatch(
function_name="battery_level", function_name="battery_level",
return_type=["int", None], return_type=["int", None],
@ -2821,6 +2821,16 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
return_type=None, return_type=None,
has_async_counterpart=True, has_async_counterpart=True,
), ),
TypeHintMatch(
function_name="start",
return_type=None,
has_async_counterpart=True,
),
TypeHintMatch(
function_name="pause",
return_type=None,
has_async_counterpart=True,
),
TypeHintMatch( TypeHintMatch(
function_name="return_to_base", function_name="return_to_base",
kwargs_type="Any", kwargs_type="Any",
@ -2860,63 +2870,6 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
), ),
], ],
), ),
ClassTypeHintMatch(
base_class="VacuumEntity",
matches=[
TypeHintMatch(
function_name="status",
return_type=["str", None],
),
TypeHintMatch(
function_name="start_pause",
kwargs_type="Any",
return_type=None,
has_async_counterpart=True,
),
TypeHintMatch(
function_name="async_pause",
return_type=None,
),
TypeHintMatch(
function_name="async_start",
return_type=None,
),
],
),
ClassTypeHintMatch(
base_class="StateVacuumEntity",
matches=[
TypeHintMatch(
function_name="state",
return_type=["str", None],
),
TypeHintMatch(
function_name="start",
return_type=None,
has_async_counterpart=True,
),
TypeHintMatch(
function_name="pause",
return_type=None,
has_async_counterpart=True,
),
TypeHintMatch(
function_name="async_turn_on",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="async_turn_off",
kwargs_type="Any",
return_type=None,
),
TypeHintMatch(
function_name="async_toggle",
kwargs_type="Any",
return_type=None,
),
],
),
], ],
"water_heater": [ "water_heater": [
ClassTypeHintMatch( ClassTypeHintMatch(

View File

@ -1161,17 +1161,11 @@ def test_vacuum_entity(linter: UnittestLinter, type_hint_checker: BaseChecker) -
class Entity(): class Entity():
pass pass
class ToggleEntity(Entity): class StateVacuumEntity(Entity):
pass
class _BaseVacuum(Entity):
pass
class VacuumEntity(_BaseVacuum, ToggleEntity):
pass pass
class MyVacuum( #@ class MyVacuum( #@
VacuumEntity StateVacuumEntity
): ):
def send_command( def send_command(
self, self,