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


Python GenGenericCommentF.startswith方法代码示例

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


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

示例1: GenSpecialSections

# 需要导入模块: from Library.CommentGenerating import GenGenericCommentF [as 别名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import startswith [as 别名]
def GenSpecialSections(ObjectList, SectionName, UserExtensionsContent=''):
    #
    # generate section
    #
    Content = ''
    NewSectionDict = {}
    for Obj in ObjectList:
        #
        # Generate comment
        #
        CommentStr = ''
        HelpTextList = Obj.GetHelpTextList()
        HelpStr = _GetHelpStr(HelpTextList)
        CommentStr = GenGenericCommentF(HelpStr)
        if SectionName == 'Hob':
            Type = Obj.GetHobType()
        elif SectionName == 'Event':
            Type = Obj.GetEventType()
        elif SectionName == 'BootMode':
            Type = Obj.GetSupportedBootModes()
        else:
            assert(SectionName)
        Usage = Obj.GetUsage()

        # If the content already in UserExtensionsContent then ignore
        if '[%s]' % SectionName in UserExtensionsContent and Type in UserExtensionsContent:
            return ''

        Statement = ' ' + Type + ' ## ' + Usage
        if CommentStr in ['#\n', '#\n#\n']:
            CommentStr = '#\n#\n#\n'
        #
        # the first head comment line should start with '##\n', if it starts with '#\n', then add one '#'
        # else add '##\n' to meet the format defined in INF spec
        #
        if CommentStr.startswith('#\n'):
            CommentStr = '#' + CommentStr
        elif CommentStr:
            CommentStr = '##\n' + CommentStr
        if CommentStr and not CommentStr.endswith('\n#\n'):
            CommentStr = CommentStr + '#\n'
        NewStateMent = CommentStr + Statement
        SupArch = Obj.GetSupArchList()
        SupArch.sort()
        SortedArch = ' '.join(SupArch)
        if SortedArch in NewSectionDict:
            NewSectionDict[SortedArch] = NewSectionDict[SortedArch] + [NewStateMent]
        else:
            NewSectionDict[SortedArch] = [NewStateMent]
    SectionContent = GenSection(SectionName, NewSectionDict)
    SectionContent = SectionContent.strip()
    if SectionContent:
        Content = '# ' + ('\n' + '# ').join(GetSplitValueList(SectionContent, '\n'))
        Content = Content.lstrip()
    #
    # add a return to differentiate it between other possible sections
    # 
    if Content:
        Content += '\n'
    return Content
开发者ID:vathpela,项目名称:edk2,代码行数:62,代码来源:GenInfFile.py


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