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

Method mainloop

IPython/terminal/interactiveshell.py:557–576  ·  view source on GitHub ↗
(self, display_banner=DISPLAY_BANNER_DEPRECATED)

Source from the content-addressed store, hash-verified

555 self.run_cell(code, store_history=True)
556
557 def mainloop(self, display_banner=DISPLAY_BANNER_DEPRECATED):
558 # An extra layer of protection in case someone mashing Ctrl-C breaks
559 # out of our internal code.
560 if display_banner is not DISPLAY_BANNER_DEPRECATED:
561 warn('mainloop `display_banner` argument is deprecated since IPython 5.0. Call `show_banner()` if needed.', DeprecationWarning, stacklevel=2)
562 while True:
563 try:
564 self.interact()
565 break
566 except KeyboardInterrupt as e:
567 print("\n%s escaped interact()\n" % type(e).__name__)
568 finally:
569 # An interrupt during the eventloop will mess up the
570 # internal state of the prompt_toolkit library.
571 # Stopping the eventloop fixes this, see
572 # https://github.com/ipython/ipython/pull/9867
573 if hasattr(self, '_eventloop'):
574 self._eventloop.stop()
575
576 self.restore_term_title()
577
578
579 _inputhook = None

Callers

nothing calls this directly

Calls 3

interactMethod · 0.95
restore_term_titleMethod · 0.95
stopMethod · 0.80

Tested by

no test coverage detected