(
stream: BinaryIO,
responses: "queue.Queue[dict[str, Any]]",
transcript: list[dict[str, Any]],
)
| 49 | |
| 50 | |
| 51 | def read_json_lines( |
| 52 | stream: BinaryIO, |
| 53 | responses: "queue.Queue[dict[str, Any]]", |
| 54 | transcript: list[dict[str, Any]], |
| 55 | ) -> None: |
| 56 | for raw_line in iter(stream.readline, b""): |
| 57 | try: |
| 58 | message = json.loads(raw_line.decode("utf-8")) |
| 59 | except (UnicodeDecodeError, json.JSONDecodeError): |
| 60 | continue |
| 61 | if isinstance(message, dict): |
| 62 | transcript.append(message) |
| 63 | responses.put(message) |
| 64 | |
| 65 | |
| 66 | def drain(stream: BinaryIO, chunks: list[bytes]) -> None: |
nothing calls this directly
no outgoing calls
no test coverage detected