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

Method _peek_chunked

Lib/http/client.py:734–745  ·  view source on GitHub ↗
(self, n)

Source from the content-addressed store, hash-verified

732 return read
733
734 def _peek_chunked(self, n):
735 # Strictly speaking, _get_chunk_left() may cause more than one read,
736 # but that is ok, since that is to satisfy the chunked protocol.
737 try:
738 chunk_left = self._get_chunk_left()
739 except IncompleteRead:
740 return b'' # peek doesn't worry about protocol
741 if chunk_left is None:
742 return b'' # eof
743 # peek is allowed to return more than requested. Just request the
744 # entire chunk, and truncate what we get.
745 return self.fp.peek(chunk_left)[:chunk_left]
746
747 def fileno(self):
748 return self.fp.fileno()

Callers 1

peekMethod · 0.95

Calls 2

_get_chunk_leftMethod · 0.95
peekMethod · 0.45

Tested by

no test coverage detected