replace old %-formatted and .format(…) strings with f-strings (#7671)

mostly using flynt
https://github.com/ikamensh/flynt
This commit is contained in:
Mike Fährmann
2025-06-28 19:36:16 +02:00
parent f77e98b57d
commit 9dbe33b6de
167 changed files with 756 additions and 891 deletions

View File

@@ -39,7 +39,7 @@ class GalleryDLException(Exception):
if not message:
message = self.default
elif isinstance(message, Exception):
message = "{}: {}".format(message.__class__.__name__, message)
message = f"{message.__class__.__name__}: {message}"
if self.msgfmt and fmt:
message = self.msgfmt.format(message)
Exception.__init__(self, message)
@@ -61,8 +61,8 @@ class HttpError(ExtractionError):
else:
self.status = response.status_code
if not message:
message = "'{} {}' for '{}'".format(
response.status_code, response.reason, response.url)
message = (f"'{response.status_code} {response.reason}' "
f"for '{response.url}'")
ExtractionError.__init__(self, message)