本文整理汇总了Python中smart.option.OptionParser.defaults["remove_all"]方法的典型用法代码示例。如果您正苦于以下问题:Python OptionParser.defaults["remove_all"]方法的具体用法?Python OptionParser.defaults["remove_all"]怎么用?Python OptionParser.defaults["remove_all"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smart.option.OptionParser
的用法示例。
在下文中一共展示了OptionParser.defaults["remove_all"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_options
# 需要导入模块: from smart.option import OptionParser [as 别名]
# 或者: from smart.option.OptionParser import defaults["remove_all"] [as 别名]
def parse_options(argv):
parser = OptionParser(usage=USAGE,
description=DESCRIPTION,
examples=EXAMPLES)
parser.defaults["add"] = []
parser.defaults["remove"] = []
parser.defaults["remove_all"] = []
parser.defaults["clear_history"] = None
parser.add_option("--show", action="store_true",
help=_("show current mirrors"))
parser.add_option("--add", action="callback", callback=append_all,
help=_("add to the given origin URL the given mirror "
"URL, provided either in pairs, or in a given "
"file/url in the format used by --show"))
parser.add_option("--remove", action="callback", callback=append_all,
help=_("remove from the given origin URL the given "
"mirror URL, provided either in pairs, or in a "
"given file/url in the format used by --show"))
parser.add_option("--remove-all", action="callback", callback=append_all,
help=_("remove all mirrors for the given origin URLs"))
parser.add_option("--sync", action="store", metavar="FILE",
help=_("synchronize mirrors from the given file/url, "
"so that origins in the given file will have "
"exactly the specified mirrors"))
parser.add_option("--clear-history", action="callback", callback=append_all,
help=_("clear history for the given origins/mirrors, or "
"for all mirrors"))
parser.add_option("--show-penalities", action="store_true",
help=_("show current penalities for origins/mirrors, "
"based on the history information"))
opts, args = parser.parse_args(argv)
opts.args = args
return opts