class TransformVisitor: (source)
A visitor for handling transforms.
The standard approach of using it is to call
~visit
with an astroid module and the class
will take care of the rest, walking the tree and running the
transforms for each encountered node.
Method | __init__ |
Undocumented |
Method | register_transform |
Register transform(node) function to be applied on the given astroid's node_class if predicate is None or returns true when called with the node as argument. |
Method | unregister_transform |
Unregister the given transform. |
Method | visit |
Walk the given astroid tree and transform each encountered node |
Constant | TRANSFORM_MAX_CACHE_SIZE |
Undocumented |
Instance Variable | transforms |
Undocumented |
Method | _transform |
Call matching transforms for the given node if any and return the transformed node. |
Method | _visit |
Undocumented |
Method | _visit_generic |
Undocumented |
Register transform(node)
function to be applied on the given
astroid's node_class
if predicate
is None or returns true
when called with the node as argument.
The transform function may return a value which is then used to substitute the original node in the tree.
Walk the given astroid tree and transform each encountered node
Only the nodes which have transforms registered will actually be replaced or changed.