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

Method reload_extension

IPython/core/extensions.py:106–125  ·  view source on GitHub ↗

Reload an IPython extension by calling reload. If the module has not been loaded before, :meth:`InteractiveShell.load_extension` is called. Otherwise :func:`reload` is called and then the :func:`load_ipython_extension` function of the module, if it exists is called.

(self, module_str: str)

Source from the content-addressed store, hash-verified

104 return "no unload function"
105
106 def reload_extension(self, module_str: str):
107 """Reload an IPython extension by calling reload.
108
109 If the module has not been loaded before,
110 :meth:`InteractiveShell.load_extension` is called. Otherwise
111 :func:`reload` is called and then the :func:`load_ipython_extension`
112 function of the module, if it exists is called.
113 """
114
115 if BUILTINS_EXTS.get(module_str, False) is True:
116 module_str = "IPython.extensions." + module_str
117
118 if (module_str in self.loaded) and (module_str in sys.modules):
119 self.unload_extension(module_str)
120 mod = sys.modules[module_str]
121 reload(mod)
122 if self._call_load_ipython_extension(mod):
123 self.loaded.add(module_str)
124 else:
125 self.load_extension(module_str)
126
127 def _call_load_ipython_extension(self, mod):
128 if hasattr(mod, 'load_ipython_extension'):

Callers 3

reload_extMethod · 0.80
test_autorestoreFunction · 0.80
test_extension_loadingFunction · 0.80

Calls 6

unload_extensionMethod · 0.95
load_extensionMethod · 0.95
reloadFunction · 0.85
getMethod · 0.80
addMethod · 0.45

Tested by 2

test_autorestoreFunction · 0.64
test_extension_loadingFunction · 0.64