pylint: various

This commit is contained in:
The MMGen Project 2024-09-20 09:36:06 +00:00
commit 790a22d271
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
5 changed files with 11 additions and 11 deletions

View file

@ -35,7 +35,7 @@ def decrypt_keystore(data,passwd,mac_algo=None,mac_params={}):
# Derive encryption key from password:
if kdf == 'scrypt':
if not mac_algo:
die(1,f'the ‘mac_algo’ parameter is required for scrypt kdf')
die(1, 'the ‘mac_algo’ parameter is required for scrypt kdf')
from hashlib import scrypt
hashed_pw = scrypt(
password = passwd,

View file

@ -28,8 +28,8 @@ class Completed(Base,TxBase.Completed):
if not (has_ss or has_witness):
return False
fs = "Hex TX has {} scriptSig but input is of type '{}'!"
for n in range(len(txins)):
ti,mmti = txins[n],self.inputs[n]
for n, ti in enumerate(txins):
mmti = self.inputs[n]
if ti['scriptSig'] == '' or ( len(ti['scriptSig']) == 46 and # native P2WPKH or P2SH-P2WPKH
ti['scriptSig'][:6] == '16' + self.proto.witness_vernum_hex + '14' ):
assert 'witness' in ti, 'missing witness'

View file

@ -74,11 +74,11 @@ class IPPort(HiliteStr,InitErrors):
return cls.init_fail(e,s)
class json_encoder(json.JSONEncoder):
def default(self,obj):
if isinstance(obj,Decimal):
return str(obj)
def default(self, o):
if isinstance(o, Decimal):
return str(o)
else:
return json.JSONEncoder.default(self,obj)
return json.JSONEncoder.default(self, o)
class RPCBackends:

View file

@ -49,8 +49,8 @@ class Completed(Base):
from .file import MMGenTxFile
return MMGenTxFile(self)
@classmethod
def ext_to_cls(cls,ext,proto):
@staticmethod
def ext_to_cls(ext, proto):
"""
see twctl:import_token()
"""

View file

@ -102,8 +102,8 @@ class wallet(MMGenObject,metaclass=WalletMeta):
break
msg('Trying again...')
@classmethod
def ext_to_cls(cls,ext,proto):
@staticmethod
def ext_to_cls(ext, proto):
return get_wallet_cls(ext=ext)
def get_fmt_data(self):