diff options
author | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-23 08:35:43 -0400 |
---|---|---|
committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2023-04-23 12:43:23 -0400 |
commit | 5ddf4a61d211c9db2e49a081fa26562d57313db3 (patch) | |
tree | 6df135ed6bafbc608ff5cad21b5a872a881ba4d2 /pylint/checkers | |
parent | 3d036b78fca6e80222f9ca2ffd0f25950d261aed (diff) | |
download | pylint-git-5ddf4a61d211c9db2e49a081fa26562d57313db3.tar.gz |
Cache `class_is_abstract()`
For one project in the pylint primer (music21),
provides 15% speedup linting the entire project.
Diffstat (limited to 'pylint/checkers')
-rw-r--r-- | pylint/checkers/utils.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/pylint/checkers/utils.py b/pylint/checkers/utils.py index 38321bc11..c76c767aa 100644 --- a/pylint/checkers/utils.py +++ b/pylint/checkers/utils.py @@ -1130,6 +1130,7 @@ def node_ignores_exception( return any(get_contextlib_suppressors(node, exception)) +@lru_cache(maxsize=1024) def class_is_abstract(node: nodes.ClassDef) -> bool: """Return true if the given class node should be considered as an abstract class. @@ -2191,6 +2192,7 @@ def overridden_method( def clear_lru_caches() -> None: """Clear caches holding references to AST nodes.""" caches_holding_node_references: list[_lru_cache_wrapper[Any]] = [ + class_is_abstract, in_for_else_branch, infer_all, is_overload_stub, |