lstree/nodes/node.py
def visit(self, visitor, topdown=True):
        """
        allow a visitor to visit each node in the node-tree in a top-down fashion (by default)
        :param visitor: an instance of NodeTreeVisitor which knows what to do when visiting each type of the nodes
        :param topdown: from top towards bottom if True, bottom-up if False
        :return: nothing
        """
        assert isinstance(visitor, NodeTreeVisitor)

        if topdown:
            # first visit self, if it's top-down
            visitor.visit(self)

        if len(self._children):
            visitor.down()

            # visit the children
            for c in self._children:
                c.visit(visitor, topdown)

            visitor.up()

        if not topdown:
            # if it's bottom-up, then visit self last
            visitor.visit(self)

        allow a visitor to visit each node in the node-tree in a top-down fashion (by default)
        :param visitor: an instance of NodeTreeVisitor which knows what to do when visiting each type of the nodes
        :param topdown: from top towards bottom if True, bottom-up if False
        :return: nothing
        
allow a visitor to visit each node in the node-tree in a top-down fashion (by default)
allow a visitor to visit each node in the node - tree in a top - down fashion ( by default )
def visit(self, visitor, topdown=True):
        assert isinstance(visitor, NodeTreeVisitor)
        if topdown:
            visitor.visit(self)
        if len(self._children):
            visitor.down()
            for c in self._children:
                c.visit(visitor, topdown)
            visitor.up()
        if not topdown:
            visitor.visit(self)
def visit ( self , visitor , topdown = True ) : assert isinstance ( visitor , NodeTreeVisitor ) if topdown : visitor . visit ( self ) if len ( self . _children ) : visitor . down ( ) for c in self . _children : c . visit ( visitor , topdown ) visitor . up ( ) if not topdown : visitor . visit ( self )
allow a visitor to visit each node in the node-tree in a top-down fashion (by default)
allow a visitor to visit each node in the node - tree in a top - down fashion ( by default )
"""
        allow a visitor to visit each node in the node-tree in a top-down fashion (by default)
        :param visitor: an instance of NodeTreeVisitor which knows what to do when visiting each type of the nodes
        :param topdown: from top towards bottom if True, bottom-up if False
        :return: nothing
        """ # first visit self, if it's top-down # visit the children # if it's bottom-up, then visit self last
None
self
visitor
an instance of NodeTreeVisitor which knows what to do when visiting each type of the nodes
an instance of NodeTreeVisitor which knows what to do when visiting each type of the nodes
topdown
from top towards bottom if True, bottom-up if False
from top towards bottom if True bottom - up if False