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

Method _peek_chunked

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

Source from the content-addressed store, hash-verified

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