Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update type signature for VFS::readinto #1937

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tiledb/vfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading