Skip to content

Commit 50d8822

Browse files
committed
Commenting and revert uncessary changes to files for smaller diff
1 parent baf1062 commit 50d8822

3 files changed

Lines changed: 36 additions & 7 deletions

File tree

src/zarr/codecs/sharding.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,7 @@ async def _get_group_bytes(
855855
Reads a possibly coalesced group of one or more chunks from a shard.
856856
Returns a mapping of chunk coordinates to bytes.
857857
"""
858+
# _coalesce_chunks ensures that the group is not empty.
858859
group_start = group[0].byte_slice.start
859860
group_end = group[-1].byte_slice.stop
860861

src/zarr/core/indexing.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ def err_too_many_indices(selection: Any, shape: ChunkCoords) -> None:
7676
raise IndexError(f"too many indices for array; expected {len(shape)}, got {len(selection)}")
7777

7878

79-
def _zarr_array_to_int_or_bool_array(
80-
arr: Array,
81-
) -> npt.NDArray[np.intp] | npt.NDArray[np.bool_]:
79+
def _zarr_array_to_int_or_bool_array(arr: Array) -> npt.NDArray[np.intp] | npt.NDArray[np.bool_]:
8280
if arr.dtype.kind in ("i", "b"):
8381
return np.asarray(arr)
8482
else:
@@ -1320,8 +1318,7 @@ def pop_fields(selection: SelectionWithFields) -> tuple[Fields | None, Selection
13201318
fields = fields[0] if len(fields) == 1 else fields
13211319
selection_tuple = tuple(s for s in selection if not isinstance(s, str))
13221320
selection = cast(
1323-
"Selection",
1324-
selection_tuple[0] if len(selection_tuple) == 1 else selection_tuple,
1321+
"Selection", selection_tuple[0] if len(selection_tuple) == 1 else selection_tuple
13251322
)
13261323
return fields, selection
13271324

tests/test_properties.py

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,20 @@ def test_vindex(data: st.DataObject) -> None:
152152

153153
indexer = data.draw(
154154
npst.integer_array_indices(
155-
shape=nparray.shape,
156-
result_shape=npst.array_shapes(min_side=1, max_dims=None),
155+
shape=nparray.shape, result_shape=npst.array_shapes(min_side=1, max_dims=None)
157156
)
158157
)
159158
actual = zarray.vindex[indexer]
160159
assert_array_equal(nparray[indexer], actual)
161160

161+
# FIXME!
162+
# when the indexer is such that a value gets overwritten multiple times,
163+
# I think the output depends on chunking.
164+
# new_data = data.draw(npst.arrays(shape=st.just(actual.shape), dtype=nparray.dtype))
165+
# nparray[indexer] = new_data
166+
# zarray.vindex[indexer] = new_data
167+
# assert_array_equal(nparray, zarray[:])
168+
162169

163170
@given(store=stores, meta=array_metadata()) # type: ignore[misc]
164171
@pytest.mark.filterwarnings("ignore::zarr.core.dtype.common.UnstableSpecificationWarning")
@@ -216,6 +223,30 @@ def test_roundtrip_array_metadata_from_json(data: st.DataObject, zarr_format: in
216223
assert deep_equal(orig, rt), f"Roundtrip mismatch:\nOriginal: {orig}\nRoundtripped: {rt}"
217224

218225

226+
# @st.composite
227+
# def advanced_indices(draw, *, shape):
228+
# basic_idxr = draw(
229+
# basic_indices(
230+
# shape=shape, min_dims=len(shape), max_dims=len(shape), allow_ellipsis=False
231+
# ).filter(lambda x: isinstance(x, tuple))
232+
# )
233+
234+
# int_idxr = draw(
235+
# npst.integer_array_indices(shape=shape, result_shape=npst.array_shapes(max_dims=1))
236+
# )
237+
# args = tuple(
238+
# st.sampled_from((l, r)) for l, r in zip_longest(basic_idxr, int_idxr, fillvalue=slice(None))
239+
# )
240+
# return draw(st.tuples(*args))
241+
242+
243+
# @given(st.data())
244+
# def test_roundtrip_object_array(data):
245+
# nparray = data.draw(np_arrays)
246+
# zarray = data.draw(arrays(arrays=st.just(nparray)))
247+
# assert_array_equal(nparray, zarray[:])
248+
249+
219250
def serialized_complex_float_is_valid(
220251
serialized: tuple[numbers.Real | str, numbers.Real | str],
221252
) -> bool:

0 commit comments

Comments
 (0)