Browse Source

pylint throughout (excluding tests) - use "is" for bool,None,type equality

The MMGen Project 2 years ago
parent
commit
b660ba4235

+ 5 - 5
mmgen/addrfile.py

@@ -110,7 +110,7 @@ class AddrFile(MMGenObject):
 		fs = '  {:<%s}  {:<34}{}' % len(str(p.data[-1].idx))
 		fs = '  {:<%s}  {:<34}{}' % len(str(p.data[-1].idx))
 		for e in p.data:
 		for e in p.data:
 			c = ' ' + e.comment if add_comments and e.comment else ''
 			c = ' ' + e.comment if add_comments and e.comment else ''
-			if type(p) == KeyList:
+			if type(p) is KeyList:
 				out.append(fs.format( e.idx, f'{p.al_id.mmtype.wif_label}: {e.sec.wif}', c ))
 				out.append(fs.format( e.idx, f'{p.al_id.mmtype.wif_label}: {e.sec.wif}', c ))
 			elif type(p).__name__ == 'PasswordList':
 			elif type(p).__name__ == 'PasswordList':
 				out.append(fs.format(e.idx,e.passwd,c))
 				out.append(fs.format(e.idx,e.passwd,c))
@@ -119,7 +119,7 @@ class AddrFile(MMGenObject):
 				if p.has_keys:
 				if p.has_keys:
 					if self.cfg.b16:
 					if self.cfg.b16:
 						out.append(fs.format( '', f'orig_hex: {e.sec.orig_bytes.hex()}', c ))
 						out.append(fs.format( '', f'orig_hex: {e.sec.orig_bytes.hex()}', c ))
-					if type(self) != ViewKeyAddrFile:
+					if type(self) is not ViewKeyAddrFile:
 						out.append(fs.format( '', f'{p.al_id.mmtype.wif_label}: {e.sec.wif}', c ))
 						out.append(fs.format( '', f'{p.al_id.mmtype.wif_label}: {e.sec.wif}', c ))
 					for k in ('viewkey','wallet_passwd'):
 					for k in ('viewkey','wallet_passwd'):
 						v = getattr(e,k)
 						v = getattr(e,k)
@@ -154,7 +154,7 @@ class AddrFile(MMGenObject):
 			a = le(**{ 'proto': p.proto, 'idx':int(idx), p.main_attr:addr, 'comment':comment })
 			a = le(**{ 'proto': p.proto, 'idx':int(idx), p.main_attr:addr, 'comment':comment })
 
 
 			if p.has_keys: # order: wif,(orig_hex),viewkey,wallet_passwd
 			if p.has_keys: # order: wif,(orig_hex),viewkey,wallet_passwd
-				if type(self) != ViewKeyAddrFile:
+				if type(self) is not ViewKeyAddrFile:
 					d = self.get_line(lines)
 					d = self.get_line(lines)
 					assert d[0] == p.al_id.mmtype.wif_label+':', iifs.format(d[0],p.al_id.mmtype.wif_label)
 					assert d[0] == p.al_id.mmtype.wif_label+':', iifs.format(d[0],p.al_id.mmtype.wif_label)
 					a.sec = PrivKey(proto=p.proto,wif=d[1])
 					a.sec = PrivKey(proto=p.proto,wif=d[1])
@@ -168,7 +168,7 @@ class AddrFile(MMGenObject):
 
 
 			ret.append(a)
 			ret.append(a)
 
 
-		if type(self) != ViewKeyAddrFile and p.has_keys and p.ka_validity_chk != False:
+		if type(self) is not ViewKeyAddrFile and p.has_keys and p.ka_validity_chk is not False:
 
 
 			def verify_keys():
 			def verify_keys():
 				from .addrgen import KeyGenerator,AddrGenerator
 				from .addrgen import KeyGenerator,AddrGenerator
@@ -230,7 +230,7 @@ class AddrFile(MMGenObject):
 
 
 			proto = init_proto( p.cfg, coin=coin, network=network )
 			proto = init_proto( p.cfg, coin=coin, network=network )
 
 
-			if mmtype_key == None:
+			if mmtype_key is None:
 				mmtype_key = proto.mmtypes[0]
 				mmtype_key = proto.mmtypes[0]
 
 
 			return ( proto, proto.addr_type(mmtype_key) )
 			return ( proto, proto.addr_type(mmtype_key) )

+ 2 - 2
mmgen/addrgen.py

@@ -66,9 +66,9 @@ def AddrGenerator(cfg,proto,addr_type):
 
 
 	from .addr import MMGenAddrType
 	from .addr import MMGenAddrType
 
 
-	if type(addr_type) == str:
+	if type(addr_type) is str:
 		addr_type = MMGenAddrType(proto=proto,id_str=addr_type)
 		addr_type = MMGenAddrType(proto=proto,id_str=addr_type)
-	elif type(addr_type) == MMGenAddrType:
+	elif type(addr_type) is MMGenAddrType:
 		assert addr_type in proto.mmtypes, f'{addr_type}: invalid address type for coin {proto.coin}'
 		assert addr_type in proto.mmtypes, f'{addr_type}: invalid address type for coin {proto.coin}'
 	else:
 	else:
 		raise TypeError(f'{type(addr_type)}: incorrect argument type for {cls.__name__}()')
 		raise TypeError(f'{type(addr_type)}: incorrect argument type for {cls.__name__}()')

+ 4 - 4
mmgen/addrlist.py

@@ -216,16 +216,16 @@ class AddrList(MMGenObject): # Address info for a single seed ID
 		self.fmt_data = ''
 		self.fmt_data = ''
 		self.chksum = None
 		self.chksum = None
 
 
-		if self.al_id == None:
+		if self.al_id is None:
 			return
 			return
 
 
-		if type(self) == ViewKeyAddrList:
+		if type(self) is ViewKeyAddrList:
 			if not 'viewkey' in self.al_id.mmtype.extra_attrs:
 			if not 'viewkey' in self.al_id.mmtype.extra_attrs:
 				die(1,f'viewkeys not supported for address type {self.al_id.mmtype.desc!r}')
 				die(1,f'viewkeys not supported for address type {self.al_id.mmtype.desc!r}')
 
 
 		self.id_str = AddrListIDStr(self)
 		self.id_str = AddrListIDStr(self)
 
 
-		if type(self) == KeyList:
+		if type(self) is KeyList:
 			return
 			return
 
 
 		if do_chksum and not skip_chksum:
 		if do_chksum and not skip_chksum:
