Tidy some old-school %s strings

This commit is contained in:
James R. Barlow
2022-06-11 00:15:19 -07:00
parent e3ba13e365
commit a0ac448d52
3 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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"""
+1 -1
View File
@@ -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()