bool_str_repr

glotaran.plugin_system.io_plugin_utils.bool_str_repr(value: Any, true_repr: str = '*', false_repr: str = '/') Any[source]

Replace boolean value with string repr.

This function is a helper for table representation (e.g. with tabulate) of boolean values.

Parameters:
  • value (Any) – Arbitrary value

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

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

Returns:

Original value or desired repr for bool

Return type:

Any

Examples

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