Show More
@@ -51,7 +51,7 b' class DisplayHook(Configurable):' | |||||
51 |
|
51 | |||
52 | # we need a reference to the user-level namespace |
|
52 | # we need a reference to the user-level namespace | |
53 | self.shell = shell |
|
53 | self.shell = shell | |
54 |
|
54 | |||
55 | self._,self.__,self.___ = '','','' |
|
55 | self._,self.__,self.___ = '','','' | |
56 |
|
56 | |||
57 | # these are deliberately global: |
|
57 | # these are deliberately global: | |
@@ -83,9 +83,15 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 | return False |
|
88 | try: | |
|
89 | cell = self.shell.history_manager.input_hist_parsed[-1] | |||
|
90 | except IndexError: | |||
|
91 | # some uses of ipshellembed may fail here | |||
|
92 | return False | |||
|
93 | ||||
|
94 | return self.semicolon_at_end_of_expression(cell) | |||
89 |
|
95 | |||
90 | @staticmethod |
|
96 | @staticmethod | |
91 | def semicolon_at_end_of_expression(expression): |
|
97 | def semicolon_at_end_of_expression(expression): | |
@@ -274,12 +280,13 b' class DisplayHook(Configurable):' | |||||
274 | cull_count = max(int(sz * self.cull_fraction), 2) |
|
280 | cull_count = max(int(sz * self.cull_fraction), 2) | |
275 | warn('Output cache limit (currently {sz} entries) hit.\n' |
|
281 | warn('Output cache limit (currently {sz} entries) hit.\n' | |
276 | 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count)) |
|
282 | 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count)) | |
277 |
|
283 | |||
278 | for i, n in enumerate(sorted(oh)): |
|
284 | for i, n in enumerate(sorted(oh)): | |
279 | if i >= cull_count: |
|
285 | if i >= cull_count: | |
280 | break |
|
286 | break | |
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) | |
|
289 | ||||
283 |
|
290 | |||
284 | def flush(self): |
|
291 | def flush(self): | |
285 | if not self.do_full_cache: |
|
292 | if not self.do_full_cache: |
General Comments 0
You need to be logged in to leave comments.
Login now