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

Method load_extension

IPython/core/extensions.py:54–67  ·  view source on GitHub ↗

Load an IPython extension by its module name. Returns the string "already loaded" if the extension is already loaded, "no load function" if the module doesn't have a load_ipython_extension function, or None if it succeeded.

(self, module_str: str)

Source from the content-addressed store, hash-verified

52 self.loaded = set()
53
54 def load_extension(self, module_str: str):
55 """Load an IPython extension by its module name.
56
57 Returns the string "already loaded" if the extension is already loaded,
58 "no load function" if the module doesn't have a load_ipython_extension
59 function, or None if it succeeded.
60 """
61 try:
62 return self._load_extension(module_str)
63 except ModuleNotFoundError:
64 if module_str in BUILTINS_EXTS:
65 BUILTINS_EXTS[module_str] = True
66 return self._load_extension("IPython.extensions." + module_str)
67 raise
68
69 def _load_extension(self, module_str: str):
70 if module_str in self.loaded:

Callers 6

reload_extensionMethod · 0.95
init_extensionsMethod · 0.80
load_extMethod · 0.80
test_extension_loadingFunction · 0.80
test_extension_builtinsFunction · 0.80
test_non_extensionFunction · 0.80

Calls 1

_load_extensionMethod · 0.95

Tested by 3

test_extension_loadingFunction · 0.64
test_extension_builtinsFunction · 0.64
test_non_extensionFunction · 0.64