CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Member Functions | Private Attributes

argparse::_ActionsContainer Class Reference

Inheritance diagram for argparse::_ActionsContainer:
argparse::_ArgumentGroup argparse::_ArgumentGroup argparse::ArgumentParser argparse::ArgumentParser argparse::_MutuallyExclusiveGroup argparse::_MutuallyExclusiveGroup argparse::_MutuallyExclusiveGroup argparse::_MutuallyExclusiveGroup

List of all members.

Public Member Functions

def __init__
def __init__
def add_argument
def add_argument
def add_argument_group
def add_argument_group
def add_mutually_exclusive_group
def add_mutually_exclusive_group
def get_default
def register
def register
def set_defaults
def set_defaults

Public Attributes

 argument_default
 conflict_handler
 description
 prefix_chars

Private Member Functions

def _add_action
def _add_action
def _add_container_actions
def _add_container_actions
def _check_conflict
def _check_conflict
def _get_handler
def _get_handler
def _get_optional_kwargs
def _get_optional_kwargs
def _get_positional_kwargs
def _get_positional_kwargs
def _handle_conflict_error
def _handle_conflict_error
def _handle_conflict_resolve
def _handle_conflict_resolve
def _pop_action_class
def _pop_action_class
def _registry_get
def _registry_get
def _remove_action
def _remove_action

Private Attributes

 _action_groups
 _actions
 _defaults
 _has_negative_number_optionals
 _mutually_exclusive_groups
 _negative_number_matcher
 _option_string_actions
 _registries

Detailed Description

Definition at line 1167 of file argparse.py.


Constructor & Destructor Documentation

def argparse::_ActionsContainer::__init__ (   self,
  description,
  prefix_chars,
  argument_default,
  conflict_handler 
)

Reimplemented in argparse::_ArgumentGroup, and argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

01174                                   :
01175         super(_ActionsContainer, self).__init__()
01176 
01177         self.description = description
01178         self.argument_default = argument_default
01179         self.prefix_chars = prefix_chars
01180         self.conflict_handler = conflict_handler
01181 
01182         # set up registries
01183         self._registries = {}
01184 
01185         # register actions
01186         self.register('action', None, _StoreAction)
01187         self.register('action', 'store', _StoreAction)
01188         self.register('action', 'store_const', _StoreConstAction)
01189         self.register('action', 'store_true', _StoreTrueAction)
01190         self.register('action', 'store_false', _StoreFalseAction)
01191         self.register('action', 'append', _AppendAction)
01192         self.register('action', 'append_const', _AppendConstAction)
01193         self.register('action', 'count', _CountAction)
01194         self.register('action', 'help', _HelpAction)
01195         self.register('action', 'version', _VersionAction)
01196         self.register('action', 'parsers', _SubParsersAction)
01197 
01198         # raise an exception if the conflict handler is invalid
01199         self._get_handler()
01200 
01201         # action storage
01202         self._actions = []
01203         self._option_string_actions = {}
01204 
01205         # groups
01206         self._action_groups = []
01207         self._mutually_exclusive_groups = []
01208 
01209         # defaults storage
01210         self._defaults = {}
01211 
01212         # determines whether an "option" looks like a negative number
01213         self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$')
01214 
01215         # whether or not there are any optionals that look like negative
01216         # numbers -- uses a list so it can be shared and edited
01217         self._has_negative_number_optionals = []

def argparse::_ActionsContainer::__init__ (   self,
  description,
  prefix_chars,
  argument_default,
  conflict_handler 
)

Reimplemented in argparse::_ArgumentGroup, and argparse::_ArgumentGroup.

Definition at line 1163 of file argparse.py.

