Add pylint rule for cached_property (#127482)
This commit is contained in:
parent
1dd59375f6
commit
6eb49991a4
|
@ -9,6 +9,7 @@ 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 (
|
||||
|
|
|
@ -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$"),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from enum import StrEnum
|
||||
from functools import cached_property
|
||||
from functools import cached_property # pylint: disable=hass-deprecated-import
|
||||
from types import ModuleType
|
||||
from typing import Any
|
||||
|
||||
|
|
Loading…
Reference in New Issue