diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-10-01 21:58:35 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-10-01 21:58:35 -0700 |
commit | c246c6db51b97f1c556c8bddfb955e7f55db700f (patch) | |
tree | b24f44cab9657a4b5471fb079da2ceee8dc709f2 | |
parent | a2ffa0af21d114935ea5acc9ad7253b74d7966ec (diff) | |
download | portage-c246c6db51b97f1c556c8bddfb955e7f55db700f.tar.gz portage-c246c6db51b97f1c556c8bddfb955e7f55db700f.tar.bz2 portage-c246c6db51b97f1c556c8bddfb955e7f55db700f.zip |
Convert create_color_func into a class.
-rw-r--r-- | pym/portage/output.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/pym/portage/output.py b/pym/portage/output.py index 763d74a7a..6b10f7b6c 100644 --- a/pym/portage/output.py +++ b/pym/portage/output.py @@ -341,12 +341,12 @@ compat_functions_colors = ["bold","white","teal","turquoise","darkteal", "fuchsia","purple","blue","darkblue","green","darkgreen","yellow", "brown","darkyellow","red","darkred"] -def create_color_func(color_key): - def derived_func(*args): - newargs = list(args) - newargs.insert(0, color_key) - return colorize(*newargs) - return derived_func +class create_color_func(object): + __slots__ = ("_color_key",) + def __init__(self, color_key): + self._color_key = color_key + def __call__(self, text): + return colorize(self._color_key, text) for c in compat_functions_colors: globals()[c] = create_color_func(c) |