ls012_optable.py: Added a header col replacement func. Not used yet
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Mon, 10 Apr 2023 12:46:07 +0000 (12:46 +0000)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Mon, 10 Apr 2023 12:46:07 +0000 (12:46 +0000)
openpower/sv/rfc/ls012_optable.py

index f7ac4defd990e784e4a895fbf07eff712004efd9..4aeb831e0afed8b7b32200adcfb830b4649f6292 100644 (file)
@@ -77,6 +77,18 @@ def by_cost_then_priority_then_page(areas):
         costs[cost].append(row)
     return costs
 
+# For prettier printing, replace short column heading
+# names with full, consistent names.
+# Expected input is a list of column strings
+def column_header_replacement(header):
+    replacement_col = {'cost': 'XO Cost'}
+    new_header = header
+    for shortname in replacement_col.keys():
+        # check if header contains any shortnames
+        if shortname in header:
+            index = header.index(shortname)
+            new_header[index] = replacement_col[shortname]
+    return new_header
 
 def print_table(title, header, areas, sortby):
     fname = title.lower().replace(" ", "_")