Skip to content

Commit dfd672b

Browse files
dstansbyd-v-b
andauthored
Fix type of v2 compressors (#3232)
* Fix type of v2 compressors * Add bugfix entry --------- Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
1 parent 7154f98 commit dfd672b

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

changes/3232.bugfix.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the type of ``ArrayV2Metadata.codec`` to constrain it to ``numcodecs.abc.Codec | None``.
2+
Previously the type was more permissive, allowing objects that can be parsed into Codecs (e.g., the codec name).
3+
The constructor of ``ArrayV2Metadata`` still allows the permissive input when creating new objects.

src/zarr/core/metadata/v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ArrayV2Metadata(Metadata):
6868
order: MemoryOrder = "C"
6969
filters: tuple[numcodecs.abc.Codec, ...] | None = None
7070
dimension_separator: Literal[".", "/"] = "."
71-
compressor: CompressorLikev2
71+
compressor: numcodecs.abc.Codec | None
7272
attributes: dict[str, JSON] = field(default_factory=dict)
7373
zarr_format: Literal[2] = field(init=False, default=2)
7474

0 commit comments

Comments
 (0)