diff options
author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 20:43:59 +0000 |
---|---|---|
committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-01-01 20:48:39 +0000 |
commit | 14a9289d780240bbce78ad3640e8e1b1b12df43f (patch) | |
tree | fd753f5b0f8c7053923b78c8fef2b90b60f9c7fa /sphinx/util/parallel.py | |
parent | 26f79b0d2dd88b353ac65623897bdfbe8bc07cab (diff) | |
download | sphinx-git-14a9289d780240bbce78ad3640e8e1b1b12df43f.tar.gz |
Use PEP 604 types
Diffstat (limited to 'sphinx/util/parallel.py')
-rw-r--r-- | sphinx/util/parallel.py | 8 |
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 |