@@ -168,7 +168,7 @@ def wrapped(*args, **kwargs):
168168 def register_plugin_entry_point (cls , entry_point , modifier = identity ):
169169 if hasattr (cls , entry_point .name ):
170170 raise ValueError (
171- f"Can't add { entry_point .name } from { entry_point . module_name } "
171+ f"Can't add { entry_point .name } "
172172 f"to { cls .__name__ } : duplicate method name."
173173 )
174174
@@ -178,7 +178,6 @@ def stub(*args, **kwargs):
178178 if not issubclass (node , Stream ):
179179 raise TypeError (
180180 f"Error loading { entry_point .name } "
181- f"from module { entry_point .module_name } : "
182181 f"{ node .__class__ .__name__ } must be a subclass of Stream"
183182 )
184183 if getattr (cls , entry_point .name ).__name__ == "stub" :
@@ -379,13 +378,14 @@ def __str__(self):
379378 __repr__ = __str__
380379
381380 def _ipython_display_ (self , ** kwargs ): # pragma: no cover
381+ # Since this function is only called by jupyter, this import must succeed
382+ from IPython .display import HTML , display
383+
382384 try :
383385 import ipywidgets
384386 from IPython .core .interactiveshell import InteractiveShell
385387 output = ipywidgets .Output (_view_count = 0 )
386388 except ImportError :
387- # since this function is only called by jupyter, this import must succeed
388- from IPython .display import display , HTML
389389 if hasattr (self , '_repr_html_' ):
390390 return display (HTML (self ._repr_html_ ()))
391391 else :
@@ -420,7 +420,11 @@ def remove_stream(change):
420420
421421 output .observe (remove_stream , '_view_count' )
422422
423- return output ._ipython_display_ (** kwargs )
423+ if hasattr (output , "_repr_mimebundle_" ):
424+ data = output ._repr_mimebundle_ (** kwargs )
425+ return display (data , raw = True )
426+ else :
427+ return output ._ipython_display_ (** kwargs )
424428
425429 def _emit (self , x , metadata = None ):
426430 """
@@ -1468,18 +1472,23 @@ class zip(Stream):
14681472
14691473 def __init__ (self , * upstreams , ** kwargs ):
14701474 self .maxsize = kwargs .pop ('maxsize' , 10 )
1471- self .condition = Condition ()
1475+ self ._condition = None
14721476 self .literals = [(i , val ) for i , val in enumerate (upstreams )
14731477 if not isinstance (val , Stream )]
14741478
14751479 self .buffers = {upstream : deque ()
14761480 for upstream in upstreams
14771481 if isinstance (upstream , Stream )}
1478-
14791482 upstreams2 = [upstream for upstream in upstreams if isinstance (upstream , Stream )]
14801483
14811484 Stream .__init__ (self , upstreams = upstreams2 , ** kwargs )
14821485
1486+ @property
1487+ def condition (self ):
1488+ if self ._condition is None :
1489+ self ._condition = Condition ()
1490+ return self ._condition
1491+
14831492 def _add_upstream (self , upstream ):
14841493 # Override method to handle setup of buffer for new stream
14851494 self .buffers [upstream ] = deque ()
@@ -1876,7 +1885,7 @@ class latest(Stream):
18761885 _graphviz_shape = 'octagon'
18771886
18781887 def __init__ (self , upstream , ** kwargs ):
1879- self .condition = Condition ()
1888+ self ._condition = None
18801889 self .next = []
18811890 self .next_metadata = None
18821891
@@ -1885,6 +1894,12 @@ def __init__(self, upstream, **kwargs):
18851894
18861895 self .loop .add_callback (self .cb )
18871896
1897+ @property
1898+ def condition (self ):
1899+ if self ._condition is None :
1900+ self ._condition = Condition ()
1901+ return self ._condition
1902+
18881903 def update (self , x , who = None , metadata = None ):
18891904 if self .next_metadata :
18901905 self ._release_refs (self .next_metadata )
0 commit comments