diff options
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r-- | Lib/asyncio/streams.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/asyncio/streams.py b/Lib/asyncio/streams.py index 4943e8e..b709dc1 100644 --- a/Lib/asyncio/streams.py +++ b/Lib/asyncio/streams.py @@ -70,6 +70,13 @@ def connect(host=None, port=None, *, server_hostname=None, ssl_handshake_timeout=None, happy_eyeballs_delay=None, interleave=None): + """Connect to TCP socket on *host* : *port* address to send and receive data. + + *limit* determines the buffer size limit used by the returned `Stream` + instance. By default the *limit* is set to 64 KiB. + + The rest of the arguments are passed directly to `loop.create_connection()`. + """ # Design note: # Don't use decorator approach but explicit non-async # function to fail fast and explicitly @@ -108,6 +115,13 @@ async def _connect(host, port, def connect_read_pipe(pipe, *, limit=_DEFAULT_LIMIT): + """Establish a connection to a file-like object *pipe* to receive data. + + Takes a file-like object *pipe* to return a Stream object of the mode + StreamMode.READ that has similar API of StreamReader. It can also be used + as an async context manager. + """ + # Design note: # Don't use decorator approach but explicit non-async # function to fail fast and explicitly @@ -129,6 +143,13 @@ async def _connect_read_pipe(pipe, limit): def connect_write_pipe(pipe, *, limit=_DEFAULT_LIMIT): + """Establish a connection to a file-like object *pipe* to send data. + + Takes a file-like object *pipe* to return a Stream object of the mode + StreamMode.WRITE that has similar API of StreamWriter. It can also be used + as an async context manager. + """ + # Design note: # Don't use decorator approach but explicit non-async # function to fail fast and explicitly |