22
33from collections .abc import Mapping
44from enum import Enum
5- from functools import partial
65from typing import Any , Never
76
87import voluptuous as vol
98
10- from .deprecation import (
11- DeferredDeprecatedAlias ,
12- all_with_deprecated_constants ,
13- check_if_deprecated_constant ,
14- dir_with_deprecated_constants ,
15- )
16-
179type GPSType = tuple [float , float ]
1810type ConfigType = dict [str , Any ]
1911type DiscoveryInfoType = dict [str , Any ]
@@ -35,32 +27,3 @@ class UndefinedType(Enum):
3527
3628
3729UNDEFINED = UndefinedType ._singleton # noqa: SLF001
38-
39-
40- def _deprecated_typing_helper (attr : str ) -> DeferredDeprecatedAlias :
41- """Help to make a DeferredDeprecatedAlias."""
42-
43- def value_fn () -> Any :
44- import homeassistant .core # noqa: PLC0415
45-
46- return getattr (homeassistant .core , attr )
47-
48- return DeferredDeprecatedAlias (value_fn , f"homeassistant.core.{ attr } " , "2025.5" )
49-
50-
51- # The following types should not used and
52- # are not present in the core code base.
53- # They are kept in order not to break custom integrations
54- # that may rely on them.
55- # Deprecated as of 2024.5 use types from homeassistant.core instead.
56- _DEPRECATED_ContextType = _deprecated_typing_helper ("Context" )
57- _DEPRECATED_EventType = _deprecated_typing_helper ("Event" )
58- _DEPRECATED_HomeAssistantType = _deprecated_typing_helper ("HomeAssistant" )
59- _DEPRECATED_ServiceCallType = _deprecated_typing_helper ("ServiceCall" )
60-
61- # These can be removed if no deprecated constant are in this module anymore
62- __getattr__ = partial (check_if_deprecated_constant , module_globals = globals ())
63- __dir__ = partial (
64- dir_with_deprecated_constants , module_globals_keys = [* globals ().keys ()]
65- )
66- __all__ = all_with_deprecated_constants (globals ())
0 commit comments