Browse Source

altcoin_subclass() -> base_proto_subclass()

The MMGen Project 3 years ago
parent
commit
301e2516ab
8 changed files with 18 additions and 18 deletions
  1. 3 3
      mmgen/addrdata.py
  2. 1 1
      mmgen/main_addrimport.py
  3. 2 2
      mmgen/twaddrs.py
  4. 2 2
      mmgen/twbal.py
  5. 2 2
      mmgen/twctl.py
  6. 2 2
      mmgen/twuo.py
  7. 5 5
      mmgen/tx.py
  8. 1 1
      mmgen/util.py

+ 3 - 3
mmgen/addrdata.py

@@ -20,7 +20,7 @@
 addrdata.py: MMGen AddrData and related classes
 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 .base_obj import AsyncInit
 from .obj import MMGenObject,MMGenDict,get_obj
 from .obj import MMGenObject,MMGenDict,get_obj
 from .addr import MMGenID,AddrListID
 from .addr import MMGenID,AddrListID
@@ -37,7 +37,7 @@ re-import your addresses.
 	}
 	}
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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):
 	def __init__(self,proto,*args,**kwargs):
 		self.al_ids = {}
 		self.al_ids = {}
@@ -80,7 +80,7 @@ re-import your addresses.
 class TwAddrData(AddrData,metaclass=AsyncInit):
 class TwAddrData(AddrData,metaclass=AsyncInit):
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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):
 	async def __init__(self,proto,wallet=None):
 		from .rpc import rpc_init
 		from .rpc import rpc_init

+ 1 - 1
mmgen/main_addrimport.py

@@ -160,7 +160,7 @@ def make_args_list(tw,al,batch,rescan):
 async def main():
 async def main():
 	from .twctl import TrackingWallet
 	from .twctl import TrackingWallet
 	if opt.token_addr:
 	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(
 	tw = await TrackingWallet(
 		proto      = proto,
 		proto      = proto,

+ 2 - 2
mmgen/twaddrs.py

@@ -21,7 +21,7 @@ twaddrs: Tracking wallet listaddresses class for the MMGen suite
 """
 """
 
 
 from .color import green
 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 .base_obj import AsyncInit
 from .obj import MMGenList,MMGenDict,TwComment
 from .obj import MMGenList,MMGenDict,TwComment
 from .addr import CoinAddr,MMGenID
 from .addr import CoinAddr,MMGenID
@@ -32,7 +32,7 @@ class TwAddrList(MMGenDict,TwCommon,metaclass=AsyncInit):
 	has_age = True
 	has_age = True
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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):
 	async def __init__(self,proto,usr_addr_list,minconf,showempty,showbtcaddrs,all_labels,wallet=None):
 
 

+ 2 - 2
mmgen/twbal.py

@@ -21,7 +21,7 @@ twbal: Tracking wallet getbalance class for the MMGen suite
 """
 """
 
 
 from .color import red,green
 from .color import red,green
-from .util import altcoin_subclass
+from .util import base_proto_subclass
 from .base_obj import AsyncInit
 from .base_obj import AsyncInit
 from .objmethods import MMGenObject
 from .objmethods import MMGenObject
 from .rpc import rpc_init
 from .rpc import rpc_init
@@ -32,7 +32,7 @@ class TwGetBalance(MMGenObject,metaclass=AsyncInit):
 	fs = '{w:13} {u:<16} {p:<16} {c}'
 	fs = '{w:13} {u:<16} {p:<16} {c}'
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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):
 	async def __init__(self,proto,minconf,quiet):
 
 

+ 2 - 2
mmgen/twctl.py

@@ -21,7 +21,7 @@ twctl: Tracking wallet control class for the MMGen suite
 """
 """
 
 
 from .globalvars import g
 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 .base_obj import AsyncInit
 from .objmethods import MMGenObject
 from .objmethods import MMGenObject
 from .obj import TwComment,get_obj
 from .obj import TwComment,get_obj
@@ -38,7 +38,7 @@ class TrackingWallet(MMGenObject,metaclass=AsyncInit):
 	importing = False
 	importing = False
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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):
 	async def __init__(self,proto,mode='r',token_addr=None):
 
 

+ 2 - 2
mmgen/twuo.py

@@ -36,7 +36,7 @@ from .util import (
 	keypress_confirm,
 	keypress_confirm,
 	line_input,
 	line_input,
 	do_pager,
 	do_pager,
-	altcoin_subclass
+	base_proto_subclass
 )
 )
 from .base_obj import AsyncInit
 from .base_obj import AsyncInit
 from .objmethods import MMGenObject
 from .objmethods import MMGenObject
@@ -48,7 +48,7 @@ from .tw import TwCommon,TwMMGenID,get_tw_label
 class TwUnspentOutputs(MMGenObject,TwCommon,metaclass=AsyncInit):
 class TwUnspentOutputs(MMGenObject,TwCommon,metaclass=AsyncInit):
 
 
 	def __new__(cls,proto,*args,**kwargs):
 	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
 	txid_w = 64
 	disp_type = 'btc'
 	disp_type = 'btc'

+ 5 - 5
mmgen/tx.py

@@ -35,7 +35,7 @@ from .util import (
 	is_int,
 	is_int,
 	fmt,
 	fmt,
 	suf,
 	suf,
-	altcoin_subclass,
+	base_proto_subclass,
 	confirm_or_raise,
 	confirm_or_raise,
 	remove_dups,
 	remove_dups,
 	get_extension,
 	get_extension,
@@ -353,14 +353,14 @@ class MMGenTX:
 
 
 		def __new__(cls,*args,**kwargs):
 		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
 			transaction object
 			"""
 			"""
 			assert args == (), f'MMGenTX.Base_chk1: only keyword args allowed in {cls.__name__} initializer'
 			assert args == (), f'MMGenTX.Base_chk1: only keyword args allowed in {cls.__name__} initializer'
 			if 'proto' in kwargs:
 			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:
 			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:
 			elif 'filename' in kwargs:
 				from .txfile import MMGenTxFile
 				from .txfile import MMGenTxFile
 				tmp_tx = MMGenObject.__new__(cls)
 				tmp_tx = MMGenObject.__new__(cls)
@@ -368,7 +368,7 @@ class MMGenTX:
 					infile        = kwargs['filename'],
 					infile        = kwargs['filename'],
 					quiet_open    = kwargs.get('quiet_open'),
 					quiet_open    = kwargs.get('quiet_open'),
 					metadata_only = True )
 					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
 				me.proto = tmp_tx.proto
 				return me
 				return me
 			elif cls.__name__ == 'Base' and args == () and kwargs == {}: # allow instantiation of empty Base()
 			elif cls.__name__ == 'Base' and args == () and kwargs == {}: # allow instantiation of empty Base()

+ 1 - 1
mmgen/util.py

@@ -672,7 +672,7 @@ def get_subclasses(cls,names=False):
 				yield j
 				yield j
 	return tuple((c.__name__ for c in gen(cls)) if names else gen(cls))
 	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
 	magic module loading and class retrieval
 	"""
 	"""