(self)
| 217 | view = view[written:] |
| 218 | |
| 219 | def close(self) -> None: |
| 220 | if self._closed: |
| 221 | return |
| 222 | self._closed = True |
| 223 | fd, self._fd = self._fd, None |
| 224 | if fd is not None: |
| 225 | try: |
| 226 | os.close(fd) |
| 227 | except OSError: |
| 228 | logger.exception("transcript close failed for %s", self._path) |
| 229 | |
| 230 | # Context-manager support so callers can write `with TranscriptWriter(...) as w:` |
| 231 | def __enter__(self) -> "TranscriptWriter": |
no outgoing calls