Skip to content

Commit 06e5482

Browse files
committed
remove replace kwarg for _set_return_key
1 parent 8be3876 commit 06e5482

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/zarr/core/group.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,14 +3402,13 @@ async def _read_node(
34023402
return await _read_node_v2(store_path=store_path)
34033403
case 3:
34043404
return await _read_node_v3(store_path=store_path)
3405-
case _:
3405+
case _: # pragma: no cover
34063406
raise ValueError(f"Unexpected zarr format: {zarr_format}") # pragma: no cover
34073407

34083408

3409-
async def _set_return_key(*, store: Store, key: str, value: Buffer, replace: bool) -> str:
3409+
async def _set_return_key(*, store: Store, key: str, value: Buffer) -> str:
34103410
"""
3411-
Either write a value to storage at the given key, or ensure that there is already a value in
3412-
storage at the given key. The key is returned in either case.
3411+
Write a value to storage at the given key. The key is returned.
34133412
Useful when saving values via routines that return results in execution order,
34143413
like asyncio.as_completed, because in this case we need to know which key was saved in order
34153414
to yield the right object to the caller.
@@ -3422,14 +3421,8 @@ async def _set_return_key(*, store: Store, key: str, value: Buffer, replace: boo
34223421
The key to save the value to.
34233422
value : Buffer
34243423
The value to save.
3425-
replace : bool
3426-
If True, then the value will be written even if a value associated with the key
3427-
already exists in storage. If False, an existing value will not be overwritten.
34283424
"""
3429-
if replace:
3430-
await store.set(key, value)
3431-
else:
3432-
await store.set_if_not_exists(key, value)
3425+
await store.set(key, value)
34333426
return key
34343427

34353428

@@ -3442,7 +3435,7 @@ def _persist_metadata(
34423435

34433436
to_save = metadata.to_buffer_dict(default_buffer_prototype())
34443437
return tuple(
3445-
_set_return_key(store=store, key=_join_paths([path, key]), value=value, replace=True)
3438+
_set_return_key(store=store, key=_join_paths([path, key]), value=value)
34463439
for key, value in to_save.items()
34473440
)
34483441

0 commit comments

Comments
 (0)