From 301e2516ab595a20d7e67d435025920879eaca50 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Thu, 3 Feb 2022 20:40:42 +0000 Subject: [PATCH] altcoin_subclass() -> base_proto_subclass() --- mmgen/addrdata.py | 6 +++--- mmgen/main_addrimport.py | 2 +- mmgen/twaddrs.py | 4 ++-- mmgen/twbal.py | 4 ++-- mmgen/twctl.py | 4 ++-- mmgen/twuo.py | 4 ++-- mmgen/tx.py | 10 +++++----- mmgen/util.py | 2 +- 8 files changed, 18 insertions(+), 18 deletions(-) diff --git a/mmgen/addrdata.py b/mmgen/addrdata.py index 91bdfa1e..6abca301 100755 --- a/mmgen/addrdata.py +++ b/mmgen/addrdata.py @@ -20,7 +20,7 @@ addrdata.py: MMGen AddrData and related classes """ -from .util import vmsg,altcoin_subclass +from .util import vmsg,base_proto_subclass from .base_obj import AsyncInit from .obj import MMGenObject,MMGenDict,get_obj from .addr import MMGenID,AddrListID @@ -37,7 +37,7 @@ re-import your addresses. } def __new__(cls,proto,*args,**kwargs): - return MMGenObject.__new__(altcoin_subclass(cls,proto,'tw')) + return MMGenObject.__new__(base_proto_subclass(cls,proto,'tw')) def __init__(self,proto,*args,**kwargs): self.al_ids = {} @@ -80,7 +80,7 @@ re-import your addresses. class TwAddrData(AddrData,metaclass=AsyncInit): def __new__(cls,proto,*args,**kwargs): - return MMGenObject.__new__(altcoin_subclass(cls,proto,'tw')) + return MMGenObject.__new__(base_proto_subclass(cls,proto,'tw')) async def __init__(self,proto,wallet=None): from .rpc import rpc_init diff --git a/mmgen/main_addrimport.py b/mmgen/main_addrimport.py index 8ca52b24..b0c9faa4 100755 --- a/mmgen/main_addrimport.py +++ b/mmgen/main_addrimport.py @@ -160,7 +160,7 @@ def make_args_list(tw,al,batch,rescan): async def main(): from .twctl import TrackingWallet if opt.token_addr: - proto.tokensym = 'foo' # hack to trigger 'Token' in altcoin_subclass() + proto.tokensym = 'foo' # hack to trigger 'Token' in base_proto_subclass() tw = await TrackingWallet( proto = proto, diff --git a/mmgen/twaddrs.py b/mmgen/twaddrs.py index 81d44a2e..ef8cd04d 100755 --- a/mmgen/twaddrs.py +++ b/mmgen/twaddrs.py @@ -21,7 +21,7 @@ twaddrs: Tracking wallet listaddresses class for the MMGen suite """ from .color import green -from .util import msg,die,altcoin_subclass +from .util import msg,die,base_proto_subclass from .base_obj import AsyncInit from .obj import MMGenList,MMGenDict,TwComment from .addr import CoinAddr,MMGenID @@ -32,7 +32,7 @@ class TwAddrList(MMGenDict,TwCommon,metaclass=AsyncInit): has_age = True def __new__(cls,proto,*args,**kwargs): - return MMGenDict.__new__(altcoin_subclass(cls,proto,'twaddrs'),*args,**kwargs) + return MMGenDict.__new__(base_proto_subclass(cls,proto,'twaddrs'),*args,**kwargs) async def __init__(self,proto,usr_addr_list,minconf,showempty,showbtcaddrs,all_labels,wallet=None): diff --git a/mmgen/twbal.py b/mmgen/twbal.py index 3ae13b0c..85acdb6f 100755 --- a/mmgen/twbal.py +++ b/mmgen/twbal.py @@ -21,7 +21,7 @@ twbal: Tracking wallet getbalance class for the MMGen suite """ from .color import red,green -from .util import altcoin_subclass +from .util import base_proto_subclass from .base_obj import AsyncInit from .objmethods import MMGenObject from .rpc import rpc_init @@ -32,7 +32,7 @@ class TwGetBalance(MMGenObject,metaclass=AsyncInit): fs = '{w:13} {u:<16} {p:<16} {c}' def __new__(cls,proto,*args,**kwargs): - return MMGenObject.__new__(altcoin_subclass(cls,proto,'twbal')) + return MMGenObject.__new__(base_proto_subclass(cls,proto,'twbal')) async def __init__(self,proto,minconf,quiet): diff --git a/mmgen/twctl.py b/mmgen/twctl.py index 1b6dcb93..2ecd4807 100755 --- a/mmgen/twctl.py +++ b/mmgen/twctl.py @@ -21,7 +21,7 @@ twctl: Tracking wallet control class for the MMGen suite """ from .globalvars import g -from .util import msg,dmsg,write_mode,altcoin_subclass +from .util import msg,dmsg,write_mode,base_proto_subclass from .base_obj import AsyncInit from .objmethods import MMGenObject from .obj import TwComment,get_obj @@ -38,7 +38,7 @@ class TrackingWallet(MMGenObject,metaclass=AsyncInit): importing = False def __new__(cls,proto,*args,**kwargs): - return MMGenObject.__new__(altcoin_subclass(cls,proto,'twctl')) + return MMGenObject.__new__(base_proto_subclass(cls,proto,'twctl')) async def __init__(self,proto,mode='r',token_addr=None): diff --git a/mmgen/twuo.py b/mmgen/twuo.py index 95a7d5df..e09bc55c 100755 --- a/mmgen/twuo.py +++ b/mmgen/twuo.py @@ -36,7 +36,7 @@ from .util import ( keypress_confirm, line_input, do_pager, - altcoin_subclass + base_proto_subclass ) from .base_obj import AsyncInit from .objmethods import MMGenObject @@ -48,7 +48,7 @@ from .tw import TwCommon,TwMMGenID,get_tw_label class TwUnspentOutputs(MMGenObject,TwCommon,metaclass=AsyncInit): def __new__(cls,proto,*args,**kwargs): - return MMGenObject.__new__(altcoin_subclass(cls,proto,'twuo')) + return MMGenObject.__new__(base_proto_subclass(cls,proto,'twuo')) txid_w = 64 disp_type = 'btc' diff --git a/mmgen/tx.py b/mmgen/tx.py index 8d499fbd..392a77a3 100755 --- a/mmgen/tx.py +++ b/mmgen/tx.py @@ -35,7 +35,7 @@ from .util import ( is_int, fmt, suf, - altcoin_subclass, + base_proto_subclass, confirm_or_raise, remove_dups, get_extension, @@ -353,14 +353,14 @@ class MMGenTX: def __new__(cls,*args,**kwargs): """ - determine correct protocol and pass the proto to altcoin_subclass(), which returns the + determine correct protocol and pass the proto to base_proto_subclass(), which returns the transaction object """ assert args == (), f'MMGenTX.Base_chk1: only keyword args allowed in {cls.__name__} initializer' if 'proto' in kwargs: - return MMGenObject.__new__(altcoin_subclass(cls,kwargs['proto'],'tx')) + return MMGenObject.__new__(base_proto_subclass(cls,kwargs['proto'],'tx')) elif 'data' in kwargs: - return MMGenObject.__new__(altcoin_subclass(cls,kwargs['data']['proto'],'tx')) + return MMGenObject.__new__(base_proto_subclass(cls,kwargs['data']['proto'],'tx')) elif 'filename' in kwargs: from .txfile import MMGenTxFile tmp_tx = MMGenObject.__new__(cls) @@ -368,7 +368,7 @@ class MMGenTX: infile = kwargs['filename'], quiet_open = kwargs.get('quiet_open'), metadata_only = True ) - me = MMGenObject.__new__(altcoin_subclass(cls,tmp_tx.proto,'tx')) + me = MMGenObject.__new__(base_proto_subclass(cls,tmp_tx.proto,'tx')) me.proto = tmp_tx.proto return me elif cls.__name__ == 'Base' and args == () and kwargs == {}: # allow instantiation of empty Base() diff --git a/mmgen/util.py b/mmgen/util.py index a194b7c6..6c47beaf 100755 --- a/mmgen/util.py +++ b/mmgen/util.py @@ -672,7 +672,7 @@ def get_subclasses(cls,names=False): yield j return tuple((c.__name__ for c in gen(cls)) if names else gen(cls)) -def altcoin_subclass(cls,proto,mod_dir): +def base_proto_subclass(cls,proto,mod_dir): """ magic module loading and class retrieval """