row.py 478 B

12345678910111213141516171819
  1. from collections.abc import Mapping
  2. def row_str(row: Mapping) -> str:
  3. """Convert a row to string representation."""
  4. return str(row.as_pydict())
  5. def row_repr(row: Mapping) -> str:
  6. """Convert a row to repr representation."""
  7. return str(row)
  8. def row_repr_pretty(row: Mapping, p, cycle):
  9. """Pretty print a row."""
  10. from IPython.lib.pretty import _dict_pprinter_factory
  11. pprinter = _dict_pprinter_factory("{", "}")
  12. return pprinter(row, p, cycle)