diff options
author | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-03-20 19:17:53 +0100 |
---|---|---|
committer | Ronny Pfannschmidt <opensource@ronnypfannschmidt.de> | 2023-03-29 17:04:12 +0200 |
commit | 5c2eddd5a1f0a078db128b1ef86b119c4376815a (patch) | |
tree | 2770654f9dc7c3430c1e0f0828864eeceb4c42b2 | |
parent | 51b3566170be25582b5c3216a54b024caf3d431f (diff) | |
download | setuptools-scm-5c2eddd5a1f0a078db128b1ef86b119c4376815a.tar.gz |
refactor: has_command: inline optional args
-rw-r--r-- | src/setuptools_scm/utils.py | 6 |
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 |