Skip to content

Commit

Permalink
Change vfs.readinto() buff type annotation to bytes-like object
Browse files Browse the repository at this point in the history
  • Loading branch information
kounelisagis committed Mar 29, 2024
1 parent 1550d27 commit d88a236
Showing 1 changed file with 5 additions and 4 deletions.
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

0 comments on commit d88a236

Please sign in to comment.