diff sat_frontends/jp/cmd_merge_request.py @ 3568:04283582966f

core, frontends: fix invalid translatable strings. Some f-strings where used in translatable text, this has been fixed by using explicit `format()` call (using a script based on `tokenize`). As tokenize messes with spaces, a reformating tool (`black`) has been applied to some files afterwards.
author Goffi <goffi@goffi.org>
date Mon, 14 Jun 2021 18:35:12 +0200
parents be6d91572633
children 5f65f4e9f8cb
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_merge_request.py	Mon Jun 14 12:19:21 2021 +0200
+++ b/sat_frontends/jp/cmd_merge_request.py	Mon Jun 14 18:35:12 2021 +0200
@@ -30,7 +30,6 @@
 
 
 class Set(base.CommandBase):
-
     def __init__(self, host):
         base.CommandBase.__init__(
             self,
@@ -74,11 +73,12 @@
         await common.fill_well_known_uri(self, self.repository, "merge requests")
         if not self.args.force:
             message = _(
-                f"You are going to publish your changes to service "
-                f"[{self.args.service}], are you sure ?"
+                "You are going to publish your changes to service "
+                "[{service}], are you sure ?"
+            ).format(service=self.args.service)
+            await self.host.confirmOrQuit(
+                message, _("merge request publication cancelled")
             )
-            await self.host.confirmOrQuit(
-                message, _("merge request publication cancelled"))
 
         extra = {"update": True} if self.args.item else {}
         values = {}
@@ -101,7 +101,11 @@
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
         if published_id:
-            self.disp(_(f"Merge request published at {published_id}"))
+            self.disp(
+                _("Merge request published at {published_id}").format(
+                    published_id=published_id
+                )
+            )
         else:
             self.disp(_("Merge request published"))
 
@@ -125,8 +129,7 @@
         pass
 
     async def start(self):
-        await common.fill_well_known_uri(
-            self, os.getcwd(), "merge requests", meta_map={})
+        await common.fill_well_known_uri(self, os.getcwd(), "merge requests", meta_map={})
         extra = {}
         try:
             requests_data = data_format.deserialise(
@@ -148,7 +151,7 @@
             whitelist = None
         else:
             whitelist = {"id", "title", "body"}
-        for request_xmlui in requests_data['items']:
+        for request_xmlui in requests_data["items"]:
             xmlui = xmlui_manager.create(self.host, request_xmlui, whitelist=whitelist)
             await xmlui.show(values_only=True)
             self.disp("")
@@ -179,7 +182,8 @@
     async def start(self):
         self.repository = os.path.expanduser(os.path.abspath(self.args.repository))
         await common.fill_well_known_uri(
-            self, self.repository, "merge requests", meta_map={})
+            self, self.repository, "merge requests", meta_map={}
+        )
         extra = {}
         try:
             await self.host.bridge.mergeRequestsImport(