osmith submitted this change.
testenv: remove *args from various functions
Whenever **kwargs can be passed to functions, I have also added *args
even though it is unused. If it was actually used, it could lead to
confusing behavior as they are passed along after keyword arguments.
Related: https://docs.astral.sh/ruff/rules/star-arg-unpacking-after-keyword-arg/
Change-Id: I18edc0ee16bd23e1188162156939e9b51f6b13d2
---
M .ruff.toml
M _testenv/testenv/cmd.py
M _testenv/testenv/podman.py
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/.ruff.toml b/.ruff.toml
index 53bd7ed..d8fc4db 100644
--- a/.ruff.toml
+++ b/.ruff.toml
@@ -5,7 +5,6 @@
[lint]
ignore = [
- "B026", # https://docs.astral.sh/ruff/rules/star-arg-unpacking-after-keyword-arg/
"BLE001", # https://docs.astral.sh/ruff/rules/blind-except/
"DTZ001", # https://docs.astral.sh/ruff/rules/call-datetime-without-tzinfo/
"DTZ004", # https://docs.astral.sh/ruff/rules/call-datetime-utcfromtimestamp/
diff --git a/_testenv/testenv/cmd.py b/_testenv/testenv/cmd.py
index 06630c0..4da2360 100644
--- a/_testenv/testenv/cmd.py
+++ b/_testenv/testenv/cmd.py
@@ -121,10 +121,10 @@
return ret
-def run(cmd, check=True, env=None, no_podman=False, stdin=subprocess.DEVNULL, *args, **kwargs):
+def run(cmd, check=True, env=None, no_podman=False, stdin=subprocess.DEVNULL, **kwargs):
env = env or {}
if not no_podman and testenv.args.podman:
- return testenv.podman.exec_cmd(cmd, check=check, env=env, *args, **kwargs)
+ return testenv.podman.exec_cmd(cmd, check=check, env=env, **kwargs)
logging.debug(f"+ {cmd}")
@@ -135,7 +135,6 @@
shell=isinstance(cmd, str),
stdin=stdin,
check=False,
- *args,
**kwargs,
)
diff --git a/_testenv/testenv/podman.py b/_testenv/testenv/podman.py
index 3641693..4fcb905 100644
--- a/_testenv/testenv/podman.py
+++ b/_testenv/testenv/podman.py
@@ -137,7 +137,7 @@
run_shell_on_stop = True
-def exec_cmd(cmd, podman_opts=None, cwd=None, env=None, *args, **kwargs):
+def exec_cmd(cmd, podman_opts=None, cwd=None, env=None, **kwargs):
podman_opts = podman_opts or []
env = env or {}
@@ -158,7 +158,6 @@
return testenv.cmd.run(
["podman", "exec"] + podman_opts + [container_name] + cmd,
no_podman=True,
- *args,
**kwargs,
)
To view, visit change 43305. To unsubscribe, or for help writing mail filters, visit settings.