refactor: convert remaining percent formatting in log messages

This commit is contained in:
Mark Paronyan 2026-09-30 20:45:47 +03:00
parent 95ada23395
commit 74943b4c74
No known key found for this signature in database
GPG Key ID: 8DC7338A87FE22F8
4 changed files with 6 additions and 6 deletions

View File

@ -125,8 +125,8 @@ class CompressedRotatingFileHandler(RotatingFileHandler):
self.stream.close()
if self.backupCount > 0:
for i in range(self.backupCount - 1, 0, -1):
sfn = "%s.%d.gz" % (self.baseFilename, i)
dfn = "%s.%d.gz" % (self.baseFilename, i + 1)
sfn = f"{self.baseFilename}.{i}.gz"
dfn = f"{self.baseFilename}.{i + 1}.gz"
if os.path.exists(sfn):
if os.path.exists(dfn):
os.remove(dfn)

View File

@ -45,7 +45,7 @@ def daemonize():
# Exit first parent
sys.exit(0)
except OSError as e:
print("First fork failed: %d (%s)\n" % (e.errno, e.strerror), file=sys.stderr)
print(f"First fork failed: {e.errno} ({e.strerror})\n", file=sys.stderr)
sys.exit(1)
# Decouple from parent environment
@ -59,7 +59,7 @@ def daemonize():
# Exit from second parent
sys.exit(0)
except OSError as e:
print("Second fork failed: %d (%s)\n" % (e.errno, e.strerror), file=sys.stderr)
print(f"Second fork failed: {e.errno} ({e.strerror})\n", file=sys.stderr)
sys.exit(1)

View File

@ -72,7 +72,7 @@ def parse_version(version):
info = int(info)
# We pad with zero to compare only on string
# This avoid issue when comparing version with different length
version.append("%06d" % (info,))
version.append(f"{info:06d}")
except ValueError:
# Force to a version with three number
if len(version) == 1:

View File

@ -187,7 +187,7 @@ class ZipFile(zipfile.ZipFile):
# check for valid comment length
if len(comment) >= zipfile.ZIP_MAX_COMMENT:
if self.debug:
print("Archive comment is too long; truncating to %d bytes" % zipfile.ZIP_MAX_COMMENT)
print(f"Archive comment is too long; truncating to {zipfile.ZIP_MAX_COMMENT} bytes")
comment = comment[: zipfile.ZIP_MAX_COMMENT]
self._comment = comment
self._didModify = True