Add pylint rule for cached_property (#127482)

This commit is contained in:
J. Nick Koston
2024-10-03 17:53:55 -05:00
committed by GitHub
parent 1dd59375f6
commit 6eb49991a4
3 changed files with 9 additions and 5 deletions

View File

@@ -19,6 +19,12 @@ class ObsoleteImportMatch:
_OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
"functools": [
ObsoleteImportMatch(
reason="replaced by propcache.cached_property",
constant=re.compile(r"^cached_property$"),
),
],
"homeassistant.backports.enum": [
ObsoleteImportMatch(
reason="We can now use the Python 3.11 provided enum.StrEnum instead",
@@ -27,10 +33,7 @@ _OBSOLETE_IMPORT: dict[str, list[ObsoleteImportMatch]] = {
],
"homeassistant.backports.functools": [
ObsoleteImportMatch(
reason=(
"We can now use the Python 3.12 provided "
"functools.cached_property instead"
),
reason="replaced by propcache.cached_property",
constant=re.compile(r"^cached_property$"),
),
],