summaryrefslogtreecommitdiff
path: root/checkers/variables.py
diff options
context:
space:
mode:
authorSylvain <syt@logilab.fr>2006-12-05 10:29:06 +0100
committerSylvain <syt@logilab.fr>2006-12-05 10:29:06 +0100
commitddd403c6e5fed8aad0648b9205c41f384b49a808 (patch)
tree2ef1ef17ac981d46d080585bb53fc382c3e13945 /checkers/variables.py
parent9c73bcc109fcf2f638d51dd5c3f6f66a8ea27cce (diff)
downloadpylint-ddd403c6e5fed8aad0648b9205c41f384b49a808.tar.gz
see changelog
Diffstat (limited to 'checkers/variables.py')
-rw-r--r--checkers/variables.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/checkers/variables.py b/checkers/variables.py
index 47f0355..7be2d16 100644
--- a/checkers/variables.py
+++ b/checkers/variables.py
@@ -16,8 +16,6 @@
"""variables checkers for Python code
"""
-__revision__ = "$Id: variables.py,v 1.69 2006-04-19 09:17:40 syt Exp $"
-
from copy import copy
from logilab.common.compat import enumerate
@@ -61,6 +59,9 @@ MSGS = {
'Used when a variable is defined but not used.'),
'W0613': ('Unused argument %r',
'Used when a function or method argument is not used.'),
+ 'W0614': ('Unused import %s from wildcard import',
+ 'Used when an imported module or variable is not used from a \
+ \'from X import *\' style import.'),
'W0621': ('Redefining name %r from outer scope (line %s)',
'Used when a variable\'s name hide a name defined in the outer \
@@ -134,9 +135,13 @@ builtins. Remember that you should avoid to define new builtins when possible.'
return
for name, stmts in not_consumed.items():
stmt = stmts[0]
- if isinstance(stmt, astng.Import) or (
- isinstance(stmt, astng.From) and stmt.modname != '__future__'):
+ if isinstance(stmt, astng.Import):
self.add_message('W0611', args=name, node=stmt)
+ elif isinstance(stmt, astng.From) and stmt.modname != '__future__':
+ if stmt.names[0][0] == '*':
+ self.add_message('W0614', args=name, node=stmt)
+ else:
+ self.add_message('W0611', args=name, node=stmt)
del self._to_consume
del self._vars