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
@@ -167,11 +167,11 @@ class InfPomAlignment(ModuleObject):
|
||||
#
|
||||
# Convert UEFI/PI version to decimal number
|
||||
#
|
||||
if DefineObj.GetUefiSpecificationVersion() != None:
|
||||
if DefineObj.GetUefiSpecificationVersion() is not None:
|
||||
__UefiVersion = DefineObj.GetUefiSpecificationVersion().GetValue()
|
||||
__UefiVersion = ConvertVersionToDecimal(__UefiVersion)
|
||||
self.SetUefiSpecificationVersion(str(__UefiVersion))
|
||||
if DefineObj.GetPiSpecificationVersion() != None:
|
||||
if DefineObj.GetPiSpecificationVersion() is not None:
|
||||
__PiVersion = DefineObj.GetPiSpecificationVersion().GetValue()
|
||||
__PiVersion = ConvertVersionToDecimal(__PiVersion)
|
||||
|
||||
@@ -186,7 +186,7 @@ class InfPomAlignment(ModuleObject):
|
||||
# must exist items in INF define section
|
||||
# MODULE_TYPE/BASE_NAME/INF_VERSION/FILE_GUID/VERSION_STRING
|
||||
#
|
||||
if DefineObj.GetModuleType() == None:
|
||||
if DefineObj.GetModuleType() is None:
|
||||
Logger.Error("InfParser", FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("MODULE_TYPE"), File=self.FullPath)
|
||||
else:
|
||||
@@ -205,7 +205,7 @@ class InfPomAlignment(ModuleObject):
|
||||
Line=DefineObj.ModuleType.CurrentLine.LineNo,
|
||||
ExtraData=DefineObj.ModuleType.CurrentLine.LineString)
|
||||
self.LibModuleTypeList.append(ModuleType)
|
||||
if DefineObj.GetBaseName() == None:
|
||||
if DefineObj.GetBaseName() is None:
|
||||
Logger.Error("InfParser", FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("BASE_NAME"), File=self.FullPath)
|
||||
else:
|
||||
@@ -214,17 +214,17 @@ class InfPomAlignment(ModuleObject):
|
||||
self.UniFileClassObject = UniFileClassObject([PathClass(DefineObj.GetModuleUniFileName())])
|
||||
else:
|
||||
self.UniFileClassObject = None
|
||||
if DefineObj.GetInfVersion() == None:
|
||||
if DefineObj.GetInfVersion() is None:
|
||||
Logger.Error("InfParser", FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("INF_VERSION"), File=self.FullPath)
|
||||
else:
|
||||
self.SetVersion(DefineObj.GetInfVersion().GetValue())
|
||||
if DefineObj.GetFileGuid() == None:
|
||||
if DefineObj.GetFileGuid() is None:
|
||||
Logger.Error("InfParser", FORMAT_INVALID,
|
||||
ST.ERR_INF_PARSER_DEFINE_SECTION_MUST_ITEM_NOT_EXIST % ("FILE_GUID"), File=self.FullPath)
|
||||
else:
|
||||
self.SetGuid(DefineObj.GetFileGuid().GetValue())
|
||||
if DefineObj.GetVersionString() == None:
|
||||
if DefineObj.GetVersionString() is None:
|
||||
#
|
||||
# VERSION_STRING is missing from the [Defines] section, tools must assume that the module's version is 0.
|
||||
#
|
||||
@@ -256,7 +256,7 @@ class InfPomAlignment(ModuleObject):
|
||||
if not (ModuleTypeValue == 'SEC' or ModuleTypeValue == 'PEI_CORE' or ModuleTypeValue == 'PEIM'):
|
||||
Logger.Error("InfParser", FORMAT_INVALID, ST.ERR_INF_PARSER_DEFINE_SHADOW_INVALID, File=self.FullPath)
|
||||
|
||||
if DefineObj.GetPcdIsDriver() != None:
|
||||
if DefineObj.GetPcdIsDriver() is not None:
|
||||
self.SetPcdIsDriver(DefineObj.GetPcdIsDriver().GetValue())
|
||||
#
|
||||
# LIBRARY_CLASS
|
||||
@@ -499,7 +499,7 @@ class InfPomAlignment(ModuleObject):
|
||||
LibraryClass.SetSupArchList(ConvertArchList(Item.GetSupArchList()))
|
||||
LibraryClass.SetSupModuleList(Item.GetSupModuleList())
|
||||
HelpStringObj = Item.GetHelpString()
|
||||
if HelpStringObj != None:
|
||||
if HelpStringObj is not None:
|
||||
CommentString = GetHelpStringByRemoveHashKey(HelpStringObj.HeaderComments +
|
||||
HelpStringObj.TailComments)
|
||||
HelpTextHeaderObj = CommonObject.TextObject()
|
||||
|
@@ -45,7 +45,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
CustomMakefile = DefineObj.GetCustomMakefile()
|
||||
UefiHiiResourceSection = DefineObj.GetUefiHiiResourceSection()
|
||||
|
||||
if EdkReleaseVersion != None:
|
||||
if EdkReleaseVersion is not None:
|
||||
Name = DT.TAB_INF_DEFINES_EDK_RELEASE_VERSION
|
||||
Value = EdkReleaseVersion.GetValue()
|
||||
Statement = _GenInfDefineStateMent(EdkReleaseVersion.Comments.GetHeaderComments(),
|
||||
@@ -54,7 +54,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
EdkReleaseVersion.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if Shadow != None:
|
||||
if Shadow is not None:
|
||||
Name = DT.TAB_INF_DEFINES_SHADOW
|
||||
Value = Shadow.GetValue()
|
||||
Statement = _GenInfDefineStateMent(Shadow.Comments.GetHeaderComments(),
|
||||
@@ -63,7 +63,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
Shadow.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if DpxSource != None:
|
||||
if DpxSource is not None:
|
||||
Name = DT.TAB_INF_DEFINES_DPX_SOURCE
|
||||
for DpxSourceItem in DpxSource:
|
||||
Value = DpxSourceItem[0]
|
||||
@@ -73,7 +73,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
DpxSourceItem[1].GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if PciVendorId != None:
|
||||
if PciVendorId is not None:
|
||||
Name = DT.TAB_INF_DEFINES_PCI_VENDOR_ID
|
||||
Value = PciVendorId.GetValue()
|
||||
Statement = _GenInfDefineStateMent(PciVendorId.Comments.GetHeaderComments(),
|
||||
@@ -82,7 +82,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
PciVendorId.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if PciDeviceId != None:
|
||||
if PciDeviceId is not None:
|
||||
Name = DT.TAB_INF_DEFINES_PCI_DEVICE_ID
|
||||
Value = PciDeviceId.GetValue()
|
||||
Statement = _GenInfDefineStateMent(PciDeviceId.Comments.GetHeaderComments(),
|
||||
@@ -91,7 +91,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
PciDeviceId.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if PciClassCode != None:
|
||||
if PciClassCode is not None:
|
||||
Name = DT.TAB_INF_DEFINES_PCI_CLASS_CODE
|
||||
Value = PciClassCode.GetValue()
|
||||
Statement = _GenInfDefineStateMent(PciClassCode.Comments.GetHeaderComments(),
|
||||
@@ -100,7 +100,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
PciClassCode.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if PciRevision != None:
|
||||
if PciRevision is not None:
|
||||
Name = DT.TAB_INF_DEFINES_PCI_REVISION
|
||||
Value = PciRevision.GetValue()
|
||||
Statement = _GenInfDefineStateMent(PciRevision.Comments.GetHeaderComments(),
|
||||
@@ -109,7 +109,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
PciRevision.Comments.GetTailComments())
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if PciCompress != None:
|
||||
if PciCompress is not None:
|
||||
Name = DT.TAB_INF_DEFINES_PCI_COMPRESS
|
||||
Value = PciCompress.GetValue()
|
||||
Statement = _GenInfDefineStateMent(PciCompress.Comments.GetHeaderComments(),
|
||||
@@ -138,7 +138,7 @@ def GenModuleHeaderUserExt(DefineObj, ArchString):
|
||||
|
||||
DefinesDictNew[Statement] = ArchString
|
||||
|
||||
if UefiHiiResourceSection != None:
|
||||
if UefiHiiResourceSection is not None:
|
||||
Name = DT.TAB_INF_DEFINES_UEFI_HII_RESOURCE_SECTION
|
||||
Value = UefiHiiResourceSection.GetValue()
|
||||
HeaderComment = UefiHiiResourceSection.Comments.GetHeaderComments()
|
||||
|
Reference in New Issue
Block a user