Show More
@@ -2,25 +2,11 b'' | |||
|
2 | 2 | """Displayhook for IPython. |
|
3 | 3 | |
|
4 | 4 | This defines a callable class that IPython uses for `sys.displayhook`. |
|
5 | ||
|
6 | Authors: | |
|
7 | ||
|
8 | * Fernando Perez | |
|
9 | * Brian Granger | |
|
10 | * Robert Kern | |
|
11 | 5 | """ |
|
12 | 6 | |
|
13 | #----------------------------------------------------------------------------- | |
|
14 | # Copyright (C) 2008-2011 The IPython Development Team | |
|
15 | # Copyright (C) 2001-2007 Fernando Perez <fperez@colorado.edu> | |
|
16 | # | |
|
17 | # Distributed under the terms of the BSD License. The full license is in | |
|
18 | # the file COPYING, distributed as part of this software. | |
|
19 | #----------------------------------------------------------------------------- | |
|
20 | ||
|
21 | #----------------------------------------------------------------------------- | |
|
22 | # Imports | |
|
23 | #----------------------------------------------------------------------------- | |
|
7 | # Copyright (c) IPython Development Team. | |
|
8 | # Distributed under the terms of the Modified BSD License. | |
|
9 | ||
|
24 | 10 | from __future__ import print_function |
|
25 | 11 | |
|
26 | 12 | import sys |
@@ -32,10 +18,6 b' from IPython.utils.py3compat import builtin_mod' | |||
|
32 | 18 | from IPython.utils.traitlets import Instance |
|
33 | 19 | from IPython.utils.warn import warn |
|
34 | 20 | |
|
35 | #----------------------------------------------------------------------------- | |
|
36 | # Main displayhook class | |
|
37 | #----------------------------------------------------------------------------- | |
|
38 | ||
|
39 | 21 | # TODO: Move the various attributes (cache_size, [others now moved]). Some |
|
40 | 22 | # of these are also attributes of InteractiveShell. They should be on ONE object |
|
41 | 23 | # only and the other objects should ask that one object for their values. |
@@ -168,6 +150,9 b' class DisplayHook(Configurable):' | |||
|
168 | 150 | md_dict : dict (optional) |
|
169 | 151 | The metadata dict to be associated with the display data. |
|
170 | 152 | """ |
|
153 | if 'text/plain' not in format_dict: | |
|
154 | # nothing to do | |
|
155 | return | |
|
171 | 156 | # We want to print because we want to always make sure we have a |
|
172 | 157 | # newline, even if all the prompt separators are ''. This is the |
|
173 | 158 | # standard IPython behavior. |
@@ -221,6 +206,9 b' class DisplayHook(Configurable):' | |||
|
221 | 206 | |
|
222 | 207 | def log_output(self, format_dict): |
|
223 | 208 | """Log the output.""" |
|
209 | if 'text/plain' not in format_dict: | |
|
210 | # nothing to do | |
|
211 | return | |
|
224 | 212 | if self.shell.logger.log_output: |
|
225 | 213 | self.shell.logger.log_write(format_dict['text/plain'], 'output') |
|
226 | 214 | self.shell.history_manager.output_hist_reprs[self.prompt_count] = \ |
General Comments 0
You need to be logged in to leave comments.
Login now