Skip to content

Node

datapizza.type.Node

Class representing a node in a document graph.

content property

content

Get the textual content of this node and its children.

is_leaf property

is_leaf

Check if the node is a leaf node (has no children).

__eq__

__eq__(other)

Check if two nodes are equal.

__hash__

__hash__()

Hash the node.

__init__

__init__(
    children=None,
    metadata=None,
    node_type=NodeType.SECTION,
    content=None,
)

Initialize a Node object.

Parameters:

Name Type Description Default
children list[Node] | None

List of child nodes

None
metadata dict | None

Dictionary of metadata

None
content str | None

Content object for leaf nodes

None

add_child

add_child(child)

Add a child node to this node.

remove_child

remove_child(child)

Remove a child node from this node.

datapizza.type.MediaNode

Bases: Node

Class representing a media node in a document graph.