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

Method write

python/python3/tornado/http1connection.py:488–504  ·  view source on GitHub ↗

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

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

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