commands.noop
¶
Module Contents¶
Classes¶
A |
- class commands.noop.NOOPCommand(context: libcst.codemod._context.CodemodContext)¶
Bases:
libcst.codemod.CodemodCommand
A
Codemod
which can be invoked on the command-line using thelibcst.tool codemod
utility. It behaves like any other codemod in that it can be instantiated and run identically to aCodemod
. However, it provides support for providing help text and command-line arguments tolibcst.tool codemod
as well as facilities for automatically running certain common transforms after executing yourtransform_module_impl()
.The following list of transforms are automatically run at this time:
AddImportsVisitor
(adds needed imports to a module).RemoveImportsVisitor
(removes unreferenced imports from a module).
- Parameters
context (libcst.codemod._context.CodemodContext) –
- DESCRIPTION :str = Does absolutely nothing.¶
- transform_module_impl(self, tree: libcst.Module) libcst.Module ¶
Override this with your transform. You should take in the tree, optionally mutate it and then return the mutated version. The module reference and all calculated metadata are available for the lifetime of this function.
- Parameters
tree (libcst.Module) –
- Return type
libcst.Module