BaseTools: refactor and 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-17 22:40:15 +08:00
committed by Yonghong Zhu
parent 55c84777ee
commit 9eb87141ec
27 changed files with 137 additions and 159 deletions

View File

@ -1,7 +1,7 @@
## @file
# generate capsule
#
# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@ -201,7 +201,7 @@ class Capsule (CapsuleClassObject) :
# @retval string Generated Capsule file path
#
def GenCapsule(self):
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict:
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)
@ -251,11 +251,11 @@ class Capsule (CapsuleClassObject) :
CapInfFile.writelines("[options]" + T_CHAR_LF)
for Item in self.TokensDict.keys():
for Item in self.TokensDict:
CapInfFile.writelines("EFI_" + \
Item + \
' = ' + \
self.TokensDict.get(Item) + \
self.TokensDict[Item] + \
T_CHAR_LF)
return CapInfFile