Skip to content

Commit 68465db

Browse files
committed
docstrings
1 parent e204a32 commit 68465db

File tree

4 files changed

+29
-25
lines changed

4 files changed

+29
-25
lines changed

src/zarr/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"create",
5454
"create_array",
5555
"create_group",
56-
"read_array",
5756
"empty",
5857
"empty_like",
5958
"full",
@@ -63,12 +62,13 @@
6362
"ones",
6463
"ones_like",
6564
"open",
66-
"read",
6765
"open_array",
6866
"open_consolidated",
6967
"open_group",
70-
"read_group",
7168
"open_like",
69+
"read",
70+
"read_array",
71+
"read_group",
7272
"save",
7373
"save_array",
7474
"save_group",

src/zarr/api/asynchronous.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -952,46 +952,48 @@ async def create_array(
952952
dimension_names: Iterable[str] | None = None,
953953
storage_options: dict[str, Any] | None = None,
954954
overwrite: bool = False,
955-
config: ArrayConfig | ArrayConfigParams | None = None
955+
config: ArrayConfig | ArrayConfigParams | None = None,
956956
) -> AsyncArray[ArrayV2Metadata] | AsyncArray[ArrayV3Metadata]:
957957
"""Create an array.
958958
959959
Parameters
960960
----------
961-
store: str or Store
961+
store : str or Store
962962
Store or path to directory in file system or name of zip file.
963-
path: str or None, optional
963+
path : str or None, optional
964964
The name of the array within the store. If ``path`` is ``None``, the array will be located
965965
at the root of the store.
966-
shape: ChunkCoords
966+
shape : ChunkCoords
967967
Shape of the array.
968-
dtype: npt.DTypeLike
968+
dtype : npt.DTypeLike
969969
Data type of the array.
970-
chunk_shape: ChunkCoords
970+
chunk_shape : ChunkCoords
971971
Chunk shape of the array.
972-
shard_shape: ChunkCoords | None
973-
Shard shape of the array.
974-
filters: Iterable[Codec], optional
972+
shard_shape : ChunkCoords, optional
973+
Shard shape of the array. The default value of ``None`` results in no sharding at all.
974+
filters : Iterable[Codec], optional
975975
List of filters to apply to the array.
976-
compressors: Iterable[Codec], optional
976+
compressors : Iterable[Codec], optional
977977
List of compressors to apply to the array.
978-
fill_value: Any, optional
978+
fill_value : Any, optional
979979
Fill value for the array.
980-
order: {"C", "F"}, optional
980+
order : {"C", "F"}, optional
981981
Memory layout of the array.
982-
zarr_format: {2, 3}, optional
982+
zarr_format : {2, 3}, optional
983983
The zarr format to use when saving.
984-
attributes: dict, optional
984+
attributes : dict, optional
985985
Attributes for the array.
986-
chunk_key_encoding: ChunkKeyEncoding, optional
986+
chunk_key_encoding : ChunkKeyEncoding, optional
987987
The chunk key encoding to use.
988-
dimension_names: Iterable[str], optional
988+
dimension_names : Iterable[str], optional
989989
Dimension names for the array.
990-
storage_options: dict, optional
990+
storage_options : dict, optional
991991
If using an fsspec URL to create the store, these will be passed to the backend implementation.
992992
Ignored otherwise.
993-
overwrite: bool, default False
993+
overwrite : bool, default False
994994
Whether to overwrite an array with the same name in the store, if one exists.
995+
config : ArrayConfig or ArrayConfigParams, optional
996+
Runtime configuration for the array.
995997
996998
Returns
997999
-------
@@ -1026,7 +1028,7 @@ async def create_array(
10261028
if dimension_names is not None:
10271029
raise ValueError("Zarr v2 arrays do not support dimension names.")
10281030
if order is None:
1029-
order_parsed = zarr_config.get('array.order')
1031+
order_parsed = zarr_config.get("array.order")
10301032
else:
10311033
order_parsed = order
10321034
return await AsyncArray._create_v2(
@@ -1071,7 +1073,7 @@ async def create_array(
10711073
codecs=codecs,
10721074
dimension_names=dimension_names,
10731075
overwrite=overwrite,
1074-
config=config_parsed
1076+
config=config_parsed,
10751077
)
10761078

10771079

src/zarr/codecs/sharding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
396396
return replace(self, codecs=evolved_codecs)
397397
return self
398398

399-
def validate(self, *, shape: ChunkCoords, dtype: np.dtype[Any], chunk_grid: ChunkGrid) -> None:
399+
def validate(
400+
self, *, shape: ChunkCoords, dtype: np.dtype[np.generic], chunk_grid: ChunkGrid
401+
) -> None:
400402
if len(self.chunk_shape) != len(shape):
401403
raise ValueError(
402404
"The shard's `chunk_shape` and array's `shape` need to have the same number of dimensions."

src/zarr/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def parse_bool(data: Any) -> bool:
167167
raise ValueError(f"Expected bool, got {data} instead.")
168168

169169

170-
def parse_dtype(dtype: Any, zarr_format: ZarrFormat) -> np.dtype[Any]:
170+
def parse_dtype(dtype: Any, zarr_format: ZarrFormat) -> np.dtype[np.generic]:
171171
if dtype is str or dtype == "str":
172172
if zarr_format == 2:
173173
# special case as object

0 commit comments

Comments
 (0)