with scratch_image.open("rb") as img_file, self.pdf_file.open("wb") as pdf_file:
pdf_file.write(img2pdf.convert(img_file))
+ # Copy what file stat is possible
+ shutil.copystat(self.file, self.pdf_file)
+
def detect(self) -> None:
"""
Scan all pages of the PDF as images, updating barcodes and the pages
savepath = Path(self.temp_dir.name) / output_filename
with open(savepath, "wb") as out:
dst.save(out)
+
+ shutil.copystat(self.file, savepath)
+
document_paths.append(savepath)
return document_paths
dir=settings.SCRATCH_DIR,
)
self.path = Path(tempdir.name) / Path(self.filename)
- shutil.copy(self.original_path, self.path)
+ shutil.copy2(self.original_path, self.path)
# Determine the parser class.
def _write(self, storage_type, source, target):
with open(source, "rb") as read_file, open(target, "wb") as write_file:
write_file.write(read_file.read())
+ shutil.copystat(source, target)
def _log_script_outputs(self, completed_process: CompletedProcess):
"""