##// END OF EJS Templates
format-related docstrings!
MinRK -
Show More
@@ -145,11 +145,14 b' class DisplayHook(Configurable):'
145
145
146 Returns
146 Returns
147 -------
147 -------
148 format_data : dict
148 (format_dict, md_dict) : dict
149 A :class:`dict` whose keys are valid MIME types and values are
149 format_dict is a :class:`dict` whose keys are valid MIME types and values are
150 JSON'able raw data for that MIME type. It is recommended that
150 JSON'able raw data for that MIME type. It is recommended that
151 all return values of this should always include the "text/plain"
151 all return values of this should always include the "text/plain"
152 MIME type representation of the object.
152 MIME type representation of the object.
153 md_dict is a :class:`dict` with the same MIME type keys
154 of metadata associated with each output.
155
153 """
156 """
154 return self.shell.display_formatter.format(result)
157 return self.shell.display_formatter.format(result)
155
158
@@ -165,6 +168,8 b' class DisplayHook(Configurable):'
165 ----------
168 ----------
166 format_dict : dict
169 format_dict : dict
167 The format dict for the object passed to `sys.displayhook`.
170 The format dict for the object passed to `sys.displayhook`.
171 md_dict : dict (optional)
172 The metadata dict to be associated with the display data.
168 """
173 """
169 # We want to print because we want to always make sure we have a
174 # We want to print because we want to always make sure we have a
170 # newline, even if all the prompt separators are ''. This is the
175 # newline, even if all the prompt separators are ''. This is the
@@ -98,7 +98,9 b' class DisplayPublisher(Configurable):'
98 metadata : dict
98 metadata : dict
99 A dictionary for metadata related to the data. This can contain
99 A dictionary for metadata related to the data. This can contain
100 arbitrary key, value pairs that frontends can use to interpret
100 arbitrary key, value pairs that frontends can use to interpret
101 the data.
101 the data. Metadata specific to each mime-type can be specified
102 in the metadata dict with the same mime-type keys as
103 the data itself.
102 """
104 """
103
105
104 # The default is to simply write the plain text data using io.stdout.
106 # The default is to simply write the plain text data using io.stdout.
@@ -149,8 +151,9 b' def publish_display_data(source, data, metadata=None):'
149 metadata : dict
151 metadata : dict
150 A dictionary for metadata related to the data. This can contain
152 A dictionary for metadata related to the data. This can contain
151 arbitrary key, value pairs that frontends can use to interpret
153 arbitrary key, value pairs that frontends can use to interpret
152 the data.
154 the data. mime-type keys matching those in data can be used
153 """
155 to specify metadata about particular representations.
156 """
154 from IPython.core.interactiveshell import InteractiveShell
157 from IPython.core.interactiveshell import InteractiveShell
155 InteractiveShell.instance().display_pub.publish(
158 InteractiveShell.instance().display_pub.publish(
156 source,
159 source,
@@ -127,12 +127,16 b' class DisplayFormatter(Configurable):'
127
127
128 Returns
128 Returns
129 -------
129 -------
130 format_dict : dict
130 (format_dict, metadata_dict) : tuple of two dicts
131 A dictionary of key/value pairs, one or each format that was
131
132 format_dict is a dictionary of key/value pairs, one of each format that was
132 generated for the object. The keys are the format types, which
133 generated for the object. The keys are the format types, which
133 will usually be MIME type strings and the values and JSON'able
134 will usually be MIME type strings and the values and JSON'able
134 data structure containing the raw data for the representation in
135 data structure containing the raw data for the representation in
135 that format.
136 that format.
137
138 metadata_dict is a dictionary of metadata about each mime-type output.
139 Its keys will be a strict subset of the keys in format_dict.
136 """
140 """
137 format_dict = {}
141 format_dict = {}
138 md_dict = {}
142 md_dict = {}
General Comments 0
You need to be logged in to leave comments. Login now