type(self).__name__ -> self.name
This commit is contained in:
parent
3b7a238259
commit
b01e825fc4
6 changed files with 10 additions and 8 deletions
|
|
@ -41,7 +41,7 @@ class New(Base,TxBase.New):
|
|||
|
||||
if self.cfg.contract_data:
|
||||
m = "'--contract-data' option may not be used with token transaction"
|
||||
assert not 'Token' in type(self).__name__, m
|
||||
assert not 'Token' in self.name, m
|
||||
with open(self.cfg.contract_data) as fp:
|
||||
self.usr_contract_data = HexStr(fp.read().strip())
|
||||
self.disable_fee_check = True
|
||||
|
|
@ -81,7 +81,7 @@ class New(Base,TxBase.New):
|
|||
|
||||
async def process_cmd_args(self,cmd_args,ad_f,ad_w):
|
||||
lc = len(cmd_args)
|
||||
if lc == 0 and self.usr_contract_data and not 'Token' in type(self).__name__:
|
||||
if lc == 0 and self.usr_contract_data and not 'Token' in self.name:
|
||||
return
|
||||
if lc != 1:
|
||||
die(1,f'{lc} output{suf(lc)} specified, but Ethereum transactions must have exactly one')
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ class MoneroRPCClient(RPCClient):
|
|||
self.daemon_version = None
|
||||
|
||||
def call(self,method,*params,**kwargs):
|
||||
assert params == (), f'{type(self).__name__}.call() accepts keyword arguments only'
|
||||
assert params == (), f'{self.name}.call() accepts keyword arguments only'
|
||||
return self.process_http_resp(self.backend.run_noasync(
|
||||
payload = {'id': 0, 'jsonrpc': '2.0', 'method': method, 'params': kwargs },
|
||||
timeout = 3600, # allow enough time to sync ≈1,000,000 blocks
|
||||
|
|
@ -83,7 +83,7 @@ class MoneroRPCClient(RPCClient):
|
|||
))
|
||||
|
||||
def call_raw(self,method,*params,**kwargs):
|
||||
assert params == (), f'{type(self).__name__}.call() accepts keyword arguments only'
|
||||
assert params == (), f'{self.name}.call() accepts keyword arguments only'
|
||||
return self.process_http_resp(self.backend.run_noasync(
|
||||
payload = kwargs,
|
||||
timeout = self.timeout,
|
||||
|
|
|
|||
|
|
@ -266,6 +266,7 @@ class RPCClient(MMGenObject):
|
|||
def __init__(self,cfg,host,port,test_connection=True):
|
||||
|
||||
self.cfg = cfg
|
||||
self.name = type(self).__name__
|
||||
|
||||
# aiohttp workaround, and may speed up RPC performance overall on some systems:
|
||||
if gc.platform == 'win' and host == 'localhost':
|
||||
|
|
@ -275,8 +276,8 @@ class RPCClient(MMGenObject):
|
|||
if not self.cfg.debug_rpc:
|
||||
dmsg_rpc = dmsg_rpc_backend = noop
|
||||
|
||||
dmsg_rpc(f'=== {type(self).__name__}.__init__() debug ===')
|
||||
dmsg_rpc(f' cls [{type(self).__name__}] host [{host}] port [{port}]\n')
|
||||
dmsg_rpc(f'=== {self.name}.__init__() debug ===')
|
||||
dmsg_rpc(f' cls [{self.name}] host [{host}] port [{port}]\n')
|
||||
|
||||
if test_connection:
|
||||
import socket
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ class MoneroWalletOutputsFile:
|
|||
|
||||
def get_wallet_fn(self,fn):
|
||||
assert fn.name.endswith(f'.{self.ext}'), (
|
||||
f'{type(self).__name__}: filename does not end with {"."+self.ext!r}'
|
||||
f'{self.name}: filename does not end with {"."+self.ext!r}'
|
||||
)
|
||||
return fn.parent / fn.name[:-(len(self.ext)+self.ext_offset+1)]
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class TestSuiteAutosignBase(TestSuiteBase):
|
|||
return
|
||||
|
||||
if gc.platform == 'win':
|
||||
die(1,f'Test {type(self).__name__} not supported for Windows platform')
|
||||
die(1,f'Test {self.name} not supported for Windows platform')
|
||||
|
||||
self.network_ids = [c+'_tn' for c in self.daemon_coins] + self.daemon_coins
|
||||
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ class TestSuiteBase:
|
|||
def __init__(self,trunner,cfgs,spawn):
|
||||
if hasattr(self,'tr'): # init will be called multiple times for classes with multiple inheritance
|
||||
return
|
||||
self.name = type(self).__name__
|
||||
self.proto = cfg._proto
|
||||
self.tr = trunner
|
||||
self.cfgs = cfgs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue