Merge "Fix pyflakes-bypass for PyFlakes 0.7"
This commit is contained in:
commit
818f9e7c67
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user