Avoid a reportPossiblyUnboundVariable warning with Pyright (#4092)

This commit is contained in:
correctmost 2026-01-07 02:49:07 -05:00 committed by GitHub
parent e2e158973f
commit 84c36adb1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,7 @@
from __future__ import annotations
from typing import assert_never
from archinstall.lib.models.application import ZramAlgorithm, ZramConfiguration
from archinstall.lib.translationhandler import tr
from archinstall.tui.curses_menu import SelectMenu
@ -126,12 +128,15 @@ def ask_for_swap(preset: ZramConfiguration = ZramConfiguration(enabled=True)) ->
allow_skip=True,
).run()
algo: ZramAlgorithm
match algo_result.type_:
case ResultType.Skip:
algo = preset.algorithm
case ResultType.Selection:
algo = algo_result.get_value()
case ResultType.Reset:
raise ValueError('Unhandled result type')
case _:
assert_never(algo_result.type_)
return ZramConfiguration(enabled=True, algorithm=algo)
case ResultType.Reset: