本文整理汇总了Python中CIME.XML.generic_xml.GenericXML.get方法的典型用法代码示例。如果您正苦于以下问题:Python GenericXML.get方法的具体用法?Python GenericXML.get怎么用?Python GenericXML.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.generic_xml.GenericXML
的用法示例。
在下文中一共展示了GenericXML.get方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import get [as 别名]
def __init__(self, machobj, infile=None, compiler=None, mpilib=None, files=None, version=None):
"""
initialize an object
"""
if infile is None:
if files is None:
files = Files()
infile = files.get_value("COMPILERS_SPEC_FILE")
schema = files.get_schema("COMPILERS_SPEC_FILE")
GenericXML.__init__(self, infile, schema)
self._machobj = machobj
if version is not None:
# this is used in scripts_regression_tests to force version 2, it should not be used otherwise
self._version = version
else:
self._version = self.get_version()
self.machine = machobj.get_machine_name()
self.os = machobj.get_value("OS")
if compiler is None:
compiler = machobj.get_default_compiler()
self.compiler = compiler
if mpilib is None:
if compiler is None:
mpilib = machobj.get_default_MPIlib()
else:
mpilib = machobj.get_default_MPIlib(attributes={'compiler':compiler})
self.mpilib = mpilib
self.compiler_nodes = None # Listed from last to first
#Append the contents of $HOME/.cime/config_compilers.xml if it exists
#This could cause problems if node matchs are repeated when only one is expected
infile = os.path.join(os.environ.get("HOME"),".cime","config_compilers.xml")
if os.path.exists(infile):
GenericXML.read(self, infile)
if self.compiler is not None:
self.set_compiler(compiler)
if self._version > 1.0:
schema_db = GenericXML(infile=schema)
compiler_vars = schema_db.get_child("{http://www.w3.org/2001/XMLSchema}group", attributes={"name":"compilerVars"})
choice = schema_db.get_child(name="{http://www.w3.org/2001/XMLSchema}choice", root=compiler_vars)
self.flag_vars = set(schema_db.get(elem, "name") for elem in schema_db.get_children(root=choice, attributes={"type":"flagsVar"}))