Make magic functions callable without having to type the initial %. Without arguments toggles on/off (when off, you must call it as %automagic, of course). With arguments it sets the value, and you can use any of (case insensitive): - on, 1, True: to activate
(self, parameter_s='')
| 32 | |
| 33 | @line_magic |
| 34 | def automagic(self, parameter_s=''): |
| 35 | """Make magic functions callable without having to type the initial %. |
| 36 | |
| 37 | Without arguments toggles on/off (when off, you must call it as |
| 38 | %automagic, of course). With arguments it sets the value, and you can |
| 39 | use any of (case insensitive): |
| 40 | |
| 41 | - on, 1, True: to activate |
| 42 | |
| 43 | - off, 0, False: to deactivate. |
| 44 | |
| 45 | Note that magic functions have lowest priority, so if there's a |
| 46 | variable whose name collides with that of a magic fn, automagic won't |
| 47 | work for that function (you get the variable instead). However, if you |
| 48 | delete the variable (del var), the previously shadowed magic function |
| 49 | becomes visible to automagic again.""" |
| 50 | |
| 51 | arg = parameter_s.lower() |
| 52 | mman = self.shell.magics_manager |
| 53 | if arg in ('on', '1', 'true'): |
| 54 | val = True |
| 55 | elif arg in ('off', '0', 'false'): |
| 56 | val = False |
| 57 | else: |
| 58 | val = not mman.auto_magic |
| 59 | mman.auto_magic = val |
| 60 | print('\n' + self.shell.magics_manager.auto_status()) |
| 61 | |
| 62 | @skip_doctest |
| 63 | @line_magic |
nothing calls this directly
no test coverage detected