当前位置: 首页>>代码示例>>Python>>正文


Python Schema.getInstance方法代码示例

本文整理汇总了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)
开发者ID:inouekazu,项目名称:crmsh,代码行数:20,代码来源:parse.py

示例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:
开发者ID:inouekazu,项目名称:crmsh,代码行数:32,代码来源:xmlutil.py


注:本文中的schema.Schema.getInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。