Commit d7c2e13f authored by Moul's avatar Moul
Browse files

[mod] #194: history/tx: Use f-string

parent ad958fe9
......@@ -58,9 +58,7 @@ NBR_ISSUERS = 1
"-a",
multiple=True,
type=click.FloatRange(MINIMAL_ABSOLUTE_TX_AMOUNT),
help="Quantitative amount(s):\n-a <amount>\nMinimum amount is {}".format(
MINIMAL_ABSOLUTE_TX_AMOUNT
),
help=f"Quantitative amount(s):\n-a <amount>\nMinimum amount is {MINIMAL_ABSOLUTE_TX_AMOUNT}.",
cls=cli_tools.MutuallyExclusiveOption,
mutually_exclusive=["amountsud", "allsources"],
)
......@@ -232,9 +230,9 @@ def check_transaction_values(
if ct.check_pubkey_format(outputBackChange):
outputBackChange = ct.validate_checksum(outputBackChange)
if enough_source:
pubkey = tui.display_pubkey_and_checksum(issuer_pubkey)
tools.message_exit(
tui.display_pubkey_and_checksum(issuer_pubkey)
+ " pubkey doesn’t have enough money for this transaction."
f"{pubkey} pubkey doesn’t have enough money for this transaction."
)
return outputBackChange
......
......@@ -62,16 +62,10 @@ def generate_header(pubkey, currency_symbol, ud_value):
except:
idty = dict([("uid", "")])
balance = get_amount_from_pubkey(pubkey)
return "Transactions history from: {uid} {pubkey}\n\
Current balance: {balance} {currency}, {balance_ud} UD {currency} on {date}\n\
".format(
uid=idty["uid"],
pubkey=display_pubkey_and_checksum(pubkey),
currency=currency_symbol,
balance=balance[1] / 100,
balance_ud=round(balance[1] / ud_value, 2),
date=now().format(ALL),
)
balance_ud = round(balance[1] / ud_value, 2)
date = now().format(ALL)
return f'Transactions history from: {idty["uid"]} {display_pubkey_and_checksum(pubkey)}\n\
Current balance: {balance[1] / 100} {currency_symbol}, {balance_ud} UD {currency_symbol} on {date}\n'
def get_transactions_history(client, pubkey, received_txs, sent_txs):
......@@ -250,10 +244,8 @@ def assign_idty_from_pubkey(pubkey, identities, full_pubkey):
idty = display_pubkey_and_checksum(pubkey, short=not full_pubkey)
for identity in identities:
if pubkey == identity["pubkey"]:
idty = "{} - {}".format(
identity["uid"],
display_pubkey_and_checksum(pubkey, short=not full_pubkey),
)
pubkey_mod = display_pubkey_and_checksum(pubkey, short=not full_pubkey)
idty = f'{identity["uid"]} - {pubkey_mod}'
return idty
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment