Skip to content

Commit 6422761

Browse files
committed
normalize more docstrings, and make docstring tests easier to interpret
1 parent 9802d1f commit 6422761

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

src/zarr/api/asynchronous.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -932,12 +932,12 @@ async def create(
932932
synchronizer : object, optional
933933
Array synchronizer.
934934
overwrite : bool, optional
935-
If True, delete all pre-existing data in `store` at `path` before
935+
If True, delete all pre-existing data in ``store`` at ``path`` before
936936
creating the array.
937937
path : str, optional
938938
Path under which array is stored.
939939
chunk_store : StoreLike or None, default=None
940-
Separate storage for chunks. If not provided, `store` will be used
940+
Separate storage for chunks. If not provided, ``store`` will be used
941941
for storage of both chunks and metadata.
942942
filters : Iterable[Codec] | Literal["auto"], optional
943943
Iterable of filters to apply to each chunk of the array, in order, before serializing that

src/zarr/api/synchronous.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -650,10 +650,10 @@ def create(
650650
shape : int or tuple of ints
651651
Array shape.
652652
chunks : int or tuple of ints, optional
653-
Chunk shape. If True, will be guessed from `shape` and `dtype`. If
654-
False, will be set to `shape`, i.e., single chunk for the whole array.
653+
Chunk shape. If True, will be guessed from ``shape`` and ``dtype``. If
654+
False, will be set to ``shape``, i.e., single chunk for the whole array.
655655
If an int, the chunk size in each dimension will be given by the value
656-
of `chunks`. Default is True.
656+
of ``chunks``. Default is True.
657657
dtype : str or dtype, optional
658658
NumPy dtype.
659659
compressor : Codec, optional
@@ -676,12 +676,12 @@ def create(
676676
synchronizer : object, optional
677677
Array synchronizer.
678678
overwrite : bool, optional
679-
If True, delete all pre-existing data in `store` at `path` before
679+
If True, delete all pre-existing data in ``store`` at ``path`` before
680680
creating the array.
681681
path : str, optional
682682
Path under which array is stored.
683683
chunk_store : StoreLike or None, default=None
684-
Separate storage for chunks. If not provided, `store` will be used
684+
Separate storage for chunks. If not provided, ``store`` will be used
685685
for storage of both chunks and metadata.
686686
filters : Iterable[Codec] | Literal["auto"], optional
687687
Iterable of filters to apply to each chunk of the array, in order, before serializing that
@@ -698,7 +698,7 @@ def create(
698698
type of the array and the Zarr format specified. For all data types in Zarr V3, and most
699699
data types in Zarr V2, the default filters are empty. The only cases where default filters
700700
are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
701-
`:class:zarr.dtype.VariableLengthUTF8` or `:class:zarr.dtype.VariableLengthUTF8`. In these cases,
701+
:class:`zarr.dtype.VariableLengthUTF8` or :class:`zarr.dtype.VariableLengthUTF8`. In these cases,
702702
the default filters contains a single element which is a codec specific to that particular data type.
703703
704704
To create an array with no filters, provide an empty iterable or the value ``None``.
@@ -863,7 +863,7 @@ def create_array(
863863
type of the array and the Zarr format specified. For all data types in Zarr V3, and most
864864
data types in Zarr V2, the default filters are empty. The only cases where default filters
865865
are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
866-
`:class:zarr.dtype.VariableLengthUTF8` or `:class:zarr.dtype.VariableLengthUTF8`. In these cases,
866+
:class:`zarr.dtype.VariableLengthUTF8` or :class:`zarr.dtype.VariableLengthUTF8`. In these cases,
867867
the default filters contains a single element which is a codec specific to that particular data type.
868868
869869
To create an array with no filters, provide an empty iterable or the value ``None``.
@@ -915,7 +915,7 @@ def create_array(
915915
Ignored otherwise.
916916
overwrite : bool, default False
917917
Whether to overwrite an array with the same name in the store, if one exists.
918-
If `True`, all existing paths in the store will be deleted.
918+
If ``True``, all existing paths in the store will be deleted.
919919
config : ArrayConfigLike, optional
920920
Runtime configuration for the array.
921921
write_data : bool

src/zarr/core/array.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4721,7 +4721,7 @@ async def create_array(
47214721
type of the array and the Zarr format specified. For all data types in Zarr V3, and most
47224722
data types in Zarr V2, the default filters are empty. The only cases where default filters
47234723
are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
4724-
`:class:zarr.dtype.VariableLengthUTF8` or `:class:zarr.dtype.VariableLengthUTF8`. In these cases,
4724+
:class:`zarr.dtype.VariableLengthUTF8` or :class:`zarr.dtype.VariableLengthUTF8`. In these cases,
47254725
the default filters contains a single element which is a codec specific to that particular data type.
47264726
47274727
To create an array with no filters, provide an empty iterable or the value ``None``.

src/zarr/core/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2651,7 +2651,7 @@ def create_array(
26512651
type of the array and the Zarr format specified. For all data types in Zarr V3, and most
26522652
data types in Zarr V2, the default filters are empty. The only cases where default filters
26532653
are not empty is when the Zarr format is 2, and the data type is a variable-length data type like
2654-
`:class:zarr.dtype.VariableLengthUTF8` or `:class:zarr.dtype.VariableLengthUTF8`. In these cases,
2654+
:class:`zarr.dtype.VariableLengthUTF8` or :class:`zarr.dtype.VariableLengthUTF8`. In these cases,
26552655
the default filters contains a single element which is a codec specific to that particular data type.
26562656
26572657
To create an array with no filters, provide an empty iterable or the value ``None``.

tests/test_api/test_synchronous.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
@pytest.mark.parametrize("callable_name", MATCHED_CALLABLE_NAMES)
26-
def test_docstring_match(callable_name: str) -> None:
26+
def test_docstrings_match(callable_name: str) -> None:
2727
"""
2828
Tests that the docstrings for the sync and async define identical parameters.
2929
"""
@@ -34,7 +34,11 @@ def test_docstring_match(callable_name: str) -> None:
3434
else:
3535
params_a = NumpyDocString(callable_a.__doc__)["Parameters"]
3636
params_b = NumpyDocString(callable_b.__doc__)["Parameters"]
37-
assert params_a == params_b
37+
mismatch = []
38+
for idx, (a, b) in enumerate(zip(params_a, params_b, strict=False)):
39+
if a != b:
40+
mismatch.append((idx, (a, b)))
41+
assert mismatch == []
3842

3943

4044
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)