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


Python GenericMetadata.checkMetadataVersion方法代码示例

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


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

示例1: test_check_metadata_version

# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import checkMetadataVersion [as 别名]
 def test_check_metadata_version(self):
     """ Test check metadata version """       
     step1 = "mkdir foo; cd foo"
     
     GenericMetadata.appendProcessingHistoryItem(self.context, step1)
     GenericMetadata.checkMetadataVersion(self.context.projectDir)
     # For testing purposes only, users should not modify 
     #   GenericMetadata._ecohydrolibVersion
     _prevVersion = GenericMetadata._ecohydrolibVersion
     GenericMetadata._ecohydrolibVersion = '11'
     caughtMetadataVersionError = False
     try:
         GenericMetadata.checkMetadataVersion(self.context.projectDir)
     except MetadataVersionError:
         caughtMetadataVersionError = True
     self.assertTrue(caughtMetadataVersionError, "Expected metadata version mismatch, but none found.")
     GenericMetadata._ecohydrolibVersion = _prevVersion
     
     
开发者ID:dblodgett-usgs,项目名称:EcohydroLib,代码行数:19,代码来源:test_metadata.py

示例2: __init__

# 需要导入模块: from ecohydrolib.metadata import GenericMetadata [as 别名]
# 或者: from ecohydrolib.metadata.GenericMetadata import checkMetadataVersion [as 别名]
 def __init__(self, projectDir, configFile=None):
     """ Constructor for Context class
     
         @param projectDir Path of the project whose metadata store is to be read from
         @param configFile Path of ecohydrolib configuration file to use.  If none,
         will attempt to read configuration from a file named in the environment
         variable Context.CONFIG_FILE_ENV
         
         @raise IOError if project directory path is not a directory
         @raise IOError if project directory is not writable
         @raise MetadataVersionError if a version already exists in the 
         metadata store and is different than GenericMetadata._ecohydrolibVersion
         @raise EnvironmentError if configuration file name could not be read from the 
         environment
         @raise IOError if configuration file could not be read
     """
     if not os.path.isdir(projectDir):
         raise IOError(errno.ENOTDIR, "Specified project directory %s is not a directory" % \
                       (projectDir,))
     if not os.access(projectDir, os.W_OK):
         raise IOError(errno.EACCES, "Unable to write to project directory %s" % \
                       (projectDir,))
     self.projectDir = os.path.abspath(projectDir)
     
     # Make sure metadata version is compatible with this version of ecohydrolib
     #   will raise MetadataVersionError if there is a version mismatch
     GenericMetadata.checkMetadataVersion(projectDir)
     
     if not configFile:
         try:
             self._configFile = os.environ[CONFIG_FILE_ENV]
         except KeyError:
             raise EnvironmentError("Configuration file not specified via environmental variable %s" %\
                                    CONFIG_FILE_ENV)
     else:
         self._configFile = configFile
     
     if not os.access(self._configFile, os.R_OK):
         raise IOError(errno.EACCES, "Unable to read configuration file %s" %
                       self._configFile)
     self.config = ConfigParser.RawConfigParser()
     self.config.read(self._configFile)
开发者ID:dblodgett-usgs,项目名称:EcohydroLib,代码行数:44,代码来源:context.py


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