mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-01-15 21:40:19 -06:00
keyword only arguments in some places
This commit is contained in:
@@ -108,9 +108,9 @@ def _setdefault_kwargs(kwargs: Dict[str, Any]) -> None:
|
||||
|
||||
def cmd_output_b(
|
||||
*cmd: str,
|
||||
retcode: Optional[int] = 0,
|
||||
**kwargs: Any,
|
||||
) -> Tuple[int, bytes, Optional[bytes]]:
|
||||
retcode = kwargs.pop('retcode', 0)
|
||||
_setdefault_kwargs(kwargs)
|
||||
|
||||
try:
|
||||
@@ -176,9 +176,10 @@ if os.name != 'nt': # pragma: windows no cover
|
||||
|
||||
def cmd_output_p(
|
||||
*cmd: str,
|
||||
retcode: Optional[int] = 0,
|
||||
**kwargs: Any,
|
||||
) -> Tuple[int, bytes, Optional[bytes]]:
|
||||
assert kwargs.pop('retcode') is None
|
||||
assert retcode is None
|
||||
assert kwargs['stderr'] == subprocess.STDOUT, kwargs['stderr']
|
||||
_setdefault_kwargs(kwargs)
|
||||
|
||||
|
||||
@@ -117,6 +117,10 @@ def _thread_mapper(maxsize: int) -> Generator[
|
||||
def xargs(
|
||||
cmd: Tuple[str, ...],
|
||||
varargs: Sequence[str],
|
||||
*,
|
||||
color: bool = False,
|
||||
target_concurrency: int = 1,
|
||||
_max_length: int = _get_platform_max_length(),
|
||||
**kwargs: Any,
|
||||
) -> Tuple[int, bytes]:
|
||||
"""A simplified implementation of xargs.
|
||||
@@ -124,9 +128,6 @@ def xargs(
|
||||
color: Make a pty if on a platform that supports it
|
||||
target_concurrency: Target number of partitions to run concurrently
|
||||
"""
|
||||
color = kwargs.pop('color', False)
|
||||
target_concurrency = kwargs.pop('target_concurrency', 1)
|
||||
max_length = kwargs.pop('_max_length', _get_platform_max_length())
|
||||
cmd_fn = cmd_output_p if color else cmd_output_b
|
||||
retcode = 0
|
||||
stdout = b''
|
||||
@@ -136,7 +137,7 @@ def xargs(
|
||||
except parse_shebang.ExecutableNotFoundError as e:
|
||||
return e.to_output()[:2]
|
||||
|
||||
partitions = partition(cmd, varargs, target_concurrency, max_length)
|
||||
partitions = partition(cmd, varargs, target_concurrency, _max_length)
|
||||
|
||||
def run_cmd_partition(
|
||||
run_cmd: Tuple[str, ...],
|
||||
|
||||
Reference in New Issue
Block a user