Mark a magic function as not needing variable expansion By default, IPython interprets `{a}` or `$a` in the line passed to magics as variables that should be interpolated from the interactive namespace before passing the line to the magic function. This is not always desirable, e.g.
(magic_func)
| 269 | |
| 270 | |
| 271 | def no_var_expand(magic_func): |
| 272 | """Mark a magic function as not needing variable expansion |
| 273 | |
| 274 | By default, IPython interprets `{a}` or `$a` in the line passed to magics |
| 275 | as variables that should be interpolated from the interactive namespace |
| 276 | before passing the line to the magic function. |
| 277 | This is not always desirable, e.g. when the magic executes Python code |
| 278 | (%timeit, %time, etc.). |
| 279 | Decorate magics with `@no_var_expand` to opt-out of variable expansion. |
| 280 | |
| 281 | .. versionadded:: 7.3 |
| 282 | """ |
| 283 | setattr(magic_func, MAGIC_NO_VAR_EXPAND_ATTR, True) |
| 284 | return magic_func |
| 285 | |
| 286 | |
| 287 | # Create the actual decorators for public use |
nothing calls this directly
no outgoing calls
no test coverage detected