Formatted python files to follow PEP 8 python code standards.
- Changed the python files in the openbmc-test-automation
directory to conform to python code style standards with
the exception of E402 and E501.
- Resolves openbmc/openbmc-test-automation#1308
Change-Id: I109995c2d248f5a6bb2c0e3c76a6144c8f3aac2e
Signed-off-by: Joy Onyerikwu <onyekachukwu.joy.onyerikwu@ibm.com>
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index 471be4e..3199ec0 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -56,7 +56,6 @@
def exit_function(signal_number=0,
frame=None):
-
r"""
Execute whenever the program ends normally or with the signals that we
catch (i.e. TERM, INT).
@@ -70,7 +69,6 @@
def signal_handler(signal_number,
frame):
-
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, our
program would terminate immediately with return code 143 and without
@@ -88,7 +86,6 @@
def validate_parms():
-
r"""
Validate program parameters, etc. Return True or False (i.e. pass/fail)
accordingly.
@@ -105,7 +102,6 @@
def rest_fail():
-
r"""
If STOP_REST_FAIL, then this function will determine whether REST commands
to the target are working. If not, this function will stop the program by
@@ -139,7 +135,6 @@
def esel_stop_check():
-
r"""
Run the esel_stop_check program to determine whether any eSEL entries
found warrent stopping the test run. See esel_stop_check help text for
@@ -195,5 +190,6 @@
# Main
+
if not main():
exit(1)
diff --git a/bin/process_plug_in_packages.py b/bin/process_plug_in_packages.py
index 49fc21c..797c3c8 100755
--- a/bin/process_plug_in_packages.py
+++ b/bin/process_plug_in_packages.py
@@ -32,28 +32,28 @@
# Create parser object.
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
- description="%(prog)s will process the plug-in packages passed to it." +
- " A plug-in package is essentially a directory containing" +
- " one or more call point programs. Each of these call point" +
- " programs must have a prefix of \"cp_\". When calling" +
- " %(prog)s, a user must provide a call_point parameter" +
- " (described below). For each plug-in package passed," +
- " %(prog)s will check for the presence of the specified call" +
- " point program in the plug-in directory. If it is found," +
- " %(prog)s will run it. It is the responsibility of the" +
- " caller to set any environment variables needed by the call" +
- " point programs.\n\nAfter each call point program" +
- " has been run, %(prog)s will print the following values in" +
- " the following formats for use by the calling program:\n" +
- " failed_plug_in_name: <failed plug-in value," +
- " if any>\n shell_rc: " +
- "<shell return code value of last call point program - this" +
- " will be printed in hexadecimal format. Also, be aware" +
- " that if a call point program returns a value it will be" +
- " shifted left 2 bytes (e.g. rc of 2 will be printed as" +
- " 0x00000200). That is because the rightmost byte is" +
- " reserved for errors in calling the call point program" +
- " rather than errors generated by the call point program.>",
+ description="%(prog)s will process the plug-in packages passed to it."
+ + " A plug-in package is essentially a directory containing"
+ + " one or more call point programs. Each of these call point"
+ + " programs must have a prefix of \"cp_\". When calling"
+ + " %(prog)s, a user must provide a call_point parameter"
+ + " (described below). For each plug-in package passed,"
+ + " %(prog)s will check for the presence of the specified call"
+ + " point program in the plug-in directory. If it is found,"
+ + " %(prog)s will run it. It is the responsibility of the"
+ + " caller to set any environment variables needed by the call"
+ + " point programs.\n\nAfter each call point program"
+ + " has been run, %(prog)s will print the following values in"
+ + " the following formats for use by the calling program:\n"
+ + " failed_plug_in_name: <failed plug-in value,"
+ + " if any>\n shell_rc: "
+ + "<shell return code value of last call point program - this"
+ + " will be printed in hexadecimal format. Also, be aware"
+ + " that if a call point program returns a value it will be"
+ + " shifted left 2 bytes (e.g. rc of 2 will be printed as"
+ + " 0x00000200). That is because the rightmost byte is"
+ + " reserved for errors in calling the call point program"
+ + " rather than errors generated by the call point program.>",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')
@@ -68,51 +68,51 @@
'--call_point',
default="setup",
required=True,
- help='The call point program name. This value must not include the' +
- ' "cp_" prefix. For each plug-in package passed to this program,' +
- ' the specified call_point program will be called if it exists in' +
- ' the plug-in directory.' + default_string)
+ help='The call point program name. This value must not include the'
+ + ' "cp_" prefix. For each plug-in package passed to this program,'
+ + ' the specified call_point program will be called if it exists in'
+ + ' the plug-in directory.' + default_string)
parser.add_argument(
'--allow_shell_rc',
default="0x00000000",
- help='The user may supply a value other than zero to indicate an' +
- ' acceptable non-zero return code. For example, if this value' +
- ' equals 0x00000200, it means that for each plug-in call point that' +
- ' runs, a 0x00000200 will not be counted as a failure. See note' +
- ' above regarding left-shifting of return codes.' + default_string)
+ help='The user may supply a value other than zero to indicate an'
+ + ' acceptable non-zero return code. For example, if this value'
+ + ' equals 0x00000200, it means that for each plug-in call point that'
+ + ' runs, a 0x00000200 will not be counted as a failure. See note'
+ + ' above regarding left-shifting of return codes.' + default_string)
parser.add_argument(
'--stop_on_plug_in_failure',
default=1,
type=int,
choices=[1, 0],
- help='If this parameter is set to 1, this program will stop and return ' +
- 'non-zero if the call point program from any plug-in directory ' +
- 'fails. Conversely, if it is set to false, this program will run ' +
- 'the call point program from each and every plug-in directory ' +
- 'regardless of their return values. Typical example cases where ' +
- 'you\'d want to run all plug-in call points regardless of success ' +
- 'or failure would be "cleanup" or "ffdc" call points.')
+ help='If this parameter is set to 1, this program will stop and return '
+ + 'non-zero if the call point program from any plug-in directory '
+ + 'fails. Conversely, if it is set to false, this program will run '
+ + 'the call point program from each and every plug-in directory '
+ + 'regardless of their return values. Typical example cases where '
+ + 'you\'d want to run all plug-in call points regardless of success '
+ + 'or failure would be "cleanup" or "ffdc" call points.')
parser.add_argument(
'--stop_on_non_zero_rc',
default=0,
type=int,
choices=[1, 0],
- help='If this parm is set to 1 and a plug-in call point program returns ' +
- 'a valid non-zero return code (see "allow_shell_rc" parm above),' +
- ' this program will stop processing and return 0 (success). Since' +
- ' this constitutes a successful exit, this would normally be used' +
- ' where the caller wishes to stop processing if one of the plug-in' +
- ' directory call point programs returns a special value indicating' +
- ' that some special case has been found. An example might be in' +
- ' calling some kind of "check_errl" call point program. Such a' +
- ' call point program might return a 2 (i.e. 0x00000200) to indicate' +
- ' that a given error log entry was found in an "ignore" list and is' +
- ' therefore to be ignored. That being the case, no other' +
- ' "check_errl" call point program would need to be called.' +
- default_string)
+ help='If this parm is set to 1 and a plug-in call point program returns '
+ + 'a valid non-zero return code (see "allow_shell_rc" parm above),'
+ + ' this program will stop processing and return 0 (success). Since'
+ + ' this constitutes a successful exit, this would normally be used'
+ + ' where the caller wishes to stop processing if one of the plug-in'
+ + ' directory call point programs returns a special value indicating'
+ + ' that some special case has been found. An example might be in'
+ + ' calling some kind of "check_errl" call point program. Such a'
+ + ' call point program might return a 2 (i.e. 0x00000200) to indicate'
+ + ' that a given error log entry was found in an "ignore" list and is'
+ + ' therefore to be ignored. That being the case, no other'
+ + ' "check_errl" call point program would need to be called.'
+ + default_string)
parser.add_argument(
'--mch_class',
@@ -236,8 +236,8 @@
print_var(shell_rc, hex)
return rc, shell_rc, failed_plug_in_name
- print("------------------------------------------------- Starting plug-" +
- "in -----------------------------------------------")
+ print("------------------------------------------------- Starting plug-"
+ + "in -----------------------------------------------")
print(out_buf)
if autoscript:
stdout = 1 - quiet
@@ -266,8 +266,8 @@
if shell_rc != 0:
failed_plug_in_name = plug_in_name
- print("------------------------------------------------- Ending plug-in" +
- " -------------------------------------------------")
+ print("------------------------------------------------- Ending plug-in"
+ + " -------------------------------------------------")
if failed_plug_in_name != "":
print_var(failed_plug_in_name)
print_var(shell_rc, hex)
@@ -334,8 +334,8 @@
if stop_on_plug_in_failure:
break
if shell_rc != 0 and stop_on_non_zero_rc:
- qprint_time("Stopping on non-zero shell return code as requested" +
- " by caller.\n")
+ qprint_time("Stopping on non-zero shell return code as requested"
+ + " by caller.\n")
break
if ret_code == 0:
diff --git a/bin/prop_call.py b/bin/prop_call.py
index b616feb..30845ff 100755
--- a/bin/prop_call.py
+++ b/bin/prop_call.py
@@ -34,26 +34,26 @@
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
- description="%(prog)s will call a program using parameters retrieved" +
- " from the given properties file.",
+ description="%(prog)s will call a program using parameters retrieved"
+ + " from the given properties file.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')
parser.add_argument(
'--prop_dir_path',
default=os.environ.get("PROP_DIR_PATH", os.getcwd()),
- help='The path to the directory that contains the properties file.' +
- ' The default value is environment variable "PROP_DIR_PATH", if' +
- ' set. Otherwise, it is the current working directory.')
+ help='The path to the directory that contains the properties file.'
+ + ' The default value is environment variable "PROP_DIR_PATH", if'
+ + ' set. Otherwise, it is the current working directory.')
parser.add_argument(
'--prop_file_name',
- help='The path to a properties file that contains the parameters to' +
- ' pass to the program. If the properties file has a ".properties"' +
- ' extension, the caller need not specify the extension. The format' +
- ' of each line in the properties file should be as follows:' +
- ' <parm_name=parm_value>. Do not quote the parm value. To specify' +
- ' positional parms, use a parm name of "pos". For example: pos=this'
+ help='The path to a properties file that contains the parameters to'
+ + ' pass to the program. If the properties file has a ".properties"'
+ + ' extension, the caller need not specify the extension. The format'
+ + ' of each line in the properties file should be as follows:'
+ + ' <parm_name=parm_value>. Do not quote the parm value. To specify'
+ + ' positional parms, use a parm name of "pos". For example: pos=this'
' value')
parser.add_argument(
@@ -66,7 +66,6 @@
def exit_function(signal_number=0,
frame=None):
-
r"""
Execute whenever the program ends normally or with the signals that we
catch (i.e. TERM, INT).
@@ -80,7 +79,6 @@
def signal_handler(signal_number,
frame):
-
r"""
Handle signals. Without a function to catch a SIGTERM or SIGINT, our
program would terminate immediately with return code 143 and without
@@ -98,7 +96,6 @@
def validate_parms():
-
r"""
Validate program parameters, etc. Return True or False (i.e. pass/fail)
accordingly.
diff --git a/bin/validate_plug_ins.py b/bin/validate_plug_ins.py
index 36b1db9..9c0a1fd 100755
--- a/bin/validate_plug_ins.py
+++ b/bin/validate_plug_ins.py
@@ -27,9 +27,9 @@
# Create parser object.
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS] [PLUG_IN_DIR_PATHS]',
- description="%(prog)s will validate the plug-in packages passed to it." +
- " It will also print a list of the absolute plug-in" +
- " directory paths for use by the calling program.",
+ description="%(prog)s will validate the plug-in packages passed to it."
+ + " It will also print a list of the absolute plug-in"
+ + " directory paths for use by the calling program.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')