PEP585: More UP006 fixes (#146392)

This should be the final PR before we can enable RUFF UP006.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/146392
Approved by: https://github.com/justinchuby, https://github.com/albanD, https://github.com/Skylion007
This commit is contained in:
Aaron Orenstein
2025-02-19 14:37:18 -08:00
committed by PyTorch MergeBot
parent 76ad19a549
commit db4ce78d46
81 changed files with 283 additions and 329 deletions

View File

@ -7,12 +7,12 @@ import typing
import warnings
import weakref
from abc import abstractmethod
from contextlib import AbstractContextManager
from dataclasses import dataclass
from typing import (
Any,
Callable,
ClassVar,
ContextManager,
Generic,
NewType,
Optional,
@ -1741,7 +1741,9 @@ class MetaConverter(Generic[_TensorT]):
# subclasses. Relevant test is
# DynamicShapesFunctionTests::test_add_dynamic_shapes in
# test/dynamo/test_dynamic_shapes.py
maybe_fake_mgr: ContextManager[None] = contextlib.nullcontext()
maybe_fake_mgr: AbstractContextManager[
None
] = contextlib.nullcontext()
from torch._subclasses.fake_tensor import (
in_kernel_invocation_manager,
maybe_get_fake_mode,