當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。