Show More
@@ -83,10 +83,16 b' class DisplayHook(Configurable):' | |||||
83 |
|
83 | |||
84 | def quiet(self): |
|
84 | def quiet(self): | |
85 | """Should we silence the display hook because of ';'?""" |
|
85 | """Should we silence the display hook because of ';'?""" | |
86 | if self.exec_result is not None: |
|
86 | # do not print output if input ends in ';' | |
87 | return self.semicolon_at_end_of_expression(self.exec_result.info.raw_cell) |
|
87 | ||
|
88 | try: | |||
|
89 | cell = self.shell.history_manager.input_hist_parsed[-1] | |||
|
90 | except IndexError: | |||
|
91 | # some uses of ipshellembed may fail here | |||
88 | return False |
|
92 | return False | |
89 |
|
93 | |||
|
94 | return self.semicolon_at_end_of_expression(cell) | |||
|
95 | ||||
90 | @staticmethod |
|
96 | @staticmethod | |
91 | def semicolon_at_end_of_expression(expression): |
|
97 | def semicolon_at_end_of_expression(expression): | |
92 | """Parse Python expression and detects whether last token is ';'""" |
|
98 | """Parse Python expression and detects whether last token is ';'""" | |
@@ -281,6 +287,7 b' class DisplayHook(Configurable):' | |||||
281 | self.shell.user_ns.pop('_%i' % n, None) |
|
287 | self.shell.user_ns.pop('_%i' % n, None) | |
282 | oh.pop(n, None) |
|
288 | oh.pop(n, None) | |
283 |
|
289 | |||
|
290 | ||||
284 | def flush(self): |
|
291 | def flush(self): | |
285 | if not self.do_full_cache: |
|
292 | if not self.do_full_cache: | |
286 | raise ValueError("You shouldn't have reached the cache flush " |
|
293 | raise ValueError("You shouldn't have reached the cache flush " |
General Comments 0
You need to be logged in to leave comments.
Login now