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

Method flush

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

Source from the content-addressed store, hash-verified

299 oh.pop(n, None)
300
301 def flush(self):
302 if not self.do_full_cache:
303 raise ValueError("You shouldn't have reached the cache flush "
304 "if full caching is not enabled!")
305 # delete auto-generated vars from global namespace
306
307 for n in range(1,self.prompt_count + 1):
308 key = '_'+repr(n)
309 try:
310 del self.shell.user_ns_hidden[key]
311 except KeyError:
312 pass
313 try:
314 del self.shell.user_ns[key]
315 except KeyError:
316 pass
317 # In some embedded circumstances, the user_ns doesn't have the
318 # '_oh' key set up.
319 oh = self.shell.user_ns.get('_oh', None)
320 if oh is not None:
321 oh.clear()
322
323 # Release our own references to objects:
324 self._, self.__, self.___ = '', '', ''
325
326 if '_' not in builtin_mod.__dict__:
327 self.shell.user_ns.update({'_':self._,'__':self.__,'___':self.___})
328 import gc
329 # TODO: Is this really needed?
330 # IronPython blocks here forever
331 if sys.platform != "cli":
332 gc.collect()
333
334
335class CapturingDisplayHook:

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
atexit_operationsMethod · 0.45
clear_outputFunction · 0.45
handlerMethod · 0.45
finish_displayhookMethod · 0.45

Calls 3

getMethod · 0.80
updateMethod · 0.45
collectMethod · 0.45

Tested by

no test coverage detected