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
+1 -2
View File
@@ -3,7 +3,6 @@
import inspect
from collections.abc import Sequence
from typing import Optional
import numpy as np
import pytest
@@ -271,7 +270,7 @@ def test_sampling_metadata_in_input_batch(device: str, batch_size: int):
reqs, req_ids_retained, input_batch.req_id_to_index, device=torch.device(device)
)
def same(t1: Optional[torch.Tensor], t2: Optional[torch.Tensor]) -> bool:
def same(t1: torch.Tensor | None, t2: torch.Tensor | None) -> bool:
return (t1 is None and t2 is None) or (
t1 is not None and t2 is not None and torch.allclose(t1, t2)
)
@@ -4,8 +4,7 @@
import multiprocessing as mp
import os
import tempfile
from multiprocessing import Queue
from typing import Optional
from multiprocessing.queues import Queue
from unittest.mock import patch
import pytest
@@ -16,7 +15,7 @@ from vllm.utils import MemorySnapshot
from vllm.v1.worker.gpu_worker import Worker, init_worker_distributed_environment
# Global queue to track operation order across processes
_QUEUE: Optional[Queue] = None
_QUEUE: Queue | None = None
def track_operation(operation: str, rank: int):