Browse Source

proto.base_proto_subclass(): simplify call signature

The MMGen Project 2 years ago
parent
commit
20b250ef98
9 changed files with 10 additions and 11 deletions
  1. 1 1
      mmgen/addrdata.py
  2. 2 3
      mmgen/protocol.py
  3. 1 1
      mmgen/tw/addresses.py
  4. 1 1
      mmgen/tw/bal.py
  5. 1 1
      mmgen/tw/ctl.py
  6. 1 1
      mmgen/tw/json.py
  7. 1 1
      mmgen/tw/rpc.py
  8. 1 1
      mmgen/tw/txhistory.py
  9. 1 1
      mmgen/tw/unspent.py

+ 1 - 1
mmgen/addrdata.py

@@ -69,7 +69,7 @@ class AddrData(MMGenObject):
 class TwAddrData(AddrData,metaclass=AsyncInit):
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,None,'addrdata'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'addrdata'))
 
 	async def __init__(self,proto,wallet=None):
 		from .rpc import rpc_init

+ 2 - 3
mmgen/protocol.py

@@ -165,13 +165,12 @@ class CoinProtocol(MMGenObject):
 		def viewkey(self,viewkey_str):
 			raise NotImplementedError(f'{self.name} protocol does not support view keys')
 
-		def base_proto_subclass(self,cls,subdir,modname,sub_clsname=None):
+		def base_proto_subclass(self,cls,modname,sub_clsname=None):
 			"""
 			magic module loading and class selection
 			"""
-			modpath = 'mmgen.proto.{}.{}{}'.format(
+			modpath = 'mmgen.proto.{}.{}'.format(
 				self.base_proto_coin.lower(),
-				subdir + '.' if subdir else '',
 				modname )
 
 			clsname = (

+ 1 - 1
mmgen/tw/addresses.py

@@ -72,7 +72,7 @@ class TwAddresses(TwView):
 		return [d.addr for d in self.data]
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','addresses'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.addresses'))
 
 	async def __init__(self,proto,minconf=1,mmgen_addrs='',get_data=False):
 

+ 1 - 1
mmgen/tw/bal.py

@@ -28,7 +28,7 @@ from ..rpc import rpc_init
 class TwGetBalance(MMGenObject,metaclass=AsyncInit):
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','bal'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.bal'))
 
 	async def __init__(self,proto,minconf,quiet):
 

+ 1 - 1
mmgen/tw/ctl.py

@@ -54,7 +54,7 @@ class TrackingWallet(MMGenObject,metaclass=AsyncInit):
 	importing = False
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','ctl'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.ctl'))
 
 	async def __init__(self,proto,mode='r',token_addr=None,rpc_ignore_wallet=False):
 

+ 1 - 1
mmgen/tw/json.py

@@ -28,7 +28,7 @@ class TwJSON:
 		fn_pfx = 'mmgen-tracking-wallet-dump'
 
 		def __new__(cls,proto,*args,**kwargs):
-			return MMGenObject.__new__(proto.base_proto_subclass(TwJSON,'tw','json',cls.__name__))
+			return MMGenObject.__new__(proto.base_proto_subclass(TwJSON,'tw.json',cls.__name__))
 
 		def __init__(self,proto):
 			self.proto = proto

+ 1 - 1
mmgen/tw/rpc.py

@@ -17,7 +17,7 @@ from ..objmethods import MMGenObject
 class TwRPC:
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','rpc'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.rpc'))
 
 	def __init__(self,proto,rpc,wallet):
 		self.proto = proto

+ 1 - 1
mmgen/tw/txhistory.py

@@ -29,7 +29,7 @@ class TwTxHistory(TwView):
 			item_separator = '\n\n'
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','txhistory'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.txhistory'))
 
 	has_wallet = False
 	show_txid = False

+ 1 - 1
mmgen/tw/unspent.py

@@ -46,7 +46,7 @@ class TwUnspentOutputs(TwView):
 			cols = ('num','txid','vout','addr','mmid','amt','amt2','block','date_time','comment')
 
 	def __new__(cls,proto,*args,**kwargs):
-		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw','unspent'))
+		return MMGenObject.__new__(proto.base_proto_subclass(cls,'tw.unspent'))
 
 	show_mmid = True
 	no_rpcdata_errmsg = """