diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2016-06-14 12:17:31 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2016-07-01 01:12:10 +0100 |
commit | 1c9565d6b3d0e524ce20a6111a892d16afa262db (patch) | |
tree | bfae5f8bd60481441ab7c2e6fe191fc8c5834436 | |
parent | 0eecb4bc85bb7a75ea0dff0776d2947b040b94a0 (diff) | |
download | pylint-git-1c9565d6b3d0e524ce20a6111a892d16afa262db.tar.gz |
Install the backport of lru_cache and use it for overriden_method (the same behaviour before changing it to a function per stmt).
-rw-r--r-- | pylint/__pkginfo__.py | 1 | ||||
-rw-r--r-- | pylint/checkers/variables.py | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pylint/__pkginfo__.py b/pylint/__pkginfo__.py index 1c14429e6..c2b60c688 100644 --- a/pylint/__pkginfo__.py +++ b/pylint/__pkginfo__.py @@ -25,6 +25,7 @@ if sys.platform == 'win32': install_requires.append('colorama') if sys.version_info[0] == 2: install_requires.append('configparser') + install_requires.append('backports.functools_lru_cache') license = 'GPL' diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index fef71b741..3290e886d 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -8,6 +8,10 @@ import os import sys import re from copy import copy +try: + from functools import lru_cache +except ImportError: + from backports.functools_lru_cache import lru_cache import six @@ -48,6 +52,7 @@ def in_for_else_branch(parent, stmt): return (isinstance(parent, astroid.For) and any(else_stmt.parent_of(stmt) for else_stmt in parent.orelse)) +@lru_cache(maxsize=1000) def overridden_method(klass, name): """get overridden method if any""" try: |