chore: apply pre-commit hooks
This commit is contained in:
parent
3d0a608896
commit
e8ed141c09
2 changed files with 7 additions and 5 deletions
|
@ -2,7 +2,7 @@ exclude: |
|
||||||
(?x)^(
|
(?x)^(
|
||||||
README.md|
|
README.md|
|
||||||
LICENSE|
|
LICENSE|
|
||||||
tests/ymls/
|
tests/ymls/others/
|
||||||
)
|
)
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
import graphviz
|
import graphviz
|
||||||
|
|
||||||
from compose_viz.compose import Compose
|
from compose_viz.compose import Compose
|
||||||
|
@ -42,7 +44,7 @@ def apply_edge_style(type) -> dict:
|
||||||
"dir": "both",
|
"dir": "both",
|
||||||
"arrowhead": "inv",
|
"arrowhead": "inv",
|
||||||
"arrowtail": "dot",
|
"arrowtail": "dot",
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
return style[type]
|
return style[type]
|
||||||
|
@ -60,10 +62,10 @@ class Graph:
|
||||||
transTable = name.maketrans({":": ""})
|
transTable = name.maketrans({":": ""})
|
||||||
return name.translate(transTable)
|
return name.translate(transTable)
|
||||||
|
|
||||||
def add_vertex(self, name: str, type: str, lable: str = None) -> None:
|
def add_vertex(self, name: str, type: str, lable: Optional[str] = None) -> None:
|
||||||
self.dot.node(self.validate_name(name), lable, **apply_vertex_style(type))
|
self.dot.node(self.validate_name(name), lable, **apply_vertex_style(type))
|
||||||
|
|
||||||
def add_edge(self, head: str, tail: str, type: str, lable: str = None) -> None:
|
def add_edge(self, head: str, tail: str, type: str, lable: Optional[str] = None) -> None:
|
||||||
self.dot.edge(self.validate_name(head), self.validate_name(tail), lable, **apply_edge_style(type))
|
self.dot.edge(self.validate_name(head), self.validate_name(tail), lable, **apply_edge_style(type))
|
||||||
|
|
||||||
def render(self, format: str, cleanup: bool = True) -> None:
|
def render(self, format: str, cleanup: bool = True) -> None:
|
||||||
|
|
Loading…
Reference in a new issue