From 8fa5ec15af667f8b3f71c4cf67683175f31f8845 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:50:11 -0500 Subject: [PATCH] Enable the yield-in-for-loop ruff rule and fix warnings (#2984) --- archinstall/lib/boot.py | 3 +-- archinstall/lib/general.py | 3 +-- pyproject.toml | 1 - 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/archinstall/lib/boot.py b/archinstall/lib/boot.py index c60f412d..605a0764 100644 --- a/archinstall/lib/boot.py +++ b/archinstall/lib/boot.py @@ -80,8 +80,7 @@ class Boot: def __iter__(self) -> Iterator[bytes]: if self.session: - for value in self.session: - yield value + yield from self.session def __contains__(self, key: bytes) -> bool: if self.session is None: diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 141a7cb0..92420bda 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -383,8 +383,7 @@ class SysCommand: def __iter__(self, *args: list[Any], **kwargs: dict[str, Any]) -> Iterator[bytes]: if self.session: - for line in self.session: - yield line + yield from self.session def __getitem__(self, key: slice) -> bytes | None: if not self.session: diff --git a/pyproject.toml b/pyproject.toml index f2993be6..e3651a68 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -211,7 +211,6 @@ ignore = [ "RUF012", # mutable-class-default "RUF015", # unnecessary-iterable-allocation-for-first-element "RUF039", # unraw-re-pattern - "UP028", # yield-in-for-loop "UP037", # quoted-annotation "W191", # tab-indentation ]