(path: Path, rows: Iterable[Dict[str, Any]])
| 102 | |
| 103 | |
| 104 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
| 105 | path.parent.mkdir(parents=True, exist_ok=True) |
| 106 | with path.open("w", encoding="utf-8") as handle: |
| 107 | for row in rows: |
| 108 | handle.write(json.dumps(row, ensure_ascii=False) + "\n") |
| 109 | |
| 110 | |
| 111 | def load_json(path: Path) -> Dict[str, Any]: |