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

Method __init__

IPython/core/interactiveshell.py:624–703  ·  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

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

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