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

Method __init__

IPython/core/interactiveshell.py:621–694  ·  view source on GitHub ↗
(self, ipython_dir=None, profile_dir=None,
                 user_module=None, user_ns=None,
                 custom_exceptions=((), None), **kwargs)

Source from the content-addressed store, hash-verified

619 last_execution_result = Instance('IPython.core.interactiveshell.ExecutionResult', help='Result of executing the last command', allow_none=True)
620
621 def __init__(self, ipython_dir=None, profile_dir=None,
622 user_module=None, user_ns=None,
623 custom_exceptions=((), None), **kwargs):
624 # This is where traits with a config_key argument are updated
625 # from the values on config.
626 super(InteractiveShell, self).__init__(**kwargs)
627 self.configurables = [self]
628
629 # These are relatively independent and stateless
630 self.init_ipython_dir(ipython_dir)
631 self.init_profile_dir(profile_dir)
632 self.init_instance_attrs()
633 self.init_environment()
634
635 # Check if we're in a virtualenv, and set up sys.path.
636 self.init_virtualenv()
637
638 # Create namespaces (user_ns, user_global_ns, etc.)
639 self.init_create_namespaces(user_module, user_ns)
640 # This has to be done after init_create_namespaces because it uses
641 # something in self.user_ns, but before init_sys_modules, which
642 # is the first thing to modify sys.
643 # TODO: When we override sys.stdout and sys.stderr before this class
644 # is created, we are saving the overridden ones here. Not sure if this
645 # is what we want to do.
646 self.save_sys_module_state()
647 self.init_sys_modules()
648
649 # While we're trying to have each part of the code directly access what
650 # it needs without keeping redundant references to objects, we have too
651 # much legacy code that expects ip.db to exist.
652 self.db = PickleShareDB(os.path.join(self.profile_dir.location, 'db'))
653
654 self.init_history()
655 self.init_encoding()
656 self.init_prefilter()
657
658 self.init_syntax_highlighting()
659 self.init_hooks()
660 self.init_events()
661 self.init_pushd_popd_magic()
662 self.init_user_ns()
663 self.init_logger()
664 self.init_builtins()
665
666 # The following was in post_config_initialization
667 self.raw_input_original = input
668 self.init_completer()
669 # TODO: init_io() needs to happen before init_traceback handlers
670 # because the traceback handlers hardcode the stdout/stderr streams.
671 # This logic in in debugger.Pdb and should eventually be changed.
672 self.init_io()
673 self.init_traceback_handlers(custom_exceptions)
674 self.init_prompts()
675 self.init_display_formatter()
676 self.init_display_pub()
677 self.init_data_pub()
678 self.init_displayhook()

Callers

nothing calls this directly

Calls 15

init_ipython_dirMethod · 0.95
init_profile_dirMethod · 0.95
init_instance_attrsMethod · 0.95
init_environmentMethod · 0.95
init_virtualenvMethod · 0.95
save_sys_module_stateMethod · 0.95
init_sys_modulesMethod · 0.95
init_historyMethod · 0.95
init_encodingMethod · 0.95
init_prefilterMethod · 0.95

Tested by

no test coverage detected