01167                                   :
01168         super(_ActionsContainer, self).__init__()
01169 
01170         self.description = description
01171         self.argument_default = argument_default
01172         self.prefix_chars = prefix_chars
01173         self.conflict_handler = conflict_handler
01174 
01175         # set up registries
01176         self._registries = {}
01177 
01178         # register actions
01179         self.register('action', None, _StoreAction)
01180         self.register('action', 'store', _StoreAction)
01181         self.register('action', 'store_const', _StoreConstAction)
01182         self.register('action', 'store_true', _StoreTrueAction)
01183         self.register('action', 'store_false', _StoreFalseAction)
01184         self.register('action', 'append', _AppendAction)
01185         self.register('action', 'append_const', _AppendConstAction)
01186         self.register('action', 'count', _CountAction)
01187         self.register('action', 'help', _HelpAction)
01188         self.register('action', 'version', _VersionAction)
01189         self.register('action', 'parsers', _SubParsersAction)
01190 
01191         # raise an exception if the conflict handler is invalid
01192         self._get_handler()
01193 
01194         # action storage
01195         self._actions = []
01196         self._option_string_actions = {}
01197 
01198         # groups
01199         self._action_groups = []
01200         self._mutually_exclusive_groups = []
01201 
01202         # defaults storage
01203         self._defaults = {}
01204 
01205         # determines whether an "option" looks like a negative number
01206         self._negative_number_matcher = _re.compile(r'^-\d+|-\d*.\d+$')
01207 
01208         # whether or not there are any optionals that look like negative
01209         # numbers -- uses a list so it can be shared and edited
01210         self._has_negative_number_optionals = []
01211 

Member Function Documentation

def argparse::_ActionsContainer::_add_action (   self,
  action 
) [private]

Reimplemented in argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, argparse::ArgumentParser, argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, and argparse::ArgumentParser.

Definition at line 1307 of file argparse.py.

01308                                  :
01309         # resolve any conflicts
01310         self._check_conflict(action)
01311 
01312         # add to actions list
01313         self._actions.append(action)
01314         action.container = self
01315 
01316         # index the action by any option strings it has
01317         for option_string in action.option_strings:
01318             self._option_string_actions[option_string] = action
01319 
01320         # set the flag if any option strings look like negative numbers
01321         for option_string in action.option_strings:
01322             if self._negative_number_matcher.match(option_string):
01323                 if not self._has_negative_number_optionals:
01324                     self._has_negative_number_optionals.append(True)
01325 
01326         # return the created action
01327         return action

def argparse::_ActionsContainer::_add_action (   self,
  action 
) [private]

Reimplemented in argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, argparse::ArgumentParser, argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, and argparse::ArgumentParser.

Definition at line 1277 of file argparse.py.

01277                                  :
01278         # resolve any conflicts
01279         self._check_conflict(action)
01280 
01281         # add to actions list
01282         self._actions.append(action)
01283         action.container = self
01284 
01285         # index the action by any option strings it has
01286         for option_string in action.option_strings:
01287             self._option_string_actions[option_string] = action
01288 
01289         # set the flag if any option strings look like negative numbers
01290         for option_string in action.option_strings:
01291             if self._negative_number_matcher.match(option_string):
01292                 if not self._has_negative_number_optionals:
01293                     self._has_negative_number_optionals.append(True)
01294 
01295         # return the created action
01296         return action
01297 
def argparse::_ActionsContainer::_add_container_actions (   self,
  container 
) [private]

Definition at line 1331 of file argparse.py.

01332                                                :
01333         # collect groups by titles
01334         title_group_map = {}
01335         for group in self._action_groups:
01336             if group.title in title_group_map:
01337                 msg = _('cannot merge actions - two groups are named %r')
01338                 raise ValueError(msg % (group.title))
01339             title_group_map[group.title] = group
01340 
01341         # map each action to its group
01342         group_map = {}
01343         for group in container._action_groups:
01344 
01345             # if a group with the title exists, use that, otherwise
01346             # create a new group matching the container's group
01347             if group.title not in title_group_map:
01348                 title_group_map[group.title] = self.add_argument_group(
01349                     title=group.title,
01350                     description=group.description,
01351                     conflict_handler=group.conflict_handler)
01352 
01353             # map the actions to their new group
01354             for action in group._group_actions:
01355                 group_map[action] = title_group_map[group.title]
01356 
01357         # add container's mutually exclusive groups
01358         # NOTE: if add_mutually_exclusive_group ever gains title= and
01359         # description= then this code will need to be expanded as above
01360         for group in container._mutually_exclusive_groups:
01361             mutex_group = self.add_mutually_exclusive_group(
01362                 required=group.required)
01363 
01364             # map the actions to their new mutex group
01365             for action in group._group_actions:
01366                 group_map[action] = mutex_group
01367 
01368         # add all actions to this container or their group
01369         for action in container._actions:
01370             group_map.get(action, self)._add_action(action)

def argparse::_ActionsContainer::_add_container_actions (   self,
  container 
) [private]

Definition at line 1301 of file argparse.py.

01301                                                :
01302         # collect groups by titles
01303         title_group_map = {}
01304         for group in self._action_groups:
01305             if group.title in title_group_map:
01306                 msg = _('cannot merge actions - two groups are named %r')
01307                 raise ValueError(msg % (group.title))
01308             title_group_map[group.title] = group
01309 
01310         # map each action to its group
01311         group_map = {}
01312         for group in container._action_groups:
01313 
01314             # if a group with the title exists, use that, otherwise
01315             # create a new group matching the container's group
01316             if group.title not in title_group_map:
01317                 title_group_map[group.title] = self.add_argument_group(
01318                     title=group.title,
01319                     description=group.description,
01320                     conflict_handler=group.conflict_handler)
01321 
01322             # map the actions to their new group
01323             for action in group._group_actions:
01324                 group_map[action] = title_group_map[group.title]
01325 
01326         # add container's mutually exclusive groups
01327         # NOTE: if add_mutually_exclusive_group ever gains title= and
01328         # description= then this code will need to be expanded as above
01329         for group in container._mutually_exclusive_groups:
01330             mutex_group = self.add_mutually_exclusive_group(
01331                 required=group.required)
01332 
01333             # map the actions to their new mutex group
01334             for action in group._group_actions:
01335                 group_map[action] = mutex_group
01336 
01337         # add all actions to this container or their group
01338         for action in container._actions:
01339             group_map.get(action, self)._add_action(action)
01340 
def argparse::_ActionsContainer::_check_conflict (   self,
  action 
) [private]

Definition at line 1435 of file argparse.py.

01436                                      :
01437 
01438         # find all options that conflict with this option
01439         confl_optionals = []
01440         for option_string in action.option_strings:
01441             if option_string in self._option_string_actions:
01442                 confl_optional = self._option_string_actions[option_string]
01443                 confl_optionals.append((option_string, confl_optional))
01444 
01445         # resolve any conflicts
01446         if confl_optionals:
01447             conflict_handler = self._get_handler()
01448             conflict_handler(action, confl_optionals)

def argparse::_ActionsContainer::_check_conflict (   self,
  action 
) [private]

Definition at line 1414 of file argparse.py.

01414                                      :
01415 
01416         # find all options that conflict with this option
01417         confl_optionals = []
01418         for option_string in action.option_strings:
01419             if option_string in self._option_string_actions:
01420                 confl_optional = self._option_string_actions[option_string]
01421                 confl_optionals.append((option_string, confl_optional))
01422 
01423         # resolve any conflicts
01424         if confl_optionals:
01425             conflict_handler = self._get_handler()
01426             conflict_handler(action, confl_optionals)
01427 
def argparse::_ActionsContainer::_get_handler (   self) [private]

Definition at line 1405 of file argparse.py.

