Skip to content

Commit

Permalink
!squash more
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Jun 4, 2023
1 parent 636448f commit 5e62a1c
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/unihan_db/importer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import typing as t
from unihan_db.tables import (
Unhn,
UnhnLocation,
UnhnLocationkXHC1983,
UnhnReading,
Expand Down Expand Up @@ -43,7 +45,16 @@
)


def import_char(c, char): # NOQA: C901
def import_char(
c: Unhn,
char: t.Dict[
str,
t.Dict[
str,
t.Union[int, str, t.List[t.Dict[str, t.Any]], t.Dict[str, t.Any]],
],
],
): # NOQA: C901
if "kDefinition" in char:
for d in char["kDefinition"]:
c.kDefinition.append(kDefinition(definition=d))
Expand All @@ -64,7 +75,9 @@ def import_char(c, char): # NOQA: C901
if "kHanyuPinyin" in char:
for d in char["kHanyuPinyin"]:
k = kHanyuPinyin()
assert isinstance(d["locations"], list)
for loc in d["locations"]:
assert isinstance(loc, dict)
k.locations.append(
UnhnLocation(
volume=loc["volume"],
Expand Down

0 comments on commit 5e62a1c

Please sign in to comment.