patman: Convert camel case in tout.py
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -30,10 +30,10 @@ def __enter__():
|
||||
|
||||
def __exit__(unused1, unused2, unused3):
|
||||
"""Clean up and remove any progress message."""
|
||||
ClearProgress()
|
||||
clear_progress()
|
||||
return False
|
||||
|
||||
def UserIsPresent():
|
||||
def user_is_present():
|
||||
"""This returns True if it is likely that a user is present.
|
||||
|
||||
Sometimes we want to prompt the user, but if no one is there then this
|
||||
@@ -44,7 +44,7 @@ def UserIsPresent():
|
||||
"""
|
||||
return stdout_is_tty and verbose > 0
|
||||
|
||||
def ClearProgress():
|
||||
def clear_progress():
|
||||
"""Clear any active progress message on the terminal."""
|
||||
global in_progress
|
||||
if verbose > 0 and stdout_is_tty and in_progress:
|
||||
@@ -52,14 +52,14 @@ def ClearProgress():
|
||||
_stdout.flush()
|
||||
in_progress = False
|
||||
|
||||
def Progress(msg, warning=False, trailer='...'):
|
||||
def progress(msg, warning=False, trailer='...'):
|
||||
"""Display progress information.
|
||||
|
||||
Args:
|
||||
msg: Message to display.
|
||||
warning: True if this is a warning."""
|
||||
global in_progress
|
||||
ClearProgress()
|
||||
clear_progress()
|
||||
if verbose > 0:
|
||||
_progress = msg + trailer
|
||||
if stdout_is_tty:
|
||||
@@ -70,7 +70,7 @@ def Progress(msg, warning=False, trailer='...'):
|
||||
else:
|
||||
_stdout.write(_progress + '\n')
|
||||
|
||||
def _Output(level, msg, color=None):
|
||||
def _output(level, msg, color=None):
|
||||
"""Output a message to the terminal.
|
||||
|
||||
Args:
|
||||
@@ -80,7 +80,7 @@ def _Output(level, msg, color=None):
|
||||
error: True if this is an error message, else False.
|
||||
"""
|
||||
if verbose >= level:
|
||||
ClearProgress()
|
||||
clear_progress()
|
||||
if color:
|
||||
msg = _color.Color(color, msg)
|
||||
if level < NOTICE:
|
||||
@@ -88,7 +88,7 @@ def _Output(level, msg, color=None):
|
||||
else:
|
||||
print(msg)
|
||||
|
||||
def DoOutput(level, msg):
|
||||
def do_output(level, msg):
|
||||
"""Output a message to the terminal.
|
||||
|
||||
Args:
|
||||
@@ -96,66 +96,66 @@ def DoOutput(level, msg):
|
||||
this as high as the currently selected level.
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(level, msg)
|
||||
_output(level, msg)
|
||||
|
||||
def Error(msg):
|
||||
def error(msg):
|
||||
"""Display an error message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(ERROR, msg, _color.RED)
|
||||
_output(ERROR, msg, _color.RED)
|
||||
|
||||
def Warning(msg):
|
||||
def warning(msg):
|
||||
"""Display a warning message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(WARNING, msg, _color.YELLOW)
|
||||
_output(WARNING, msg, _color.YELLOW)
|
||||
|
||||
def Notice(msg):
|
||||
def notice(msg):
|
||||
"""Display an important infomation message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(NOTICE, msg)
|
||||
_output(NOTICE, msg)
|
||||
|
||||
def Info(msg):
|
||||
def info(msg):
|
||||
"""Display an infomation message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(INFO, msg)
|
||||
_output(INFO, msg)
|
||||
|
||||
def Detail(msg):
|
||||
def detail(msg):
|
||||
"""Display a detailed message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(DETAIL, msg)
|
||||
_output(DETAIL, msg)
|
||||
|
||||
def Debug(msg):
|
||||
def debug(msg):
|
||||
"""Display a debug message
|
||||
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(DEBUG, msg)
|
||||
_output(DEBUG, msg)
|
||||
|
||||
def UserOutput(msg):
|
||||
def user_output(msg):
|
||||
"""Display a message regardless of the current output level.
|
||||
|
||||
This is used when the output was specifically requested by the user.
|
||||
Args:
|
||||
msg; Message to display.
|
||||
"""
|
||||
_Output(0, msg)
|
||||
_output(0, msg)
|
||||
|
||||
def Init(_verbose=WARNING, stdout=sys.stdout):
|
||||
def init(_verbose=WARNING, stdout=sys.stdout):
|
||||
"""Initialize a new output object.
|
||||
|
||||
Args:
|
||||
@@ -173,7 +173,7 @@ def Init(_verbose=WARNING, stdout=sys.stdout):
|
||||
stdout_is_tty = hasattr(sys.stdout, 'isatty') and sys.stdout.isatty()
|
||||
stderr_is_tty = hasattr(sys.stderr, 'isatty') and sys.stderr.isatty()
|
||||
|
||||
def Uninit():
|
||||
ClearProgress()
|
||||
def uninit():
|
||||
clear_progress()
|
||||
|
||||
Init()
|
||||
init()
|
||||
|
Reference in New Issue
Block a user