Skip to content

Commit 8732789

Browse files
committed
Fix flake8 errors
1 parent 1bbbe4d commit 8732789

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

templated_docs/__init__.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ def find_template_file(template_name):
8080
def _convert_file(filename, format, result_queue=None, options=None):
8181
"""Helper function to convert a file via LOKit.
8282
83-
This function can be called via subprocess so that in the event of LO crashing randomly
84-
after conversion, it will not terminate the parent process. This is assisted by inserting
85-
the result into a Queue object.
83+
This function can be called via subprocess so that in the event of LO
84+
crashing randomly after conversion, it will not terminate the parent
85+
process. This is assisted by inserting the result into a Queue object.
8686
"""
8787
lo_path = getattr(
8888
settings,
@@ -96,25 +96,34 @@ def _convert_file(filename, format, result_queue=None, options=None):
9696
doc.saveAs(str(conv_file.name), options=options)
9797
os.unlink(filename)
9898

99-
# type comparison is required instead of isinstance owing to multiprocessing.Queue is a method
99+
# type comparison is required instead of isinstance owing to
100+
# multiprocessing.Queue is a method
100101
if type(result_queue) == multiprocessing.queues.Queue:
101102
result_queue.put(conv_file.name)
102103
else:
103104
return conv_file.name
104105

105106

106-
def fill_template(template_name, context, output_format='odt', options=None, separate_process=True):
107+
def fill_template(
108+
template_name,
109+
context,
110+
output_format='odt',
111+
options=None,
112+
separate_process=True,
113+
):
107114
"""Fill a document with data and convert it to the requested format.
108115
109116
Returns an absolute path to the generated file.
110117
111118
Supported output format:
112119
Text documents: doc, docx, fodt, html, odt, ott, pdf, txt, xhtml, png
113120
Spreadsheets: csv, fods, html, ods, ots, pdf, xhtml, xls, xlsx, png
114-
Presentations: fodp, html, odg, odp, otp, pdf, potm, pot, pptx, pps, ppt, svg, swf, xhtml, png
121+
Presentations: fodp, html, odg, odp, otp, pdf, potm, pot, pptx, pps,
122+
ppt, svg, swf, xhtml, png
115123
Drawings: fodg, html, odg, pdf, svg, swf, xhtml, png
116124
117-
More on filter options, https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options
125+
More on filter options,
126+
https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Filter_Options # noqa: E501
118127
119128
:param template_name: the path to template, in OpenDocument format
120129
:param context: the context to be used to inject content
@@ -171,8 +180,10 @@ def fill_template(template_name, context, output_format='odt', options=None, sep
171180
if source_extension[1:] != output_format:
172181
if separate_process:
173182
results = multiprocessing.Queue()
174-
converter = multiprocessing.Process(target=_convert_file,
175-
args=(str(dest_file.name), output_format, results, options))
183+
converter = multiprocessing.Process(
184+
target=_convert_file,
185+
args=(str(dest_file.name), output_format, results, options),
186+
)
176187
converter.start()
177188
return results.get()
178189
else:

0 commit comments

Comments
 (0)