From 43a1c1fbdebb5d964e30dddc018cd7a61a3c2937 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 5 May 2026 12:38:51 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[performance=20improvement]?= =?UTF-8?q?=20optimize=20redundant=20strip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaced `line.strip()` called twice inside a list comprehension with the walrus operator `(stripped := line.strip())` to prevent redundant calculations and temporary allocations per loop iteration. Co-authored-by: bashandbone <89049923+bashandbone@users.noreply.github.com> --- src/codeweaver/providers/optimize.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/codeweaver/providers/optimize.py b/src/codeweaver/providers/optimize.py index b0d06089..26174d30 100644 --- a/src/codeweaver/providers/optimize.py +++ b/src/codeweaver/providers/optimize.py @@ -51,7 +51,8 @@ def _nvidia_smi_device_ids() -> list[int]: text=True, timeout=2.0, ) - return [int(line.strip()) for line in out.splitlines() if line.strip().isdigit()] + # Using walrus operator avoids redundant .strip() calls on each line + return [int(stripped) for line in out.splitlines() if (stripped := line.strip()).isdigit()] return []