mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-05 04:36:52 +00:00
improve coverage a bit
This commit is contained in:
parent
639dfe1671
commit
bb3c8d2607
3 changed files with 50 additions and 21 deletions
|
|
@ -3,6 +3,7 @@ import collections
|
|||
import errno
|
||||
import itertools
|
||||
import logging
|
||||
import multiprocessing.pool
|
||||
import signal
|
||||
import tokenize
|
||||
from typing import Dict
|
||||
|
|
@ -15,11 +16,6 @@ from flake8 import exceptions
|
|||
from flake8 import processor
|
||||
from flake8 import utils
|
||||
|
||||
try:
|
||||
import multiprocessing.pool
|
||||
except ImportError:
|
||||
multiprocessing = None # type: ignore
|
||||
|
||||
Results = List[Tuple[str, int, int, str, Optional[str]]]
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
|
@ -40,13 +36,6 @@ SERIAL_RETRY_ERRNOS = {
|
|||
}
|
||||
|
||||
|
||||
def _multiprocessing_is_fork() -> bool:
|
||||
"""Class state is only preserved when using the `fork` strategy."""
|
||||
return bool(
|
||||
multiprocessing and multiprocessing.get_start_method() == "fork"
|
||||
)
|
||||
|
||||
|
||||
class Manager:
|
||||
"""Manage the parallelism and checker instances for each plugin and file.
|
||||
|
||||
|
|
@ -113,7 +102,9 @@ class Manager:
|
|||
# - we're processing a diff, which again does not work well with
|
||||
# multiprocessing and which really shouldn't require multiprocessing
|
||||
# - the user provided some awful input
|
||||
if not _multiprocessing_is_fork():
|
||||
|
||||
# class state is only preserved when using the `fork` strategy.
|
||||
if multiprocessing.get_start_method() != "fork":
|
||||
LOG.warning(
|
||||
"The multiprocessing module is not available. "
|
||||
"Ignoring --jobs arguments."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue