[JIT] Allow @torch.jit.unused to be used on TS classes (#38522)
Summary:
**Summary**
This commit enables the use of `torch.jit.unused` on methods of TorchScript classes.
This attribute is honoured by replacing the body of any method
marked as unused in the parsed AST for the class with `raise Exception(...)`.
**Test Plan**
This commit adds a unit test `TestClassType.test_unused_method` that
tests this feature.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38522
Differential Revision: D21733818
Pulled By: SplitInfinity
fbshipit-source-id: 771872359dad70fac4aae83b6b5f17abb6329890