pycodestyle: fix issues
When calling pycodestyle directly on a file (vs the project as a
whole) it seems to be a bit more opinionated. Fix up these issues
so we can change how we call pycodestyle organization-wide.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: If561fb1ec3036b5fd5a600969fb5d81274464db2
diff --git a/bin/plug_ins/Auto_reboot/cp_master b/bin/plug_ins/Auto_reboot/cp_master
index 843d73e..7e1b274 100755
--- a/bin/plug_ins/Auto_reboot/cp_master
+++ b/bin/plug_ins/Auto_reboot/cp_master
@@ -22,8 +22,7 @@
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
- description="%(prog)s will set the auto_boot policy according to the"
- + " user's wishes.",
+ description="%(prog)s will set the auto_boot policy according to the user's wishes.",
formatter_class=argparse.RawTextHelpFormatter,
prefix_chars='-+')
@@ -35,6 +34,7 @@
AUTO_REBOOT_DISABLE = "1"
+
def validate_parms():
r"""
diff --git a/bin/plug_ins/Soft_errors/cp_post_boot b/bin/plug_ins/Soft_errors/cp_post_boot
index 8a562da..9f9d515 100755
--- a/bin/plug_ins/Soft_errors/cp_post_boot
+++ b/bin/plug_ins/Soft_errors/cp_post_boot
@@ -17,9 +17,9 @@
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
description="%(prog)s will calculate the value of num_err_logs and"
- + " save it as a plug-in value for the benefit of the FFDC plug-in."
- + " The FFDC plug-in can use that data to decide whether to collect"
- + " FFDC data.",
+ + " save it as a plug-in value for the benefit of the FFDC plug-in."
+ + " The FFDC plug-in can use that data to decide whether to collect"
+ + " FFDC data.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')
@@ -75,8 +75,9 @@
if not REDFISH_SUPPORT_TRANS_STATE:
try:
from robot.libraries.BuiltIn import BuiltIn
- REDFISH_SUPPORT_TRANS_STATE = int(BuiltIn().get_variable_value("${REDFISH_SUPPORT_TRANS_STATE}", default=0))
- except:
+ REDFISH_SUPPORT_TRANS_STATE = \
+ int(BuiltIn().get_variable_value("${REDFISH_SUPPORT_TRANS_STATE}", default=0))
+ except Exception:
pass
keyword_redfish_strings = \
@@ -96,7 +97,7 @@
"${json_string}= Evaluate json.dumps($error_logs, indent=4) modules=json",
"Append To File " + high_sev_elogs_file_path + " ${json_string}"
]
-
+
if REDFISH_SUPPORT_TRANS_STATE:
keyword_string = ' ; '.join(keyword_redfish_strings)
else:
@@ -116,7 +117,8 @@
num_error_logs = int(result['num_error_logs'])
save_plug_in_value(num_error_logs)
if num_error_logs > 0:
- qprint_timen("Adding the name of our high severity error logs FFDC file to the appropriate file list.")
+ qprint_timen("Adding the name of our high severity error logs FFDC file "
+ + "to the appropriate file list.")
shell_cmd("echo " + high_sev_elogs_file_path + " > " + AUTOBOOT_FFDC_LIST_FILE_PATH)
else:
os.remove(high_sev_elogs_file_path)
diff --git a/bin/plug_ins/Stop/cp_stop_check b/bin/plug_ins/Stop/cp_stop_check
index ba46eb7..8eb8e05 100755
--- a/bin/plug_ins/Stop/cp_stop_check
+++ b/bin/plug_ins/Stop/cp_stop_check
@@ -4,6 +4,7 @@
Check for stop conditions. Return code of 2 if stop conditions are found.
"""
+import argparse
import sys
import subprocess
import os
@@ -30,18 +31,18 @@
# Create parser object to process command line parameters and args.
parser = argparse.ArgumentParser(
usage='%(prog)s [OPTIONS]',
- description="If the \"Stop\" plug-in is selected by the user, %(prog)s" +
- " is called by OBMC Boot Test after each boot test. If %(prog)s returns" +
- " " + str(stop_test_rc) + ", then OBMC Boot Test will stop. The user" +
- " may set environment variable STOP_COMMAND to contain any valid bash" +
- " command or program. %(prog)s will run this stop command. If the stop" +
- " command returns non-zero, then %(prog)s will return " +
- str(stop_test_rc) + ". %(prog)s recognizes some special values for" +
- " STOP_COMMAND: 1) \"FAIL\" means that OBMC Boot Test should stop" +
- " whenever a boot test fails. 2) \"ALL\" means that OBMC Boot Test" +
- " should stop after any boot test. If environment variable" +
- " STOP_REST_FAIL is set, OBMC Boot Test will stop if REST commands are" +
- " no longer working.",
+ description="If the \"Stop\" plug-in is selected by the user, %(prog)s"
+ + " is called by OBMC Boot Test after each boot test. If %(prog)s returns"
+ + " " + str(stop_test_rc) + ", then OBMC Boot Test will stop. The user"
+ + " may set environment variable STOP_COMMAND to contain any valid bash"
+ + " command or program. %(prog)s will run this stop command. If the stop"
+ + " command returns non-zero, then %(prog)s will return "
+ + str(stop_test_rc) + ". %(prog)s recognizes some special values for"
+ + " STOP_COMMAND: 1) \"FAIL\" means that OBMC Boot Test should stop"
+ + " whenever a boot test fails. 2) \"ALL\" means that OBMC Boot Test"
+ + " should stop after any boot test. If environment variable"
+ + " STOP_REST_FAIL is set, OBMC Boot Test will stop if REST commands are"
+ + " no longer working.",
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
prefix_chars='-+')
@@ -147,11 +148,11 @@
return
pel_txt_file_path = os.environ.get("AUTOBOOT_FFDC_DIR_PATH", "") + \
- os.environ.get("AUTOBOOT_FFDC_PREFIX", "") + "PEL_logs_list.json"
+ os.environ.get("AUTOBOOT_FFDC_PREFIX", "") + "PEL_logs_list.json"
if not os.path.isfile(pel_txt_file_path):
- qprint_timen("The following file was not present so no further" +
- " action will be taken.")
+ qprint_timen("The following file was not present so no further"
+ + " action will be taken.")
qprint_var(pel_txt_file_path)
return
@@ -170,22 +171,23 @@
pel_stop_list = file_to_list(pel_stop_file_path, newlines=0, comments=0)
if len(pel_stop_list) == 0:
- print_timen("There are no records to process in " +
- pel_stop_file_path + ".")
+ print_timen("There are no records to process in "
+ + pel_stop_file_path + ".")
return
pel_all_list = file_to_list(pel_txt_file_path, newlines=0, comments=0)
if len(pel_all_list) == 0:
- print_timen("There are no records to process in " +
- pel_txt_file_path + ".")
+ print_timen("There are no records to process in "
+ + pel_txt_file_path + ".")
return
for stop_pel in pel_stop_list:
for pel_all in pel_all_list:
pel_match = re.search(".*SRC.*" + stop_pel + ".*", pel_all)
if pel_match:
- print_timen("The caller wishes to stop test execution based on the presence of certain PEL entries.")
+ print_timen("The caller wishes to stop test execution based on "
+ + "the presence of certain PEL entries.")
stop_check()