diff --git a/src/unihan_db/importer.py b/src/unihan_db/importer.py index 3e3aa3c9..15d14543 100644 --- a/src/unihan_db/importer.py +++ b/src/unihan_db/importer.py @@ -261,12 +261,15 @@ def import_char( if "kGSR" in char: for d in char["kGSR"]: + assert isinstance(d, dict) k = kGSR(set=d["set"], letter=d["letter"], apostrophe=d["apostrophe"]) c.kGSR.append(k) if "kCheungBauerIndex" in char: d = char["kCheungBauerIndex"] k = kCheungBauerIndex() + assert isinstance(d, dict) + assert isinstance(d["location"], dict) k.locations.append( UnhnLocation( page=d["location"]["page"], character=d["location"]["character"] @@ -275,11 +278,14 @@ def import_char( c.kCheungBauerIndex.append(k) if "kFennIndex" in char: - d = char["kFennIndex"] + _kFennIndex = char["kFennIndex"] k = kFennIndex() + assert isinstance(_kFennIndex, dict) + assert isinstance(_kFennIndex["location"], dict) k.locations.append( UnhnLocation( - page=d["location"]["page"], character=d["location"]["character"] + page=_kFennIndex["location"]["page"], + character=_kFennIndex["location"]["character"], ) ) c.kFennIndex.append(k)