class_docstr: Tree node data structure
  
  Nodes have an attribute item to carry arbitrary information. A node may only have one parent
  and can have as many children as desired.
  
  Parents can be set at initialization or via `node.set_parent`. Setting a parent automatically
  set the current node as the child of the parent.
  
  Children can be set at initialization or via `node.add_children`. Setting children
  automatically set their parent as the current node.
  
  Tree of nodes are iterable, by default with preorder traversal.
  
  .. seealso::
      `orion.core.utils.tree.PreOrderTraversal`
      `orion.core.utils.tree.DepthFirstTraversal`
  
  Attributes
  ----------
  item: T
      Can be anything
  parent: None or instance of `orion.core.utils.tree.TreeNode`
      The parent of the current node, None if the current node is the root.
  children: None or list of instances of `orion.core.utils.tree.TreeNode`
      The children of the current node.
  root: instance of `orion.core.utils.tree.TreeNode`
      The top node of the current tree. The root node returns itself.
  
  Examples
  --------
  .. code-block:: python
      :linenos:
  
      a = TreeNode("a")
      b = TreeNode("b", a)
      c = TreeNode("c", a)
      d = TreeNode("d", a)
      e = TreeNode("e", a)
  
      f = TreeNode("f", b)
      g = TreeNode("g", b)
  
      h = TreeNode("h", e)
  
      # Gives this tree
      # a
      # |   \  \   \
      # b    c  d   e
      # | \         |
      # f  g        h
  
      g.set_parent(e)
  
      # Gives this tree
      # a
      # |  \  \   \
      # b   c  d   e
      # |          | \
      # f          h g
  
      c.add_children(h, g)
  
      # Gives this tree
      # a
      # |  \    \   \
      # b   c    d   e
      # |   | \
      # f   h  g
  
      a.drop_children(c)
  
      # Gives this tree
      # a
      # |  \   \
      # b   d   e
      # |
      # f
class_docstr_tok: ["Tree","node","data","structure","Nodes","have","an","attribute","item","to","carry","arbitrary","information",".","A","node","may","only","have","one","parent","and","can","have","as","many","children","as","desired",".","Parents","can","be","set","at","initialization","or","via","`","node.set_parent","`",".","Setting","a","parent","automatically","set","the","current","node","as","the","child","of","the","parent",".","Children","can","be","set","at","initialization","or","via","`","node.add_children","`",".","Setting","children","automatically","set","their","parent","as","the","current","node",".","Tree","of","nodes","are","iterable",",","by","default","with","preorder","traversal",".","..","seealso",":",":","`","orion.core.utils.tree.PreOrderTraversal","`","`","orion.core.utils.tree.DepthFirstTraversal","`","Attributes","--","--","--","--","--","item",":","T","Can","be","anything","parent",":","None","or","instance","of","`","orion.core.utils.tree.TreeNode","`","The","parent","of","the","current","node",",","None","if","the","current","node","is","the","root",".","children",":","None","or","list","of","instances","of","`","orion.core.utils.tree.TreeNode","`","The","children","of","the","current","node",".","root",":","instance","of","`","orion.core.utils.tree.TreeNode","`","The","top","node","of","the","current","tree",".","The","root","node","returns","itself",".","Examples","--","--","--","--","..","code-block",":",":","python",":","linenos",":","a","=","TreeNode","(","``","a","''",")","b","=","TreeNode","(","``","b","''",",","a",")","c","=","TreeNode","(","``","c","''",",","a",")","d","=","TreeNode","(","``","d","''",",","a",")","e","=","TreeNode","(","``","e","''",",","a",")","f","=","TreeNode","(","``","f","''",",","b",")","g","=","TreeNode","(","``","g","''",",","b",")","h","=","TreeNode","(","``","h","''",",","e",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","\\","|","#","f","g","h","g.set_parent","(","e",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","|","\\","#","f","h","g","c.add_children","(","h",",","g",")","#","Gives","this","tree","#","a","#","|","\\","\\","\\","#","b","c","d","e","#","|","|","\\","#","f","h","g","a.drop_children","(","c",")","#","Gives","this","tree","#","a","#","|","\\","\\","#","b","d","e","#","|","#","f"]
docstr: Drop the children of the node, do nothing if no parent
  
  If no nodes are passed, the method will drop all the children of the current node.
  
  Note that the parent of the given node will be removed as well
  
  Raises
  ------
  ValueError
      If one of the given nodes is not a children of the current node.
docstr_tok: ["Drop","the","children","of","the","node",",","do","nothing","if","no","parent","If","no","nodes","are","passed",",","the","method","will","drop","all","the","children","of","the","current","node",".","Note","that","the","parent","of","the","given","node","will","be","removed","as","well","Raises","--","--","--","ValueError","If","one","of","the","given","nodes","is","not","a","children","of","the","current","node","."]
code: def drop_children(self: Self, *nodes: Self) -> None:
      """Drop the children of the node, do nothing if no parent
  
      If no nodes are passed, the method will drop all the children of the current node.
  
      Note that the parent of the given node will be removed as well
  
      Raises
      ------
      ValueError
          If one of the given nodes is not a children of the current node.
  
      """
      if not nodes:
          nodes = tuple(self.children)
  
      for child in list(nodes):
          del self._children[self._children.index(child)]
          # pylint: disable=protected-access
          child._parent = None
  
imports: from __future__ import annotations
  from typing import Callable, Generic, Iterable, Iterator, Sequence, TypeVar
label_desc: Use image node_id 8 for calling the TreeNode obj's underlying member method code with example usage: obj.drop_children() without return types