Created
December 20, 2013 21:07
-
-
Save fishy/8061555 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
last_line = '' | |
for line in sys.stdin.xreadlines(): | |
length = len(last_line.rstrip()) | |
if length != len(line.rstrip()) or length == 0: | |
sys.stdout.write(last_line) | |
last_line = line | |
continue | |
if line.count("=") == length: | |
last_line = "= " + last_line | |
elif line.count("-") == length: | |
if last_line.startswith("GERRIT") or last_line.startswith("SEARCHBOX"): | |
sys.stdout.write(last_line) | |
last_line = line | |
else: | |
last_line = "== " + last_line | |
elif line.count("~") == length: | |
last_line = "=== " + last_line | |
elif line.count("^") == length: | |
last_line = "==== " + last_line | |
elif line.count("+") == length: | |
last_line = "===== " + last_line | |
else: | |
sys.stdout.write(last_line) | |
last_line = line | |
sys.stdout.write(last_line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment