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

Method peek

tools/python-3.11.9-amd64/Lib/zipfile.py:922–933  ·  view source on GitHub ↗

Returns buffered bytes without advancing the position.

(self, n=1)

Source from the content-addressed store, hash-verified

920 return io.BufferedIOBase.readline(self, limit)
921
922 def peek(self, n=1):
923 """Returns buffered bytes without advancing the position."""
924 if n > len(self._readbuffer) - self._offset:
925 chunk = self.read(n)
926 if len(chunk) > self._offset:
927 self._readbuffer = chunk + self._readbuffer[self._offset:]
928 self._offset = 0
929 else:
930 self._offset -= len(chunk)
931
932 # Return up to 512 bytes to reduce allocation overhead for tight loops.
933 return self._readbuffer[self._offset: self._offset + 512]
934
935 def readable(self):
936 if self.closed:

Callers

nothing calls this directly

Calls 1

readMethod · 0.95

Tested by

no test coverage detected