buildtest.utils.table

Module Contents

Functions

create_table(columns, data[, title, header_style, ...])

Create a table object with the given columns and data. This function is a wrapper around rich.Table

print_table(table[, row_count, pager])

Print the given table, optionally showing the row count or using a pager.

print_terse_format(tdata, headers[, color, ...])

This method will print the output of buildtest buildspec find in terse format.

buildtest.utils.table.create_table(columns, data, title=None, header_style='blue', column_style=None, show_lines=False)[source]

Create a table object with the given columns and data. This function is a wrapper around rich.Table and it can be used to alter table settings. The return value is a rich.Table object.

Parameters:
  • columns (list) – List of column names

  • data (list) – List of rows, where each row is a list of values

  • title (str) – Title of the table

  • header_style (str) – Style of the header

  • column_style (str) – Style of the columns

  • show_lines (bool) – Whether to show lines in the table

buildtest.utils.table.print_table(table, row_count=None, pager=None)[source]

Print the given table, optionally showing the row count or using a pager.

Parameters:
  • table (Table) – Table to print

  • row_count (bool) – Whether to show the row count

  • pager (bool) – Whether to use a pager

buildtest.utils.table.print_terse_format(tdata, headers, color=None, display_header=False, pager=None)[source]

This method will print the output of buildtest buildspec find in terse format.

Parameters:
  • tdata (list) – Table data to print in terse format

  • headers (list) – List of headers to print in terse format

  • color (str) – Specify color to use when printing output

  • display_header (bool) – Display header when printing output

  • pager (bool) – Use pager when printing output