stubber.codemod.add_comment
¶
Module Contents¶
Classes¶
A command that acts identically to a visitor-based transform, but also has |
- class stubber.codemod.add_comment.AddComment(context: libcst.codemod.CodemodContext, comments: List[str])¶
Bases:
libcst.codemod.VisitorBasedCodemodCommand
A command that acts identically to a visitor-based transform, but also has the support of
add_args()
and running supported helper transforms after execution. SeeCodemodCommand
andContextAwareTransformer
for additional documentation.- Parameters
context (libcst.codemod.CodemodContext) –
comments (List[str]) –
- DESCRIPTION :str = Add comment(s) to each file¶
- static add_args(arg_parser: argparse.ArgumentParser) None ¶
Override this to add arguments to the CLI argument parser. These args will show up when the user invokes
libcst.tool codemod
with--help
. They will also be presented to your class’s__init__
method. So, if you define a command with an argument ‘foo’, you should also have a corresponding ‘foo’ positional or keyword argument in your class’s__init__
method.- Parameters
arg_parser (argparse.ArgumentParser) –
- Return type
None
- leave_Module(original_node: libcst.Module, updated_node: libcst.Module) libcst.Module ¶
- Parameters
original_node (libcst.Module) –
updated_node (libcst.Module) –
- Return type
libcst.Module