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


Python GenGenericCommentF.strip方法代码示例

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


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

示例1: GenGuidSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import strip [as 别名]
def GenGuidSections(GuidObjList):
    #
    # generate [Guids] section
    #
    Content = ''
    GuidDict = Sdict()
    for Guid in GuidObjList:
        HelpTextList = Guid.GetHelpTextList()
        HelpStr = _GetHelpStr(HelpTextList)
        CName = Guid.GetCName()
        FFE = Guid.GetFeatureFlag()
        Statement = CName
        if FFE:
            Statement += '|' + FFE
        Usage = Guid.GetUsage()
        GuidType = Guid.GetGuidTypeList()[0]
        VariableName = Guid.GetVariableName()
        #
        # Differentiate the generic comment and usage comment as multiple generic comment need to be put at first
        #
        if Usage == DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
            # generate list of generic comment
            Comment = GenGenericCommentF(HelpStr)
        else:
            # generate list of other comment
            Comment = HelpStr.replace('\n', ' ')
            Comment = Comment.strip()
            if Comment:
                Comment = ' # ' + Comment
            else:
                Comment = ''
            if Usage != DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
                Comment = '## ' + Usage + Comment
            elif GuidType == 'Variable':
                Comment = '## ' + Usage + ' ## ' + GuidType + ':' + VariableName + Comment
            else:
                Comment = '## ' + Usage + ' ## ' + GuidType + Comment

            if Comment:
                Comment += '\n'
        #
        # merge duplicate items
        #
        ArchList = Guid.GetSupArchList()
        ArchList.sort()
        SortedArch = ' '.join(ArchList)
        if (Statement, SortedArch) in GuidDict:
            PreviousComment = GuidDict[Statement, SortedArch]
            Comment = PreviousComment + Comment
        GuidDict[Statement, SortedArch] = Comment
    NewSectionDict = GenMetaFileMisc.TransferDict(GuidDict, 'INF_GUID')
    #
    # generate the section contents
    #
    if NewSectionDict:
        Content = GenSection('Guids', NewSectionDict)

    return Content
开发者ID:vathpela,项目名称:edk2,代码行数:60,代码来源:GenInfFile.py

示例2: GenProtocolPPiSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import strip [as 别名]
def GenProtocolPPiSections(ObjList, IsProtocol):
    Content = ''
    Dict = Sdict()
    for Object in ObjList:
        HelpTextList = Object.GetHelpTextList()
        HelpStr = _GetHelpStr(HelpTextList)
        CName = Object.GetCName()
        FFE = Object.GetFeatureFlag()
        Statement = CName
        if FFE:
            Statement += '|' + FFE
        Usage = Object.GetUsage()
        Notify = Object.GetNotify()
        #
        # Differentiate the generic comment and usage comment as consecutive generic comment need to be put together
        #
        if Usage == DT.ITEM_UNDEFINED and Notify == '':
            # generate list of generic comment
            Comment = GenGenericCommentF(HelpStr)
        else:
            # generate list of other comment
            Comment = HelpStr.replace('\n', ' ')
            Comment = Comment.strip()
            if Comment:
                Comment = ' # ' + Comment
            else:
                Comment = ''
            if Usage == DT.ITEM_UNDEFINED and not Comment and Notify == '':
                Comment = ''
            else:
                if Notify:
                    Comment = '## ' + Usage + ' ## ' + 'NOTIFY' + Comment
                else:
                    Comment = '## ' + Usage + Comment
            if Comment:
                Comment += '\n'
        #
        # merge duplicate items
        #
        ArchList = Object.GetSupArchList()
        ArchList.sort()
        SortedArch = ' '.join(ArchList)
        if (Statement, SortedArch) in Dict:
            PreviousComment = Dict[Statement, SortedArch]
            Comment = PreviousComment + Comment
        Dict[Statement, SortedArch] = Comment
    NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PPI_PROTOCOL')
    #
    # generate the section contents
    #
    if NewSectionDict:
        if IsProtocol:
            Content = GenSection('Protocols', NewSectionDict)
        else:
            Content = GenSection('Ppis', NewSectionDict)

    return Content
开发者ID:vathpela,项目名称:edk2,代码行数:59,代码来源:GenInfFile.py

示例3: GenPcdSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import strip [as 别名]
def GenPcdSections(ModuleObject):
    Content = ''
    if not GlobalData.gIS_BINARY_INF:
        #
        # for each Pcd Itemtype, maintain a dict so the same type will be grouped 
        # together
        #
        ItemTypeDict = {}
        for Pcd in ModuleObject.GetPcdList():
            HelpTextList = Pcd.GetHelpTextList()
            HelpStr = _GetHelpStr(HelpTextList)
            Statement = ''
            CName = Pcd.GetCName()
            TokenSpaceGuidCName = Pcd.GetTokenSpaceGuidCName()
            DefaultValue = Pcd.GetDefaultValue()
            ItemType = Pcd.GetItemType()
            if ItemType in ItemTypeDict:
                Dict = ItemTypeDict[ItemType]
            else:
                Dict = Sdict()
                ItemTypeDict[ItemType] = Dict
            FFE = Pcd.GetFeatureFlag()
            Statement += TokenSpaceGuidCName + '.' + CName
            if DefaultValue:
                Statement += '|' + DefaultValue
                if FFE:
                    Statement += '|' + FFE
            elif FFE:
                Statement += '||' + FFE
            #
            # Generate comment
            #
            Usage = Pcd.GetValidUsage()
            # if FeatureFlag Pcd, then assume all Usage is CONSUMES
            if ItemType == DT.TAB_INF_FEATURE_PCD:
                Usage = DT.USAGE_ITEM_CONSUMES
            if Usage == DT.ITEM_UNDEFINED:
                # generate list of generic comment
                Comment = GenGenericCommentF(HelpStr)
            else:
                # generate list of other comment
                Comment = HelpStr.replace('\n', ' ')
                Comment = Comment.strip()
                if Comment:
                    Comment = ' # ' + Comment
                else:
                    Comment = ''
                Comment = '## ' + Usage + Comment
                if Comment:
                    Comment += '\n'
            #
            # Merge duplicate entries
            #
            ArchList = Pcd.GetSupArchList()
            ArchList.sort()
            SortedArch = ' '.join(ArchList)
            if (Statement, SortedArch) in Dict:
                PreviousComment = Dict[Statement, SortedArch]
                Comment = PreviousComment + Comment
            Dict[Statement, SortedArch] = Comment
        for ItemType in ItemTypeDict:
            # First we need to transfer the Dict to use SortedArch as key
            Dict = ItemTypeDict[ItemType]
            NewSectionDict = GenMetaFileMisc.TransferDict(Dict, 'INF_PCD')
            if NewSectionDict:
                Content += GenSection(ItemType, NewSectionDict)
    #
    # For AsBuild INF files   
    #
    else:
        Content += GenAsBuiltPacthPcdSections(ModuleObject)
        Content += GenAsBuiltPcdExSections(ModuleObject)

    return Content
