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

Method read1

Lib/compression/zstd/_zstdfile.py:175–188  ·  view source on GitHub ↗

Read up to size uncompressed bytes, while trying to avoid making multiple reads from the underlying stream. Reads up to a buffer's worth of data if size is negative. Returns b'' if the file is at EOF.

(self, size=-1)

Source from the content-addressed store, hash-verified

173 return self._buffer.read(size)
174
175 def read1(self, size=-1):
176 """Read up to size uncompressed bytes, while trying to avoid
177 making multiple reads from the underlying stream. Reads up to a
178 buffer's worth of data if size is negative.
179
180 Returns b'' if the file is at EOF.
181 """
182 self._check_can_read()
183 if size < 0:
184 # Note this should *not* be io.DEFAULT_BUFFER_SIZE.
185 # ZSTD_DStreamOutSize is the minimum amount to read guaranteeing
186 # a full block is read.
187 size = ZSTD_DStreamOutSize
188 return self._buffer.read1(size)
189
190 def readinto(self, b):
191 """Read bytes into b.

Callers

nothing calls this directly

Calls 1

_check_can_readMethod · 0.80

Tested by

no test coverage detected