Fix annotation errors
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user