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


Python generic_xml.GenericXML类代码示例

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


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

示例1: __init__

    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)
开发者ID:apcraig,项目名称:cime,代码行数:26,代码来源:batch.py

示例2: __init__

    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)
开发者ID:cacraigucar,项目名称:cime-cacraig,代码行数:27,代码来源:env_archive.py

示例3: __init__

    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)
开发者ID:mnlevy1981,项目名称:cime,代码行数:34,代码来源:machines.py

示例4: __init__

    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)
开发者ID:quantheory,项目名称:cime,代码行数:25,代码来源:compilers.py

示例5: __init__

    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)
开发者ID:cacraigucar,项目名称:cime-cacraig,代码行数:8,代码来源:grids.py

示例6: __init__

    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)
开发者ID:quantheory,项目名称:cime,代码行数:8,代码来源:archive.py

示例7: __init__

    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")
开发者ID:bertinia,项目名称:cime,代码行数:9,代码来源:test_reporter.py

示例8: __init__

 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)
开发者ID:apcraig,项目名称:cime,代码行数:9,代码来源:testlist.py

示例9: __init__

    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)
开发者ID:apcraig,项目名称:cime,代码行数:9,代码来源:test_reporter.py

示例10: __init__

 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)
开发者ID:Katetc,项目名称:cime,代码行数:9,代码来源:pes.py

示例11: __init__

    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)
开发者ID:cacraigucar,项目名称:cime-cacraig,代码行数:10,代码来源:tests.py

示例12: __init__

    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
开发者ID:ekluzek,项目名称:cime,代码行数:10,代码来源:lt_archive.py

示例13: __init__

 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
开发者ID:Katetc,项目名称:cime,代码行数:11,代码来源:testspec.py

示例14: __init__

 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))
开发者ID:bertinia,项目名称:cime,代码行数:11,代码来源:testlist.py

示例15: __init__

 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)
开发者ID:quantheory,项目名称:cime,代码行数:12,代码来源:testspec.py


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