Any descendant (no max level) of the collection's item

        :rtype: [Collection]
766647
def descendants(self):
        
        return self.members + \
            [submember for member in self.members for submember in member.descendants]
610176
def index(self, item):
        """"""
        index_at = None
        for (i, child) in enumerate(self._children):
            if child.item == item:
                index_at = i
                break
        if index_at is None:
            raise ValueError("%s is not contained in any child" % (item))
        return index_at
410731
def parent(self):
        
        if len(self.nodes) > 0:
            parent = self.nodes[-1].proxy
        else:
            parent = None
        return parent
145728
def fetchChildren(self):
        
        assert self._canFetchChildren, "canFetchChildren must be True"
        try:
            childItems = self._fetchAllChildren()
        finally:
            self._canFetchChildren = False # Set to True, even if tried and failed.

        return childItems
672552
def descendants(state, obj, level=0):
    
    return sum([
        [(child, level)] + descendants(state, child, level + 1)
        for child in state[obj].children
    ], [])
702024
def ancestors(self):
        
        if self.parent is not None:
            yield self.parent
            for ancestor in self.parent.ancestors():
                yield ancestor
800446
def __get_descendants(node, dfs_data):
    """"""
    list_of_descendants = []

    stack = deque()

    children_lookup = dfs_data['children_lookup']

    current_node = node
    children = children_lookup[current_node]
    dfs_current_node = D(current_node, dfs_data)
    for n in children:
        dfs_child = D(n, dfs_data)
        # Validate that the child node is actually a descendant and not an ancestor
        if dfs_child > dfs_current_node:
            stack.append(n)

    while len(stack) > 0:
        current_node = stack.pop()
        list_of_descendants.append(current_node)
        children = children_lookup[current_node]
        dfs_current_node = D(current_node, dfs_data)
        for n in children:
            dfs_child = D(n, dfs_data)
            # Validate that the child node is actually a descendant and not an ancestor
            if dfs_child > dfs_current_node:
                stack.append(n)

    return list_of_descendants
338102
def iter_child_nodes(self, exclude=None, only=None):
        
        for field, item in self.iter_fields(exclude, only):
            if isinstance(item, list):
                for n in item:
                    if isinstance(n, Node):
                        yield n
            elif isinstance(item, Node):
                yield item
815885
def get_level(self, level=2):
        """"""
        if level == 1:
            for child in self.children.values(): yield child
        else:
            for child in self.children.values():
                for node in child.get_level(level-1): yield node
120791
def iter_ancestors(self):
        
        node = self
        while node.up is not None:
            yield node.up
            node = node.up
791429
def each_descendant(&block)
      children.each do |child_model|
        block.call(child_model)
        child_model.each_descendant(&block) if child_model.respond_to?(:each_descendant)
      end
    end
969753
def inheritanceTree(self):
        
        inherits = self.inherits()
        while inherits:
            ischema = orb.system.schema(inherits)
            if not ischema:
                raise orb.errors.ModelNotFound(schema=inherits)

            yield ischema
            inherits = ischema.inherits()
159864
def node_ancestor(node, levels)
      while levels > 0
        node = node.node_parent
        return unless node
        levels -= 1
      end

      node
    end
767741
def getAncestors(self, all_ancestors=True):
        
        parent = self.getParentAnalysisRequest()
        if not parent:
            return list()
        if not all_ancestors:
            return [parent]
        return [parent] + parent.getAncestors(all_ancestors=True)
542202
def is_descendant_of(self, node):
        
        return self.pk in [obj.pk for obj in node.get_descendants()]
1237235
def item_at_line(root_item, line):
    
    previous_item = root_item
    item = root_item
    for item in get_item_children(root_item):
        if item.line > line:
            return previous_item
        previous_item = item
    else:
        return item
614781
def get_ancestors(self):
        
        if self.is_root():
            return get_result_class(self.__class__).objects.none()
        return get_result_class(self.__class__).objects.filter(
            tree_id=self.tree_id,
            lft__lt=self.lft,
            rgt__gt=self.rgt)