mode.utils.types.trees — mode-ng 0.4.0 documentation

# `mode.utils.types.trees`

Type classes for `mode.utils.trees`.

class mode.utils.types.trees.NodeT

  Node in a tree data structure.

  abstract add(data: Union[_T, NodeT[_T]]) → None
  abstract add_deduplicate(data: Union[_T, NodeT[_T]]) → None
  abstract as_graph() → DependencyGraphT
  children: list[Any]
  data: Any = None
  abstract property depth: int
  abstract detach(parent: NodeT) → NodeT
  abstract discard(data: _T) → None
  abstract new(data: _T) → NodeT
  abstract property parent: Optional[NodeT]
  abstract property path: str
  abstract reattach(parent: NodeT) → NodeT
  abstract property root: Optional[NodeT]
  abstract traverse() → Iterator[NodeT]
  abstract walk() → Iterator[NodeT]