diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-12 14:00:26 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-05-12 14:00:26 +0300 |
commit | 35543eb71299989dbf13f2d22ebdba477e879ae0 (patch) | |
tree | dfff58a3f0bdcc15994f9d2be2b0275a2a91791c | |
parent | 067be2a2d551e87d0fd19b8a92ab0d6ab39d11fd (diff) | |
download | pylint-35543eb71299989dbf13f2d22ebdba477e879ae0.tar.gz |
Use the base_scope_type instead of looking in self._to_consume directly.
-rw-r--r-- | pylint/checkers/variables.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/pylint/checkers/variables.py b/pylint/checkers/variables.py index aa19179..ae0e695 100644 --- a/pylint/checkers/variables.py +++ b/pylint/checkers/variables.py @@ -852,7 +852,7 @@ builtins. Remember that you should avoid to define new builtins when possible.' defframe.parent_of(node) and isinstance(defframe, astroid.Class) and node.name == defframe.name) - if (self._to_consume[-1][-1] == 'lambda' and + if (base_scope_type == 'lambda' and isinstance(frame, astroid.Class) and name in frame.locals): maybee0601 = True @@ -894,10 +894,10 @@ builtins. Remember that you should avoid to define new builtins when possible.' or annotation_return or isinstance(defstmt, astroid.Delete)): self.add_message('undefined-variable', args=name, node=node) - elif self._to_consume[-1][-1] != 'lambda': + elif base_scope_type != 'lambda': # E0601 may *not* occurs in lambda scope. self.add_message('used-before-assignment', args=name, node=node) - elif self._to_consume[-1][-1] == 'lambda': + elif base_scope_type == 'lambda': # E0601 can occur in class-level scope in lambdas, as in # the following example: # class A: |