Fix annotation errors

This commit is contained in:
Veronica Berglyd Olsen
2024-04-09 17:01:05 +02:00
parent 99c4b0acd0
commit c1154682b5
19 changed files with 60 additions and 44 deletions
+1 -1
View File
@@ -382,7 +382,7 @@ class BuildSettings:
postponed = []
def allowRoot(rHandle):
def allowRoot(rHandle: str | None) -> None:
if rHandle in postponed and rHandle in result and rHandle is not None:
result[rHandle] = (True, FilterMode.ROOT)
postponed.remove(rHandle)
+1 -1
View File
@@ -449,7 +449,7 @@ class ProjectXMLReader:
result[xEntry.attrib["key"]] = checkString(xEntry.text, "")
return result
def _parseDictTagText(self, xItem) -> dict:
def _parseDictTagText(self, xItem: ET.Element) -> dict:
"""Parse a dictionary stored with key as the tag and the value
as the text property.
"""
+3 -3
View File
@@ -74,7 +74,7 @@ class NWSpellEnchant:
# Setters
##
def setLanguage(self, language: str | None):
def setLanguage(self, language: str | None) -> None:
"""Load a dictionary for the language specified in the config.
If that fails, we load a mock dictionary so that lookups don't
crash. Note that enchant will allow loading an empty string as
@@ -182,10 +182,10 @@ class FakeEnchant:
def check(self, word: str) -> bool:
return True
def suggest(self, word) -> list[str]:
def suggest(self, word: str) -> list[str]:
return []
def add_to_session(self, word: str):
def add_to_session(self, word: str) -> None:
return
# END Class FakeEnchant
+1 -1
View File
@@ -49,7 +49,7 @@ ESCAPES = {r"\*": "*", r"\~": "~", r"\_": "_", r"\[": "[", r"\]": "]", r"\ ": ""
RX_ESC = re.compile("|".join([re.escape(k) for k in ESCAPES.keys()]), flags=re.DOTALL)
def stripEscape(text) -> str:
def stripEscape(text: str) -> str:
"""Strip escaped Markdown characters from paragraph text."""
if "\\" in text:
return RX_ESC.sub(lambda x: ESCAPES[x.group(0)], text)
+1 -1
View File
@@ -548,7 +548,7 @@ class ToOdt(Tokenizer):
oVers = _mkTag("office", "version")
xSett = ET.Element(oRoot, attrib={oVers: X_VERS})
def putInZip(name, xObj, zipObj):
def putInZip(name: str, xObj: ET.Element, zipObj: ZipFile) -> None:
with zipObj.open(name, mode="w") as fObj:
xml = ET.ElementTree(xObj)
xml.write(fObj, encoding="utf-8", xml_declaration=True)