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:
Carsey, Jaben
2018-03-27 04:25:43 +08:00
committed by Yonghong Zhu
parent 05a32984ab
commit 4231a8193e
131 changed files with 1142 additions and 1142 deletions

View File

@ -70,14 +70,14 @@ class FV (FvClassObject):
#
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}, Flag=False) :
if BaseAddress == None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
#
# Check whether FV in Capsule is in FD flash region.
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
#
if self.CapsuleName != None:
if self.CapsuleName is not None:
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
for RegionObj in FdObj.RegionList:
@ -94,7 +94,7 @@ class FV (FvClassObject):
GenFdsGlobalVariable.LargeFileInFvFlags.append(False)
FFSGuid = None
if self.FvBaseAddress != None:
if self.FvBaseAddress is not None:
BaseAddress = self.FvBaseAddress
if not Flag:
self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
@ -136,7 +136,7 @@ class FV (FvClassObject):
FvOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName)
FvOutputFile = FvOutputFile + '.Fv'
# BUGBUG: FvOutputFile could be specified from FDF file (FV section, CreateFile statement)
if self.CreateFileName != None:
if self.CreateFileName is not None:
FvOutputFile = self.CreateFileName
if Flag:
@ -163,7 +163,7 @@ class FV (FvClassObject):
NewFvInfo = None
if os.path.exists (FvInfoFileName):
NewFvInfo = open(FvInfoFileName, 'r').read()
if NewFvInfo != None and NewFvInfo != OrigFvInfo:
if NewFvInfo is not None and NewFvInfo != OrigFvInfo:
FvChildAddr = []
AddFileObj = open(FvInfoFileName, 'r')
AddrStrings = AddFileObj.readlines()
@ -273,16 +273,16 @@ class FV (FvClassObject):
# Add [Options]
#
self.FvInfFile.writelines("[options]" + T_CHAR_LF)
if BaseAddress != None :
if BaseAddress is not None :
self.FvInfFile.writelines("EFI_BASE_ADDRESS = " + \
BaseAddress + \
T_CHAR_LF)
if BlockSize != None:
if BlockSize is not None:
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
'0x%X' %BlockSize + \
T_CHAR_LF)
if BlockNum != None:
if BlockNum is not None:
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
' 0x%X' %BlockNum + \
T_CHAR_LF)
@ -293,20 +293,20 @@ class FV (FvClassObject):
self.FvInfFile.writelines("EFI_BLOCK_SIZE = 0x1" + T_CHAR_LF)
for BlockSize in self.BlockSizeList :
if BlockSize[0] != None:
if BlockSize[0] is not None:
self.FvInfFile.writelines("EFI_BLOCK_SIZE = " + \
'0x%X' %BlockSize[0] + \
T_CHAR_LF)
if BlockSize[1] != None:
if BlockSize[1] is not None:
self.FvInfFile.writelines("EFI_NUM_BLOCKS = " + \
' 0x%X' %BlockSize[1] + \
T_CHAR_LF)
if self.BsBaseAddress != None:
if self.BsBaseAddress is not None:
self.FvInfFile.writelines('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \
'0x%X' %self.BsBaseAddress)
if self.RtBaseAddress != None:
if self.RtBaseAddress is not None:
self.FvInfFile.writelines('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \
'0x%X' %self.RtBaseAddress)
#
@ -317,7 +317,7 @@ class FV (FvClassObject):
self.FvInfFile.writelines("EFI_ERASE_POLARITY = " + \
' %s' %ErasePloarity + \
T_CHAR_LF)
if not (self.FvAttributeDict == None):
if not (self.FvAttributeDict is None):
for FvAttribute in self.FvAttributeDict.keys() :
if FvAttribute == "FvUsedSizeEnable":
if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1') :
@ -328,7 +328,7 @@ class FV (FvClassObject):
' = ' + \
self.FvAttributeDict[FvAttribute] + \
T_CHAR_LF )
if self.FvAlignment != None:
if self.FvAlignment is not None:
self.FvInfFile.writelines("EFI_FVB2_ALIGNMENT_" + \
self.FvAlignment.strip() + \
" = TRUE" + \
@ -337,7 +337,7 @@ class FV (FvClassObject):
#
# Generate FV extension header file
#
if self.FvNameGuid == None or self.FvNameGuid == '':
if self.FvNameGuid is None or self.FvNameGuid == '':
if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:
GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))
@ -442,7 +442,7 @@ class FV (FvClassObject):
# Add [Files]
#
self.FvInfFile.writelines("[files]" + T_CHAR_LF)
if VtfDict != None and self.UiFvName in VtfDict.keys():
if VtfDict is not None and self.UiFvName in VtfDict.keys():
self.FvInfFile.writelines("EFI_FILE_NAME = " + \
VtfDict.get(self.UiFvName) + \
T_CHAR_LF)