(path: Path)
| 67 | |
| 68 | |
| 69 | def load_jsonl(path: Path) -> List[Dict[str, Any]]: |
| 70 | rows: List[Dict[str, Any]] = [] |
| 71 | if not path.exists(): |
| 72 | return rows |
| 73 | with path.open("r", encoding="utf-8") as handle: |
| 74 | for line in handle: |
| 75 | line = line.strip() |
| 76 | if not line: |
| 77 | continue |
| 78 | payload = json.loads(line) |
| 79 | if isinstance(payload, dict): |
| 80 | rows.append(payload) |
| 81 | return rows |
| 82 | |
| 83 | |
| 84 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
no outgoing calls
no test coverage detected