diff --git a/silkaj/money.py b/silkaj/money.py index b23f9ad3354bf51250894758d6048c9d7b51ed0c..d030a661dd342240acebf0228125296e8e0f577c 100644 --- a/silkaj/money.py +++ b/silkaj/money.py @@ -138,7 +138,7 @@ def get_sources(pubkey): listinput = list() amount = 0 for source in sources["sources"]: - if source["conditions"] == "SIG(" + pubkey + ")": + if source["conditions"] == f"SIG({pubkey})": listinput.append( InputSource( amount=source["amount"], @@ -161,7 +161,7 @@ def get_sources(pubkey): identifier = pending["hash"] for i, output in enumerate(pending["outputs"]): outputsplited = output.split(":") - if outputsplited[2] == "SIG(" + pubkey + ")": + if outputsplited[2] == f"SIG({pubkey})": inputgenerated = InputSource( amount=int(outputsplited[0]), base=int(outputsplited[1]), diff --git a/silkaj/tui.py b/silkaj/tui.py index 985c97455fb79ab97714099e7ce8e02e8fa06b6b..eaecea329cf442c02eb6c1e61d5be3f103110a5a 100644 --- a/silkaj/tui.py +++ b/silkaj/tui.py @@ -27,15 +27,12 @@ def display_amount(tx, message, amount, ud_value, currency_symbol): """ Displays an amount in unit and relative reference. """ - amount_UD = round((amount / ud_value), 2) + UD_amount = str(round((amount / ud_value), 2)) + unit_amount = str(amount / 100) tx.append( [ - message + " (unit|relative)", - "{unit_amount} {currency_symbol} | {UD_amount} UD {currency_symbol}".format( - unit_amount=str(amount / 100), - currency_symbol=currency_symbol, - UD_amount=str(amount_UD), - ), + f"{message} (unit|relative)", + f"{unit_amount} {currency_symbol} | {UD_amount} UD {currency_symbol}", ] ) @@ -44,10 +41,10 @@ def display_pubkey(tx, message, pubkey): """ Displays a pubkey and the eventually associated id. """ - tx.append([message + " (pubkey:checksum)", display_pubkey_and_checksum(pubkey)]) + tx.append([f"{message} (pubkey:checksum)", display_pubkey_and_checksum(pubkey)]) id = wot_tools.is_member(pubkey) if id: - tx.append([message + " (id)", id["uid"]]) + tx.append([f"{message} (id)", id["uid"]]) def display_pubkey_and_checksum( @@ -58,8 +55,8 @@ def display_pubkey_and_checksum( returns `length` first chars of pubkey and checksum in short form. `length` defaults to SHORT_PUBKEY_SIZE. """ - short_pubkey = pubkey[:length] + "…" if short else pubkey - return short_pubkey + ":" + ct.gen_checksum(pubkey) + short_pubkey = f"{pubkey[:length]}…" if short else pubkey + return f"{short_pubkey}:{ct.gen_checksum(pubkey)}" def send_doc_confirmation(document_name):