39
39
create_hierarchy ,
40
40
)
41
41
from zarr .core .metadata import ArrayMetadataDict , ArrayV2Metadata , ArrayV3Metadata
42
- from zarr .errors import GroupNotFoundError , NodeTypeValidationError
42
+ from zarr .errors import (
43
+ GroupNotFoundError ,
44
+ NodeTypeValidationError ,
45
+ ZarrDeprecationWarning ,
46
+ ZarrRuntimeWarning ,
47
+ ZarrUserWarning ,
48
+ )
43
49
from zarr .storage import StorePath
44
50
from zarr .storage ._common import make_store_path
45
51
@@ -162,7 +168,7 @@ def _handle_zarr_version_or_format(
162
168
)
163
169
if zarr_version is not None :
164
170
warnings .warn (
165
- "zarr_version is deprecated, use zarr_format" , DeprecationWarning , stacklevel = 2
171
+ "zarr_version is deprecated, use zarr_format" , ZarrDeprecationWarning , stacklevel = 2
166
172
)
167
173
return zarr_version
168
174
return zarr_format
@@ -228,7 +234,7 @@ async def consolidate_metadata(
228
234
warnings .warn (
229
235
"Consolidated metadata is currently not part in the Zarr format 3 specification. It "
230
236
"may not be supported by other zarr implementations and may change in the future." ,
231
- category = UserWarning ,
237
+ category = ZarrUserWarning ,
232
238
stacklevel = 1 ,
233
239
)
234
240
@@ -536,7 +542,7 @@ async def save_group(
536
542
await asyncio .gather (* aws )
537
543
538
544
539
- @deprecated ("Use AsyncGroup.tree instead." )
545
+ @deprecated ("Use AsyncGroup.tree instead." , category = ZarrDeprecationWarning )
540
546
async def tree (grp : AsyncGroup , expand : bool | None = None , level : int | None = None ) -> Any :
541
547
"""Provide a rich display of the hierarchy.
542
548
@@ -674,13 +680,13 @@ async def group(
674
680
store_path = await make_store_path (store , path = path , mode = mode , storage_options = storage_options )
675
681
676
682
if chunk_store is not None :
677
- warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
683
+ warnings .warn ("chunk_store is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
678
684
if cache_attrs is not None :
679
- warnings .warn ("cache_attrs is not yet implemented" , RuntimeWarning , stacklevel = 2 )
685
+ warnings .warn ("cache_attrs is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
680
686
if synchronizer is not None :
681
- warnings .warn ("synchronizer is not yet implemented" , RuntimeWarning , stacklevel = 2 )
687
+ warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
682
688
if meta_array is not None :
683
- warnings .warn ("meta_array is not yet implemented" , RuntimeWarning , stacklevel = 2 )
689
+ warnings .warn ("meta_array is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
684
690
685
691
if attributes is None :
686
692
attributes = {}
@@ -827,13 +833,13 @@ async def open_group(
827
833
zarr_format = _handle_zarr_version_or_format (zarr_version = zarr_version , zarr_format = zarr_format )
828
834
829
835
if cache_attrs is not None :
830
- warnings .warn ("cache_attrs is not yet implemented" , RuntimeWarning , stacklevel = 2 )
836
+ warnings .warn ("cache_attrs is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
831
837
if synchronizer is not None :
832
- warnings .warn ("synchronizer is not yet implemented" , RuntimeWarning , stacklevel = 2 )
838
+ warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
833
839
if meta_array is not None :
834
- warnings .warn ("meta_array is not yet implemented" , RuntimeWarning , stacklevel = 2 )
840
+ warnings .warn ("meta_array is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
835
841
if chunk_store is not None :
836
- warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
842
+ warnings .warn ("chunk_store is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
837
843
838
844
store_path = await make_store_path (store , mode = mode , storage_options = storage_options , path = path )
839
845
if attributes is None :
@@ -1011,19 +1017,19 @@ async def create(
1011
1017
)
1012
1018
1013
1019
if synchronizer is not None :
1014
- warnings .warn ("synchronizer is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1020
+ warnings .warn ("synchronizer is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1015
1021
if chunk_store is not None :
1016
- warnings .warn ("chunk_store is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1022
+ warnings .warn ("chunk_store is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1017
1023
if cache_metadata is not None :
1018
- warnings .warn ("cache_metadata is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1024
+ warnings .warn ("cache_metadata is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1019
1025
if cache_attrs is not None :
1020
- warnings .warn ("cache_attrs is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1026
+ warnings .warn ("cache_attrs is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1021
1027
if object_codec is not None :
1022
- warnings .warn ("object_codec is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1028
+ warnings .warn ("object_codec is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1023
1029
if read_only is not None :
1024
- warnings .warn ("read_only is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1030
+ warnings .warn ("read_only is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1025
1031
if meta_array is not None :
1026
- warnings .warn ("meta_array is not yet implemented" , RuntimeWarning , stacklevel = 2 )
1032
+ warnings .warn ("meta_array is not yet implemented" , ZarrRuntimeWarning , stacklevel = 2 )
1027
1033
1028
1034
if write_empty_chunks is not None :
1029
1035
_warn_write_empty_chunks_kwarg ()
@@ -1042,7 +1048,7 @@ async def create(
1042
1048
"This is redundant. When both are set, write_empty_chunks will be used instead "
1043
1049
"of the value in config."
1044
1050
)
1045
- warnings .warn (UserWarning (msg ), stacklevel = 1 )
1051
+ warnings .warn (ZarrUserWarning (msg ), stacklevel = 1 )
1046
1052
config_parsed = dataclasses .replace (config_parsed , write_empty_chunks = write_empty_chunks )
1047
1053
1048
1054
return await AsyncArray ._create (
0 commit comments