File tree 3 files changed +39
-18
lines changed
3 files changed +39
-18
lines changed Original file line number Diff line number Diff line change
1
+ # Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
2
+ # For details: https://github.com/pylint-dev/pylint/blob/main/LICENSE
3
+ # Copyright (c) https://github.com/pylint-dev/pylint/blob/main/CONTRIBUTORS.txt
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import TYPE_CHECKING , Any
8
+
9
+ from pylint .checkers .typecheck import _similar_names
10
+ from pylint .checkers .utils import (
11
+ class_is_abstract ,
12
+ in_for_else_branch ,
13
+ infer_all ,
14
+ is_overload_stub ,
15
+ overridden_method ,
16
+ safe_infer ,
17
+ unimplemented_abstract_methods ,
18
+ )
19
+
20
+ if TYPE_CHECKING :
21
+ from functools import _lru_cache_wrapper
22
+
23
+
24
+ def clear_lru_caches () -> None :
25
+ """Clear caches holding references to AST nodes."""
26
+ caches_holding_node_references : list [_lru_cache_wrapper [Any ]] = [
27
+ class_is_abstract ,
28
+ in_for_else_branch ,
29
+ infer_all ,
30
+ is_overload_stub ,
31
+ overridden_method ,
32
+ unimplemented_abstract_methods ,
33
+ safe_infer ,
34
+ _similar_names ,
35
+ ]
36
+ for lru in caches_holding_node_references :
37
+ lru .cache_clear ()
Original file line number Diff line number Diff line change 16
16
from collections .abc import Callable , Iterable , Iterator
17
17
from functools import lru_cache , partial
18
18
from re import Match
19
- from typing import TYPE_CHECKING , Any , TypeVar
19
+ from typing import TYPE_CHECKING , TypeVar
20
20
21
21
import astroid .objects
22
22
from astroid import TooManyLevelsError , nodes , util
28
28
from pylint .constants import TYPING_NEVER , TYPING_NORETURN
29
29
30
30
if TYPE_CHECKING :
31
- from functools import _lru_cache_wrapper
32
31
33
32
from pylint .checkers import BaseChecker
34
33
@@ -2327,21 +2326,6 @@ def overridden_method(
2327
2326
return None # pragma: no cover
2328
2327
2329
2328
2330
- def clear_lru_caches () -> None :
2331
- """Clear caches holding references to AST nodes."""
2332
- caches_holding_node_references : list [_lru_cache_wrapper [Any ]] = [
2333
- class_is_abstract ,
2334
- in_for_else_branch ,
2335
- infer_all ,
2336
- is_overload_stub ,
2337
- overridden_method ,
2338
- unimplemented_abstract_methods ,
2339
- safe_infer ,
2340
- ]
2341
- for lru in caches_holding_node_references :
2342
- lru .cache_clear ()
2343
-
2344
-
2345
2329
def is_enum_member (node : nodes .AssignName ) -> bool :
2346
2330
"""Return `True` if `node` is an Enum member (is an item of the
2347
2331
`__members__` container).
Original file line number Diff line number Diff line change 12
12
from typing import ClassVar
13
13
14
14
from pylint import config
15
- from pylint .checkers .utils import clear_lru_caches
15
+ from pylint .checkers .clear_lru_cache import clear_lru_caches
16
16
from pylint .config ._pylint_config import (
17
17
_handle_pylint_config_commands ,
18
18
_register_generate_config_options ,
You can’t perform that action at this time.
0 commit comments