(path: Path, rows: List[Dict[str, Any]])
| 380 | |
| 381 | |
| 382 | def _write_csv(path: Path, rows: List[Dict[str, Any]]) -> None: |
| 383 | if not rows: |
| 384 | path.write_text("", encoding="utf-8") |
| 385 | return |
| 386 | fieldnames = list(rows[0].keys()) |
| 387 | with path.open("w", encoding="utf-8-sig", newline="") as handle: |
| 388 | writer = csv.DictWriter(handle, fieldnames=fieldnames) |
| 389 | writer.writeheader() |
| 390 | writer.writerows(rows) |
| 391 | |
| 392 | |
| 393 | def _to_markdown(rows: List[Dict[str, Any]]) -> str: |