zarr.testing.strategies ======================= .. py:module:: zarr.testing.strategies Attributes ---------- .. autoapisummary:: zarr.testing.strategies.array_names zarr.testing.strategies.array_shapes zarr.testing.strategies.attrs zarr.testing.strategies.compressors zarr.testing.strategies.node_names zarr.testing.strategies.short_node_names zarr.testing.strategies.stores zarr.testing.strategies.zarr_formats zarr.testing.strategies.zarr_key_chars Functions --------- .. autoapisummary:: zarr.testing.strategies.array_metadata zarr.testing.strategies.arrays zarr.testing.strategies.basic_indices zarr.testing.strategies.chunk_paths zarr.testing.strategies.chunk_shapes zarr.testing.strategies.clear_store zarr.testing.strategies.dimension_names zarr.testing.strategies.dtypes zarr.testing.strategies.end_slices zarr.testing.strategies.is_negative_slice zarr.testing.strategies.key_ranges zarr.testing.strategies.keys zarr.testing.strategies.np_array_and_chunks zarr.testing.strategies.numpy_arrays zarr.testing.strategies.orthogonal_indices zarr.testing.strategies.paths zarr.testing.strategies.safe_unicode_for_dtype zarr.testing.strategies.shard_shapes zarr.testing.strategies.simple_arrays zarr.testing.strategies.v2_dtypes zarr.testing.strategies.v3_dtypes Module Contents --------------- .. py:function:: array_metadata(*, array_shapes: collections.abc.Callable[Ellipsis, hypothesis.strategies.SearchStrategy[tuple[int, Ellipsis]]] = npst.array_shapes, zarr_formats: hypothesis.strategies.SearchStrategy[Literal[2, 3]] = zarr_formats, attributes: hypothesis.strategies.SearchStrategy[collections.abc.Mapping[str, zarr.core.common.JSON] | None] = attrs) -> zarr.core.metadata.ArrayV2Metadata | zarr.core.metadata.ArrayV3Metadata .. py:function:: arrays(*, shapes: hypothesis.strategies.SearchStrategy[tuple[int, Ellipsis]] = array_shapes, compressors: hypothesis.strategies.SearchStrategy = compressors, stores: hypothesis.strategies.SearchStrategy[zarr.storage.StoreLike] = stores, paths: hypothesis.strategies.SearchStrategy[str] = paths(), array_names: hypothesis.strategies.SearchStrategy = array_names, arrays: hypothesis.strategies.SearchStrategy | None = None, attrs: hypothesis.strategies.SearchStrategy = attrs, zarr_formats: hypothesis.strategies.SearchStrategy = zarr_formats) -> zarr.core.array.Array .. py:function:: basic_indices(*, shape: tuple[int, Ellipsis], min_dims: int = 0, max_dims: int | None = None, allow_newaxis: bool = False, allow_ellipsis: bool = True) -> Any Basic indices without unsupported negative slices. .. !! processed by numpydoc !! .. py:function:: chunk_paths(ndim: int, numblocks: tuple[int, Ellipsis], subset: bool = True) -> str .. py:function:: chunk_shapes(*, shape: tuple[int, Ellipsis]) -> tuple[int, Ellipsis] .. py:function:: clear_store(x: zarr.abc.store.Store) -> zarr.abc.store.Store .. py:function:: dimension_names(*, ndim: int | None = None) -> list[None | str] | None .. py:function:: dtypes() -> hypothesis.strategies.SearchStrategy[numpy.dtype[Any]] .. py:function:: end_slices(*, shape: tuple[int, Ellipsis]) -> Any A strategy that slices ranges that include the last chunk. This is intended to stress-test handling of a possibly smaller last chunk. .. !! processed by numpydoc !! .. py:function:: is_negative_slice(idx: Any) -> bool .. py:function:: key_ranges(keys: hypothesis.strategies.SearchStrategy[str] = node_names, max_size: int = sys.maxsize) -> hypothesis.strategies.SearchStrategy[list[tuple[str, zarr.abc.store.RangeByteRequest]]] Function to generate key_ranges strategy for get_partial_values() returns list strategy w/ form:: [(key, (range_start, range_end)), (key, (range_start, range_end)),...] .. !! processed by numpydoc !! .. py:function:: keys(*, max_num_nodes: int | None = None) -> str .. py:function:: np_array_and_chunks(*, arrays: hypothesis.strategies.SearchStrategy[numpy.typing.NDArray[Any]] = numpy_arrays()) -> tuple[numpy.ndarray, tuple[int, Ellipsis]] A hypothesis strategy to generate small sized random arrays. Returns: a tuple of the array and a suitable random chunking for it. .. !! processed by numpydoc !! .. py:function:: numpy_arrays(*, shapes: hypothesis.strategies.SearchStrategy[tuple[int, Ellipsis]] = array_shapes, dtype: numpy.dtype[Any] | None = None) -> numpy.typing.NDArray[Any] Generate numpy arrays that can be saved in the provided Zarr format. .. !! processed by numpydoc !! .. py:function:: orthogonal_indices(*, shape: tuple[int, Ellipsis]) -> tuple[tuple[numpy.ndarray[Any, Any], Ellipsis], tuple[numpy.ndarray[Any, Any], Ellipsis]] Strategy that returns (1) a tuple of integer arrays used for orthogonal indexing of Zarr arrays. (2) an tuple of integer arrays that can be used for equivalent indexing of numpy arrays .. !! processed by numpydoc !! .. py:function:: paths(*, max_num_nodes: int | None = None) -> str .. py:function:: safe_unicode_for_dtype(dtype: numpy.dtype[numpy.str_]) -> hypothesis.strategies.SearchStrategy[str] Generate UTF-8-safe text constrained to max_len of dtype. .. !! processed by numpydoc !! .. py:function:: shard_shapes(*, shape: tuple[int, Ellipsis], chunk_shape: tuple[int, Ellipsis]) -> tuple[int, Ellipsis] .. py:function:: simple_arrays(*, shapes: hypothesis.strategies.SearchStrategy[tuple[int, Ellipsis]] = array_shapes) -> Any .. py:function:: v2_dtypes() -> hypothesis.strategies.SearchStrategy[numpy.dtype[Any]] .. py:function:: v3_dtypes() -> hypothesis.strategies.SearchStrategy[numpy.dtype[Any]] .. py:data:: array_names .. py:data:: array_shapes .. py:data:: attrs :type: hypothesis.strategies.SearchStrategy[collections.abc.Mapping[str, zarr.core.common.JSON] | None] .. py:data:: compressors .. py:data:: node_names .. py:data:: short_node_names .. py:data:: stores .. py:data:: zarr_formats :type: hypothesis.strategies.SearchStrategy[zarr.core.common.ZarrFormat] .. py:data:: zarr_key_chars