Skip to content

Commit 7cc8ac5

Browse files
committed
Using _repr_mimebundle if attribute on Output
1 parent e077622 commit 7cc8ac5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

streamz/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,14 @@ def __str__(self):
379379
__repr__ = __str__
380380

381381
def _ipython_display_(self, **kwargs): # pragma: no cover
382+
# Since this function is only called by jupyter, this import must succeed
383+
from IPython.display import HTML, display
384+
382385
try:
383386
import ipywidgets
384387
from IPython.core.interactiveshell import InteractiveShell
385388
output = ipywidgets.Output(_view_count=0)
386389
except ImportError:
387-
# since this function is only called by jupyter, this import must succeed
388-
from IPython.display import display, HTML
389390
if hasattr(self, '_repr_html_'):
390391
return display(HTML(self._repr_html_()))
391392
else:
@@ -420,7 +421,11 @@ def remove_stream(change):
420421

421422
output.observe(remove_stream, '_view_count')
422423

423-
return output._ipython_display_(**kwargs)
424+
if hasattr(output, "_repr_mimebundle_"):
425+
data = output._repr_mimebundle_(**kwargs)
426+
return display(data, raw=True)
427+
else:
428+
return output._ipython_display_(**kwargs)
424429

425430
def _emit(self, x, metadata=None):
426431
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy