Home Assistant Unofficial Reference 2024.12.1
enum.py
Go to the documentation of this file.
1 """Enum backports from standard lib.
2 
3 This file contained the backport of the StrEnum of Python 3.11.
4 
5 Since we have dropped support for Python 3.10, we can remove this backport.
6 This file is kept for now to avoid breaking custom components that might
7 import it.
8 """
9 
10 from __future__ import annotations
11 
12 from enum import StrEnum as _StrEnum
13 from functools import partial
14 
16  DeprecatedAlias,
17  all_with_deprecated_constants,
18  check_if_deprecated_constant,
19  dir_with_deprecated_constants,
20 )
21 
22 # StrEnum deprecated as of 2024.5 use enum.StrEnum instead.
23 _DEPRECATED_StrEnum = DeprecatedAlias(_StrEnum, "enum.StrEnum", "2025.5")
24 
25 __getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
26 __dir__ = partial(
27  dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
28 )
29 __all__ = all_with_deprecated_constants(globals())
list[str] all_with_deprecated_constants(dict[str, Any] module_globals)
Definition: deprecation.py:356