diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-12 17:24:47 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2024-03-12 17:34:45 +0300 |
commit | e84602b8f2b95d10d45eb11369ae7d627339c881 (patch) | |
tree | 028524c9f076a9c4019a8d78d4a30685b7626c99 /contrib/python/ipython/py3/IPython/core/displaypub.py | |
parent | e98c636d759bf6f106a2b90142041bb9d4f1e33f (diff) | |
download | ydb-e84602b8f2b95d10d45eb11369ae7d627339c881.tar.gz |
Intermediate changes
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core/displaypub.py')
-rw-r--r-- | contrib/python/ipython/py3/IPython/core/displaypub.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/displaypub.py b/contrib/python/ipython/py3/IPython/core/displaypub.py index 74028ec79e..ed6a7082e7 100644 --- a/contrib/python/ipython/py3/IPython/core/displaypub.py +++ b/contrib/python/ipython/py3/IPython/core/displaypub.py @@ -24,7 +24,9 @@ from traitlets import List # This used to be defined here - it is imported for backwards compatibility from .display_functions import publish_display_data -#----------------------------------------------------------------------------- +import typing as t + +# ----------------------------------------------------------------------------- # Main payload class #----------------------------------------------------------------------------- @@ -103,9 +105,9 @@ class DisplayPublisher(Configurable): rather than creating a new output. """ - handlers = {} + handlers: t.Dict = {} if self.shell is not None: - handlers = getattr(self.shell, 'mime_renderers', {}) + handlers = getattr(self.shell, "mime_renderers", {}) for mime, handler in handlers.items(): if mime in data: @@ -125,11 +127,20 @@ class DisplayPublisher(Configurable): class CapturingDisplayPublisher(DisplayPublisher): """A DisplayPublisher that stores""" - outputs = List() - def publish(self, data, metadata=None, source=None, *, transient=None, update=False): - self.outputs.append({'data':data, 'metadata':metadata, - 'transient':transient, 'update':update}) + outputs: List = List() + + def publish( + self, data, metadata=None, source=None, *, transient=None, update=False + ): + self.outputs.append( + { + "data": data, + "metadata": metadata, + "transient": transient, + "update": update, + } + ) def clear_output(self, wait=False): super(CapturingDisplayPublisher, self).clear_output(wait) |