MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / render_table

Function render_table

misc/python/materialize/scratch.py:133–138  ·  view source on GitHub ↗

Print a borderless, left-aligned table, like `docker ps` / `kubectl get`: columns separated by two spaces, an uppercase header, no rules.

(headers: list[str], rows: list[list[str]])

Source from the content-addressed store, hash-verified

131
132
133def render_table(headers: list[str], rows: list[list[str]]) -> None:
134 """Print a borderless, left-aligned table, like `docker ps` / `kubectl get`:
135 columns separated by two spaces, an uppercase header, no rules."""
136 widths = [max(len(r[c]) for r in [headers, *rows]) for c in range(len(headers))]
137 for r in [headers, *rows]:
138 print(" ".join(cell.ljust(w) for cell, w in zip(r, widths)).rstrip())
139
140
141def _format_expires(dt: datetime.datetime | None) -> str:

Callers 2

pick_machineFunction · 0.90
print_instancesFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected