(path: Path, rows: Iterable[Dict[str, Any]])
| 86 | |
| 87 | |
| 88 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
| 89 | path.parent.mkdir(parents=True, exist_ok=True) |
| 90 | with path.open("w", encoding="utf-8") as handle: |
| 91 | for row in rows: |
| 92 | handle.write(json.dumps(row, ensure_ascii=False) + "\n") |
| 93 | |
| 94 | |
| 95 | def load_json(path: Path) -> Dict[str, Any]: |