From 5214297b1166bf885f29f1a2bbe6f157e23f4756 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sun, 26 Sep 2021 13:28:08 +0200
Subject: [PATCH] [mod] #194: wot: Use f-string

---
 silkaj/wot.py | 34 ++++++++++++----------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/silkaj/wot.py b/silkaj/wot.py
index d83d603d..d66bba6b 100644
--- a/silkaj/wot.py
+++ b/silkaj/wot.py
@@ -84,23 +84,15 @@ def received_sent_certifications(uid_pubkey):
             certifications["sent_expire"],
         ) = get_sent_certifications(signed, time_first_block, params)
     nbr_sent_certs = len(certifications["sent"]) if "sent" in certifications else 0
-    print(
-        "{} ({}) from block #{}\nreceived {} and sent {}/{} certifications:\n{}\n{}\n".format(
-            identity["uid"],
-            display_pubkey_and_checksum(pubkey, True),
-            identity["meta"]["timestamp"][:15] + "…",
-            len(certifications["received"]),
-            nbr_sent_certs,
-            params["sigStock"],
-            tabulate(
-                certifications,
-                headers="keys",
-                tablefmt="orgtbl",
-                stralign="right",
-            ),
-            "✔: Certification available to be written or already written into the blockchain",
-        )
+    table = tabulate(
+        certifications, headers="keys", tablefmt="orgtbl", stralign="right"
     )
+    txt = f'{identity["uid"]} ({display_pubkey_and_checksum(pubkey, True)}) \
+from block #{identity["meta"]["timestamp"][:15]}…\n\
+received {len(certifications["received"])} and sent {nbr_sent_certs}/{params["sigStock"]} certifications:\n\
+{table}\n\
+✔: Certification available to be written or already written into the blockchain\n'
+    print(txt)
     membership_status(certifications, pubkey, req)
 
 
@@ -114,12 +106,10 @@ def cert_written_in_the_blockchain(written_certs, certifieur):
 def membership_status(certifications, pubkey, req):
     params = BlockchainParams().params
     if len(certifications["received"]) >= params["sigQty"]:
-        print(
-            "Membership expiration due to certification expirations: "
-            + certifications["received_expire"][
-                len(certifications["received"]) - params["sigQty"]
-            ]
-        )
+        date = certifications["received_expire"][
+            len(certifications["received"]) - params["sigQty"]
+        ]
+        print(f"Membership expiration due to certification expirations: {date}")
     member = wt.is_member(pubkey)
     if member:
         member = True
-- 
GitLab