def _make_parser(func): """ Build a parser using the params set using the option and positional decorators Used by the command and command_method decorators to build a parser using the arguments that have been added by the option and positional decorators param: func - The function being decorated param: args - A string containing command line like arguments """ params = _get_params(func) del func.__yoga_params__ params.options.reverse() params.positionals.reverse() parser = ArgumentParser() for o in params.options: parser.add_option(*o) for p in params.positionals: parser.add_positional(p) return parser
def setUp(self): self.parser = ArgumentParser()