|
@@ -2,7 +2,7 @@ import contextvars |
|
|
import os |
|
|
import os |
|
|
import uuid |
|
|
import uuid |
|
|
from pathlib import Path |
|
|
from pathlib import Path |
|
|
from typing import List, Union, Dict |
|
|
|
|
|
|
|
|
from typing import Dict, List, Optional, Union |
|
|
|
|
|
|
|
|
from graphviz import Digraph |
|
|
from graphviz import Digraph |
|
|
|
|
|
|
|
@@ -86,9 +86,9 @@ class Diagram: |
|
|
autolabel: bool = False, |
|
|
autolabel: bool = False, |
|
|
show: bool = True, |
|
|
show: bool = True, |
|
|
strict: bool = False, |
|
|
strict: bool = False, |
|
|
graph_attr: dict = {}, |
|
|
|
|
|
node_attr: dict = {}, |
|
|
|
|
|
edge_attr: dict = {}, |
|
|
|
|
|
|
|
|
graph_attr: Optional[dict] = None, |
|
|
|
|
|
node_attr: Optional[dict] = None, |
|
|
|
|
|
edge_attr: Optional[dict] = None, |
|
|
): |
|
|
): |
|
|
"""Diagram represents a global diagrams context. |
|
|
"""Diagram represents a global diagrams context. |
|
|
|
|
|
|
|
@@ -105,6 +105,12 @@ class Diagram: |
|
|
:param edge_attr: Provide edge_attr dot config attributes. |
|
|
:param edge_attr: Provide edge_attr dot config attributes. |
|
|
:param strict: Rendering should merge multi-edges. |
|
|
:param strict: Rendering should merge multi-edges. |
|
|
""" |
|
|
""" |
|
|
|
|
|
if graph_attr is None: |
|
|
|
|
|
graph_attr = {} |
|
|
|
|
|
if node_attr is None: |
|
|
|
|
|
node_attr = {} |
|
|
|
|
|
if edge_attr is None: |
|
|
|
|
|
edge_attr = {} |
|
|
self.name = name |
|
|
self.name = name |
|
|
if not name and not filename: |
|
|
if not name and not filename: |
|
|
filename = "diagrams_image" |
|
|
filename = "diagrams_image" |
|
@@ -215,7 +221,7 @@ class Cluster: |
|
|
self, |
|
|
self, |
|
|
label: str = "cluster", |
|
|
label: str = "cluster", |
|
|
direction: str = "LR", |
|
|
direction: str = "LR", |
|
|
graph_attr: dict = {}, |
|
|
|
|
|
|
|
|
graph_attr: Optional[dict] = None, |
|
|
): |
|
|
): |
|
|
"""Cluster represents a cluster context. |
|
|
"""Cluster represents a cluster context. |
|
|
|
|
|
|
|
@@ -223,6 +229,8 @@ class Cluster: |
|
|
:param direction: Data flow direction. Default is 'left to right'. |
|
|
:param direction: Data flow direction. Default is 'left to right'. |
|
|
:param graph_attr: Provide graph_attr dot config attributes. |
|
|
:param graph_attr: Provide graph_attr dot config attributes. |
|
|
""" |
|
|
""" |
|
|
|
|
|
if graph_attr is None: |
|
|
|
|
|
graph_attr = {} |
|
|
self.label = label |
|
|
self.label = label |
|
|
self.name = "cluster_" + self.label |
|
|
self.name = "cluster_" + self.label |
|
|
|
|
|
|
|
|