01405                           :
01406         # determine function from conflict handler string
01407         handler_func_name = '_handle_conflict_%s' % self.conflict_handler
01408         try:
01409             return getattr(self, handler_func_name)
01410         except AttributeError:
01411             msg = _('invalid conflict_resolution value: %r')
01412             raise ValueError(msg % self.conflict_handler)
01413 
def argparse::_ActionsContainer::_get_handler (   self) [private]

Definition at line 1426 of file argparse.py.

01427                           :
01428         # determine function from conflict handler string
01429         handler_func_name = '_handle_conflict_%s' % self.conflict_handler
01430         try:
01431             return getattr(self, handler_func_name)
01432         except AttributeError:
01433             msg = _('invalid conflict_resolution value: %r')
01434             raise ValueError(msg % self.conflict_handler)

def argparse::_ActionsContainer::_get_optional_kwargs (   self,
  args,
  kwargs 
) [private]

Definition at line 1357 of file argparse.py.

01357                                                    :
01358         # determine short and long option strings
01359         option_strings = []
01360         long_option_strings = []
01361         for option_string in args:
01362             # error on one-or-fewer-character option strings
01363             if len(option_string) < 2:
01364                 msg = _('invalid option string %r: '
01365                         'must be at least two characters long')
01366                 raise ValueError(msg % option_string)
01367 
01368             # error on strings that don't start with an appropriate prefix
01369             if not option_string[0] in self.prefix_chars:
01370                 msg = _('invalid option string %r: '
01371                         'must start with a character %r')
01372                 tup = option_string, self.prefix_chars
01373                 raise ValueError(msg % tup)
01374 
01375             # error on strings that are all prefix characters
01376             if not (_set(option_string) - _set(self.prefix_chars)):
01377                 msg = _('invalid option string %r: '
01378                         'must contain characters other than %r')
01379                 tup = option_string, self.prefix_chars
01380                 raise ValueError(msg % tup)
01381 
01382             # strings starting with two prefix characters are long options
01383             option_strings.append(option_string)
01384             if option_string[0] in self.prefix_chars:
01385                 if option_string[1] in self.prefix_chars:
01386                     long_option_strings.append(option_string)
01387 
01388         # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
01389         dest = kwargs.pop('dest', None)
01390         if dest is None:
01391             if long_option_strings:
01392                 dest_option_string = long_option_strings[0]
01393             else:
01394                 dest_option_string = option_strings[0]
01395             dest = dest_option_string.lstrip(self.prefix_chars)
01396             dest = dest.replace('-', '_')
01397 
01398         # return the updated keyword arguments
01399         return dict(kwargs, dest=dest, option_strings=option_strings)
01400 
def argparse::_ActionsContainer::_get_optional_kwargs (   self,
  args,
  kwargs 
) [private]

Definition at line 1387 of file argparse.py.

01388                                                    :
01389         # determine short and long option strings
01390         option_strings = []
01391         long_option_strings = []
01392         for option_string in args:
01393             # error on strings that don't start with an appropriate prefix
01394             if not option_string[0] in self.prefix_chars:
01395                 msg = _('invalid option string %r: '
01396                         'must start with a character %r')
01397                 tup = option_string, self.prefix_chars
01398                 raise ValueError(msg % tup)
01399 
01400             # strings starting with two prefix characters are long options
01401             option_strings.append(option_string)
01402             if option_string[0] in self.prefix_chars:
01403                 if len(option_string) > 1:
01404                     if option_string[1] in self.prefix_chars:
01405                         long_option_strings.append(option_string)
01406 
01407         # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
01408         dest = kwargs.pop('dest', None)
01409         if dest is None:
01410             if long_option_strings:
01411                 dest_option_string = long_option_strings[0]
01412             else:
01413                 dest_option_string = option_strings[0]
01414             dest = dest_option_string.lstrip(self.prefix_chars)
01415             if not dest:
01416                 msg = _('dest= is required for options like %r')
01417                 raise ValueError(msg % option_string)
01418             dest = dest.replace('-', '_')
01419 
01420         # return the updated keyword arguments
01421         return dict(kwargs, dest=dest, option_strings=option_strings)

