summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2023-03-20 19:17:53 +0100
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2023-03-29 17:04:12 +0200
commit5c2eddd5a1f0a078db128b1ef86b119c4376815a (patch)
tree2770654f9dc7c3430c1e0f0828864eeceb4c42b2
parent51b3566170be25582b5c3216a54b024caf3d431f (diff)
downloadsetuptools-scm-5c2eddd5a1f0a078db128b1ef86b119c4376815a.tar.gz
refactor: has_command: inline optional args
-rw-r--r--src/setuptools_scm/utils.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/setuptools_scm/utils.py b/src/setuptools_scm/utils.py
index 6788f23..f74740b 100644
--- a/src/setuptools_scm/utils.py
+++ b/src/setuptools_scm/utils.py
@@ -10,6 +10,7 @@ import warnings
from types import CodeType
from types import FunctionType
from typing import NamedTuple
+from typing import Sequence
from typing import TYPE_CHECKING
from . import _run_cmd
@@ -55,10 +56,9 @@ def function_has_arg(fn: object | FunctionType, argname: str) -> bool:
return argname in code.co_varnames
-def has_command(name: str, args: list[str] | None = None, warn: bool = True) -> bool:
+def has_command(name: str, args: Sequence[str] = ["help"], warn: bool = True) -> bool:
try:
- cmd = [name, "help"] if args is None else [name, *args]
- p = _run_cmd.run(cmd, cwd=".", timeout=5)
+ p = _run_cmd.run([name, *args], cwd=".", timeout=5)
except OSError:
_trace.trace(*sys.exc_info())
res = False