mirror of
https://github.com/home-assistant/core.git
synced 2025-07-03 19:37:10 +00:00
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:
parent
1baba8b880
commit
77dca49c75
@ -4,6 +4,7 @@ from __future__ import annotations
|
||||
|
||||
from enum import StrEnum
|
||||
import logging
|
||||
from typing import Any
|
||||
|
||||
from thinqconnect import DeviceType
|
||||
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."""
|
||||
_LOGGER.debug(
|
||||
"[%s:%s] async_return_to_base",
|
||||
|
@ -70,7 +70,7 @@ _MODULES: dict[str, set[str]] = {
|
||||
"todo": {"TodoListEntity"},
|
||||
"tts": {"TextToSpeechEntity"},
|
||||
"update": {"UpdateEntity", "UpdateEntityDescription"},
|
||||
"vacuum": {"StateVacuumEntity", "VacuumEntity", "VacuumEntityDescription"},
|
||||
"vacuum": {"StateVacuumEntity", "VacuumEntityDescription"},
|
||||
"wake_word": {"WakeWordDetectionEntity"},
|
||||
"water_heater": {"WaterHeaterEntity"},
|
||||
"weather": {
|
||||
|
@ -2789,12 +2789,12 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||
matches=_RESTORE_ENTITY_MATCH,
|
||||
),
|
||||
ClassTypeHintMatch(
|
||||
base_class="ToggleEntity",
|
||||
matches=_TOGGLE_ENTITY_MATCH,
|
||||
),
|
||||
ClassTypeHintMatch(
|
||||
base_class="_BaseVacuum",
|
||||
base_class="StateVacuumEntity",
|
||||
matches=[
|
||||
TypeHintMatch(
|
||||
function_name="state",
|
||||
return_type=["str", None],
|
||||
),
|
||||
TypeHintMatch(
|
||||
function_name="battery_level",
|
||||
return_type=["int", None],
|
||||
@ -2821,6 +2821,16 @@ _INHERITANCE_MATCH: dict[str, list[ClassTypeHintMatch]] = {
|
||||
return_type=None,
|
||||
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(
|
||||
function_name="return_to_base",
|
||||
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": [
|
||||
ClassTypeHintMatch(
|
||||
|
@ -1161,17 +1161,11 @@ def test_vacuum_entity(linter: UnittestLinter, type_hint_checker: BaseChecker) -
|
||||
class Entity():
|
||||
pass
|
||||
|
||||
class ToggleEntity(Entity):
|
||||
pass
|
||||
|
||||
class _BaseVacuum(Entity):
|
||||
pass
|
||||
|
||||
class VacuumEntity(_BaseVacuum, ToggleEntity):
|
||||
class StateVacuumEntity(Entity):
|
||||
pass
|
||||
|
||||
class MyVacuum( #@
|
||||
VacuumEntity
|
||||
StateVacuumEntity
|
||||
):
|
||||
def send_command(
|
||||
self,
|
||||
|
Loading…
x
Reference in New Issue
Block a user