Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes #7 #8

Merged
merged 1 commit into from May 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions flake8_print.py
Expand Up @@ -3,7 +3,7 @@

from sys import stdin

__version__ = '1.6.0'
__version__ = '1.6.1'

PRINT_ERROR_CODE = 'T001'
PRINT_ERROR_MESSAGE = 'print statement found.'
Expand Down Expand Up @@ -45,7 +45,7 @@ def check_code_for_print_statements(code):
def check_tree_for_print_statements(tree, noqa):
errors = []
for node in ast.walk(tree):
if ((isinstance(node, ast.Call) and node.func.id == 'print') or (hasattr(ast, 'Print') and isinstance(node, ast.Print) and node.lineno not in noqa)) and node.lineno not in noqa:
if ((isinstance(node, ast.Call) and getattr(node.func, 'id', None) == 'print') or (hasattr(ast, 'Print') and isinstance(node, ast.Print) and node.lineno not in noqa)) and node.lineno not in noqa:
errors.append({
"message": '{0} {1}'.format(PRINT_ERROR_CODE, PRINT_ERROR_MESSAGE),
"line": node.lineno,
Expand Down