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

Method __call__

IPython/core/magic.py:808–827  ·  view source on GitHub ↗

Call the magic alias.

(self, *args: Any, **kwargs: Any)

Source from the content-addressed store, hash-verified

806 self._in_call = False
807
808 def __call__(self, *args: Any, **kwargs: Any) -> Any:
809 """Call the magic alias."""
810 fn = self.shell.find_magic(self.magic_name, self.magic_kind) # type: ignore[no-untyped-call]
811 if fn is None:
812 raise UsageError("Magic `%s` not found." % self.pretty_target)
813
814 # Protect against infinite recursion.
815 if self._in_call:
816 raise UsageError(
817 "Infinite recursion detected; magic aliases cannot call themselves."
818 )
819 self._in_call = True
820 try:
821 if self.magic_params:
822 args_list = list(args)
823 args_list[0] = self.magic_params + " " + args[0]
824 args = tuple(args_list)
825 return fn(*args, **kwargs)
826 finally:
827 self._in_call = False

Callers

nothing calls this directly

Calls 2

UsageErrorClass · 0.85
find_magicMethod · 0.80

Tested by

no test coverage detected