Abstract base class.
Class attributes:
standard_option_list : [Option]
list of standard options that will be accepted by all instances
of this parser class (intended to be overridden by subclasses).
Instance attributes:
option_list : [Option]
the list of Option objects contained by this OptionContainer
_short_opt : { string : Option }
dictionary mapping short option strings, eg. "-f" or "-X",
to the Option instances that implement them. If an Option
has multiple short option strings, it will appears in this
dictionary multiple times. [1]
_long_opt : { string : Option }
dictionary mapping long option strings, eg. "--file" or
"--exclude", to the Option instances that implement them.
Again, a given Option can occur multiple times in this
dictionary. [1]
defaults : { string : any }
dictionary mapping option destination names to default
values for each destination [1]
[1] These mappings are common to (shared by) all components of the
controlling OptionParser, where they are initially created.
Methods
|
|
|
|
__init__
|
__init__ (
self,
option_class,
conflict_handler,
description,
)
|
|
_check_conflict
|
_check_conflict ( self, option )
Exceptions
|
|
OptionConflictError( "conflicting option string(s): %s" % ", ".join([ co [ 0 ] for co in conflict_opts ] ), option )
|
|
|
_create_option_mappings
|
_create_option_mappings ( self )
|
|
_share_option_mappings
|
_share_option_mappings ( self, parser )
|
|
add_option
|
add_option (
self,
*args,
*kwargs,
)
add_option(Option)
add_option(opt_str, ..., kwarg=val, ...)
Exceptions
|
|
TypeError, "invalid arguments"
TypeError, "not an Option instance: %r" % option
|
|
|
add_options
|
add_options ( self, option_list )
|
|
format_description
|
format_description ( self, formatter )
|
|
format_help
|
format_help ( self, formatter )
|
|
format_option_help
|
format_option_help ( self, formatter )
|
|
get_description
|
get_description ( self )
|
|
get_option
|
get_option ( self, opt_str )
|
|
has_option
|
has_option ( self, opt_str )
|
|
remove_option
|
remove_option ( self, opt_str )
Exceptions
|
|
ValueError( "no such option %r" % opt_str )
|
|
|
set_conflict_handler
|
set_conflict_handler ( self, handler )
Exceptions
|
|
ValueError, "invalid conflict_resolution value %r" % handler
|
|
|
set_description
|
set_description ( self, description )
|
|