Skip to content

Commit 2927797

Browse files
committed
simplify preparedwrite
1 parent 4305dc0 commit 2927797

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

src/zarr/abc/codec.py

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from abc import abstractmethod
44
from collections.abc import Mapping
5-
from dataclasses import dataclass, field
5+
from dataclasses import dataclass
66
from typing import TYPE_CHECKING, Any, Generic, Protocol, TypeGuard, TypeVar, runtime_checkable
77

88
from typing_extensions import ReadOnly, TypedDict
@@ -232,31 +232,12 @@ class PreparedWrite:
232232
----------
233233
chunk_dict : dict[tuple[int, ...], Buffer | None]
234234
Per-inner-chunk buffers keyed by chunk coordinates.
235-
inner_codec_chain : SupportsChunkCodec
236-
The [`SupportsChunkCodec`][zarr.abc.codec.SupportsChunkCodec] for
237-
decoding/encoding inner chunks.
238-
inner_chunk_spec : ArraySpec
239-
The [`ArraySpec`][zarr.core.array_spec.ArraySpec] for inner chunks.
240235
indexer : list[ChunkProjection]
241236
Mapping from inner-chunk coordinates to value/output selections.
242-
value_selection : SelectorTuple | None
243-
Outer ``out_selection`` for sharding. Unused by the base implementation.
244-
write_full_shard : bool
245-
Whether the full shard blob will be written. Unused by the base implementation.
246-
is_complete_shard : bool
247-
Fast-path flag for complete shard writes. Unused by the base implementation.
248-
shard_data : NDBuffer | None
249-
Full shard value for complete writes. Unused by the base implementation.
250237
"""
251238

252239
chunk_dict: dict[tuple[int, ...], Buffer | None]
253-
inner_codec_chain: SupportsChunkCodec
254-
inner_chunk_spec: ArraySpec
255240
indexer: list[ChunkProjection]
256-
value_selection: SelectorTuple | None = None
257-
write_full_shard: bool = True
258-
is_complete_shard: bool = False
259-
shard_data: NDBuffer | None = field(default=None)
260241

261242

262243
class ArrayBytesCodec(BaseCodec[NDBuffer, Buffer]):
@@ -374,7 +355,6 @@ def prepare_write_sync(
374355
chunk_selection: SelectorTuple,
375356
out_selection: SelectorTuple,
376357
replace: bool,
377-
codec_chain: SupportsChunkCodec,
378358
) -> PreparedWrite:
379359
"""Prepare a synchronous write by optionally reading existing data.
380360
@@ -397,9 +377,6 @@ def prepare_write_sync(
397377
If ``True``, the write replaces all data in the chunk and no
398378
read-modify-write is needed. If ``False``, existing data is
399379
fetched first.
400-
codec_chain : SupportsChunkCodec
401-
The [`SupportsChunkCodec`][zarr.abc.codec.SupportsChunkCodec] used to
402-
decode/encode the chunk.
403380
404381
Returns
405382
-------
@@ -411,11 +388,8 @@ def prepare_write_sync(
411388
if not replace:
412389
existing = byte_setter.get_sync(prototype=chunk_spec.prototype)
413390
chunk_dict = self.deserialize(existing, chunk_spec)
414-
inner_chain = self.inner_codec_chain or codec_chain
415391
return PreparedWrite(
416392
chunk_dict=chunk_dict,
417-
inner_codec_chain=inner_chain,
418-
inner_chunk_spec=chunk_spec,
419393
indexer=[
420394
( # type: ignore[list-item]
421395
(0,),
@@ -500,7 +474,6 @@ async def prepare_write(
500474
chunk_selection: SelectorTuple,
501475
out_selection: SelectorTuple,
502476
replace: bool,
503-
codec_chain: SupportsChunkCodec,
504477
) -> PreparedWrite:
505478
"""Async variant of
506479
[`prepare_write_sync`][zarr.abc.codec.ArrayBytesCodec.prepare_write_sync].
@@ -520,9 +493,6 @@ async def prepare_write(
520493
If ``True``, the write replaces all data in the chunk and no
521494
read-modify-write is needed. If ``False``, existing data is
522495
fetched first.
523-
codec_chain : SupportsChunkCodec
524-
The [`SupportsChunkCodec`][zarr.abc.codec.SupportsChunkCodec] used to
525-
decode/encode the chunk.
526496
527497
Returns
528498
-------
@@ -534,11 +504,8 @@ async def prepare_write(
534504
if not replace:
535505
existing = await byte_setter.get(prototype=chunk_spec.prototype)
536506
chunk_dict = self.deserialize(existing, chunk_spec)
537-
inner_chain = self.inner_codec_chain or codec_chain
538507
return PreparedWrite(
539508
chunk_dict=chunk_dict,
540-
inner_codec_chain=inner_chain,
541-
inner_chunk_spec=chunk_spec,
542509
indexer=[
543510
( # type: ignore[list-item]
544511
(0,),

0 commit comments

Comments
 (0)