Update ruff to 0.13.1 (#163744)

Update ruff to 0.13.1 so that we can remove `UP038` from `pyproject.toml` because it has been removed from supported rules of ruff.
There are some fixes, the most notable one is [(PYI059)](https://docs.astral.sh/ruff/rules/generic-not-last-base-class/#generic-not-last-base-class-pyi059)
```
Checks for classes inheriting from typing.Generic[] where Generic[] is not the last base class in the bases tuple.

```

A BC-breaking change is introduced to change the typing of `OrderedSet .storage`

Pull Request resolved: https://github.com/pytorch/pytorch/pull/163744
Approved by: https://github.com/Skylion007, https://github.com/jingsh
This commit is contained in:
Yuanyuan Chen
2025-09-26 10:12:21 +00:00
committed by PyTorch MergeBot
parent 6a2bd1f4ee
commit 7441a1b9b1
10 changed files with 15 additions and 16 deletions

View File

@ -11,7 +11,7 @@ from dataclasses import is_dataclass
from enum import auto, Enum
from pathlib import Path
from pprint import pformat
from typing import Any, Callable, Generic, Literal, NoReturn, TYPE_CHECKING, TypeVar
from typing import Any, Callable, Generic, NoReturn, TYPE_CHECKING, TypeVar
from typing_extensions import assert_never, deprecated, Self
from torchgen.code_template import CodeTemplate
@ -482,7 +482,7 @@ class NamespaceHelper:
class OrderedSet(Generic[T]):
storage: dict[T, Literal[None]]
storage: dict[T, None]
def __init__(self, iterable: Iterable[T] | None = None) -> None:
if iterable is None: