From 4d29030db1213dc47a0567165c668bca91ea8fc2 Mon Sep 17 00:00:00 2001 From: ehennestad Date: Thu, 31 Jul 2025 21:03:22 +0200 Subject: [PATCH 1/2] Update ZarrPy.py --- PythonModule/ZarrPy.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/PythonModule/ZarrPy.py b/PythonModule/ZarrPy.py index 6a182b9..a78c4ff 100644 --- a/PythonModule/ZarrPy.py +++ b/PythonModule/ZarrPy.py @@ -100,6 +100,14 @@ def readZarr (kvstore_schema, starts, ends, strides): 'kvstore': kvstore_schema, }).result() + # Ensure all inputs are lists/tuples + if isinstance(starts, (int, type(None))): + starts = [starts] + if isinstance(ends, (int, type(None))): + ends = [ends] + if isinstance(strides, (int, type(None))): + strides = [strides] + # Construct the indexing slices slices = tuple(slice(start, end, stride) for start, end, stride in zip(starts, ends, strides)) From 15e922099dc83b487bfeaeef3c7ba64089ccf274 Mon Sep 17 00:00:00 2001 From: ehennestad Date: Tue, 30 Sep 2025 10:54:25 +0200 Subject: [PATCH 2/2] Update ZarrPy.py Simplify - Expecting input to be array or int, never None --- PythonModule/ZarrPy.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PythonModule/ZarrPy.py b/PythonModule/ZarrPy.py index a78c4ff..2b7e395 100644 --- a/PythonModule/ZarrPy.py +++ b/PythonModule/ZarrPy.py @@ -100,12 +100,12 @@ def readZarr (kvstore_schema, starts, ends, strides): 'kvstore': kvstore_schema, }).result() - # Ensure all inputs are lists/tuples - if isinstance(starts, (int, type(None))): + # Convert integer inputs to single-element lists + if isinstance(starts, int): starts = [starts] - if isinstance(ends, (int, type(None))): + if isinstance(ends, int): ends = [ends] - if isinstance(strides, (int, type(None))): + if isinstance(strides, int): strides = [strides] # Construct the indexing slices