Welcome to pynodes’s documentation!¶
pynodes is a Python library to manage Nodes classes. A node is an object which is related to other nodes given a tree chart.
(venv) $ pip install pynodes
Basic Usage¶
import pynodes
node = pynodes.Node()
- class pynodes.Node(name: str, parent: Node | None = None)[source]¶
Should be subclassed only
- static check_lineage(nodes: list[Node]) bool [source]¶
- check if the list of nodes is a straight lineage:
node 1 (ancestor) -> node 2 -> node 3 -> … -> node n (grand children)
- classmethod create_random_nodes(type_: str = 'cmd', depth: int = 0) Node [source]¶
Creates random tree of nodes for testing purpose
- property level: int¶
returns the level of the Node object
- property path: str¶
returns a representation of the ancestor lineage of self