From 0c416c10b2ad62b2bf8a7cce615a57012f9b6b2c Mon Sep 17 00:00:00 2001 From: pdmurray Date: Sun, 14 Apr 2024 10:37:04 -0700 Subject: [PATCH] Fix remaining append bugs in test_api --- versioned_hdf5/backend.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/versioned_hdf5/backend.py b/versioned_hdf5/backend.py index 95ecc44b..3ba19bd6 100644 --- a/versioned_hdf5/backend.py +++ b/versioned_hdf5/backend.py @@ -1008,7 +1008,7 @@ def __init__(self, value: np.ndarray): self.value = value def __repr__(self): - return f"WriteOperation: {self.value}" + return f"AppendOperation: {self.value}" def apply( self, @@ -1229,7 +1229,7 @@ def append_to_dataset( ) # Get the slices from the previous version; they are reused here - last_virtual_slice = list(sorted(slices, key=lambda obj: obj.args[0]))[-1] + last_virtual_slice = list(sorted(slices, key=lambda obj: obj.args[0].start))[-1] # Split the data to append into a part which fits in the last # chunk of the raw data, and the part that doesn't @@ -1558,7 +1558,7 @@ def partition( index = to_slice_tuple(obj) shape = tuple(dim.stop for dim in index.args) - if isinstance(chunks, int): + if isinstance(chunks, (int, np.integer)): chunks = (chunks,) yield from ChunkSize(chunks).as_subchunks(index, shape)