Function
_to_markdown
(rows: List[Dict[str, Any]])
Source from the content-addressed store, hash-verified
| 391 | |
| 392 | |
| 393 | def _to_markdown(rows: List[Dict[str, Any]]) -> str: |
| 394 | if not rows: |
| 395 | return "(empty)\n" |
| 396 | headers = list(rows[0].keys()) |
| 397 | lines = ["| " + " | ".join(headers) + " |", "| " + " | ".join(["---"] * len(headers)) + " |"] |
| 398 | for row in rows: |
| 399 | lines.append("| " + " | ".join(str(row.get(h, "")) for h in headers) + " |") |
| 400 | return "\n".join(lines) + "\n" |
| 401 | |
| 402 | |
| 403 | def main() -> None: |
Tested by
no test coverage detected