From: Nathan Chancellor <nathan@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
Guillaume Tucker <gtucker@gtucker.io>
Cc: linux-kbuild@vger.kernel.org
Subject: [PATCH 2/3] scripts/container: Use list comprehension in get_names()
Date: Thu, 22 Jan 2026 16:27:22 -0700 [thread overview]
Message-ID: <20260122-scripts-container-ruff-fixes-v1-2-fd1b928c3f10@kernel.org> (raw)
In-Reply-To: <20260122-scripts-container-ruff-fixes-v1-0-fd1b928c3f10@kernel.org>
'ruff check --select C4 scripts/container' warns:
C400 Unnecessary generator (rewrite as a list comprehension)
--> scripts/container:113:16
|
111 | def get_names(cls):
112 | """Get a list of all the runtime names"""
113 | return list(runtime.name for runtime in cls.runtimes)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114 |
115 | @classmethod
|
help: Rewrite as a list comprehension
Do as it suggests.
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
scripts/container | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/container b/scripts/container
index dae475c6d262..5afaad762492 100755
--- a/scripts/container
+++ b/scripts/container
@@ -110,7 +110,7 @@ class Runtimes:
@classmethod
def get_names(cls):
"""Get a list of all the runtime names"""
- return list(runtime.name for runtime in cls.runtimes)
+ return [runtime.name for runtime in cls.runtimes]
@classmethod
def get(cls, name):
--
2.52.0
next prev parent reply other threads:[~2026-01-22 23:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-22 23:27 [PATCH 0/3] scripts/container: Minor fixups suggested by ruff Nathan Chancellor
2026-01-22 23:27 ` [PATCH 1/3] scripts/container: Turn runtimes class variable into a tuple Nathan Chancellor
2026-01-23 20:34 ` Guillaume Tucker
2026-01-22 23:27 ` Nathan Chancellor [this message]
2026-01-23 20:38 ` [PATCH 2/3] scripts/container: Use list comprehension in get_names() Guillaume Tucker
2026-01-22 23:27 ` [PATCH 3/3] scripts/container: Use iterable unpacking for _get_opts() Nathan Chancellor
2026-01-23 20:45 ` Guillaume Tucker
2026-01-23 15:14 ` [PATCH 0/3] scripts/container: Minor fixups suggested by ruff Miguel Ojeda
2026-01-23 21:01 ` Nathan Chancellor
2026-01-23 23:55 ` Miguel Ojeda
2026-01-23 20:26 ` Guillaume Tucker
2026-01-23 23:46 ` Nathan Chancellor
2026-02-04 8:54 ` Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260122-scripts-container-ruff-fixes-v1-2-fd1b928c3f10@kernel.org \
--to=nathan@kernel.org \
--cc=gtucker@gtucker.io \
--cc=linux-kbuild@vger.kernel.org \
--cc=nsc@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox