autodoc2.analysis
#
Analyse of Python code using astroid.
The core function though analyse_module is agnostic to the implementation, It simply yields ItemData typed-dicts.
Module Contents#
Classes#
Functions#
Analyse the given module and yield items. |
|
Get the full name of a node. |
|
Get the parent name of a node. |
|
Remove common leading indentation, where the indentation of the first line is ignored. |
|
Yield data for an annotation assignment node. |
|
Yield data for an assignment node. |
|
Yield data for an assignment node. |
|
Yield data for a function definition node. |
|
Yield data for a class definition node. |
Data#
API#
- autodoc2.analysis.__all__ = ['analyse_module']#
- autodoc2.analysis.analyse_module(file_path: pathlib.Path, name: str, exclude_external_imports: Pattern[str] | None = None) Iterable[autodoc2.utils.ItemData] [source]#
Analyse the given module and yield items.
- Parameters:
file_path β The path to the module.
name β The name of the module, e.g. βfoo.barβ.
record_external_imports β If given, record these external imports on the module. These are only used to determine what is exposed by __all__, which is only usually objects in the same package. But if you want to expose objects from other packages, you can use this to record them.
- class autodoc2.analysis.State[source]#
-
- copy(**kwargs: Any) autodoc2.analysis.State [source]#
Copy the state and update the given attributes.
- autodoc2.analysis._get_full_name(name: str, name_stack: list[str]) str [source]#
Get the full name of a node.
- autodoc2.analysis.fix_docstring_indent(s: None | str, tabsize: int = 8) str [source]#
Remove common leading indentation, where the indentation of the first line is ignored.
- autodoc2.analysis.walk_node(node: astroid.nodes.NodeNG, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
- autodoc2.analysis.yield_module(node: astroid.nodes.Module, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
- autodoc2.analysis.yield_annotation_assign(node: astroid.nodes.AnnAssign, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
Yield data for an annotation assignment node.
- autodoc2.analysis.yield_assign(node: astroid.nodes.Assign, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
Yield data for an assignment node.
- autodoc2.analysis._yield_assign(node: astroid.nodes.Assign | astroid.nodes.AnnAssign, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
Yield data for an assignment node.
- autodoc2.analysis.yield_function_def(node: astroid.nodes.FunctionDef | astroid.nodes.AsyncFunctionDef, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
Yield data for a function definition node.
- autodoc2.analysis.yield_class_def(node: astroid.nodes.ClassDef, state: autodoc2.analysis.State) Iterable[autodoc2.utils.ItemData] [source]#
Yield data for a class definition node.
- autodoc2.analysis._FUNC_MAPPER: dict[astroid.nodes.NodeNG, Callable[[astroid.nodes.NodeNG, autodoc2.analysis.State], Iterable[autodoc2.utils.ItemData]]] = None#