Read at most _size bytes from the current position.
(self, __size: Optional[int] = -1)
| 370 | return pos |
| 371 | |
| 372 | def read(self, __size: Optional[int] = -1) -> bytes: |
| 373 | """Read at most _size bytes from the current position.""" |
| 374 | current = self.tell() |
| 375 | if __size is None or __size < 0: |
| 376 | # Read until file limit |
| 377 | truncated_size = self._size_limit - current |
| 378 | else: |
| 379 | # Read until file limit or __size |
| 380 | truncated_size = min(__size, self._size_limit - current) |
| 381 | return self._file.read(truncated_size) |