mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 00:20:18 +01:00
[Easy][BE]: Enable RUF008 and RUF016 checks (#116195)
Enables a few more static linting checks for mutable defaults in dataclasses and for detecting a common type error. Pull Request resolved: https://github.com/pytorch/pytorch/pull/116195 Approved by: https://github.com/malfet
This commit is contained in:
parent
bc0d8649a4
commit
6e2c9be501
|
|
@ -106,7 +106,9 @@ select = [
|
|||
"PT025",
|
||||
"PT026",
|
||||
"PYI",
|
||||
"RUF008", # mutable dataclass default
|
||||
"RUF015", # access first ele in constant time
|
||||
"RUF016", # type error non-integer index
|
||||
"RUF017",
|
||||
"TRY200",
|
||||
"TRY302",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import functools
|
||||
from contextlib import contextmanager
|
||||
from dataclasses import dataclass
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Set, Tuple
|
||||
|
||||
import torch
|
||||
|
|
@ -27,7 +27,7 @@ class TracingConfig:
|
|||
in :meth:`~torch.fx.Tracer.trace`.
|
||||
"""
|
||||
|
||||
tracer: torch.fx.Tracer = torch.fx.Tracer()
|
||||
tracer: torch.fx.Tracer = field(default_factory=torch.fx.Tracer)
|
||||
concrete_args: Optional[Dict[str, Any]] = None
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user