diff options
| author | Michal Nowikowski <godfryd@gmail.com> | 2014-08-02 06:31:13 +0200 |
|---|---|---|
| committer | Michal Nowikowski <godfryd@gmail.com> | 2014-08-02 06:31:13 +0200 |
| commit | 8ef5d79f2f65469ba08c3e5ef4f79be010e389da (patch) | |
| tree | 2efbf7b939631357591ff259a9fe20a1142d12be | |
| parent | 067b083930d7aa751ac8d5698e90e49adeb63b2e (diff) | |
| download | pylint-8ef5d79f2f65469ba08c3e5ef4f79be010e389da.tar.gz | |
Fixed preparing unused-import message.
| -rw-r--r-- | checkers/variables.py | 2 | ||||
| -rw-r--r-- | test/functional/unused_import.py | 1 | ||||
| -rw-r--r-- | test/functional/unused_import.txt | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/checkers/variables.py b/checkers/variables.py index 3893a4a..68dd0d5 100644 --- a/checkers/variables.py +++ b/checkers/variables.py @@ -331,7 +331,7 @@ builtins. Remember that you should avoid to define new builtins when possible.' self.add_message('unused-wildcard-import', args=name, node=stmt) else: if stmt.names[0][1] is None: - msg = "%s imported from %s" % stmt.names[0][0], stmt.modname + msg = "%s imported from %s" % (stmt.names[0][0], stmt.modname) else: msg = "%s imported from %s as %s" % (stmt.names[0][0], stmt.modname, stmt.names[0][1]) self.add_message('unused-import', args=msg, node=stmt) diff --git a/test/functional/unused_import.py b/test/functional/unused_import.py index e129a41..08aa0ee 100644 --- a/test/functional/unused_import.py +++ b/test/functional/unused_import.py @@ -3,3 +3,4 @@ import xml.etree # [unused-import] import xml.sax # [unused-import] import os.path as test # [unused-import] from sys import argv as test2 # [unused-import] +from sys import flags # [unused-import] diff --git a/test/functional/unused_import.txt b/test/functional/unused_import.txt index 627fb2d..53243c1 100644 --- a/test/functional/unused_import.txt +++ b/test/functional/unused_import.txt @@ -2,3 +2,4 @@ unused-import:2::Unused import xml.etree unused-import:3::Unused import xml.sax unused-import:4::Unused os.path imported as test unused-import:5::Unused argv imported from sys as test2 +unused-import:6::Unused flags imported from sys |
