Summary Table

This module contains the abstract definition of SummaryTable that allows to create summary or report tables .

Example

Creating a summary table:

class ReportTable(SummaryTable):
    _table: PrettyTable

    def __init__(self):
        self._table = PrettyTable()

    def build(self) -> str:
        return str(self._table)

    def add_row(self, row: List[Any]) -> Table:
        self._table.add_row(row)
        return self

    def set_title(self, title: str) -> Table:
        self._table.title = title
        return self

    def set_labels(self, labels: List[str]) -> Table:
        self._table.field_names = labels
        return self

    def set_alignment(self, align: List[str]) -> SummaryTable:
        for field, alignment in zip(self._table.field_names, align):
            self._table.align[field] = alignment
        return self
class gsf.core.debug.domain.summary_table.SummaryTable

Bases: object

Summary Table

Abstract definition of tables that will be used by the framework.

abstract add_row(row: List[Any])gsf.core.debug.domain.summary_table.SummaryTable

Adds a row to the table

Parameters

row – Row to be added.

abstract build()str

Returns the table in string format

abstract set_alignment(align: List[str])gsf.core.debug.domain.summary_table.SummaryTable

Sets the alignment of the columns

Parameters

align – Alignment of each column.

abstract set_labels(labels: List[str])gsf.core.debug.domain.summary_table.SummaryTable

Sets the labels of the table

Parameters

labels – Fields of the table.

abstract set_title(title: str)gsf.core.debug.domain.summary_table.SummaryTable

Sets the title of the table

Parameters

title (str) – Title of the table.