1616
1717import os
1818import sys
19- import time
2019import warnings
2120from threading import local
2221
23- from tornado import ioloop
24-
2522from IPython .core .interactiveshell import (
2623 InteractiveShell , InteractiveShellABC
2724)
5956# Functions and classes
6057#-----------------------------------------------------------------------------
6158
59+ _sentinel = object ()
60+
61+
6262class ZMQDisplayPublisher (DisplayPublisher ):
6363 """A display publisher that publishes data using a ZeroMQ PUB socket."""
6464
@@ -93,7 +93,12 @@ def _hooks(self):
9393 self ._thread_local .hooks = []
9494 return self ._thread_local .hooks
9595
96- def publish (self , data , metadata = None , source = None , transient = None ,
96+ def publish (
97+ self ,
98+ data ,
99+ metadata = None ,
100+ source = _sentinel ,
101+ transient = None ,
97102 update = False ,
98103 ):
99104 """Publish a display-data message
@@ -110,7 +115,23 @@ def publish(self, data, metadata=None, source=None, transient=None,
110115 Transient data should not be persisted to documents.
111116 update: bool, optional, keyword-only
112117 If True, send an update_display_data message instead of display_data.
118+ source : unused
119+ Value will have no effect on function behavior. Parameter is still
120+ present for backward compatibility but will be removed in the
121+ future.
122+
123+ .. deprecated:: 4.0.1
124+
125+ `source` has been deprecated and no-op since ipykernel 4.0.1
126+ (2015)
113127 """
128+ if source is not _sentinel :
129+ warnings .warn (
130+ "`source` has been deprecated since ipykernel 4.0.1 "
131+ "and will have no effect" ,
132+ DeprecationWarning ,
133+ stacklevel = 2 ,
134+ )
114135 self ._flush_streams ()
115136 if metadata is None :
116137 metadata = {}
@@ -555,8 +576,13 @@ def _showtraceback(self, etype, evalue, stb):
555576 if dh .topic :
556577 topic = dh .topic .replace (b'execute_result' , b'error' )
557578
558- exc_msg = dh .session .send (dh .pub_socket , 'error' , json_clean (exc_content ),
559- dh .parent_header , ident = topic )
579+ dh .session .send (
580+ dh .pub_socket ,
581+ "error" ,
582+ json_clean (exc_content ),
583+ dh .parent_header ,
584+ ident = topic ,
585+ )
560586
561587 # FIXME - Once we rely on Python 3, the traceback is stored on the
562588 # exception object, so we shouldn't need to store it here.
0 commit comments