MCPcopy Create free account
hub / github.com/EasyIME/PIME / peek

Method peek

python/python3/tornado/iostream.py:161–176  ·  view source on GitHub ↗

Get a view over at most ``size`` bytes (possibly fewer) at the current buffer position.

(self, size: int)

Source from the content-addressed store, hash-verified

159 self._size += size
160
161 def peek(self, size: int) -> memoryview:
162 """
163 Get a view over at most ``size`` bytes (possibly fewer) at the
164 current buffer position.
165 """
166 assert size > 0
167 try:
168 is_memview, b = self._buffers[0]
169 except IndexError:
170 return memoryview(b"")
171
172 pos = self._first_pos
173 if is_memview:
174 return typing.cast(memoryview, b[pos : pos + size])
175 else:
176 return memoryview(b)[pos : pos + size]
177
178 def advance(self, size: int) -> None:
179 """

Callers 2

_handle_writeMethod · 0.80
check_peekMethod · 0.80

Calls

no outgoing calls

Tested by 1

check_peekMethod · 0.64