From 8a68ff96057ec58e524a3e41a2d8dca7b5d016bc Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 24 Sep 2012 12:15:13 +0900 Subject: Coding style cleanup Fix the following issues reported by pylint: C0321: More than one statement on a single line W0622: Redefining built-in 'name' W0612: Unused variable 'name' W0613: Unused argument 'name' W0102: Dangerous default value 'value' as argument W0105: String statement has no effect Also fixed a few cases of inconsistent indentation. Change-Id: Ie0db839e7c57d576cff12d8c055fe87030d00744 --- color.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'color.py') diff --git a/color.py b/color.py index 9b3365be..9200a298 100644 --- a/color.py +++ b/color.py @@ -38,8 +38,11 @@ ATTRS = {None :-1, RESET = "\033[m" -def is_color(s): return s in COLORS -def is_attr(s): return s in ATTRS +def is_color(s): + return s in COLORS + +def is_attr(s): + return s in ATTRS def _Color(fg = None, bg = None, attr = None): fg = COLORS[fg] @@ -80,8 +83,8 @@ def _Color(fg = None, bg = None, attr = None): class Coloring(object): - def __init__(self, config, type): - self._section = 'color.%s' % type + def __init__(self, config, section_type): + self._section = 'color.%s' % section_type self._config = config self._out = sys.stdout @@ -126,8 +129,8 @@ class Coloring(object): if self._on: c = self._parse(opt, fg, bg, attr) def f(fmt, *args): - str = fmt % args - return ''.join([c, str, RESET]) + output = fmt % args + return ''.join([c, output, RESET]) return f else: def f(fmt, *args): @@ -151,8 +154,10 @@ class Coloring(object): have_fg = False for a in v.split(' '): if is_color(a): - if have_fg: bg = a - else: fg = a + if have_fg: + bg = a + else: + fg = a elif is_attr(a): attr = a -- cgit v1.2.3-54-g00ecf