Remove unused functions and code formatting tweaks
This commit is contained in:
parent
f128ea2d10
commit
052348cd54
@ -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_colors import get_color_hex
|
||||||
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \
|
from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, \
|
||||||
nested_html_table, flatten2d, index_if_list, html_line_breaks, \
|
nested_html_table, flatten2d, index_if_list, html_line_breaks, \
|
||||||
graphviz_line_breaks, remove_line_breaks, clean_whitespace, open_file_read, \
|
clean_whitespace, open_file_read, open_file_write, html_colorbar, \
|
||||||
open_file_write, html_colorbar, html_image, html_caption, \
|
html_image, html_caption, manufacturer_info_field, component_table_entry
|
||||||
manufacturer_info_field, component_table_entry
|
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from typing import List, Union
|
from typing import List, Union
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -451,7 +450,7 @@ class Harness:
|
|||||||
# Remove linebreaks and clean whitespace of values in search
|
# Remove linebreaks and clean whitespace of values in search
|
||||||
target = tuple(clean_whitespace(v) for v in (item, unit, manufacturer, mpn, pn))
|
target = tuple(clean_whitespace(v) for v in (item, unit, manufacturer, mpn, pn))
|
||||||
for entry in self.bom():
|
for entry in self.bom():
|
||||||
if(entry['item'], entry['unit'], entry['manufacturer'], entry['mpn'], entry['pn']) == target:
|
if (entry['item'], entry['unit'], entry['manufacturer'], entry['mpn'], entry['pn']) == target:
|
||||||
return entry['id']
|
return entry['id']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|||||||
@ -146,12 +146,6 @@ def index_if_list(value, index):
|
|||||||
def html_line_breaks(inp):
|
def html_line_breaks(inp):
|
||||||
return inp.replace('\n', '<br />') if isinstance(inp, str) else 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):
|
def clean_whitespace(inp):
|
||||||
return ' '.join(inp.split()).replace(' ,', ',') if isinstance(inp, str) else 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 += manufacturer_str
|
||||||
output = html_line_breaks(output)
|
output = html_line_breaks(output)
|
||||||
# format the above output as left aligned text in a single visible cell
|
# 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>'''
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user