MCPcopy Create free account
hub / github.com/ipython/ipython / __call__

Method __call__

IPython/core/magic.py:685–703  ·  view source on GitHub ↗

Call the magic alias.

(self, *args, **kwargs)

Source from the content-addressed store, hash-verified

683 self._in_call = False
684
685 def __call__(self, *args, **kwargs):
686 """Call the magic alias."""
687 fn = self.shell.find_magic(self.magic_name, self.magic_kind)
688 if fn is None:
689 raise UsageError("Magic `%s` not found." % self.pretty_target)
690
691 # Protect against infinite recursion.
692 if self._in_call:
693 raise UsageError("Infinite recursion detected; "
694 "magic aliases cannot call themselves.")
695 self._in_call = True
696 try:
697 if self.magic_params:
698 args_list = list(args)
699 args_list[0] = self.magic_params + " " + args[0]
700 args = tuple(args_list)
701 return fn(*args, **kwargs)
702 finally:
703 self._in_call = False

Callers

nothing calls this directly

Calls 2

UsageErrorClass · 0.85
find_magicMethod · 0.80

Tested by

no test coverage detected