From f5d9a4f1c6d7322bc2c35057e843f59303bcd561 Mon Sep 17 00:00:00 2001 From: Laurens Valk Date: Tue, 29 Nov 2022 20:28:08 +0100 Subject: [PATCH] uio: Document getvalue. --- src/uio/__init__.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/uio/__init__.py b/src/uio/__init__.py index 8e9c0cb..e62c6be 100644 --- a/src/uio/__init__.py +++ b/src/uio/__init__.py @@ -14,7 +14,7 @@ This module contains ``stream`` objects that behave like files. from typing import overload, Union # TODO: MicroPython streams implement '__enter__', '__exit__', 'close', 'read', -# 'readinto', 'readline', 'write', 'flush', 'getvalue', 'seek', 'tell' +# 'readinto', 'readline', 'write', 'flush', 'seek', 'tell' # and are iterable @@ -45,6 +45,13 @@ class BytesIO: alloc_size (int): Optional number of preallocated bytes. """ + def getvalue(self) -> bytes: + """ + getvalue() -> bytes + + Gets the contents of the underlying buffer. + """ + class StringIO: @overload @@ -72,6 +79,13 @@ class StringIO: alloc_size (int): Optional number of preallocated bytes. """ + def getvalue(self) -> str: + """ + getvalue() -> str + + Gets the contents of the underlying buffer. + """ + class FileIO: """