Mercurial > dotfiles
view unixSoft/bin/epylint @ 175:4741c022c7ae
python-mode: apply patch from the python-mode list to fix triplequotes.
This patch is originally by Andreas Roehler <andreas.roehler at online.de>.
It was not applied because it works only in GNU Emacs based on list archives.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Wed, 16 Dec 2009 22:59:38 -0600 |
parents | 7f67cf332537 |
children |
line wrap: on
line source
#!/usr/bin/env python import re import sys from subprocess import Popen, PIPE p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" % sys.argv[1], shell = True, stdout = PIPE).stdout for line in p.readlines(): match = re.search("\\[([WE])(, (.+?))?\\]", line) if match: kind = match.group(1) func = match.group(3) if kind == "W": msg = "Warning" else: msg = "Error" if func: line = re.sub("\\[([WE])(, (.+?))?\\]", "%s (%s):" % (msg, func), line) else: line = re.sub("\\[([WE])?\\]", "%s:" % msg, line) print line, p.close()