summaryrefslogtreecommitdiff
path: root/sphinx/util/parallel.py
diff options
context:
space:
mode:
authorAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-01 20:43:59 +0000
committerAdam Turner <9087854+aa-turner@users.noreply.github.com>2023-01-01 20:48:39 +0000
commit14a9289d780240bbce78ad3640e8e1b1b12df43f (patch)
treefd753f5b0f8c7053923b78c8fef2b90b60f9c7fa /sphinx/util/parallel.py
parent26f79b0d2dd88b353ac65623897bdfbe8bc07cab (diff)
downloadsphinx-git-14a9289d780240bbce78ad3640e8e1b1b12df43f.tar.gz
Use PEP 604 types
Diffstat (limited to 'sphinx/util/parallel.py')
-rw-r--r--sphinx/util/parallel.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py
index 55386c56a..fec275572 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, Optional, Sequence
+from typing import Any, Callable, Sequence
try:
import multiprocessing
@@ -30,7 +30,7 @@ class SerialTasks:
pass
def add_task(
- self, task_func: Callable, arg: Any = None, result_func: Optional[Callable] = None
+ self, task_func: Callable, arg: Any = None, result_func: Callable | None = None
) -> None:
if arg is not None:
res = task_func(arg)
@@ -51,7 +51,7 @@ class ParallelTasks:
# (optional) function performed by each task on the result of main task
self._result_funcs: dict[int, Callable] = {}
# task arguments
- self._args: dict[int, Optional[list[Any]]] = {}
+ self._args: dict[int, list[Any] | None] = {}
# list of subprocesses (both started and waiting)
self._procs: dict[int, Any] = {}
# list of receiving pipe connections of running subprocesses
@@ -80,7 +80,7 @@ class ParallelTasks:
pipe.send((failed, collector.logs, ret))
def add_task(
- self, task_func: Callable, arg: Any = None, result_func: Optional[Callable] = None
+ self, task_func: Callable, arg: Any = None, result_func: Callable | None = None
) -> None:
tid = self._taskid
self._taskid += 1