summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Marek <shlomme@gmail.com>2014-04-25 23:31:38 +0200
committerTorsten Marek <shlomme@gmail.com>2014-04-25 23:31:38 +0200
commit14c199bb7ee187e67b3dac216e71695c5090604e (patch)
treeb441b0f480d1e537e2fd8091964e056645b6e8f9
parent751762c8ed3858e3be0a256e1197aaf9d4328664 (diff)
downloadpylint-14c199bb7ee187e67b3dac216e71695c5090604e.tar.gz
Use Module.future_imports for detecting if print is a builtin.
-rw-r--r--checkers/format.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/checkers/format.py b/checkers/format.py
index eedce59..8b73049 100644
--- a/checkers/format.py
+++ b/checkers/format.py
@@ -474,10 +474,8 @@ class FormatChecker(BaseTokenChecker):
def process_module(self, module):
self._keywords_with_parens = set()
- for node in module.body:
- if (isinstance(node, nodes.From) and node.modname == '__future__'
- and any(name == 'print_function' for name, _ in node.names)):
- self._keywords_with_parens.add('print')
+ if 'print_function' in module.future_imports:
+ self._keywords_with_parens.add('print')
def _check_keyword_parentheses(self, tokens, start):
"""Check that there are not unnecessary parens after a keyword.