Skip to content

diagram

Provides classes and helper functions to visualise Plugboard processes.

Diagram

Diagram(**kwargs: Any)

Bases: ABC

Diagram base class for creating diagrams of Plugboard processes.

Instantiates Diagram.

diagram abstractmethod property

diagram: str

Returns a string representation of the diagram.

from_process abstractmethod classmethod

from_process(process: Process, **kwargs: Any) -> Diagram

Create the diagram.

Parameters:

Name Type Description Default
process Process

The Process object to create the diagram from.

required
**kwargs Any

Additional keyword arguments for the diagram backend.

{}

MermaidDiagram

MermaidDiagram(spec: str)

Bases: Diagram

MermaidDiagram class for creating diagrams of Plugboard processes using Mermaid.

Instantiates MermaidDiagram.

Parameters:

Name Type Description Default
spec str

The string representation of the diagram.

required

diagram property

diagram: str

Returns a string representation of the diagram.

url property

url: str

Returns a URL to the diagram on Mermaid Live Editor.

from_process classmethod

from_process(
    process: Process, **kwargs: Any
) -> MermaidDiagram

Create the diagram.

Parameters:

Name Type Description Default
process Process

The Process object to create the diagram from.

required
**kwargs Any

Additional keyword arguments for the diagram backend.

{}

markdown_diagram

markdown_diagram(process: Process) -> str

Returns a markdown representation of a Process.