From 87aa0fe2abf7ca78abc2d4b44f7467d0ba6d39a7 Mon Sep 17 00:00:00 2001 From: Alan Gibson Date: Thu, 27 Feb 2025 13:21:29 +0100 Subject: [PATCH] Remove stray comments Move html_length function to wv_gv_html.py --- src/wireviz/DataClasses.py | 11 ----------- src/wireviz/Harness.py | 8 +------- src/wireviz/wv_gv_html.py | 7 +++++++ 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index dba7ee2..95fe37e 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -76,7 +76,6 @@ class Tweak: append: Union[str, List[str], None] = None -# Alan def parse_length(l: str): length: float = 0 length_unit: str = 'm' @@ -154,10 +153,6 @@ class StripSleeve: length: float = 0 length_unit: Optional[str] = None - # Alan - # def __post_init__(self) -> None: - # normalize_length(self) - @dataclass class StripInsulation: @@ -165,18 +160,12 @@ class StripInsulation: length: float = 0 length_unit: Optional[str] = None - # Alan - # def __post_init__(self) -> None: - # print('__post_init__', self.length, '|', self.length_unit) - # normalize_length(self) - @dataclass class Strip: sleeve: Optional[StripSleeve] = None insulation: Optional[StripInsulation] = None - # Alan def __post_init__(self) -> None: if self.sleeve: self.sleeve = StripSleeve('TODO', **parse_length(self.sleeve)) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 15a234f..a23ac01 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -37,6 +37,7 @@ from wireviz.wv_gv_html import ( html_caption, html_colorbar, html_image, + html_length, html_line_breaks, nested_html_table, remove_links, @@ -65,13 +66,6 @@ def check_old(node: str, old_attr: dict, args: dict) -> None: raise ValueError(f"'{attr}' in {node}: '{attr}' {descr}") -# Alan -def html_length(o) -> str: - if o: # Can be None - return f'{o.length} {o.length_unit}' if o.length > 0 else None - else: - return '-' - @dataclass class Harness: metadata: Metadata diff --git a/src/wireviz/wv_gv_html.py b/src/wireviz/wv_gv_html.py index ec80aa7..b4ca82a 100644 --- a/src/wireviz/wv_gv_html.py +++ b/src/wireviz/wv_gv_html.py @@ -109,3 +109,10 @@ def html_size_attr(image): def html_line_breaks(inp): return remove_links(inp).replace("\n", "
") if isinstance(inp, str) else inp + + +def html_length(o) -> str: + if o: # Can be None + return f'{o.length} {o.length_unit}' if o.length > 0 else None + else: + return '-'