]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: refactor and remove out of date use of .keys()
authorCarsey, Jaben </o=Intel/ou=Americas01/cn=Workers/cn=Carsey, Jaben>
Thu, 5 Apr 2018 23:14:02 +0000 (07:14 +0800)
committerYonghong Zhu <yonghong.zhu@intel.com>
Tue, 10 Apr 2018 02:05:16 +0000 (10:05 +0800)
this is no longer required to make dictionary objects iterable.

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>
BaseTools/Scripts/SmiHandlerProfileSymbolGen.py
BaseTools/Source/Python/AutoGen/GenMake.py
BaseTools/Source/Python/GenFds/Fv.py
BaseTools/Source/Python/GenFds/Section.py
BaseTools/Source/Python/TargetTool/TargetTool.py
BaseTools/Source/Python/UPT/PomAdapter/InfPomAlignment.py
BaseTools/Source/Python/build/build.py

index f03278b64f8f74f85e1c169f9a1fcbc52c29a584..26c09241038678e2b1f95832421d808264c6bf3a 100644 (file)
@@ -204,7 +204,7 @@ def genGuidString(guidreffile):
         if len(guidLineList) == 2:\r
             guid = guidLineList[0]\r
             guidName = guidLineList[1]\r
-            if guid not in dictGuid.keys() :\r
+            if guid not in dictGuid :\r
                 dictGuid[guid] = guidName\r
 \r
 def createSym(symbolName):\r
@@ -256,7 +256,7 @@ def main():
         for smiEntry in SmiEntry:\r
             if smiEntry.hasAttribute("HandlerType"):\r
                 guidValue = smiEntry.getAttribute("HandlerType")\r
-                if guidValue in dictGuid.keys() :\r
+                if guidValue in dictGuid:\r
                     smiEntry.setAttribute("HandlerType", dictGuid[guidValue])\r
             SmiHandler = smiEntry.getElementsByTagName("SmiHandler")\r
             for smiHandler in SmiHandler:\r
index 533fdb54231ce3ec0ed5bb2db389479962bdd900..b7594d8988da5a10ec6d35676a80de8670ed16ab 100644 (file)
@@ -492,7 +492,7 @@ cleanlib:
             ImageEntryPoint = "_ModuleEntryPoint"\r
 \r
         for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
-            if k not in self._AutoGenObject.Macros.keys():\r
+            if k not in self._AutoGenObject.Macros:\r
                 self._AutoGenObject.Macros[k] = v\r
 \r
         if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
index 14e36b88596601df317844f6d49b3f0d55025bd2..345ad3bdcc90036d53f9af00893e4eac34ca156c 100644 (file)
@@ -318,7 +318,7 @@ class FV (FvClassObject):
                                           ' %s' %ErasePloarity    + \\r
                                           T_CHAR_LF)\r
         if not (self.FvAttributeDict is None):\r
-            for FvAttribute in self.FvAttributeDict.keys() :\r
+            for FvAttribute in self.FvAttributeDict:\r
                 if FvAttribute == "FvUsedSizeEnable":\r
                     if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1') :\r
                         self.UsedSizeEnable = True\r
index 5e0b4bee7d1c509f8f81bedca7b9ee5f3786a1d6..6335c249a693e2eb98bdbc7ecd9c6cb90d695d94 100644 (file)
@@ -111,10 +111,7 @@ class Section (SectionClassObject):
     #   @retval tuple       (File list, boolean)\r
     #\r
     def GetFileList(FfsInf, FileType, FileExtension, Dict = {}, IsMakefile=False):\r
-        if FileType in Section.SectFileType.keys() :\r
-            IsSect = True\r
-        else :\r
-            IsSect = False\r
+        IsSect = FileType in Section.SectFileType\r
 \r
         if FileExtension is not None:\r
             Suffix = FileExtension\r
index ede9713c9b8b558be6cd995d02d064b7bc2106b4..143b53ec35efb516647287608910a34de622c5c3 100644 (file)
@@ -80,9 +80,8 @@ class TargetTool():
             traceback.print_exception(last_type, last_value, last_tb)\r
 \r
     def Print(self):\r
-        KeyList = self.TargetTxtDictionary.keys()\r
         errMsg  = ''\r
-        for Key in KeyList:\r
+        for Key in self.TargetTxtDictionary:\r
             if type(self.TargetTxtDictionary[Key]) == type([]):\r
                 print "%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key]))\r
             elif self.TargetTxtDictionary[Key] is None:\r
index e37a0b6c3be7191cca043ea9172c0fa1d39d11c8..165ac111272a23a6da56c7d4c3c4900bf3936106 100644 (file)
@@ -486,10 +486,7 @@ class InfPomAlignment(ModuleObject):
             #\r
             # Get all LibraryClasses\r
             #\r
-            LibClassObj = self.Parser.InfLibraryClassSection.LibraryClasses\r
-            Keys = LibClassObj.keys()\r
-            for Key in Keys:\r
-                LibraryClassData = LibClassObj[Key]\r
+            for LibraryClassData in self.Parser.InfLibraryClassSection.LibraryClasses.values():\r
                 for Item in LibraryClassData:\r
                     LibraryClass = CommonObject.LibraryClassObject()\r
                     LibraryClass.SetUsage(DT.USAGE_ITEM_CONSUMES)\r
index 4aca280984625e4fd7dc938b2ed57e1a6efec362..6fb2e0ed3d0966f0a171b19c2ef29970277c3f98 100644 (file)
@@ -1423,9 +1423,7 @@ class Build():
     def _RebaseModule (self, MapBuffer, BaseAddress, ModuleList, AddrIsOffset = True, ModeIsSmm = False):\r
         if ModeIsSmm:\r
             AddrIsOffset = False\r
-        InfFileNameList = ModuleList.keys()\r
-        #InfFileNameList.sort()\r
-        for InfFile in InfFileNameList:\r
+        for InfFile in ModuleList:\r
             sys.stdout.write (".")\r
             sys.stdout.flush()\r
             ModuleInfo = ModuleList[InfFile]\r