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

Method _read_chunked

Lib/http/client.py:596–614  ·  view source on GitHub ↗
(self, amt=None)

Source from the content-addressed store, hash-verified

594 return chunk_left
595
596 def _read_chunked(self, amt=None):
597 assert self.chunked != _UNKNOWN
598 if amt is not None and amt < 0:
599 amt = None
600 value = []
601 try:
602 while (chunk_left := self._get_chunk_left()) is not None:
603 if amt is not None and amt <= chunk_left:
604 value.append(self._safe_read(amt))
605 self.chunk_left = chunk_left - amt
606 break
607
608 value.append(self._safe_read(chunk_left))
609 if amt is not None:
610 amt -= chunk_left
611 self.chunk_left = 0
612 return b''.join(value)
613 except IncompleteRead as exc:
614 raise IncompleteRead(b''.join(value)) from exc
615
616 def _readinto_chunked(self, b):
617 assert self.chunked != _UNKNOWN

Callers 1

readMethod · 0.95

Calls 5

_get_chunk_leftMethod · 0.95
_safe_readMethod · 0.95
IncompleteReadClass · 0.85
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected