MCPcopy Index your code
hub / github.com/RustPython/RustPython / peek

Method peek

Lib/_pyio.py:1111–1120  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

1109 return out[:n] if out else nodata_val
1110
1111 def peek(self, size=0):
1112 """Returns buffered bytes without advancing the position.
1113
1114 The argument indicates a desired minimal number of bytes; we
1115 do at most one raw read to satisfy it. We never return more
1116 than self.buffer_size.
1117 """
1118 self._checkClosed("peek of closed file")
1119 with self._read_lock:
1120 return self._peek_unlocked(size)
1121
1122 def _peek_unlocked(self, n=0):
1123 want = min(n, self.buffer_size)

Callers 3

nreadaheadMethod · 0.45
peekMethod · 0.45
peekMethod · 0.45

Calls 2

_peek_unlockedMethod · 0.95
_checkClosedMethod · 0.45

Tested by

no test coverage detected