bundles / IPython 9.13.0 / IPython / core / magic / Magics / parse_options
function
IPython.core.magic:Magics.parse_options
source: /IPython/core/magic.py :687
Signature
def parse_options ( self , arg_str : str , opt_str : str , * long_opts : str , ** kw : Any ) → tuple[Any, Any] Summary
Parse options passed to an argument string.
Extended Summary
The interface is similar to that of getopt.getopt, but it returns a ~IPython.utils.struct.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.
Parameters
arg_str: strThe arguments to parse.
opt_str: strThe options specification.
mode: str, default 'string'If given as 'list', the argument string is returned as a list (split on whitespace) instead of a string.
list_all: bool, default FalsePut all option values in lists. Normally only options appearing more than once are put in a list.
posix: bool, default TrueWhether to split the input line in POSIX mode or not, as per the conventions outlined in the shlex module from the standard library.
Aliases
-
IPython.core.magic.Magics.parse_options