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


Python GenericXML.invalidate方法代码示例

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


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

示例1: lock_file

# 需要导入模块: from CIME.XML.generic_xml import GenericXML [as 别名]
# 或者: from CIME.XML.generic_xml.GenericXML import invalidate [as 别名]
def lock_file(filename, caseroot=None, newname=None):
    expect("/" not in filename, "Please just provide basename of locked file")
    caseroot = os.getcwd() if caseroot is None else caseroot
    newname = filename if newname is None else newname
    fulllockdir = os.path.join(caseroot, LOCKED_DIR)
    if not os.path.exists(fulllockdir):
        os.mkdir(fulllockdir)

    logging.debug("Locking file {}".format(filename))

    # JGF: It is extremely dangerous to alter our database (xml files) without
    # going through the standard API. The copy below invalidates all existing
    # GenericXML instances that represent this file and all caching that may
    # have involved this file. We should probably seek a safer way of locking
    # files.
    safe_copy(os.path.join(caseroot, filename), os.path.join(fulllockdir, newname))
    GenericXML.invalidate(os.path.join(fulllockdir, newname))
开发者ID:fischer-ncar,项目名称:cime,代码行数:19,代码来源:locked_files.py


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