mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-29463: Add docstring field to some AST nodes. (#46)
* bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
This commit is contained in:
parent
1bc156430b
commit
cb41b2766d
15 changed files with 3153 additions and 3048 deletions
|
@ -133,9 +133,17 @@ and classes for traversing abstract syntax trees:
|
|||
.. function:: get_docstring(node, clean=True)
|
||||
|
||||
Return the docstring of the given *node* (which must be a
|
||||
:class:`FunctionDef`, :class:`ClassDef` or :class:`Module` node), or ``None``
|
||||
if it has no docstring. If *clean* is true, clean up the docstring's
|
||||
indentation with :func:`inspect.cleandoc`.
|
||||
:class:`FunctionDef`, :class:`AsyncFunctionDef`, :class:`ClassDef`,
|
||||
or :class:`Module` node), or ``None`` if it has no docstring.
|
||||
If *clean* is true, clean up the docstring's indentation with
|
||||
:func:`inspect.cleandoc`.
|
||||
|
||||
.. versionchanged:: 3.5
|
||||
:class:`AsyncFunctionDef` is now supported.
|
||||
|
||||
.. versionchanged:: 3.7
|
||||
The docstring is now exported from the node docstring field, instead of
|
||||
the first body statement.
|
||||
|
||||
|
||||
.. function:: fix_missing_locations(node)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue