Small fix

This commit is contained in:
Philipp Rudiger
2022-05-02 19:48:15 +02:00
parent 4df9a7e06d
commit 7534b79fd6
2 changed files with 10 additions and 10 deletions

View File

@@ -52,12 +52,12 @@ def eval_formatter(obj, print_method):
"""
if print_method == '__repr__':
return repr(obj)
elif print_method == 'savefig':
buf = io.BytesIO()
obj.savefig(buf, format='png')
buf.seek(0)
return base64.b64encode(buf.read()).decode('utf-8')
elif hasattr(obj, print_method):
if print_method == 'savefig':
buf = io.BytesIO()
obj.savefig(buf, format='png')
buf.seek(0)
return base64.b64encode(buf.read()).decode('utf-8')
return getattr(obj, print_method)()
elif print_method == '_repr_mimebundle_':
return {}, {}