Skip to content

Commit dc641fe

Browse files
kgabord-v-b
andauthored
Add default value to init_array config param. Update docstring. (#3391)
* Make config in init_array optional * Add default value to init_array config param. * Update docstring. * Add changelog entry. * Fix type casting typo. * Update src/zarr/core/array.py * Update src/zarr/core/array.py * reformat docstring --------- Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
1 parent 7970f4a commit dc641fe

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

changes/3391.feature.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make config param optional in init_array

src/zarr/core/array.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4444,7 +4444,7 @@ async def init_array(
44444444
chunk_key_encoding: ChunkKeyEncodingLike | None = None,
44454445
dimension_names: DimensionNames = None,
44464446
overwrite: bool = False,
4447-
config: ArrayConfigLike | None,
4447+
config: ArrayConfigLike | None = None,
44484448
) -> AsyncArray[ArrayV3Metadata] | AsyncArray[ArrayV2Metadata]:
44494449
"""Create and persist an array metadata document.
44504450
@@ -4524,8 +4524,10 @@ async def init_array(
45244524
Zarr format 3 only. Zarr format 2 arrays should not use this parameter.
45254525
overwrite : bool, default False
45264526
Whether to overwrite an array with the same name in the store, if one exists.
4527-
config : ArrayConfigLike or None, optional
4527+
config : ArrayConfigLike or None, default=None
45284528
Configuration for this array.
4529+
If ``None``, the default array runtime configuration will be used. This default
4530+
is stored in the global configuration object.
45294531
45304532
Returns
45314533
-------

src/zarr/testing/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ def has_cupy() -> bool:
4646

4747
# Decorator for GPU tests
4848
def gpu_test(func: T) -> T:
49-
return cast("T", gpu_mark(skip_if_no_gpu(func)))
49+
return cast(T, gpu_mark(skip_if_no_gpu(func)))

tests/test_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,6 @@ async def test_init_order_warns() -> None:
440440
store_path=StorePath(store=MemoryStore()),
441441
shape=(1,),
442442
dtype="uint8",
443-
config=None,
444443
zarr_format=3,
445444
order="F",
446445
)

0 commit comments

Comments
 (0)