BaseTools: remove un-needed use of .keys() on dictionaries

sometimes just delete it.
sometimes the loop needed .values() instead

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-12 16:53:53 -07:00 committed by Yonghong Zhu
parent 4e50eba1b6
commit b491aa95ab
2 changed files with 4 additions and 4 deletions

View File

@ -439,7 +439,7 @@ class FV (FvClassObject):
# Add [Files] # Add [Files]
# #
self.FvInfFile.writelines("[files]" + T_CHAR_LF) self.FvInfFile.writelines("[files]" + T_CHAR_LF)
if VtfDict is not None and self.UiFvName in VtfDict: if VtfDict and self.UiFvName in VtfDict:
self.FvInfFile.writelines("EFI_FILE_NAME = " + \ self.FvInfFile.writelines("EFI_FILE_NAME = " + \
VtfDict[self.UiFvName] + \ VtfDict[self.UiFvName] + \
T_CHAR_LF) T_CHAR_LF)

View File

@ -1200,7 +1200,7 @@ class DscBuildData(PlatformBuildClassObject):
for item in GlobalData.BuildOptionPcd: for item in GlobalData.BuildOptionPcd:
if len(item) == 5 and (item[1],item[0]) in StruPcds: if len(item) == 5 and (item[1],item[0]) in StruPcds:
StructurePcdInCom[(item[0],item[1],item[2] )] = (item[3],item[4]) StructurePcdInCom[(item[0],item[1],item[2] )] = (item[3],item[4])
GlobalPcds = set([(item[0],item[1]) for item in StructurePcdInCom.keys()]) GlobalPcds = {(item[0],item[1]) for item in StructurePcdInCom}
for Pcd in StruPcds.values(): for Pcd in StruPcds.values():
if (Pcd.TokenSpaceGuidCName,Pcd.TokenCName) not in GlobalPcds: if (Pcd.TokenSpaceGuidCName,Pcd.TokenCName) not in GlobalPcds:
continue continue
@ -1276,7 +1276,7 @@ class DscBuildData(PlatformBuildClassObject):
DefaultStoreMgr = DefaultStore(self.DefaultStores) DefaultStoreMgr = DefaultStore(self.DefaultStores)
SkuIds = self.SkuIdMgr.AvailableSkuIdSet SkuIds = self.SkuIdMgr.AvailableSkuIdSet
SkuIds.update({TAB_DEFAULT:0}) SkuIds.update({TAB_DEFAULT:0})
DefaultStores = set([storename for pcdobj in AllPcds.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict.keys()]) DefaultStores = {storename for pcdobj in AllPcds.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict}
S_PcdSet = [] S_PcdSet = []
# Find out all possible PCD candidates for self._Arch # Find out all possible PCD candidates for self._Arch
@ -2332,7 +2332,7 @@ class DscBuildData(PlatformBuildClassObject):
Pcds = {} Pcds = {}
DefaultStoreObj = DefaultStore(self._GetDefaultStores()) DefaultStoreObj = DefaultStore(self._GetDefaultStores())
SkuIds = {skuname:skuid for skuname,skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON} SkuIds = {skuname:skuid for skuname,skuid in self.SkuIdMgr.AvailableSkuIdSet.items() if skuname != TAB_COMMON}
DefaultStores = set([storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict.keys()]) DefaultStores = set([storename for pcdobj in PcdSet.values() for skuobj in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict])
for PcdCName, TokenSpaceGuid in PcdSet: for PcdCName, TokenSpaceGuid in PcdSet:
PcdObj = PcdSet[(PcdCName, TokenSpaceGuid)] PcdObj = PcdSet[(PcdCName, TokenSpaceGuid)]
self.CopyDscRawValue(PcdObj) self.CopyDscRawValue(PcdObj)