Skip to content

Commit 715e014

Browse files
committed
🧎‍♀️ Genuflect to the types.
1 parent ad73ed8 commit 715e014

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

inflect.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@
5050

5151
import ast
5252
import re
53+
from typing import Dict, Union
54+
5355

5456
try:
55-
import importlib.metadata as importlib_metadata
57+
import importlib.metadata as importlib_metadata # type: ignore
5658
except ImportError:
57-
import importlib_metadata
59+
import importlib_metadata # type: ignore
5860

5961

6062
class UnknownClassicalModeError(Exception):
@@ -1456,16 +1458,16 @@ def make_pl_si_lists(lst, plending, siendingsize, dojoinstem=True):
14561458
)
14571459
)
14581460

1459-
pl_sb_postfix_adj = {
1461+
_pl_sb_postfix_adj_defn = {
14601462
"general": [r"(?!major|lieutenant|brigadier|adjutant|.*star)\S+"],
14611463
"martial": ["court"],
14621464
"force": ["pound"],
14631465
}
14641466

1465-
for k in list(pl_sb_postfix_adj.keys()):
1466-
pl_sb_postfix_adj[k] = enclose(
1467-
enclose("|".join(pl_sb_postfix_adj[k])) + "(?=(?:-|\\s+)%s)" % k
1468-
)
1467+
pl_sb_postfix_adj: Dict[str, str] = {}
1468+
1469+
for key, val in _pl_sb_postfix_adj_defn.items():
1470+
pl_sb_postfix_adj[key] = enclose(enclose("|".join(val)) + "(?=(?:-|\\s+)%s)" % key)
14691471

14701472
pl_sb_postfix_adj_stems = "(" + "|".join(list(pl_sb_postfix_adj.values())) + ")(.*)"
14711473

@@ -1590,7 +1592,7 @@ def make_pl_si_lists(lst, plending, siendingsize, dojoinstem=True):
15901592
"theirs": "theirs",
15911593
}
15921594

1593-
si_pron = {}
1595+
si_pron: Dict[str, Dict[str, Union[str, Dict[str, str]]]] = {}
15941596
si_pron["nom"] = {v: k for (k, v) in pl_pron_nom.items()}
15951597
si_pron["nom"]["we"] = "I"
15961598

@@ -1649,10 +1651,10 @@ def make_pl_si_lists(lst, plending, siendingsize, dojoinstem=True):
16491651
("acc", "themselves", "masculine or feminine", "himself or herself"),
16501652
):
16511653
try:
1652-
si_pron[thecase][plur][gend] = sing
1654+
si_pron[thecase][plur][gend] = sing # type: ignore
16531655
except TypeError:
16541656
si_pron[thecase][plur] = {}
1655-
si_pron[thecase][plur][gend] = sing
1657+
si_pron[thecase][plur][gend] = sing # type: ignore
16561658

16571659

16581660
si_pron_acc_keys = enclose("|".join(list(si_pron["acc"].keys())))

0 commit comments

Comments
 (0)