def parse_options(args):
    parser = optparse.OptionParser(usage="%prog [options] task1 [[task2] ...]",
                                   version="%prog " + __version__)

    def error(msg):
        raise CommandLineUsageException(
            parser.get_usage() + parser.format_option_help(), msg)

    parser.error = error

    list_tasks_option = parser.add_option("-t", "--list-tasks",
                                          action="store_true",
                                          dest="list_tasks",
                                          default=False,
                                          help="List tasks")

    list_plan_tasks_option = parser.add_option("-T", "--list-plan-tasks",
                                               action="store_true",
                                               dest="list_plan_tasks",
                                               default=False,
                                               help="List execution plan tasks")

    start_project_option = parser.add_option("--start-project",
                                             action="store_true",
                                             dest="start_project",
                                             default=False,
                                             help="Initialize build descriptors and python project structure")

    update_project_option = parser.add_option("--update-project",
                                              action="store_true",
                                              dest="update_project",
                                              default=False,
                                              help="Update build descriptors and python project structure")

    parser.add_option("-v", "--verbose",
                      action="store_true",
                      dest="verbose",
                      default=False,
                      help="Enable verbose output")

    project_group = optparse.OptionGroup(
        parser, "Project Options", "Customizes the project to build.")

    project_group.add_option("-D", "--project-directory",
                             dest="project_directory",
                             help="Root directory to execute in",
                             metavar="<project directory>",
                             default=".")
    project_group.add_option("-E", "--environment",
                             dest="environments",
                             help="Activate the given environment for this build. Can be used multiple times",
                             metavar="<environment>",
                             action="append",
                             default=[])
    project_group.add_option("-P",
                             action="append",
                             dest="property_overrides",
                             default=[],
                             metavar="<property>=<value>",
                             help="Set/ override a property value")

    project_group.add_option("-x", "--exclude",
                             action="append",
                             dest="exclude_optional_tasks",
                             default=[],
                             metavar="<task>",
                             help="Exclude optional task dependencies")

    project_group.add_option("-o", "--exclude-all-optional",
                             action="store_true",
                             dest="exclude_all_optional",
                             default=False,
                             help="Exclude all optional task dependencies")

    project_group.add_option("--force-exclude",
                             action="append",
                             dest="exclude_tasks",
                             default=[],
                             metavar="<task>",
                             help="Exclude any task dependencies "
                                  "(dangerous, may break the build in unexpected ways)")

    parser.add_option_group(project_group)

    output_group = optparse.OptionGroup(
        parser, "Output Options", "Modifies the messages printed during a build.")

    output_group.add_option("-X", "--debug",
                            action="store_true",
                            dest="debug",
                            default=False,
                            help="Print debug messages")
    output_group.add_option("-q", "--quiet",
                            action="store_true",
                            dest="quiet",
                            default=False,
                            help="Quiet mode; print only warnings and errors")
    output_group.add_option("-Q", "--very-quiet",
                            action="store_true",
                            dest="very_quiet",
                            default=False,
                            help="Very quiet mode; print only errors")
    output_group.add_option("-C", "--no-color",
                            action="store_true",
                            dest="no_color",
                            default=False,
                            help="Disable colored output")

    parser.add_option_group(output_group)

    options, arguments = parser.parse_args(args=list(args))

    if options.list_tasks and options.list_plan_tasks:
        parser.error((list_tasks_option, list_plan_tasks_option) % "%s and %s are mutually exclusive")
    if options.start_project and options.update_project:
        parser.error("%s and %s are mutually exclusive" % (start_project_option, update_project_option))

    property_overrides = {}
    for pair in options.property_overrides:
        if not PROPERTY_OVERRIDE_PATTERN.match(pair):
            parser.error("%s is not a property definition." % pair)
        key, val = pair.split("=")
        property_overrides[key] = val

    options.property_overrides = property_overrides

    if options.very_quiet:
        options.quiet = True

    return options, arguments
dataset/ETHPy150Open pybuilder/pybuilder/src/main/python/pybuilder/cli.py/parse_options/swapped operands of `%`