Python optparse 模块,SUPPRESS_HELP 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用optparse.SUPPRESS_HELP

项目:optimalvibes    作者:littlemika    | 项目源码 | 文件源码
def build_completion(opt_parser):
    commands = []

    for group in opt_parser.option_groups:
        for option in group.option_list:
            long_option = option.get_opt_string().strip('-')
            complete_cmd = ['complete', '--command', 'youtube-dl', '--long-option', long_option]
            if option._short_opts:
                complete_cmd += ['--short-option', option._short_opts[0].strip('-')]
            if option.help != optparse.SUPPRESS_HELP:
                complete_cmd += ['--description', option.help]
            complete_cmd.extend(EXTRA_ARGS.get(long_option, []))
            commands.append(shell_quote(complete_cmd))

    with open(FISH_COMPLETION_TEMPLATE) as f:
        template = f.read()
    filled_template = template.replace('{{commands}}', '\n'.join(commands))
    with open(FISH_COMPLETION_FILE, 'w') as f:
        f.write(filled_template)
项目:python-redfish-utility    作者:DMTF    | 项目源码 | 文件源码
def format_argument_help(self, formatter):
        """Function to help format argument help.

        :param formatter: formatter
        :type formatter: formatter
        """
        if not self._args:
            return ""

        result = []
        for option in self._args:
            if not option.help is optparse.SUPPRESS_HELP:
                output = formatter.format_option(option)
                output = self._repattern.sub('  ', output)
                result.append(output)

        return '%s\n' % "".join(result)
项目:social-media-pulse    作者:jrmontag    | 项目源码 | 文件源码
def fit_args():
    """
    This top-level function returns an opt parser in the event that this module 
    is run from the command-line.
    """
    parser = optparse.OptionParser()

    parser.add_option("-i", "--column-independent", dest="i_col", default=1, type="int",
            help="Column of independent variable for fit, 1-based count (default: %default)")
    parser.add_option("-d", "--column-dependent",  dest="d_col", default=2, type="int",
            help="Column of dependent variable for fit, 1-based count (default: %default)")
    parser.add_option("-p", "--init-parameters", dest="init_parameters", default=None,
            help="Initial guess of model function parameters e.g. '[x0, alpha, beta, a0, y0]' (use single-quotes). If not given, initial values are calculated from input data (default: %default)")
    parser.add_option("-w", "--fitting-window", dest="window", default=None, 
            help="Define a window of 0-1-scaled x values over which to fit the curve e.g. '[0.1,0.7]' (use single-quotes). If not given, entire input range is used (not recommended). (default: %default)")
    parser.add_option("-t", "--real-time", dest="real_time", default=False, action='store_true', 
            help="Return output with time data in actual time [epoch seconds, instead of 0-1 scaled] (default: %default)")
    parser.add_option("-b", "--both-times", dest="both_times", action='store_true', 
            help=optparse.SUPPRESS_HELP)

    return parser
项目:get-youtube-subtitle-url-node    作者:joegesualdo    | 项目源码 | 文件源码
def build_completion(opt_parser):
    commands = []

    for group in opt_parser.option_groups:
        for option in group.option_list:
            long_option = option.get_opt_string().strip('-')
            complete_cmd = ['complete', '--command', 'youtube-dl', '--long-option', long_option]
            if option._short_opts:
                complete_cmd += ['--short-option', option._short_opts[0].strip('-')]
            if option.help != optparse.SUPPRESS_HELP:
                complete_cmd += ['--description', option.help]
            complete_cmd.extend(EXTRA_ARGS.get(long_option, []))
            commands.append(shell_quote(complete_cmd))

    with open(FISH_COMPLETION_TEMPLATE) as f:
        template = f.read()
    filled_template = template.replace('{{commands}}', '\n'.join(commands))
    with open(FISH_COMPLETION_FILE, 'w') as f:
        f.write(filled_template)
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:python-    作者:secondtonone1    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:my-first-blog    作者:AnkurBegining    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:swjtu-pyscraper    作者:Desgard    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:noc-orchestrator    作者:DirceuSilvaLabs    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:jira_worklog_scanner    作者:pgarneau    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:zanph    作者:zanph    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:Sci-Finder    作者:snverse    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:ascii-art-py    作者:blinglnav    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:ivaochdoc    作者:ivaoch    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:aws-cfn-plex    作者:lordmuffin    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:django    作者:alexsukhrin    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:RPoint    作者:george17-meet    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:isni-reconcile    作者:cmh2166    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:AshsSDK    作者:thehappydinoa    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:habilitacion    作者:GabrielBD    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:flickr_downloader    作者:Denisolt    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:flickr_downloader    作者:Denisolt    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:threatdetectionservice    作者:flyballlabs    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:threatdetectionservice    作者:flyballlabs    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0
项目:RealtimePythonChat    作者:quangtqag    | 项目源码 | 文件源码
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )