materials_commons.cli.print_formatter module

class materials_commons.cli.print_formatter.PrintFormatter(fmt, sep=' ', end='\n', truncate=True)[source]

Bases: object

Print dict-like records, nicely

tabulate works nicely when you have all the records ahead of time, PrintFormatter lets you print without having all the records ahead of time.



List of tuples Specify how to format records via: (key, header, alignment, size, function)

key: str, key being described header: str, header string alignment: str, string.format alignment option size: int, column size function: function, function that acts on record[key], or None if key is not in record, to determine what is printed.

print_detail(title_key, record)[source]
materials_commons.cli.print_formatter.trunc(s, size=40)[source]