bool_table_repr

glotaran.plugin_system.io_plugin_utils.bool_table_repr(table_data: Iterable[Iterable[Any]], true_repr: str = '*', false_repr: str = '/') Iterator[Iterator[Any]][source]

Replace boolean value with string repr for all table values.

This function is an implementation of bool_str_repr() for a 2D table, for easy usage with tabulate.

Parameters:
  • table_data (Iterable[Iterable[Any]]) – Data of the table e.g. a list of lists.

  • true_repr (str) – Desired repr for True, by default “*”

  • false_repr (str) – Desired repr for False, by default “/”

Returns:

table_data with original values or desired repr for bool

Return type:

Iterator[Iterator[Any]]

See also

bool_str_repr

Examples

>>> table_data = [["foo", True, False], ["bar", False, True]]
>>> print(tabulate(bool_table_repr(table_data))
---  -  -
foo  *  /
bar  /  *
---  -  -