MCPcopy Index your code
hub / github.com/python/cpython / peek

Method peek

Lib/bz2.py:153–163  ·  view source on GitHub ↗

Return buffered data without advancing the file position. Always returns at least one byte of data, unless at EOF. The exact number of bytes returned is unspecified.

(self, n=0)

Source from the content-addressed store, hash-verified

151 return self._mode == _MODE_WRITE
152
153 def peek(self, n=0):
154 """Return buffered data without advancing the file position.
155
156 Always returns at least one byte of data, unless at EOF.
157 The exact number of bytes returned is unspecified.
158 """
159 self._check_can_read()
160 # Relies on the undocumented fact that BufferedReader.peek()
161 # always returns at least one byte (except at EOF), independent
162 # of the value of n
163 return self._buffer.peek(n)
164
165 def read(self, size=-1):
166 """Read up to size uncompressed bytes from the file.

Callers

nothing calls this directly

Calls 1

_check_can_readMethod · 0.80

Tested by

no test coverage detected