class documentation
class NodeVisitor(visitor.PartialVisitor[
Known subclasses: pydoctor.astbuilder.ModuleVistor
Constructor: NodeVisitor(extensions)
Generic AST node visitor. This class does not work like ast.NodeVisitor
, it only visits statements directly within a body. Also, visitor methods can't return anything.
:See: visitor
for more informations.
Class Method | get |
Returns the nested nodes in the body of a node. |
Method | generic |
Helper method to visit a node by calling visit() on each child of the node. This is useful because this vistitor only visits statements inside .body attribute. |
Inherited from PartialVisitor
:
Method | unknown |
Called before exiting unknown object types. |
Method | unknown |
Called when entering unknown object types. |
Inherited from Visitor
(via PartialVisitor
):
Exception |
|
Comletely stop visiting the current node, extensions will not be run on that node. |
Exception |
|
Do not visit any children of the current node. The current node's siblings and depart_... method are not affected. |
Exception |
|
Do not visit the current node's children, and do not call the current node's depart_... method. The extensions will still be called. |
Method | __init__ |
Undocumented |
Method | depart |
Extend the base depart with extensions. |
Method | visit |
Extend the base visit with extensions. |
Method | walkabout |
Perform a tree traversal, calling visit() method when entering a node and the depart() method before exiting each node. |
Instance Variable | extensions |
Undocumented |
Exception | _ |
Base class for Visitor -related tree pruning exceptions. |
Instance Variable | _skipped |
Undocumented |
Helper method to visit a node by calling visit() on each child of the node. This is useful because this vistitor only visits statements inside .body attribute.
So if one wants to visit ast.Expr
children with their visitor, they should include:
def visit_Expr(self, node:ast.Expr): self.generic_visit(node)