Merge "Fix pyflakes-bypass for PyFlakes 0.7"

This commit is contained in:
Jenkins 2013-04-23 10:31:00 +00:00 committed by Gerrit Code Review
commit 818f9e7c67

View File

@ -3,11 +3,11 @@ from pyflakes.checker import Checker
def report_with_bypass(self, messageClass, *args, **kwargs):
text_lineno = args[0] - 1
message = messageClass(self.filename, *args, **kwargs)
with open(self.filename, 'r') as code:
if code.readlines()[text_lineno].find('pyflakes_bypass') >= 0:
if 'pyflakes_bypass' in code.readlines()[message.lineno - 1]:
return
self.messages.append(messageClass(self.filename, *args, **kwargs))
self.messages.append(message)
# monkey patch checker to support bypass
Checker.report = report_with_bypass