def build_parser(self, options=None, permissive=False, **override_kwargs):
        """Construct an argparser from supplied options.

        :keyword override_kwargs: keyword arguments to override when calling
            parser constructor.
        :keyword permissive: when true, build a parser that does not validate
            required arguments.
        """
        kwargs = copy.copy(self._parser_kwargs)
        kwargs.setdefault('formatter_class',
                          argparse.ArgumentDefaultsHelpFormatter)
        kwargs.update(override_kwargs)
        if 'fromfile_prefix_chars' not in kwargs:
            kwargs['fromfile_prefix_chars'] = '@'
        parser = self._parser_class(**kwargs)
        if options is None:
            options = []
            for _opt in self._options:
                _kw = _opt.kwargs.copy()
                if _kw.get('default') is None:
                    _kw['default'] = argparse.SUPPRESS
                options.append(Option(*_opt.args, **_kw))
        for option in options:
            option.add_argument(parser, permissive=permissive)
        return parser
def build_parser ( self , options = None , permissive = False , ** override_kwargs ) : kwargs = copy . copy ( self . _parser_kwargs ) kwargs . setdefault ( 'formatter_class' , argparse . ArgumentDefaultsHelpFormatter ) kwargs . update ( override_kwargs ) if 'fromfile_prefix_chars' not in kwargs : kwargs [ 'fromfile_prefix_chars' ] = '@' parser = self . _parser_class ( ** kwargs ) if options is None : options = [ ] for _opt in self . _options : _kw = _opt . kwargs . copy ( ) if _kw . get ( 'default' ) is None : _kw [ 'default' ] = argparse . SUPPRESS options . append ( Option ( * _opt . args , ** _kw ) ) for option in options : option . add_argument ( parser , permissive = permissive ) return parser
Construct an argparser from supplied options.

        :keyword override_kwargs: keyword arguments to override when calling
            parser constructor.
        :keyword permissive: when true, build a parser that does not validate
            required arguments.