MCPcopy Index your code
hub / github.com/ipython/ipython / publish_display_data

Function publish_display_data

IPython/core/display_functions.py:37–77  ·  view source on GitHub ↗

Publish data and metadata to all frontends. See the ``display_data`` message in the messaging documentation for more details about this message type. Keys of data and metadata can be any mime-type. Parameters ---------- data : dict A dictionary having keys that are

(data, metadata=None, *, transient=None, **kwargs)

Source from the content-addressed store, hash-verified

35
36# use * to indicate transient is keyword-only
37def publish_display_data(data, metadata=None, *, transient=None, **kwargs):
38 """Publish data and metadata to all frontends.
39
40 See the ``display_data`` message in the messaging documentation for
41 more details about this message type.
42
43 Keys of data and metadata can be any mime-type.
44
45 Parameters
46 ----------
47 data : dict
48 A dictionary having keys that are valid MIME types (like
49 'text/plain' or 'image/svg+xml') and values that are the data for
50 that MIME type. The data itself must be a JSON'able data
51 structure. Minimally all data should have the 'text/plain' data,
52 which can be displayed by all frontends. If more than the plain
53 text is given, it is up to the frontend to decide which
54 representation to use.
55 metadata : dict
56 A dictionary for metadata related to the data. This can contain
57 arbitrary key, value pairs that frontends can use to interpret
58 the data. mime-type keys matching those in data can be used
59 to specify metadata about particular representations.
60 transient : dict, keyword-only
61 A dictionary of transient data, such as display_id.
62 """
63 from IPython.core.interactiveshell import InteractiveShell
64
65 display_pub = InteractiveShell.instance().display_pub
66
67 # only pass transient if supplied,
68 # to avoid errors with older ipykernel.
69 # TODO: We could check for ipykernel version and provide a detailed upgrade message.
70 if transient:
71 kwargs['transient'] = transient
72
73 display_pub.publish(
74 data=data,
75 metadata=metadata,
76 **kwargs
77 )
78
79
80def _new_id():

Callers 2

displayMethod · 0.90
displayFunction · 0.85

Calls 1

publishMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…