diff sat_frontends/jp/cmd_event.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 d8baf92cb921
line wrap: on
line diff
--- a/sat_frontends/jp/cmd_event.py	Mon Jun 14 12:19:21 2021 +0200
+++ b/sat_frontends/jp/cmd_event.py	Mon Jun 14 18:35:12 2021 +0200
@@ -107,9 +107,7 @@
             default="",
             help=_("ID of the PubSub Item"),
         )
-        self.parser.add_argument(
-            "-d", "--date", type=str, help=_("date of the event")
-        )
+        self.parser.add_argument("-d", "--date", type=str, help=_("date of the event"))
         self.parser.add_argument(
             "-f",
             "--field",
@@ -169,7 +167,7 @@
             self.disp(f"can't create event: {e}", error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
         else:
-            self.disp(_(f"Event created successfuly on node {node}"))
+            self.disp(_("Event created successfuly on node {node}").format(node=node))
             self.host.quit()
 
 
@@ -350,9 +348,7 @@
         table = common.Table.fromListDict(
             self.host,
             data,
-            ("nick",)
-            + (("jid",) if self.host.verbosity else ())
-            + ("attend", "guests"),
+            ("nick",) + (("jid",) if self.host.verbosity else ()) + ("attend", "guests"),
             headers=None,
             filters={
                 "nick": A.color(C.A_HEADER, "{}" if show_table else "{} "),
@@ -402,9 +398,7 @@
                 )
             )
             self.disp(
-                A.color(
-                    C.A_SUBHEADER, _("total: "), A.RESET, str(guests + guests_maybe)
-                )
+                A.color(C.A_SUBHEADER, _("total: "), A.RESET, str(guests + guests_maybe))
             )
         if attendees_missing:
             self.disp("")
@@ -453,7 +447,7 @@
             self.disp(f"can't get event data: {e}", error=True)
             self.host.quit(C.EXIT_BRIDGE_ERRBACK)
 
-        # we fill nicknames and keep only requested people
+            # we fill nicknames and keep only requested people
 
         if self.args.no_rsvp:
             for jid_ in event_data:
@@ -462,21 +456,23 @@
                 try:
                     del prefilled[jid_]
                 except KeyError:
-                    self.disp(A.color(
-                        C.A_WARNING,
-                        f"We got a RSVP from somebody who was not in invitees "
-                        f"list: {jid_}"
+                    self.disp(
+                        A.color(
+                            C.A_WARNING,
+                            f"We got a RSVP from somebody who was not in invitees "
+                            f"list: {jid_}",
                         ),
-                        error=True)
+                        error=True,
+                    )
         else:
             # we replace empty dicts for existing people with R.S.V.P. data
             prefilled.update(event_data)
 
-        # we get nicknames for everybody, make it easier for organisers
+            # we get nicknames for everybody, make it easier for organisers
         for jid_, data in prefilled.items():
             id_data = await self.host.bridge.identityGet(jid_, [], True, self.profile)
             id_data = data_format.deserialise(id_data)
-            data["nick"] = id_data['nicknames'][0]
+            data["nick"] = id_data["nicknames"][0]
 
         await self.output(prefilled)
         self.host.quit()