parameters: (self, *args, **kwargs)
return_statement: return self._add_action(action)
docstring: add_argument(dest, ..., name=value, ...)
          add_argument(option_string, option_string, ..., name=value, ...)
docstring_summary: add_argument(dest, ..., name=value, ...)
          add_argument(option_string, option_string, ..., name=value, ...)
docstring_tokens: add_argument ( dest ... name = value ... ) add_argument ( option_string option_string ... name = value ... )
function: def add_argument(self, *args, **kwargs):
          """
          add_argument(dest, ..., name=value, ...)
          add_argument(option_string, option_string, ..., name=value, ...)
          """
  
          # if no positional args are supplied or only one is supplied and
          # it doesn't look like an option string, parse a positional
          # argument
          chars = self.prefix_chars
          if not args or len(args) == 1 and args[0][0] not in chars:
              if args and 'dest' in kwargs:
                  raise ValueError('dest supplied twice for positional argument')
              kwargs = self._get_positional_kwargs(*args, **kwargs)
  
          # otherwise, we're adding an optional argument
          else:
              kwargs = self._get_optional_kwargs(*args, **kwargs)
  
          # if no default was supplied, use the parser-level default
          if 'default' not in kwargs:
              dest = kwargs['dest']
              if dest in self._defaults:
                  kwargs['default'] = self._defaults[dest]
              elif self.argument_default is not None:
                  kwargs['default'] = self.argument_default
  
          # create the action object, and add it to the parser
          action_class = self._pop_action_class(kwargs)
          if not _callable(action_class):
              raise ValueError('unknown action "%s"' % action_class)
          action = action_class(**kwargs)
  
          # raise an error if the action type is not callable
          type_func = self._registry_get('type', action.type, action.type)
          if not _callable(type_func):
              raise ValueError('%r is not callable' % type_func)
  
          return self._add_action(action)
function_tokens: def add_argument ( self , * args , * * kwargs ) : # if no positional args are supplied or only one is supplied and # it doesn't look like an option string, parse a positional # argument chars = self . prefix_chars if not args or len ( args ) == 1 and args [ 0 ] [ 0 ] not in chars : if args and 'dest' in kwargs : raise ValueError ( 'dest supplied twice for positional argument' ) kwargs = self . _get_positional_kwargs ( * args , * * kwargs ) # otherwise, we're adding an optional argument else : kwargs = self . _get_optional_kwargs ( * args , * * kwargs ) # if no default was supplied, use the parser-level default if 'default' not in kwargs : dest = kwargs [ 'dest' ] if dest in self . _defaults : kwargs [ 'default' ] = self . _defaults [ dest ] elif self . argument_default is not None : kwargs [ 'default' ] = self . argument_default # create the action object, and add it to the parser action_class = self . _pop_action_class ( kwargs ) if not _callable ( action_class ) : raise ValueError ( 'unknown action "%s"' % action_class ) action = action_class ( * * kwargs ) # raise an error if the action type is not callable type_func = self . _registry_get ( 'type' , action . type , action . type ) if not _callable ( type_func ) : raise ValueError ( '%r is not callable' % type_func ) return self . _add_action ( action )