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 3/3] scripts/container: Use iterable unpacking for _get_opts()
Date: Thu, 22 Jan 2026 16:27:23 -0700 [thread overview]
Message-ID: <20260122-scripts-container-ruff-fixes-v1-3-fd1b928c3f10@kernel.org> (raw)
In-Reply-To: <20260122-scripts-container-ruff-fixes-v1-0-fd1b928c3f10@kernel.org>
'ruff check --select RUF scripts/container' warns:
RUF005 Consider iterable unpacking instead of concatenation
--> scripts/container:89:16
|
88 | def _get_opts(self, container_name):
89 | return super()._get_opts(container_name) + [
| ________________^
90 | | '--user', f'{self._uid}:{self._gid}'
91 | | ]
| |_________^
|
help: Replace with iterable unpacking
RUF005 Consider iterable unpacking instead of concatenation
--> scripts/container:100:16
|
99 | def _get_opts(self, container_name):
100 | return super()._get_opts(container_name) + [
| ________________^
101 | | '--userns', f'keep-id:uid={self._uid},gid={self._gid}',
102 | | ]
| |_________^
|
help: Replace with iterable unpacking
Iterable unpacking is more efficient, so switch to it as it suggests
(even if it is unlikely to matter given how small these lists are).
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
scripts/container | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/container b/scripts/container
index 5afaad762492..09a14f7e29f3 100755
--- a/scripts/container
+++ b/scripts/container
@@ -86,7 +86,8 @@ class DockerRuntime(CommonRuntime):
name = 'docker'
def _get_opts(self, container_name):
- return super()._get_opts(container_name) + [
+ return [
+ *super()._get_opts(container_name),
'--user', f'{self._uid}:{self._gid}'
]
@@ -97,7 +98,8 @@ class PodmanRuntime(CommonRuntime):
name = 'podman'
def _get_opts(self, container_name):
- return super()._get_opts(container_name) + [
+ return [
+ *super()._get_opts(container_name),
'--userns', f'keep-id:uid={self._uid},gid={self._gid}',
]
--
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 ` [PATCH 2/3] scripts/container: Use list comprehension in get_names() Nathan Chancellor
2026-01-23 20:38 ` Guillaume Tucker
2026-01-22 23:27 ` Nathan Chancellor [this message]
2026-01-23 20:45 ` [PATCH 3/3] scripts/container: Use iterable unpacking for _get_opts() 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-3-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