mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
add --jobs option to autoupdate
This commit is contained in:
parent
bab5f70a38
commit
ddbee32ad0
4 changed files with 72 additions and 43 deletions
|
|
@ -3,6 +3,7 @@ from __future__ import annotations
|
|||
import concurrent.futures
|
||||
import contextlib
|
||||
import math
|
||||
import multiprocessing
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
|
@ -22,6 +23,13 @@ TArg = TypeVar('TArg')
|
|||
TRet = TypeVar('TRet')
|
||||
|
||||
|
||||
def cpu_count() -> int:
|
||||
try:
|
||||
return multiprocessing.cpu_count()
|
||||
except NotImplementedError:
|
||||
return 1
|
||||
|
||||
|
||||
def _environ_size(_env: MutableMapping[str, str] | None = None) -> int:
|
||||
environ = _env if _env is not None else getattr(os, 'environb', os.environ)
|
||||
size = 8 * len(environ) # number of pointers in `envp`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue