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

Method writelines

Lib/asyncio/selector_events.py:1183–1204  ·  view source on GitHub ↗
(self, list_of_data)

Source from the content-addressed store, hash-verified

1181 self._sock.shutdown(socket.SHUT_WR)
1182
1183 def writelines(self, list_of_data):
1184 if self._eof:
1185 raise RuntimeError('Cannot call writelines() after write_eof()')
1186 if self._empty_waiter is not None:
1187 raise RuntimeError('unable to writelines; sendfile is in progress')
1188 if not list_of_data:
1189 return
1190
1191 if self._conn_lost:
1192 if self._conn_lost >= constants.LOG_THRESHOLD_FOR_CONNLOST_WRITES:
1193 logger.warning('socket.send() raised exception.')
1194 self._conn_lost += 1
1195 return
1196
1197 for data in list_of_data:
1198 self._buffer.append(memoryview(data))
1199 self._buffer_size += len(data)
1200 self._write_ready()
1201 # If the entire buffer couldn't be written, register a write handler
1202 if self._buffer:
1203 self._add_writer(self._sock_fd, self._write_ready)
1204 self._maybe_pause_protocol()
1205
1206 def can_write_eof(self):
1207 return True

Callers

nothing calls this directly

Calls 5

_write_readyMethod · 0.80
_maybe_pause_protocolMethod · 0.80
warningMethod · 0.45
appendMethod · 0.45
_add_writerMethod · 0.45

Tested by

no test coverage detected