module documentation

Attribute docstrings parsing.

Class AttributeDocstrings An ast.NodeVisitor that collects attribute docstrings.
Function add_attribute_docstrings Add attribute docstrings found in the object's source code.
Function ast_get_attribute Return name, type and default if the given node is an attribute.
Function ast_get_constant_value Return the constant's value if the given node is a constant.
Function ast_is_literal_str Return True if the given node is a literal string.
Function ast_unparse Convert the AST node to source code as a string.
def add_attribute_docstrings(obj: type | ModuleType, docstring: Docstring): (source)

Add attribute docstrings found in the object's source code.

Parameters
obj:type | ModuleTypeobject from which to parse attribute docstrings
docstring:DocstringDocstring object where found attributes are added
Returns
list with names of added attributes
def ast_get_attribute(node: ast.AST) -> tuple[str, str | None, str | None] | None: (source)

Return name, type and default if the given node is an attribute.

def ast_get_constant_value(node: ast.AST) -> T.Any: (source)

Return the constant's value if the given node is a constant.

def ast_is_literal_str(node: ast.AST) -> bool: (source)

Return True if the given node is a literal string.

def ast_unparse(node: ast.AST) -> str | None: (source)

Convert the AST node to source code as a string.