MCPcopy Index your code
hub / github.com/ipython/ipython / cull_cache

Method cull_cache

IPython/core/displayhook.py:287–299  ·  view source on GitHub ↗

Output cache is full, cull the oldest entries

(self)

Source from the content-addressed store, hash-verified

285 self.finish_displayhook()
286
287 def cull_cache(self):
288 """Output cache is full, cull the oldest entries"""
289 oh = self.shell.user_ns.get('_oh', {})
290 sz = len(oh)
291 cull_count = max(int(sz * self.cull_fraction), 2)
292 warn('Output cache limit (currently {sz} entries) hit.\n'
293 'Flushing oldest {cull_count} entries.'.format(sz=sz, cull_count=cull_count))
294
295 for i, n in enumerate(sorted(oh)):
296 if i >= cull_count:
297 break
298 self.shell.user_ns.pop('_%i' % n, None)
299 oh.pop(n, None)
300
301 def flush(self):
302 if not self.do_full_cache:

Callers 1

update_user_nsMethod · 0.95

Calls 3

getMethod · 0.80
popMethod · 0.80
formatMethod · 0.45

Tested by

no test coverage detected