remove assert statements that affect branching

- assert statements are still used throughout the MMGen code base for essential
  checks, so use of PYTHONOPTIMIZE will lead to failures.
This commit is contained in:
The MMGen Project 2022-01-18 09:11:00 +00:00
commit e7d531db07
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 15 additions and 20 deletions

View file

@ -625,15 +625,14 @@ class CoinInfo(object):
return None
try:
assert (
cls.external_tests_blacklist[addr_type][tool] == True
or coin in cls.external_tests_blacklist[addr_type][tool] )
bl = cls.external_tests_blacklist[addr_type][tool]
except:
pass
else:
if verbose:
msg(f'Tool {tool!r} blacklisted for coin {coin}, addr_type {addr_type!r}')
return None
if bl == True or coin in bl:
if verbose:
msg(f'Tool {tool!r} blacklisted for coin {coin}, addr_type {addr_type!r}')
return None
if toolname: # skip whitelists
return tool

View file

@ -229,21 +229,17 @@ if invoked_as == 'passchg' and ss_in.infile.dirname == g.data_dir:
shred_file(
ss_in.infile.name,
verbose = opt.verbose )
elif (
invoked_as == 'gen'
and not opt.outdir
and not opt.stdout
and not find_file_in_dir( MMGenWallet, g.data_dir )
and keypress_confirm(
'Make this wallet your default and move it to the data directory?',
default_yes = True ) ):
ss_out.write_to_file(outdir=g.data_dir)
else:
try:
assert invoked_as == 'gen', 'dw'
assert not opt.outdir, 'dw'
assert not opt.stdout, 'dw'
assert not find_file_in_dir( MMGenWallet, g.data_dir ), 'dw'
assert keypress_confirm(
'Make this wallet your default and move it to the data directory?',
default_yes = True ), 'dw'
except Exception as e:
if str(e) != 'dw':
raise
ss_out.write_to_file()
else:
ss_out.write_to_file(outdir=g.data_dir)
ss_out.write_to_file()
if invoked_as == 'passchg':
if ss_out.ssdata.passwd == ss_in.ssdata.passwd: