[Misc] Replace Optional[X] with X | None syntax (#33332)

Signed-off-by: carlory <baofa.fan@daocloud.io>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
杨朱 · Kiki
2026-01-30 17:56:59 +08:00
committed by GitHub
parent c87eac18f7
commit 1a7894dbdf
56 changed files with 129 additions and 135 deletions

View File

@@ -5,7 +5,7 @@ import copy
from collections import defaultdict
from collections.abc import Callable
from dataclasses import asdict, dataclass, field
from typing import Any, Optional, TypeAlias
from typing import Any, TypeAlias
from torch._C._autograd import DeviceType, _KinetoEvent, _ProfilerResult
from torch._C._profiler import _EventType, _ExperimentalConfig, _ProfilerEvent
@@ -31,7 +31,7 @@ except ImportError:
@dataclass
class _ModuleTreeNode:
event: _ProfilerEvent
parent: Optional["_ModuleTreeNode"] = None
parent: "_ModuleTreeNode | None" = None
children: list["_ModuleTreeNode"] = field(default_factory=list)
trace: str = ""