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>
diff --git a/tools/patman/terminal.py b/tools/patman/terminal.py
index f76d2b1..e72c55b 100644
--- a/tools/patman/terminal.py
+++ b/tools/patman/terminal.py
@@ -64,7 +64,7 @@
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 @@
>>> text += 'def'
>>> CalcAsciiLen(text)
6
- >>> text += col.Color(Color.RED, 'abc')
+ >>> text += col.build(Color.RED, 'abc')
>>> CalcAsciiLen(text)
9
"""
@@ -87,7 +87,7 @@
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 @@
>>> 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 @@
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 @@
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 @@
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: