Revert "black: re-format"

This reverts commit 5731818de0ce446ceaafc7e75ae39da1b69942ae.

Signed-off-by: George Keishing <gkeishin@in.ibm.com>
Change-Id: Ie61cdc8c7f2825b0d9d66be87a6a3a058de2b372
diff --git a/tools/ct_metrics/gen_csv_results.py b/tools/ct_metrics/gen_csv_results.py
index 2b4df12..3ad9d67 100755
--- a/tools/ct_metrics/gen_csv_results.py
+++ b/tools/ct_metrics/gen_csv_results.py
@@ -6,21 +6,22 @@
 http://robot-framework.readthedocs.io/en/3.0/autodoc/robot.result.html
 """
 
-import csv
-import datetime
-import getopt
+import sys
 import os
+import getopt
+import csv
+import robot.errors
 import re
 import stat
-import sys
+import datetime
+
+from robot.api import ExecutionResult
+from robot.result.visitor import ResultVisitor
 from xml.etree import ElementTree
 
-import robot.errors
 from gen_arg import *
 from gen_print import *
 from gen_valid import *
-from robot.api import ExecutionResult
-from robot.result.visitor import ResultVisitor
 
 # Remove the python library path to restore with local project path later.
 save_path_0 = sys.path[0]
@@ -32,7 +33,7 @@
 
 
 this_program = sys.argv[0]
-info = " For more information:  " + this_program + "  -h"
+info = " For more information:  " + this_program + '  -h'
 if len(sys.argv) == 1:
     print(info)
     sys.exit(1)
@@ -40,88 +41,64 @@
 
 parser = argparse.ArgumentParser(
     usage=info,
-    description=(
-        "%(prog)s uses a robot framework API to extract test result    data"
-        " from output.xml generated by robot tests. For more information on"
-        " the    Robot Framework API, see   "
-        " http://robot-framework.readthedocs.io/en/3.0/autodoc/robot.result.html"
-    ),
+    description="%(prog)s uses a robot framework API to extract test result\
+    data from output.xml generated by robot tests. For more information on the\
+    Robot Framework API, see\
+    http://robot-framework.readthedocs.io/en/3.0/autodoc/robot.result.html",
     formatter_class=argparse.ArgumentDefaultsHelpFormatter,
-    prefix_chars="-+",
-)
+    prefix_chars='-+')
 
 parser.add_argument(
-    "--source",
-    "-s",
-    help=(
-        "The output.xml robot test result file path.  This parameter is       "
-        "    required."
-    ),
-)
+    '--source',
+    '-s',
+    help='The output.xml robot test result file path.  This parameter is \
+          required.')
 
 parser.add_argument(
-    "--dest",
-    "-d",
-    help=(
-        "The directory path where the generated .csv files will go.  This     "
-        "      parameter is required."
-    ),
-)
+    '--dest',
+    '-d',
+    help='The directory path where the generated .csv files will go.  This \
+          parameter is required.')
 
 parser.add_argument(
-    "--version_id",
-    help=(
-        "Driver version of openbmc firmware which was used during test,       "
-        '   e.g. "v2.1-215-g6e7eacb".  This parameter is required.'
-    ),
-)
+    '--version_id',
+    help='Driver version of openbmc firmware which was used during test,\
+          e.g. "v2.1-215-g6e7eacb".  This parameter is required.')
 
 parser.add_argument(
-    "--platform",
-    help=(
-        "OpenBMC platform which was used during test,          e.g."
-        ' "Witherspoon".  This parameter is required.'
-    ),
-)
+    '--platform',
+    help='OpenBMC platform which was used during test,\
+          e.g. "Witherspoon".  This parameter is required.')
 
 parser.add_argument(
-    "--level",
-    help=(
-        "OpenBMC release level which was used during test,          e.g."
-        ' "Master", "OBMC920".  This parameter is required.'
-    ),
-)
+    '--level',
+    help='OpenBMC release level which was used during test,\
+          e.g. "Master", "OBMC920".  This parameter is required.')
 
 parser.add_argument(
-    "--test_phase",
-    help=(
-        'Name of testing phase, e.g. "DVT", "SVT", etc.          This'
-        " parameter is optional."
-    ),
-    default="FVT",
-)
+    '--test_phase',
+    help='Name of testing phase, e.g. "DVT", "SVT", etc.\
+          This parameter is optional.',
+    default="FVT")
 
 parser.add_argument(
-    "--subsystem",
-    help=(
-        'Name of the subsystem, e.g. "OPENBMC" etc.          This parameter is'
-        " optional."
-    ),
-    default="OPENBMC",
-)
+    '--subsystem',
+    help='Name of the subsystem, e.g. "OPENBMC" etc.\
+          This parameter is optional.',
+    default="OPENBMC")
 
 parser.add_argument(
-    "--processor",
+    '--processor',
     help='Name of processor, e.g. "P9". This parameter is optional.',
-    default="OPENPOWER",
-)
+    default="OPENPOWER")
 
 
 # Populate stock_list with options we want.
 stock_list = [("test_mode", 0), ("quiet", 0), ("debug", 0)]
 
 
-def exit_function(signal_number=0, frame=None):
+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).
@@ -134,7 +111,8 @@
     qprint_pgm_footer()
 
 
-def signal_handler(signal_number, frame):
+def signal_handler(signal_number,
+                   frame):
     r"""
     Handle signals.  Without a function to catch a SIGTERM or SIGINT, the
     program would terminate immediately with return code 143 and without
@@ -168,15 +146,8 @@
     return True
 
 
-def parse_output_xml(
-    xml_file_path,
-    csv_dir_path,
-    version_id,
-    platform,
-    level,
-    test_phase,
-    processor,
-):
+def parse_output_xml(xml_file_path, csv_dir_path, version_id, platform, level,
+                     test_phase, processor):
     r"""
     Parse the robot-generated output.xml file and extract various test
     output data. Put the extracted information into a csv file in the "dest"
@@ -204,19 +175,13 @@
     total_non_critical_failed = 0
 
     result = ExecutionResult(xml_file_path)
-    result.configure(
-        stat_config={
-            "suite_stat_level": 2,
-            "tag_stat_combine": "tagANDanother",
-        }
-    )
+    result.configure(stat_config={'suite_stat_level': 2,
+                                  'tag_stat_combine': 'tagANDanother'})
 
     stats = result.statistics
     print("--------------------------------------")
     try:
-        total_critical_tc = (
-            stats.total.critical.passed + stats.total.critical.failed
-        )
+        total_critical_tc = stats.total.critical.passed + stats.total.critical.failed
         total_critical_passed = stats.total.critical.passed
         total_critical_failed = stats.total.critical.failed
     except AttributeError:
@@ -229,9 +194,7 @@
     except AttributeError:
         pass
 
-    print(
-        "Total Test Count:\t %d" % (total_non_critical_tc + total_critical_tc)
-    )
+    print("Total Test Count:\t %d" % (total_non_critical_tc + total_critical_tc))
 
     print("Total Critical Test Failed:\t %d" % total_critical_failed)
     print("Total Critical Test Passed:\t %d" % total_critical_passed)
@@ -258,11 +221,11 @@
     # Default Test data
     l_test_type = test_phase
 
-    l_pse_rel = "Master"
+    l_pse_rel = 'Master'
     if level:
         l_pse_rel = level
 
-    l_env = "HW"
+    l_env = 'HW'
     l_proc = processor
     l_platform_type = ""
     l_func_area = ""
@@ -289,27 +252,14 @@
     if l_driver and l_platform_type:
         print("Driver and system info set.")
     else:
-        print(
-            "Both driver and system info need to be set.                CSV"
-            " file is not generated."
-        )
+        print("Both driver and system info need to be set.\
+                CSV file is not generated.")
         sys.exit()
 
     # Default header
-    l_header = [
-        "test_start",
-        "test_end",
-        "subsys",
-        "test_type",
-        "test_result",
-        "test_name",
-        "pse_rel",
-        "driver",
-        "env",
-        "proc",
-        "platform_type",
-        "test_func_area",
-    ]
+    l_header = ['test_start', 'test_end', 'subsys', 'test_type',
+                'test_result', 'test_name', 'pse_rel', 'driver',
+                'env', 'proc', 'platform_type', 'test_func_area']
 
     l_csvlist.append(l_header)
 
@@ -324,11 +274,11 @@
     for testcase in collectDataObj.testData:
         # Functional Area: Suite Name
         # Test Name: Test Case Name
-        l_func_area = str(testcase.parent).split(" ", 1)[1]
+        l_func_area = str(testcase.parent).split(' ', 1)[1]
         l_test_name = str(testcase)
 
         # Test Result pass=0 fail=1
-        if testcase.status == "PASS":
+        if testcase.status == 'PASS':
             l_test_result = 0
         else:
             l_test_result = 1
@@ -339,36 +289,18 @@
         # Data Sequence: test_start,test_end,subsys,test_type,
         #                test_result,test_name,pse_rel,driver,
         #                env,proc,platform_type,test_func_area,
-        l_data = [
-            l_stime,
-            l_etime,
-            subsystem,
-            l_test_type,
-            l_test_result,
-            l_test_name,
-            l_pse_rel,
-            l_driver,
-            l_env,
-            l_proc,
-            l_platform_type,
-            l_func_area,
-        ]
+        l_data = [l_stime, l_etime, subsystem, l_test_type, l_test_result,
+                  l_test_name, l_pse_rel, l_driver, l_env, l_proc,
+                  l_platform_type, l_func_area]
         l_csvlist.append(l_data)
 
     # Open the file and write to the CSV file
     l_file = open(l_csvfile, "w")
-    l_writer = csv.writer(l_file, lineterminator="\n")
+    l_writer = csv.writer(l_file, lineterminator='\n')
     l_writer.writerows(l_csvlist)
     l_file.close()
     # Set file permissions 666.
-    perm = (
-        stat.S_IRUSR
-        + stat.S_IWUSR
-        + stat.S_IRGRP
-        + stat.S_IWGRP
-        + stat.S_IROTH
-        + stat.S_IWOTH
-    )
+    perm = stat.S_IRUSR + stat.S_IWUSR + stat.S_IRGRP + stat.S_IWGRP + stat.S_IROTH + stat.S_IWOTH
     os.chmod(l_csvfile, perm)
 
 
@@ -404,19 +336,19 @@
 
     bmc_version_id = ""
     bmc_platform = ""
-    with open(xml_file_path, "rt") as output:
+    with open(xml_file_path, 'rt') as output:
         tree = ElementTree.parse(output)
 
-    for node in tree.iter("msg"):
+    for node in tree.iter('msg'):
         # /etc/os-release output is logged in the XML as msg
         # Example: ${output} = VERSION_ID="v1.99.2-71-gbc49f79"
-        if "${output} = VERSION_ID=" in node.text:
+        if '${output} = VERSION_ID=' in node.text:
             # Get BMC version (e.g. v1.99.1-96-g2a46570)
             bmc_version_id = str(node.text.split("VERSION_ID=")[1])[1:-1]
 
         # Platform is logged in the XML as msg.
         # Example: ${bmc_model} = Witherspoon BMC
-        if "${bmc_model} = " in node.text:
+        if '${bmc_model} = ' in node.text:
             bmc_platform = node.text.split(" = ")[1]
 
     print_vars(bmc_version_id, bmc_platform)
@@ -424,6 +356,7 @@
 
 
 def main():
+
     if not gen_get_options(parser, stock_list):
         return False
 
@@ -432,9 +365,8 @@
 
     qprint_pgm_header()
 
-    parse_output_xml(
-        source, dest, version_id, platform, level, test_phase, processor
-    )
+    parse_output_xml(source, dest, version_id, platform, level,
+                     test_phase, processor)
 
     return True