From c3d3953000f994de0e62f01d5a83b6d72d1bfe9d Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Sat, 10 Jun 2023 06:09:20 -0500 Subject: [PATCH] !squash --- src/unihan_db/importer.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/unihan_db/importer.py b/src/unihan_db/importer.py index 4b770942..a8428e35 100644 --- a/src/unihan_db/importer.py +++ b/src/unihan_db/importer.py @@ -121,10 +121,12 @@ def import_char( c.kIRGHanyuDaZidian.append(k) if "kXHC1983" in char: - for d in char["kXHC1983"]: - k = kXHC1983() - for loc in d["locations"]: - k.locations.append( + for kxhc in char["kXHC1983"]: + assert isinstance(kxhc, dict) + assert isinstance(kxhc["locations"], list) + kxhc_locations: t.List[UnhnLocationkXHC1983] = [] + for loc in kxhc["locations"]: + kxhc_locations.append( UnhnLocationkXHC1983( page=loc["page"], character=loc["character"], @@ -132,8 +134,7 @@ def import_char( substituted=loc["substituted"], ) ) - k.readings.append(UnhnReading(reading=d["reading"])) - c.kXHC1983.append(k) + c.kXHC1983.append(kXHC1983(readings=kxhc_locations)) if "kCheungBauer" in char: for _kcb in char["kCheungBauer"]: