Skip to content

Commit 533e980

Browse files
Put cached_property import behind guard
1 parent 7b713d4 commit 533e980

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pylint/checkers/imports.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import sys
1313
from collections import defaultdict
1414
from collections.abc import ItemsView, Sequence
15-
from functools import cached_property
1615
from typing import TYPE_CHECKING, Any, Dict, List, Union
1716

1817
import astroid
@@ -38,6 +37,12 @@
3837
if TYPE_CHECKING:
3938
from pylint.lint import PyLinter
4039

40+
if sys.version_info >= (3, 8):
41+
from functools import cached_property
42+
else:
43+
from astroid.decorators import cachedproperty as cached_property
44+
45+
4146
# The dictionary with Any should actually be a _ImportTree again
4247
# but mypy doesn't support recursive types yet
4348
_ImportTree = Dict[str, Union[List[Dict[str, Any]], List[str]]]

0 commit comments

Comments
 (0)