本文整理汇总了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
示例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
示例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