[BE][Ez]: Apply PYI059 - Generic always come last (#127685)

Generic baseclass should always be last or unexpected issues can occur, especially in non-stub files (such as with MRO). Applies autofixes from the preview PYI059 rule to fix the issues in the codebase.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/127685
Approved by: https://github.com/ezyang
This commit is contained in:
Aaron Gokaslan 2024-06-02 13:38:56 +00:00 committed by PyTorch MergeBot
parent c2547dfcc3
commit e24a87ed8d
3 changed files with 3 additions and 3 deletions

View file

@ -2423,7 +2423,7 @@ class TestFunctionalMapDataPipe(TestCase):
_generic_namedtuple_allowed = sys.version_info >= (3, 7) and sys.version_info < (3, 9)
if _generic_namedtuple_allowed:
class InvalidData(Generic[T_co], NamedTuple):
class InvalidData(NamedTuple, Generic[T_co]):
name: str
data: T_co

View file

@ -390,7 +390,7 @@ P = ParamSpec("P")
RV = TypeVar("RV", covariant=True)
class CachedMethod(Generic[P, RV], Protocol):
class CachedMethod(Protocol, Generic[P, RV]):
@staticmethod
def clear_cache(self) -> None:
...

View file

@ -61,7 +61,7 @@ _K = TypeVar("_K")
_V = TypeVar("_V")
class OverrideDict(Generic[_K, _V], Collection[_K]):
class OverrideDict(Collection[_K], Generic[_K, _V]):
"""A dictionary that merges built-in and custom symbolic functions.
It supports overriding and un-overriding built-in symbolic functions with custom