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
+3 -2
View File
@@ -11,8 +11,9 @@ import contextlib
import functools
import logging
import os
from collections.abc import Callable
from enum import Enum
from typing import Any, Callable, Literal, Optional
from typing import Any, Literal
import torch
@@ -43,7 +44,7 @@ def tensor_cache(fn: Callable[..., torch.Tensor]) -> Callable[..., torch.Tensor]
A wrapped version of the input function with single-entry caching.
"""
cache_entries: tuple[Optional[tuple], Optional[dict], Any] = []
cache_entries: tuple[tuple | None, dict | None, Any] = []
cache_size = 4
@functools.wraps(fn)