Create a parentless node.
(self, children: Mapping[str, Self] | None = None)
| 74 | _children: dict[str, Self] |
| 75 | |
| 76 | def __init__(self, children: Mapping[str, Self] | None = None): |
| 77 | """Create a parentless node.""" |
| 78 | self._parent = None |
| 79 | self._children = {} |
| 80 | |
| 81 | if children: |
| 82 | # shallow copy to avoid modifying arguments in-place (see GH issue #9196) |
| 83 | self.children = {name: child.copy() for name, child in children.items()} |
| 84 | |
| 85 | @property |
| 86 | def parent(self) -> Self | None: |