Simplify a bit.

main
Vincent Driessen 13 years ago
parent 59a01b49f4
commit 435cbc0f53

@ -5,6 +5,7 @@ Miscellaneous helper functions.
The formatter for ANSI colored console output is heavily based on Pygments The formatter for ANSI colored console output is heavily based on Pygments
terminal colorizing code, originally by Georg Brandl. terminal colorizing code, originally by Georg Brandl.
""" """
import sys
import os import os
@ -35,7 +36,6 @@ def gettermsize():
class _Colorizer(object): class _Colorizer(object):
def __init__(self): def __init__(self):
import sys
esc = "\x1b[" esc = "\x1b["
self.codes = {} self.codes = {}
@ -73,7 +73,7 @@ class _Colorizer(object):
return self.codes["reset"] return self.codes["reset"]
def colorize(self, color_key, text): def colorize(self, color_key, text):
if self.notty: if not sys.stdout.isatty()
return text return text
else: else:
return self.codes[color_key] + text + self.codes["reset"] return self.codes[color_key] + text + self.codes["reset"]

Loading…
Cancel
Save