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


Python GenericXML.get_value方法代码示例

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


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

示例1: get_value

# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import get_value [as 别名]
    def get_value(self, name, attributes=None, resolved=True, subgroup=None):
        """
        Get Value of fields in the config_machines.xml file
        """
        expect(self.machine_node is not None, "Machine object has no machine defined")
        expect(subgroup is None, "This class does not support subgroups")
        value = None

        # COMPILER and MPILIB are special, if called without arguments they get the default value from the
        # COMPILERS and MPILIBS lists in the file.
        if name == "COMPILER":
            value = self.get_default_compiler()
        elif name == "MPILIB":
            value = self.get_default_MPIlib(attributes)
        else:
            node = self.get_optional_node(name, root=self.machine_node, attributes=attributes)
            if node is not None:
                value = node.text

        if value is None:
            # if all else fails
            value = GenericXML.get_value(self, name)

        if resolved:
            if value is not None:
                value = self.get_resolved_value(value)
            elif name in os.environ:
                value = os.environ[name]

            value = convert_to_unknown_type(value)

        return value
开发者ID:apcraig,项目名称:cime,代码行数:34,代码来源:machines.py

示例2: get_value

# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import get_value [as 别名]
    def get_value(self, name, attribute=None, resolved=True, subgroup=None):
        """
        Get Value of fields in the config_batch.xml file
        """
        expect(self.batch_system_node is not None, "Batch object has no batch system defined")
        expect(subgroup is None, "This class does not support subgroups")
        value = None

        node = self.get_optional_batch_node(name)
        if node is not None:
            value = node.text

        if value is None:
            # if all else fails
            value = GenericXML.get_value(self, name, attribute, resolved, subgroup)

        if resolved:
            if value is not None:
                value = self.get_resolved_value(value)
            elif name in os.environ:
                value = os.environ[name]

        return value
开发者ID:apcraig,项目名称:cime,代码行数:25,代码来源:batch.py

示例3: get_value

# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import get_value [as 别名]
    def get_value(self, name, attribute=None, resolved=True, subgroup=None):
        """
        Get Value of fields in the config_compilers.xml file
        """
        expect(self.compiler_nodes is not None, "Compiler object has no compiler defined")
        expect(subgroup is None, "This class does not support subgroups")
        value = None

        node = self.get_optional_compiler_node(name, attributes=attribute)
        if node is not None:
            value = self.text(node)

        if value is None:
            # if all else fails
            value = GenericXML.get_value(self, name)

        if resolved:
            if value is not None:
                value = self.get_resolved_value(value)
            elif name in os.environ:
                value = os.environ[name]

        return value
开发者ID:Katetc,项目名称:cime,代码行数:25,代码来源:compilers.py


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