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

Method restore_sys_module_state

IPython/core/interactiveshell.py:963–972  ·  view source on GitHub ↗

Restore the state of the sys module.

(self)

Source from the content-addressed store, hash-verified

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."""
965 try:
966 for k, v in self._orig_sys_module_state.items():
967 setattr(sys, k, v)
968 except AttributeError:
969 pass
970 # Reset what what done in self.init_sys_modules
971 if self._orig_sys_modules_main_mod is not None:
972 sys.modules[self._orig_sys_modules_main_name] = self._orig_sys_modules_main_mod
973
974 #-------------------------------------------------------------------------
975 # Things related to the banner

Callers 1

cleanupMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected