From 0ed34de2f29e5135e81e3622916dffdb179e7f83 Mon Sep 17 00:00:00 2001 From: Alexander Popov Date: Sun, 12 May 2024 18:31:23 +0300 Subject: [PATCH] Fix mypy typing warnings in __init__.py --- kernel_hardening_checker/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel_hardening_checker/__init__.py b/kernel_hardening_checker/__init__.py index 6adab90..6da5feb 100644 --- a/kernel_hardening_checker/__init__.py +++ b/kernel_hardening_checker/__init__.py @@ -56,7 +56,7 @@ def detect_kernel_version(fname: str) -> Tuple[Tuple | None, str]: ver_numbers = ver_str.split('.') if len(ver_numbers) >= 3: if all(map(lambda x: x.isdigit(), ver_numbers)): - return tuple(map(int, ver_numbers)), None + return tuple(map(int, ver_numbers)), 'OK' msg = f'failed to parse the version "{parts[2]}"' return None, msg return None, 'no kernel version detected' @@ -388,6 +388,7 @@ def main() -> None: if mode and mode not in ('verbose', 'json'): sys.exit(f'[!] ERROR: wrong mode "{mode}" for --print') arch = args.print + assert arch, 'unexpected empty arch from ArgumentParser' add_kconfig_checks(config_checklist, arch) add_cmdline_checks(config_checklist, arch) add_sysctl_checks(config_checklist, arch) @@ -401,6 +402,7 @@ def main() -> None: if mode: sys.exit(f'[!] ERROR: wrong mode "{mode}" for --generate') arch = args.generate + assert arch, 'unexpected empty arch from ArgumentParser' add_kconfig_checks(config_checklist, arch) print(f'CONFIG_{arch}=y') # the Kconfig fragment should describe the microarchitecture for opt in config_checklist: -- 2.31.1