fix: wrong type check and indentations

pull/482/head
mingrammer 5 years ago
parent 1144a367b7
commit ff90ff93bd

@ -104,7 +104,7 @@ class Diagram:
""" """
self.name = name self.name = name
if not name and not filename: if not name and not filename:
filename = "diagrams_image" filename = "diagrams_image"
elif not filename: elif not filename:
filename = "_".join(self.name.split()).lower() filename = "_".join(self.name.split()).lower()
self.filename = filename self.filename = filename
@ -211,7 +211,10 @@ class Cluster:
# Cluster direction does not work now. Graphviz couldn't render # Cluster direction does not work now. Graphviz couldn't render
# correctly for a subgraph that has a different rank direction. # correctly for a subgraph that has a different rank direction.
def __init__( def __init__(
self, label: str = "cluster", direction: str = "LR", graph_attr: dict = {}, self,
label: str = "cluster",
direction: str = "LR",
graph_attr: dict = {},
): ):
"""Cluster represents a cluster context. """Cluster represents a cluster context.
@ -403,8 +406,8 @@ class Node:
""" """
if not isinstance(node, Node): if not isinstance(node, Node):
ValueError(f"{node} is not a valid Node") ValueError(f"{node} is not a valid Node")
if not isinstance(node, Edge): if not isinstance(edge, Edge):
ValueError(f"{node} is not a valid Edge") ValueError(f"{edge} is not a valid Edge")
# An edge must be added on the global diagrams, not a cluster. # An edge must be added on the global diagrams, not a cluster.
self._diagram.connect(self, node, edge) self._diagram.connect(self, node, edge)
return node return node

Loading…
Cancel
Save