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

Method _read_chunked

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

Source from the content-addressed store, hash-verified

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