本文整理汇总了Python中datasource.bases.BaseHub.BaseHub.checkKeys方法的典型用法代码示例。如果您正苦于以下问题:Python BaseHub.checkKeys方法的具体用法?Python BaseHub.checkKeys怎么用?Python BaseHub.checkKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类datasource.bases.BaseHub.BaseHub
的用法示例。
在下文中一共展示了BaseHub.checkKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: validateDataSource
# 需要导入模块: from datasource.bases.BaseHub import BaseHub [as 别名]
# 或者: from datasource.bases.BaseHub.BaseHub import checkKeys [as 别名]
def validateDataSource(self, dataSourceName):
"""
Iterates through dataSourceReqKeys and confirms required
key/value pairs. Probably a better way of doing this but
not thinking of anything more elegent at the moment. Attempting
to provide the caller with clear messaging regarding missing fields
in the data source file.
Parameters:
dataSourceName - name of the datasource to test
Returns:
None
"""
for key in self.dataSourceReqKeys:
if key is 'req':
msg = 'the %s source object in %s' % (dataSourceName, BaseHub.sourceListFile)
##Confirm required keys##
BaseHub.checkKeys(self.dataSourceReqKeys[key], BaseHub.dataSources[dataSourceName], True, msg)
elif key is 'databases':
if key in BaseHub.dataSources[dataSourceName]:
for i in range(len(BaseHub.dataSources[dataSourceName][key])):
db = BaseHub.dataSources[dataSourceName][key][i]
msg = 'the %s.%s index position %i in %s' % (dataSourceName, key, i, BaseHub.sourceListFile)
BaseHub.checkKeys(self.dataSourceReqKeys[key], db, True, msg)
else:
msg = 'the %s.%s in %s' % (dataSourceName, key, BaseHub.sourceListFile)
if key in BaseHub.dataSources[dataSourceName]:
BaseHub.checkKeys(self.dataSourceReqKeys[key], BaseHub.dataSources[dataSourceName][key], True, msg)