Adds a ruff lint rule to ban raising raw exceptions. Most of these should at the very least be runtime exception, value errors, type errors or some other errors. There are hundreds of instance of these bad exception types already in the codebase, so I have noqa'd most of them. Hopefully this error code will get commiters to rethink what exception type they should raise when they submit a PR.
I also encourage people to gradually go and fix all the existing noqas that have been added so they can be removed overtime and our exception typing can be improved.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/124570
Approved by: https://github.com/ezyang
In order to avoid extra round trips, and avoid confusion in places such as
this to manually pull in the latest copy of the shape_functions.py file
This also fixes the cases where people pull in the wrong version of the file. This can happen in cases such as when developers run `python setup.py install` instead of `python setup.py develop` to generate their current copy of Pytorch.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/83629
Approved by: https://github.com/davidberard98
Somehow even with clang-format off, it was unhappy with this line
>>> Lint for torch/csrc/jit/runtime/serialized_shape_function_registry.cpp:
Warning (CLANGFORMAT) format
See https://clang.llvm.org/docs/ClangFormat.html.
Run `lintrunner -a` to apply this patch.
You can run `lintrunner -a` to apply this patch.
2855 2855 | return shape_mappings;
2856 2856 | }
2857 2857 |
2857 |-
2859 2858 | // clang-format on
2860 2859 |
2861 2860 | } // namespace jit
Note that there is no changes to `serialized_shape_function_registry.cpp` in this diff because I had to manually run `lintrunner` to make it format the code correctly in the previous diff so that we can land it.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/79571
Approved by: https://github.com/eellison