ui: fix the type errors newer ty finds (#39505)

This commit is contained in:
Adeeb Shihadeh
2026-11-28 15:44:03 -06:00
committed by firestar5683
parent ad714cbc62
commit 3bbda2d485
3 changed files with 5 additions and 3 deletions
@@ -99,7 +99,7 @@ class WifiNetworkButton(BigButton):
def _draw_content(self, btn_y: float):
super()._draw_content(btn_y)
# Render lock icon at lower right of wifi icon if secured
if self._draw_lock:
if self._draw_lock and self._txt_icon is not None:
icon_x = self._rect.x + self._rect.width - 30 - self._txt_icon.width
icon_y = btn_y + 30
lock_x = icon_x + self._txt_icon.width - self._lock_txt.width + 7
@@ -117,6 +117,7 @@ def parse_po(path: str | Path) -> tuple[POEntry | None, list[POEntry]]:
m = re.match(r'msgstr\[(\d+)]\s+(.*)', stripped)
if m:
assert cur is not None
plural_idx = int(m.group(1))
cur.msgstr_plural[plural_idx] = _parse_quoted(m.group(2))
cur_field = 'msgstr_plural'
@@ -130,6 +131,7 @@ def parse_po(path: str | Path) -> tuple[POEntry | None, list[POEntry]]:
continue
if stripped.startswith('"'):
assert cur is not None
val = _parse_quoted(stripped)
if cur_field == 'msgid':
cur.msgid += val
@@ -302,7 +304,7 @@ def init_po(pot_path: str | Path, po_path: str | Path, language: str) -> None:
_, entries = parse_po(pot_path)
plural_forms = PLURAL_FORMS.get(language, 'nplurals=2; plural=(n != 1);')
nplurals = int(re.search(r'nplurals=(\d+)', plural_forms).group(1))
nplurals = int(re.findall(r'nplurals=(\d+)', plural_forms)[0])
for e in entries:
if e.is_plural:
e.msgstr_plural = dict.fromkeys(range(nplurals), '')
+1 -1
View File
@@ -36,7 +36,7 @@ def wrap_text(text, font_size, max_width):
if lines:
lines.append("")
continue
indent = re.match(r"^\s*", paragraph).group()
indent = paragraph[:len(paragraph) - len(paragraph.lstrip())]
current_line = indent
words = re.split(r"(\s+|-)", paragraph[len(indent):])
while len(words):