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

Method save_sys_module_state

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

996 #-------------------------------------------------------------------------
997
998 def save_sys_module_state(self):
999 """Save the state of hooks in the sys module.
1000
1001 This has to be called after self.user_module is created.
1002 """
1003 self._orig_sys_module_state = {'stdin': sys.stdin,
1004 'stdout': sys.stdout,
1005 'stderr': sys.stderr,
1006 'excepthook': sys.excepthook}
1007 self._orig_sys_modules_main_name = self.user_module.__name__
1008 self._orig_sys_modules_main_mod = sys.modules.get(self.user_module.__name__)
1009
1010 def restore_sys_module_state(self):
1011 """Restore the state of the sys module."""

Callers 1

__init__Method · 0.95

Calls 1

getMethod · 0.80

Tested by

no test coverage detected