Quantcast
Channel: User Chase Seibert - Stack Overflow
Viewing all articles
Browse latest Browse all 43

Answer by Chase Seibert for How do I get Pyflakes to ignore a statement?

$
0
0

Here is a monkey patch for pyflakes that adds a # bypass_pyflakes comment option.

bypass_pyflakes.py

#!/usr/bin/env pythonfrom pyflakes.scripts import pyflakesfrom pyflakes.checker import Checkerdef report_with_bypass(self, messageClass, *args, **kwargs):    text_lineno = args[0] - 1    with open(self.filename, 'r') as code:        if code.readlines()[text_lineno].find('bypass_pyflakes') >= 0:            return    self.messages.append(messageClass(self.filename, *args, **kwargs))# monkey patch checker to support bypassChecker.report = report_with_bypasspyflakes.main()

If you save this as bypass_pyflakes.py, then you can invoke it as python bypass_pyflakes.py myfile.py.

http://chase-seibert.github.com/blog/2013/01/11/bypass_pyflakes.html


Viewing all articles
Browse latest Browse all 43

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>