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

Method _get_chunk_left

Lib/http/client.py:572–594  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

570 break
571
572 def _get_chunk_left(self):
573 # return self.chunk_left, reading a new chunk if necessary.
574 # chunk_left == 0: at the end of the current chunk, need to close it
575 # chunk_left == None: No current chunk, should read next.
576 # This function returns non-zero or None if the last chunk has
577 # been read.
578 chunk_left = self.chunk_left
579 if not chunk_left: # Can be 0 or None
580 if chunk_left is not None:
581 # We are at the end of chunk, discard chunk end
582 self._safe_read(2) # toss the CRLF at the end of the chunk
583 try:
584 chunk_left = self._read_next_chunk_size()
585 except ValueError:
586 raise IncompleteRead(b'')
587 if chunk_left == 0:
588 # last chunk: 1*("0") [ chunk-extension ] CRLF
589 self._read_and_discard_trailer()
590 # we read everything; close the "file"
591 self._close_conn()
592 chunk_left = None
593 self.chunk_left = chunk_left
594 return chunk_left
595
596 def _read_chunked(self, amt=None):
597 assert self.chunked != _UNKNOWN

Callers 4

_read_chunkedMethod · 0.95
_readinto_chunkedMethod · 0.95
_read1_chunkedMethod · 0.95
_peek_chunkedMethod · 0.95

Calls 5

_safe_readMethod · 0.95
_read_next_chunk_sizeMethod · 0.95
_close_connMethod · 0.95
IncompleteReadClass · 0.85

Tested by

no test coverage detected