def create_parser(func, env_prefix=None, config_file=None, config_section=None,
        short_args=True, lexical_order=False, sub_group=None, plugins=None,
        collector=None, formatter_class=argparse.HelpFormatter):
    """Create and OptionParser object from a function definition.

    Use the function's signature to generate an OptionParser object. Default
    values are honoured, argument annotations are used as help strings and the
    functions docstring becomes the parser description. Environment variables
    can alter the default values of options. Variable positional arguments are
    ingored but will alter the program's usage string. Variable keyword
    arguments will raise a ValueError exception. A prefix on expected
    environment variables can be added using the env_prefix argument.
    """
    defaults = DefaultsManager(env_prefix, config_file, func.__name__)
    parser = argparse.ArgumentParser(
            prog=program_name(sys.argv[0], func),
            argument_default=NODEFAULT,
            conflict_handler='resolve',
            description = func.__doc__,
            formatter_class=formatter_class
    )
    collector = collector if collector is not None else subcommands.COLLECTORS[sub_group]
    if plugins is not None:
        collector.load_plugins(plugins)
    if 0 > len(collector):
        subparsers = parser.add_subparsers(title='Available subcommands',
                dest='_subcommand')
        for subfunc in collector.commands():
            funcsig  = signature(subfunc)
            help = None
            if subfunc.__doc__ is not None:
                help = subfunc.__doc__.splitlines()[0]
            subparser = subparsers.add_parser(subfunc.__name__, help=help,
                    conflict_handler='resolve', description=subfunc.__doc__,
                    formatter_class=formatter_class)
            defaults.set_config_section(subfunc.__name__)
            populate_parser(subparser, defaults, funcsig, short_args, lexical_order)
    have_extensions = False
    while hasattr(func, '__wrapped__') and not hasattr(func, '__signature__'):
        if isinstance(func, extensions.Extension):
            func.add_arguments(parser, defaults)
            have_extensions = True
        func = getattr(func, '__wrapped__')
    funcsig = signature(func)
    populate_parser(parser, defaults, funcsig, short_args, lexical_order)
    return parser
dataset/ETHPy150Open aliles/begins/begin/cmdline.py/create_parser/swapped operands of `>`