Call the magic alias.
(self, *args: Any, **kwargs: Any)
| 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 |
nothing calls this directly
no test coverage detected