Compute format data of the object to be displayed. The format data is a generalization of the :func:`repr` of an object. In the default implementation the format data is a :class:`dict` of key value pair where the keys are valid MIME types and the values are JSON'abl
(self, result)
| 132 | sys.stdout.write(outprompt) |
| 133 | |
| 134 | def compute_format_data(self, result): |
| 135 | """Compute format data of the object to be displayed. |
| 136 | |
| 137 | The format data is a generalization of the :func:`repr` of an object. |
| 138 | In the default implementation the format data is a :class:`dict` of |
| 139 | key value pair where the keys are valid MIME types and the values |
| 140 | are JSON'able data structure containing the raw data for that MIME |
| 141 | type. It is up to frontends to determine pick a MIME to to use and |
| 142 | display that data in an appropriate manner. |
| 143 | |
| 144 | This method only computes the format data for the object and should |
| 145 | NOT actually print or write that to a stream. |
| 146 | |
| 147 | Parameters |
| 148 | ---------- |
| 149 | result : object |
| 150 | The Python object passed to the display hook, whose format will be |
| 151 | computed. |
| 152 | |
| 153 | Returns |
| 154 | ------- |
| 155 | (format_dict, md_dict) : dict |
| 156 | format_dict is a :class:`dict` whose keys are valid MIME types and values are |
| 157 | JSON'able raw data for that MIME type. It is recommended that |
| 158 | all return values of this should always include the "text/plain" |
| 159 | MIME type representation of the object. |
| 160 | md_dict is a :class:`dict` with the same MIME type keys |
| 161 | of metadata associated with each output. |
| 162 | |
| 163 | """ |
| 164 | return self.shell.display_formatter.format(result) |
| 165 | |
| 166 | # This can be set to True by the write_output_prompt method in a subclass |
| 167 | prompt_end_newline = False |