table
¶
This module is used to create formatted tables of parameters, errors and warnings.
- turboctl.ui.table.table(database, numbers='all', widths={})¶
Return a table of parameters, errors or warnings.
- Parameters:
database – A
dict
of parameters, errors or warnings. The values should beParameter
orErrorOrWarning
objects, and the keys the numbers (int
) of those objects.numbers –
'all'
, or a sequence of the numbers of the parameters/errors/warnings that should be displayed.widths – A
dict
with keys corresponding to column names and values to the maximum widths of the columns. The column names are the same as the attributes of theParameter
orErrorOrWarning
classes. If the maximum width of a column isn’t specified in widths, it is set to infinite and no text wrapping is used for that column.
- Returns:
The table as a formatted
str
ready for printing.- Raises:
ValueError – If database is empty or if there is no parameter/error/warning corresponding to a number in numbers.