MCPcopy Index your code
hub / github.com/RustPython/RustPython / _readinto_chunked

Method _readinto_chunked

Lib/http/client.py:616–638  ·  view source on GitHub ↗
(self, b)

Source from the content-addressed store, hash-verified

614 raise IncompleteRead(b''.join(value)) from exc
615
616 def _readinto_chunked(self, b):
617 assert self.chunked != _UNKNOWN
618 total_bytes = 0
619 mvb = memoryview(b)
620 try:
621 while True:
622 chunk_left = self._get_chunk_left()
623 if chunk_left is None:
624 return total_bytes
625
626 if len(mvb) <= chunk_left:
627 n = self._safe_readinto(mvb)
628 self.chunk_left = chunk_left - n
629 return total_bytes + n
630
631 temp_mvb = mvb[:chunk_left]
632 n = self._safe_readinto(temp_mvb)
633 mvb = mvb[n:]
634 total_bytes += n
635 self.chunk_left = 0
636
637 except IncompleteRead:
638 raise IncompleteRead(bytes(b[0:total_bytes]))
639
640 def _safe_read(self, amt):
641 """Read the number of bytes requested.

Callers 1

readintoMethod · 0.95

Calls 4

_get_chunk_leftMethod · 0.95
_safe_readintoMethod · 0.95
lenFunction · 0.85
IncompleteReadClass · 0.85

Tested by

no test coverage detected