1
1
from __future__ import annotations
2
2
3
3
from collections .abc import Mapping
4
- from typing import TYPE_CHECKING , Literal , Self , TypedDict , TypeGuard , overload
4
+ from typing import Literal , Self , TypedDict , TypeGuard , overload
5
5
6
6
from typing_extensions import ReadOnly
7
7
8
8
from zarr .codecs .numcodecs ._codecs import (
9
9
_NumcodecsChecksumCodec ,
10
10
_warn_unstable_specification ,
11
11
)
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
+ )
16
21
17
22
18
23
class Crc32Config (TypedDict ):
@@ -26,6 +31,7 @@ class Crc32JSON_V2(Crc32Config):
26
31
27
32
id : ReadOnly [Literal ["crc32" ]]
28
33
34
+
29
35
class Crc32JSON_V3_Legacy (NamedConfig [Literal ["numcodecs.crc32" ], Crc32Config ]):
30
36
"""Legacy JSON representation of CRC32 codec for Zarr V3."""
31
37
@@ -81,7 +87,7 @@ def to_json(self, zarr_format: Literal[3]) -> Crc32JSON_V3: ...
81
87
def to_json (self , zarr_format : ZarrFormat ) -> Crc32JSON_V2 | Crc32JSON_V3 :
82
88
_warn_unstable_specification (self )
83
89
return super ().to_json (zarr_format ) # type: ignore[return-value]
84
-
90
+
85
91
@classmethod
86
92
def _from_json_v2 (cls , data : CodecJSON_V2 ) -> Self :
87
93
return cls (** data )
@@ -97,4 +103,4 @@ def _from_json_v3(cls, data: CodecJSON_V3) -> Self:
97
103
def from_json (cls , data : CodecJSON ) -> Self :
98
104
if _check_codecjson_v2 (data ):
99
105
return cls ._from_json_v2 (data )
100
- return cls ._from_json_v3 (data )
106
+ return cls ._from_json_v3 (data )
0 commit comments