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

Method unload_extension

IPython/core/extensions.py:92–110  ·  view source on GitHub ↗

Unload an IPython extension by its module name. This function looks up the extension's name in ``sys.modules`` and simply calls ``mod.unload_ipython_extension(self)``. Returns the string "no unload function" if the extension doesn't define a function to unlo

(self, module_str)

Source from the content-addressed store, hash-verified

90 return "no load function"
91
92 def unload_extension(self, module_str):
93 """Unload an IPython extension by its module name.
94
95 This function looks up the extension's name in ``sys.modules`` and
96 simply calls ``mod.unload_ipython_extension(self)``.
97
98 Returns the string "no unload function" if the extension doesn't define
99 a function to unload itself, "not loaded" if the extension isn't loaded,
100 otherwise None.
101 """
102 if module_str not in self.loaded:
103 return "not loaded"
104
105 if module_str in sys.modules:
106 mod = sys.modules[module_str]
107 if self._call_unload_ipython_extension(mod):
108 self.loaded.discard(module_str)
109 else:
110 return "no unload function"
111
112 def reload_extension(self, module_str):
113 """Reload an IPython extension by calling reload.

Callers 3

reload_extensionMethod · 0.95
test_extension_loadingFunction · 0.80
unload_extMethod · 0.80

Calls 1

Tested by 1

test_extension_loadingFunction · 0.64