Update Optional[x] -> x | None and Union[x, y] to x | y (#26633)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
This commit is contained in:
Harry Mellor
2025-10-12 09:51:31 -07:00
committed by GitHub
parent 9bb38130cb
commit 8fcaaf6a16
944 changed files with 9490 additions and 10121 deletions
+6 -5
View File
@@ -1,10 +1,11 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import os
from collections.abc import Callable
from concurrent.futures import Future, ThreadPoolExecutor
from functools import cached_property
from multiprocessing import Lock
from typing import Any, Callable, Optional, Union
from typing import Any
import torch
import torch.distributed as dist
@@ -36,7 +37,7 @@ class UniProcExecutor(ExecutorBase):
shared_worker_lock=Lock(),
)
self.async_output_thread: Optional[ThreadPoolExecutor] = None
self.async_output_thread: ThreadPoolExecutor | None = None
if self.max_concurrent_batches > 1:
self.async_output_thread = ThreadPoolExecutor(
max_workers=1, thread_name_prefix="WorkerAsyncOutput"
@@ -60,10 +61,10 @@ class UniProcExecutor(ExecutorBase):
def collective_rpc(
self,
method: Union[str, Callable],
timeout: Optional[float] = None,
method: str | Callable,
timeout: float | None = None,
args: tuple = (),
kwargs: Optional[dict] = None,
kwargs: dict | None = None,
non_block: bool = False,
) -> list[Any]:
if kwargs is None: