From: Zac Medico Date: Sun, 2 Oct 2011 04:58:35 +0000 (-0700) Subject: Convert create_color_func into a class. X-Git-Tag: v2.2.0_alpha61~29 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c246c6db51b97f1c556c8bddfb955e7f55db700f;p=portage.git Convert create_color_func into a class. --- 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)