def argparse::_ActionsContainer::_get_positional_kwargs (   self,
  dest,
  kwargs 
) [private]

Definition at line 1371 of file argparse.py.

01372                                                     :
01373         # make sure required is not specified
01374         if 'required' in kwargs:
01375             msg = _("'required' is an invalid argument for positionals")
01376             raise TypeError(msg)
01377 
01378         # mark positional arguments as required if at least one is
01379         # always required
01380         if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
01381             kwargs['required'] = True
01382         if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:
01383             kwargs['required'] = True
01384 
01385         # return the keyword arguments with no option strings
01386         return dict(kwargs, dest=dest, option_strings=[])

def argparse::_ActionsContainer::_get_positional_kwargs (   self,
  dest,
  kwargs 
) [private]

Definition at line 1341 of file argparse.py.

01341                                                     :
01342         # make sure required is not specified
01343         if 'required' in kwargs:
01344             msg = _("'required' is an invalid argument for positionals")
01345             raise TypeError(msg)
01346 
01347         # mark positional arguments as required if at least one is
01348         # always required
01349         if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]:
01350             kwargs['required'] = True
01351         if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs:
01352             kwargs['required'] = True
01353 
01354         # return the keyword arguments with no option strings
01355         return dict(kwargs, dest=dest, option_strings=[])
01356 
def argparse::_ActionsContainer::_handle_conflict_error (   self,
  action,
  conflicting_actions 
) [private]

Definition at line 1449 of file argparse.py.

01450                                                                  :
01451         message = _('conflicting option string(s): %s')
01452         conflict_string = ', '.join([option_string
01453                                      for option_string, action
01454                                      in conflicting_actions])
01455         raise ArgumentError(action, message % conflict_string)

def argparse::_ActionsContainer::_handle_conflict_error (   self,
  action,
  conflicting_actions 
) [private]

Definition at line 1428 of file argparse.py.

01428                                                                  :
01429         message = _('conflicting option string(s): %s')
01430         conflict_string = ', '.join([option_string
01431                                      for option_string, action
01432                                      in conflicting_actions])
01433         raise ArgumentError(action, message % conflict_string)
01434 
def argparse::_ActionsContainer::_handle_conflict_resolve (   self,
  action,
  conflicting_actions 
) [private]

Definition at line 1456 of file argparse.py.

01457                                                                    :
01458 
01459         # remove all conflicting options
01460         for option_string, action in conflicting_actions:
01461 
01462             # remove the conflicting option
01463             action.option_strings.remove(option_string)
01464             self._option_string_actions.pop(option_string, None)
01465 
01466             # if the option now has no option string, remove it from the
01467             # container holding it
01468             if not action.option_strings:
01469                 action.container._remove_action(action)
01470 

def argparse::_ActionsContainer::_handle_conflict_resolve (   self,
  action,
  conflicting_actions 
) [private]

Definition at line 1435 of file argparse.py.

01435                                                                    :
01436 
01437         # remove all conflicting options
01438         for option_string, action in conflicting_actions:
01439 
01440             # remove the conflicting option
01441             action.option_strings.remove(option_string)
01442             self._option_string_actions.pop(option_string, None)
01443 
01444             # if the option now has no option string, remove it from the
01445             # container holding it
01446             if not action.option_strings:
01447                 action.container._remove_action(action)
01448 
01449 
def argparse::_ActionsContainer::_pop_action_class (   self,
  kwargs,
  default = None 
) [private]

Definition at line 1422 of file argparse.py.

01423                                                      :
01424         action = kwargs.pop('action', default)
01425         return self._registry_get('action', action, action)

def argparse::_ActionsContainer::_pop_action_class (   self,
  kwargs,
  default = None 
) [private]

Definition at line 1401 of file argparse.py.

01401                                                      :
01402         action = kwargs.pop('action', default)
01403         return self._registry_get('action', action, action)
01404 
def argparse::_ActionsContainer::_registry_get (   self,
  registry_name,
  value,
  default = None 
) [private]

Definition at line 1219 of file argparse.py.

01219                                                                :
01220         return self._registries[registry_name].get(value, default)
01221 
def argparse::_ActionsContainer::_registry_get (   self,
  registry_name,
  value,
  default = None 
) [private]

Definition at line 1225 of file argparse.py.

01226                                                                :
01227         return self._registries[registry_name].get(value, default)

def argparse::_ActionsContainer::_remove_action (   self,
  action 
) [private]

Reimplemented in argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, argparse::_ArgumentGroup, and argparse::_MutuallyExclusiveGroup.

Definition at line 1328 of file argparse.py.

01329                                     :
01330         self._actions.remove(action)

def argparse::_ActionsContainer::_remove_action (   self,
  action 
) [private]

Reimplemented in argparse::_ArgumentGroup, argparse::_MutuallyExclusiveGroup, argparse::_ArgumentGroup, and argparse::_MutuallyExclusiveGroup.

Definition at line 1298 of file argparse.py.

01298                                     :
01299         self._actions.remove(action)
01300 
def argparse::_ActionsContainer::add_argument (   self,
  args,
  kwargs 
)
add_argument(dest, ..., name=value, ...)
add_argument(option_string, option_string, ..., name=value, ...)

Definition at line 1250 of file argparse.py.

01251                                            :
01252         """
01253         add_argument(dest, ..., name=value, ...)
01254         add_argument(option_string, option_string, ..., name=value, ...)
01255         """
01256 
01257         # if no positional args are supplied or only one is supplied and
01258         # it doesn't look like an option string, parse a positional
01259         # argument
01260         chars = self.prefix_chars
01261         if not args or len(args) == 1 and args[0][0] not in chars:
01262             if args and 'dest' in kwargs:
01263                 raise ValueError('dest supplied twice for positional argument')
01264             kwargs = self._get_positional_kwargs(*args, **kwargs)
01265 
01266         # otherwise, we're adding an optional argument
01267         else:
01268             kwargs = self._get_optional_kwargs(*args, **kwargs)
01269 
01270         # if no default was supplied, use the parser-level default
01271         if 'default' not in kwargs:
01272             dest = kwargs['dest']
01273             if dest in self._defaults:
01274                 kwargs['default'] = self._defaults[dest]
01275             elif self.argument_default is not None:
01276                 kwargs['default'] = self.argument_default
01277 
01278         # create the action object, and add it to the parser
01279         action_class = self._pop_action_class(kwargs)
01280         if not _callable(action_class):
01281             raise ValueError('unknown action "%s"' % (action_class,))
01282         action = action_class(**kwargs)
01283 
01284         # raise an error if the action type is not callable
01285         type_func = self._registry_get('type', action.type, action.type)
01286         if not _callable(type_func):
01287             raise ValueError('%r is not callable' % (type_func,))
01288 
01289         # raise an error if the metavar does not match the type
01290         if hasattr(self, "_get_formatter"):
01291             try:
01292                 self._get_formatter()._format_args(action, None)
01293             except TypeError:
01294                 raise ValueError("length of metavar tuple does not match nargs")
01295 
01296         return self._add_action(action)

def argparse::_ActionsContainer::add_argument (   self,
  args,
  kwargs 
)
add_argument(dest, ..., name=value, ...)
add_argument(option_string, option_string, ..., name=value, ...)

Definition at line 1237 of file argparse.py.

