rope.refactor.patchedast
Attributes
Exceptions
Base exception for rope |
Functions
|
Adds |
|
Patches the given node |
|
Get the region of a patched ast node |
|
Extract source form a patched AST node with sorted_children field |
Module Contents
- rope.refactor.patchedast.COMMA_IN_WITH_PATTERN
- rope.refactor.patchedast.get_patched_ast(source, sorted_children=False)
Adds
regionandsorted_childrenfields to nodesAdds
sorted_childrenfield only if sorted_children is True.
- rope.refactor.patchedast.patch_ast(node, source, sorted_children=False)
Patches the given node
After calling, each node in node will have a new field named region that is a tuple containing the start and end offsets of the code that generated it.
If sorted_children is true, a sorted_children field will be created for each node, too. It is a list containing child nodes as well as whitespaces and comments that occur between them.
- rope.refactor.patchedast.node_region(patched_ast_node)
Get the region of a patched ast node
- rope.refactor.patchedast.write_ast(patched_ast_node)
Extract source form a patched AST node with sorted_children field
If the node is patched with sorted_children turned off you can use node_region function for obtaining code using module source code.
- exception rope.refactor.patchedast.MismatchedTokenError
Bases:
rope.base.exceptions.RopeErrorBase exception for rope