Seek to a position in the file, but never beyond size_limit.
(self, __offset: int, __whence: int = SEEK_SET)
| 359 | return self._file.tell() |
| 360 | |
| 361 | def seek(self, __offset: int, __whence: int = SEEK_SET) -> int: |
| 362 | """Seek to a position in the file, but never beyond size_limit.""" |
| 363 | if __whence == SEEK_END: |
| 364 | __offset = len(self) + __offset |
| 365 | __whence = SEEK_SET |
| 366 | |
| 367 | pos = self._file.seek(__offset, __whence) |
| 368 | if pos > self._size_limit: |
| 369 | return self._file.seek(self._size_limit) |
| 370 | return pos |
| 371 | |
| 372 | def read(self, __size: Optional[int] = -1) -> bytes: |
| 373 | """Read at most _size bytes from the current position.""" |
no outgoing calls