From c246c6db51b97f1c556c8bddfb955e7f55db700f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 1 Oct 2011 21:58:35 -0700 Subject: Convert create_color_func into a class. --- pym/portage/output.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'pym/portage/output.py') 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) -- cgit v1.2.3-1-g7c22