From e8f48bd66e30816dfbe318215e7d404bbdecf90e Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Mon, 3 Jul 2023 12:42:50 +0000 Subject: [PATCH] whitespace; minor fix --- mmgen/proto/btc/tw/addresses.py | 23 ++++++++++++++--------- mmgen/rpc.py | 3 ++- mmgen/tool/rpc.py | 8 ++++---- mmgen/tw/json.py | 17 +++++++++++++++-- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/mmgen/proto/btc/tw/addresses.py b/mmgen/proto/btc/tw/addresses.py index 994bf20a..a78fe36f 100755 --- a/mmgen/proto/btc/tw/addresses.py +++ b/mmgen/proto/btc/tw/addresses.py @@ -54,15 +54,20 @@ Actions: [q]uit menu, r[e]draw, add [l]abel: self.total = sum((v['amt'] for v in addrs.values())) or amt0 # Python 3.8: start=amt0 msg_r('Getting labels and associated addresses...') - for label,addr in await self.get_addr_label_pairs(): - if label and label.mmid not in addrs: - addrs[label.mmid] = { - 'addr': addr, - 'amt': amt0, - 'recvd': amt0, - 'confs': 0, - 'lbl': label } - msg('done') + pairs = await self.get_addr_label_pairs() + + if pairs: + for label,addr in pairs: + if label and label.mmid not in addrs: + addrs[label.mmid] = { + 'addr': addr, + 'amt': amt0, + 'recvd': amt0, + 'confs': 0, + 'lbl': label } + msg('done') + else: + msg('[none]') msg_r('Getting received funds data...') # args: 1:minconf, 2:include_empty, 3:include_watchonly, 4:include_immature_coinbase (>=v23.0.0) diff --git a/mmgen/rpc.py b/mmgen/rpc.py index ca7b9bcf..340e301d 100755 --- a/mmgen/rpc.py +++ b/mmgen/rpc.py @@ -308,7 +308,8 @@ class RPCClient(MMGenObject): self.backend = (await ret) if type(ret).__name__ == 'coroutine' else ret # Call family of methods - direct-to-daemon RPC call: - # positional params are passed to the daemon, 'timeout' and 'wallet' kwargs to the backend + # - positional params are passed to the daemon, 'timeout' and 'wallet' kwargs to the backend + # - 'wallet' kwarg is used only by regtest async def call(self,method,*params,timeout=None,wallet=None): """ diff --git a/mmgen/tool/rpc.py b/mmgen/tool/rpc.py index b40d9f4e..8efcba53 100755 --- a/mmgen/tool/rpc.py +++ b/mmgen/tool/rpc.py @@ -229,10 +229,10 @@ class tool_cmd(tool_cmd_base): await TwJSON.Export( self.cfg, self.proto, - include_amts = include_amts, - pretty = pretty, - prune = prune, - warn_used = warn_used ) + include_amts = include_amts, + pretty = pretty, + prune = prune, + warn_used = warn_used ) return True async def twimport(self,filename:str,ignore_checksum=False,batch=False): diff --git a/mmgen/tw/json.py b/mmgen/tw/json.py index 2b55a2db..a6db12ef 100755 --- a/mmgen/tw/json.py +++ b/mmgen/tw/json.py @@ -86,7 +86,13 @@ class TwJSON: blockchain_rescan_warning = None - async def __init__(self,cfg,proto,filename,ignore_checksum=False,batch=False): + async def __init__( + self, + cfg, + proto, + filename, + ignore_checksum = False, + batch = False ): super().__init__(cfg,proto) @@ -154,7 +160,14 @@ class TwJSON: class Export(Base,metaclass=AsyncInit): - async def __init__(self,cfg,proto,include_amts=True,pretty=False,prune=False,warn_used=False): + async def __init__( + self, + cfg, + proto, + include_amts = True, + pretty = False, + prune = False, + warn_used = False ): if prune and not self.can_prune: die(1,f'Pruning not supported for {proto.name} protocol')