Skip to content

Commit 2f87e95

Browse files
committed
Move config warning next to code that ignores order
1 parent e9118db commit 2f87e95

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/zarr/api/asynchronous.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from_array,
1818
get_array_metadata,
1919
)
20-
from zarr.core.array_spec import ArrayConfig, ArrayConfigLike, ArrayConfigParams
20+
from zarr.core.array_spec import ArrayConfigLike, ArrayConfigParams
2121
from zarr.core.buffer import NDArrayLike
2222
from zarr.core.common import (
2323
JSON,
@@ -1039,15 +1039,6 @@ async def create(
10391039
)
10401040
warnings.warn(UserWarning(msg), stacklevel=1)
10411041
config_dict["write_empty_chunks"] = write_empty_chunks
1042-
if order is not None and config is not None:
1043-
msg = (
1044-
"Both order and config keyword arguments are set. "
1045-
"This is redundant. When both are set, order will be ignored and "
1046-
"config will be used."
1047-
)
1048-
warnings.warn(UserWarning(msg), stacklevel=1)
1049-
1050-
config_parsed = ArrayConfig.from_dict(config_dict)
10511042

10521043
return await AsyncArray._create(
10531044
store_path,
@@ -1066,7 +1057,7 @@ async def create(
10661057
codecs=codecs,
10671058
dimension_names=dimension_names,
10681059
attributes=attributes,
1069-
config=config_parsed,
1060+
config=config,
10701061
**kwargs,
10711062
)
10721063

src/zarr/core/array.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,15 @@ async def _create(
584584
_chunks = normalize_chunks(chunks, shape, dtype_parsed.itemsize)
585585
else:
586586
_chunks = normalize_chunks(chunk_shape, shape, dtype_parsed.itemsize)
587+
588+
if order is not None and config is not None:
589+
msg = (
590+
"Both order and config keyword arguments are set. "
591+
"This is redundant. When both are set, order will be ignored and "
592+
"config will be used."
593+
)
594+
warnings.warn(UserWarning(msg), stacklevel=1)
595+
587596
config_parsed = parse_array_config(config)
588597

589598
result: AsyncArray[ArrayV3Metadata] | AsyncArray[ArrayV2Metadata]

0 commit comments

Comments
 (0)