Recursive function to expand each tree item.
186285
protected void expandItems(MaterialTreeItem item) {
        item.expand();
        item.setHide(true);
        item.getTreeItems().forEach(this::expandItems);
    }
947517
def p_term_mult(self, tree):
        ''' '''
        tree.value = convertstr(tree[0].value) * convertstr(tree[2].value)
853501
def walk_up_tree(root):
    """"""
    for child in root.children:
        for el in walk_up_tree(child):
            yield el

    yield root
1122520
def extend_values(dictionary, key, items):
    """"""
    values = dictionary.get(key, [])
    try:
        values.extend(items)
    except TypeError:
        raise TypeError('Expected a list, got: %r' % items)
    dictionary[key] = values
87851
function expand (base, sub) {
    var children = splitSelector(sub)
    return splitSelector(base).reduce(function (selectors, parent) {
      return selectors.concat(children.map(function (child) {
        return parent + ' ' + child
      }))
    }, []).join(', ')
  }
455874
def _expand(dat, counts, start, end):
    
    for pos in range(start, end):
        for s in counts:
            dat[s][pos] += counts[s]
    return dat
648716
def expandPath(self, path):
        
        iiPath = self.model().findItemAndIndexPath(path)
        for (item, index) in iiPath[1:]: # skip invisible root
            assert index.isValid(), "Sanity check: invalid index in path for item: {}".format(item)
            self.expand(index)

        leaf = iiPath[-1]
        return leaf
111629
def expand_folder(files):
    """"""
    expfiles = []
    for file in files:
        if os.path.isdir(file):
            for dirpath, dirnames, filenames in os.walk(file):
                for filename in filenames:
                    expfiles.append(os.path.join(dirpath, filename))
        else:
            expfiles.append(file)

    for path in expfiles:
        if not os.path.exists(path):
            sys.stderr.write('%s: No such file or directory\n' % path)

    return expfiles
1035793
def descendants(self):
        """"""
        for i in self.current_item.items:
            self.move_to(i)
            if i.type == TYPE_COLLECTION:
                for c in self.children:
                    yield c
            else:
                yield i
            self.move_up()
730892
def _expand_paths(self, paths):
        """"""
        paths = ninja_syntax.as_list(paths)
        return ' '.join(map(self._shell_escape, (map(self._expand, paths))))
46396
def expand_item(self, item, open_all=True):
        
        self.expand_row(self._view_path_for(item), open_all)
1151207
def expandDescendants(self, branches):
        
        return sum([b.descendants() for b in branches], []) + \
            [b.source for b in branches]
229508
def populate_tree(self, parentItem, children_list):
        """"""
        for child_key in children_list:
            self.item_depth += 1
            (filename, line_number, function_name, file_and_line, node_type
             ) = self.function_info(child_key)

            ((total_calls, total_calls_dif), (loc_time, loc_time_dif), (cum_time,
             cum_time_dif)) = self.format_output(child_key)

            child_item = TreeWidgetItem(parentItem)
            self.item_list.append(child_item)
            self.set_item_data(child_item, filename, line_number)

            # FIXME: indexes to data should be defined by a dictionary on init
            child_item.setToolTip(0, _('Function or module name'))
            child_item.setData(0, Qt.DisplayRole, function_name)
            child_item.setIcon(0, self.icon_list[node_type])

            child_item.setToolTip(1, _('Time in function '\
                                       '(including sub-functions)'))
            child_item.setData(1, Qt.DisplayRole, cum_time)
            child_item.setTextAlignment(1, Qt.AlignRight)
            
            child_item.setData(2, Qt.DisplayRole, cum_time_dif[0])
            child_item.setForeground(2, QColor(cum_time_dif[1]))
            child_item.setTextAlignment(2, Qt.AlignLeft)

            child_item.setToolTip(3, _('Local time in function '\
                                      '(not in sub-functions)'))

            child_item.setData(3, Qt.DisplayRole, loc_time)
            child_item.setTextAlignment(3, Qt.AlignRight)
            
            child_item.setData(4, Qt.DisplayRole, loc_time_dif[0])
            child_item.setForeground(4, QColor(loc_time_dif[1]))
            child_item.setTextAlignment(4, Qt.AlignLeft)

            child_item.setToolTip(5, _('Total number of calls '\
                                       '(including recursion)'))

            child_item.setData(5, Qt.DisplayRole, total_calls)
            child_item.setTextAlignment(5, Qt.AlignRight)
            
            child_item.setData(6, Qt.DisplayRole, total_calls_dif[0])
            child_item.setForeground(6, QColor(total_calls_dif[1]))
            child_item.setTextAlignment(6, Qt.AlignLeft)

            child_item.setToolTip(7, _('File:line '\
                                       'where function is defined'))
            child_item.setData(7, Qt.DisplayRole, file_and_line)
            #child_item.setExpanded(True)
            if self.is_recursive(child_item):
                child_item.setData(7, Qt.DisplayRole, '(%s)' % _('recursion'))
                child_item.setDisabled(True)
            else:
                callees = self.find_callees(child_key)
                if self.item_depth < 3:
                    self.populate_tree(child_item, callees)
                elif callees:
                    child_item.setChildIndicatorPolicy(child_item.ShowIndicator)
                    self.items_to_be_shown[id(child_item)] = callees
            self.item_depth -= 1
482387
function flattenTree(root) {
  let newChildren = [];
  root.children.forEach(child => {
    const commonParent = getDeepMoreThenOneChild(child);
    if (commonParent.children.length === 0) {
      newChildren.push(commonParent);
    } else {
      newChildren = newChildren.concat(commonParent.children);
    }
  });
  root.children = newChildren;
}
687775
function set(tree, i, item) {
	var len = tree.size;
	if (i < 0 || len < i) {
		throw new Error("Index " + i + " out of range!");
	}
	if (i === len) return push(item, tree);
	var offset = (0, _util.tailOffset)(tree);
	if (i >= offset) {
		var newTail = (0, _util.createLeafFrom)(tree.tail);
		newTail[i - offset] = item;
		return new Tree(tree.size, tree.root, newTail);
	}
	var newRoot = (0, _util.setRoot)(i, item, tree.root);
	return new Tree(tree.size, newRoot, tree.tail);
}
729752
def map_tree(visitor, tree):
    """"""
    newn = [map_tree(visitor, node) for node in tree.nodes]
    return visitor(tree, newn)
1067744
private long grow(PrintStream out, List<ItemSet> list, TotalSupportTree ttree, HeaderTableItem header, int[] itemset, int[] localItemSupport, int[] prefixItemset) {
        long n = 1;
        int support = header.count;
        int item = header.id;
        itemset = insert(itemset, item);

        collect(out, list, ttree, itemset, support);
        
        if (header.node.next == null) {
            FPTree.Node node = header.node;
            n += grow(out, list, ttree, node.parent, itemset, support);
        } else {
            // Count singles in linked list
            if (getLocalItemSupport(header.node, localItemSupport)) {
                // Create local FP tree
                FPTree fptree = getLocalFPTree(header.node, localItemSupport, prefixItemset);
                // Mine new FP-tree
                n += grow(out, list, ttree, fptree, itemset, localItemSupport, prefixItemset);
            }
        }

        return n;
    }