From 435cbc0f53a58b6afb8c9567b9cbd0f7c331b448 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Wed, 19 Sep 2012 10:19:23 +0200 Subject: [PATCH] Simplify a bit. --- rq/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rq/utils.py b/rq/utils.py index 8e4bb68..940e622 100644 --- a/rq/utils.py +++ b/rq/utils.py @@ -5,6 +5,7 @@ Miscellaneous helper functions. The formatter for ANSI colored console output is heavily based on Pygments terminal colorizing code, originally by Georg Brandl. """ +import sys import os @@ -35,7 +36,6 @@ def gettermsize(): class _Colorizer(object): def __init__(self): - import sys esc = "\x1b[" self.codes = {} @@ -73,7 +73,7 @@ class _Colorizer(object): return self.codes["reset"] def colorize(self, color_key, text): - if self.notty: + if not sys.stdout.isatty() return text else: return self.codes[color_key] + text + self.codes["reset"]