MCPcopy
hub / github.com/tornadoweb/tornado / _consume

Method _consume

tornado/iostream.py:985–994  ·  view source on GitHub ↗
(self, loc: int)

Source from the content-addressed store, hash-verified

983 future_set_result_unless_cancelled(future, None)
984
985 def _consume(self, loc: int) -> bytes:
986 # Consume loc bytes from the read buffer and return them
987 if loc == 0:
988 return b""
989 assert loc <= self._read_buffer_size
990 # Slice the bytearray buffer into bytes, without intermediate copying
991 b = (memoryview(self._read_buffer)[:loc]).tobytes()
992 self._read_buffer_size -= loc
993 del self._read_buffer[:loc]
994 return b
995
996 def _check_closed(self) -> None:
997 if self.closed():

Callers 1

_finish_readMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected