Skip to content

Commit aa3f708

Browse files
committed
pre-commit
1 parent 5a956a9 commit aa3f708

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

numcodecs/zarr3.py

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ def make_bytes_bytes_codec(codec_id: str, cls_name: str) -> type[NumcodecsBytesB
144144
_codec_id = codec_id
145145

146146
class _Codec(NumcodecsBytesBytesCodec):
147-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
147+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
148+
if codec_config is None:
149+
codec_config = {}
148150
super().__init__(codec_id=_codec_id, codec_config=codec_config)
149151

150152
_Codec.__name__ = cls_name
@@ -156,7 +158,9 @@ def make_array_array_codec(codec_id: str, cls_name: str) -> type[NumcodecsArrayA
156158
_codec_id = codec_id
157159

158160
class _Codec(NumcodecsArrayArrayCodec):
159-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
161+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
162+
if codec_config is None:
163+
codec_config = {}
160164
super().__init__(codec_id=_codec_id, codec_config=codec_config)
161165

162166
_Codec.__name__ = cls_name
@@ -168,7 +172,9 @@ def make_array_bytes_codec(codec_id: str, cls_name: str) -> type[NumcodecsArrayB
168172
_codec_id = codec_id
169173

170174
class _Codec(NumcodecsArrayBytesCodec):
171-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
175+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
176+
if codec_config is None:
177+
codec_config = {}
172178
super().__init__(codec_id=_codec_id, codec_config=codec_config)
173179

174180
_Codec.__name__ = cls_name
@@ -180,7 +186,9 @@ def make_checksum_codec(codec_id: str, cls_name: str) -> type[NumcodecsBytesByte
180186
_codec_id = codec_id
181187

182188
class _ChecksumCodec(NumcodecsBytesBytesCodec):
183-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
189+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
190+
if codec_config is None:
191+
codec_config = {}
184192
super().__init__(codec_id=_codec_id, codec_config=codec_config)
185193

186194
def compute_encoded_size(self, input_byte_length: int, chunk_spec: ArraySpec) -> int:
@@ -191,7 +199,9 @@ def compute_encoded_size(self, input_byte_length: int, chunk_spec: ArraySpec) ->
191199

192200

193201
class ShuffleCodec(NumcodecsBytesBytesCodec):
194-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
202+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
203+
if codec_config is None:
204+
codec_config = {}
195205
super().__init__(codec_id="shuffle", codec_config=codec_config)
196206

197207
def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
@@ -201,7 +211,9 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
201211

202212

203213
class FixedScaleOffsetCodec(NumcodecsArrayArrayCodec):
204-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
214+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
215+
if codec_config is None:
216+
codec_config = {}
205217
super().__init__(codec_id="fixedscaleoffset", codec_config=codec_config)
206218

207219
def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
@@ -216,7 +228,9 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
216228

217229

218230
class QuantizeCodec(NumcodecsArrayArrayCodec):
219-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
231+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
232+
if codec_config is None:
233+
codec_config = {}
220234
super().__init__(codec_id="quantize", codec_config=codec_config)
221235

222236
def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
@@ -226,7 +240,9 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
226240

227241

228242
class AsTypeCodec(NumcodecsArrayArrayCodec):
229-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
243+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
244+
if codec_config is None:
245+
codec_config = {}
230246
super().__init__(codec_id="astype", codec_config=codec_config)
231247

232248
def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:
@@ -240,7 +256,9 @@ def evolve_from_array_spec(self, array_spec: ArraySpec) -> Self:
240256

241257

242258
class PackbitsCodec(NumcodecsArrayArrayCodec):
243-
def __init__(self, codec_config: dict[str, JSON] = {}) -> None:
259+
def __init__(self, codec_config: dict[str, JSON] | None = None) -> None:
260+
if codec_config is None:
261+
codec_config = {}
244262
super().__init__(codec_id="packbits", codec_config=codec_config)
245263

246264
def resolve_metadata(self, chunk_spec: ArraySpec) -> ArraySpec:

0 commit comments

Comments
 (0)