diff sat_frontends/jp/cmd_ping.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 4b842c1fb686
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_ping.py	Mon Jun 14 12:19:21 2021 +0200
+++ b/sat_frontends/jp/cmd_ping.py	Mon Jun 14 18:35:12 2021 +0200
@@ -25,14 +25,11 @@
 
 
 class Ping(base.CommandBase):
-
     def __init__(self, host):
-        super(Ping, self).__init__(host, 'ping', help=_('ping XMPP entity'))
+        super(Ping, self).__init__(host, "ping", help=_("ping XMPP entity"))
 
     def add_parser_options(self):
-        self.parser.add_argument(
-            "jid", help=_("jid to ping")
-        )
+        self.parser.add_argument("jid", help=_("jid to ping"))
         self.parser.add_argument(
             "-d", "--delay-only", action="store_true", help=_("output delay only (in s)")
         )
@@ -41,9 +38,9 @@
         try:
             pong_time = await self.host.bridge.ping(self.args.jid, self.profile)
         except Exception as e:
-            self.disp(msg=_(f"can't do the ping: {e}"), error=True)
+            self.disp(msg=_("can't do the ping: {e}").format(e=e), error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
         else:
-            msg = pong_time if self.args.delay_only else  f"PONG ({pong_time} s)"
+            msg = pong_time if self.args.delay_only else f"PONG ({pong_time} s)"
             self.disp(msg)
             self.host.quit()