diff options
author | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2012-03-15 13:45:52 +0100 |
---|---|---|
committer | Sylvain Th?nault <sylvain.thenault@logilab.fr> | 2012-03-15 13:45:52 +0100 |
commit | 6b55d80bd9ba59e77e80cf3244f8b9018f8f969c (patch) | |
tree | b9517772cd0273e77bc245811828970f069d9134 /checkers/classes.py | |
parent | 8747675c91618553a5688bd90ae13955ba1b3600 (diff) | |
download | pylint-6b55d80bd9ba59e77e80cf3244f8b9018f8f969c.tar.gz |
don't emit E0202 (attribute hiding a method) on @property methods. Closes #89092
Diffstat (limited to 'checkers/classes.py')
-rw-r--r-- | checkers/classes.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/checkers/classes.py b/checkers/classes.py index 60d20b6..847646e 100644 --- a/checkers/classes.py +++ b/checkers/classes.py @@ -254,7 +254,17 @@ a class method.'} continue self._check_signature(node, meth_node, 'overridden') break - # check if the method overload an attribute + if node.decorators: + for decorator in node.decorators.nodes: + if isinstance(decorator, astng.Getattr) and \ + decorator.attrname in ('getter', 'setter', 'deleter'): + # attribute affectation will call this method, not hiding it + return + if isinstance(decorator, astng.Name) and decorator.name == 'property': + # attribute affectation will either call a setter or raise + # an attribute error, anyway not hiding the function + return + # check if the method is hidden by an attribute try: overridden = klass.instance_attr(node.name)[0] # XXX args = (overridden.root().name, overridden.fromlineno) |