AttributeTreeNode
ClassDataClassSource
AttributeTreeNode(
name: str,
attrs: dict[str, Any] = dict(...),
children: dict[str, AttributeTreeNode] = dict(...)
)
The node in the attribute tree.
Fields
| Name | Type | Required | |
|---|---|---|---|
name | str | The partial name of the current node. | |
attrs | dict[str, Any] | The extra attributes of the current node. | |
children | dict[str, AttributeTreeNode] | The members/children of the current node. |
Methods
add
self.add(segments: Sequence[str], attrs: Mapping[str, Any] | None = None)
Recursively add segments into the tree.
Requires
| Name | Type | Required | |
|---|---|---|---|
segments | Sequence[str] | A sequence of name segments. Each segment represents a partial node name in the route. If an empty list such as [] is provided, it means update the information of the current (this) node. | |
attrs | Mapping[str, Any] | None | The attributes to be added to the target node. The node is routed by segments related to the current node. |