11from __future__ import annotations
22
33from collections .abc import Mapping
4- from typing import TYPE_CHECKING , Literal , Self , TypedDict , TypeGuard , overload
4+ from typing import Literal , Self , TypedDict , TypeGuard , overload
55
66from typing_extensions import ReadOnly
77
88from zarr .codecs .numcodecs ._codecs import (
99 _NumcodecsChecksumCodec ,
1010 _warn_unstable_specification ,
1111)
12- from zarr .core .common import CodecJSON , CodecJSON_V2 , CodecJSON_V3 , NamedConfig , ZarrFormat , _check_codecjson_v2 , _check_codecjson_v3
13-
14- if TYPE_CHECKING :
15- pass
12+ from zarr .core .common import (
13+ CodecJSON ,
14+ CodecJSON_V2 ,
15+ CodecJSON_V3 ,
16+ NamedConfig ,
17+ ZarrFormat ,
18+ _check_codecjson_v2 ,
19+ _check_codecjson_v3 ,
20+ )
1621
1722
1823class Crc32Config (TypedDict ):
@@ -26,6 +31,7 @@ class Crc32JSON_V2(Crc32Config):
2631
2732 id : ReadOnly [Literal ["crc32" ]]
2833
34+
2935class Crc32JSON_V3_Legacy (NamedConfig [Literal ["numcodecs.crc32" ], Crc32Config ]):
3036 """Legacy JSON representation of CRC32 codec for Zarr V3."""
3137
@@ -81,7 +87,7 @@ def to_json(self, zarr_format: Literal[3]) -> Crc32JSON_V3: ...
8187 def to_json (self , zarr_format : ZarrFormat ) -> Crc32JSON_V2 | Crc32JSON_V3 :
8288 _warn_unstable_specification (self )
8389 return super ().to_json (zarr_format ) # type: ignore[return-value]
84-
90+
8591 @classmethod
8692 def _from_json_v2 (cls , data : CodecJSON_V2 ) -> Self :
8793 return cls (** data )
@@ -97,4 +103,4 @@ def _from_json_v3(cls, data: CodecJSON_V3) -> Self:
97103 def from_json (cls , data : CodecJSON ) -> Self :
98104 if _check_codecjson_v2 (data ):
99105 return cls ._from_json_v2 (data )
100- return cls ._from_json_v3 (data )
106+ return cls ._from_json_v3 (data )
0 commit comments