pytorch/torchgen
Aaron Orenstein 07669ed960 PEP585 update - benchmarks tools torchgen (#145101)
This is one of a series of PRs to update us to PEP585 (changing Dict -> dict, List -> list, etc).  Most of the PRs were completely automated with RUFF as follows:

Since RUFF UP006 is considered an "unsafe" fix first we need to enable unsafe fixes:

```
--- a/tools/linter/adapters/ruff_linter.py
+++ b/tools/linter/adapters/ruff_linter.py
@@ -313,6 +313,7 @@
                     "ruff",
                     "check",
                     "--fix-only",
+                    "--unsafe-fixes",
                     "--exit-zero",
                     *([f"--config={config}"] if config else []),
                     "--stdin-filename",
```

Then we need to tell RUFF to allow UP006 (as a final PR once all of these have landed this will be made permanent):

```
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -40,7 +40,7 @@

 [tool.ruff]
-target-version = "py38"
+target-version = "py39"
 line-length = 88
 src = ["caffe2", "torch", "torchgen", "functorch", "test"]

@@ -87,7 +87,6 @@
     "SIM116", # Disable Use a dictionary instead of consecutive `if` statements
     "SIM117",
     "SIM118",
-    "UP006", # keep-runtime-typing
     "UP007", # keep-runtime-typing
 ]
 select = [
```

Finally running `lintrunner -a --take RUFF` will fix up the deprecated uses.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/145101
Approved by: https://github.com/bobrenjc93
2025-01-18 05:05:07 +00:00
..
_autoheuristic [BE][Easy] use pathlib.Path instead of dirname / ".." / pardir (#129374) 2024-12-29 17:23:13 +00:00
aoti [AOTI] Support _int_mm (#144571) 2025-01-13 20:32:29 +00:00
api Revert "Make functionalization ViewMeta serializable with pickle. (#143712)" 2025-01-17 00:52:50 +00:00
decompositions Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
dest [1/N] Apply py39 ruff fixes (#138578) 2024-12-02 21:46:18 +00:00
executorch [TorchGen] remove remove_non_owning_ref_types from valuetype_type (#142449) 2024-12-12 00:15:44 +00:00
fuse
operator_versions Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
selective_build
shape_functions Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
static_runtime [BE][CI] bump ruff to 0.8.4 (#143753) 2024-12-24 12:24:10 +00:00
__init__.py
BUCK.oss
BUILD.bazel
build.bzl
code_template.py [1/N] Apply py39 ruff fixes (#138578) 2024-12-02 21:46:18 +00:00
context.py [2/N] Apply py39 ruff fixes (#141938) 2024-12-05 06:26:06 +00:00
gen.py PEP585 update - benchmarks tools torchgen (#145101) 2025-01-18 05:05:07 +00:00
gen_aoti_c_shim.py Fix unused Python variables outside torch/ and test/ (#136359) 2024-12-11 17:10:23 +00:00
gen_backend_stubs.py torchgen: move dispatch_helpers out of RegisterDispatchDefinitions.ini (#144363) 2025-01-10 18:13:06 +00:00
gen_executorch.py Revert "Use absolute path path.resolve() -> path.absolute() (#129409)" 2025-01-04 14:17:20 +00:00
gen_functionalization_type.py Revert "Make functionalization ViewMeta serializable with pickle. (#143712)" 2025-01-17 00:52:50 +00:00
gen_lazy_tensor.py [BE][Easy] use pathlib.Path instead of dirname / ".." / pardir (#129374) 2024-12-29 17:23:13 +00:00
gen_schema_utils.py [2/N] Apply py39 ruff fixes (#141938) 2024-12-05 06:26:06 +00:00
gen_vmap_plumbing.py [1/N] Apply py39 ruff fixes (#138578) 2024-12-02 21:46:18 +00:00
local.py [1/N] Apply py39 ruff fixes (#138578) 2024-12-02 21:46:18 +00:00
model.py Remove ConstQuantizerPtr in torchgen (#142375) 2024-12-10 02:37:01 +00:00
native_function_generation.py [aotd] capture rrelu_with_noise noise mutation in compile (#141867) 2024-12-04 12:18:58 +00:00
utils.py Shard RegisterDispatchKey (#144364) 2025-01-10 18:21:19 +00:00
yaml_utils.py