From 8b670c6696e9eb0b2fae2a2e3ae643d6dda48956 Mon Sep 17 00:00:00 2001 From: Andrey Miroshnikov Date: Mon, 10 Apr 2023 12:46:07 +0000 Subject: [PATCH] ls012_optable.py: Added a header col replacement func. Not used yet --- openpower/sv/rfc/ls012_optable.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openpower/sv/rfc/ls012_optable.py b/openpower/sv/rfc/ls012_optable.py index f7ac4defd..4aeb831e0 100644 --- a/openpower/sv/rfc/ls012_optable.py +++ b/openpower/sv/rfc/ls012_optable.py @@ -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(" ", "_") -- 2.30.2