Skip to content
Snippets Groups Projects
Commit 5214297b authored by Moul's avatar Moul
Browse files

[mod] #194: wot: Use f-string

parent d7c2e13f
No related branches found
No related tags found
1 merge request!195#194, #376: Use f-string and sys.exit()
...@@ -84,23 +84,15 @@ def received_sent_certifications(uid_pubkey): ...@@ -84,23 +84,15 @@ def received_sent_certifications(uid_pubkey):
certifications["sent_expire"], certifications["sent_expire"],
) = get_sent_certifications(signed, time_first_block, params) ) = get_sent_certifications(signed, time_first_block, params)
nbr_sent_certs = len(certifications["sent"]) if "sent" in certifications else 0 nbr_sent_certs = len(certifications["sent"]) if "sent" in certifications else 0
print( table = tabulate(
"{} ({}) from block #{}\nreceived {} and sent {}/{} certifications:\n{}\n{}\n".format( certifications, headers="keys", tablefmt="orgtbl", stralign="right"
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",
)
) )
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) membership_status(certifications, pubkey, req)
...@@ -114,12 +106,10 @@ def cert_written_in_the_blockchain(written_certs, certifieur): ...@@ -114,12 +106,10 @@ def cert_written_in_the_blockchain(written_certs, certifieur):
def membership_status(certifications, pubkey, req): def membership_status(certifications, pubkey, req):
params = BlockchainParams().params params = BlockchainParams().params
if len(certifications["received"]) >= params["sigQty"]: if len(certifications["received"]) >= params["sigQty"]:
print( date = certifications["received_expire"][
"Membership expiration due to certification expirations: " len(certifications["received"]) - params["sigQty"]
+ certifications["received_expire"][ ]
len(certifications["received"]) - params["sigQty"] print(f"Membership expiration due to certification expirations: {date}")
]
)
member = wt.is_member(pubkey) member = wt.is_member(pubkey)
if member: if member:
member = True member = True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment