diff --git a/homeassistant/backports/functools.py b/homeassistant/backports/functools.py deleted file mode 100644 index 1b032c65966..00000000000 --- a/homeassistant/backports/functools.py +++ /dev/null @@ -1,31 +0,0 @@ -"""Functools backports from standard lib. - -This file contained the backport of the cached_property implementation of Python 3.12. - -Since we have dropped support for Python 3.11, we can remove this backport. -This file is kept for now to avoid breaking custom components that might -import it. -""" - -from __future__ import annotations - -# pylint: disable-next=hass-deprecated-import -from functools import cached_property as _cached_property, partial - -from homeassistant.helpers.deprecation import ( - DeprecatedAlias, - all_with_deprecated_constants, - check_if_deprecated_constant, - dir_with_deprecated_constants, -) - -# cached_property deprecated as of 2024.5 use functools.cached_property instead. -_DEPRECATED_cached_property = DeprecatedAlias( - _cached_property, "functools.cached_property", "2025.5" -) - -__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()) diff --git a/pylint/plugins/hass_imports.py b/pylint/plugins/hass_imports.py index 96fc608c1c4..38dbf035604 100644 --- a/pylint/plugins/hass_imports.py +++ b/pylint/plugins/hass_imports.py @@ -25,12 +25,6 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = { constant=re.compile(r"^cached_property$"), ), ], - "homeassistant.backports.functools": [ - ObsoleteImportMatch( - reason="replaced by propcache.api.cached_property", - constant=re.compile(r"^cached_property$"), - ), - ], "homeassistant.components.light": [ ObsoleteImportMatch( reason="replaced by ColorMode enum", diff --git a/tests/test_backports.py b/tests/test_backports.py deleted file mode 100644 index ecd2ea7df9d..00000000000 --- a/tests/test_backports.py +++ /dev/null @@ -1,36 +0,0 @@ -"""Test backports package.""" - -from __future__ import annotations - -from functools import cached_property # pylint: disable=hass-deprecated-import -from types import ModuleType -from typing import Any - -import pytest - -from homeassistant.backports import functools as backports_functools - -from .common import import_and_test_deprecated_alias - - -@pytest.mark.parametrize( - ("module", "replacement", "breaks_in_ha_version"), - [ - (backports_functools, cached_property, "2025.5"), - ], -) -def test_deprecated_aliases( - caplog: pytest.LogCaptureFixture, - module: ModuleType, - replacement: Any, - breaks_in_ha_version: str, -) -> None: - """Test deprecated aliases.""" - alias_name = replacement.__name__ - import_and_test_deprecated_alias( - caplog, - module, - alias_name, - replacement, - breaks_in_ha_version, - )