From cf23699c2cb24fd24988b3d99d816b0aa195ad4d Mon Sep 17 00:00:00 2001 From: codefiles <11915375+codefiles@users.noreply.github.com> Date: Thu, 15 Jan 2026 09:02:22 -0500 Subject: [PATCH] Use Self for Tui --- archinstall/tui/curses_menu.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/archinstall/tui/curses_menu.py b/archinstall/tui/curses_menu.py index 3170536457..12020d22e3 100644 --- a/archinstall/tui/curses_menu.py +++ b/archinstall/tui/curses_menu.py @@ -9,7 +9,7 @@ from curses.ascii import isprint from curses.textpad import Textbox from types import FrameType, TracebackType -from typing import Literal, override +from typing import ClassVar, Literal, Self, override from archinstall.lib.translationhandler import tr @@ -1240,7 +1240,7 @@ def _focus_item(self, direction: Literal['next', 'prev', 'first', 'last']) -> No class Tui: - _t: Tui | None = None + _t: ClassVar[Self | None] = None def __enter__(self) -> None: if Tui._t is None: @@ -1254,10 +1254,10 @@ def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseExceptio def screen(self) -> curses.window: return self._screen - @staticmethod - def t() -> 'Tui': - assert Tui._t is not None - return Tui._t + @classmethod + def t(cls) -> Self: + assert cls._t is not None + return cls._t @staticmethod def shutdown() -> None: @@ -1266,7 +1266,7 @@ def shutdown() -> None: Tui.t().stop() - def init(self) -> 'Tui': + def init(self) -> Self: self._screen = curses.initscr() curses.noecho() curses.cbreak()