summaryrefslogtreecommitdiff
path: root/src/flake8/checker.py
diff options
context:
space:
mode:
authorRuairidh MacLeod <5160559+rkm@users.noreply.github.com>2020-05-12 14:23:26 +0100
committerAnthony Sottile <asottile@umich.edu>2020-05-13 13:25:51 -0700
commit45573570cf706f8490cd631ee6f6a58bc41f8130 (patch)
treeb4f42b855dfd87a0d4a0f4e6f6ab306da6ccc805 /src/flake8/checker.py
parent666be736e0a8632c217997201ef1117babf47c75 (diff)
downloadflake8-45573570cf706f8490cd631ee6f6a58bc41f8130.tar.gz
Parse --jobs as a custom argparse type. Fixes #567
Diffstat (limited to 'src/flake8/checker.py')
-rw-r--r--src/flake8/checker.py11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/flake8/checker.py b/src/flake8/checker.py
index 36a4735..d993cb9 100644
--- a/src/flake8/checker.py
+++ b/src/flake8/checker.py
@@ -137,19 +137,12 @@ class Manager(object):
return 0
jobs = self.options.jobs
- if jobs != "auto" and not jobs.isdigit():
- LOG.warning(
- '"%s" is not a valid parameter to --jobs. Must be one '
- 'of "auto" or a numerical value, e.g., 4.',
- jobs,
- )
- return 0
# If the value is "auto", we want to let the multiprocessing library
# decide the number based on the number of CPUs. However, if that
# function is not implemented for this particular value of Python we
# default to 1
- if jobs == "auto":
+ if jobs.is_auto:
try:
return multiprocessing.cpu_count()
except NotImplementedError:
@@ -157,7 +150,7 @@ class Manager(object):
# Otherwise, we know jobs should be an integer and we can just convert
# it to an integer
- return int(jobs)
+ return jobs.n_jobs
def _handle_results(self, filename, results):
style_guide = self.style_guide