Fix --compat-options list-formats

Closes #2481
This commit is contained in:
pukkandan 2022-02-02 06:08:40 +05:30
parent 63c3ee4f63
commit d16df59db5
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698

View file

@ -3430,10 +3430,9 @@ def get_max_lens(table):
return [max(width(str(v)) for v in col) for col in zip(*table)] return [max(width(str(v)) for v in col) for col in zip(*table)]
def filter_using_list(row, filterArray): def filter_using_list(row, filterArray):
return [col for (take, col) in zip(filterArray, row) if take] return [col for take, col in itertools.zip_longest(filterArray, row, fillvalue=True) if take]
if hide_empty: max_lens = get_max_lens(data) if hide_empty else []
max_lens = get_max_lens(data)
header_row = filter_using_list(header_row, max_lens) header_row = filter_using_list(header_row, max_lens)
data = [filter_using_list(row, max_lens) for row in data] data = [filter_using_list(row, max_lens) for row in data]