Improve typing of SelectorConfig (#85022)

pull/85031/head
Franck Nijhof 2023-01-03 00:52:15 +01:00 committed by GitHub
parent 9c36f05ac4
commit 5cfa98e400
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ from collections.abc import Callable, Mapping, Sequence
from typing import Any, Generic, Literal, TypedDict, TypeVar, cast
from uuid import UUID
from typing_extensions import Required
import voluptuous as vol
from homeassistant.backports.enum import StrEnum
@ -211,7 +212,7 @@ class AreaSelector(Selector[AreaSelectorConfig]):
class AttributeSelectorConfig(TypedDict, total=False):
"""Class to represent an attribute selector config."""
entity_id: str
entity_id: Required[str]
hide_attributes: list[str]
@ -728,7 +729,7 @@ class SelectSelectorMode(StrEnum):
class SelectSelectorConfig(TypedDict, total=False):
"""Class to represent a select selector config."""
options: Sequence[SelectOptionDict] | Sequence[str] # required
options: Required[Sequence[SelectOptionDict] | Sequence[str]]
multiple: bool
custom_value: bool
mode: SelectSelectorMode
@ -788,7 +789,7 @@ class TargetSelectorConfig(TypedDict, total=False):
class StateSelectorConfig(TypedDict, total=False):
"""Class to represent an state selector config."""
entity_id: str
entity_id: Required[str]
@SELECTORS.register("state")