本文整理汇总了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
示例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
示例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
示例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)
示例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
示例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]
示例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,
)
示例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