本文整理汇总了Python中CIME.XML.entry_id.EntryID.get_value方法的典型用法代码示例。如果您正苦于以下问题:Python EntryID.get_value方法的具体用法?Python EntryID.get_value怎么用?Python EntryID.get_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.entry_id.EntryID
的用法示例。
在下文中一共展示了EntryID.get_value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_value
# 需要导入模块: from CIME.XML.entry_id import EntryID [as 别名]
# 或者: from CIME.XML.entry_id.EntryID import get_value [as 别名]
def get_value(self, vid, attribute=None, resolved=True, subgroup=None):
"""
Get a value for entry with id attribute vid.
or from the values field if the attribute argument is provided
and matches
"""
value = None
vid, comp, iscompvar = self.check_if_comp_var(vid, attribute)
logger.debug("vid {} comp {} iscompvar {}".format(vid, comp, iscompvar))
if iscompvar:
if comp is None:
if subgroup is not None:
comp = subgroup
else:
logger.debug("Not enough info to get value for {}".format(vid))
return value
if attribute is None:
attribute = {"compclass" : comp}
else:
attribute["compclass"] = comp
node = self.scan_optional_child("entry", {"id":vid})
if node is not None:
type_str = self._get_type_info(node)
values = self.get_optional_child("values", root=node)
node = values if values is not None else node
val = self.get_element_text("value", attribute, root=node)
if val is not None:
if val.startswith("$"):
value = val
else:
value = convert_to_type(val,type_str, vid)
return value
return EntryID.get_value(self, vid, attribute=attribute, resolved=resolved, subgroup=subgroup)
示例2: get_value
# 需要导入模块: from CIME.XML.entry_id import EntryID [as 别名]
# 或者: from CIME.XML.entry_id.EntryID import get_value [as 别名]
def get_value(self, name, attribute=None, resolved=False, subgroup=None):
expect(subgroup is None, "This class does not support subgroups")
return EntryID.get_value(self, name, attribute, resolved)