diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-10-14 09:57:42 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-10-14 10:17:49 +0300 |
commit | f13bfc9a1e469983083b02e19cf963678ace66c0 (patch) | |
tree | 08bbf5b3ec11f1ce4aa614c451089b74caec35e2 /contrib/python/ipython/py3/IPython/core/displayhook.py | |
parent | 82c487106cdf6fa8ae9a18967e53de52fb52e4e8 (diff) | |
download | ydb-f13bfc9a1e469983083b02e19cf963678ace66c0.tar.gz |
Update contrib/python/ipython/py3 to 8.16.0
Diffstat (limited to 'contrib/python/ipython/py3/IPython/core/displayhook.py')
-rw-r--r-- | contrib/python/ipython/py3/IPython/core/displayhook.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/contrib/python/ipython/py3/IPython/core/displayhook.py b/contrib/python/ipython/py3/IPython/core/displayhook.py index b411f11613..1ea8d8506f 100644 --- a/contrib/python/ipython/py3/IPython/core/displayhook.py +++ b/contrib/python/ipython/py3/IPython/core/displayhook.py @@ -51,7 +51,7 @@ class DisplayHook(Configurable): # we need a reference to the user-level namespace self.shell = shell - + self._,self.__,self.___ = '','','' # these are deliberately global: @@ -83,15 +83,9 @@ class DisplayHook(Configurable): def quiet(self): """Should we silence the display hook because of ';'?""" - # do not print output if input ends in ';' - - try: - cell = self.shell.history_manager.input_hist_parsed[-1] - except IndexError: - # some uses of ipshellembed may fail here - return False - - return self.semicolon_at_end_of_expression(cell) + if self.exec_result is not None: + return self.semicolon_at_end_of_expression(self.exec_result.info.raw_cell) + return False @staticmethod def semicolon_at_end_of_expression(expression): @@ -280,13 +274,12 @@ class DisplayHook(Configurable): cull_count = max(int(sz * self.cull_fraction), 2) warn('Output cache limit (currently {sz} entries) hit.\n' 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count)) - + for i, n in enumerate(sorted(oh)): if i >= cull_count: break self.shell.user_ns.pop('_%i' % n, None) oh.pop(n, None) - def flush(self): if not self.do_full_cache: |