MCPcopy Index your code
hub / github.com/RustPython/RustPython / drain

Method drain

Lib/asyncio/streams.py:363–386  ·  view source on GitHub ↗

Flush the write buffer. The intended use is to write w.write(data) await w.drain()

(self)

Source from the content-addressed store, hash-verified

361 return self._transport.get_extra_info(name, default)
362
363 async def drain(self):
364 """Flush the write buffer.
365
366 The intended use is to write
367
368 w.write(data)
369 await w.drain()
370 """
371 if self._reader is not None:
372 exc = self._reader.exception()
373 if exc is not None:
374 raise exc
375 if self._transport.is_closing():
376 # Wait for protocol.connection_lost() call
377 # Raise connection closing error if any,
378 # ConnectionResetError otherwise
379 # Yield to the event loop so connection_lost() may be
380 # called. Without this, _drain_helper() would return
381 # immediately, and code that calls
382 # write(...); await drain()
383 # in a loop would never call connection_lost(), so it
384 # would not see an error when the socket is closed.
385 await sleep(0)
386 await self._protocol._drain_helper()
387
388 async def start_tls(self, sslcontext, *,
389 server_hostname=None,

Callers 9

start_tlsMethod · 0.95
_feed_stdinMethod · 0.45
handle_clientMethod · 0.45
clientMethod · 0.45
innerMethod · 0.45
runMethod · 0.45
write_stdinMethod · 0.45
handle_clientMethod · 0.45
writeMethod · 0.45

Calls 4

_drain_helperMethod · 0.80
sleepFunction · 0.70
exceptionMethod · 0.45
is_closingMethod · 0.45

Tested by 7

handle_clientMethod · 0.36
clientMethod · 0.36
innerMethod · 0.36
runMethod · 0.36
write_stdinMethod · 0.36
handle_clientMethod · 0.36
writeMethod · 0.36