OpenQuizz
Une application de gestion des contenus pédagogiques
NodeTransformer Class Reference
Inheritance diagram for NodeTransformer:
Collaboration diagram for NodeTransformer:

Public Member Functions

def generic_visit (self, node, *args, **kwargs)
 
def visit_list (self, node, *args, **kwargs)
 
- Public Member Functions inherited from NodeVisitor
def get_visitor (self, node)
 
def visit (self, node, *args, **kwargs)
 

Detailed Description

Walks the abstract syntax tree and allows modifications of nodes.

The `NodeTransformer` will walk the AST and use the return value of the
visitor functions to replace or remove the old node.  If the return
value of the visitor function is `None` the node will be removed
from the previous location otherwise it's replaced with the return
value.  The return value may be the original node in which case no
replacement takes place.

Member Function Documentation

◆ generic_visit()

def generic_visit (   self,
  node,
args,
**  kwargs 
)
Called if no explicit visitor function exists for a node.

Reimplemented from NodeVisitor.

Reimplemented in Optimizer.

◆ visit_list()

def visit_list (   self,
  node,
args,
**  kwargs 
)
As transformers may return lists in some places this method
can be used to enforce a list as return value.

The documentation for this class was generated from the following file: