diff options
author | Simon Glass <sjg@chromium.org> | 2022-01-29 14:14:17 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-02-09 12:30:13 -0700 |
commit | 252ac589969acbc4c17379a4e862a18e1518d12d (patch) | |
tree | c17e36e0f9590e6de59f812066e6649c22be0000 /tools/patman/terminal.py | |
parent | 82e0e732ee2cf6d0e125aeb7ed7de69711f35ec8 (diff) |
patman: Rename Color() method to build()
This method has the same name as its class which is confusing. It is also
annoying when searching the code.
It builds a string with a colour, so rename it to build().
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/terminal.py')
-rw-r--r-- | tools/patman/terminal.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py index f76d2b1777..e72c55ba98 100644 --- a/tools/patman/terminal.py +++ b/tools/patman/terminal.py @@ -64,7 +64,7 @@ def CalcAsciiLen(text): Length of text, after skipping ANSI sequences >>> col = Color(COLOR_ALWAYS) - >>> text = col.Color(Color.RED, 'abc') + >>> text = col.build(Color.RED, 'abc') >>> len(text) 14 >>> CalcAsciiLen(text) @@ -73,7 +73,7 @@ def CalcAsciiLen(text): >>> text += 'def' >>> CalcAsciiLen(text) 6 - >>> text += col.Color(Color.RED, 'abc') + >>> text += col.build(Color.RED, 'abc') >>> CalcAsciiLen(text) 9 """ @@ -87,7 +87,7 @@ def TrimAsciiLen(text, size): calculation. >>> col = Color(COLOR_ALWAYS) - >>> text = col.Color(Color.RED, 'abc') + >>> text = col.build(Color.RED, 'abc') >>> len(text) 14 >>> CalcAsciiLen(TrimAsciiLen(text, 4)) @@ -97,7 +97,7 @@ def TrimAsciiLen(text, size): >>> text += 'def' >>> CalcAsciiLen(TrimAsciiLen(text, 4)) 4 - >>> text += col.Color(Color.RED, 'ghi') + >>> text += col.build(Color.RED, 'ghi') >>> CalcAsciiLen(TrimAsciiLen(text, 7)) 7 """ @@ -148,7 +148,7 @@ def Tprint(text='', newline=True, colour=None, limit_to_line=False, bright=True) else: if colour: col = Color() - text = col.Color(colour, text, bright=bright) + text = col.build(colour, text, bright=bright) if newline: print(text) last_print_len = None @@ -191,7 +191,7 @@ def EchoPrintTestLines(): for line in print_test_list: if line.colour: col = Color() - print(col.Color(line.colour, line.text), end='') + print(col.build(line.colour, line.text), end='') else: print(line.text, end='') if line.newline: @@ -247,7 +247,7 @@ class Color(object): return self.RESET return '' - def Color(self, color, text, bright=True): + def build(self, color, text, bright=True): """Returns text with conditionally added color escape sequences. Keyword arguments: |