(path: Path)
| 162 | |
| 163 | |
| 164 | def load_jsonl(path: Path) -> List[Dict[str, Any]]: |
| 165 | rows: List[Dict[str, Any]] = [] |
| 166 | if not path.exists(): |
| 167 | return rows |
| 168 | with path.open("r", encoding="utf-8") as handle: |
| 169 | for line in handle: |
| 170 | line = line.strip() |
| 171 | if not line: |
| 172 | continue |
| 173 | payload = json.loads(line) |
| 174 | if isinstance(payload, dict): |
| 175 | rows.append(payload) |
| 176 | return rows |
| 177 | |
| 178 | |
| 179 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
no outgoing calls
no test coverage detected