Use Self for Tui (#4130)

This commit is contained in:
codefiles 2026-01-15 14:36:11 -05:00 committed by GitHub
parent 2c85b5eab0
commit 2c154245cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ from collections.abc import Callable
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 @@ class SelectMenu[ValueT](AbstractCurses[ValueT]):
class Tui:
_t: Tui | None = None
_t: ClassVar[Self | None] = None
def __enter__(self) -> None:
if Tui._t is None:
@ -1254,10 +1254,10 @@ class Tui:
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 @@ class Tui:
Tui.t().stop()
def init(self) -> 'Tui':
def init(self) -> Self:
self._screen = curses.initscr()
curses.noecho()
curses.cbreak()