diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-10 06:30:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-05-10 06:30:40 +0000 |
commit | f174d1c83b97cd7007a792255c5e132306e6c1a3 (patch) | |
tree | 0506eadfc5ef4db1ca746799d35d4610df9a9c78 /pre_commit/lang_base.py | |
parent | Adding upstream version 3.2.2. (diff) | |
download | pre-commit-f174d1c83b97cd7007a792255c5e132306e6c1a3.tar.xz pre-commit-f174d1c83b97cd7007a792255c5e132306e6c1a3.zip |
Adding upstream version 3.3.1.upstream/3.3.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'pre_commit/lang_base.py')
-rw-r--r-- | pre_commit/lang_base.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/pre_commit/lang_base.py b/pre_commit/lang_base.py index 9480c55..4a993ea 100644 --- a/pre_commit/lang_base.py +++ b/pre_commit/lang_base.py @@ -1,7 +1,6 @@ from __future__ import annotations import contextlib -import multiprocessing import os import random import re @@ -15,9 +14,9 @@ from typing import Sequence import pre_commit.constants as C from pre_commit import parse_shebang +from pre_commit import xargs from pre_commit.prefix import Prefix from pre_commit.util import cmd_output_b -from pre_commit.xargs import xargs FIXED_RANDOM_SEED = 1542676187 @@ -140,10 +139,7 @@ def target_concurrency() -> int: if 'TRAVIS' in os.environ: return 2 else: - try: - return multiprocessing.cpu_count() - except NotImplementedError: - return 1 + return xargs.cpu_count() def _shuffled(seq: Sequence[str]) -> list[str]: @@ -171,7 +167,7 @@ def run_xargs( # ordering. file_args = _shuffled(file_args) jobs = target_concurrency() - return xargs(cmd, file_args, target_concurrency=jobs, color=color) + return xargs.xargs(cmd, file_args, target_concurrency=jobs, color=color) def hook_cmd(entry: str, args: Sequence[str]) -> tuple[str, ...]: |