开发者ID:vathpela,项目名称:edk2,代码行数:76,代码来源:GenInfFile.py

示例4: GenProtocolPPiSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import strip [as 别名]
def GenProtocolPPiSections(ObjList, IsProtocol):
    Content = ""
    Dict = Sdict()
    for Object in ObjList:
        HelpTextList = Object.GetHelpTextList()
        HelpStr = _GetHelpStr(HelpTextList)

        CName = Object.GetCName()
        FFE = Object.GetFeatureFlag()
        Statement = CName
        if FFE:
            Statement += "|" + FFE

        Usage = Object.GetUsage()
        Notify = Object.GetNotify()

        #
        # we need to differentiate the generic comment and usage comment
        # as consecutive generic comment need to be put together
        #
        if Usage == DT.ITEM_UNDEFINED and Notify == "":
            # generate list of generic comment
            Comment = GenGenericCommentF(HelpStr)
        else:
            # generate list of other comment
            Comment = HelpStr.replace("\n", " ")
            Comment = Comment.strip()
            if Comment:
                Comment = " # " + Comment
            else:
                Comment = ""

            if Usage == DT.ITEM_UNDEFINED and not Comment and Notify == "":
                Comment = ""
            else:
                if Notify:
                    Comment = "## " + Usage + " ## " + "NOTIFY" + Comment
                else:
                    Comment = "## " + Usage + Comment

            if Comment:
                Comment += "\n"

        #
        # merge duplicate items
        #
        ArchList = Object.GetSupArchList()
        ArchList.sort()
        SortedArch = " ".join(ArchList)
        if (Statement, SortedArch) in Dict:
            PreviousComment = Dict[Statement, SortedArch]
            Comment = PreviousComment + Comment
        Dict[Statement, SortedArch] = Comment

    NewSectionDict = GenMetaFileMisc.TransferDict(Dict)

    #
    # generate the section contents
    #
    if NewSectionDict:
        if IsProtocol:
            Content = GenSection("Protocols", NewSectionDict)
        else:
            Content = GenSection("Ppis", NewSectionDict)

    return Content
开发者ID:B-Rich,项目名称:edk2,代码行数:68,代码来源:GenInfFile.py

示例5: GenGuidSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import strip [as 别名]
def GenGuidSections(GuidObjList):
    #
    # generate [Guids] section
    #
    Content = ""
    GuidDict = Sdict()

    for Guid in GuidObjList:
        HelpTextList = Guid.GetHelpTextList()
        HelpStr = _GetHelpStr(HelpTextList)

        CName = Guid.GetCName()
        FFE = Guid.GetFeatureFlag()
        Statement = CName
        if FFE:
            Statement += "|" + FFE

        Usage = Guid.GetUsage()
        GuidType = Guid.GetGuidTypeList()[0]
        VariableName = Guid.GetVariableName()

        #
        # we need to differentiate the generic comment and usage comment
        # as multiple generic comment need to be put at first
        #
        if Usage == DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
            # generate list of generic comment
            Comment = GenGenericCommentF(HelpStr)
        else:
            # generate list of other comment
            Comment = HelpStr.replace("\n", " ")
            Comment = Comment.strip()
            if Comment:
                Comment = " # " + Comment
            else:
                Comment = ""

            if Usage != DT.ITEM_UNDEFINED and GuidType == DT.ITEM_UNDEFINED:
                Comment = "## " + Usage + Comment
            elif GuidType == "Variable":
                Comment = "## " + Usage + " ## " + GuidType + ":" + VariableName + Comment
            else:
                Comment = "## " + Usage + " ## " + GuidType + Comment

            if Comment:
                Comment += "\n"

        #
        # merge duplicate items
        #
        ArchList = Guid.GetSupArchList()
        ArchList.sort()
        SortedArch = " ".join(ArchList)
        if (Statement, SortedArch) in GuidDict:
            PreviousComment = GuidDict[Statement, SortedArch]
            Comment = PreviousComment + Comment
        GuidDict[Statement, SortedArch] = Comment

    NewSectionDict = GenMetaFileMisc.TransferDict(GuidDict)

    #
    # generate the section contents
    #
    if NewSectionDict:
        Content = GenSection("Guids", NewSectionDict)

    return Content
开发者ID:B-Rich,项目名称:edk2,代码行数:69,代码来源:GenInfFile.py


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