1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Include deprecated constants in wildcard imports (#107114)

This commit is contained in:
Erik Montnemery
2024-01-05 11:46:45 +01:00
committed by GitHub
parent c063bf403a
commit c805ea7b4f
52 changed files with 438 additions and 137 deletions

View File

@@ -83,6 +83,7 @@ from .exceptions import (
)
from .helpers.deprecation import (
DeprecatedConstantEnum,
all_with_deprecated_constants,
check_if_deprecated_constant,
dir_with_deprecated_constants,
)
@@ -159,11 +160,6 @@ _DEPRECATED_SOURCE_STORAGE = DeprecatedConstantEnum(ConfigSource.STORAGE, "2025.
_DEPRECATED_SOURCE_YAML = DeprecatedConstantEnum(ConfigSource.YAML, "2025.1")
# Both can be removed if no deprecated constant are in this module anymore
__getattr__ = functools.partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = functools.partial(dir_with_deprecated_constants, module_globals=globals())
# How long to wait until things that run on startup have to finish.
TIMEOUT_EVENT_START = 15
@@ -2545,3 +2541,11 @@ class Config:
if self._original_unit_system:
data["unit_system"] = self._original_unit_system
return await super().async_save(data)
# These can be removed if no deprecated constant are in this module anymore
__getattr__ = functools.partial(check_if_deprecated_constant, module_globals=globals())
__dir__ = functools.partial(
dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
)
__all__ = all_with_deprecated_constants(globals())