diff options
author | danieleades <33452915+danieleades@users.noreply.github.com> | 2022-08-28 21:17:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-28 21:17:14 +0100 |
commit | 5e9550c78e3421dd7dcab037021d996841178f67 (patch) | |
tree | 601e5f52f4324ea96f5386db32e5952eaf1b0052 /sphinx/util/parallel.py | |
parent | f56e61d1a1a83db1fb95502d39ea830284c0a0d9 (diff) | |
download | sphinx-git-5e9550c78e3421dd7dcab037021d996841178f67.tar.gz |
Fix more strict static typing errors (#10681)
Diffstat (limited to 'sphinx/util/parallel.py')
-rw-r--r-- | sphinx/util/parallel.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py index e89418ad3..267f7bd4c 100644 --- a/sphinx/util/parallel.py +++ b/sphinx/util/parallel.py @@ -9,8 +9,9 @@ from typing import Any, Callable, Dict, List, Optional, Sequence try: import multiprocessing + HAS_MULTIPROCESSING = True except ImportError: - multiprocessing = None + HAS_MULTIPROCESSING = False from sphinx.errors import SphinxParallelError from sphinx.util import logging @@ -33,7 +34,9 @@ class SerialTasks: def __init__(self, nproc: int = 1) -> None: pass - def add_task(self, task_func: Callable, arg: Any = None, result_func: Callable = None) -> None: # NOQA + def add_task( + self, task_func: Callable, arg: Any = None, result_func: Optional[Callable] = None + ) -> None: if arg is not None: res = task_func(arg) else: |