diff --git a/src/ocrmypdf/_exec/ghostscript.py b/src/ocrmypdf/_exec/ghostscript.py index 0ccadc45..111ccf42 100644 --- a/src/ocrmypdf/_exec/ghostscript.py +++ b/src/ocrmypdf/_exec/ghostscript.py @@ -45,7 +45,7 @@ For details see: """ # Most reliable what to get the bitness of Python interpreter, according to Python docs -_is_64bit = sys.maxsize > 2 ** 32 +_is_64bit = sys.maxsize > 2**32 _gswin = None if os.name == 'nt': @@ -115,7 +115,7 @@ def rasterize_pdf( + [ '-o', '-', - '-sstdout=%stderr', + '-sstdout=%stderr', # Literal %s, not string interpolation '-dAutoRotatePages=/None', # Probably has no effect on raster '-f', fspath(input_file), @@ -251,7 +251,7 @@ def generate_pdfa( "-dPDFACompatibilityPolicy=1", "-o", "-", - "-sstdout=%stderr", + "-sstdout=%stderr", # Literal %s, not string interpolation ] ) args_gs.extend(fspath(s) for s in pdf_pages) # Stringify Path objs diff --git a/src/ocrmypdf/_exec/tesseract.py b/src/ocrmypdf/_exec/tesseract.py index 04c556e4..0e032026 100644 --- a/src/ocrmypdf/_exec/tesseract.py +++ b/src/ocrmypdf/_exec/tesseract.py @@ -57,7 +57,7 @@ TESSERACT_THRESHOLDING_METHODS: Dict[str, int] = { class TesseractLoggerAdapter(logging.LoggerAdapter): def process(self, msg, kwargs): kwargs['extra'] = self.extra - return '[tesseract] %s' % (msg), kwargs + return f'[tesseract] {msg}', kwargs TESSERACT_VERSION_PATTERN = r""" diff --git a/src/ocrmypdf/_jobcontext.py b/src/ocrmypdf/_jobcontext.py index 2363ccbb..11f04cf2 100644 --- a/src/ocrmypdf/_jobcontext.py +++ b/src/ocrmypdf/_jobcontext.py @@ -83,7 +83,7 @@ class PageContext: The path will be based in a common temporary folder and have a prefix based on the page number. """ - return self.work_folder / ("%06d_%s" % (self.pageno + 1, name)) + return self.work_folder / f"{(self.pageno + 1):06d}_{name}" def __getstate__(self): state = self.__dict__.copy()