Skip to content

Commit

Permalink
Resolved issue #1669: Parallel now defaults to number of CPU cores if…
Browse files Browse the repository at this point in the history
… no value is provided
  • Loading branch information
timothycrosley committed Feb 27, 2021
1 parent 713a059 commit fb6e0a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -9,6 +9,7 @@ Find out more about isort's release policy [here](https://pycqa.github.io/isort/
- Implemented #1648: Export MyPY type hints.
- Implemented #1641: Identified import statements now return runnable code.
- Implemented #1661: Added "wemake" profile.
- implemented #1669: Parallel (`-j`) now defaults to number of CPU cores if no value is provided.

### 5.7.0 December 30th 2020
- Fixed #1612: In rare circumstances an extra comma is added after import and before comment.
Expand Down
10 changes: 9 additions & 1 deletion isort/main.py
Expand Up @@ -2,6 +2,7 @@
import argparse
import functools
import json
import multiprocessing
import os
import sys
from gettext import gettext as _
Expand Down Expand Up @@ -268,7 +269,13 @@ def _build_arg_parser() -> argparse.ArgumentParser:
help="Use the old deprecated finder logic that relies on environment introspection magic.",
)
general_group.add_argument(
"-j", "--jobs", help="Number of files to process in parallel.", dest="jobs", type=int
"-j",
"--jobs",
help="Number of files to process in parallel.",
dest="jobs",
type=int,
nargs="?",
const=multiprocessing.cpu_count(),
)
general_group.add_argument(
"--ac",
Expand Down Expand Up @@ -844,6 +851,7 @@ def parse_args(argv: Optional[Sequence[str]] = None) -> Dict[str, Any]:
arguments["multi_line_output"] = WrapModes(int(multi_line_output))
else:
arguments["multi_line_output"] = WrapModes[multi_line_output]

return arguments


Expand Down

0 comments on commit fb6e0a9

Please sign in to comment.