01237                                            :
01238         """
01239         add_argument(dest, ..., name=value, ...)
01240         add_argument(option_string, option_string, ..., name=value, ...)
01241         """
01242 
01243         # if no positional args are supplied or only one is supplied and
01244         # it doesn't look like an option string, parse a positional
01245         # argument
01246         chars = self.prefix_chars
01247         if not args or len(args) == 1 and args[0][0] not in chars:
01248             kwargs = self._get_positional_kwargs(*args, **kwargs)
01249 
01250         # otherwise, we're adding an optional argument
01251         else:
01252             kwargs = self._get_optional_kwargs(*args, **kwargs)
01253 
01254         # if no default was supplied, use the parser-level default
01255         if 'default' not in kwargs:
01256             dest = kwargs['dest']
01257             if dest in self._defaults:
01258                 kwargs['default'] = self._defaults[dest]
01259             elif self.argument_default is not None:
01260                 kwargs['default'] = self.argument_default
01261 
01262         # create the action object, and add it to the parser
01263         action_class = self._pop_action_class(kwargs)
01264         action = action_class(**kwargs)
01265         return self._add_action(action)
01266 
def argparse::_ActionsContainer::add_argument_group (   self,
  args,
  kwargs 
)

Definition at line 1267 of file argparse.py.

01267                                                  :
01268         group = _ArgumentGroup(self, *args, **kwargs)
01269         self._action_groups.append(group)
01270         return group
01271 
def argparse::_ActionsContainer::add_argument_group (   self,
  args,
  kwargs 
)

Definition at line 1297 of file argparse.py.

01298                                                  :
01299         group = _ArgumentGroup(self, *args, **kwargs)
01300         self._action_groups.append(group)
01301         return group

def argparse::_ActionsContainer::add_mutually_exclusive_group (   self,
  kwargs 
)

Definition at line 1302 of file argparse.py.

01303                                                     :
01304         group = _MutuallyExclusiveGroup(self, **kwargs)
01305         self._mutually_exclusive_groups.append(group)
01306         return group

def argparse::_ActionsContainer::add_mutually_exclusive_group (   self,
  kwargs 
)

Definition at line 1272 of file argparse.py.

01272                                                     :
01273         group = _MutuallyExclusiveGroup(self, **kwargs)
01274         self._mutually_exclusive_groups.append(group)
01275         return group
01276 
def argparse::_ActionsContainer::get_default (   self,
  dest 
)

Definition at line 1240 of file argparse.py.

01241                                :
01242         for action in self._actions:
01243             if action.dest == dest and action.default is not None:
01244                 return action.default
01245         return self._defaults.get(dest, None)
01246 

def argparse::_ActionsContainer::register (   self,
  registry_name,
  value,
  object 
)

Definition at line 1221 of file argparse.py.

01222                                                     :
01223         registry = self._registries.setdefault(registry_name, {})
01224         registry[value] = object

def argparse::_ActionsContainer::register (   self,
  registry_name,
  value,
  object 
)

Definition at line 1215 of file argparse.py.

01215                                                     :
01216         registry = self._registries.setdefault(registry_name, {})
01217         registry[value] = object
01218 
def argparse::_ActionsContainer::set_defaults (   self,
  kwargs 
)

Definition at line 1231 of file argparse.py.

01232                                     :
01233         self._defaults.update(kwargs)
01234 
01235         # if these defaults match any existing arguments, replace
01236         # the previous default on the object with the new one
01237         for action in self._actions:
01238             if action.dest in kwargs:
01239                 action.default = kwargs[action.dest]

def argparse::_ActionsContainer::set_defaults (   self,
  kwargs 
)

Definition at line 1225 of file argparse.py.

01225                                     :
01226         self._defaults.update(kwargs)
01227 
01228         # if these defaults match any existing arguments, replace
01229         # the previous default on the object with the new one
01230         for action in self._actions:
01231             if action.dest in kwargs:
01232                 action.default = kwargs[action.dest]
01233 

Member Data Documentation

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Reimplemented in argparse::_ArgumentGroup.

Definition at line 1169 of file argparse.py.

Definition at line 1169 of file argparse.py.

Definition at line 1169 of file argparse.py.

Definition at line 1169 of file argparse.py.

Definition at line 1169 of file argparse.py.