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

Method write

tornado/http1connection.py:489–505  ·  tornado/http1connection.py::HTTP1Connection.write

Implements `.HTTPConnection.write`. For backwards compatibility it is allowed but deprecated to skip `write_headers` and instead call `write()` with a pre-encoded header block.

(self, chunk: bytes)

Source from the content-addressed store, hash-verified

487 return chunk
488
489 def write(self, chunk: bytes) -> class="st">"Future[None]":
490 class="st">"""Implements `.HTTPConnection.write`.
491
492 For backwards compatibility it is allowed but deprecated to
493 skip `write_headers` and instead call `write()` with a
494 pre-encoded header block.
495 class="st">"""
496 future = None
497 if self.stream.closed():
498 future = self._write_future = Future()
499 self._write_future.set_exception(iostream.StreamClosedError())
500 self._write_future.exception()
501 else:
502 future = self._write_future = Future()
503 self._pending_write = self.stream.write(self._format_chunk(chunk))
504 future_add_done_callback(self._pending_write, self._on_write_complete)
505 return future
506
507 def finish(self) -> None:
508 class="st">""class="st">"Implements `.HTTPConnection.finish`."class="st">""

Callers 3

_read_messageMethod · 0.45
write_headersMethod · 0.45
finishMethod · 0.45

Calls 3

_format_chunkMethod · 0.95
future_add_done_callbackFunction · 0.90
closedMethod · 0.80

Tested by

no test coverage detected