diff options
| author | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-14 11:36:51 +0900 |
|---|---|---|
| committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-14 11:38:57 +0900 |
| commit | c1b86a232383748811c6faf17f364e63e10f7dd4 (patch) | |
| tree | 8f28c8e8a922ffd4165f48a1988500070936bd39 /color.py | |
| parent | 98ffba1401056e2d88d3f3898b6fbf5d7d3931a4 (diff) | |
| download | git-repo-c1b86a232383748811c6faf17f364e63e10f7dd4.tar.gz | |
Fix inconsistent indentation
The repo coding style is to indent at 2 characters, but there are
many places where this is not followed.
Enable pylint warning "W0311: Bad indentation" and make sure all
indentation is at multiples of 2 characters.
Change-Id: I68f0f64470789ce2429ab11104d15d380a63e6a8
Diffstat (limited to 'color.py')
| -rw-r--r-- | color.py | 62 |
1 files changed, 31 insertions, 31 deletions
| @@ -40,47 +40,47 @@ RESET = "\033[m" # pylint: disable=W1401 | |||
| 40 | # backslash is not anomalous | 40 | # backslash is not anomalous |
| 41 | 41 | ||
| 42 | def is_color(s): | 42 | def is_color(s): |
| 43 | return s in COLORS | 43 | return s in COLORS |
| 44 | 44 | ||
| 45 | def is_attr(s): | 45 | def is_attr(s): |
| 46 | return s in ATTRS | 46 | return s in ATTRS |
| 47 | 47 | ||
| 48 | def _Color(fg = None, bg = None, attr = None): | 48 | def _Color(fg = None, bg = None, attr = None): |
| 49 | fg = COLORS[fg] | 49 | fg = COLORS[fg] |
| 50 | bg = COLORS[bg] | 50 | bg = COLORS[bg] |
| 51 | attr = ATTRS[attr] | 51 | attr = ATTRS[attr] |
| 52 | 52 | ||
| 53 | if attr >= 0 or fg >= 0 or bg >= 0: | 53 | if attr >= 0 or fg >= 0 or bg >= 0: |
| 54 | need_sep = False | 54 | need_sep = False |
| 55 | code = "\033[" #pylint: disable=W1401 | 55 | code = "\033[" #pylint: disable=W1401 |
| 56 | 56 | ||
| 57 | if attr >= 0: | 57 | if attr >= 0: |
| 58 | code += chr(ord('0') + attr) | 58 | code += chr(ord('0') + attr) |
| 59 | need_sep = True | 59 | need_sep = True |
| 60 | 60 | ||
| 61 | if fg >= 0: | 61 | if fg >= 0: |
| 62 | if need_sep: | 62 | if need_sep: |
| 63 | code += ';' | 63 | code += ';' |
| 64 | need_sep = True | 64 | need_sep = True |
| 65 | 65 | ||
| 66 | if fg < 8: | 66 | if fg < 8: |
| 67 | code += '3%c' % (ord('0') + fg) | 67 | code += '3%c' % (ord('0') + fg) |
| 68 | else: | 68 | else: |
| 69 | code += '38;5;%d' % fg | 69 | code += '38;5;%d' % fg |
| 70 | 70 | ||
| 71 | if bg >= 0: | 71 | if bg >= 0: |
| 72 | if need_sep: | 72 | if need_sep: |
| 73 | code += ';' | 73 | code += ';' |
| 74 | need_sep = True | 74 | need_sep = True |
| 75 | 75 | ||
| 76 | if bg < 8: | 76 | if bg < 8: |
| 77 | code += '4%c' % (ord('0') + bg) | 77 | code += '4%c' % (ord('0') + bg) |
| 78 | else: | 78 | else: |
| 79 | code += '48;5;%d' % bg | 79 | code += '48;5;%d' % bg |
| 80 | code += 'm' | 80 | code += 'm' |
| 81 | else: | 81 | else: |
| 82 | code = '' | 82 | code = '' |
| 83 | return code | 83 | return code |
| 84 | 84 | ||
| 85 | 85 | ||
| 86 | class Coloring(object): | 86 | class Coloring(object): |
