in utils/find_corpus.py [0:0]
def print_table(table: list[list[Any]]):
"""
Nicely print a table, the first row is the header
"""
# Compute the column lengths.
transposed_table = list(map(list, zip(*table)))
column_lengths = [max(len(str(x)) for x in column) for column in transposed_table]
print("")
for index, row in enumerate(table):
# Print the row.
for datum, max_len in zip(row, column_lengths):
print(str(datum).ljust(max_len), end=" ")
print("")
# Print a separator between the header and the rest of the table.
if index == 0:
for length in column_lengths:
print("".ljust(length, "─"), end=" ")
print("")
if len(table) == 1:
print("(no datasets)")