| 312 | |
| 313 | |
| 314 | class CapturingDisplayHook(object): |
| 315 | def __init__(self, shell, outputs=None): |
| 316 | self.shell = shell |
| 317 | if outputs is None: |
| 318 | outputs = [] |
| 319 | self.outputs = outputs |
| 320 | |
| 321 | def __call__(self, result=None): |
| 322 | if result is None: |
| 323 | return |
| 324 | format_dict, md_dict = self.shell.display_formatter.format(result) |
| 325 | self.outputs.append({ 'data': format_dict, 'metadata': md_dict }) |
no outgoing calls