Document readline() and readlines()

This commit is contained in:
Dan Halbert 2021-03-07 15:34:07 -05:00
parent d919b7fa4a
commit a6cb7d7069

View File

@ -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.
//|