diff --git a/archinstall/lib/boot.py b/archinstall/lib/boot.py index 8faf3557..46ea6bf8 100644 --- a/archinstall/lib/boot.py +++ b/archinstall/lib/boot.py @@ -1,6 +1,7 @@ import time from collections.abc import Iterator from types import TracebackType +from typing import Self from .exceptions import SysCallError from .general import SysCommand, SysCommandWorker, locate_binary @@ -16,7 +17,7 @@ class Boot: self.session: SysCommandWorker | None = None self.ready = False - def __enter__(self) -> 'Boot': + def __enter__(self) -> Self: if (existing_session := storage.get('active_boot', None)) and existing_session.instance != self.instance: raise KeyError('Archinstall only supports booting up one instance and another session is already active.') diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 779d1802..98404e6e 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -15,7 +15,7 @@ from pathlib import Path from select import EPOLLHUP, EPOLLIN, epoll from shutil import which from types import TracebackType -from typing import Any, override +from typing import Any, Self, override from .exceptions import RequirementError, SysCallError from .output import debug, error, logger @@ -177,7 +177,7 @@ class SysCommandWorker: except UnicodeDecodeError: return str(self._trace_log) - def __enter__(self) -> 'SysCommandWorker': + def __enter__(self) -> Self: return self def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> None: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 2aa71d6e..a1e9d91c 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -11,7 +11,7 @@ from collections.abc import Callable from pathlib import Path from subprocess import CalledProcessError from types import TracebackType -from typing import Any +from typing import Any, Self from archinstall.lib.disk.device_handler import device_handler from archinstall.lib.disk.fido import Fido2 @@ -123,7 +123,7 @@ class Installer: self.pacman = Pacman(self.target, arch_config_handler.args.silent) - def __enter__(self) -> 'Installer': + def __enter__(self) -> Self: return self def __exit__(self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None) -> bool | None: