Skip to main content

AttributeTreeNode

ClassDataClassSource

AttributeTreeNode(
name: str,
attrs: dict[str, Any] = dict(...),
children: dict[str, AttributeTreeNode] = dict(...)
)

The node in the attribute tree.

Fields

NameTypeRequired
Description
namestrThe partial name of the current node.
attrsdict[str, Any]The extra attributes of the current node.
childrendict[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

NameTypeRequired
Description
segmentsSequence[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.
attrsMapping[str, Any] | NoneThe attributes to be added to the target node. The node is routed by segments related to the current node.