sec_parser.semantic_tree.tree_node ================================== .. py:module:: sec_parser.semantic_tree.tree_node Classes ------- .. autoapisummary:: sec_parser.semantic_tree.tree_node.TreeNode Module Contents --------------- .. py:class:: TreeNode(semantic_element: sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement, *, parent: TreeNode | None = None, children: collections.abc.Iterable[TreeNode] | None = None) The TreeNode class is a fundamental part of the semantic tree structure. Each TreeNode represents a node in the tree. It holds a reference to a semantic element, maintains a list of its child nodes, and a reference to its parent node. This class provides methods for managing the tree structure, such as adding and removing child nodes. Importantly, these methods ensure logical consistency as children/parents are being changed. For example, if a parent is removed from a child, the child is automatically removed from the parent. .. py:attribute:: _semantic_element .. py:attribute:: _children :type: list[TreeNode] :value: [] .. py:attribute:: _parent :type: TreeNode | None :value: None .. py:property:: parent :type: TreeNode | None .. py:property:: semantic_element :type: sec_parser.semantic_elements.abstract_semantic_element.AbstractSemanticElement .. py:property:: children :type: list[TreeNode] .. py:method:: add_child(child: TreeNode) -> None .. py:method:: add_children(children: collections.abc.Iterable[TreeNode]) -> None .. py:method:: remove_child(child: TreeNode) -> None .. py:method:: has_child(child: TreeNode) -> bool .. py:method:: get_descendants() -> collections.abc.Iterator[TreeNode] .. py:method:: __repr__() -> str .. py:property:: text :type: str Property text is a passthrough to the SemanticElement text property. .. py:method:: get_source_code(*, pretty: bool = False) -> str get_source_code is a passthrough to the SemanticElement method.