stubber.codemod.merge_docstub
¶
Module Contents¶
Classes¶
A libcst transformer that merges the type-rich information from a doc-stub into |
- class stubber.codemod.merge_docstub.MergeCommand(context: libcst.codemod.CodemodContext, stub_file: Union[pathlib.Path, str])¶
Bases:
libcst.codemod.VisitorBasedCodemodCommand
A libcst transformer that merges the type-rich information from a doc-stub into a firmware stub. The resulting file will contain information from both sources.
module docstring - from source
function parameters and types - from docstubs
function return types - from docstubs
function docstrings - from source
- Parameters
context (libcst.codemod.CodemodContext) –
stub_file (Union[pathlib.Path, str]) –
- DESCRIPTION :str = Merge the type-rich information from a doc-stub into a firmware stub¶
- static add_args(arg_parser: argparse.ArgumentParser) None ¶
Add command-line args that a user can specify for running this codemod.
- Parameters
arg_parser (argparse.ArgumentParser) –
- Return type
None
- leave_Module(original_node: libcst.Module, updated_node: libcst.Module) libcst.Module ¶
Update the Module docstring
- Parameters
original_node (libcst.Module) –
updated_node (libcst.Module) –
- Return type
libcst.Module
- visit_ClassDef(node: libcst.ClassDef) Optional[bool] ¶
- Parameters
node (libcst.ClassDef) –
- Return type
Optional[bool]
- leave_ClassDef(original_node: libcst.ClassDef, updated_node: libcst.ClassDef) libcst.ClassDef ¶
- Parameters
original_node (libcst.ClassDef) –
updated_node (libcst.ClassDef) –
- Return type
libcst.ClassDef
- visit_FunctionDef(node: libcst.FunctionDef) Optional[bool] ¶
- Parameters
node (libcst.FunctionDef) –
- Return type
Optional[bool]
- leave_FunctionDef(original_node: libcst.FunctionDef, updated_node: libcst.FunctionDef) Union[libcst.FunctionDef, libcst.ClassDef] ¶
Update the function Parameters and return type, decorators and docstring
- Parameters
original_node (libcst.FunctionDef) –
updated_node (libcst.FunctionDef) –
- Return type
Union[libcst.FunctionDef, libcst.ClassDef]