diff sat_frontends/jp/cmd_invitation.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 524856bd7b19
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_invitation.py	Mon Jun 14 12:19:21 2021 +0200
+++ b/sat_frontends/jp/cmd_invitation.py	Mon Jun 14 18:35:12 2021 +0200
@@ -162,9 +162,7 @@
         )
 
     def add_parser_options(self):
-        self.parser.add_argument(
-            "id", help=_("invitation UUID")
-        )
+        self.parser.add_argument("id", help=_("invitation UUID"))
         self.parser.add_argument(
             "-j",
             "--with-jid",
@@ -184,7 +182,7 @@
                 self.args.id,
             )
         except Exception as e:
-            self.disp(msg=_(f"can't get invitation data: {e}"), error=True)
+            self.disp(msg=_("can't get invitation data: {e}").format(e=e), error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
         if not self.args.with_jid:
@@ -197,7 +195,7 @@
                     profile,
                 )
             except Exception as e:
-                self.disp(msg=_(f"can't start session: {e}"), error=True)
+                self.disp(msg=_("can't start session: {e}").format(e=e), error=True)
                 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
             try:
@@ -207,7 +205,7 @@
                     profile_key=profile,
                 )
             except Exception as e:
-                self.disp(msg=_(f"can't retrieve jid: {e}"), error=True)
+                self.disp(msg=_("can't retrieve jid: {e}").format(e=e), error=True)
                 self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
             await self.output_data(invitation_data, jid_)
@@ -224,9 +222,7 @@
         )
 
     def add_parser_options(self):
-        self.parser.add_argument(
-            "id", help=_("invitation UUID")
-        )
+        self.parser.add_argument("id", help=_("invitation UUID"))
 
     async def start(self):
         try:
@@ -234,7 +230,7 @@
                 self.args.id,
             )
         except Exception as e:
-            self.disp(msg=_(f"can't delete guest account: {e}"), error=True)
+            self.disp(msg=_("can't delete guest account: {e}").format(e=e), error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
         self.host.quit()
@@ -290,9 +286,7 @@
             default="",
             help="profile doing the invitation (default: don't associate profile",
         )
-        self.parser.add_argument(
-            "id", help=_("invitation UUID")
-        )
+        self.parser.add_argument("id", help=_("invitation UUID"))
 
     async def start(self):
         extra = dict(self.args.extra)
@@ -302,7 +296,9 @@
                 continue
             if arg_name in extra:
                 self.parser.error(
-                    _(f"you can't set {arg_name} in both optional argument and extra")
+                    _(
+                        "you can't set {arg_name} in both optional argument and extra"
+                    ).format(arg_name=arg_name)
                 )
             extra[arg_name] = value
         try:
@@ -312,9 +308,7 @@
                 self.args.replace,
             )
         except Exception as e:
-            self.disp(
-                f"can't modify invitation: {e}", error=True
-            )
+            self.disp(f"can't modify invitation: {e}", error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
         else:
             self.disp(_("invitations have been modified successfuly"))