@@ -288,7 +288,7 @@ class AddrList(MMGenObject): # Address info for a single seed ID
 					e.viewkey = ag.to_viewkey(data)
 					e.viewkey = ag.to_viewkey(data)
 				if gen_wallet_passwd:
 				if gen_wallet_passwd:
 					e.wallet_passwd = self.gen_wallet_passwd(
 					e.wallet_passwd = self.gen_wallet_passwd(
-						e.viewkey.encode() if type(self) == ViewKeyAddrList else e.sec )
+						e.viewkey.encode() if type(self) is ViewKeyAddrList else e.sec )
 			elif self.gen_passwds:
 			elif self.gen_passwds:
 				e.passwd = self.gen_passwd(e.sec) # TODO - own type
 				e.passwd = self.gen_passwd(e.sec) # TODO - own type
 
 

+ 3 - 3
mmgen/altcoin.py

@@ -42,7 +42,7 @@ from .cfg import gc,Config
 from .util import msg
 from .util import msg
 
 
 def test_equal(desc,a,b,*cdata):
 def test_equal(desc,a,b,*cdata):
-	if type(a) == int:
+	if type(a) is int:
 		a = hex(a)
 		a = hex(a)
 		b = hex(b)
 		b = hex(b)
 	(network,coin,e,b_desc,verbose) = cdata
 	(network,coin,e,b_desc,verbose) = cdata
@@ -625,7 +625,7 @@ class CoinInfo(object):
 		except:
 		except:
 			pass
 			pass
 		else:
 		else:
-			if bl == True or coin in bl:
+			if bl is True or coin in bl:
 				if verbose:
 				if verbose:
 					msg(f'Tool {tool!r} blacklisted for coin {coin}, addr_type {addr_type!r}')
 					msg(f'Tool {tool!r} blacklisted for coin {coin}, addr_type {addr_type!r}')
 				return None
 				return None
@@ -708,7 +708,7 @@ def init_genonly_altcoins(usr_coin=None,testnet=False):
 	networks = ['mainnet'] + (['testnet'] if testnet else [])
 	networks = ['mainnet'] + (['testnet'] if testnet else [])
 	network = 'testnet' if testnet else 'mainnet'
 	network = 'testnet' if testnet else 'mainnet'
 
 
-	if usr_coin == None:
+	if usr_coin is None:
 		for network in networks:
 		for network in networks:
 			data[network] = CoinInfo.get_supported_coins(network)
 			data[network] = CoinInfo.get_supported_coins(network)
 		trust_level = 0
 		trust_level = 0

+ 1 - 1
mmgen/amt.py

@@ -47,7 +47,7 @@ class CoinAmt(Decimal,Hilite,InitErrors): # abstract class
 		try:
 		try:
 			if from_unit:
 			if from_unit:
 				assert from_unit in cls.units, f'{from_unit!r}: unrecognized denomination for {cls.__name__}'
 				assert from_unit in cls.units, f'{from_unit!r}: unrecognized denomination for {cls.__name__}'
-				assert type(num) == int,'value is not an integer'
+				assert type(num) is int,'value is not an integer'
 				me = Decimal.__new__(cls,num * getattr(cls,from_unit))
 				me = Decimal.__new__(cls,num * getattr(cls,from_unit))
 			elif from_decimal:
 			elif from_decimal:
 				assert isinstance(num,Decimal), f'number must be of type Decimal, not {type(num).__name__})'
 				assert isinstance(num,Decimal), f'number must be of type Decimal, not {type(num).__name__})'

+ 3 - 3
mmgen/baseconv.py

@@ -121,9 +121,9 @@ class baseconv(object):
 		If 'seed', output length will be mapped from input length using data in seedlen_map.
 		If 'seed', output length will be mapped from input length using data in seedlen_map.
 		If an integer, the string, hex string or byte output will be padded to this length.
 		If an integer, the string, hex string or byte output will be padded to this length.
 		"""
 		"""
-		if pad == None:
+		if pad is None:
 			return 0
 			return 0
-		elif type(pad) == int:
+		elif type(pad) is int:
 			return pad
 			return pad
 		elif pad == 'seed':
 		elif pad == 'seed':
 			return seed_pad_func()
 			return seed_pad_func()
@@ -132,7 +132,7 @@ class baseconv(object):
 
 
 	def tohex(self,words_arg,pad=None):
 	def tohex(self,words_arg,pad=None):
 		"convert string or list data of instance base to a hexadecimal string"
 		"convert string or list data of instance base to a hexadecimal string"
-		return self.tobytes(words_arg,pad//2 if type(pad)==int else pad).hex()
+		return self.tobytes(words_arg, pad//2 if type(pad) is int else pad).hex()
 
 
 	def tobytes(self,words_arg,pad=None):
 	def tobytes(self,words_arg,pad=None):
 		"convert string or list data of instance base to byte string"
 		"convert string or list data of instance base to byte string"

+ 1 - 1
mmgen/bip39.py

@@ -110,7 +110,7 @@ class bip39(baseconv):
 
 
 	def fromhex(self,seed_hex,pad=None,tostr=False):
 	def fromhex(self,seed_hex,pad=None,tostr=False):
 		assert is_hex_str(seed_hex),'seed data not a hexadecimal string'
 		assert is_hex_str(seed_hex),'seed data not a hexadecimal string'
-		assert tostr == False,"'tostr' must be False for 'bip39'"
+		assert tostr is False,"'tostr' must be False for 'bip39'"
 		assert pad in (None,'seed'), f"{pad}: invalid 'pad' argument (must be None or 'seed')"
 		assert pad in (None,'seed'), f"{pad}: invalid 'pad' argument (must be None or 'seed')"
 
 
 		wl = self.digits
 		wl = self.digits

+ 2 - 2
mmgen/cfg.py

@@ -675,7 +675,7 @@ class Config(Lockable):
 
 
 	def _die_on_incompatible_opts(self):
 	def _die_on_incompatible_opts(self):
 		for group in self._incompatible_opts:
 		for group in self._incompatible_opts:
-			bad = [k for k in self.__dict__ if k in group and getattr(self,k) != None]
+			bad = [k for k in self.__dict__ if k in group and getattr(self,k) is not None]
 			if len(bad) > 1:
 			if len(bad) > 1:
 				die(1,'Conflicting options: {}'.format(', '.join(map(fmt_opt,bad))))
 				die(1,'Conflicting options: {}'.format(', '.join(map(fmt_opt,bad))))
 
 
@@ -881,7 +881,7 @@ def conv_type(
 			d = f' in {src!r}' if src else '',
 			d = f' in {src!r}' if src else '',
 			e = type(refval).__name__ ))
 			e = type(refval).__name__ ))
 
 
-	if type(refval) == bool:
+	if type(refval) is bool:
 		v = str(val).lower()
 		v = str(val).lower()
 		ret = (
 		ret = (
 			True  if v in ('true','yes','1','on') else
 			True  if v in ('true','yes','1','on') else

+ 1 - 1
mmgen/cfgfile.py

@@ -148,7 +148,7 @@ class cfg_file_sample(cfg_file):
 				if line == '':
 				if line == '':
 					in_chunk = False
 					in_chunk = False
 				elif line.startswith('#'):
 				elif line.startswith('#'):
-					if in_chunk == False:
+					if in_chunk is False:
 						if chunk:
 						if chunk:
 							yield process_chunk(chunk,last_nonblank)
 							yield process_chunk(chunk,last_nonblank)
 						chunk = [line]
 						chunk = [line]

+ 1 - 1
mmgen/crypto.py

@@ -306,7 +306,7 @@ class Crypto:
 			desc,
 			desc,
 			urand = {'data':b'', 'counter':0} ):
 			urand = {'data':b'', 'counter':0} ):
 
 
-		assert type(rand_bytes) == bytes, 'add_user_random_chk1'
+		assert type(rand_bytes) is bytes, 'add_user_random_chk1'
 
 
 		if self.cfg.usr_randchars:
 		if self.cfg.usr_randchars:
 
 

+ 1 - 1
mmgen/fileutil.py

