diff options
author | Michal Nowikowski <godfryd@gmail.com> | 2014-08-01 06:30:10 +0200 |
---|---|---|
committer | Michal Nowikowski <godfryd@gmail.com> | 2014-08-01 06:30:10 +0200 |
commit | 9eb9853d52091a24ceffd04679762a7efedc98fd (patch) | |
tree | 62bfad82ea4ee61c48bcaab57aa9eed0a2812bc2 /checkers/variables.py | |
parent | cb41910e3fbad8bd6ba041b285b74a439c9d9375 (diff) | |
download | pylint-9eb9853d52091a24ceffd04679762a7efedc98fd.tar.gz |
Improved presenting unused-import message. Closes issue #293.
Diffstat (limited to 'checkers/variables.py')
-rw-r--r-- | checkers/variables.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 338615f..e1ae0ec 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -319,14 +319,14 @@ builtins. Remember that you should avoid to define new builtins when possible.' and isinstance(stmt.ass_type(), astroid.AugAssign) for stmt in stmts): continue - stmt = stmts[0] - if isinstance(stmt, astroid.Import): - self.add_message('unused-import', args=name, node=stmt) - elif isinstance(stmt, astroid.From) and stmt.modname != '__future__': - if stmt.names[0][0] == '*': - self.add_message('unused-wildcard-import', args=name, node=stmt) - else: - self.add_message('unused-import', args=name, node=stmt) + for stmt in stmts: + if isinstance(stmt, astroid.Import): + self.add_message('unused-import', args=stmt.names[0][0], node=stmt) + elif isinstance(stmt, astroid.From) and stmt.modname != '__future__': + if stmt.names[0][0] == '*': + self.add_message('unused-wildcard-import', args=name, node=stmt) + else: + self.add_message('unused-import', args=name, node=stmt) del self._to_consume def visit_class(self, node): |