Home Assistant Unofficial Reference 2024.12.1
functools.py
Go to the documentation of this file.
1 """Functools backports from standard lib.
2 
3 This file contained the backport of the cached_property implementation of Python 3.12.
4 
5 Since we have dropped support for Python 3.11, 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 # pylint: disable-next=hass-deprecated-import
13 from functools import cached_property as _cached_property, partial
14 
16  DeprecatedAlias,
17  all_with_deprecated_constants,
18  check_if_deprecated_constant,
19  dir_with_deprecated_constants,
20 )
21 
22 # cached_property deprecated as of 2024.5 use functools.cached_property instead.
23 _DEPRECATED_cached_property = DeprecatedAlias(
24  _cached_property, "functools.cached_property", "2025.5"
25 )
26 
27 __getattr__ = partial(check_if_deprecated_constant, module_globals=globals())
28 __dir__ = partial(
29  dir_with_deprecated_constants, module_globals_keys=[*globals().keys()]
30 )
31 __all__ = all_with_deprecated_constants(globals())
list[str] all_with_deprecated_constants(dict[str, Any] module_globals)
Definition: deprecation.py:356