MCPcopy Create free account
hub / github.com/ipython/ipython / flush

Method flush

IPython/core/displayhook.py:285–311  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

283
284
285 def flush(self):
286 if not self.do_full_cache:
287 raise ValueError("You shouldn't have reached the cache flush "
288 "if full caching is not enabled!")
289 # delete auto-generated vars from global namespace
290
291 for n in range(1,self.prompt_count + 1):
292 key = '_'+repr(n)
293 try:
294 del self.shell.user_ns[key]
295 except: pass
296 # In some embedded circumstances, the user_ns doesn't have the
297 # '_oh' key set up.
298 oh = self.shell.user_ns.get('_oh', None)
299 if oh is not None:
300 oh.clear()
301
302 # Release our own references to objects:
303 self._, self.__, self.___ = '', '', ''
304
305 if '_' not in builtin_mod.__dict__:
306 self.shell.user_ns.update({'_':self._,'__':self.__,'___':self.___})
307 import gc
308 # TODO: Is this really needed?
309 # IronPython blocks here forever
310 if sys.platform != "cli":
311 gc.collect()
312
313
314class CapturingDisplayHook(object):

Callers 15

init_codeMethod · 0.45
__call__Method · 0.45
show_exception_onlyMethod · 0.45
handlerMethod · 0.45
__call__Method · 0.45
logstartMethod · 0.45
log_writeMethod · 0.45
resetMethod · 0.45
finish_displayhookMethod · 0.45
__call__Method · 0.45
clear_outputFunction · 0.45
get_root_modulesFunction · 0.45

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected