本文整理匯總了Python中Library.CommentGenerating.GenGenericCommentF.endswith方法的典型用法代碼示例。如果您正苦於以下問題:Python GenGenericCommentF.endswith方法的具體用法?Python GenGenericCommentF.endswith怎麽用?Python GenGenericCommentF.endswith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Library.CommentGenerating.GenGenericCommentF
的用法示例。
在下文中一共展示了GenGenericCommentF.endswith方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: GenSpecialSections
# 需要導入模塊: from Library.CommentGenerating import GenGenericCommentF [as 別名]
# 或者: from Library.CommentGenerating.GenGenericCommentF import endswith [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