TotalDepth.common.data_table (Pretty Printing Tables)

Formats a table as a list of printable strings.

TODO: Support specific styles:

Sphinx style:

+------------------------+------------+----------+----------+
| Header row, column 1   | Header 2   | Header 3 | Header 4 |
| (header rows optional) |            |          |          |
+========================+============+==========+==========+
| body row 1, column 1   | column 2   | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2             | ...        | ...      |          |
+------------------------+------------+----------+----------+

Result:

Header row, column 1 (header rows optional) Header 2 Header 3 Header 4
body row 1, column 1 column 2 column 3 column 4
body row 2  

Markdown style:

| Calculation | Video Time t (s) | Distance from start of Runway (m) | Distance from start of Runway at t=0 (m) |
| --- | --: | --: | --: |
| Mid speed -10 knots | -30.1 | 537 | 1325 |
| Mid speed | -32.8 | 232 | 1182 |
| Mid speed +10 knots | -35.6 | -87 | 1039 |
| **Range and worst error** | **-32.8 ±2.8** | **232 ±319** | **1182 ±143** |
TotalDepth.common.data_table.format_object(o: Any) → str

Format a value as a string.

TotalDepth.common.data_table.format_table(rows: Sequence[Sequence[Any]], pad: str = ' ', heading_underline: str = '', left_flush: bool = False) → List[str]

Given a table of strings this formats them as a list of strings.

TotalDepth.common.data_table.format_table_columns(rows: Sequence[Sequence[Any]], column_formats: List[str], pad: str = ' ', heading_underline: str = '') → List[str]

Given a list of objects this formats them as a list of strings.