Mercurial > dotfiles
annotate unixSoft/bin/epylint @ 351:bef29d49d19f
safe-paste: adds support for bracketed paste mode to zsh
Since I don't use oh-my-zsh, just import their code directly with a
reference. Based on the site where I learned about this [0], it's
originally from [1], and I downloaded it from [2].
0: https://cirw.in/blog/bracketed-paste
1: http://www.zsh.org/mla/users/2011/msg00367.html
2: https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/plugins/safe-paste/safe-paste.plugin.zsh
author | Augie Fackler <raf@durin42.com> |
---|---|
date | Mon, 10 Nov 2014 09:26:04 -0500 |
parents | 7f67cf332537 |
children |
rev | line source |
---|---|
93 | 1 #!/usr/bin/env python |
2 import re | |
3 import sys | |
4 | |
5 from subprocess import Popen, PIPE | |
6 | |
7 p = Popen("pylint -f parseable -r n --disable-msg-cat=C,R %s" % | |
8 sys.argv[1], shell = True, stdout = PIPE).stdout | |
9 | |
10 for line in p.readlines(): | |
11 match = re.search("\\[([WE])(, (.+?))?\\]", line) | |
12 if match: | |
13 kind = match.group(1) | |
14 func = match.group(3) | |
15 if kind == "W": | |
16 msg = "Warning" | |
17 else: | |
18 msg = "Error" | |
19 | |
20 if func: | |
21 line = re.sub("\\[([WE])(, (.+?))?\\]", | |
22 "%s (%s):" % (msg, func), line) | |
23 else: | |
24 line = re.sub("\\[([WE])?\\]", "%s:" % msg, line) | |
25 print line, | |
26 | |
27 p.close() |