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 be Parameter or ErrorOrWarning 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 the Parameter or ErrorOrWarning 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.

turboctl.ui.table.array(database, numbers='all', widths={})

The same as table(), but instead of a str the table is returned as a list of rows, each of which is a list of fields (str).

This function can be used to test this module.