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)
| 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: |