summaryrefslogtreecommitdiff
path: root/shared-bindings
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2021-03-07 15:34:07 -0500
committerDan Halbert <halbert@halwitz.org>2021-03-07 15:34:07 -0500
commita6cb7d7069351264096432d12f8b2ab1014a5140 (patch)
tree9f1fbe8322a810637f58754a6677b5de13744d50 /shared-bindings
parentd919b7fa4ac2e14dea81e33b419c11d2790c2a1e (diff)
Document readline() and readlines()
Diffstat (limited to 'shared-bindings')
-rw-r--r--shared-bindings/usb_cdc/Serial.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/shared-bindings/usb_cdc/Serial.c b/shared-bindings/usb_cdc/Serial.c
index 4913ac85a..0f2f76a17 100644
--- a/shared-bindings/usb_cdc/Serial.c
+++ b/shared-bindings/usb_cdc/Serial.c
@@ -45,7 +45,6 @@
//| descriptor and are included in the ``usb_cdc.serials`` tuple."""
//| ...
//|
-
//| def read(self, size: int = 1) -> bytes:
//| """Read at most ``size`` bytes. If ``size`` exceeds the internal buffer size
//| only the bytes in the buffer will be read. If `timeout` is > 0 or ``None``,
@@ -64,6 +63,28 @@
//| :rtype: bytes"""
//| ...
//|
+//| def readline(self, size=-1) -> Optional[bytes]:
+//| r"""Read a line, ending in a newline character ("\\n"), or
+//| return everything readable if no newline is found and ``timeout`` is 0.
+//| Return ``None`` in case of error.
+//|
+//| This is a binary stream: the newline character cannot be changed.
+//|
+//| :param int size: maximum number of characters to read. ``-1`` means as many as possible.
+//| :return: the line read
+//| :rtype: bytes or None"""
+//| ...
+//|
+//| def readlines(self) -> list:
+//| """Read multiple lines as a list, using `readline()`
+//|
+//| .. warning:: If ``timeout`` is ``None``,
+//| `readlines()` will never return, because there is no way to indicate end of stream.
+//|
+//| :return: a list of the line read
+//| :rtype: list"""
+//| ...
+//|
//| def write(self, buf: ReadableBuffer) -> int:
//| """Write as many bytes as possible from the buffer of bytes.
//|