Use kw_only in entity description example (#1979)

This commit is contained in:
Martin Hjelmare 2023-11-16 13:05:25 +01:00 committed by GitHub
parent 130b81efd8
commit 32fbbb42bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -270,20 +270,13 @@ from homeassistant.helpers.typing import StateType
from .const import DOMAIN, LOGGER
@dataclass
class ExampleSensorEntityDescriptionMixin:
"""Mixin for required keys."""
value_fn: Callable[[ExampleDevice], StateType]
@dataclass
class ExampleSensorEntityDescription(
SensorEntityDescription, ExampleSensorEntityDescriptionMixin
):
@dataclass(kw_only=True)
class ExampleSensorEntityDescription(SensorEntityDescription):
"""Describes Example sensor entity."""
exists_fn: Callable[[ExampleDevice], bool] = lambda _: True
value_fn: Callable[[ExampleDevice], StateType]
SENSORS: tuple[ExampleSensorEntityDescription, ...] = (