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

Method readall

Lib/_pyio.py:625–634  ·  view source on GitHub ↗

Read until EOF, using multiple read() call.

(self)

Source from the content-addressed store, hash-verified

623 return b.take_bytes()
624
625 def readall(self):
626 """Read until EOF, using multiple read() call."""
627 res = bytearray()
628 while data := self.read(DEFAULT_BUFFER_SIZE):
629 res += data
630 if res:
631 return res.take_bytes()
632 else:
633 # b'' or None
634 return data
635
636 def readinto(self, b):
637 """Read bytes into a pre-allocated bytes-like object b.

Callers 1

readMethod · 0.95

Calls 2

readMethod · 0.95
take_bytesMethod · 0.80

Tested by

no test coverage detected