@@ -169,22 +169,6 @@ def _like_args(a: ArrayLike) -> _LikeArgs:
169169 return new
170170
171171
172- def _handle_zarr_version_or_format (
173- * , zarr_version : ZarrFormat | None , zarr_format : ZarrFormat | None
174- ) -> ZarrFormat | None :
175- """Handle the deprecated zarr_version kwarg and return zarr_format"""
176- if zarr_format is not None and zarr_version is not None and zarr_format != zarr_version :
177- raise ValueError (
178- f"zarr_format { zarr_format } does not match zarr_version { zarr_version } , please only set one"
179- )
180- if zarr_version is not None :
181- warnings .warn (
182- "zarr_version is deprecated, use zarr_format" , ZarrDeprecationWarning , stacklevel = 2
183- )
184- return zarr_version
185- return zarr_format
186-
187-
188172async def consolidate_metadata (
189173 store : StoreLike ,
190174 path : str | None = None ,
@@ -289,7 +273,6 @@ async def load(
289273 store : StoreLike ,
290274 path : str | None = None ,
291275 zarr_format : ZarrFormat | None = None ,
292- zarr_version : ZarrFormat | None = None ,
293276) -> NDArrayLikeOrScalar | dict [str , NDArrayLikeOrScalar ]:
294277 """Load data from an array or group into memory.
295278
@@ -318,7 +301,6 @@ async def load(
318301 If loading data from a group of arrays, data will not be immediately loaded into
319302 memory. Rather, arrays will be loaded into memory as they are requested.
320303 """
321- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
322304
323305 obj = await open (store = store , path = path , zarr_format = zarr_format )
324306 if isinstance (obj , AsyncArray ):
@@ -331,7 +313,6 @@ async def open(
331313 * ,
332314 store : StoreLike | None = None ,
333315 mode : AccessModeLiteral | None = None ,
334- zarr_version : ZarrFormat | None = None , # deprecated
335316 zarr_format : ZarrFormat | None = None ,
336317 path : str | None = None ,
337318 storage_options : dict [str , Any ] | None = None ,
@@ -367,7 +348,7 @@ async def open(
367348 z : array or group
368349 Return type depends on what exists in the given store.
369350 """
370- zarr_format = _handle_zarr_version_or_format ( zarr_version = zarr_version , zarr_format = zarr_format )
351+
371352 if mode is None :
372353 if isinstance (store , (Store , StorePath )) and store .read_only :
373354 mode = "r"
@@ -418,7 +399,6 @@ async def open_consolidated(
418399async def save (
419400 store : StoreLike ,
420401 * args : NDArrayLike ,
421- zarr_version : ZarrFormat | None = None , # deprecated
422402 zarr_format : ZarrFormat | None = None ,
423403 path : str | None = None ,
424404 ** kwargs : Any , # TODO: type kwargs as valid args to save
@@ -440,7 +420,6 @@ async def save(
440420 **kwargs
441421 NumPy arrays with data to save.
442422 """
443- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
444423
445424 if len (args ) == 0 and len (kwargs ) == 0 :
446425 raise ValueError ("at least one array must be provided" )
@@ -454,7 +433,6 @@ async def save_array(
454433 store : StoreLike ,
455434 arr : NDArrayLike ,
456435 * ,
457- zarr_version : ZarrFormat | None = None , # deprecated
458436 zarr_format : ZarrFormat | None = None ,
459437 path : str | None = None ,
460438 storage_options : dict [str , Any ] | None = None ,
@@ -482,10 +460,8 @@ async def save_array(
482460 **kwargs
483461 Passed through to [`create`][zarr.api.asynchronous.create], e.g., compressor.
484462 """
485- zarr_format = (
486- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
487- or _default_zarr_format ()
488- )
463+ if zarr_format is None :
464+ zarr_format = _default_zarr_format ()
489465 if not isinstance (arr , NDArrayLike ):
490466 raise TypeError ("arr argument must be numpy or other NDArrayLike array" )
491467
@@ -512,7 +488,6 @@ async def save_array(
512488async def save_group (
513489 store : StoreLike ,
514490 * args : NDArrayLike ,
515- zarr_version : ZarrFormat | None = None , # deprecated
516491 zarr_format : ZarrFormat | None = None ,
517492 path : str | None = None ,
518493 storage_options : dict [str , Any ] | None = None ,
@@ -542,13 +517,8 @@ async def save_group(
542517
543518 store_path = await make_store_path (store , path = path , mode = "w" , storage_options = storage_options )
544519
545- zarr_format = (
546- _handle_zarr_version_or_format (
547- zarr_version = zarr_version ,
548- zarr_format = zarr_format ,
549- )
550- or _default_zarr_format ()
551- )
520+ if zarr_format is None :
521+ zarr_format = _default_zarr_format ()
552522
553523 for arg in args :
554524 if not isinstance (arg , NDArrayLike ):
@@ -662,7 +632,6 @@ async def group(
662632 cache_attrs : bool | None = None , # not used, default changed
663633 synchronizer : Any | None = None , # not used
664634 path : str | None = None ,
665- zarr_version : ZarrFormat | None = None , # deprecated
666635 zarr_format : ZarrFormat | None = None ,
667636 meta_array : Any | None = None , # not used
668637 attributes : dict [str , JSON ] | None = None ,
@@ -715,7 +684,6 @@ async def group(
715684 cache_attrs = cache_attrs ,
716685 synchronizer = synchronizer ,
717686 path = path ,
718- zarr_version = zarr_version ,
719687 zarr_format = zarr_format ,
720688 meta_array = meta_array ,
721689 attributes = attributes ,
@@ -784,7 +752,6 @@ async def open_group(
784752 path : str | None = None ,
785753 chunk_store : StoreLike | None = None , # not used
786754 storage_options : dict [str , Any ] | None = None ,
787- zarr_version : ZarrFormat | None = None , # deprecated
788755 zarr_format : ZarrFormat | None = None ,
789756 meta_array : Any | None = None , # not used
790757 attributes : dict [str , JSON ] | None = None ,
@@ -846,8 +813,6 @@ async def open_group(
846813 The new group.
847814 """
848815
849- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
850-
851816 if cache_attrs is not None :
852817 warnings .warn ("cache_attrs is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
853818 if synchronizer is not None :
@@ -901,7 +866,6 @@ async def create(
901866 object_codec : Codec | None = None , # TODO: type has changed
902867 dimension_separator : Literal ["." , "/" ] | None = None ,
903868 write_empty_chunks : bool | None = None ,
904- zarr_version : ZarrFormat | None = None , # deprecated
905869 zarr_format : ZarrFormat | None = None ,
906870 meta_array : Any | None = None , # TODO: need type
907871 attributes : dict [str , JSON ] | None = None ,
@@ -1043,10 +1007,8 @@ async def create(
10431007 z : array
10441008 The array.
10451009 """
1046- zarr_format = (
1047- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1048- or _default_zarr_format ()
1049- )
1010+ if zarr_format is None :
1011+ zarr_format = _default_zarr_format ()
10501012
10511013 if synchronizer is not None :
10521014 warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
@@ -1238,7 +1200,6 @@ async def ones_like(a: ArrayLike, **kwargs: Any) -> AnyAsyncArray:
12381200async def open_array (
12391201 * , # note: this is a change from v2
12401202 store : StoreLike | None = None ,
1241- zarr_version : ZarrFormat | None = None , # deprecated
12421203 zarr_format : ZarrFormat | None = None ,
12431204 path : PathLike = "" ,
12441205 storage_options : dict [str , Any ] | None = None ,
@@ -1252,8 +1213,6 @@ async def open_array(
12521213 StoreLike object to open. See the
12531214 [storage documentation in the user guide][user-guide-store-like]
12541215 for a description of all valid StoreLike values.
1255- zarr_version : {2, 3, None}, optional
1256- The zarr format to use when saving. Deprecated in favor of zarr_format.
12571216 zarr_format : {2, 3, None}, optional
12581217 The zarr format to use when saving.
12591218 path : str, optional
@@ -1273,8 +1232,6 @@ async def open_array(
12731232 mode = kwargs .pop ("mode" , None )
12741233 store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
12751234
1276- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1277-
12781235 if "write_empty_chunks" in kwargs :
12791236 _warn_write_empty_chunks_kwarg ()
12801237
0 commit comments