pytorch/docs/source/notes
Richard Barnes 9c185b6b46 [codemod] Replace hasattr with getattr in caffe2/docs/source/notes/extending.rst (#100598)
Summary:
The pattern
```
X.Y if hasattr(X, "Y") else Z
```
can be replaced with
```
getattr(X, "Y", Z)
```

The [getattr](https://www.w3schools.com/python/ref_func_getattr.asp) function gives more succinct code than the [hasattr](https://www.w3schools.com/python/ref_func_hasattr.asp) function. Please use it when appropriate.

**This diff is very low risk. Green tests indicate that you can safely Accept & Ship.**

Test Plan: Sandcastle

Differential Revision: D44886464

Pull Request resolved: https://github.com/pytorch/pytorch/pull/100598
Approved by: https://github.com/Skylion007
2023-05-04 16:36:15 +00:00
..
amp_examples.rst
autograd.rst
broadcasting.rst
cpu_threading_runtimes.svg
cpu_threading_torchscript_inference.rst
cpu_threading_torchscript_inference.svg
cuda.rst
ddp.rst
extending.func.rst
extending.rst [codemod] Replace hasattr with getattr in caffe2/docs/source/notes/extending.rst (#100598) 2023-05-04 16:36:15 +00:00
faq.rst
gradcheck.rst
hip.rst
large_scale_deployments.rst
modules.rst Replace master with main in links and docs/conf.py (#100176) 2023-05-02 18:20:32 +00:00
mps.rst
multiprocessing.rst
numerical_accuracy.rst
randomness.rst
serialization.rst Replace master with main in links and docs/conf.py (#100176) 2023-05-02 18:20:32 +00:00
windows.rst