From d1e460e97a657505fd49139c4154034a9c0b5fe9 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 15 Nov 2023 04:12:31 +0100 Subject: [PATCH] Remove AdGuard entity descriptions required fields mixins (#103991) --- homeassistant/components/adguard/sensor.py | 13 +++---------- homeassistant/components/adguard/switch.py | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/adguard/sensor.py b/homeassistant/components/adguard/sensor.py index 9f1c0a5b0fe..523e1b73e16 100644 --- a/homeassistant/components/adguard/sensor.py +++ b/homeassistant/components/adguard/sensor.py @@ -22,20 +22,13 @@ SCAN_INTERVAL = timedelta(seconds=300) PARALLEL_UPDATES = 4 -@dataclass -class AdGuardHomeEntityDescriptionMixin: - """Mixin for required keys.""" +@dataclass(kw_only=True) +class AdGuardHomeEntityDescription(SensorEntityDescription): + """Describes AdGuard Home sensor entity.""" value_fn: Callable[[AdGuardHome], Coroutine[Any, Any, int | float]] -@dataclass -class AdGuardHomeEntityDescription( - SensorEntityDescription, AdGuardHomeEntityDescriptionMixin -): - """Describes AdGuard Home sensor entity.""" - - SENSORS: tuple[AdGuardHomeEntityDescription, ...] = ( AdGuardHomeEntityDescription( key="dns_queries", diff --git a/homeassistant/components/adguard/switch.py b/homeassistant/components/adguard/switch.py index 1020e8690f1..944a3c7b269 100644 --- a/homeassistant/components/adguard/switch.py +++ b/homeassistant/components/adguard/switch.py @@ -21,22 +21,15 @@ SCAN_INTERVAL = timedelta(seconds=10) PARALLEL_UPDATES = 1 -@dataclass -class AdGuardHomeSwitchEntityDescriptionMixin: - """Mixin for required keys.""" +@dataclass(kw_only=True) +class AdGuardHomeSwitchEntityDescription(SwitchEntityDescription): + """Describes AdGuard Home switch entity.""" is_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, bool]]] turn_on_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]] turn_off_fn: Callable[[AdGuardHome], Callable[[], Coroutine[Any, Any, None]]] -@dataclass -class AdGuardHomeSwitchEntityDescription( - SwitchEntityDescription, AdGuardHomeSwitchEntityDescriptionMixin -): - """Describes AdGuard Home switch entity.""" - - SWITCHES: tuple[AdGuardHomeSwitchEntityDescription, ...] = ( AdGuardHomeSwitchEntityDescription( key="protection",