formatted return message also on interactive shells

This commit is contained in:
Martin Diehl 2019-05-28 09:02:29 +02:00
parent 100a2031d3
commit 669ca82ce1
2 changed files with 12 additions and 1 deletions

View File

@ -70,7 +70,7 @@ class Geom():
message[-1] = util.delete(message[-1])
message.append('max microstructure: {}'.format(np.nanmax(self.microstructure)))
return util.srepr(message)
return util.return_message(message)
def set_comments(self,comments):
self.comments = []

View File

@ -189,6 +189,17 @@ def progressBar(iteration, total, prefix='', bar_length=50):
if iteration == total: sys.stderr.write('\n')
sys.stderr.flush()
class return_message():
"""Object with formatted return message"""
def __init__(self,message):
self.message = message
def __repr__(self):
"""Return message suitable for interactive shells"""
return srepr(self.message)
def leastsqBound(func, x0, args=(), bounds=None, Dfun=None, full_output=0,