41
41
ArrayNotFoundError ,
42
42
GroupNotFoundError ,
43
43
NodeTypeValidationError ,
44
- ZarrDeprecationWarning ,
45
44
ZarrRuntimeWarning ,
46
45
ZarrUserWarning ,
47
46
)
@@ -166,22 +165,6 @@ def _like_args(a: ArrayLike) -> _LikeArgs:
166
165
return new
167
166
168
167
169
- def _handle_zarr_version_or_format (
170
- * , zarr_version : ZarrFormat | None , zarr_format : ZarrFormat | None
171
- ) -> ZarrFormat | None :
172
- """Handle the deprecated zarr_version kwarg and return zarr_format"""
173
- if zarr_format is not None and zarr_version is not None and zarr_format != zarr_version :
174
- raise ValueError (
175
- f"zarr_format { zarr_format } does not match zarr_version { zarr_version } , please only set one"
176
- )
177
- if zarr_version is not None :
178
- warnings .warn (
179
- "zarr_version is deprecated, use zarr_format" , ZarrDeprecationWarning , stacklevel = 2
180
- )
181
- return zarr_version
182
- return zarr_format
183
-
184
-
185
168
async def consolidate_metadata (
186
169
store : StoreLike ,
187
170
path : str | None = None ,
@@ -284,7 +267,6 @@ async def load(
284
267
store : StoreLike ,
285
268
path : str | None = None ,
286
269
zarr_format : ZarrFormat | None = None ,
287
- zarr_version : ZarrFormat | None = None ,
288
270
) -> NDArrayLikeOrScalar | dict [str , NDArrayLikeOrScalar ]:
289
271
"""Load data from an array or group into memory.
290
272
@@ -311,8 +293,6 @@ async def load(
311
293
If loading data from a group of arrays, data will not be immediately loaded into
312
294
memory. Rather, arrays will be loaded into memory as they are requested.
313
295
"""
314
- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
315
-
316
296
obj = await open (store = store , path = path , zarr_format = zarr_format )
317
297
if isinstance (obj , AsyncArray ):
318
298
return await obj .getitem (slice (None ))
@@ -324,7 +304,6 @@ async def open(
324
304
* ,
325
305
store : StoreLike | None = None ,
326
306
mode : AccessModeLiteral | None = None ,
327
- zarr_version : ZarrFormat | None = None , # deprecated
328
307
zarr_format : ZarrFormat | None = None ,
329
308
path : str | None = None ,
330
309
storage_options : dict [str , Any ] | None = None ,
@@ -358,7 +337,6 @@ async def open(
358
337
z : array or group
359
338
Return type depends on what exists in the given store.
360
339
"""
361
- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
362
340
if mode is None :
363
341
if isinstance (store , (Store , StorePath )) and store .read_only :
364
342
mode = "r"
@@ -409,7 +387,6 @@ async def open_consolidated(
409
387
async def save (
410
388
store : StoreLike ,
411
389
* args : NDArrayLike ,
412
- zarr_version : ZarrFormat | None = None , # deprecated
413
390
zarr_format : ZarrFormat | None = None ,
414
391
path : str | None = None ,
415
392
** kwargs : Any , # TODO: type kwargs as valid args to save
@@ -429,7 +406,6 @@ async def save(
429
406
**kwargs
430
407
NumPy arrays with data to save.
431
408
"""
432
- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
433
409
434
410
if len (args ) == 0 and len (kwargs ) == 0 :
435
411
raise ValueError ("at least one array must be provided" )
@@ -443,7 +419,6 @@ async def save_array(
443
419
store : StoreLike ,
444
420
arr : NDArrayLike ,
445
421
* ,
446
- zarr_version : ZarrFormat | None = None , # deprecated
447
422
zarr_format : ZarrFormat | None = None ,
448
423
path : str | None = None ,
449
424
storage_options : dict [str , Any ] | None = None ,
@@ -469,10 +444,7 @@ async def save_array(
469
444
**kwargs
470
445
Passed through to [`create`][zarr.api.asynchronous.create], e.g., compressor.
471
446
"""
472
- zarr_format = (
473
- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
474
- or _default_zarr_format ()
475
- )
447
+ zarr_format = zarr_format or _default_zarr_format ()
476
448
if not isinstance (arr , NDArrayLike ):
477
449
raise TypeError ("arr argument must be numpy or other NDArrayLike array" )
478
450
@@ -499,7 +471,6 @@ async def save_array(
499
471
async def save_group (
500
472
store : StoreLike ,
501
473
* args : NDArrayLike ,
502
- zarr_version : ZarrFormat | None = None , # deprecated
503
474
zarr_format : ZarrFormat | None = None ,
504
475
path : str | None = None ,
505
476
storage_options : dict [str , Any ] | None = None ,
@@ -527,13 +498,7 @@ async def save_group(
527
498
528
499
store_path = await make_store_path (store , path = path , mode = "w" , storage_options = storage_options )
529
500
530
- zarr_format = (
531
- _handle_zarr_version_or_format (
532
- zarr_version = zarr_version ,
533
- zarr_format = zarr_format ,
534
- )
535
- or _default_zarr_format ()
536
- )
501
+ zarr_format = zarr_format or _default_zarr_format ()
537
502
538
503
for arg in args :
539
504
if not isinstance (arg , NDArrayLike ):
@@ -624,7 +589,6 @@ async def group(
624
589
cache_attrs : bool | None = None , # not used, default changed
625
590
synchronizer : Any | None = None , # not used
626
591
path : str | None = None ,
627
- zarr_version : ZarrFormat | None = None , # deprecated
628
592
zarr_format : ZarrFormat | None = None ,
629
593
meta_array : Any | None = None , # not used
630
594
attributes : dict [str , JSON ] | None = None ,
@@ -675,7 +639,6 @@ async def group(
675
639
cache_attrs = cache_attrs ,
676
640
synchronizer = synchronizer ,
677
641
path = path ,
678
- zarr_version = zarr_version ,
679
642
zarr_format = zarr_format ,
680
643
meta_array = meta_array ,
681
644
attributes = attributes ,
@@ -742,7 +705,6 @@ async def open_group(
742
705
path : str | None = None ,
743
706
chunk_store : StoreLike | None = None , # not used
744
707
storage_options : dict [str , Any ] | None = None ,
745
- zarr_version : ZarrFormat | None = None , # deprecated
746
708
zarr_format : ZarrFormat | None = None ,
747
709
meta_array : Any | None = None , # not used
748
710
attributes : dict [str , JSON ] | None = None ,
@@ -810,8 +772,6 @@ async def open_group(
810
772
The new group.
811
773
"""
812
774
813
- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
814
-
815
775
if cache_attrs is not None :
816
776
warnings .warn ("cache_attrs is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
817
777
if synchronizer is not None :
@@ -865,7 +825,6 @@ async def create(
865
825
object_codec : Codec | None = None , # TODO: type has changed
866
826
dimension_separator : Literal ["." , "/" ] | None = None ,
867
827
write_empty_chunks : bool | None = None ,
868
- zarr_version : ZarrFormat | None = None , # deprecated
869
828
zarr_format : ZarrFormat | None = None ,
870
829
meta_array : Any | None = None , # TODO: need type
871
830
attributes : dict [str , JSON ] | None = None ,
@@ -1005,10 +964,7 @@ async def create(
1005
964
z : array
1006
965
The array.
1007
966
"""
1008
- zarr_format = (
1009
- _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1010
- or _default_zarr_format ()
1011
- )
967
+ zarr_format = zarr_format or _default_zarr_format ()
1012
968
1013
969
if synchronizer is not None :
1014
970
warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
@@ -1212,7 +1168,6 @@ async def ones_like(
1212
1168
async def open_array (
1213
1169
* , # note: this is a change from v2
1214
1170
store : StoreLike | None = None ,
1215
- zarr_version : ZarrFormat | None = None , # deprecated
1216
1171
zarr_format : ZarrFormat | None = None ,
1217
1172
path : PathLike = "" ,
1218
1173
storage_options : dict [str , Any ] | None = None ,
@@ -1224,8 +1179,6 @@ async def open_array(
1224
1179
----------
1225
1180
store : StoreLike
1226
1181
Store or path to directory in file system or name of zip file.
1227
- zarr_version : {2, 3, None}, optional
1228
- The zarr format to use when saving. Deprecated in favor of zarr_format.
1229
1182
zarr_format : {2, 3, None}, optional
1230
1183
The zarr format to use when saving.
1231
1184
path : str, optional
@@ -1245,8 +1198,6 @@ async def open_array(
1245
1198
mode = kwargs .pop ("mode" , None )
1246
1199
store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
1247
1200
1248
- zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
1249
-
1250
1201
if "write_empty_chunks" in kwargs :
1251
1202
_warn_write_empty_chunks_kwarg ()
1252
1203
0 commit comments