From e8ed141c09f7a88b97a6825a47d58dc7c5af3abf Mon Sep 17 00:00:00 2001 From: Xyphuz Date: Wed, 25 May 2022 17:16:10 +0800 Subject: [PATCH] chore: apply pre-commit hooks --- .pre-commit-config.yaml | 2 +- compose_viz/graph.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4999367..9b26d29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ exclude: | (?x)^( README.md| LICENSE| - tests/ymls/ + tests/ymls/others/ ) repos: - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/compose_viz/graph.py b/compose_viz/graph.py index c686e3c..15516ca 100644 --- a/compose_viz/graph.py +++ b/compose_viz/graph.py @@ -1,3 +1,5 @@ +from typing import Optional + import graphviz from compose_viz.compose import Compose @@ -38,11 +40,11 @@ def apply_edge_style(type) -> dict: "depends_on": { "style": "dotted", }, - "extends":{ + "extends": { "dir": "both", "arrowhead": "inv", "arrowtail": "dot", - } + }, } return style[type] @@ -60,10 +62,10 @@ class Graph: transTable = name.maketrans({":": ""}) 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)) - 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)) def render(self, format: str, cleanup: bool = True) -> None: