From: Alexander Popov Date: Sun, 12 May 2024 15:31:23 +0000 (+0300) Subject: Fix mypy typing warnings in __init__.py X-Git-Tag: v0.6.10~67^2~18 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=0ed34de2f29e5135e81e3622916dffdb179e7f83;p=kconfig-hardened-check.git Fix mypy typing warnings in __init__.py --- 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: