mirror of
https://github.com/home-assistant/core.git
synced 2025-07-30 02:38:10 +02:00
Deprecated old backports and typing aliases (#114883)
This commit is contained in:
@ -2,15 +2,22 @@
|
||||
|
||||
from collections.abc import Mapping
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
from typing import Any, TypeVar
|
||||
|
||||
import homeassistant.core
|
||||
|
||||
from .deprecation import (
|
||||
DeprecatedAlias,
|
||||
all_with_deprecated_constants,
|
||||
check_if_deprecated_constant,
|
||||
dir_with_deprecated_constants,
|
||||
)
|
||||
|
||||
_DataT = TypeVar("_DataT")
|
||||
|
||||
GPSType = tuple[float, float]
|
||||
ConfigType = dict[str, Any]
|
||||
ContextType = homeassistant.core.Context
|
||||
DiscoveryInfoType = dict[str, Any]
|
||||
ServiceDataType = dict[str, Any]
|
||||
StateType = str | int | float | None
|
||||
@ -33,7 +40,23 @@ UNDEFINED = UndefinedType._singleton # pylint: disable=protected-access
|
||||
# are not present in the core code base.
|
||||
# They are kept in order not to break custom integrations
|
||||
# that may rely on them.
|
||||
# In due time they will be removed.
|
||||
EventType = homeassistant.core.Event
|
||||
HomeAssistantType = homeassistant.core.HomeAssistant
|
||||
ServiceCallType = homeassistant.core.ServiceCall
|
||||
# Deprecated as of 2024.5 use types from homeassistant.core instead.
|
||||
_DEPRECATED_ContextType = DeprecatedAlias(
|
||||
homeassistant.core.Context, "homeassistant.core.Context", "2025.5"
|
||||
)
|
||||
_DEPRECATED_EventType = DeprecatedAlias(
|
||||
homeassistant.core.Event, "homeassistant.core.Event", "2025.5"
|
||||
)
|
||||
_DEPRECATED_HomeAssistantType = DeprecatedAlias(
|
||||
homeassistant.core.HomeAssistant, "homeassistant.core.HomeAssistant", "2025.5"
|
||||
)
|
||||
_DEPRECATED_ServiceCallType = DeprecatedAlias(
|
||||
homeassistant.core.ServiceCall, "homeassistant.core.ServiceCall", "2025.5"
|
||||
)
|
||||
|
||||
# These can be removed if no deprecated constant are in this module anymore
|
||||
__getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
|
||||
__dir__ = partial(
|
||||
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
|
||||
)
|
||||
__all__ = all_with_deprecated_constants(globals())
|
||||
|
Reference in New Issue
Block a user