chore: Do not use fstrings without placeholders

> f-strings are a convenient way to format strings, but they are not
> necessary if there are no placeholder expressions to format. In this
> case, a regular string should be used instead, as an f-string without
> placeholders can be confusing for readers, who may expect such a
> placeholder to be present.
>
> — [ruff docs](https://docs.astral.sh/ruff/rules/f-string-missing-placeholders/)
This commit is contained in:
Alexis Métaireau 2024-05-22 15:10:43 +02:00
parent 5aa4863b52
commit 99f1e15fd2
No known key found for this signature in database
GPG key ID: C65C7A89A8FFC56E
6 changed files with 16 additions and 15 deletions

View file

@ -78,12 +78,12 @@ class MaxPagesException(PagesException):
class MaxPageWidthException(PagesException):
error_code = ERROR_SHIFT + 44
error_message = f"A page exceeded the maximum width."
error_message = "A page exceeded the maximum width."
class MaxPageHeightException(PagesException):
error_code = ERROR_SHIFT + 45
error_message = f"A page exceeded the maximum height."
error_message = "A page exceeded the maximum height."
class PageCountMismatch(PagesException):

View file

@ -824,7 +824,7 @@ class SettingsWidget(QtWidgets.QWidget):
if n_docs == 1:
self.start_button.setText("Convert to Safe Document")
self.docs_selected_label.setText(f"1 document selected")
self.docs_selected_label.setText("1 document selected")
else:
self.start_button.setText("Convert to Safe Documents")
self.docs_selected_label.setText(f"{n_docs} documents selected")

View file

@ -206,7 +206,7 @@ class UpdaterThread(QtCore.QThread):
current_time = self._get_now_timestamp()
last_check = self.dangerzone.settings.get("updater_last_check")
if current_time < last_check + UPDATE_CHECK_COOLDOWN_SECS:
log.debug(f"Cooling down update checks")
log.debug("Cooling down update checks")
return True
else:
return False
@ -255,10 +255,10 @@ class UpdaterThread(QtCore.QThread):
previous run.
2. In GitHub, by hitting the latest releases API.
"""
log.debug(f"Checking for Dangerzone updates")
log.debug("Checking for Dangerzone updates")
latest_version = self.dangerzone.settings.get("updater_latest_version")
if version.parse(get_version()) < version.parse(latest_version):
log.debug(f"Determined that there is an update due to cached results")
log.debug("Determined that there is an update due to cached results")
return UpdateReport(
version=latest_version,
changelog=self.dangerzone.settings.get("updater_latest_changelog"),
@ -275,7 +275,7 @@ class UpdaterThread(QtCore.QThread):
"updater_last_check", self._get_now_timestamp(), autosave=True
)
log.debug(f"Checking the latest GitHub release")
log.debug("Checking the latest GitHub release")
report = self.get_latest_info()
log.debug(f"Latest version in GitHub is {report.version}")
if report.version and self.can_update(latest_version, report.version):
@ -285,7 +285,7 @@ class UpdaterThread(QtCore.QThread):
)
return report
log.debug(f"No need to update")
log.debug("No need to update")
return UpdateReport()
##################

View file

@ -83,16 +83,16 @@ def main():
)
parser.add_argument(
"--tag",
help=f"use the release with this tag",
help="use the release with this tag",
)
parser.add_argument(
"--release-id",
help=f"use the release with this ID",
help="use the release with this ID",
)
parser.add_argument(
"--draft",
action="store_true",
help=f"use the latest draft release",
help="use the latest draft release",
)
parser.add_argument(
"file",
@ -116,7 +116,7 @@ def main():
elif args.release_id:
release_id = args.release_id
else:
log.debug(f"Getting the ID of the latest draft release")
log.debug("Getting the ID of the latest draft release")
release_id = get_latest_draft_release(token)
log.debug(f"The latest draft release has ID '{release_id}'")

View file

@ -19,7 +19,7 @@ def main():
# Read the zipfile from stdin
zf = sys.stdin.buffer.read(size)
if len(zf) < size:
say(f"Client closed the connection early")
say("Client closed the connection early")
return 1
with tempfile.NamedTemporaryFile(suffix=".zip") as t:
@ -27,10 +27,11 @@ def main():
t.write(zf)
t.flush()
say(f"Importing the conversion module")
say("Importing the conversion module")
sys.path.insert(0, t.name)
from dangerzone.conversion.doc_to_pixels import main
return asyncio.run(main())

View file

@ -56,7 +56,7 @@ class QubesWait(Qubes):
return proc
time.sleep(0.1)
raise RuntimeError(f"Disposable qube did not start within 30 seconds")
raise RuntimeError("Disposable qube did not start within 30 seconds")
@pytest.fixture