(path: Path)
| 136 | |
| 137 | |
| 138 | def load_jsonl(path: Path) -> List[Dict[str, Any]]: |
| 139 | rows: List[Dict[str, Any]] = [] |
| 140 | if not path.exists(): |
| 141 | return rows |
| 142 | with path.open("r", encoding="utf-8") as handle: |
| 143 | for line in handle: |
| 144 | line = line.strip() |
| 145 | if not line: |
| 146 | continue |
| 147 | payload = json.loads(line) |
| 148 | if isinstance(payload, dict): |
| 149 | rows.append(payload) |
| 150 | return rows |
| 151 | |
| 152 | |
| 153 | def write_jsonl(path: Path, rows: Iterable[Dict[str, Any]]) -> None: |
no outgoing calls
no test coverage detected