Correct file write

- Correct bug in file write
This commit is contained in:
Franco Masotti 2023-01-12 14:04:20 +01:00
parent 68473f9752
commit 693b11f8a5
Signed by: frnmst
GPG Key ID: 24116ED85666780A
1 changed files with 2 additions and 2 deletions

View File

@ -431,7 +431,7 @@ def patch_invoice_schema_file(invoice_schema_file: str, offending_line: str,
.. note: this sucks. A better solution needs to be found.
"""
save = list()
save: list = list()
with open(invoice_schema_file, 'r') as f:
for line in f:
if line == offending_line:
@ -442,7 +442,7 @@ def patch_invoice_schema_file(invoice_schema_file: str, offending_line: str,
with tempfile.NamedTemporaryFile('w', delete=False) as f:
f.flush()
os.fsync(f.fileno())
f.write(save)
f.write(os.linesep.join(save))
shutil.move(f.name, invoice_schema_file)