本文整理匯總了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