minor cleanups
This commit is contained in:
parent
ba3b40c5b6
commit
8c2b48780d
7 changed files with 12 additions and 10 deletions
|
|
@ -81,7 +81,7 @@ addrimport_msgs = {
|
|||
"""
|
||||
}
|
||||
|
||||
def parse_cmd_args(rpc, cmd_args):
|
||||
def parse_cmd_args(cmd_args):
|
||||
|
||||
def import_mmgen_list(infile):
|
||||
return (AddrList, KeyAddrList)[bool(cfg.keyaddr_file)](cfg, proto, infile=infile)
|
||||
|
|
@ -146,7 +146,7 @@ async def main():
|
|||
for k, v in addrimport_msgs.items():
|
||||
addrimport_msgs[k] = fmt(v, indent=' ', strip_char='\t').rstrip()
|
||||
|
||||
al, infile = parse_cmd_args(twctl.rpc, cfg._args)
|
||||
al, infile = parse_cmd_args(cfg._args)
|
||||
|
||||
cfg._util.qmsg(
|
||||
f'OK. {al.num_addrs} addresses'
|
||||
|
|
|
|||
|
|
@ -124,10 +124,11 @@ class ImmutableAttr: # Descriptor
|
|||
def assign_with_check(instance, value):
|
||||
if type(value) is dtype:
|
||||
return value
|
||||
raise TypeError('Attribute {!r} of {} instance must of type {}'.format(
|
||||
raise TypeError('Attribute {!r} of {} instance must be of type {}, not {}'.format(
|
||||
self.name,
|
||||
type(instance).__name__,
|
||||
dtype))
|
||||
dtype,
|
||||
type(value)))
|
||||
self.conv = assign_with_check
|
||||
|
||||
def __set_name__(self, owner, name):
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ class BitcoinTwCtl(TwCtl):
|
|||
def init_empty(self):
|
||||
self.data = {'coin': self.proto.coin, 'addresses': {}}
|
||||
|
||||
def upgrade_wallet_maybe(self):
|
||||
pass
|
||||
|
||||
async def rpc_get_balance(self, addr, block='latest'):
|
||||
raise NotImplementedError('not implemented')
|
||||
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ class EthereumTwCtl(TwCtl):
|
|||
def used_addrs(self):
|
||||
from decimal import Decimal
|
||||
return (
|
||||
{k for k, v in self.data['accounts'].items() if Decimal(v['balance'])} |
|
||||
{k for k, v in self.data['accounts'].items() if Decimal(v.get('balance', 0))} |
|
||||
{k for t in self.data['tokens'].values() for k, v in t.items()
|
||||
if Decimal(v.get('balance', 0))})
|
||||
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ class TwAddresses(TwView):
|
|||
(not (d.is_used and not self.showused) and (d.amt or self.showempty))
|
||||
)
|
||||
|
||||
def get_column_widths(self, data, wide, interactive):
|
||||
def get_column_widths(self, data, *, wide, interactive):
|
||||
|
||||
return self.compute_column_widths(
|
||||
widths = { # fixed cols
|
||||
|
|
|
|||
|
|
@ -110,6 +110,9 @@ class TwCtl(MMGenObject, metaclass=AsyncInit):
|
|||
|
||||
self.conv_types(self.data[self.data_key])
|
||||
|
||||
def upgrade_wallet_maybe(self):
|
||||
pass
|
||||
|
||||
def init_from_wallet_file(self):
|
||||
from ..fileutil import check_or_create_dir, get_data_from_file
|
||||
check_or_create_dir(self.tw_dir)
|
||||
|
|
|
|||
|
|
@ -466,7 +466,8 @@ class CmdTestEthSwapEth(CmdTestEthSwapMethods, CmdTestSwapMethods, CmdTestEthdev
|
|||
return self._swaptxsend(add_opts=['--verbose', '--status'], status=True)
|
||||
|
||||
def swaptxmemo4(self):
|
||||
self.mining_delay()
|
||||
import time
|
||||
time.sleep(1)
|
||||
return self._check_token_swaptx_memo('=:b:mkQsXA7mqDtnUpkaXMbDtAL1KMeof4GPw3:0/3/0')
|
||||
|
||||
def swaptxreceipt4(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue