From a719335404a0be4ad057dc4f4751fecbb02e36cf Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sun, 4 Jun 2023 13:49:27 -0500 Subject: [PATCH] !squash more --- src/unihan_db/importer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)