Enable possibly-undefined warnings in mypy (#3340)
This commit also fixes the two remaining possibly-undefined warnings.
This commit is contained in:
parent
bdc260e7e8
commit
16d8b209fc
|
|
@ -581,6 +581,7 @@ class Installer:
|
||||||
# in the first column of the entry; check for both cases.
|
# in the first column of the entry; check for both cases.
|
||||||
entry_re = re.compile(rf'#{lang}(\.{encoding})?{modifier} {encoding}')
|
entry_re = re.compile(rf'#{lang}(\.{encoding})?{modifier} {encoding}')
|
||||||
|
|
||||||
|
lang_value = None
|
||||||
for index, line in enumerate(locale_gen_lines):
|
for index, line in enumerate(locale_gen_lines):
|
||||||
if entry_re.match(line):
|
if entry_re.match(line):
|
||||||
uncommented_line = line.removeprefix('#')
|
uncommented_line = line.removeprefix('#')
|
||||||
|
|
@ -588,7 +589,8 @@ class Installer:
|
||||||
locale_gen.write_text(''.join(locale_gen_lines))
|
locale_gen.write_text(''.join(locale_gen_lines))
|
||||||
lang_value = uncommented_line.split()[0]
|
lang_value = uncommented_line.split()[0]
|
||||||
break
|
break
|
||||||
else:
|
|
||||||
|
if lang_value is None:
|
||||||
error(f"Invalid locale: language '{locale_config.sys_lang}', encoding '{locale_config.sys_enc}'")
|
error(f"Invalid locale: language '{locale_config.sys_lang}', encoding '{locale_config.sys_enc}'")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import ipaddress
|
import ipaddress
|
||||||
from typing import TYPE_CHECKING, override
|
from typing import TYPE_CHECKING, assert_never, override
|
||||||
|
|
||||||
from archinstall.tui.curses_menu import EditMenu, SelectMenu
|
from archinstall.tui.curses_menu import EditMenu, SelectMenu
|
||||||
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
||||||
|
|
@ -144,6 +144,10 @@ class ManualNetworkConfig(ListManager):
|
||||||
mode = result.get_value()
|
mode = result.get_value()
|
||||||
case ResultType.Reset:
|
case ResultType.Reset:
|
||||||
raise ValueError('Unhandled result type')
|
raise ValueError('Unhandled result type')
|
||||||
|
case ResultType.Skip:
|
||||||
|
raise ValueError('The mode menu should not be skippable')
|
||||||
|
case _:
|
||||||
|
assert_never(result.type_)
|
||||||
|
|
||||||
if mode == 'IP (static)':
|
if mode == 'IP (static)':
|
||||||
header = str(_('Enter the IP and subnet for {} (example: 192.168.0.5/24): ').format(iface_name)) + '\n'
|
header = str(_('Enter the IP and subnet for {} (example: 192.168.0.5/24): ').format(iface_name)) + '\n'
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ enable_error_code = [
|
||||||
"explicit-override",
|
"explicit-override",
|
||||||
"ignore-without-code",
|
"ignore-without-code",
|
||||||
"mutable-override",
|
"mutable-override",
|
||||||
|
"possibly-undefined",
|
||||||
"redundant-expr",
|
"redundant-expr",
|
||||||
"redundant-self",
|
"redundant-self",
|
||||||
"truthy-iterable",
|
"truthy-iterable",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue