summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/streams.py
diff options
context:
space:
mode:
authorXtreak <tir.karthi@gmail.com>2019-09-13 10:52:38 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-09-13 10:52:38 (GMT)
commitd31b31516c71890e8735606aec1dbf2bfb8fd6be (patch)
tree748eaf8c8c5f0bb568be16ed1a06fa76ceafa6e7 /Lib/asyncio/streams.py
parent6a517c674907c195660fa9178a7b561de49cc721 (diff)
downloadcpython-d31b31516c71890e8735606aec1dbf2bfb8fd6be.zip
cpython-d31b31516c71890e8735606aec1dbf2bfb8fd6be.tar.gz
cpython-d31b31516c71890e8735606aec1dbf2bfb8fd6be.tar.bz2
bpo-36889: Document Stream class and add docstrings (GH-14488)
* This just copies the docs from `StreamWriter` and `StreamReader`. * Add docstring for asyncio functions. https://bugs.python.org/issue36889 Automerge-Triggered-By: @asvetlov
Diffstat (limited to 'Lib/asyncio/streams.py')
-rw-r--r--Lib/asyncio/streams.py21
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