From cc57a4728ecb68b3bd81e793562eec5c12826908 Mon Sep 17 00:00:00 2001 From: Jehiah Czebotar Date: Tue, 30 Aug 2011 00:32:22 -0400 Subject: [PATCH] tag things with '# pyflakes.ignore' --- pyflakes/scripts/pyflakes.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pyflakes/scripts/pyflakes.py b/pyflakes/scripts/pyflakes.py index 6b1dae2..8b577db 100644 --- a/pyflakes/scripts/pyflakes.py +++ b/pyflakes/scripts/pyflakes.py @@ -54,10 +54,21 @@ def check(codeString, filename): # Okay, it's syntactically valid. Now check it. w = checker.Checker(tree, filename) w.messages.sort(lambda a, b: cmp(a.lineno, b.lineno)) + warnings = 0 for warning in w.messages: + if skip_warning(warning): + continue print warning - return len(w.messages) + warnings += 1 + return warnings +def skip_warning(warning): + # quick dirty hack, just need to keep the line in the warning + line = open(warning.filename).readlines()[warning.lineno-1] + return skip_line(line) + +def skip_line(line): + return line.rstrip().endswith('# pyflakes.ignore') def checkPath(filename): """