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


Python Validator.validateMapping方法代码示例

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


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

示例1: generate_model

# 需要导入模块: from validator import Validator [as 别名]
# 或者: from validator.Validator import validateMapping [as 别名]
def generate_model(plistPaths, fullOutputDirectory, version, testEnabled, jsonFormatEnabled, autoImport):

	internal_file_names = []
	external_file_names = []

	print fullOutputDirectory

	instantiatorPath = fullOutputDirectory + 'Model/Internal/JMInstantiator.swift'
	instantiatorGenerator = InstantiatorGenerator(plistPaths, instantiatorPath, version, testEnabled, jsonFormatEnabled)

	generate_file(instantiatorGenerator.internalGeneratedClass(), instantiatorPath, True)
	internal_file_names.append('JMInstantiator.swift')

	for mappingPath in plistPaths:
		classname = mappingPath[mappingPath.rindex('/',0,-1)+1:-1] if mappingPath.endswith('/') else mappingPath[mappingPath.rindex('/')+1:].split('.', 1 )[0]

		propertyMappings = []

		if jsonFormatEnabled == True:
			propertyMappings = json.load(open(mappingPath))
		else:
			propertyMappings = plistlib.readPlist(mappingPath)

		print fullOutputDirectory

		classGenerator = ClassGenerator(mappingPath, fullOutputDirectory, version, testEnabled, jsonFormatEnabled)

		internalClassPath = fullOutputDirectory + 'Model/Internal/_'+ classname + '.swift'
		externalClassPath = fullOutputDirectory + 'Model/' + classname + '.swift'

		validator = Validator(classname, propertyMappings)
		validator.validateMapping()

		internalClass = classGenerator.internalGeneratedClass()
		externalClass= classGenerator.externalGeneratedClass()

		internal_file_names.append('_'+ classname + '.swift')
		external_file_names.append(classname + '.swift')

		generate_file(internalClass, internalClassPath, True)
		generate_file(externalClass, externalClassPath, False)

	if testEnabled == 0:
		save_files_to_project(fullOutputDirectory, internal_file_names, external_file_names)
开发者ID:AntonTheDev,项目名称:JSONModelKit,代码行数:46,代码来源:modelgen-swift.py


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