##// END OF EJS Templates
Python 3 supports keyword-only args...
Min RK -
Show More
@@ -78,7 +78,7 b' def _display_mimetype(mimetype, objs, raw=False, metadata=None):'
78 78 # Main functions
79 79 #-----------------------------------------------------------------------------
80 80
81 def publish_display_data(data, metadata=None, source=None, transient=None, **kwargs):
81 def publish_display_data(data, metadata=None, source=None, *, transient=None, **kwargs):
82 82 """Publish data and metadata to all frontends.
83 83
84 84 See the ``display_data`` message in the messaging documentation for
@@ -132,7 +132,7 b' def publish_display_data(data, metadata=None, source=None, transient=None, **kwa'
132 132 **kwargs
133 133 )
134 134
135 def display(*objs, **kwargs):
135 def display(*objs, include=None, exclude=None, metadata=None, transient=None, display_id=None, **kwargs):
136 136 """Display a Python object in all frontends.
137 137
138 138 By default all representations will be computed and sent to the frontends.
@@ -163,16 +163,18 b' def display(*objs, **kwargs):'
163 163 display_id : str, optional
164 164 Set an id for the display.
165 165 This id can be used for updating this display area later via update_display.
166 kwargs: additional keyword-args, optional
167 Additional keyword-arguments are passed through to the display publisher.
166 168 """
167 169 raw = kwargs.pop('raw', False)
168 include = kwargs.pop('include', None)
169 exclude = kwargs.pop('exclude', None)
170 metadata = kwargs.pop('metadata', None)
171 transient = kwargs.setdefault('transient', {})
172 if 'display_id' in kwargs:
173 transient['display_id'] = kwargs.pop('display_id')
170 if transient is None:
171 transient = {}
172 if display_id:
173 transient['display_id'] = display_id
174 174 if kwargs.get('update') and 'display_id' not in transient:
175 175 raise TypeError('display_id required for update_display')
176 if transient:
177 kwargs['transient'] = transient
176 178
177 179 from IPython.core.interactiveshell import InteractiveShell
178 180
@@ -194,10 +196,20 b' def display(*objs, **kwargs):'
194 196 **kwargs)
195 197
196 198
197 def update_display(*objs, **kwargs):
198 """Update an existing display"""
199 def update_display(obj, *, display_id=None, **kwargs):
200 """Update an existing display.
201
202 Parameters
203 ----------
204
205 obj:
206 The object with which to update the display
207 display_id: keyword-only
208 The id of the display to update
209 """
199 210 kwargs['update'] = True
200 return display(*objs, **kwargs)
211 return display(obj, **kwargs)
212
201 213
202 214
203 215 def display_pretty(*objs, **kwargs):
General Comments 0
You need to be logged in to leave comments. Login now