missing import fixes throughout
This commit is contained in:
parent
aff850d1c8
commit
f626fc2e05
30 changed files with 41 additions and 32 deletions
|
|
@ -24,7 +24,7 @@ import os,re
|
|||
from collections import namedtuple
|
||||
|
||||
from .cfg import gc
|
||||
from .util import msg,ymsg,suf,fmt,fmt_list,oneshot_warning,strip_comment,capfirst
|
||||
from .util import msg,ymsg,suf,fmt,fmt_list,oneshot_warning,strip_comment,capfirst,die
|
||||
|
||||
def mmgen_cfg_file(cfg,id_str):
|
||||
return cfg_file.get_cls_by_id(id_str)(cfg)
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ from .cfg import gc
|
|||
from .util import (
|
||||
msg,
|
||||
msg_r,
|
||||
ymsg,
|
||||
fmt,
|
||||
die,
|
||||
make_chksum_8,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import sys
|
|||
import mmgen.opts as opts
|
||||
from .cfg import Config
|
||||
from .base_obj import AsyncInit
|
||||
from .util import msg,suf,async_run
|
||||
from .util import msg,suf,async_run,die
|
||||
from .msg import (
|
||||
NewMsg,
|
||||
CompletedMsg,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ mmgen-txsign: Sign a transaction generated by 'mmgen-txcreate'
|
|||
|
||||
import mmgen.opts as opts
|
||||
from .cfg import gc,Config
|
||||
from .util import msg,ymsg,die,async_run
|
||||
from .util import msg,ymsg,suf,die,async_run
|
||||
from .subseed import SubSeedIdxRange
|
||||
from .wallet import Wallet
|
||||
from .color import orange
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ proto.btc.tx.completed: Bitcoin completed transaction class
|
|||
import mmgen.tx.completed as TxBase
|
||||
from .base import Base,scriptPubKey2addr
|
||||
from ....obj import HexStr
|
||||
from ....util import msg
|
||||
from ....util import msg,die
|
||||
|
||||
class Completed(Base,TxBase.Completed):
|
||||
fn_fee_unit = 'satoshi'
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ proto.btc.tx.new: Bitcoin new transaction class
|
|||
import mmgen.tx.new as TxBase
|
||||
from .base import Base
|
||||
from ....obj import HexStr,MMGenTxID
|
||||
from ....util import msg,make_chksum_6,die
|
||||
from ....util import msg,fmt,make_chksum_6,die
|
||||
|
||||
class New(Base,TxBase.New):
|
||||
usr_fee_prompt = 'Enter transaction fee: '
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ proto.btc.tx.online: Bitcoin online signed transaction class
|
|||
|
||||
import mmgen.tx.online as TxBase
|
||||
from .signed import Signed
|
||||
from ....util import msg,ymsg,rmsg
|
||||
from ....util import msg,ymsg,rmsg,die
|
||||
|
||||
class OnlineSigned(Signed,TxBase.OnlineSigned):
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ proto.btc.tx.unsigned: Bitcoin unsigned transaction class
|
|||
import mmgen.tx.unsigned as TxBase
|
||||
from .completed import Completed
|
||||
from ....obj import HexStr,CoinTxID,MMGenDict
|
||||
from ....util import msg,msg_r,ymsg,suf
|
||||
from ....util import msg,msg_r,ymsg,suf,die
|
||||
|
||||
class Unsigned(Completed,TxBase.Unsigned):
|
||||
desc = 'unsigned transaction'
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ from decimal import Decimal
|
|||
from . import rlp
|
||||
|
||||
from . import erigon_sleep
|
||||
from ...util import msg,pp_msg
|
||||
from ...util import msg,pp_msg,die
|
||||
from ...base_obj import AsyncInit
|
||||
from ...obj import MMGenObject,CoinTxID
|
||||
from ...addr import CoinAddr,TokenAddr
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import json
|
|||
import mmgen.tx.new as TxBase
|
||||
from .base import Base,TokenBase
|
||||
from ....obj import Int,ETHNonce,MMGenTxID,Str,HexStr
|
||||
from ....util import msg,is_int,is_hex_str,make_chksum_6
|
||||
from ....util import msg,is_int,is_hex_str,make_chksum_6,suf,die
|
||||
from ....tw.ctl import TwCtl
|
||||
from ....addr import is_mmgen_id,is_coin_addr
|
||||
from ..contract import Token
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ proto.eth.tx.online: Ethereum online signed transaction class
|
|||
import mmgen.tx.online as TxBase
|
||||
from .signed import Signed,TokenSigned
|
||||
from .. import erigon_sleep
|
||||
from ....util import msg,rmsg
|
||||
from ....util import msg,rmsg,die
|
||||
|
||||
class OnlineSigned(Signed,TxBase.OnlineSigned):
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
seed: Seed-related classes and methods for the MMGen suite
|
||||
"""
|
||||
|
||||
from .util import make_chksum_8,hexdigits_uc
|
||||
from .util import make_chksum_8,hexdigits_uc,die
|
||||
from .objmethods import Hilite,InitErrors,MMGenObject
|
||||
from .obj import ImmutableAttr,get_obj
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ seedsplit: Seed split classes and methods for the MMGen suite
|
|||
"""
|
||||
|
||||
from .color import yellow
|
||||
from .obj import MMGenPWIDString,MMGenIdx
|
||||
from .util import msg,die
|
||||
from .obj import MMGenPWIDString,MMGenIdx,get_obj
|
||||
from .subseed import *
|
||||
from .crypto import Crypto
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class tool_cmd(tool_cmd_base):
|
|||
dec_d = Crypto(self.cfg).mmgen_decrypt( enc_d, 'data', hash_preset )
|
||||
if dec_d:
|
||||
break
|
||||
from ..util import msg
|
||||
msg('Trying again...')
|
||||
if not outfile:
|
||||
from ..util import remove_extension
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class tool_cmd(tool_cmd_base):
|
|||
from ..protocol import init_proto
|
||||
proto = init_proto( self.cfg, 'xmr' )
|
||||
if len(bytestr) != proto.privkey_len:
|
||||
from ..util import die
|
||||
die(1,'{!r}: invalid bit length for Monero private key (must be {})'.format(
|
||||
len(bytestr*8),
|
||||
proto.privkey_len*8 ))
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ class TwGetBalance(MMGenObject,metaclass=AsyncInit):
|
|||
return len(str(int(max(v[colname] for v in self.data.values())))) + iwidth_adj
|
||||
|
||||
def make_col(label,col):
|
||||
return(self.data[label][col].fmt(iwidth=iwidths[col],color=color))
|
||||
return self.data[label][col].fmt( iwidth=iwidths[col], color=color )
|
||||
|
||||
if color:
|
||||
from ..color import red,green,yellow
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ def _get_cls_info(clsname,modname,args,kwargs):
|
|||
f"{clsname} must be instantiated with 'proto','data' or 'filename' keyword" )
|
||||
|
||||
if clsname == 'Completed':
|
||||
from ..util import get_extension
|
||||
from ..util import get_extension,die
|
||||
from .completed import Completed
|
||||
ext = get_extension( kwargs['filename'] )
|
||||
cls = Completed.ext_to_cls( ext, proto )
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ tx.bump: transaction bump class
|
|||
|
||||
from .new import New
|
||||
from .completed import Completed
|
||||
from ..util import is_int
|
||||
from ..util import msg,is_int,die
|
||||
|
||||
class Bump(Completed,New):
|
||||
desc = 'fee-bumped transaction'
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ util2: Less frequently-used variables, classes and utility functions for the MMG
|
|||
"""
|
||||
|
||||
import re,time
|
||||
from .util import msg,suf,hexdigits
|
||||
from .util import msg,suf,hexdigits,die
|
||||
|
||||
def die_wait(delay,ev=0,s=''):
|
||||
assert isinstance(delay,int)
|
||||
|
|
@ -80,7 +80,7 @@ def int2bytespec(n,spec,fmt,print_sym=True,strip=False,add_space=False):
|
|||
if k == spec:
|
||||
return v
|
||||
else:
|
||||
die('{spec}: unrecognized bytespec')
|
||||
die(1,f'{spec!r}: unrecognized bytespec')
|
||||
|
||||
if strip:
|
||||
ret = '{:{}f}'.format(n/spec2int(spec),fmt).rstrip('0')
|
||||
|
|
@ -120,7 +120,7 @@ def format_elapsed_hr(t,now=None,cached={}):
|
|||
|
||||
def pretty_format(s,width=80,pfx=''):
|
||||
out = []
|
||||
while(s):
|
||||
while s:
|
||||
if len(s) <= width:
|
||||
out.append(s)
|
||||
break
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ wallet.incog_base: incognito wallet base class
|
|||
"""
|
||||
|
||||
from ..seed import Seed
|
||||
from ..util import msg,make_chksum_8
|
||||
from ..util import msg,make_chksum_8,die
|
||||
from .enc import wallet
|
||||
|
||||
class wallet(wallet):
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ def create_src(cfg,template,token_data):
|
|||
if not field.test(val):
|
||||
die(1,f'{val!r}: invalid parameter for option --{k}')
|
||||
|
||||
yield(k,field.conversion(val))
|
||||
yield (k, field.conversion(val))
|
||||
|
||||
from string import Template
|
||||
return Template(template).substitute(**dict(gen()))
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ curdir = normalize_path(os.curdir)
|
|||
|
||||
for n in reversed(range(len(sys.path))):
|
||||
if normalize_path(sys.path[n]) == curdir:
|
||||
del(sys.path[n])
|
||||
del sys.path[n]
|
||||
|
||||
try:
|
||||
import mmgen.main
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import include.test_init
|
|||
import mmgen.opts as opts
|
||||
from mmgen.cfg import gc,Config
|
||||
from mmgen.color import green,red,purple
|
||||
from mmgen.util import msg,capfirst,is_int,die
|
||||
from mmgen.util import msg,ymsg,capfirst,is_int,die
|
||||
|
||||
results_file = 'gentest.out.json'
|
||||
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@ if not os.getenv('MMGEN_DEVTOOLS'):
|
|||
init_dev()
|
||||
|
||||
from mmgen.cfg import Config
|
||||
from mmgen.util import msg,msg_r,gmsg,capfirst
|
||||
from mmgen.color import yellow,blue,green,orange,purple,gray,nocolor
|
||||
from mmgen.util import msg,msg_r,gmsg,capfirst,die
|
||||
from mmgen.color import red,yellow,blue,green,orange,purple,gray,nocolor
|
||||
from mmgen.obj import get_obj
|
||||
|
||||
opts_data = {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import include.test_init
|
|||
|
||||
import mmgen.opts as opts
|
||||
from mmgen.cfg import gc,Config
|
||||
from mmgen.util import msg,msg_r,bmsg
|
||||
from mmgen.util import msg,msg_r,bmsg,die
|
||||
|
||||
opts_data = {
|
||||
'text': {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ else:
|
|||
repo_root = include.test_init.repo_root
|
||||
|
||||
from mmgen.cfg import Config,gc
|
||||
from mmgen.color import red,yellow,green,blue,cyan,nocolor
|
||||
from mmgen.color import red,yellow,green,blue,cyan,nocolor,init_color
|
||||
from mmgen.util import Msg,bmsg,die,suf,make_timestr,async_run
|
||||
|
||||
from test.include.common import (
|
||||
|
|
@ -104,6 +104,7 @@ from test.include.common import (
|
|||
ok,
|
||||
start_test_daemons,
|
||||
stop_test_daemons,
|
||||
init_coverage,
|
||||
)
|
||||
|
||||
try:
|
||||
|
|
@ -198,7 +199,10 @@ cfg = Config(opts_data=opts_data)
|
|||
|
||||
set_globals(cfg)
|
||||
|
||||
from test.test_py_d.common import get_file_with_ext # this must be loaded after set_globals()
|
||||
from test.test_py_d.common import ( # this must be loaded after set_globals()
|
||||
get_file_with_ext,
|
||||
confirm_continue
|
||||
)
|
||||
|
||||
type(cfg)._reset_ok += (
|
||||
'no_daemon_autostart',
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ test.test_py_d.common: Shared routines and data for the test.py test suite
|
|||
import sys,os
|
||||
|
||||
from mmgen.cfg import gc
|
||||
from mmgen.color import green
|
||||
from mmgen.color import green,blue
|
||||
from mmgen.util import msg
|
||||
|
||||
from ..include.common import cfg,getrand,text_jp,text_zh,ascii_cyr_gr,lat_cyr_gr
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ from subprocess import run,PIPE
|
|||
import include.test_init
|
||||
|
||||
from mmgen.cfg import Config,gc
|
||||
from mmgen.color import green,cyan,yellow,blue
|
||||
from mmgen.color import red,yellow,green,blue,cyan
|
||||
from mmgen.util import msg,msg_r,Msg,die
|
||||
|
||||
opts_data = {
|
||||
|
|
@ -65,7 +65,8 @@ from test.include.common import (
|
|||
cmp_or_die,
|
||||
getrand,
|
||||
getrandhex,
|
||||
end_msg
|
||||
end_msg,
|
||||
init_coverage
|
||||
)
|
||||
set_globals(cfg)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ from decimal import Decimal
|
|||
|
||||
import include.test_init
|
||||
|
||||
from test.include.common import set_globals,end_msg,sample_text
|
||||
from test.include.common import set_globals,end_msg,sample_text,init_coverage
|
||||
|
||||
from mmgen.cfg import Config,gc
|
||||
from mmgen.color import green,blue,purple,cyan
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ if not os.getenv('MMGEN_DEVTOOLS'):
|
|||
init_dev()
|
||||
|
||||
from mmgen.cfg import Config,gc
|
||||
from mmgen.color import gray
|
||||
from mmgen.color import green,gray
|
||||
from mmgen.util import msg,gmsg,ymsg,Msg,die,async_run
|
||||
|
||||
from test.include.common import set_globals,end_msg
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue