mirror of
https://github.com/home-assistant/core.git
synced 2025-08-02 20:25:07 +02:00
Add generic Event class (#97071)
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
"""Typing Helpers for Home Assistant."""
|
||||
from collections.abc import Mapping
|
||||
from enum import Enum
|
||||
from typing import Any
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
import homeassistant.core
|
||||
|
||||
_DataT = TypeVar("_DataT")
|
||||
|
||||
GPSType = tuple[float, float]
|
||||
ConfigType = dict[str, Any]
|
||||
ContextType = homeassistant.core.Context
|
||||
@@ -32,5 +34,10 @@ UNDEFINED = UndefinedType._singleton # pylint: disable=protected-access
|
||||
# that may rely on them.
|
||||
# In due time they will be removed.
|
||||
HomeAssistantType = homeassistant.core.HomeAssistant
|
||||
EventType = homeassistant.core.Event
|
||||
ServiceCallType = homeassistant.core.ServiceCall
|
||||
|
||||
|
||||
class EventType(homeassistant.core.Event, Generic[_DataT]):
|
||||
"""Generic Event class to better type data."""
|
||||
|
||||
data: _DataT # type: ignore[assignment]
|
||||
|
Reference in New Issue
Block a user