minor fixes, cleanups

This commit is contained in:
The MMGen Project 2022-01-22 14:26:13 +00:00
commit 753bd0aba8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 14 additions and 12 deletions

View file

@ -55,7 +55,7 @@ class Filename(MMGenObject):
ftype = from_extension.ext_to_type(self.ext)
if not ftype:
from .exception import BadFileExtension
raise BadFileExtension(f'{self.ext!r}: not a recognized file extension for {self.from_extension}')
raise BadFileExtension(f'{self.ext!r}: not a recognized file extension for {from_extension}')
self.ftype = ftype

View file

@ -220,12 +220,12 @@ common_opts_data = {
--, --ignore-daemon-version Ignore coin daemon version check
--, --http-timeout=t Set HTTP timeout in seconds for JSON-RPC connections
--, --no-license Suppress the GPL license prompt
--, --rpc-host=host Communicate with coin daemon running on host 'host'
--, --rpc-port=port Communicate with coin daemon listening on port 'port'
--, --rpc-user=user Authenticate to coin daemon using username 'user'
--, --rpc-password=pass Authenticate to coin daemon using password 'pass'
--, --rpc-host=HOST Communicate with coin daemon running on host HOST
--, --rpc-port=PORT Communicate with coin daemon listening on port PORT
--, --rpc-user=USER Authenticate to coin daemon using username USER
--, --rpc-password=PASS Authenticate to coin daemon using password PASS
--, --rpc-backend=backend Use backend 'backend' for JSON-RPC communications
--, --aiohttp-rpc-queue-len=N Use 'N' simultaneous RPC connections with aiohttp
--, --aiohttp-rpc-queue-len=N Use N simultaneous RPC connections with aiohttp
--, --regtest=0|1 Disable or enable regtest mode
--, --testnet=0|1 Disable or enable testnet
--, --skip-cfg-file Skip reading the configuration file
@ -281,10 +281,6 @@ def init(opts_data=None,add_opts=None,init_opts=None,opt_filter=None,parse_only=
+ g.common_opts ):
setattr(opt,o,po.user_opts[o] if o in po.user_opts else None)
# Make this available to usage()
global usage_data
usage_data = opts_data['text'].get('usage2') or opts_data['text']['usage']
if opt.version:
version() # exits
@ -374,6 +370,10 @@ def init(opts_data=None,add_opts=None,init_opts=None,opt_filter=None,parse_only=
if getattr(opt,'help',None) or getattr(opt,'longhelp',None):
print_help(po,opts_data,opt_filter) # exits
del mmgen.share.Opts.print_help
del mmgen.share.Opts.process_uopts
del mmgen.share.Opts.parse_opts
from .util import warn_altcoins
warn_altcoins(g.coin,altcoin_trust_level)
@ -398,8 +398,11 @@ def init(opts_data=None,add_opts=None,init_opts=None,opt_filter=None,parse_only=
if g.debug_opts:
opt_postproc_debug()
# Make this available to usage()
global usage_data
usage_data = opts_data['text'].get('usage2') or opts_data['text']['usage']
# We don't need this data anymore
del mmgen.share.Opts
for k in ('text','notes','code'):
if k in opts_data:
del opts_data[k]

View file

@ -1053,7 +1053,6 @@ class tool_api(
"""
Initializer - takes no arguments
"""
import mmgen.opts
opts.UserOpts._reset_ok += ('usr_randchars',)
if not opt._lock:
opts.init()