

def format_option(self, option):
    old_help = option.help
    default = option.default
    if (isinstance(default, str) and (' ' in default)):
        default = repr(default)
    if (option.help is None):
        option.help = ('Specify a %s.' % option.type)
    if (option.type == 'choice'):
        choices = []
        for choice in option.choices:
            if (choice == option.default):
                if (' ' in choice):
                    choice = repr(choice)
                choice = (('[' + choice) + ']')
            elif (' ' in choice):
                choice = repr(choice)
            choices.append(choice)
        option.help = ('%s Choices: %s.' % (option.help, ', '.join(choices)))
    elif (default != NO_DEFAULT):
        if (option.action == 'store_false'):
            option.help = ('%s Default: %s.' % (option.help, (not default)))
        else:
            option.help = ('%s Default: %s.' % (option.help, default))
    result = TitledHelpFormatter.format_option(self, option)
    option.help = old_help
    return result

dataset/ETHPy150Open pearu/pylibtiff/libtiff/script_options.py MyHelpFormatter.format_option/original