devtools.py: add pexit() method, allow args in pmsg()
This commit is contained in:
parent
818488c559
commit
05e901e78d
2 changed files with 9 additions and 4 deletions
|
|
@ -53,13 +53,17 @@ if os.getenv('MMGEN_DEBUG') or os.getenv('MMGEN_TEST_SUITE') or os.getenv('MMGEN
|
|||
print_stack_trace(*args,**kwargs)
|
||||
|
||||
# Pretty-print any object subclassed from MMGenObject, recursing into sub-objects - WIP
|
||||
def pmsg(self):
|
||||
print(self.pfmt())
|
||||
def pmsg(self,*args):
|
||||
print(args[0] if len(args) == 1 else args if args else self.pfmt())
|
||||
|
||||
def pdie(self):
|
||||
print(self.pfmt())
|
||||
def pdie(self,*args):
|
||||
self.pmsg(*args)
|
||||
sys.exit(1)
|
||||
|
||||
def pexit(self,*args):
|
||||
self.pmsg(*args)
|
||||
sys.exit(0)
|
||||
|
||||
def pfmt(self,lvl=0,id_list=[]):
|
||||
scalars = (str,int,float,Decimal)
|
||||
def do_list(out,e,lvl=0,is_dict=False):
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ class MMGenListItem(MMGenObject):
|
|||
'pfmt',
|
||||
'pmsg',
|
||||
'pdie',
|
||||
'pexit',
|
||||
'valid_attrs',
|
||||
'valid_attrs_extra',
|
||||
'invalid_attrs',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue