stubber.codemod.add_comment

Module Contents

Classes

AddComment

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. See CodemodCommand and ContextAwareTransformer 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

visit_Comment(node: libcst.Comment) None
Parameters

node (libcst.Comment) –

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