本文整理汇总了Python中WMCore.Agent.Configuration.Configuration.documentedString_方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.documentedString_方法的具体用法?Python Configuration.documentedString_怎么用?Python Configuration.documentedString_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WMCore.Agent.Configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.documentedString_方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testD
# 需要导入模块: from WMCore.Agent.Configuration import Configuration [as 别名]
# 或者: from WMCore.Agent.Configuration.Configuration import documentedString_ [as 别名]
def testD(self):
"""test documentation"""
config = Configuration()
config.section_("Section1")
config.Section1.Parameter1 = True
config.Section1.Parameter2 = "string"
config.Section1.Parameter3 = 123
config.Section1.Parameter4 = 123.456
config.Section1.Parameter5 = {
"test1" : "test2", "test3" : 123
}
config.Section1.document_("""This is Section1""")
config.Section1.document_("""This is Section1.Parameter1""",
"Parameter1")
config.Section1.document_("""This is Section1.Parameter2""",
"Parameter2")
config.Section1.document_("""This is Section1.Parameter3\n with multiline comments""",
"Parameter3")
try:
config.Section1.documentedString_()
except Exception as ex:
msg = "Error calling ConfigSection.documentedString_:\n"
msg += "%s\n" % str(ex)
self.fail(msg)
try:
config.Section1.commentedString_()
except Exception as ex:
msg = "Error calling ConfigSection.commentedString_:\n"
msg += "%s\n" % str(ex)
self.fail(msg)
try:
config.documentedString_()
except Exception as ex:
msg = "Error calling Configuration.documentedString_:\n"
msg += "%s\n" % str(ex)
self.fail(msg)
try:
config.commentedString_()
except Exception as ex:
msg = "Error calling Configuration.commentedString_:\n"
msg += "%s\n" % str(ex)
self.fail(msg)
示例2: testE
# 需要导入模块: from WMCore.Agent.Configuration import Configuration [as 别名]
# 或者: from WMCore.Agent.Configuration.Configuration import documentedString_ [as 别名]
def testE(self):
"""test save/load """
testValues = [
"string", 123, 123.456,
["list", 789, 10.1 ],
{ "dict1" : "value", "dict2" : 10.0 }
]
config = Configuration()
for x in range(0, 5):
config.section_("Section%s" % x)
config.component_("Component%s" % x)
sect = getattr(config, "Section%s" % x)
comp = getattr(config, "Component%s" % x)
sect.document_("This is Section%s" % x)
comp.document_("This is Component%s" % x)
for i in range(0, 5):
setattr(comp, "Parameter%s" % i, testValues[i])
setattr(sect, "Parameter%s" % i, testValues[i])
comp.document_("This is Parameter%s" % i,
"Parameter%s" %i)
sect.document_("This is Parameter%s" %i,
"Parameter%s" %i)
stringSave = str(config)
documentSave = config.documentedString_()
commentSave = config.commentedString_()
saveConfigurationFile(config, self.normalSave)
saveConfigurationFile(config, self.docSave, document = True)
saveConfigurationFile(config, self.commentSave, comment = True)
plainConfig = loadConfigurationFile(self.normalSave)
docConfig = loadConfigurationFile(self.docSave)
commentConfig = loadConfigurationFile(self.commentSave)