@@ -170,7 +170,7 @@ def write_data_to_file(
 	if cfg.quiet:
 	if cfg.quiet:
 		ask_overwrite = False
 		ask_overwrite = False
 
 
-	if ask_write_default_yes == False or ask_write_prompt:
+	if ask_write_default_yes is False or ask_write_prompt:
 		ask_write = True
 		ask_write = True
 
 
 	def do_stdout():
 	def do_stdout():

+ 2 - 2
mmgen/key.py

@@ -74,7 +74,7 @@ class PrivKey(bytes,Hilite,InitErrors,MMGenObject):
 			return s
 			return s
 		if wif:
 		if wif:
 			try:
 			try:
-				assert s == None,"'wif' and key hex args are mutually exclusive"
+				assert s is None,"'wif' and key hex args are mutually exclusive"
 				assert wif.isascii() and wif.isalnum(), 'not an ASCII alphanumeric string'
 				assert wif.isascii() and wif.isalnum(), 'not an ASCII alphanumeric string'
 				k = proto.decode_wif(wif) # raises exception on error
 				k = proto.decode_wif(wif) # raises exception on error
 				me = bytes.__new__(cls,k.sec)
 				me = bytes.__new__(cls,k.sec)
@@ -100,7 +100,7 @@ class PrivKey(bytes,Hilite,InitErrors,MMGenObject):
 					me = bytes.__new__(cls,s)
 					me = bytes.__new__(cls,s)
 				else:
 				else:
 					assert compressed is not None, "'compressed' arg missing"
 					assert compressed is not None, "'compressed' arg missing"
-					assert type(compressed) == bool,(
+					assert type(compressed) is bool,(
 						f"'compressed' must be of type bool, not {type(compressed).__name__}" )
 						f"'compressed' must be of type bool, not {type(compressed).__name__}" )
 					me = bytes.__new__( cls, proto.preprocess_key(s,pubkey_type) )
 					me = bytes.__new__( cls, proto.preprocess_key(s,pubkey_type) )
 					me.wif = WifKey( proto, proto.encode_wif(me,pubkey_type,compressed) )
 					me.wif = WifKey( proto, proto.encode_wif(me,pubkey_type,compressed) )

+ 7 - 7
mmgen/obj.py

@@ -126,7 +126,7 @@ class ImmutableAttr: # Descriptor
 		else:
 		else:
 			"check this attribute's type"
 			"check this attribute's type"
 			def assign_with_check(instance,value):
 			def assign_with_check(instance,value):
-				if type(value) == dtype:
+				if type(value) is dtype:
 					return value
 					return value
 				raise TypeError('Attribute {!r} of {} instance must of type {}'.format(
 				raise TypeError('Attribute {!r} of {} instance must of type {}'.format(
 					self.name,
 					self.name,
@@ -171,7 +171,7 @@ class ListItemAttr(ImmutableAttr):
 			return None
 			return None
 
 
 	def setattr_condition(self,instance):
 	def setattr_condition(self,instance):
-		return getattr(instance,self.name) == None or self.reassign_ok
+		return getattr(instance,self.name) is None or self.reassign_ok
 
 
 	def __delete__(self,instance):
 	def __delete__(self,instance):
 		if self.delete_ok:
 		if self.delete_ok:
@@ -205,7 +205,7 @@ class MMGenListItem(MMGenObject):
 			raise ValueError(f'Non-keyword args not allowed in {type(self).__name__!r} constructor')
 			raise ValueError(f'Non-keyword args not allowed in {type(self).__name__!r} constructor')
 
 
 		for k,v in kwargs.items():
 		for k,v in kwargs.items():
-			if v != None:
+			if v is not None:
 				setattr(self,k,v)
 				setattr(self,k,v)
 
 
 		# Require all immutables to be initialized.  Check performed only when testing.
 		# Require all immutables to be initialized.  Check performed only when testing.
@@ -274,11 +274,11 @@ class Int(int,Hilite,InitErrors):
 			return n
 			return n
 		try:
 		try:
 			me = int.__new__(cls,str(n),base)
 			me = int.__new__(cls,str(n),base)
-			if cls.min_val != None:
+			if cls.min_val is not None:
 				assert me >= cls.min_val, f'is less than cls.min_val ({cls.min_val})'
 				assert me >= cls.min_val, f'is less than cls.min_val ({cls.min_val})'
-			if cls.max_val != None:
+			if cls.max_val is not None:
 				assert me <= cls.max_val, f'is greater than cls.max_val ({cls.max_val})'
 				assert me <= cls.max_val, f'is greater than cls.max_val ({cls.max_val})'
-			if cls.max_digits != None:
+			if cls.max_digits is not None:
 				assert len(str(me)) <= cls.max_digits, f'has more than {cls.max_digits} digits'
 				assert len(str(me)) <= cls.max_digits, f'has more than {cls.max_digits} digits'
 			return me
 			return me
 		except Exception as e:
 		except Exception as e:
@@ -314,7 +314,7 @@ class HexStr(str,Hilite,InitErrors):
 	def __new__(cls,s,case=None):
 	def __new__(cls,s,case=None):
 		if isinstance(s,cls):
 		if isinstance(s,cls):
 			return s
 			return s
-		if case == None:
+		if case is None:
 			case = cls.hexcase
 			case = cls.hexcase
 		from .util import hexdigits_lc,hexdigits_uc
 		from .util import hexdigits_lc,hexdigits_uc
 		try:
 		try:

+ 1 - 1
mmgen/proto/btc/regtest.py

@@ -229,7 +229,7 @@ class MMGenRegtest(MMGenObject):
 	async def fork(self,coin): # currently disabled
 	async def fork(self,coin): # currently disabled
 
 
 		proto = init_proto( self.cfg, coin, False )
 		proto = init_proto( self.cfg, coin, False )
-		if not [f for f in proto.forks if f[2] == proto.coin.lower() and f[3] == True]:
+		if not [f for f in proto.forks if f[2] == proto.coin.lower() and f[3] is True]:
 			die(1,f'Coin {proto.coin} is not a replayable fork of coin {coin}')
 			die(1,f'Coin {proto.coin} is not a replayable fork of coin {coin}')
 
 
 		gmsg(f'Creating fork from coin {coin} to coin {proto.coin}')
 		gmsg(f'Creating fork from coin {coin} to coin {proto.coin}')

+ 2 - 2
mmgen/proto/btc/rpc.py

@@ -170,7 +170,7 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
 				if block0 != self.proto.block0:
 				if block0 != self.proto.block0:
 					raise ValueError(f'Invalid Genesis block for {self.proto.cls_name} protocol')
 					raise ValueError(f'Invalid Genesis block for {self.proto.cls_name} protocol')
 				for fork in self.proto.forks:
 				for fork in self.proto.forks:
-					if fork.height == None or self.blockcount < fork.height:
+					if fork.height is None or self.blockcount < fork.height:
 						break
 						break
 					if fork.hash != await self.call('getblockhash',fork.height):
 					if fork.hash != await self.call('getblockhash',fork.height):
 						die(3,f'Bad block hash at fork block {fork.height}. Is this the {fork.name} chain?')
 						die(3,f'Bad block hash at fork block {fork.height}. Is this the {fork.name} chain?')
@@ -286,7 +286,7 @@ class BitcoinRPCClient(RPCClient,metaclass=AsyncInit):
 			d = self.cached['blockchaininfo']
 			d = self.cached['blockchaininfo']
 
 
 			try:
 			try:
-				if d['softforks']['segwit']['active'] == True:
+				if d['softforks']['segwit']['active'] is True:
 					return True
 					return True
 			except:
 			except:
 				pass
 				pass

+ 1 - 1
mmgen/proto/btc/tw/ctl.py

@@ -52,7 +52,7 @@ class BitcoinTwCtl(TwCtl):
 	async def rescan_blockchain(self,start,stop):
 	async def rescan_blockchain(self,start,stop):
 
 
 		start = start or 0
 		start = start or 0
-		endless = stop == None
+		endless = stop is None
 		CR = '\n' if self.cfg.test_suite else '\r'
 		CR = '\n' if self.cfg.test_suite else '\r'
 
 
 		if not ( start >= 0 and (stop if stop is not None else start) >= start ):
 		if not ( start >= 0 and (stop if stop is not None else start) >= start ):

+ 1 - 1
mmgen/proto/btc/tw/txhistory.py

@@ -141,7 +141,7 @@ class BitcoinTwTransaction:
 		return self.parent.date_formatter[age_fmt](self.rpc,self.time)
 		return self.parent.date_formatter[age_fmt](self.rpc,self.time)
 
 
 	def txid_disp(self,color,width=None):
 	def txid_disp(self,color,width=None):
-		return self.txid.hl(color=color) if width == None else self.txid.truncate(width=width,color=color)
+		return self.txid.hl(color=color) if width is None else self.txid.truncate(width=width,color=color)
 
 
 	def vouts_list_disp(self,src,color,indent=''):
 	def vouts_list_disp(self,src,color,indent=''):
 
 

+ 1 - 1
mmgen/proto/btc/tx/bump.py

@@ -32,7 +32,7 @@ class Bump(Completed,New,TxBase.Bump):
 
 
 	def convert_and_check_fee(self,fee,desc):
 	def convert_and_check_fee(self,fee,desc):
 		ret = super().convert_and_check_fee(fee,desc)
 		ret = super().convert_and_check_fee(fee,desc)
-		if ret == False:
+		if ret is False:
 			return ret
 			return ret
 		if ret < self.min_fee:
 		if ret < self.min_fee:
 			msg('{} {c}: {} fee too small. Minimum fee: {} {c} ({} {})'.format(
 			msg('{} {c}: {} fee too small. Minimum fee: {} {c} ({} {})'.format(

+ 1 - 1
mmgen/proto/btc/tx/info.py

@@ -124,7 +124,7 @@ class TxInfo(TxInfo):
 		# format (the number of seconds elapsed since 1970-01-01T00:00 UTC). The transaction can be
 		# format (the number of seconds elapsed since 1970-01-01T00:00 UTC). The transaction can be
 		# added to any block whose block time is greater than the locktime.
 		# added to any block whose block time is greater than the locktime.
 		num = locktime or self.tx.locktime
 		num = locktime or self.tx.locktime
-		if num == None:
+		if num is None:
 			return '(None)'
 			return '(None)'
 		elif num >= 5 * 10**6:
 		elif num >= 5 * 10**6:
 			import time
 			import time

+ 2 - 2
mmgen/proto/btc/tx/new.py

@@ -69,10 +69,10 @@ class New(Base,TxBase.New):
 
 
 	def convert_and_check_fee(self,fee,desc):
 	def convert_and_check_fee(self,fee,desc):
 		abs_fee = self.feespec2abs(fee,self.estimate_size())
 		abs_fee = self.feespec2abs(fee,self.estimate_size())
-		if abs_fee == None:
+		if abs_fee is None:
 			raise ValueError(f'{fee}: cannot convert {self.rel_fee_desc} to {self.coin}'
 			raise ValueError(f'{fee}: cannot convert {self.rel_fee_desc} to {self.coin}'
 								+ ' because transaction size is unknown')
 								+ ' because transaction size is unknown')
-		if abs_fee == False:
+		if abs_fee is False:
 			err = f'{fee!r}: invalid TX fee (not a {self.coin} amount or {self.rel_fee_desc} specification)'
 			err = f'{fee!r}: invalid TX fee (not a {self.coin} amount or {self.rel_fee_desc} specification)'
 		elif abs_fee > self.proto.max_tx_fee:
 		elif abs_fee > self.proto.max_tx_fee:
 			err = f'{abs_fee} {self.coin}: {desc} fee too large (maximum fee: {self.proto.max_tx_fee} {self.coin})'
 			err = f'{abs_fee} {self.coin}: {desc} fee too large (maximum fee: {self.proto.max_tx_fee} {self.coin})'

+ 1 - 1
mmgen/proto/btc/tx/online.py

@@ -50,7 +50,7 @@ class OnlineSigned(Signed,TxBase.OnlineSigned):
 				errmsg = str(e)
 				errmsg = str(e)
 				ret = False
 				ret = False
 
 
-		if ret == False: # TODO: test send errors
+		if ret is False: # TODO: test send errors
 			if errmsg.count('Signature must use SIGHASH_FORKID'):
 			if errmsg.count('Signature must use SIGHASH_FORKID'):
 				m = ('The Aug. 1 2017 UAHF has activated on this chain.\n'
 				m = ('The Aug. 1 2017 UAHF has activated on this chain.\n'
 					+ 'Re-run the script with the --coin=bch option.' )
 					+ 'Re-run the script with the --coin=bch option.' )

+ 1 - 1
mmgen/proto/eth/contract.py

@@ -131,7 +131,7 @@ class TokenCommon(MMGenObject):
 
 
 		if chain_id is None:
 		if chain_id is None:
 			res = await self.rpc.call('eth_chainId')
 			res = await self.rpc.call('eth_chainId')
-			chain_id = None if res == None else int(res,16)
+			chain_id = None if res is None else int(res,16)
 
 
 		tx = Transaction(**tx_in).sign(key,chain_id)
 		tx = Transaction(**tx_in).sign(key,chain_id)
 
 

+ 1 - 1
mmgen/proto/eth/rpc.py

@@ -78,7 +78,7 @@ class EthereumRPCClient(RPCClient,metaclass=AsyncInit):
 		if self.daemon.id in ('parity','openethereum'):
 		if self.daemon.id in ('parity','openethereum'):
 			if (await self.call('parity_nodeKind'))['capability'] == 'full':
 			if (await self.call('parity_nodeKind'))['capability'] == 'full':
 				self.caps += ('full_node',)
 				self.caps += ('full_node',)
-			self.chainID = None if ci == None else Int(ci,16) # parity/oe return chainID only for dev chain
+			self.chainID = None if ci is None else Int(ci,16) # parity/oe return chainID only for dev chain
 			self.chain = (await self.call('parity_chain')).replace(' ','_').replace('_testnet','')
 			self.chain = (await self.call('parity_chain')).replace(' ','_').replace('_testnet','')
 		elif self.daemon.id in ('geth','erigon'):
 		elif self.daemon.id in ('geth','erigon'):
 			if self.daemon.network == 'mainnet':
 			if self.daemon.network == 'mainnet':

+ 2 - 2
mmgen/proto/eth/tw/ctl.py

@@ -183,7 +183,7 @@ class EthereumTokenTwCtl(EthereumTwCtl):
 			if not is_coin_addr(proto,token_addr):
 			if not is_coin_addr(proto,token_addr):
 				die( 'InvalidTokenAddress', f'{token_addr!r}: invalid token address' )
 				die( 'InvalidTokenAddress', f'{token_addr!r}: invalid token address' )
 		else:
 		else:
-			assert token_addr == None,'EthereumTokenTwCtl_chk1'
+			assert token_addr is None,'EthereumTokenTwCtl_chk1'
 			token_addr = await self.sym2addr(proto.tokensym) # returns None on failure
 			token_addr = await self.sym2addr(proto.tokensym) # returns None on failure
 			if not is_coin_addr(proto,token_addr):
 			if not is_coin_addr(proto,token_addr):
 				die( 'UnrecognizedTokenSymbol', f'Specified token {proto.tokensym!r} could not be resolved!' )
 				die( 'UnrecognizedTokenSymbol', f'Specified token {proto.tokensym!r} could not be resolved!' )
@@ -217,7 +217,7 @@ class EthereumTokenTwCtl(EthereumTwCtl):
 		cache = self.cur_eth_balances
 		cache = self.cur_eth_balances
 		r = self.data['accounts']
 		r = self.data['accounts']
 		ret = None if force_rpc else self.get_cached_balance(addr,cache,r)
 		ret = None if force_rpc else self.get_cached_balance(addr,cache,r)
-		if ret == None:
+		if ret is None:
 			ret = await super().rpc_get_balance(addr)
 			ret = await super().rpc_get_balance(addr)
 			self.cache_balance(addr,ret,cache,r)
 			self.cache_balance(addr,ret,cache,r)
 		return ret
 		return ret

+ 1 - 1
mmgen/proto/eth/tx/new.py

@@ -127,7 +127,7 @@ class New(Base,TxBase.New):
 
 
 	def convert_and_check_fee(self,fee,desc):
 	def convert_and_check_fee(self,fee,desc):
 		abs_fee = self.feespec2abs(fee,None)
 		abs_fee = self.feespec2abs(fee,None)
-		if abs_fee == False:
+		if abs_fee is False:
 			return False
 			return False
 		elif not self.disable_fee_check and (abs_fee > self.proto.max_tx_fee):
 		elif not self.disable_fee_check and (abs_fee > self.proto.max_tx_fee):
 			msg('{} {c}: {} fee too large (maximum fee: {} {c})'.format(
 			msg('{} {c}: {} fee too large (maximum fee: {} {c})'.format(

+ 5 - 5
mmgen/protocol.py

@@ -220,7 +220,7 @@ class CoinProtocol(MMGenObject):
 		"""
 		"""
 		def encode_wif(self,privbytes,pubkey_type,compressed):
 		def encode_wif(self,privbytes,pubkey_type,compressed):
 			assert pubkey_type == self.pubkey_type, f'{pubkey_type}: invalid pubkey_type for {self.name} protocol!'
 			assert pubkey_type == self.pubkey_type, f'{pubkey_type}: invalid pubkey_type for {self.name} protocol!'
-			assert compressed == False, f'{self.name} protocol does not support compressed pubkeys!'
+			assert compressed is False, f'{self.name} protocol does not support compressed pubkeys!'
 			return privbytes.hex()
 			return privbytes.hex()
 
 
 		def decode_wif(self,wif):
 		def decode_wif(self,wif):
@@ -239,8 +239,8 @@ def init_proto(
 		tokensym   = None,
 		tokensym   = None,
 		need_amt   = False ):
 		need_amt   = False ):
 
 
-	assert type(testnet) == bool, 'init_proto_chk1'
-	assert type(regtest) == bool, 'init_proto_chk2'
+	assert type(testnet) is bool, 'init_proto_chk1'
+	assert type(regtest) is bool, 'init_proto_chk2'
 	assert coin or network_id, 'init_proto_chk3'
 	assert coin or network_id, 'init_proto_chk3'
 	assert not (coin and network_id), 'init_proto_chk4'
 	assert not (coin and network_id), 'init_proto_chk4'
 
 
@@ -248,8 +248,8 @@ def init_proto(
 		coin,network = CoinProtocol.Base.parse_network_id(network_id)
 		coin,network = CoinProtocol.Base.parse_network_id(network_id)
 	elif network:
 	elif network:
 		assert network in CoinProtocol.Base.networks, f'init_proto_chk5 - {network!r}: invalid network'
 		assert network in CoinProtocol.Base.networks, f'init_proto_chk5 - {network!r}: invalid network'
-		assert testnet == False, 'init_proto_chk6'
-		assert regtest == False, 'init_proto_chk7'
+		assert testnet is False, 'init_proto_chk6'
+		assert regtest is False, 'init_proto_chk7'
 	else:
 	else:
 		network = 'regtest' if regtest else 'testnet' if testnet else 'mainnet'
 		network = 'regtest' if regtest else 'testnet' if testnet else 'mainnet'
 
 

+ 3 - 3
mmgen/rpc.py

@@ -34,7 +34,7 @@ auth_data = namedtuple('rpc_auth_data',['user','passwd'])
 
 
 def dmsg_rpc(fs,data=None,is_json=False):
 def dmsg_rpc(fs,data=None,is_json=False):
 	msg(
 	msg(
-		fs if data == None else
+		fs if data is None else
 		fs.format(pp_fmt(json.loads(data) if is_json else data))
 		fs.format(pp_fmt(json.loads(data) if is_json else data))
 	)
 	)
 
 
@@ -222,7 +222,7 @@ class RPCBackends:
 						yield s
 						yield s
 				if caller.auth_type == 'digest':
 				if caller.auth_type == 'digest':
 					yield '--digest'
 					yield '--digest'
-				if caller.network_proto == 'https' and caller.verify_server == False:
+				if caller.network_proto == 'https' and caller.verify_server is False:
 					yield '--insecure'
 					yield '--insecure'
 
 
 			super().__init__(caller)
 			super().__init__(caller)
@@ -338,7 +338,7 @@ class RPCClient(MMGenObject):
 		  1) method = methodname, args_list = [args_tuple1, args_tuple2,...]
 		  1) method = methodname, args_list = [args_tuple1, args_tuple2,...]
 		  2) method = None, args_list = [(methodname1,args_tuple1), (methodname2,args_tuple2), ...]
 		  2) method = None, args_list = [(methodname1,args_tuple1), (methodname2,args_tuple2), ...]
 		"""
 		"""
-		cmd_list = args_list if method == None else tuple(zip([method] * len(args_list), args_list))
+		cmd_list = args_list if method is None else tuple(zip([method] * len(args_list), args_list))
 
 
 		cur_pos = 0
 		cur_pos = 0
 		chunk_size = 1024
 		chunk_size = 1024

+ 1 - 1
mmgen/seedsplit.py

@@ -199,7 +199,7 @@ class SeedShare(SeedShareBase,SubSeed):
 	@staticmethod
 	@staticmethod
 	def make_subseed_bin(parent_list,idx:int,nonce:int,length:str):
 	def make_subseed_bin(parent_list,idx:int,nonce:int,length:str):
 		seed = parent_list.parent_seed
 		seed = parent_list.parent_seed
-		assert parent_list.have_short == False
+		assert parent_list.have_short is False
 		assert length == 'long'
 		assert length == 'long'
 		# field maximums: id_str: none (256 chars), count: 65535 (1024), idx: 65535 (1024), nonce: 65535 (1000)
 		# field maximums: id_str: none (256 chars), count: 65535 (1024), idx: 65535 (1024), nonce: 65535 (1000)
 		scramble_key = (
 		scramble_key = (

+ 1 - 1
mmgen/sha2.py

@@ -74,7 +74,7 @@ class Sha2(object):
 	def __init__(self,message,preprocess=True):
 	def __init__(self,message,preprocess=True):
 		'Use preprocess=False for Sha256Compress'
 		'Use preprocess=False for Sha256Compress'
 		assert isinstance(message,(bytes,bytearray,list)),'message must be of type bytes, bytearray or list'
 		assert isinstance(message,(bytes,bytearray,list)),'message must be of type bytes, bytearray or list'
-		if self.K == None:
+		if self.K is None:
 			type(self).initConstants()
 			type(self).initConstants()
 		self.H = list(self.H_init)
 		self.H = list(self.H_init)
 		self.M = message
 		self.M = message

+ 3 - 3
mmgen/subseed.py

@@ -139,7 +139,7 @@ class SubSeedList(MMGenObject):
 					subseed.ss_idx.hl(),
 					subseed.ss_idx.hl(),
 				))
 				))
 
 
-		if last_idx == None:
+		if last_idx is None:
 			last_idx = self.len
 			last_idx = self.len
 
 
 		subseed = get_existing_subseed_by_seed_id(sid)
 		subseed = get_existing_subseed_by_seed_id(sid)
@@ -174,7 +174,7 @@ class SubSeedList(MMGenObject):
 
 
 	def _generate(self,last_idx=None,last_sid=None):
 	def _generate(self,last_idx=None,last_sid=None):
 
 
-		if last_idx == None:
+		if last_idx is None:
 			last_idx = self.len
 			last_idx = self.len
 
 
 		first_idx = len(self) + 1
 		first_idx = len(self) + 1
@@ -182,7 +182,7 @@ class SubSeedList(MMGenObject):
 		if first_idx > last_idx:
 		if first_idx > last_idx:
 			return None
 			return None
 
 
-		if last_sid != None:
+		if last_sid is not None:
 			last_sid = SeedID(sid=last_sid)
 			last_sid = SeedID(sid=last_sid)
 
 
 		def add_subseed(idx,length):
 		def add_subseed(idx,length):

+ 2 - 2
mmgen/tw/addresses.py

@@ -266,7 +266,7 @@ class TwAddresses(TwView):
 				yield (sid_save, sid_range(bot, n-1))
 				yield (sid_save, sid_range(bot, n-1))
 
 
 		assert self.sort_key == 'twmmid'
 		assert self.sort_key == 'twmmid'
-		assert self.reverse == False
+		assert self.reverse is False
 
 
 		if not hasattr(self,'_sid_ranges'):
 		if not hasattr(self,'_sid_ranges'):
 			self._sid_ranges = dict(gen_sid_ranges())
 			self._sid_ranges = dict(gen_sid_ranges())
@@ -311,7 +311,7 @@ class TwAddresses(TwView):
 				n = (top + bot) >> 1
 				n = (top + bot) >> 1
 
 
 		assert self.sort_key == 'twmmid'
 		assert self.sort_key == 'twmmid'
-		assert self.reverse == False
+		assert self.reverse is False
 
 
 		data = self.data
 		data = self.data
 		start = get_start(
 		start = get_start(

+ 3 - 3
mmgen/tw/ctl.py

@@ -175,7 +175,7 @@ class TwCtl(MMGenObject,metaclass=AsyncInit):
 
 
 	async def get_balance(self,addr,force_rpc=False):
 	async def get_balance(self,addr,force_rpc=False):
 		ret = None if force_rpc else self.get_cached_balance(addr,self.cur_balances,self.data_root)
 		ret = None if force_rpc else self.get_cached_balance(addr,self.cur_balances,self.data_root)
-		if ret == None:
+		if ret is None:
 			ret = await self.rpc_get_balance(addr)
 			ret = await self.rpc_get_balance(addr)
 			self.cache_balance(addr,ret,self.cur_balances,self.data_root)
 			self.cache_balance(addr,ret,self.cur_balances,self.data_root)
 		return ret
 		return ret
@@ -264,7 +264,7 @@ class TwCtl(MMGenObject,metaclass=AsyncInit):
 
 
 		comment = get_obj(TwComment,s=comment)
 		comment = get_obj(TwComment,s=comment)
 
 
-		if comment == False:
+		if comment is False:
 			return False
 			return False
 
 
 		lbl = get_obj(
 		lbl = get_obj(
@@ -272,7 +272,7 @@ class TwCtl(MMGenObject,metaclass=AsyncInit):
 			proto = self.proto,
 			proto = self.proto,
 			text = res.twmmid + (' ' + comment if comment else ''))
 			text = res.twmmid + (' ' + comment if comment else ''))
 
 
-		if lbl == False:
+		if lbl is False:
 			return False
 			return False
 
 
 		if await self.set_label(res.coinaddr,lbl):
 		if await self.set_label(res.coinaddr,lbl):

+ 1 - 1
mmgen/tw/view.py

@@ -690,7 +690,7 @@ class TwView(MMGenObject,metaclass=AsyncInit):
 						break
 						break
 					await asyncio.sleep(0.5)
 					await asyncio.sleep(0.5)
 
 
-			if parent.scroll and ret == False:
+			if parent.scroll and ret is False:
 				# error messages could leave screen in messy state, so do complete redraw:
 				# error messages could leave screen in messy state, so do complete redraw:
 				msg_r(
 				msg_r(
 					CUR_HOME + ERASE_ALL +
 					CUR_HOME + ERASE_ALL +

+ 1 - 1
mmgen/tx/base.py

@@ -134,7 +134,7 @@ class Base(MMGenObject):
 		return sum(e.amt for e in self.inputs)
 		return sum(e.amt for e in self.inputs)
 
 
 	def sum_outputs(self,exclude=None):
 	def sum_outputs(self,exclude=None):
-		if exclude == None:
+		if exclude is None:
 			olist = self.outputs
 			olist = self.outputs
 		else:
 		else:
 			olist = self.outputs[:exclude] + self.outputs[exclude+1:]
 			olist = self.outputs[:exclude] + self.outputs[exclude+1:]

+ 3 - 3
mmgen/tx/bump.py

@@ -59,15 +59,15 @@ class Bump(Completed,New):
 		chg_idx = self.chg_idx
 		chg_idx = self.chg_idx
 
 
 		while True:
 		while True:
-			if init_reply == None:
+			if init_reply is None:
 				from ..ui import line_input
 				from ..ui import line_input
 				m = 'Choose an output to deduct the fee from (Hit ENTER for the change output): '
 				m = 'Choose an output to deduct the fee from (Hit ENTER for the change output): '
 				reply = line_input( self.cfg, m ) or 'c'
 				reply = line_input( self.cfg, m ) or 'c'
 			else:
 			else:
 				reply,init_reply = init_reply,None
 				reply,init_reply = init_reply,None
-			if chg_idx == None and not is_int(reply):
+			if chg_idx is None and not is_int(reply):
 				msg('Output must be an integer')
 				msg('Output must be an integer')
-			elif chg_idx != None and not is_int(reply) and reply != 'c':
+			elif chg_idx is not None and not is_int(reply) and reply != 'c':
 				msg("Output must be an integer, or 'c' for the change output")
 				msg("Output must be an integer, or 'c' for the change output")
 			else:
 			else:
 				idx = chg_idx if reply == 'c' else (int(reply) - 1)
 				idx = chg_idx if reply == 'c' else (int(reply) - 1)

+ 2 - 2
mmgen/tx/file.py

@@ -83,7 +83,7 @@ class MMGenTxFile(MMGenObject):
 					desc = 'encoded comment (not base58)'
 					desc = 'encoded comment (not base58)'
 					from ..baseconv import baseconv
 					from ..baseconv import baseconv
 					comment = baseconv('b58').tobytes(c).decode()
 					comment = baseconv('b58').tobytes(c).decode()
-					assert comment != False,'invalid comment'
+					assert comment is not False,'invalid comment'
 					desc = 'comment'
 					desc = 'comment'
 					tx.comment = MMGenTxComment(comment)
 					tx.comment = MMGenTxComment(comment)
 
 
@@ -197,7 +197,7 @@ class MMGenTxFile(MMGenObject):
 		ask_tty               = True,
 		ask_tty               = True,
 		ask_overwrite         = True ):
 		ask_overwrite         = True ):
 
 
-		if ask_write == False:
+		if ask_write is False:
 			ask_write_default_yes = True
 			ask_write_default_yes = True
 
 
 		if not self.filename:
 		if not self.filename:

+ 1 - 1
mmgen/tx/sign.py

@@ -38,7 +38,7 @@ def get_seed_for_seed_id(sid,infiles,saved_seeds):
 	while True:
 	while True:
 		if infiles:
 		if infiles:
 			seed = Wallet(cfg,infiles.pop(0),ignore_in_fmt=True).seed
 			seed = Wallet(cfg,infiles.pop(0),ignore_in_fmt=True).seed
-		elif subseeds_checked == False:
+		elif subseeds_checked is False:
 			seed = saved_seeds[list(saved_seeds)[0]].subseed_by_seed_id(sid,print_msg=True)
 			seed = saved_seeds[list(saved_seeds)[0]].subseed_by_seed_id(sid,print_msg=True)
 			subseeds_checked = True
 			subseeds_checked = True
 			if not seed:
 			if not seed:

+ 2 - 2
mmgen/util.py

@@ -324,11 +324,11 @@ def decode_timestamp(s):
 
 
 def make_timestamp(secs=None):
 def make_timestamp(secs=None):
 	return '{:04d}{:02d}{:02d}_{:02d}{:02d}{:02d}'.format(*time.gmtime(
 	return '{:04d}{:02d}{:02d}_{:02d}{:02d}{:02d}'.format(*time.gmtime(
-		int(secs) if secs != None else time.time() )[:6])
+		int(secs) if secs is not None else time.time() )[:6])
 
 
 def make_timestr(secs=None):
 def make_timestr(secs=None):
 	return '{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}'.format(*time.gmtime(
 	return '{}-{:02d}-{:02d} {:02d}:{:02d}:{:02d}'.format(*time.gmtime(
-		int(secs) if secs != None else time.time() )[:6])
+		int(secs) if secs is not None else time.time() )[:6])
 
 
 def secs_to_dhms(secs):
 def secs_to_dhms(secs):
 	hrs = secs // 3600
 	hrs = secs // 3600

+ 1 - 1
mmgen/util2.py

@@ -137,7 +137,7 @@ def block_format(data,gw=2,cols=8,line_nums=None,data_is_hex=False):
 		gw *= 2
 		gw *= 2
 	nchunks = len(data)//gw + bool(len(data)%gw)
 	nchunks = len(data)//gw + bool(len(data)%gw)
 	return ''.join(
 	return ''.join(
-		('' if (line_nums == None or i % cols) else ln_fs.format(i*bytes_per_chunk))
+		('' if (line_nums is None or i % cols) else ln_fs.format(i*bytes_per_chunk))
 		+ data[i*gw:i*gw+gw]
 		+ data[i*gw:i*gw+gw]
 		+ (' ' if (not cols or (i+1) % cols) else '\n')
 		+ (' ' if (not cols or (i+1) % cols) else '\n')
 			for i in range(nchunks)
 			for i in range(nchunks)

+ 1 - 1
mmgen/wallet/mmgen.py

@@ -155,7 +155,7 @@ class wallet(wallet):
 				return False
 				return False
 
 
 			val = baseconv('b58').tobytes(b58_val,pad='seed')
 			val = baseconv('b58').tobytes(b58_val,pad='seed')
-			if val == False:
+			if val is False:
 				msg(f'Invalid base 58 number: {b58_val}')
 				msg(f'Invalid base 58 number: {b58_val}')
 				return False
 				return False
 
 

+ 1 - 1
mmgen/wallet/seed.py

@@ -55,7 +55,7 @@ class wallet(wallet):
 
 
 		ret = baseconv('b58').tobytes(b,pad='seed')
 		ret = baseconv('b58').tobytes(b,pad='seed')
 
 
-		if ret == False:
+		if ret is False:
 			msg(f'Invalid base-58 encoded seed: {val}')
 			msg(f'Invalid base-58 encoded seed: {val}')
 			return False
 			return False
 
 

+ 2 - 2
mmgen/xmrseed.py

@@ -48,7 +48,7 @@ class xmrseed(baseconv):
 
 
 	def tobytes(self,words,pad=None):
 	def tobytes(self,words,pad=None):
 		assert isinstance(words,(list,tuple)),'words must be list or tuple'
 		assert isinstance(words,(list,tuple)),'words must be list or tuple'
-		assert pad == None, f"{pad}: invalid 'pad' argument (must be None)"
+		assert pad is None, f"{pad}: invalid 'pad' argument (must be None)"
 
 
 		desc = self.desc.short
 		desc = self.desc.short
 		wl = self.digits
 		wl = self.digits
@@ -75,7 +75,7 @@ class xmrseed(baseconv):
 		return b''.join(gen())
 		return b''.join(gen())
 
 
 	def frombytes(self,bytestr,pad=None,tostr=False):
 	def frombytes(self,bytestr,pad=None,tostr=False):
-		assert pad == None, f"{pad}: invalid 'pad' argument (must be None)"
+		assert pad is None, f"{pad}: invalid 'pad' argument (must be None)"
 
 
 		desc = self.desc.short
 		desc = self.desc.short
 		wl = self.digits
 		wl = self.digits

+ 6 - 6
mmgen/xmrwallet.py

@@ -1396,7 +1396,7 @@ class MoneroWalletOps:
 
 
 			def gen():
 			def gen():
 				for i,k in self.spec_key:
 				for i,k in self.spec_key:
-					if m[i] == None:
+					if m[i] is None:
 						setattr(self,k,None)
 						setattr(self,k,None)
 					else:
 					else:
 						idx = int(m[i])
 						idx = int(m[i])
@@ -1463,7 +1463,7 @@ class MoneroWalletOps:
 
 
 			gmsg(f'\n{self.stem.capitalize()}ing account #{self.account} of wallet {self.source.idx}' + (
 			gmsg(f'\n{self.stem.capitalize()}ing account #{self.account} of wallet {self.source.idx}' + (
 				f': {self.amount} XMR to {self.dest_addr}' if self.name == 'transfer'
 				f': {self.amount} XMR to {self.dest_addr}' if self.name == 'transfer'
-				else ' to new address' if self.dest == None
+				else ' to new address' if self.dest is None
 				else f' to new account in wallet {self.dest.idx}' ))
 				else f' to new account in wallet {self.dest.idx}' ))
 
 
 			h = self.rpc(self,self.source)
 			h = self.rpc(self,self.source)
@@ -1479,7 +1479,7 @@ class MoneroWalletOps:
 
 
 			if self.name == 'transfer':
 			if self.name == 'transfer':
 				dest_addr = self.dest_addr
 				dest_addr = self.dest_addr
-			elif self.dest == None:
+			elif self.dest is None:
 				dest_acct = self.account
 				dest_acct = self.account
 				if keypress_confirm( self.cfg, f'\nCreate new address for account #{self.account}?' ):
 				if keypress_confirm( self.cfg, f'\nCreate new address for account #{self.account}?' ):
 					dest_addr_chk = h.create_new_addr(self.account)
 					dest_addr_chk = h.create_new_addr(self.account)
@@ -1556,9 +1556,9 @@ class MoneroWalletOps:
 			h = self.rpc(self,self.source)
 			h = self.rpc(self,self.source)
 			h.open_wallet('Monero')
 			h.open_wallet('Monero')
 			label = '{a} [{b}]'.format(
 			label = '{a} [{b}]'.format(
-				a = self.label or f"xmrwallet new {'account' if self.account == None else 'address'}",
+				a = self.label or f"xmrwallet new {'account' if self.account is None else 'address'}",
 				b = make_timestr() )
 				b = make_timestr() )
-			if self.account == None:
+			if self.account is None:
 				acct,addr = h.create_acct(label=label)
 				acct,addr = h.create_acct(label=label)
 			else:
 			else:
 				msg_r(f'\n    Account index: {pink(str(self.account))}')
 				msg_r(f'\n    Account index: {pink(str(self.account))}')
@@ -1566,7 +1566,7 @@ class MoneroWalletOps:
 
 
 			accts_data = h.get_accts()[0]
 			accts_data = h.get_accts()[0]
 
 
-			if self.account != None:
+			if self.account is not None:
 				h.print_addrs(accts_data,self.account)
 				h.print_addrs(accts_data,self.account)
 
 
 			# wallet must be left open: otherwise the 'stop_wallet' RPC call used to stop the daemon will fail
 			# wallet must be left open: otherwise the 'stop_wallet' RPC call used to stop the daemon will fail