Removed direct doc formatting

Fixes #76034

This does not make python remove all `__doc__` because in some places `__doc__` is assigned to a string.

Example:
04b3313379/torch/nn/modules/conv.py (L174-L233)

Since there are quite a few of these, I will add all of them together in this PR later. (Basically still a lot of docstring will persist even with `-OO` enabled.)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/76619
Approved by: https://github.com/albanD
This commit is contained in:
vitrioil
2022-05-02 14:14:33 +00:00
committed by PyTorch MergeBot
parent 76916ccf81
commit f92cddd890
5 changed files with 36 additions and 10 deletions

View File

@ -470,7 +470,8 @@ def method_factory(method_name, docstring):
def method(self, *args, **kwargs):
return getattr(super(RRef, self), method_name)(*args, **kwargs)
method.__doc__ = docstring
if method.__doc__:
method.__doc__ = docstring
return method