Skip to content

export

export #

Export methods bound onto Procedure — JSON and Graphviz.

Thin node-side wrappers so a node exports itself without the caller reaching for the exporter functions: node.to_json() and node.to_graphviz(). The machinery lives in capturegraph.procedures.procedure.exporting; those modules import Procedure back, so each wrapper imports its exporter lazily.

__repr__(self) #

The node's DAG as pretty-printed JSON.

Equivalent to this node's to_json.

Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/export.py
def __repr__(self: Procedure) -> str:
    """The node's DAG as pretty-printed JSON.

    Equivalent to this node's
    [to_json][capturegraph.procedures.procedure.methods.export.to_json].
    """
    return to_json(self)

to_graphviz(self, group_by_depth=False) #

This node's DAG as a Graphviz diagram for visualization.

See procedure_to_graphviz.

Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/export.py
def to_graphviz(
    self: Procedure,
    group_by_depth: bool = False,
) -> Digraph:
    """This node's DAG as a Graphviz diagram for visualization.

    See
    [procedure_to_graphviz][capturegraph.procedures.procedure.exporting.visualizer.procedure_to_graphviz].
    """
    from capturegraph.procedures.procedure.exporting.visualizer import (
        procedure_to_graphviz,
    )

    return procedure_to_graphviz(self, group_by_depth=group_by_depth)

to_json(self, indent=4, target_schema=None) #

This node's DAG as a JSON string in the cross-platform wire form.

See procedure_to_json.

Source code in capturegraph-lib/capturegraph/procedures/procedure/methods/export.py
def to_json(
    self: Procedure,
    indent: int = 4,
    target_schema: type[CGType] | None = None,
) -> str:
    """This node's DAG as a JSON string in the cross-platform wire form.

    See
    [procedure_to_json][capturegraph.procedures.procedure.exporting.serializer.procedure_to_json].
    """
    from capturegraph.procedures.procedure.exporting.serializer import (
        procedure_to_json,
    )

    return procedure_to_json(self, indent=indent, target_schema=target_schema)