From d88a236fdeba78a8dd55b0611e9c4207c917c663 Mon Sep 17 00:00:00 2001 From: Agis Kounelis Date: Fri, 29 Mar 2024 17:52:57 +0200 Subject: [PATCH] Change vfs.readinto() buff type annotation to bytes-like object --- tiledb/vfs.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tiledb/vfs.py b/tiledb/vfs.py index aace71a5d0..dc5f0f5ebf 100644 --- a/tiledb/vfs.py +++ b/tiledb/vfs.py @@ -490,11 +490,12 @@ def write(self, buff: bytes): self._offset += nbytes return nbytes - def readinto(self, buff: np.ndarray) -> int: + def readinto(self, buff: Union[bytes, bytearray, memoryview]) -> int: """ - Read bytes into a pre-allocated, writable bytes-like object b, and return the number of bytes read. - - :param buff np.ndarray: A pre-allocated, writable bytes-like object + Read bytes into a pre-allocated, writable, bytes-like object, and return the number of bytes read. + :param buff bytes | bytearray | memoryview: A pre-allocated, writable object that supports the byte buffer protocol + :rtype: int + :return: The number of bytes read """ buff = memoryview(buff).cast("b") size = len(buff)