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

Method append

tornado/iostream.py:139–159  ·  tornado/iostream.py::_StreamBuffer.append

Append the given piece of data (should be a buffer-compatible object).

(self, data: Union[bytes, bytearray, memoryview])

Source from the content-addressed store, hash-verified

137 _large_buf_threshold = 2048
138
139 def append(self, data: Union[bytes, bytearray, memoryview]) -> None:
140 class="st">"""
141 Append the given piece of data (should be a buffer-compatible object).
142 class="st">"""
143 size = len(data)
144 if size > self._large_buf_threshold:
145 if not isinstance(data, memoryview):
146 data = memoryview(data)
147 self._buffers.append((True, data))
148 elif size > 0:
149 if self._buffers:
150 is_memview, b = self._buffers[-1]
151 new_buf = is_memview or len(b) >= self._large_buf_threshold
152 else:
153 new_buf = True
154 if new_buf:
155 self._buffers.append((False, bytearray(data)))
156 else:
157 b += data class="cm"># type: ignore
158
159 self._size += size
160
161 def peek(self, size: int) -> memoryview:
162 class="st">"""

Callers 15

bind_socketsFunction · 0.80
_resolve_addrFunction · 0.80
splitMethod · 0.80
writeMethod · 0.80
_signal_closedMethod · 0.80
friendly_numberMethod · 0.80
add_reload_hookFunction · 0.80
_done_callbackMethod · 0.80
callbackFunction · 0.80
putMethod · 0.80
getMethod · 0.80
_putMethod · 0.80

Calls

no outgoing calls

Tested by 15

handle_streamMethod · 0.64
setUpMethod · 0.64
tearDownMethod · 0.64
testMethod · 0.64
callbackMethod · 0.64
test_notify_1Method · 0.64
test_notify_allMethod · 0.64
fMethod · 0.64
fMethod · 0.64
fMethod · 0.64
consumerMethod · 0.64
header_callbackMethod · 0.64