本文整理汇总了Python中schema.Schema.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Python Schema.getInstance方法的具体用法?Python Schema.getInstance怎么用?Python Schema.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schema.Schema
的用法示例。
在下文中一共展示了Schema.getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from schema import Schema [as 别名]
# 或者: from schema.Schema import getInstance [as 别名]
def __init__(self):
self.comments = []
validation = Validation(Schema.getInstance())
if not self.parsers:
def add(*parsers):
for pcls in parsers:
p = pcls()
p.init(validation)
for n in p.can_parse():
self.parsers[n] = p
add(ResourceParser,
ConstraintParser,
OpParser,
NodeParser,
PropertyParser,
FencingOrderParser,
AclParser,
RawXMLParser)
示例2: merge_attributes
# 需要导入模块: from schema import Schema [as 别名]
# 或者: from schema.Schema import getInstance [as 别名]
elif dc.tag == "operations":
rc = merge_attributes(dc, sc, "op") or rc
for c in add_children:
dnode.append(copy.deepcopy(c))
return rc
def merge_tmpl_into_prim(prim_node, tmpl_node):
'''
Create a new primitive element which is a merge of a
rsc_template and a primitive which references it.
'''
dnode = etree.Element(prim_node.tag)
merge_nodes(dnode, tmpl_node)
merge_nodes(dnode, prim_node)
# the resulting node should inherit all primitives attributes
for a, v in prim_node.items():
dnode.set(a, v)
# but class/provider/type are coming from the template
# savannah#41410: stonith resources do not have the provider
# attribute
for a in ("class", "provider", "type"):
v = tmpl_node.get(a)
if v is not None:
dnode.set(a, v)
return dnode
schema = Schema.getInstance()
# vim:ts=4:sw=4:et: