當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。