DEPRECATED. Use run_line_magic() instead. Call a magic function by name. Input: a string containing the name of the magic function to call and any additional arguments to be passed to the magic. magic('name -opt foo bar') is equivalent to typing at the ipython
(self, arg_s)
| 2400 | return self.magics_manager.magics[magic_kind].get(magic_name) |
| 2401 | |
| 2402 | def magic(self, arg_s): |
| 2403 | """DEPRECATED. Use run_line_magic() instead. |
| 2404 | |
| 2405 | Call a magic function by name. |
| 2406 | |
| 2407 | Input: a string containing the name of the magic function to call and |
| 2408 | any additional arguments to be passed to the magic. |
| 2409 | |
| 2410 | magic('name -opt foo bar') is equivalent to typing at the ipython |
| 2411 | prompt: |
| 2412 | |
| 2413 | In[1]: %name -opt foo bar |
| 2414 | |
| 2415 | To call a magic without arguments, simply use magic('name'). |
| 2416 | |
| 2417 | This provides a proper Python function to call IPython's magics in any |
| 2418 | valid Python code you can type at the interpreter, including loops and |
| 2419 | compound statements. |
| 2420 | """ |
| 2421 | # TODO: should we issue a loud deprecation warning here? |
| 2422 | magic_name, _, magic_arg_s = arg_s.partition(' ') |
| 2423 | magic_name = magic_name.lstrip(prefilter.ESC_MAGIC) |
| 2424 | return self.run_line_magic(magic_name, magic_arg_s, _stack_depth=2) |
| 2425 | |
| 2426 | #------------------------------------------------------------------------- |
| 2427 | # Things related to macros |
no test coverage detected