| |
- Method resolution order:
- MyParse
- optparse.OptionParser
- optparse.OptionContainer
Methods defined here:
- print_help(self, errors=None)
Methods inherited from optparse.OptionParser:
- __init__(self, usage=None, option_list=None, option_class=<class optparse.Option>, version=None, conflict_handler='error', description=None, formatter=None, add_help_option=True, prog=None)
- add_option_group(self, *args, **kwargs)
- check_values(self, values, args)
- check_values(values : Values, args : [string])
-> (values : Values, args : [string])
Check that the supplied option values and leftover arguments are
valid. Returns the option values and leftover arguments
(possibly adjusted, possibly completely new -- whatever you
like). Default implementation just returns the passed-in
values; subclasses may override as desired.
- disable_interspersed_args(self)
- enable_interspersed_args(self)
- error(self, msg)
- error(msg : string)
Print a usage message incorporating 'msg' to stderr and exit.
If you override this in a subclass, it should not return -- it
should either exit or raise an exception.
- exit(self, status=0, msg=None)
- expand_prog_name(self, s)
- format_help(self, formatter=None)
- format_option_help(self, formatter=None)
- get_default_values(self)
- get_description(self)
- get_option_group(self, opt_str)
- get_prog_name(self)
- get_usage(self)
- get_version(self)
- parse_args(self, args=None, values=None)
- parse_args(args : [string] = sys.argv[1:],
values : Values = None)
-> (values : Values, args : [string])
Parse the command-line options found in 'args' (default:
sys.argv[1:]). Any errors result in a call to 'error()', which
by default prints the usage message to stderr and calls
sys.exit() with an error message. On success returns a pair
(values, args) where 'values' is an Values instance (with all
your option values) and 'args' is the list of arguments left
over after parsing options.
- print_usage(self, file=None)
- print_usage(file : file = stdout)
Print the usage message for the current program (self.usage) to
'file' (default stdout). Any occurence of the string "%prog" in
self.usage is replaced with the name of the current program
(basename of sys.argv[0]). Does nothing if self.usage is empty
or not defined.
- print_version(self, file=None)
- print_version(file : file = stdout)
Print the version message for this program (self.version) to
'file' (default stdout). As with print_usage(), any occurence
of "%prog" in self.version is replaced by the current program's
name. Does nothing if self.version is empty or undefined.
- set_default(self, dest, value)
- set_defaults(self, **kwargs)
- set_process_default_values(self, process)
- set_usage(self, usage)
Data and other attributes inherited from optparse.OptionParser:
- standard_option_list = []
Methods inherited from optparse.OptionContainer:
- add_option(self, *args, **kwargs)
- add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
- add_options(self, option_list)
- format_description(self, formatter)
- get_option(self, opt_str)
- has_option(self, opt_str)
- remove_option(self, opt_str)
- set_conflict_handler(self, handler)
- set_description(self, description)
|