Fix most mypy errors in archinstall/scripts/, docs/, and the __init__ file (#2641)
This commit is contained in:
parent
0601708a02
commit
62d66e1caf
|
|
@ -63,7 +63,7 @@ debug(f"Disk states before installing: {disk.disk_layouts()}")
|
|||
parser = ArgumentParser()
|
||||
|
||||
|
||||
def define_arguments():
|
||||
def define_arguments() -> None:
|
||||
"""
|
||||
Define which explicit arguments do we allow.
|
||||
Refer to https://docs.python.org/3/library/argparse.html for documentation and
|
||||
|
|
@ -213,7 +213,7 @@ def get_arguments() -> Dict[str, Any]:
|
|||
return config
|
||||
|
||||
|
||||
def load_config():
|
||||
def load_config() -> None:
|
||||
"""
|
||||
refine and set some arguments. Formerly at the scripts
|
||||
"""
|
||||
|
|
@ -263,7 +263,7 @@ def load_config():
|
|||
)
|
||||
|
||||
|
||||
def post_process_arguments(arguments):
|
||||
def post_process_arguments(arguments: dict[str, Any]) -> None:
|
||||
storage['arguments'] = arguments
|
||||
if mountpoint := arguments.get('mount_point', None):
|
||||
storage['MOUNT_POINT'] = Path(mountpoint)
|
||||
|
|
@ -285,11 +285,11 @@ post_process_arguments(arguments)
|
|||
|
||||
# @archinstall.plugin decorator hook to programmatically add
|
||||
# plugins in runtime. Useful in profiles_bck and other things.
|
||||
def plugin(f, *args, **kwargs):
|
||||
def plugin(f, *args, **kwargs) -> None:
|
||||
plugins[f.__name__] = f
|
||||
|
||||
|
||||
def _check_new_version():
|
||||
def _check_new_version() -> None:
|
||||
info("Checking version...")
|
||||
|
||||
try:
|
||||
|
|
@ -312,7 +312,7 @@ def _check_new_version():
|
|||
time.sleep(3)
|
||||
|
||||
|
||||
def main():
|
||||
def main() -> None:
|
||||
"""
|
||||
This can either be run as the compiled and installed application: python setup.py install
|
||||
OR straight as a module: python -m archinstall
|
||||
|
|
@ -331,7 +331,7 @@ def main():
|
|||
importlib.import_module(mod_name)
|
||||
|
||||
|
||||
def _shutdown_curses():
|
||||
def _shutdown_curses() -> None:
|
||||
try:
|
||||
curses.nocbreak()
|
||||
|
||||
|
|
@ -349,7 +349,7 @@ def _shutdown_curses():
|
|||
pass
|
||||
|
||||
|
||||
def run_as_a_module():
|
||||
def run_as_a_module() -> None:
|
||||
exc = None
|
||||
|
||||
try:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if archinstall.arguments.get('help'):
|
|||
exit(0)
|
||||
|
||||
|
||||
def ask_user_questions():
|
||||
def ask_user_questions() -> None:
|
||||
"""
|
||||
First, we'll ask the user for a bunch of user input.
|
||||
Not until we're satisfied with what we want to install
|
||||
|
|
@ -97,7 +97,7 @@ def ask_user_questions():
|
|||
global_menu.run()
|
||||
|
||||
|
||||
def perform_installation(mountpoint: Path):
|
||||
def perform_installation(mountpoint: Path) -> None:
|
||||
"""
|
||||
Performs the installation steps on a block device.
|
||||
Only requirement is that the block devices are
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ if archinstall.arguments.get('help', None):
|
|||
info(" - Optional systemd network via --network")
|
||||
|
||||
|
||||
def perform_installation(mountpoint: Path):
|
||||
def perform_installation(mountpoint: Path) -> None:
|
||||
disk_config: disk.DiskLayoutConfiguration = archinstall.arguments['disk_config']
|
||||
disk_encryption: disk.DiskEncryption = archinstall.arguments.get('disk_encryption', None)
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ def perform_installation(mountpoint: Path):
|
|||
info(" * devel (password: devel)")
|
||||
|
||||
|
||||
def prompt_disk_layout():
|
||||
def prompt_disk_layout() -> None:
|
||||
fs_type = None
|
||||
if filesystem := archinstall.arguments.get('filesystem', None):
|
||||
fs_type = disk.FilesystemType(filesystem)
|
||||
|
|
@ -72,7 +72,7 @@ def prompt_disk_layout():
|
|||
)
|
||||
|
||||
|
||||
def parse_disk_encryption():
|
||||
def parse_disk_encryption() -> None:
|
||||
if enc_password := archinstall.arguments.get('!encryption-password', None):
|
||||
modification: List[disk.DeviceModification] = archinstall.arguments['disk_config']
|
||||
partitions: List[disk.PartitionModification] = []
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ from archinstall.lib.configuration import ConfigurationOutput
|
|||
from archinstall.lib import disk
|
||||
|
||||
|
||||
def ask_user_questions():
|
||||
def ask_user_questions() -> None:
|
||||
global_menu = archinstall.GlobalMenu(data_store=archinstall.arguments)
|
||||
|
||||
global_menu.enable('archinstall-language')
|
||||
|
|
@ -23,7 +23,7 @@ def ask_user_questions():
|
|||
global_menu.run()
|
||||
|
||||
|
||||
def perform_installation(mountpoint: Path):
|
||||
def perform_installation(mountpoint: Path) -> None:
|
||||
"""
|
||||
Performs the installation steps on a block device.
|
||||
Only requirement is that the block devices are
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class SetupMenu(GlobalMenu):
|
|||
def __init__(self, storage_area: Dict[str, Any]):
|
||||
super().__init__(data_store=storage_area)
|
||||
|
||||
def setup_selection_menu_options(self):
|
||||
def setup_selection_menu_options(self) -> None:
|
||||
super().setup_selection_menu_options()
|
||||
|
||||
self._menu_options['mode'] = menu.Selector(
|
||||
|
|
@ -61,7 +61,7 @@ class SetupMenu(GlobalMenu):
|
|||
self.enable('continue')
|
||||
self.enable('abort')
|
||||
|
||||
def exit_callback(self):
|
||||
def exit_callback(self) -> None:
|
||||
if self._data_store.get('mode', None):
|
||||
archinstall.arguments['mode'] = self._data_store['mode']
|
||||
info(f"Archinstall will execute under {archinstall.arguments['mode']} mode")
|
||||
|
|
@ -76,7 +76,7 @@ class SwissMainMenu(GlobalMenu):
|
|||
self._execution_mode = exec_mode
|
||||
super().__init__(data_store)
|
||||
|
||||
def setup_selection_menu_options(self):
|
||||
def setup_selection_menu_options(self) -> None:
|
||||
super().setup_selection_menu_options()
|
||||
|
||||
options_list = []
|
||||
|
|
@ -130,7 +130,7 @@ class SwissMainMenu(GlobalMenu):
|
|||
self.enable(entry)
|
||||
|
||||
|
||||
def ask_user_questions(exec_mode: ExecutionMode = ExecutionMode.Full):
|
||||
def ask_user_questions(exec_mode: ExecutionMode = ExecutionMode.Full) -> None:
|
||||
"""
|
||||
First, we'll ask the user for a bunch of user input.
|
||||
Not until we're satisfied with what we want to install
|
||||
|
|
@ -163,7 +163,7 @@ def ask_user_questions(exec_mode: ExecutionMode = ExecutionMode.Full):
|
|||
menu.run()
|
||||
|
||||
|
||||
def perform_installation(mountpoint: Path, exec_mode: ExecutionMode):
|
||||
def perform_installation(mountpoint: Path, exec_mode: ExecutionMode) -> None:
|
||||
disk_config: disk.DiskLayoutConfiguration = archinstall.arguments['disk_config']
|
||||
disk_encryption: disk.DiskEncryption = archinstall.arguments.get('disk_encryption', None)
|
||||
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import sys
|
|||
sys.path.insert(0, os.path.abspath('..'))
|
||||
|
||||
|
||||
def process_docstring(app, what, name, obj, options, lines):
|
||||
def process_docstring(app, what, name, obj, options, lines) -> None:
|
||||
spaces_pat = re.compile(r"( {8})")
|
||||
ll = [spaces_pat.sub(" ", line) for line in lines]
|
||||
lines[:] = ll
|
||||
|
||||
|
||||
def setup(app):
|
||||
def setup(app) -> None:
|
||||
app.connect('autodoc-process-docstring', process_docstring)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue