st2client/st2client/commands/action.py
def _format_child_instances(self, children, parent_id):
        '''
        The goal of this method is to add an indent at every level. This way the
        WF is represented as a tree structure while in a list. For the right visuals
        representation the list must be a DF traversal else the idents will end up
        looking strange.
        '''
        # apply basic WF formating first.
        children = format_wf_instances(children)
        # setup a depth lookup table
        depth = {parent_id: 0}
        result = []
        # main loop that indents each entry correctly
        for child in children:
            # make sure child.parent is in depth and while at it compute the
            # right depth for indentation purposes.
            if child.parent not in depth:
                parent = None
                for instance in children:
                    if WF_PREFIX in instance.id:
                        instance_id = instance.id[instance.id.index(WF_PREFIX) + len(WF_PREFIX):]
                    else:
                        instance_id = instance.id
                    if instance_id == child.parent:
                        parent = instance
                if parent and parent.parent and parent.parent in depth:
                    depth[child.parent] = depth[parent.parent] + 1
                else:
                    depth[child.parent] = 0
            # now ident for the right visuals
            child.id = INDENT_CHAR * depth[child.parent] + child.id
            result.append(self._format_for_common_representation(child))
        return result

        The goal of this method is to add an indent at every level. This way the
        WF is represented as a tree structure while in a list. For the right visuals
        representation the list must be a DF traversal else the idents will end up
        looking strange.
        
The goal of this method is to add an indent at every level. This way the
WF is represented as a tree structure while in a list. For the right visuals
representation the list must be a DF traversal else the idents will end up
looking strange.
The goal of this method is to add an indent at every level . This way the WF is represented as a tree structure while in a list . For the right visuals representation the list must be a DF traversal else the idents will end up looking strange .
def _format_child_instances(self, children, parent_id):
        children = format_wf_instances(children)
        depth = {parent_id: 0}
        result = []
        for child in children:
            if child.parent not in depth:
                parent = None
                for instance in children:
                    if WF_PREFIX in instance.id:
                        instance_id = instance.id[instance.id.index(WF_PREFIX) + len(WF_PREFIX):]
                    else:
                        instance_id = instance.id
                    if instance_id == child.parent:
                        parent = instance
                if parent and parent.parent and parent.parent in depth:
                    depth[child.parent] = depth[parent.parent] + 1
                else:
                    depth[child.parent] = 0
            child.id = INDENT_CHAR * depth[child.parent] + child.id
            result.append(self._format_for_common_representation(child))
        return result
def _format_child_instances ( self , children , parent_id ) : children = format_wf_instances ( children ) depth = { parent_id : 0 } result = [ ] for child in children : if child . parent not in depth : parent = None for instance in children : if WF_PREFIX in instance . id : instance_id = instance . id [ instance . id . index ( WF_PREFIX ) + len ( WF_PREFIX ) : ] else : instance_id = instance . id if instance_id == child . parent : parent = instance if parent and parent . parent and parent . parent in depth : depth [ child . parent ] = depth [ parent . parent ] + 1 else : depth [ child . parent ] = 0 child . id = INDENT_CHAR * depth [ child . parent ] + child . id result . append ( self . _format_for_common_representation ( child ) ) return result
The goal of this method is to add an indent at every level.
The goal of this method is to add an indent at every level .
'''
        The goal of this method is to add an indent at every level. This way the
        WF is represented as a tree structure while in a list. For the right visuals
        representation the list must be a DF traversal else the idents will end up
        looking strange.
        ''' # apply basic WF formating first. # setup a depth lookup table # main loop that indents each entry correctly # make sure child.parent is in depth and while at it compute the # right depth for indentation purposes. # now ident for the right visuals
self
children
parent_id