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

Method save_sys_module_state

IPython/core/interactiveshell.py:951–961  ·  view source on GitHub ↗

Save the state of hooks in the sys module. This has to be called after self.user_module is created.

(self)

Source from the content-addressed store, hash-verified

949 #-------------------------------------------------------------------------
950
951 def save_sys_module_state(self):
952 """Save the state of hooks in the sys module.
953
954 This has to be called after self.user_module is created.
955 """
956 self._orig_sys_module_state = {'stdin': sys.stdin,
957 'stdout': sys.stdout,
958 'stderr': sys.stderr,
959 'excepthook': sys.excepthook}
960 self._orig_sys_modules_main_name = self.user_module.__name__
961 self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__)
962
963 def restore_sys_module_state(self):
964 """Restore the state of the sys module."""

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected