Delete the left-most value from a tree.
169892
def delete_min(self):
        

        # Base case: If there are no nodes lesser than this node, then this is the
        # node to delete.
        if self.left is NULL:
            return NULL, self.value

        # Acquire more reds if necessary to continue the traversal. The
        # double-deep check is fine because NULL is red.
        if not self.left.red and not self.left.left.red:
            self = self.move_red_left()

        # Recursive case: Delete the minimum node of all nodes lesser than this
        # node.
        left, value = self.left.delete_min()
        self = self._replace(left=left)

        return self.balance(), value
830648
async def delete_tree(self, prefix, *, separator=None):
        
        response = await self._discard(prefix,
                                       recurse=True,
                                       separator=separator)
        return response.body is True
259546
def _remove_tree(self, tree, parent=None):
        
        # remove sub-trees
        for sub_tree in tree.sub_trees:
            self._remove_tree(sub_tree, parent=tree)

        # remove itself
        for index in tree.indexes:
            if not getattr(tree, index):
                continue

            self._remove_from(
                getattr(self, index + "_db"),
                getattr(tree, index),
                tree,
            )

        if parent:
            self._remove_from(self.parent_db, tree.path, parent)

        self.zeo.pack()
345790
def _recursive_cleanup(foo):
    
    if isinstance(foo, dict):
        for (key, val) in list(foo.items()):
            if isinstance(val, dict):
                _recursive_cleanup(val)
            if val == "" or val == [] or val == {}:
                del foo[key]
511916
public void removeMin() {
    	if (root == null) return;

        // if both children of root are black, set root to red
        if ((root.left == null || !root.left.red) && (root.right == null || !root.right.red))
            root.red = true;

        root = removeMin(root, true);
        if (root != null) root.red = false;
        else first = last = null;
    }
1368342
BaseRow removeLast() {
		Map.Entry<BaseRow, Collection<BaseRow>> last = treeMap.lastEntry();
		BaseRow lastElement = null;
		if (last != null) {
			Collection<BaseRow> list = last.getValue();
			lastElement = getLastElement(list);
			if (lastElement != null) {
				if (list.remove(lastElement)) {
					currentTopNum -= 1;
				}
				if (list.size() == 0) {
					treeMap.remove(last.getKey());
				}
			}
		}
		return lastElement;
	}
890036
function cleanTree (oSymbol) {
			delete oSymbol.treeName;
			delete oSymbol.parent;
			if (oSymbol.children) {
				oSymbol.children.forEach(o => cleanTree(o));
			}
		}
187050
def leftsibling_in_level(self):
          # noqa
        table = _get_tree_table(self.__mapper__)
        session = Session.object_session(self)
        current_lvl_nodes = session.query(table) \
            .filter_by(level=self.level).filter_by(tree_id=self.tree_id) \
            .filter(table.c.lft < self.left).order_by(table.c.lft).all()
        if current_lvl_nodes:
            return current_lvl_nodes[-1]
        return None
1345186
def clear(self):
        
        model = self.tree.model()
        # Don't use model.clear(). it will delete the column sizes
        model.removeRows(0, 1)
        model.setRowCount(1)
        self._setColumnCountForContents()
1268256
def clean(self):
        
        for key, value in self.values.copy().items():
            if value is None:
                del self.values[key]
921999
public LeftTupleSinkNode removeLast() {
        if ( this.lastNode == null ) {
            return null;
        }
        final LeftTupleSinkNode node = this.lastNode;
        this.lastNode = node.getPreviousLeftTupleSinkNode();
        node.setPreviousLeftTupleSinkNode( null );
        if ( this.lastNode != null ) {
            this.lastNode.setNextLeftTupleSinkNode( null );
        } else {
            this.firstNode = this.lastNode;
        }
        this.size--;
        return node;
    }
882908
def delete(self, start=None, stop=None):
		
		_check_start_stop(start, stop)
		start_loc = self._bisect_right(start) - 1
		if stop is None:
			stop_loc = len(self._keys)
		else:
			stop_loc = self._bisect_left(stop)
		for value in self._values[start_loc:stop_loc]:
			if value is NOT_SET:
				raise KeyError((start, stop))
		# this is inefficient, we've already found the sub ranges
		self.set(NOT_SET, start=start, stop=stop)
176086
def clean_value(self, value):
    """"""
    if self._clean_value:
      return self._clean_value(value)
    else:
      return self.reduce_value(value)
669944
def discard(self, val):
        
        _maxes = self._maxes

        if not _maxes:
            return

        key = self._key(val)
        pos = bisect_left(_maxes, key)

        if pos == len(_maxes):
            return

        _keys = self._keys
        _lists = self._lists
        idx = bisect_left(_keys[pos], key)

        len_keys = len(_keys)
        len_sublist = len(_keys[pos])

        while True:
            if _keys[pos][idx] != key:
                return
            if _lists[pos][idx] == val:
                self._delete(pos, idx)
                return
            idx += 1
            if idx == len_sublist:
                pos += 1
                if pos == len_keys:
                    return
                len_sublist = len(_keys[pos])
                idx = 0
730496
def _delete(self, tree):
        
        tablename = tree.table
        table = self.describe(tablename, require=True)
        kwargs = {}
        visitor = Visitor(self.reserved_words)
        if tree.where:
            constraints = ConstraintExpression.from_where(tree.where)
            kwargs["condition"] = constraints.build(visitor)
        kwargs["expr_values"] = visitor.expression_values
        kwargs["alias"] = visitor.attribute_names
        return self._query_and_op(tree, table, "delete_item", kwargs)
889938
void removeAll(BaseRow sortKey) {
		Collection<BaseRow> list = treeMap.get(sortKey);
		if (list != null) {
			currentTopNum -= list.size();
			treeMap.remove(sortKey);
		}
	}
664873
def remove(self, val):
        
        _maxes = self._maxes

        if not _maxes:
            raise ValueError('{0} not in list'.format(repr(val)))

        pos = bisect_left(_maxes, val)

        if pos == len(_maxes):
            raise ValueError('{0} not in list'.format(repr(val)))

        _lists = self._lists
        idx = bisect_left(_lists[pos], val)
        if _lists[pos][idx] == val:
            self._delete(pos, idx)
        else:
            raise ValueError('{0} not in list'.format(repr(val)))