本文整理汇总了Python中CIME.XML.generic_xml.GenericXML.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GenericXML.__init__方法的具体用法?Python GenericXML.__init__怎么用?Python GenericXML.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.generic_xml.GenericXML
的用法示例。
在下文中一共展示了GenericXML.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, batch_system=None, machine=None, infile=None, files=None):
"""
initialize an object
"""
if files is None:
files = Files()
if infile is None:
infile = files.get_value("BATCH_SPEC_FILE")
schema = files.get_schema("BATCH_SPEC_FILE")
GenericXML.__init__(self, infile, schema=schema)
self.batch_system_node = None
self.machine_node = None
self.batch_system = batch_system
self.machine = machine
#Append the contents of $HOME/.cime/config_batch.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_batch.xml")
if os.path.exists(infile):
GenericXML.read(self, infile)
if self.batch_system is not None:
self.set_batch_system(self.batch_system, machine=machine)
示例2: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, compiler=None, machine=None, os_= None, mpilib=None, infile=None, files=None):
"""
initialize an object
"""
if infile is None:
if files is None:
files = Files()
infile = files.get_value("COMPILERS_SPEC_FILE")
GenericXML.__init__(self, infile)
self.machine = machine
self.os = os_
self.mpilib = mpilib
self.compiler_nodes = None # Listed from last to first
self.compiler = compiler
if self.compiler is not None:
self.set_compiler(compiler)
#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)
示例3: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, case_root=None, infile="env_archive.xml"):
"""
initialize an object interface to file env_archive.xml in the case directory
"""
logger.debug("Case_root = %s" , case_root)
# Check/Build path to env_archive.xml
if case_root is None:
case_root = os.getcwd()
if os.path.isabs(infile):
fullpath = infile
else:
fullpath = os.path.join(case_root, infile)
# Initialize self
# If env_archive.xml file does not exists in case directory read default from config
GenericXML.__init__(self, fullpath)
# The following creates the CASEROOT/env_archive.xml contents in self.root
if not os.path.isfile(fullpath):
headerobj = Headers()
headernode = headerobj.get_header_node(os.path.basename(fullpath))
self.root.append(headernode)
archive = Archive()
self.root.append(archive.root)
示例4: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile=None, files=None, machine=None):
"""
initialize an object
if a filename is provided it will be used,
otherwise if a files object is provided it will be used
otherwise create a files object from default values
"""
self.machine_node = None
self.machine = None
self.machines_dir = None
if infile is None:
if files is None:
files = Files()
infile = files.get_value("MACHINES_SPEC_FILE", resolved=False)
infile = files.get_resolved_value(infile)
self.machines_dir = os.path.dirname(infile)
GenericXML.__init__(self, infile)
# Append the contents of $HOME/.cime/config_machines.xml if it exists
# This could cause problems if node matchs are repeated when only one is expected
local_infile = os.path.join(os.environ.get("HOME"), ".cime", "config_machines.xml")
logger.debug("Infile: %s", local_infile)
if os.path.exists(local_infile):
GenericXML.read(self, local_infile)
if machine is None:
machine = self.probe_machine_name()
expect(machine is not None, "Could not initialize machine object from %s or %s" % (infile, local_infile))
self.set_machine(machine)
示例5: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile=None):
"""
initialize an object
"""
if infile is None:
infile = os.path.join(get_cime_root(), "cime_config", get_model(), "archive.xml")
GenericXML.__init__(self, infile)
示例6: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile=None, files=None):
if infile is None:
if files is None:
files = Files()
infile = files.get_value("GRIDS_SPEC_FILE")
logger.debug(" Grid specification file is %s" % infile)
GenericXML.__init__(self, infile)
示例7: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self,infile, files=None):
"""
initialize an object
"""
schema = None
if files is None:
files = Files()
schema = files.get_schema("TESTS_SPEC_FILE")
GenericXML.__init__(self, infile, schema=schema)
示例8: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile, files=None):
"""
initialize a files object given input pes specification file
"""
if files is None:
files = Files()
schema = files.get_schema("PES_SPEC_FILE")
logger.debug("DEBUG: infile is {}".format(infile))
GenericXML.__init__(self, infile, schema=schema)
示例9: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self):
"""
initialize an object
"""
expect(get_model() == 'cesm', "testreport is only meant to populate the CESM test database." )
self.root = None
GenericXML.__init__(self)
示例10: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self):
"""
initialize an object
"""
expect(get_model() == 'cesm', "testreport is only meant to populate the CESM test database." )
self.root = None
GenericXML.__init__(self, root_name_override="testrecord", read_only=False, infile="TestRecord.xml")
示例11: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, machine, infile=None):
"""
initialize an object
"""
if (infile is None):
infile = os.path.join(get_cime_root(), "cime_config", get_model(), "machines", "config_lt_archive.xml")
GenericXML.__init__(self, infile)
self.machine = machine
示例12: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile=None, files=None):
"""
initialize an object interface to file config_tests.xml
"""
if infile is None:
if files is None:
files = Files()
infile = files.get_value("CONFIG_TESTS_FILE")
GenericXML.__init__(self, infile)
示例13: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile):
"""
initialize an object
"""
GenericXML.__init__(self, infile)
self._testnodes = {}
self._testlist_node = None
if os.path.isfile(infile):
testnodes = self.get_children('test')
for node in testnodes:
self._testnodes[self.get(node, "name")] = node
示例14: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self,infile, files=None):
"""
initialize an object
"""
schema = None
if files is None:
files = Files()
schema = files.get_schema("TESTS_SPEC_FILE")
GenericXML.__init__(self, infile, schema=schema)
expect(self.get_version() >= 2.0,
"{} is an unsupported version of the testfile format and will be ignored".format(infile))
示例15: __init__
# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import __init__ [as 别名]
def __init__(self, infile):
"""
initialize an object
"""
GenericXML.__init__(self, infile)
self._testnodes = {}
if os.path.isfile(infile):
testnodes = self.get_nodes('test')
for node in testnodes:
self._testnodes[node.get("name")] = node
else:
self.root.set('version', _VERSION)