Docstrings are needed for some stdlib modules to be importable. E.g. struct.py imports __doc__ from _struct.py, but there the __doc__ is implicitly assumed as the 1st string statement of the file.
The actual PR assumes every module, class and function/method to start with an empty (None) __doc__. The AST visitor is told to take the 1st Str statement and inject an __doc__ = <value:str> "Assign" node.
It works very well for modules and module-level functions, but not for methods. Should be refactored later, maybe to show the __doc__ as a slot instead of a member of __dict__ of such function/method
Docstrings are needed for some stdlib modules to be importable. E.g.
struct.py
imports__doc__
from_struct.py
, but there the__doc__
is implicitly assumed as the 1st string statement of the file.The actual PR assumes every module, class and function/method to start with an empty (
None
)__doc__
. The AST visitor is told to take the 1stStr
statement and inject an__doc__ = <value:str>
"Assign" node.It works very well for modules and module-level functions, but not for methods. Should be refactored later, maybe to show the
__doc__
as a slot instead of a member of__dict__
of such function/method