Remove stray comments
Move html_length function to wv_gv_html.py
This commit is contained in:
parent
a76ed292a3
commit
87aa0fe2ab
@ -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))
|
||||
|
||||
@ -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
|
||||
|
||||
@ -109,3 +109,10 @@ def html_size_attr(image):
|
||||
|
||||
def html_line_breaks(inp):
|
||||
return remove_links(inp).replace("\n", "<br />") 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 '-'
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user