BaseTools: remove redundant if comparison

inherently python will check string and list for None and having data

if <x> in [None, ''] and similar are superflous.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@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-04-20 23:51:42 +08:00
committed by Yonghong Zhu
parent 1beb268a68
commit c93356ada9
6 changed files with 37 additions and 37 deletions

View File

@ -635,10 +635,10 @@ class DscBuildData(PlatformBuildClassObject):
self._SkuIds = OrderedDict()
RecordList = self._RawData[MODEL_EFI_SKU_ID, self._Arch]
for Record in RecordList:
if Record[0] in [None, '']:
if not Record[0]:
EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID number',
File=self.MetaFile, Line=Record[-1])
if Record[1] in [None, '']:
if not Record[1]:
EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID name',
File=self.MetaFile, Line=Record[-1])
if not Pattern.match(Record[0]) and not HexPattern.match(Record[0]):
@ -663,10 +663,10 @@ class DscBuildData(PlatformBuildClassObject):
self.DefaultStores = OrderedDict()
RecordList = self._RawData[MODEL_EFI_DEFAULT_STORES, self._Arch]
for Record in RecordList:
if Record[0] in [None, '']:
if not Record[0]:
EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID number',
File=self.MetaFile, Line=Record[-1])
if Record[1] in [None, '']:
if not Record[1]:
EdkLogger.error('build', FORMAT_INVALID, 'No DefaultStores ID name',
File=self.MetaFile, Line=Record[-1])
if not Pattern.match(Record[0]) and not HexPattern.match(Record[0]):

View File

@ -1116,7 +1116,7 @@ class InfBuildData(ModuleBuildClassObject):
Pcd.DatumType = PcdInPackage.DatumType
Pcd.MaxDatumSize = PcdInPackage.MaxDatumSize
Pcd.InfDefaultValue = Pcd.DefaultValue
if Pcd.DefaultValue in [None, '']:
if not Pcd.DefaultValue:
Pcd.DefaultValue = PcdInPackage.DefaultValue
else:
try: