当前位置: 首页>>代码示例>>Python>>正文


Python optparse.SUPPRESS_HELP属性代码示例

本文整理汇总了Python中optparse.SUPPRESS_HELP属性的典型用法代码示例。如果您正苦于以下问题:Python optparse.SUPPRESS_HELP属性的具体用法?Python optparse.SUPPRESS_HELP怎么用?Python optparse.SUPPRESS_HELP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在optparse的用法示例。


在下文中一共展示了optparse.SUPPRESS_HELP属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_path_completion_type

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def get_path_completion_type(cwords, cword, opts):
    """Get the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
    """
    if cword < 2 or not cwords[cword - 2].startswith('-'):
        return
    for opt in opts:
        if opt.help == optparse.SUPPRESS_HELP:
            continue
        for o in str(opt).split('/'):
            if cwords[cword - 2].split('=')[0] == o:
                if not opt.metavar or any(
                        x in ('path', 'file', 'dir')
                        for x in opt.metavar.split('/')):
                    return opt.metavar 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:21,代码来源:autocompletion.py

示例2: get_path_completion_type

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def get_path_completion_type(cwords, cword, opts):
    # type: (List[str], int, Iterable[Any]) -> Optional[str]
    """Get the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
    """
    if cword < 2 or not cwords[cword - 2].startswith('-'):
        return None
    for opt in opts:
        if opt.help == optparse.SUPPRESS_HELP:
            continue
        for o in str(opt).split('/'):
            if cwords[cword - 2].split('=')[0] == o:
                if not opt.metavar or any(
                        x in ('path', 'file', 'dir')
                        for x in opt.metavar.split('/')):
                    return opt.metavar
    return None 
开发者ID:pantsbuild,项目名称:pex,代码行数:23,代码来源:autocompletion.py

示例3: get_path_completion_type

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def get_path_completion_type(cwords, cword, opts):
    """Get the type of path completion (``file``, ``dir``, ``path`` or None)

    :param cwords: same as the environmental variable ``COMP_WORDS``
    :param cword: same as the environmental variable ``COMP_CWORD``
    :param opts: The available options to check
    :return: path completion type (``file``, ``dir``, ``path`` or None)
    """
    if cword < 2 or not cwords[cword - 2].startswith('-'):
        return
    for opt in opts:
        if opt.help == optparse.SUPPRESS_HELP:
            continue
        for o in str(opt).split('/'):
            if cwords[cword - 2].split('=')[0] == o:
                if any(x in ('path', 'file', 'dir')
                        for x in opt.metavar.split('/')):
                    return opt.metavar 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:20,代码来源:__init__.py

示例4: _UpdateOptions

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def _UpdateOptions(self, parser):
    """Adds update-specific options to 'parser'.

    Args:
      parser: An instance of OptionsParser.
    """
    parser.add_option('--no_precompilation', action='store_false',
                      dest='precompilation', default=True,
                      help='Disable automatic precompilation '
                      '(ignored for Go apps).')
    parser.add_option('--backends', action='store_true',
                      dest='backends', default=False,
                      help='Update backends when performing appcfg update.')
    parser.add_option('--no_usage_reporting', action='store_false',
                      dest='usage_reporting', default=True,
                      help='Disable usage reporting.')
    parser.add_option('--repo_info_file', action='store', type='string',
                      dest='repo_info_file', help=optparse.SUPPRESS_HELP)
    unused_repo_info_file_help = (
        'The name of a file containing source context information for the '
        'modules being deployed. If not specified, the source context '
        'information will be inferred from the directory containing the '
        'app.yaml file.')
    if JavaSupported():
      appcfg_java.AddUpdateOptions(parser) 
开发者ID:GoogleCloudPlatform,项目名称:python-compat-runtime,代码行数:27,代码来源:appcfg.py

示例5: addConfigOptions

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def addConfigOptions(self, cfgMap, argDef):
        from conary.lib.options import NO_PARAM
        for name, data in cfgMap.items():
            if len(data) == 3:
                cfgName, paramType, shortOpt = data
            else:
                shortOpt = None
                cfgName, paramType = data

            # if it's a NO_PARAM
            if paramType == NO_PARAM:
                negName = 'no-' + name
                argDef[self.defaultGroup][negName] = NO_PARAM, optparse.SUPPRESS_HELP
                cfgMap[negName] = (cfgName, paramType)

            if shortOpt:
                argDef[self.defaultGroup][name] = shortOpt, paramType
            else:
                argDef[self.defaultGroup][name] = paramType 
开发者ID:sassoftware,项目名称:conary,代码行数:21,代码来源:command.py

示例6: _level_options

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def _level_options(group, outputlevel):
    return [option for option in group.option_list
            if (getattr(option, 'level', 0) or 0) <= outputlevel
            and option.help is not optparse.SUPPRESS_HELP] 
开发者ID:AtomLinter,项目名称:linter-pylama,代码行数:6,代码来源:config.py

示例7: allow_external

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def allow_external():
    return Option(
        "--allow-external",
        dest="allow_external",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    ) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:cmdoptions.py

示例8: allow_unsafe

# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import SUPPRESS_HELP [as 别名]
def allow_unsafe():
    return Option(
        "--allow-unverified", "--allow-insecure",
        dest="allow_unverified",
        action="append",
        default=[],
        metavar="PACKAGE",
        help=SUPPRESS_HELP,
    )

# Remove after 7.0 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:cmdoptions.py


注:本文中的optparse.SUPPRESS_HELP属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。