Skip to content

Commit 16322e8

Browse files
committed
Simplify cached_property import guards
1 parent 014a04c commit 16322e8

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

astroid/mixins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
if TYPE_CHECKING:
1515
from astroid import nodes
1616

17-
if sys.version_info >= (3, 8) or TYPE_CHECKING:
17+
if sys.version_info >= (3, 8):
1818
from functools import cached_property
1919
else:
2020
from astroid.decorators import cachedproperty as cached_property

astroid/nodes/node_classes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@
4646
from astroid import nodes
4747
from astroid.nodes import LocalsDictNodeNG
4848

49-
if sys.version_info >= (3, 8) or TYPE_CHECKING:
50-
# pylint: disable-next=ungrouped-imports
49+
if sys.version_info >= (3, 8):
5150
from functools import cached_property
5251
else:
5352
from astroid.decorators import cachedproperty as cached_property

astroid/nodes/node_ng.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@
4343
else:
4444
from typing_extensions import Literal
4545

46-
if sys.version_info >= (3, 8) or TYPE_CHECKING:
47-
# pylint: disable-next=ungrouped-imports
46+
if sys.version_info >= (3, 8):
4847
from functools import cached_property
4948
else:
50-
# pylint: disable-next=ungrouped-imports
5149
from astroid.decorators import cachedproperty as cached_property
5250

5351
# Types for 'NodeNG.nodes_of_class()'

astroid/nodes/scoped_nodes/scoped_nodes.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import sys
1414
import typing
1515
import warnings
16-
from typing import TYPE_CHECKING, Dict, List, Optional, Set, TypeVar, Union, overload
16+
from typing import Dict, List, Optional, Set, TypeVar, Union, overload
1717

1818
from astroid import bases
1919
from astroid import decorators as decorators_mod
@@ -51,14 +51,11 @@
5151

5252

5353
if sys.version_info >= (3, 8):
54+
from functools import cached_property
5455
from typing import Literal
5556
else:
5657
from typing_extensions import Literal
5758

58-
if sys.version_info >= (3, 8) or TYPE_CHECKING:
59-
from functools import cached_property
60-
else:
61-
# pylint: disable-next=ungrouped-imports
6259
from astroid.decorators import cachedproperty as cached_property
6360

6461

astroid/objects.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"""
1313

1414
import sys
15-
from typing import TYPE_CHECKING
1615

1716
from astroid import bases, decorators, util
1817
from astroid.exceptions import (
@@ -26,7 +25,7 @@
2625

2726
objectmodel = util.lazy_import("interpreter.objectmodel")
2827

29-
if sys.version_info >= (3, 8) or TYPE_CHECKING:
28+
if sys.version_info >= (3, 8):
3029
from functools import cached_property
3130
else:
3231
from astroid.decorators import cachedproperty as cached_property

0 commit comments

Comments
 (0)