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

Method _find_with_lazy_load

IPython/core/interactiveshell.py:2462–2487  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 2

run_line_magicMethod · 0.95
run_cell_magicMethod · 0.95

Calls 2

run_line_magicMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected