Skip to content

Commit 7a47ef7

Browse files
committed
lint
1 parent 79f4e31 commit 7a47ef7

29 files changed

+61
-63
lines changed

src/zarr/codecs/gzip.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,19 @@ def _check_json_v2(cls, data: object) -> TypeGuard[GZipJSON_V2]:
8484
return (
8585
isinstance(data, Mapping)
8686
and set(data.keys()) == {"id", "level"}
87-
and data["id"] == "gzip" # type: ignore[typeddict-item]
88-
and isinstance(data["level"], int) # type: ignore[typeddict-item]
87+
and data["id"] == "gzip"
88+
and isinstance(data["level"], int)
8989
)
9090

9191
@classmethod
9292
def _check_json_v3(cls, data: object) -> TypeGuard[GZipJSON_V3]:
9393
return (
9494
isinstance(data, Mapping)
9595
and set(data.keys()) == {"name", "configuration"}
96-
and data["name"] == "gzip" # type: ignore[typeddict-item]
97-
and isinstance(data["configuration"], Mapping) # type: ignore[typeddict-item]
98-
and "level" in data["configuration"] # type: ignore[typeddict-item]
99-
and isinstance(data["configuration"]["level"], int) # type: ignore[typeddict-item]
96+
and data["name"] == "gzip"
97+
and isinstance(data["configuration"], Mapping)
98+
and "level" in data["configuration"]
99+
and isinstance(data["configuration"]["level"], int)
100100
)
101101

102102
@classmethod

src/zarr/codecs/numcodecs/_codecs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def __init__(self, **codec_config: Any) -> None:
8686
self,
8787
"_codec",
8888
get_numcodec(
89-
{"id": self._codec_id, **{k: v for k, v in codec_config.items() if k != "id"}}
89+
{"id": self._codec_id, **{k: v for k, v in codec_config.items() if k != "id"}} # type: ignore[typeddict-item]
9090
),
91-
) # type: ignore[typeddict-item]
91+
)
9292
object.__setattr__(self, "codec_config", self._codec.get_config())
9393

9494
def to_dict(self) -> dict[str, JSON]:

src/zarr/codecs/numcodecs/adler32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def check_json_v2(data: object) -> TypeGuard[Adler32JSON_V2]:
5050
return (
5151
_check_codecjson_v2(data)
5252
and data["id"] == "adler32"
53-
and ("location" not in data or data["location"] in ("start", "end"))
53+
and ("location" not in data or data["location"] in ("start", "end")) # type: ignore[typeddict-item]
5454
)
5555

5656

src/zarr/codecs/numcodecs/bitround.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def check_json_v2(data: object) -> TypeGuard[BitRoundJSON_V2]:
4646
_check_codecjson_v2(data)
4747
and data["id"] == "bitround"
4848
and "keepbits" in data
49-
and isinstance(data["keepbits"], int)
50-
and data["keepbits"] > 0
49+
and isinstance(data["keepbits"], int) # type: ignore[typeddict-item]
50+
and data["keepbits"] > 0 # type: ignore[typeddict-item]
5151
)
5252

5353

src/zarr/codecs/numcodecs/bz2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def check_json_v2(data: object) -> TypeGuard[BZ2JSON_V2]:
4646
_check_codecjson_v2(data)
4747
and data["id"] == "bz2"
4848
and "level" in data
49-
and isinstance(data["level"], int)
50-
and 1 <= data["level"] <= 9
49+
and isinstance(data["level"], int) # type: ignore[typeddict-item]
50+
and 1 <= data["level"] <= 9 # type: ignore[typeddict-item]
5151
)
5252

5353

src/zarr/codecs/numcodecs/crc32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def check_json_v2(data: object) -> TypeGuard[Crc32JSON_V2]:
4747
return (
4848
_check_codecjson_v2(data)
4949
and data["id"] == "crc32"
50-
and ("location" not in data or data["location"] in ("start", "end"))
50+
and ("location" not in data or data["location"] in ("start", "end")) # type: ignore[typeddict-item]
5151
)
5252

5353

src/zarr/codecs/numcodecs/crc32c.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def check_json_v2(data: object) -> TypeGuard[Crc32cJSON_V2]:
3333
return (
3434
_check_codecjson_v2(data)
3535
and data["id"] == "crc32c"
36-
and ("location" not in data or data["location"] in ("start", "end"))
36+
and ("location" not in data or data["location"] in ("start", "end")) # type: ignore[typeddict-item]
3737
)
3838

3939

@@ -77,8 +77,6 @@ def _from_json_v2(cls, data: CodecJSON_V2) -> Self:
7777
@classmethod
7878
def _from_json_v3(cls, data: CodecJSON_V3) -> Self:
7979
if check_json_v3(data):
80-
if isinstance(data, str):
81-
return cls()
8280
config = data.get("configuration", {})
8381
return cls(**config)
8482
raise TypeError(f"Invalid JSON: {data}")

src/zarr/codecs/numcodecs/gzip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ def check_json_v2(data: object) -> TypeGuard[GZipJSON_V2]:
2727
_check_codecjson_v2(data)
2828
and data["id"] == "gzip"
2929
and "level" in data
30-
and isinstance(data["level"], int)
31-
and 0 <= data["level"] <= 9
30+
and isinstance(data["level"], int) # type: ignore[typeddict-item]
31+
and 0 <= data["level"] <= 9 # type: ignore[typeddict-item]
3232
)
3333

3434

src/zarr/codecs/numcodecs/jenkins_lookup3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ def check_json_v2(data: object) -> TypeGuard[JenkinsLookup3JSON_V2]:
5252
and data["id"] == "jenkins_lookup3"
5353
and "initval" in data
5454
and "prefix" in data
55-
and isinstance(data["initval"], int)
56-
and isinstance(data["prefix"], bytes | None)
55+
and isinstance(data["initval"], int) # type: ignore[typeddict-item]
56+
and isinstance(data["prefix"], bytes | None) # type: ignore[typeddict-item]
5757
)
5858

5959

src/zarr/codecs/numcodecs/lz4.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def check_json_v2(data: object) -> TypeGuard[LZ4JSON_V2]:
4646
_check_codecjson_v2(data)
4747
and data["id"] == "lz4"
4848
and "acceleration" in data
49-
and isinstance(data["acceleration"], int)
50-
and data["acceleration"] >= 1
49+
and isinstance(data["acceleration"], int) # type: ignore[typeddict-item]
50+
and data["acceleration"] >= 1 # type: ignore[typeddict-item]
5151
)
5252

5353

0 commit comments

Comments
 (0)