diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-21 19:42:08 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2015-11-21 19:42:08 +0200 |
commit | 4fe6bc4dcd3060dd769bb8459a525106d4c44e76 (patch) | |
tree | 27fc2149c6c923447c9a120cb8b25028b9affc3b /pylint/checkers/classes.py | |
parent | 08b57ecc0fae483e794a0f6f944b0ead00025f51 (diff) | |
download | pylint-git-4fe6bc4dcd3060dd769bb8459a525106d4c44e76.tar.gz |
Cleanup pylint issues
This changeset also brings a couple of changes:
* rrheaders and rcheaders are dropped from html_writer.Table's constructor.
They weren't used at all and it was dead code. This simplified some
if statements.
* _is_attribute_property is used to look for a property assignment
instead on relying on a different implementation.
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r-- | pylint/checkers/classes.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py index 2dc45e185..6763f74f1 100644 --- a/pylint/checkers/classes.py +++ b/pylint/checkers/classes.py @@ -723,16 +723,13 @@ a metaclass class method.'} # b = property(lambda: self._b) stmt = node.parent.statement() - try: - if (isinstance(stmt, astroid.Assign) and - (stmt in klass.body or klass.parent_of(stmt)) and - isinstance(stmt.value, astroid.Call) and - isinstance(stmt.value.func, astroid.Name) and - stmt.value.func.name == 'property' and - is_builtin_object(next(stmt.value.func.infer(), None))): + if (isinstance(stmt, astroid.Assign) + and len(stmt.targets) == 1 + and isinstance(stmt.targets[0], astroid.AssignName)): + name = stmt.targets[0].name + if _is_attribute_property(name, klass): return - except astroid.InferenceError: - pass + self.add_message('protected-access', node=node, args=attrname) def visit_name(self, node): |