Skip to content

Commit d2deb47

Browse files
authored
allow both old and new usage when passing additional options to graphviz
1 parent 5386b9a commit d2deb47

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

streamz/graph.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ def readable_graph(graph):
131131
def to_graphviz(graph, **graph_attr):
132132
import graphviz
133133

134+
digraph_kwargs = {'name', 'comment', 'filename',
135+
'format', 'engine', 'encoding',
136+
'graph_attr', 'node_attr', 'edge_attr',
137+
'body', 'strict', 'directory'}
138+
if not digraph_kwargs.intersection(graph_attr):
139+
graph_attr = dict(graph_attr=graph_attr)
140+
134141
gvz = graphviz.Digraph(**graph_attr)
135142
for node, attrs in graph.nodes.items():
136143
gvz.node(node, **attrs)

0 commit comments

Comments
 (0)