Try to find a magic potentially lazy-loading it. Parameters ---------- type_: "line"|"cell" the type of magics we are trying to find/lazy load. magic_name: str The name of the magic we are trying to find/lazy load Note that
(self, /, type_, magic_name: str)
| 2460 | ) |
| 2461 | |
| 2462 | def _find_with_lazy_load(self, /, type_, magic_name: str): |
| 2463 | """ |
| 2464 | Try to find a magic potentially lazy-loading it. |
| 2465 | |
| 2466 | Parameters |
| 2467 | ---------- |
| 2468 | |
| 2469 | type_: "line"|"cell" |
| 2470 | the type of magics we are trying to find/lazy load. |
| 2471 | magic_name: str |
| 2472 | The name of the magic we are trying to find/lazy load |
| 2473 | |
| 2474 | |
| 2475 | Note that this may have any side effects |
| 2476 | """ |
| 2477 | finder = {"line": self.find_line_magic, "cell": self.find_cell_magic}[type_] |
| 2478 | fn = finder(magic_name) |
| 2479 | if fn is not None: |
| 2480 | return fn |
| 2481 | lazy = self.magics_manager.lazy_magics.get(magic_name) |
| 2482 | if lazy is None: |
| 2483 | return None |
| 2484 | |
| 2485 | self.run_line_magic("load_ext", lazy) |
| 2486 | res = finder(magic_name) |
| 2487 | return res |
| 2488 | |
| 2489 | def run_line_magic(self, magic_name: str, line: str, _stack_depth=1): |
| 2490 | """Execute the given line magic. |
no test coverage detected