diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2012-06-07 14:54:04 +0200 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2012-06-07 14:54:04 +0200 |
commit | e55d63fc8e99f24395675993a520f90c4760d8d6 (patch) | |
tree | c83034480c49f8ab4a12e866ec24e32b14b19ead /checkers/classes.py | |
parent | b38e3ef6767af52b9e85318d97bb5c15fb28505c (diff) | |
download | pylint-e55d63fc8e99f24395675993a520f90c4760d8d6.tar.gz |
Refactor _check_protected_attribute_access by extracting independent part in utils functions. Improve is_super_call docstring.
Diffstat (limited to 'checkers/classes.py')
-rw-r--r-- | checkers/classes.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/checkers/classes.py b/checkers/classes.py index 8001821..716d0a9 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -23,7 +23,7 @@ from logilab.astng import YES, Instance, are_exclusive, AssAttr from pylint.interfaces import IASTNGChecker from pylint.checkers import BaseChecker from pylint.checkers.utils import (PYMETHODS, overrides_a_method, - check_messages, is_attr_private) + check_messages, is_attr_private, is_attr_protected, node_frame_class) def class_is_abstract(node): """return true if the given class node should be considered as an abstract @@ -334,16 +334,9 @@ a class method.'} ''' attrname = node.attrname - if attrname[0] == '_' and not attrname == '_' and not ( - attrname.startswith('__') and attrname.endswith('__')): + if is_attr_protected(attrname): - klass = node.frame() - - while klass is not None and not isinstance(klass, astng.Class): - if klass.parent is None: - klass = None - else: - klass = klass.parent.frame() + klass = node_frame_class(node) # XXX infer to be more safe and less dirty ?? # in classes, check we are not getting a parent method |