stubber.codemod.add_comment

Add comment(s) to each file

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

Add command-line args that a user can specify for running this codemod.

Parameters:

arg_parser (argparse.ArgumentParser) –

Return type:

None

visit_Comment(node: libcst.Comment) None

connect comments from the source

Parameters:

node (libcst.Comment) –

Return type:

None

leave_Module(original_node: libcst.Module, updated_node: libcst.Module) libcst.Module

If the tag already exists, don’t modify the file.

Parameters:
  • original_node (libcst.Module) –

  • updated_node (libcst.Module) –

Return type:

libcst.Module