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


Python XMLBuilder.value方法代码示例

本文整理汇总了Python中xmlbuilder.XMLBuilder.value方法的典型用法代码示例。如果您正苦于以下问题:Python XMLBuilder.value方法的具体用法?Python XMLBuilder.value怎么用?Python XMLBuilder.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xmlbuilder.XMLBuilder的用法示例。


在下文中一共展示了XMLBuilder.value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: pipeline_to_xml

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import value [as 别名]
def pipeline_to_xml(p):
    """ Convert a Pipeline to XML

    :type p: Pipeline
    :param p:
    :return:
    """
    root = XMLBuilder(Constants.WORKFLOW_TEMPLATE_ROOT, id=p.idx)
    with getattr(root, Constants.ENTRY_POINTS):
        for eid, bid in p.entry_bindings:
            _d = {"id": eid, "in": bid}
            getattr(root, Constants.ENTRY_POINT)(**_d)
    with getattr(root, Constants.BINDINGS):
        for bout, bin_ in p.bindings:
            _d = {"out": bout, "in": bin_}
            getattr(root, Constants.BINDING)(**_d)

    # Engine level Options
    # for completeness write this element
    getattr(root, "options")

    # Task Options
    with getattr(root, "task-options"):
        for key, value in p.task_options.iteritems():
            _d = {"id": key}
            with getattr(root, 'option')(**_d):
                root.value(str(value))

    return root
开发者ID:pb-cdunn,项目名称:pbsmrtpipe,代码行数:31,代码来源:pb_io.py

示例2: schema_options_to_xml

# 需要导入模块: from xmlbuilder import XMLBuilder [as 别名]
# 或者: from xmlbuilder.XMLBuilder import value [as 别名]
def schema_options_to_xml(option_type_name, schema_options_d):
    """Option type name is the task-option or option"""

    x = XMLBuilder(Constants.WORKFLOW_TEMPLATE_PRESET_ROOT)

    # Need to do this getattr to get around how the API works
    with getattr(x, option_type_name):
        for option_id, schema in schema_options_d.iteritems():
            default_value = schema["properties"][option_id]["default"]
            if default_value is not None:
                with x.option(id=option_id):
                    default_value = schema["properties"][option_id]["default"]
                    x.value(str(default_value))

    return x
开发者ID:skinner,项目名称:pbsmrtpipe,代码行数:17,代码来源:pb_io.py


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