本文整理汇总了Python中optparse.OptionConflictError方法的典型用法代码示例。如果您正苦于以下问题:Python optparse.OptionConflictError方法的具体用法?Python optparse.OptionConflictError怎么用?Python optparse.OptionConflictError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类optparse
的用法示例。
在下文中一共展示了optparse.OptionConflictError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_options
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import OptionConflictError [as 别名]
def add_options(self, parser, env=None):
"""Non-camel-case version of func name for backwards compatibility.
.. warning ::
DEPRECATED: Do not use this method,
use :meth:`options <nose.plugins.base.IPluginInterface.options>`
instead.
"""
# FIXME raise deprecation warning if wasn't called by wrapper
if env is None:
env = os.environ
try:
self.options(parser, env)
self.can_configure = True
except OptionConflictError, e:
warn("Plugin %s has conflicting option string: %s and will "
"be disabled" % (self, e), RuntimeWarning)
self.enabled = False
self.can_configure = False
示例2: add_options
# 需要导入模块: import optparse [as 别名]
# 或者: from optparse import OptionConflictError [as 别名]
def add_options(cls, parser):
try:
parser.add_option(
'--print-dlint-linters',
action='store_true',
help='Print Dlint linter information.',
parse_from_config=False
)
except optparse.OptionConflictError:
# Occurs during development when flake8 detects the dlint package
# twice: once because it's been installed in editable mode, and
# once from the local filesystem directory. We can safely nop here
# since the option(s) have already been added.
pass