Skip to content

Commit f5ea962

Browse files
authored
Merge branch 'main' into remove-release-banner
2 parents 83c3c1b + 23010da commit f5ea962

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

src/zarr/storage/_obstore.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from zarr.core.config import config
1717

1818
if TYPE_CHECKING:
19-
from collections.abc import AsyncGenerator, Coroutine, Iterable
19+
from collections.abc import AsyncGenerator, Coroutine, Iterable, Sequence
2020
from typing import Any
2121

2222
from obstore import ListResult, ListStream, ObjectMeta, OffsetRange, SuffixRange
@@ -216,14 +216,14 @@ def list(self) -> AsyncGenerator[str, None]:
216216
# docstring inherited
217217
import obstore as obs
218218

219-
objects: ListStream[list[ObjectMeta]] = obs.list(self.store)
219+
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store)
220220
return _transform_list(objects)
221221

222222
def list_prefix(self, prefix: str) -> AsyncGenerator[str, None]:
223223
# docstring inherited
224224
import obstore as obs
225225

226-
objects: ListStream[list[ObjectMeta]] = obs.list(self.store, prefix=prefix)
226+
objects: ListStream[Sequence[ObjectMeta]] = obs.list(self.store, prefix=prefix)
227227
return _transform_list(objects)
228228

229229
def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
@@ -235,7 +235,7 @@ def list_dir(self, prefix: str) -> AsyncGenerator[str, None]:
235235

236236

237237
async def _transform_list(
238-
list_stream: ListStream[list[ObjectMeta]],
238+
list_stream: ListStream[Sequence[ObjectMeta]],
239239
) -> AsyncGenerator[str, None]:
240240
"""
241241
Transform the result of list into an async generator of paths.
@@ -246,7 +246,8 @@ async def _transform_list(
246246

247247

248248
async def _transform_list_dir(
249-
list_result_coroutine: Coroutine[Any, Any, ListResult[list[ObjectMeta]]], prefix: str
249+
list_result_coroutine: Coroutine[Any, Any, ListResult[Sequence[ObjectMeta]]],
250+
prefix: str,
250251
) -> AsyncGenerator[str, None]:
251252
"""
252253
Transform the result of list_with_delimiter into an async generator of paths.

src/zarr/testing/stateful.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,10 @@ def delete_array_using_del(self, data: DataObject) -> None:
343343
@precondition(lambda self: len(self.all_groups) >= 2) # fixme don't delete root
344344
@rule(data=st.data())
345345
def delete_group_using_del(self, data: DataObject) -> None:
346-
group_path = data.draw(
347-
st.sampled_from(sorted(self.all_groups)), label="Group deletion target"
348-
)
346+
# ensure that we don't include the root group in the list of member names that we try
347+
# to delete
348+
member_names = tuple(filter(lambda v: "/" in v, sorted(self.all_groups)))
349+
group_path = data.draw(st.sampled_from(member_names), label="Group deletion target")
349350
prefix, group_name = split_prefix_name(group_path)
350351
note(f"Deleting group '{group_path=!r}', {prefix=!r}, {group_name=!r} using delete")
351352
members = zarr.open_group(store=self.model, path=group_path).members(max_depth=None)

src/zarr/testing/strategies.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,15 +256,13 @@ def arrays(
256256
arrays = numpy_arrays(shapes=shapes)
257257
nparray = draw(arrays, label="array data")
258258
chunk_shape = draw(chunk_shapes(shape=nparray.shape), label="chunk shape")
259-
extra_kwargs = {}
259+
dim_names: None | list[str | None] = None
260260
if zarr_format == 3 and all(c > 0 for c in chunk_shape):
261261
shard_shape = draw(
262262
st.none() | shard_shapes(shape=nparray.shape, chunk_shape=chunk_shape),
263263
label="shard shape",
264264
)
265-
extra_kwargs["dimension_names"] = draw(
266-
dimension_names(ndim=nparray.ndim), label="dimension names"
267-
)
265+
dim_names = draw(dimension_names(ndim=nparray.ndim), label="dimension names")
268266
else:
269267
shard_shape = None
270268
# test that None works too.
@@ -285,7 +283,7 @@ def arrays(
285283
attributes=attributes,
286284
# compressor=compressor, # FIXME
287285
fill_value=fill_value,
288-
**extra_kwargs,
286+
dimension_names=dim_names,
289287
)
290288

291289
assert isinstance(a, Array)

0 commit comments

Comments
 (0)