Return True and delete children if small enough.
334227
def _prune_all_if_small(self, small_size, a_or_u):
        ""
        if self._nodes is None:
            return True

        total_size = (self.app_size() if a_or_u else self.use_size())
        if total_size < small_size:
            if a_or_u:
                self._set_size(total_size, self.use_size())
            else:
                self._set_size(self.app_size(), total_size)
            return True

        return False
216882
def remove_child(child)
      child = child.name if child.is_a?(Model)
      children.delete(child)
    end
1169821
function DeleteChildren()
    {
        //Loop through all child tags
        for($x = 0; $x < count($this->tagChildren); $x ++)
        {
            //Do this recursively
            $this->tagChildren[$x]->DeleteChildren();
            
            //Delete the name and value
            $this->tagChildren[$x] = null;
            unset($this->tagChildren[$x]);
        }
    }
345031
def trim(self):
        
        # Only allow leaves to stay on list (highest-resolution) level
        return

        for l in self._levels[-2::-1]:
            for n in l:
                if n.is_leaf:
                    n.parent.remove_child(n.label)

        self._clear_all_leaves()
9233
def _validate_children(self):
        """"""
        for child in self._children:
            if child.__class__ not in self._allowed_children:
                raise ValueError(
                    "Child %s is not allowed as a children for this %s type entity." % (
                        child, self.__class__
                    )
                )
327417
function _destroy() {
            var childrenLength;

            if (this.element) {
                this.element.remove();
            }

            if (this.children !== null){
                childrenLength = this.children.length;
                while(childrenLength > 0){
                    this.children[0].destroy();
                    if (this.children.length === childrenLength) {
                        this.children.shift();
                    }
                    childrenLength--;
                }
            }

            if (this.parent) {
                this.parent.removeChild(this);
            }

            this.children       = null;
            this.element        = null;
        }
1281586
function () {
				// Iterate backwards because the list might shrink while being iterated
				for (var i = this.__private.childViews.length - 1; i >= 0; --i) {
					this.__private.childViews[i].destroy();
				}
			}
406114
private function removeEmptyRowsFromCollection()
    {
        $this->collection = $this->collection->reject(function ($data) {
            if (empty($data)) {
                return true;
            } else {
                return false;
            }
        });
    }
1200127
def _detach_children(self):
        """"""
        children = [val[0] for val in self._children.values()]
        for child in children:
            child()._parent = list(self)
        self._children.clear()
1346318
public function hasChildren()
    {
        $result = false;

        if(isset($this->__children[$this->id])) {
            $result = (boolean) count($this->__children[$this->id]);
        }

        return $result;
    }
350297
protected function cleanup()
	{
		$items = $this->getParent(false)->listContents();

		foreach ($items as $item)
		{
			if (in_array($item->getName(), ['.svn', 'CVS', '.DS_Store', '__MACOSX']))
			{
				if (!$item->delete())
				{
					return false;
				}
			}
		}

		return true;
	}
173588
public void removeChildren() {
        log.trace("removeChildren of {}", name);
        for (IBasicScope child : children.keySet()) {
            removeChildScope(child);
        }
    }
1278325
def _detach_childs(self, idx_from=None, idx_to=None):
        """"""
        idx_from = idx_from or 0
        idx_to = idx_to or len(self.childs)
        removed = self.childs[idx_from:idx_to]
        for child in removed:
            if issubclass(child.__class__, DOMElement):
                child.parent = None
        self.childs[idx_from:idx_to] = []
        return removed
751765
protected void removeAllChildren() {

        for (int i = getGroupContainerWidget().getWidgetCount() - 1; i >= 0; i--) {
            Widget widget = getGroupContainerWidget().getWidget(i);
            if (widget instanceof CmsContainerPageElementPanel) {
                widget.removeFromParent();
            }
        }
    }
1136778
def get_children_to_delete(self):
        
        refobjinter = self.get_refobjinter()
        children = self.get_all_children()

        todelete = []
        for c in children:
            if c.status() is None:
                # if child is not in scene we do not have to delete it
                continue
            rby = refobjinter.referenced_by(c.get_refobj())
            if rby is None:
                # child is not part of another reference.
                # we have to delete it for sure
                todelete.append(c)
                continue
            # check if child is referenced by any parent up to self
            # if it is not referenced by any refrence of a parent, then we
            # can assume it is referenced by a parent of a greater scope,
            # e.g. the parent of self. because we do not delete anything above self
            # we would have to delete the child manually
            parent = c.get_parent()
            while parent != self.get_parent():
                if refobjinter.get_reference(parent.get_refobj()) == rby:
                    # is referenced by a parent so it will get delted when the parent is deleted.
                    break
                parent = parent.get_parent()
            else:
                todelete.append(c)
        return todelete
1220073
public void clear() {
        List<Widget> children = getChildren();
        Log.d(TAG, "clear(%s): removing %d children", getName(), children.size());
        for (Widget child : children) {
            removeChild(child, true);
        }
        requestLayout();
    }
1022869
def remove(self):
        
        if self.parent is not None:
            for i, child in enumerate(self.parent.children):
                if id(child) == id(self):
                    self.parent.remove_child(i)
                    self.parent = None
                    break