BaseTools: Remove equality operator with None
replace "== None" with "is None" and "!= None" with "is not None" Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
committed by
Yonghong Zhu
parent
05a32984ab
commit
4231a8193e
@@ -155,7 +155,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
|
||||
DT.MODEL_META_DATA_HEADER,
|
||||
DefineSectionMacros)
|
||||
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
DefineSectionMacros[Name] = Value
|
||||
continue
|
||||
|
||||
@@ -168,7 +168,7 @@ def GetPackageListInfo(FileNameString, WorkSpace, LineNo):
|
||||
FileNameString,
|
||||
DT.MODEL_META_DATA_PACKAGE,
|
||||
DefineSectionMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
PackageSectionMacros[Name] = Value
|
||||
continue
|
||||
|
||||
|
@@ -112,7 +112,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
|
||||
if BinLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
TailComments = BinLineContent[BinLineContent.find(DT.TAB_COMMENT_SPLIT):]
|
||||
BinLineContent = BinLineContent[:BinLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
if LineComment == None:
|
||||
if LineComment is None:
|
||||
LineComment = InfLineCommentObject()
|
||||
LineComment.SetTailComments(TailComments)
|
||||
|
||||
@@ -123,7 +123,7 @@ class InfBinarySectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_BINARY_FILE,
|
||||
self.FileLocalMacros)
|
||||
if MacroDef[0] != None:
|
||||
if MacroDef[0] is not None:
|
||||
SectionMacros[MacroDef[0]] = MacroDef[1]
|
||||
LineComment = None
|
||||
HeaderComments = []
|
||||
|
@@ -133,7 +133,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
|
||||
if LineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
TailComments = LineContent[LineContent.find(DT.TAB_COMMENT_SPLIT):]
|
||||
LineContent = LineContent[:LineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
if LineComment == None:
|
||||
if LineComment is None:
|
||||
LineComment = InfLineCommentObject()
|
||||
LineComment.SetTailComments(TailComments)
|
||||
|
||||
@@ -144,7 +144,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_META_DATA_HEADER,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
self.FileLocalMacros[Name] = Value
|
||||
continue
|
||||
|
||||
@@ -173,7 +173,7 @@ class InfDefinSectionParser(InfParserSectionRoot):
|
||||
Name, Value = _ValueList[0], _ValueList[1]
|
||||
|
||||
InfDefMemberObj = InfDefMember(Name, Value)
|
||||
if (LineComment != None):
|
||||
if (LineComment is not None):
|
||||
InfDefMemberObj.Comments.SetHeaderComments(LineComment.GetHeaderComments())
|
||||
InfDefMemberObj.Comments.SetTailComments(LineComment.GetTailComments())
|
||||
|
||||
|
@@ -87,7 +87,7 @@ class InfDepexSectionParser(InfParserSectionRoot):
|
||||
ReFormatComment = re.compile(r"""#(?:\s*)\[(.*?)\](?:.*)""", re.DOTALL)
|
||||
for CommentItem in DepexComment:
|
||||
CommentContent = CommentItem[0]
|
||||
if ReFormatComment.match(CommentContent) != None:
|
||||
if ReFormatComment.match(CommentContent) is not None:
|
||||
FormatCommentLn = CommentItem[1] + 1
|
||||
continue
|
||||
|
||||
|
@@ -77,7 +77,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_GUID,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
CommentsList = []
|
||||
ValueList = []
|
||||
@@ -164,7 +164,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_PPI,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
@@ -334,7 +334,7 @@ class InfGuidPpiProtocolSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_PROTOCOL,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
|
@@ -96,7 +96,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
|
||||
if LibLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
LibTailComments = LibLineContent[LibLineContent.find(DT.TAB_COMMENT_SPLIT):]
|
||||
LibLineContent = LibLineContent[:LibLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
if LibLineComment == None:
|
||||
if LibLineComment is None:
|
||||
LibLineComment = InfLineCommentObject()
|
||||
LibLineComment.SetTailComments(LibTailComments)
|
||||
|
||||
@@ -107,7 +107,7 @@ class InfLibrarySectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_LIBRARY_CLASS,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
LibLineComment = None
|
||||
LibHeaderComments = []
|
||||
|
@@ -89,7 +89,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
|
||||
if PkgLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
TailComments = PkgLineContent[PkgLineContent.find(DT.TAB_COMMENT_SPLIT):]
|
||||
PkgLineContent = PkgLineContent[:PkgLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
if LineComment == None:
|
||||
if LineComment is None:
|
||||
LineComment = InfLineCommentObject()
|
||||
LineComment.SetTailComments(TailComments)
|
||||
#
|
||||
@@ -99,7 +99,7 @@ class InfPackageSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_META_DATA_PACKAGE,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
LineComment = None
|
||||
HeaderComments = []
|
||||
|
@@ -97,7 +97,7 @@ class InfParser(InfSectionParser):
|
||||
#
|
||||
# Load Inf file if filename is not None
|
||||
#
|
||||
if Filename != None:
|
||||
if Filename is not None:
|
||||
self.ParseInfFile(Filename)
|
||||
|
||||
## Parse INF file
|
||||
|
@@ -73,9 +73,9 @@ gINF_SECTION_DEF = {
|
||||
# @param Flag If the flag set to True, need to skip macros in a quoted string
|
||||
#
|
||||
def InfExpandMacro(Content, LineInfo, GlobalMacros=None, SectionMacros=None, Flag=False):
|
||||
if GlobalMacros == None:
|
||||
if GlobalMacros is None:
|
||||
GlobalMacros = {}
|
||||
if SectionMacros == None:
|
||||
if SectionMacros is None:
|
||||
SectionMacros = {}
|
||||
|
||||
FileName = LineInfo[0]
|
||||
|
@@ -95,7 +95,7 @@ class InfPcdSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_PCD,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
ValueList = []
|
||||
CommentsList = []
|
||||
|
@@ -86,7 +86,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
|
||||
if SrcLineContent.find(DT.TAB_COMMENT_SPLIT) > -1:
|
||||
TailComments = SrcLineContent[SrcLineContent.find(DT.TAB_COMMENT_SPLIT):]
|
||||
SrcLineContent = SrcLineContent[:SrcLineContent.find(DT.TAB_COMMENT_SPLIT)]
|
||||
if LineComment == None:
|
||||
if LineComment is None:
|
||||
LineComment = InfLineCommentObject()
|
||||
LineComment.SetTailComments(TailComments)
|
||||
|
||||
@@ -97,7 +97,7 @@ class InfSourceSectionParser(InfParserSectionRoot):
|
||||
FileName,
|
||||
DT.MODEL_EFI_SOURCE_FILE,
|
||||
self.FileLocalMacros)
|
||||
if Name != None:
|
||||
if Name is not None:
|
||||
SectionMacros[Name] = Value
|
||||
LineComment = None
|
||||
HeaderComments = []
|
||||
|
Reference in New Issue
Block a user