MCPcopy
hub / github.com/urllib3/urllib3 / _pop_new_chunk

Method _pop_new_chunk

test/test_response.py:2027–2041  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2025 return length.encode() + chunk + b"\r\n"
2026
2027 def _pop_new_chunk(self) -> bytes:
2028 if self.chunks_exhausted:
2029 return b""
2030 try:
2031 chunk = self.content[self.index]
2032 except IndexError:
2033 chunk = b""
2034 self.chunks_exhausted = True
2035 else:
2036 self.index += 1
2037 chunk = self._encode_chunk(chunk)
2038 if not isinstance(chunk, bytes):
2039 chunk = chunk.encode()
2040 assert isinstance(chunk, bytes)
2041 return chunk
2042
2043 def pop_current_chunk(self, amt: int = -1, till_crlf: bool = False) -> bytes:
2044 if amt > 0 and till_crlf:

Callers 1

pop_current_chunkMethod · 0.95

Calls 1

_encode_chunkMethod · 0.95

Tested by

no test coverage detected