Use PEP 695 misc (#117788)

This commit is contained in:
Marc Mueller 2024-05-20 12:01:49 +02:00 committed by GitHub
parent 649981e503
commit f50973c76c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 40 additions and 47 deletions

View file

@ -4,7 +4,6 @@ from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass
from typing import Generic, TypeVar
from pydeconz.interfaces.sensors import SensorResources
from pydeconz.models.event import EventType
@ -48,29 +47,28 @@ PROVIDES_EXTRA_ATTRIBUTES = (
"water",
)
T = TypeVar(
"T",
Alarm,
CarbonMonoxide,
Fire,
GenericFlag,
OpenClose,
Presence,
Vibration,
Water,
PydeconzSensorBase,
)
@dataclass(frozen=True, kw_only=True)
class DeconzBinarySensorDescription(Generic[T], BinarySensorEntityDescription):
class DeconzBinarySensorDescription[
_T: (
Alarm,
CarbonMonoxide,
Fire,
GenericFlag,
OpenClose,
Presence,
Vibration,
Water,
PydeconzSensorBase,
)
](BinarySensorEntityDescription):
"""Class describing deCONZ binary sensor entities."""
instance_check: type[T] | None = None
instance_check: type[_T] | None = None
name_suffix: str = ""
old_unique_id_suffix: str = ""
update_key: str
value_fn: Callable[[T], bool | None]
value_fn: Callable[[_T], bool | None]
ENTITY_DESCRIPTIONS: tuple[DeconzBinarySensorDescription, ...] = (