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
diff --git a/color.py b/color.py
index 9b3365b..9200a29 100644
--- a/color.py
+++ b/color.py
@@ -38,8 +38,11 @@
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 @@
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 @@
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 @@
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