summaryrefslogtreecommitdiff
path: root/sphinx/util/parallel.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2022-12-30 21:13:29 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-01 20:48:38 +0000
commit26f79b0d2dd88b353ac65623897bdfbe8bc07cab (patch)
tree0d2f0c752cf1f49a45cde1d7f414d75a6114f1ce /sphinx/util/parallel.py
parentf4c8a0a68e0013808d169357c9f77ebdf19d0f4e (diff)
downloadsphinx-git-26f79b0d2dd88b353ac65623897bdfbe8bc07cab.tar.gz
Use PEP 595 types
Diffstat (limited to 'sphinx/util/parallel.py')
-rw-r--r--sphinx/util/parallel.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py
index a37b85346..55386c56a 100644
--- a/sphinx/util/parallel.py
+++ b/sphinx/util/parallel.py
@@ -6,7 +6,7 @@ import os
import time
import traceback
from math import sqrt
-from typing import Any, Callable, Dict, List, Optional, Sequence
+from typing import Any, Callable, Optional, Sequence
try:
import multiprocessing
@@ -49,15 +49,15 @@ class ParallelTasks:
def __init__(self, nproc: int) -> None:
self.nproc = nproc
# (optional) function performed by each task on the result of main task
- self._result_funcs: Dict[int, Callable] = {}
+ self._result_funcs: dict[int, Callable] = {}
# task arguments
- self._args: Dict[int, Optional[List[Any]]] = {}
+ self._args: dict[int, Optional[list[Any]]] = {}
# list of subprocesses (both started and waiting)
- self._procs: Dict[int, Any] = {}
+ self._procs: dict[int, Any] = {}
# list of receiving pipe connections of running subprocesses
- self._precvs: Dict[int, Any] = {}
+ self._precvs: dict[int, Any] = {}
# list of receiving pipe connections of waiting subprocesses
- self._precvsWaiting: Dict[int, Any] = {}
+ self._precvsWaiting: dict[int, Any] = {}
# number of working subprocesses
self._pworking = 0
# task number of each subprocess
@@ -136,7 +136,7 @@ class ParallelTasks:
return joined_any
-def make_chunks(arguments: Sequence[str], nproc: int, maxbatch: int = 10) -> List[Any]:
+def make_chunks(arguments: Sequence[str], nproc: int, maxbatch: int = 10) -> list[Any]:
# determine how many documents to read in one go
nargs = len(arguments)
chunksize = nargs // nproc