Make file output more consistently behaved.
This commit is contained in:
parent
8b69e9a8a8
commit
9de33b49bd
@ -9,6 +9,7 @@ from wireviz.wv_helper import awg_equiv, mm2_equiv, tuplelist2tsv, nested, \
|
|||||||
graphviz_line_breaks, remove_line_breaks
|
graphviz_line_breaks, remove_line_breaks
|
||||||
from collections import Counter
|
from collections import Counter
|
||||||
from typing import List
|
from typing import List
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
class Harness:
|
class Harness:
|
||||||
@ -279,13 +280,13 @@ class Harness:
|
|||||||
data.seek(0)
|
data.seek(0)
|
||||||
return data.read()
|
return data.read()
|
||||||
|
|
||||||
def output(self, filename, directory='_output', view=False, cleanup=True, fmt=('pdf', )):
|
def output(self, filename: (str, Path), view=False, cleanup=True, fmt=('pdf', )):
|
||||||
# graphical output
|
# graphical output
|
||||||
graph = self.create_graph()
|
graph = self.create_graph()
|
||||||
for f in fmt:
|
for f in fmt:
|
||||||
graph.format = f
|
graph.format = f
|
||||||
graph.render(filename=filename, directory=directory, view=view, cleanup=cleanup)
|
graph.render(filename=filename, view=view, cleanup=cleanup)
|
||||||
graph.save(filename=f'{filename}.gv', directory=directory)
|
graph.save(filename=f'{filename}.gv')
|
||||||
# bom output
|
# bom output
|
||||||
bom_list = self.bom_list()
|
bom_list = self.bom_list()
|
||||||
with open(f'{filename}.bom.tsv', 'w') as file:
|
with open(f'{filename}.bom.tsv', 'w') as file:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user