Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
Date: Sun, 02 Oct 2011 04:59:02
Message-Id: c246c6db51b97f1c556c8bddfb955e7f55db700f.zmedico@gentoo
1 commit: c246c6db51b97f1c556c8bddfb955e7f55db700f
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 2 04:58:35 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 2 04:58:35 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=c246c6db
7
8 Convert create_color_func into a class.
9
10 ---
11 pym/portage/output.py | 12 ++++++------
12 1 files changed, 6 insertions(+), 6 deletions(-)
13
14 diff --git a/pym/portage/output.py b/pym/portage/output.py
15 index 763d74a..6b10f7b 100644
16 --- a/pym/portage/output.py
17 +++ b/pym/portage/output.py
18 @@ -341,12 +341,12 @@ compat_functions_colors = ["bold","white","teal","turquoise","darkteal",
19 "fuchsia","purple","blue","darkblue","green","darkgreen","yellow",
20 "brown","darkyellow","red","darkred"]
21
22 -def create_color_func(color_key):
23 - def derived_func(*args):
24 - newargs = list(args)
25 - newargs.insert(0, color_key)
26 - return colorize(*newargs)
27 - return derived_func
28 +class create_color_func(object):
29 + __slots__ = ("_color_key",)
30 + def __init__(self, color_key):
31 + self._color_key = color_key
32 + def __call__(self, text):
33 + return colorize(self._color_key, text)
34
35 for c in compat_functions_colors:
36 globals()[c] = create_color_func(c)