From 284e77bfe5d4a68f021a311041cc4576b7be912a Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 28 Jun 2018 19:05:27 +0200 Subject: Make Flake (somewhat) happy --- reaktor/translate_colors.py | 53 ++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 25 deletions(-) (limited to 'reaktor/translate_colors.py') diff --git a/reaktor/translate_colors.py b/reaktor/translate_colors.py index bd71661..d49483f 100644 --- a/reaktor/translate_colors.py +++ b/reaktor/translate_colors.py @@ -1,31 +1,34 @@ COLOR_MAP = { - "\x1b[0m" : "\x0F", # reset - "\x1b[37m" : "\x0300", - "\x1b[30m" : "\x0301", - "\x1b[34m" : "\x0302", - "\x1b[32m" : "\x0303", - "\x1b[31m" : "\x0304", - "\x1b[33m" : "\x0305", - "\x1b[35m" : "\x0306", - "\x1b[33m" : "\x0307", - "\x1b[33m" : "\x0308", - "\x1b[32m" : "\x0309", - "\x1b[36m" : "\x0310", - "\x1b[36m" : "\x0311", - "\x1b[34m" : "\x0312", - "\x1b[31m" : "\x0313", - "\x1b[30m" : "\x0314", - "\x1b[37m" : "\x0315", - "\x1b[1m" : "\x02", # bold on - "\x1b[22m" : "\x02" # bold off + "\x1b[0m": "\x0F", # reset + "\x1b[37m": "\x0300", + "\x1b[30m": "\x0301", + "\x1b[34m": "\x0302", + "\x1b[32m": "\x0303", + "\x1b[31m": "\x0304", + "\x1b[33m": "\x0305", + "\x1b[35m": "\x0306", + "\x1b[33m": "\x0307", + "\x1b[33m": "\x0308", + "\x1b[32m": "\x0309", + "\x1b[36m": "\x0310", + "\x1b[36m": "\x0311", + "\x1b[34m": "\x0312", + "\x1b[31m": "\x0313", + "\x1b[30m": "\x0314", + "\x1b[37m": "\x0315", + "\x1b[1m": "\x02", # bold on + "\x1b[22m": "\x02" # bold off } -def translate_colors (line): - for color,replace in COLOR_MAP.items(): - line = line.replace(color,replace) - return line + + +def translate_colors(line): + for color, replace in COLOR_MAP.items(): + line = line.replace(color, replace) + return line + if __name__ == "__main__": - import sys - print (translate_colors(sys.stdin.read())) + import sys + print(translate_colors(sys.stdin.read())) -- cgit v1.2.3