Read just this slice's characters from its parent file. Goes through :func:`unit_source_text`, so a PDF slice indexes the extracted text rather than the container's bytes — the offsets `expand_oversized_files` computed and the string the prompt carries are then the same string (#2906).
(fs: FileSlice)
| 287 | |
| 288 | |
| 289 | def read_slice_text(fs: FileSlice) -> str: |
| 290 | """Read just this slice's characters from its parent file. |
| 291 | |
| 292 | Goes through :func:`unit_source_text`, so a PDF slice indexes the extracted |
| 293 | text rather than the container's bytes — the offsets `expand_oversized_files` |
| 294 | computed and the string the prompt carries are then the same string (#2906). |
| 295 | """ |
| 296 | return unit_source_text(fs.path)[fs.start:fs.end] |
| 297 | |
| 298 | |
| 299 | def bisect_slice(fs: FileSlice) -> tuple[FileSlice, FileSlice] | None: |