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


Python Configuration.documentedString_方法代码示例

本文整理汇总了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)
开发者ID:HassenRiahi,项目名称:WMCore,代码行数:51,代码来源:Configuration_t.py

示例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)
开发者ID:HassenRiahi,项目名称:WMCore,代码行数:43,代码来源:Configuration_t.py


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