From 0032e4b6cf44936f8744fc4612f796ee75872739 Mon Sep 17 00:00:00 2001 From: Ryan Kraus Date: Sat, 18 Apr 2015 00:30:09 -0400 Subject: [PATCH] On second thought, make that script use the specified order, not a sorted order. --- scripts/get_entities.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/get_entities.py b/scripts/get_entities.py index e2a5ff50c1a..f89f83a8562 100755 --- a/scripts/get_entities.py +++ b/scripts/get_entities.py @@ -47,22 +47,16 @@ def main(password, askpass, attrs, address, port): output[attr].append(item['attributes'].get(attr, '')) # output data - print_table(output, 'entity_id') + print_table(output, ['entity_id'] + attrs) -def print_table(data, first_key): +def print_table(data, columns): """ format and print a table of data from a dictionary """ # get column lengths lengths = {} for key, value in data.items(): lengths[key] = max([len(str(val)) for val in value] + [len(key)]) - # construct the column order - columns = sorted(list(data.keys())) - ind = columns.index(first_key) - columns.pop(ind) - columns = [first_key] + columns - # print header for item in columns: itemup = item.upper()