Remove unused functions and code formatting tweaks

This commit is contained in:
Tyler Ward 2020-10-20 21:58:47 +01:00
parent f128ea2d10
commit 052348cd54
2 changed files with 7 additions and 11 deletions

View File

@ -7,9 +7,8 @@ from wireviz import wv_colors, wv_helper, __version__, APP_NAME, APP_URL
from wireviz.wv_colors import get_color_hex
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \
nested_html_table, flatten2d, index_if_list, html_line_breaks, \
graphviz_line_breaks, remove_line_breaks, clean_whitespace, open_file_read, \
open_file_write, html_colorbar, html_image, html_caption, \
manufacturer_info_field, component_table_entry
clean_whitespace, open_file_read, open_file_write, html_colorbar, \
html_image, html_caption, manufacturer_info_field, component_table_entry
from collections import Counter
from typing import List, Union
from pathlib import Path

View File

@ -146,12 +146,6 @@ def index_if_list(value, index):
def html_line_breaks(inp):
return inp.replace('\n', '<br />') if isinstance(inp, str) else inp
def graphviz_line_breaks(inp):
return inp.replace('\n', '\\n') if isinstance(inp, str) else inp # \n generates centered new lines. http://www.graphviz.org/doc/info/attrs.html#k:escString
def remove_line_breaks(inp):
return inp.replace('\n', ' ').strip() if isinstance(inp, str) else inp
def clean_whitespace(inp):
return ' '.join(inp.split()).replace(' ,', ',') if isinstance(inp, str) else inp
@ -202,4 +196,7 @@ def component_table_entry(type, qty, unit=None, pn=None, manufacturer=None, mpn=
output += manufacturer_str
output = html_line_breaks(output)
# format the above output as left aligned text in a single visible cell
return f'<table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr><td align="left" balign="left">{output}</td></tr></table>'
# indent is set to two to match the indent in the generated html table
return f'''<table border="0" cellspacing="0" cellpadding="3" cellborder="1"><tr>
<td align="left" balign="left">{output}</td>
</tr></table>'''