Returns buffered bytes without advancing the position. The argument indicates a desired minimal number of bytes; we do at most one raw read to satisfy it. We never return more than self.buffer_size.
(self, size=0)
| 1139 | return out[:n] if out else nodata_val |
| 1140 | |
| 1141 | def peek(self, size=0): |
| 1142 | """Returns buffered bytes without advancing the position. |
| 1143 | |
| 1144 | The argument indicates a desired minimal number of bytes; we |
| 1145 | do at most one raw read to satisfy it. We never return more |
| 1146 | than self.buffer_size. |
| 1147 | """ |
| 1148 | with self._read_lock: |
| 1149 | return self._peek_unlocked(size) |
| 1150 | |
| 1151 | def _peek_unlocked(self, n=0): |
| 1152 | want = min(n, self.buffer_size) |
no test coverage detected