Inheritance diagram for IPython.core.magics.auto:
Implementation of magic functions that control various automatic behaviors.
Magics that control various autoX behaviors.
Print docstring if incorrect arguments were passed
Make functions callable without having to type parentheses.
The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the value is toggled on and off (remembering the previous state).
In more detail, these values mean:
0 -> fully disabled
1 -> active, but do not apply if there are no arguments on the line.
In this mode, you get:
In : callable Out: <built-in function callable> In : callable 'hello' ------> callable('hello') Out: False
2 -> Active always. Even if no arguments are present, the callable object is called:
In : float ------> float() Out: 0.0
Note that even with autocall off, you can still use ‘/’ at the start of a line to treat the first argument on the command line as a function and add parentheses to it:
In : /str 43 ------> str(43) Out: '43'
# all-random (note for auto-testing)
Make magic functions callable without having to type the initial %.
Without argumentsl 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
- off, 0, False: to deactivate.
Note that magic functions have lowest priority, so if there’s a variable whose name collides with that of a magic fn, automagic won’t work for that function (you get the variable instead). However, if you delete the variable (del var), the previously shadowed magic function becomes visible to automagic again.
Make an entry in the options_table for fn, with value optstr
Format a string for latex inclusion.
Parse options passed to an argument string.
The interface is similar to that of getopt(), but it returns back a Struct with the options as keys and the stripped argument string still as a string.
arg_str is quoted as a true sys.argv vector by using shlex.split. This allows us to easily expand variables, glob files, quote arguments, etc.
-mode: default ‘string’. If given as ‘list’, the argument string is returned as a list (split on whitespace) instead of a string.
-list_all: put all option values in lists. Normally only options appearing more than once are put in a list.
-posix (True): whether to split the input line in POSIX mode or not, as per the conventions outlined in the shlex module from the standard library.