MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / peek

Method peek

tools/python-3.11.9-amd64/Lib/_pyio.py:1141–1149  ·  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

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)

Callers 3

nreadaheadMethod · 0.45
peekMethod · 0.45
peekMethod · 0.45

Calls 1

_peek_unlockedMethod · 0.95

Tested by

no test coverage detected