Inheritance diagram for IPython.DPyGetOpt:
DPyGetOpt – Demiurge Python GetOptions Module
This module is modeled after perl’s Getopt::Long module– which is, in turn, modeled after GNU’s extended getopt() function.
Upon instantiation, the option specification should be a sequence (list) of option definitions.
Options that take no arguments should simply contain the name of the option. If a ! is post-pended, the option can be negated by prepending ‘no’; ie ‘debug!’ specifies that -debug and -nodebug should be accepted.
Mandatory arguments to options are specified using a postpended ‘=’ + a type specifier. ‘=s’ specifies a mandatory string argument, ‘=i’ specifies a mandatory integer argument, and ‘=f’ specifies a mandatory real number. In all cases, the ‘=’ can be substituted with ‘:’ to specify that the argument is optional.
Dashes ‘-‘ in option names are allowed.
If an option has the character ‘@’ postpended (after the argumentation specification), it can appear multiple times within each argument list that is processed. The results will be stored in a list.
The option name can actually be a list of names separated by ‘|’ characters; ie– ‘foo|bar|baz=f@’ specifies that all -foo, -bar, and -baz options that appear on within the parsed argument list must have a real number argument and that the accumulated list of values will be available under the name ‘foo’
Bases: IPython.DPyGetOpt.Error
Exception indicating an error in the arguments passed to DPyGetOpt.processArguments.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Declare and intialize instance variables
Yes, declaration is not necessary... but one of the things I sorely miss from C/Obj-C is the concept of having an interface definition that clearly declares all instance variables and methods without providing any implementation
details. it is a useful reference!
all instance variables are initialized to 0/Null/None of the appropriate type– not even the default value...
Adds newTerm as terminator of option processing.
Whenever the option processor encounters one of the terminators during option processing, the processing of options terminates immediately, all remaining options are stored in the termValues instance variable and the full name of the terminator is stored in the terminator instance variable.
Returns 1 if the option processor will ignore case when processing options.
Returns the value of the posix compliance flag.
Processes args, a list of arguments (including options).
If args is the same as sys.argv, automatically trims the first argument (the executable name/path).
If an exception is not raised, the argument list was parsed correctly.
Upon successful completion, the freeValues instance variable will contain all the arguments that were not associated with an option in the order they were encountered. optionValues is a dictionary containing the value of each option– the method valueForOption() can be used to query this dictionary. terminator will contain the argument encountered that terminated option processing (or None, if a terminator was never encountered) and termValues will contain all of the options that appeared after the Terminator (or an empty list).
Enables and disables the expansion of abbreviations during option processing.
Enables and disables ignoring case during option processing.
Enables and disables posix compliance.
When enabled, ‘+’ can be used as an option prefix and free values can be mixed with options.
Return the value associated with optionName. If optionName was not encountered during parsing of the arguments, returns the defaultValue (which defaults to None).
Returns 1 if abbreviated options will be automatically expanded to the non-abbreviated form (instead of causing an unrecognized option error).
Bases: IPython.DPyGetOpt.Error
Exception indicating an error with an option specification.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Bases: IPython.DPyGetOpt.Error
Exception indicating an error with an option processing terminator.
x.__init__(...) initializes x; see x.__class__.__doc__ for signature