Use assert_never to fix some possibly-undefined mypy warnings (#3333)

This commit is contained in:
correctmost 2025-04-03 00:59:12 +00:00 committed by GitHub
parent 5af2d2bb07
commit 1678fb5192
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
from pathlib import Path
from typing import TYPE_CHECKING, override
from typing import TYPE_CHECKING, assert_never, override
from archinstall.lib.models.device_model import SubvolumeModification
from archinstall.tui.curses_menu import EditMenu
@ -54,6 +54,8 @@ class SubvolumeMenu(ListManager):
name = result.text()
case ResultType.Reset:
raise ValueError('Unhandled result type')
case _:
assert_never(result.type_)
header = f"{_('Subvolume name')}: {name}\n"

View File

@ -1,7 +1,7 @@
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, assert_never
from archinstall.lib.models.packages import Repository
from archinstall.lib.packages.packages import list_available_packages
@ -263,6 +263,8 @@ def add_number_of_parallel_downloads(preset: int | None = None) -> int | None:
return 0
case ResultType.Selection:
downloads: int = int(result.text())
case _:
assert_never(result.type_)
pacman_conf_path = Path("/etc/pacman.conf")
with pacman_conf_path.open() as f: