From 8da95ff629dbc1768d7cedf6cd261dc472088cf3 Mon Sep 17 00:00:00 2001 From: John Readey Date: Mon, 28 Nov 2022 11:30:53 -0800 Subject: [PATCH] fix for hsload with --link and s3paths (#131) * fix for append with chunks * fix for append mode with s3 links --- h5pyd/_apps/utillib.py | 9 +++++++++ h5pyd/_hl/dataset.py | 4 ++-- h5pyd/_hl/filters.py | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/h5pyd/_apps/utillib.py b/h5pyd/_apps/utillib.py index d33c4bb7..224f7a19 100755 --- a/h5pyd/_apps/utillib.py +++ b/h5pyd/_apps/utillib.py @@ -787,6 +787,15 @@ def create_dataset(dobj, ctx): # just use the dims field of dobj.chunks as chunk shape chunks = get_chunk_dims(dobj) if chunks is not None: + if dset_preappend is not None: + # check to see if an extra dimension is needed for the chunk shape + if isinstance(chunks, dict): + # chunktable is already adjusted + pass + else: + new_chunks = [1,] + new_chunks.extend(chunks) + chunks = tuple(new_chunks) kwargs["chunks"] = chunks if ( dobj.shape is None diff --git a/h5pyd/_hl/dataset.py b/h5pyd/_hl/dataset.py index 91c887e9..740b2b7d 100644 --- a/h5pyd/_hl/dataset.py +++ b/h5pyd/_hl/dataset.py @@ -127,8 +127,8 @@ def make_new_dset( chunk > dim for dim, chunk in zip(tmp_shape, chunks) if dim is not None ): errmsg = ( - "Chunk shape must not be greater than data shape in any dimension. " - "{} is not compatible with {}".format(chunks, shape) + f"Chunk shape must not be greater than data shape in any dimension. " + "{chunks} is not compatible with {shape}" ) raise ValueError(errmsg) diff --git a/h5pyd/_hl/filters.py b/h5pyd/_hl/filters.py index e7820109..0f0e440a 100644 --- a/h5pyd/_hl/filters.py +++ b/h5pyd/_hl/filters.py @@ -92,9 +92,9 @@ def rq_tuple(tpl, name): try: tpl = tuple(tpl) except TypeError: - raise TypeError('"%s" argument must be None or a sequence object' % name) + raise TypeError(f'"{name}" argument must be None or a sequence object') if len(tpl) != len(shape): - raise ValueError('"%s" must have same rank as dataset shape' % name) + raise ValueError(f'"{name}" must have same rank as dataset shape') rq_tuple(chunks, "chunks") rq_tuple(maxshape, "maxshape")