(path: Path)
| 117 | |
| 118 | |
| 119 | def load_jsonl(path: Path) -> List[Dict[str, Any]]: |
| 120 | rows: List[Dict[str, Any]] = [] |
| 121 | with path.open("r", encoding="utf-8") as handle: |
| 122 | for line in handle: |
| 123 | line = line.strip() |
| 124 | if not line: |
| 125 | continue |
| 126 | payload = json.loads(line) |
| 127 | if isinstance(payload, dict): |
| 128 | rows.append(payload) |
| 129 | return rows |
| 130 | |
| 131 | |
| 132 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
no outgoing calls
no test coverage detected