From: Joerg Behrmann Date: Thu, 16 Nov 2023 09:43:42 +0000 (+0100) Subject: fix ruff lint warnings X-Git-Tag: v20~137^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F2073%2Fhead;p=thirdparty%2Fmkosi.git fix ruff lint warnings --- diff --git a/mkosi/burn.py b/mkosi/burn.py index 08908e9e1..ff4c813e8 100644 --- a/mkosi/burn.py +++ b/mkosi/burn.py @@ -15,7 +15,7 @@ def run_burn(args: MkosiArgs, config: MkosiConfig) -> None: fname = config.output_dir_or_cwd() / config.output if len(args.cmdline) != 1: - die("Expected device argument."); + die("Expected device argument.") device = args.cmdline[0] diff --git a/mkosi/config.py b/mkosi/config.py index ed17ea459..0d03a4edb 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -61,10 +61,28 @@ class Verb(StrEnum): burn = enum.auto() def supports_cmdline(self) -> bool: - return self in (Verb.build, Verb.shell, Verb.boot, Verb.qemu, Verb.ssh, Verb.journalctl, Verb.coredumpctl, Verb.burn) + return self in ( + Verb.build, + Verb.shell, + Verb.boot, + Verb.qemu, + Verb.ssh, + Verb.journalctl, + Verb.coredumpctl, + Verb.burn, + ) def needs_build(self) -> bool: - return self in (Verb.build, Verb.shell, Verb.boot, Verb.qemu, Verb.serve, Verb.journalctl, Verb.coredumpctl, Verb.burn) + return self in ( + Verb.build, + Verb.shell, + Verb.boot, + Verb.qemu, + Verb.serve, + Verb.journalctl, + Verb.coredumpctl, + Verb.burn, + ) def needs_root(self) -> bool: return self in (Verb.shell, Verb.boot, Verb.burn) @@ -2573,10 +2591,12 @@ def parse_config(argv: Sequence[str] = ()) -> tuple[MkosiArgs, tuple[MkosiConfig if any(getattr(config, s) == getattr(cli_ns, s) for config in images): continue - setting = SETTINGS_LOOKUP_BY_DEST[s] - - die(f"{setting.long}={getattr(cli_ns, s)} was specified on the command line but is not allowed to be configured by any images.", - hint="Prefix the setting with '@' in the image configuration file to allow overriding it from the command line.") + setting = SETTINGS_LOOKUP_BY_DEST[s].long + a = getattr(cli_ns, s) + die( + f"{setting}={a} was specified on the command line but is not allowed to be configured by any images.", + hint="Prefix the setting with '@' in the image configuration file to allow overriding it from the command line.", # noqa: E501 + ) if not images: die("No images defined in mkosi.images/") diff --git a/mkosi/mounts.py b/mkosi/mounts.py index e90f57932..ed0a74098 100644 --- a/mkosi/mounts.py +++ b/mkosi/mounts.py @@ -69,7 +69,11 @@ def mount( @contextlib.contextmanager -def mount_overlay(lowerdirs: Sequence[Path], upperdir: Optional[Path] = None, where: Optional[Path] = None) -> Iterator[Path]: +def mount_overlay( + lowerdirs: Sequence[Path], + upperdir: Optional[Path] = None, + where: Optional[Path] = None, +) -> Iterator[Path]: with contextlib.ExitStack() as stack: if upperdir is None: upperdir = Path(stack.enter_context(tempfile.TemporaryDirectory(prefix="volatile-overlay")))