Skip to content

Commit 0727f1b

Browse files
actually, just type-ignore; to avoid all possibility of breaking working code for no reason.
1 parent ff6df8a commit 0727f1b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

misc/analyze_cache.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def extract(chunks: Iterable[JsonDict]) -> Iterable[JsonDict]:
4141
if isinstance(chunk, dict):
4242
yield chunk
4343
yield from extract(chunk.values())
44+
elif isinstance(chunk, list):
45+
yield from extract(chunk) #type: ignore[unreachable] #TODO: is this actually unreachable, or are our types wrong?
4446

4547
yield from extract([chunk.data for chunk in chunks])
4648

@@ -90,6 +92,8 @@ def compress(chunk: JsonDict) -> JsonDict:
9092

9193
def helper(chunk: JsonDict) -> JsonDict:
9294
nonlocal counter
95+
if not isinstance(chunk, dict):
96+
return chunk #type: ignore[unreachable] #TODO: is this actually unreachable, or are our types wrong?
9397

9498
if len(chunk) <= 2:
9599
return chunk
@@ -119,6 +123,8 @@ def decompress(chunk: JsonDict) -> JsonDict:
119123
cache: dict[int, JsonDict] = {}
120124

121125
def helper(chunk: JsonDict) -> JsonDict:
126+
if not isinstance(chunk, dict):
127+
return chunk #type: ignore[unreachable] #TODO: is this actually unreachable, or are our types wrong?
122128
if ".id" in chunk:
123129
return cache[chunk[".id"]]
124130

0 commit comments

Comments
 (0)