本文整理汇总了Python中Cobalt.Proxy.ComponentProxy.set_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python ComponentProxy.set_attributes方法的具体用法?Python ComponentProxy.set_attributes怎么用?Python ComponentProxy.set_attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cobalt.Proxy.ComponentProxy
的用法示例。
在下文中一共展示了ComponentProxy.set_attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from Cobalt.Proxy import ComponentProxy [as 别名]
# 或者: from Cobalt.Proxy.ComponentProxy import set_attributes [as 别名]
for r in added:
print "Added resource with name '%s'" % r["name"]
sys.exit(0)
elif opt.remove:
specs = [{"name":name} for name in args]
removed = system.remove_resources(specs)
removed.sort(key=namesort)
for r in removed:
print "Removed resource with name '%s'" % r["name"]
sys.exit(0)
# May change multiple attributes at a time
if opt.func:
specs = [{"name":name, "functional":False} for name in args]
newattrs = {"functional":True}
changed = system.set_attributes(specs, newattrs)
changed.sort(key=namesort)
print "Resources marked functional:"
for r in changed:
print " %s" % r["name"]
elif opt.nonfunc:
specs = [{"name":name, "functional":True} for name in args]
newattrs = {"functional":False}
changed = system.set_attributes(specs, newattrs)
changed.sort(key=namesort)
print "Resources marked non-functional:"
for r in changed:
print " %s" % r["name"]
if opt.sched:
specs = [{"name":name, "scheduled":False} for name in args]