| 35 | |
| 36 | |
| 37 | def extract_classes(chunks: Iterable[CacheData]) -> Iterable[JsonDict]: |
| 38 | def extract(chunks: Iterable[JsonDict]) -> Iterable[JsonDict]: |
| 39 | for chunk in chunks: |
| 40 | if isinstance(chunk, dict): |
| 41 | yield chunk |
| 42 | yield from extract(chunk.values()) |
| 43 | elif isinstance(chunk, list): # type: ignore[unreachable] #TODO: is this actually unreachable, or are our types wrong? |
| 44 | yield from extract(chunk) |
| 45 | |
| 46 | yield from extract([chunk.data for chunk in chunks]) |
| 47 | |
| 48 | |
| 49 | def load_json(data_path: str, meta_path: str) -> CacheData: |