odata_query.visitor module
- class odata_query.visitor.NodeTransformer[source]
Bases:
NodeVisitorA subclass of
NodeVisitorthat allows replacing of nodes in the AST as it passes over it. The visitor methods should return instances of_Nodethat replace the passed node.
- class odata_query.visitor.NodeVisitor[source]
Bases:
objectBase class for visitors that walk the AST and calls a visitor method for every node found. This method may return a value which is forwarded by the
visit()method.This class is meant to be subclassed, with the subclass adding visitor methods. By default the visitor methods for the nodes are named
'visit_'+ class name of the node (e.g.visit_Identifier(self, identifier)). If no visitor method exists for a node, thegeneric_visit()visitor is used instead.- generic_visit(node: _Node)[source]
Visits all fields on
noderecursively. Called if no explicit visitor method exists for a node.
- visit(node: _Node) Any[source]
Looks for an explicit node visiting method on
self, otherwise callsgeneric_visit().- Returns:
Whatever the called method returned. The user is free to choose what the
NodeVisitorshould return.