[U-Boot] [PATCH v6 17/20] patman: Fix indentation in terminal.py
Simon Glass
sjg at chromium.org
Sat Aug 9 23:33:13 CEST 2014
This code came from a different project with 2-character indentation. Fix
it for U-Boot.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v6: None
Changes in v5: None
Changes in v4:
- Fix missing import in builder.py
Changes in v3:
- Add new patch to move BuilderThread code to its own file
Changes in v2: None
tools/patman/terminal.py | 108 ++++++++++++++++++++++++-----------------------
1 file changed, 55 insertions(+), 53 deletions(-)
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index 5862aa1..be216d3 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -15,66 +15,68 @@ import sys
COLOUR_IF_TERMINAL, COLOUR_ALWAYS, COLOUR_NEVER = range(3)
class Colour(object):
- """Conditionally wraps text in ANSI colour escape sequences."""
- BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
- BOLD = -1
- BRIGHT_START = '\033[1;%dm'
- NORMAL_START = '\033[22;%dm'
- BOLD_START = '\033[1m'
- RESET = '\033[0m'
+ """Conditionally wraps text in ANSI colour escape sequences."""
+ BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
+ BOLD = -1
+ BRIGHT_START = '\033[1;%dm'
+ NORMAL_START = '\033[22;%dm'
+ BOLD_START = '\033[1m'
+ RESET = '\033[0m'
- def __init__(self, coloured=COLOUR_IF_TERMINAL):
- """Create a new Colour object, optionally disabling colour output.
+ def __init__(self, coloured=COLOUR_IF_TERMINAL):
+ """Create a new Colour object, optionally disabling colour output.
- Args:
- enabled: True if colour output should be enabled. If False then this
- class will not add colour codes at all.
- """
- self._enabled = (coloured == COLOUR_ALWAYS or
- (coloured == COLOUR_IF_TERMINAL and os.isatty(sys.stdout.fileno())))
+ Args:
+ enabled: True if colour output should be enabled. If False then this
+ class will not add colour codes at all.
+ """
+ self._enabled = (coloured == COLOUR_ALWAYS or
+ (coloured == COLOUR_IF_TERMINAL and os.isatty(sys.stdout.fileno())))
- def Start(self, colour, bright=True):
- """Returns a start colour code.
+ def Start(self, colour, bright=True):
+ """Returns a start colour code.
- Args:
- colour: Colour to use, .e.g BLACK, RED, etc.
+ Args:
+ colour: Colour to use, .e.g BLACK, RED, etc.
- Returns:
- If colour is enabled, returns an ANSI sequence to start the given colour,
- otherwise returns empty string
- """
- if self._enabled:
- base = self.BRIGHT_START if bright else self.NORMAL_START
- return base % (colour + 30)
- return ''
+ Returns:
+ If colour is enabled, returns an ANSI sequence to start the given
+ colour, otherwise returns empty string
+ """
+ if self._enabled:
+ base = self.BRIGHT_START if bright else self.NORMAL_START
+ return base % (colour + 30)
+ return ''
- def Stop(self):
- """Retruns a stop colour code.
+ def Stop(self):
+ """Retruns a stop colour code.
- Returns:
- If colour is enabled, returns an ANSI colour reset sequence, otherwise
- returns empty string
- """
- if self._enabled:
- return self.RESET
- return ''
+ Returns:
+ If colour is enabled, returns an ANSI colour reset sequence,
+ otherwise returns empty string
+ """
+ if self._enabled:
+ return self.RESET
+ return ''
- def Colour(self, colour, text, bright=True):
- """Returns text with conditionally added colour escape sequences.
+ def Colour(self, colour, text, bright=True):
+ """Returns text with conditionally added colour escape sequences.
- Keyword arguments:
- colour: Text colour -- one of the colour constants defined in this class.
- text: The text to colour.
+ Keyword arguments:
+ colour: Text colour -- one of the colour constants defined in this
+ class.
+ text: The text to colour.
- Returns:
- If self._enabled is False, returns the original text. If it's True,
- returns text with colour escape sequences based on the value of colour.
- """
- if not self._enabled:
- return text
- if colour == self.BOLD:
- start = self.BOLD_START
- else:
- base = self.BRIGHT_START if bright else self.NORMAL_START
- start = base % (colour + 30)
- return start + text + self.RESET
+ Returns:
+ If self._enabled is False, returns the original text. If it's True,
+ returns text with colour escape sequences based on the value of
+ colour.
+ """
+ if not self._enabled:
+ return text
+ if colour == self.BOLD:
+ start = self.BOLD_START
+ else:
+ base = self.BRIGHT_START if bright else self.NORMAL_START
+ start = base % (colour + 30)
+ return start + text + self.RESET
--
2.0.0.526.g5318336
More information about the U-Boot
mailing list