Many small improvements
> Code improvements seen on #42: Retrieve informations once and use them in the whole program
1) https://git.duniter.org/clients/python/silkaj/blob/dd1a2b6eb81b2e8fa69ebda693c6374a8ae1e3b2/src/commands.py#L176
Would the variable `pretty` better named `pretty_currency` ?
2) https://git.duniter.org/clients/python/silkaj/blob/dd1a2b6eb81b2e8fa69ebda693c6374a8ae1e3b2/src/commands.py#L181
`ep[best_node(ep, False)]` ok now I see: best_node give the DNS or the IPv4 or the IPv6 of the endpoint ! It doesn't select a node among all.
So maybe `best_address` would be a better name ? or `best_endpoint_address` ?
3) https://git.duniter.org/clients/python/silkaj/blob/dd1a2b6eb81b2e8fa69ebda693c6374a8ae1e3b2/src/commands.py#L181
By the way, if the port is 443, the scheme is `https` not `http` I think.
4) https://git.duniter.org/clients/python/silkaj/blob/dd1a2b6eb81b2e8fa69ebda693c6374a8ae1e3b2/src/commands.py#L170
Can you use `constants.G1_SYMBOL` instead of `pretty_names = {'g1': 'Ğ1', 'gtest': 'Ğtest'}` ?
Maybe this dict would be in the constants package too ?
5) https://git.duniter.org/clients/python/silkaj/blob/cc1af63b8fc01a84f7184ebdce8da0f1f93ef658/src/money.py#L28
Is `amount` the amount "signed" in the blockchain and `totalAmountInput` the amount "signed" and "not yet signed" in the blockchain ?
6) https://git.duniter.org/clients/python/silkaj/blob/cc1af63b8fc01a84f7184ebdce8da0f1f93ef658/src/money.py#L28
`# output`
Useless comment.
7) https://git.duniter.org/clients/python/silkaj/blob/cc1af63b8fc01a84f7184ebdce8da0f1f93ef658/src/money.py#L27
I think we can refactor this :
# "--" in CLI to authenticate otherwise use pubkeys
if "--" in args:
pubkeys = [get_publickey_from_seed(auth...)]
else:
pubkeys = args.split(":")
# ensure pubkeys are real
...
for pubkey in pubkeys:
get amount
show amount
...
8) https://git.duniter.org/clients/python/silkaj/blob/cc1af63b8fc01a84f7184ebdce8da0f1f93ef658/src/money.py#L17
can we rename `value` to `amount` ? Actually `amounts` would be even better.
9) https://git.duniter.org/clients/python/silkaj/blob/fbfccc49ddf4691a85f078c246435be1f2246808/src/network_tools.py#L86
I think the last port is 65535
10) https://git.duniter.org/clients/python/silkaj/blob/5af9bc8921566ca25e3e0cee04444ba714380afa/src/tx.py#L31
That's the hell of a (near) one liner condition ;-)
it's clever, but maybe putting the `input(tabulate...` in a "user_confirm_transaction" function would make it more readable ?
11) https://git.duniter.org/clients/python/silkaj/blob/222e3765c17f0bc40a3a91eb28272ce665ecc836/src/wot.py#L16
`chart` is a "graphique", do you mean a table ?
12) https://git.duniter.org/clients/python/silkaj/blob/d1f53c1fdb4b1e9218e0980183f0c295198c0483/src/commands.py#L233-234 Mutualise this call with the previous line using a `ep_address` variable?
issue