Add type annotations to global storage dictionary (#3548)

This will help catch issues like #3530.
This commit is contained in:
correctmost 2025-05-30 07:18:17 +00:00 committed by GitHub
parent b689656547
commit c2ea6ffe9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View File

@ -92,8 +92,6 @@ class Installer:
self.post_base_install: list[Callable] = [] # type: ignore[type-arg]
# TODO: Figure out which one of these two we'll use.. But currently we're mixing them..
storage['session'] = self
storage['installation_session'] = self
self._modules: list[str] = []

View File

@ -6,9 +6,21 @@
#
# And Keeping this in dict ensures that variables are shared across imports.
from pathlib import Path
from typing import Any
from typing import TYPE_CHECKING, NotRequired, TypedDict
storage: dict[str, Any] = {
'LOG_PATH': Path('/var/log/archinstall'),
if TYPE_CHECKING:
from archinstall.lib.boot import Boot
from archinstall.lib.installer import Installer
class _StorageDict(TypedDict):
LOG_FILE: Path
LOG_PATH: Path
active_boot: NotRequired['Boot | None']
installation_session: NotRequired['Installer']
storage: _StorageDict = {
'LOG_FILE': Path('install.log'),
'LOG_PATH': Path('/var/log/archinstall'),
}