Add type annotations to global storage dictionary (#3548)
This will help catch issues like #3530.
This commit is contained in:
parent
b689656547
commit
c2ea6ffe9c
|
|
@ -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] = []
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue