public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Gary Lin <glin@suse.com>
To: edk2-devel@lists.01.org
Cc: Yonghong Zhu <yonghong.zhu@intel.com>, Liming Gao <liming.gao@intel.com>
Subject: [PATCH v4 06/13] BaseTools: Remove the deprecated hash_key()
Date: Mon, 25 Jun 2018 18:31:29 +0800	[thread overview]
Message-ID: <20180625103136.12531-7-glin@suse.com> (raw)
In-Reply-To: <20180625103136.12531-1-glin@suse.com>

Replace "has_key()" with "in" to be compatible with python3.
Based on "futurize -f lib2to3.fixes.fix_has_key"

Contributed-under: TianoCore Contribution Agreement 1.1
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Gary Lin <glin@suse.com>
---
 BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py         |  2 +-
 BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py |  6 +++---
 BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py        |  8 ++++----
 BaseTools/Source/Python/AutoGen/AutoGen.py                                         |  4 ++--
 BaseTools/Source/Python/Common/VpdInfoFile.py                                      |  2 +-
 BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py                              | 16 ++++++++--------
 BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py                       |  6 +++---
 BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py                       |  2 +-
 BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py                         |  4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py               |  2 +-
 BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py                               |  4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py                     |  4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py                          |  4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py                          |  4 ++--
 BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py                     |  2 +-
 BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py                       |  3 +--
 BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py                |  4 ++--
 BaseTools/Source/Python/build/build.py                                             |  2 +-
 18 files changed, 39 insertions(+), 40 deletions(-)

diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
index ea83327052f2..ccfef6b6e280 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
@@ -140,7 +140,7 @@ class BaseINIFile(object):
                     sObj = self.GetSectionInstance(self, name, (len(sname_arr) > 1))
                     sObj._start = index
                     sObjs.append(sObj)
-                    if not self._sections.has_key(name.lower()):
+                    if name.lower() not in self._sections:
                         self._sections[name.lower()] = [sObj]
                     else:
                         self._sections[name.lower()].append(sObj)
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
index 7c120d85c255..b49c87c8bdab 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
@@ -26,7 +26,7 @@ class SurfaceObject(object):
 
         """
         obj = object.__new__(cls, *args, **kwargs)
-        if not cls._objs.has_key("None"):
+        if "None" not in cls._objs:
             cls._objs["None"] = []
         cls._objs["None"].append(obj)
 
@@ -47,7 +47,7 @@ class SurfaceObject(object):
         self.GetFileObj().Destroy(self)
         del self._fileObj
         # dereference self from _objs arrary
-        assert self._objs.has_key(key), "when destory, object is not in obj list"
+        assert key in self._objs, "when destory, object is not in obj list"
         assert self in self._objs[key], "when destory, object is not in obj list"
         self._objs[key].remove(self)
         if len(self._objs[key]) == 0:
@@ -95,7 +95,7 @@ class SurfaceObject(object):
         if self not in cls._objs["None"]:
             ErrorMsg("Sufrace object does not be create into None list")
         cls._objs["None"].remove(self)
-        if not cls._objs.has_key(relativePath):
+        if relativePath not in cls._objs:
             cls._objs[relativePath] = []
         cls._objs[relativePath].append(self)
 
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
index 32b26850e766..793e95efedcc 100644
--- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
+++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py
@@ -61,7 +61,7 @@ class INFFile(ini.BaseINIFile):
         classname = self.GetProduceLibraryClass()
         if classname is not None:
             libobjdict = INFFile._libobjs
-            if libobjdict.has_key(classname):
+            if classname in libobjdict:
                 if self not in libobjdict[classname]:
                     libobjdict[classname].append(self)
             else:
@@ -169,7 +169,7 @@ class INFLibraryClassObject(INFSectionObject):
     def Parse(self):
         self._classname = self.GetLineByOffset(self._start).split('#')[0].strip()
         objdict = INFLibraryClassObject._objs
-        if objdict.has_key(self._classname):
+        if self._classname in objdict:
             objdict[self._classname].append(self)
         else:
             objdict[self._classname] = [self]
@@ -241,7 +241,7 @@ class INFSourceObject(INFSectionObject):
 
         self.mFilename = os.path.basename(self.GetSourceFullPath())
         objdict = INFSourceObject._objs
-        if not objdict.has_key(self.mFilename):
+        if self.mFilename not in objdict:
             objdict[self.mFilename] = [self]
         else:
             objdict[self.mFilename].append(self)
@@ -303,7 +303,7 @@ class INFPcdObject(INFSectionObject):
             self.mDefaultValue = arr[1].strip()
 
         objdict = INFPcdObject._objs
-        if objdict.has_key(self.GetName()):
+        if self.GetName() in objdict:
             if self not in objdict[self.GetName()]:
                 objdict[self.GetName()].append(self)
         else:
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index d7485909414d..dbcf662389e4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1798,8 +1798,8 @@ class PlatformAutoGen(AutoGen):
             # retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.
             BPDGToolName = None
             for ToolDef in self.ToolDefinition.values():
-                if ToolDef.has_key(TAB_GUID) and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:
-                    if not ToolDef.has_key("PATH"):
+                if TAB_GUID in ToolDef and ToolDef[TAB_GUID] == self.Platform.VpdToolGuid:
+                    if "PATH" not in ToolDef:
                         EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % self.Platform.VpdToolGuid)
                     BPDGToolName = ToolDef["PATH"]
                     break
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 435b23f203a0..ddabe9fb2546 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -211,7 +211,7 @@ class VpdInfoFile:
     #
     #  @param vpd    A given VPD PCD 
     def GetOffset(self, vpd):
-        if not self._VpdArray.has_key(vpd):
+        if vpd not in self._VpdArray:
             return None
         
         if len(self._VpdArray[vpd]) == 0:
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
index bfd422b196ba..b97b319e0956 100644
--- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
+++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py
@@ -438,14 +438,14 @@ def GenLibraryClasses(ModuleObject):
                 Statement = '# Guid: ' + LibraryItem.Guid + ' Version: ' + LibraryItem.Version
 
                 if len(BinaryFile.SupArchList) == 0:
-                    if LibraryClassDict.has_key('COMMON') and Statement not in LibraryClassDict['COMMON']:
+                    if 'COMMON' in LibraryClassDict and Statement not in LibraryClassDict['COMMON']:
                         LibraryClassDict['COMMON'].append(Statement)
                     else:
                         LibraryClassDict['COMMON'] = ['## @LIB_INSTANCES']
                         LibraryClassDict['COMMON'].append(Statement)
                 else:
                     for Arch in BinaryFile.SupArchList:
-                        if LibraryClassDict.has_key(Arch):
+                        if Arch in LibraryClassDict:
                             if Statement not in LibraryClassDict[Arch]:
                                 LibraryClassDict[Arch].append(Statement)
                             else:
@@ -917,14 +917,14 @@ def GenAsBuiltPacthPcdSections(ModuleObject):
             if FileNameObjList:
                 ArchList = FileNameObjList[0].GetSupArchList()
             if len(ArchList) == 0:
-                if PatchPcdDict.has_key(DT.TAB_ARCH_COMMON):
+                if DT.TAB_ARCH_COMMON in PatchPcdDict:
                     if Statement not in PatchPcdDict[DT.TAB_ARCH_COMMON]:
                         PatchPcdDict[DT.TAB_ARCH_COMMON].append(Statement)
                 else:
                     PatchPcdDict[DT.TAB_ARCH_COMMON] = [Statement]
             else:
                 for Arch in ArchList:
-                    if PatchPcdDict.has_key(Arch):
+                    if Arch in PatchPcdDict:
                         if Statement not in PatchPcdDict[Arch]:
                             PatchPcdDict[Arch].append(Statement)
                     else:
@@ -967,13 +967,13 @@ def GenAsBuiltPcdExSections(ModuleObject):
                 ArchList = FileNameObjList[0].GetSupArchList()
 
             if len(ArchList) == 0:
-                if PcdExDict.has_key('COMMON'):
+                if 'COMMON' in PcdExDict:
                     PcdExDict['COMMON'].append(Statement)
                 else:
                     PcdExDict['COMMON'] = [Statement]
             else:
                 for Arch in ArchList:
-                    if PcdExDict.has_key(Arch):
+                    if Arch in PcdExDict:
                         if Statement not in PcdExDict[Arch]:
                             PcdExDict[Arch].append(Statement)
                     else:
@@ -1071,7 +1071,7 @@ def GenBuildOptions(ModuleObject):
             for BuilOptionItem in BinaryFile.AsBuiltList[0].BinaryBuildFlagList:
                 Statement = '#' + BuilOptionItem.AsBuiltOptionFlags
                 if len(BinaryFile.SupArchList) == 0:
-                    if BuildOptionDict.has_key('COMMON'):
+                    if 'COMMON' in BuildOptionDict:
                         if Statement not in BuildOptionDict['COMMON']:
                             BuildOptionDict['COMMON'].append(Statement)
                     else:
@@ -1079,7 +1079,7 @@ def GenBuildOptions(ModuleObject):
                         BuildOptionDict['COMMON'].append(Statement)
                 else:
                     for Arch in BinaryFile.SupArchList:
-                        if BuildOptionDict.has_key(Arch):
+                        if Arch in BuildOptionDict:
                             if Statement not in BuildOptionDict[Arch]:
                                 BuildOptionDict[Arch].append(Statement)
                         else:
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
index 33b142d64e07..cc2fc4905326 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfBinaryObject.py
@@ -272,7 +272,7 @@ class InfBinariesObject(InfSectionCommonDef):
                                 pass
 
             if InfBianryVerItemObj is not None:
-                if self.Binaries.has_key((InfBianryVerItemObj)):
+                if (InfBianryVerItemObj) in self.Binaries:
                     BinariesList = self.Binaries[InfBianryVerItemObj]
                     BinariesList.append((InfBianryVerItemObj, VerComment))
                     self.Binaries[InfBianryVerItemObj] = BinariesList
@@ -522,7 +522,7 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                pass
 
             if InfBianryCommonItemObj is not None:
-                if self.Binaries.has_key((InfBianryCommonItemObj)):
+                if (InfBianryCommonItemObj) in self.Binaries:
                     BinariesList = self.Binaries[InfBianryCommonItemObj]
                     BinariesList.append((InfBianryCommonItemObj, ItemComment))
                     self.Binaries[InfBianryCommonItemObj] = BinariesList
@@ -673,7 +673,7 @@ class InfBinariesObject(InfSectionCommonDef):
 #                                        pass
 
                     if InfBianryUiItemObj is not None:
-                        if self.Binaries.has_key((InfBianryUiItemObj)):
+                        if (InfBianryUiItemObj) in self.Binaries:
                             BinariesList = self.Binaries[InfBianryUiItemObj]
                             BinariesList.append((InfBianryUiItemObj, UiComment))
                             self.Binaries[InfBianryUiItemObj] = BinariesList
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
index 3995546593d8..9d27a92cd6b0 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfDefineObject.py
@@ -957,7 +957,7 @@ class InfDefObject(InfSectionCommonDef):
                     SpecValue = Name[Name.find("SPEC") + len("SPEC"):].strip()
                     Name = "SPEC"
                     Value = SpecValue + " = " + Value
-                if self.Defines.has_key(ArchListString):
+                if ArchListString in self.Defines:
                     DefineList = self.Defines[ArchListString]                 
                     LineInfo[0] = InfDefMemberObj.CurrentLine.GetFileName()
                     LineInfo[1] = InfDefMemberObj.CurrentLine.GetLineNo()
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
index fb8d1f5a62ee..4dfe75a2f16a 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfGuidObject.py
@@ -338,7 +338,7 @@ class InfGuidObject():
                                 #
                                 pass
                                                 
-            if self.Guids.has_key((InfGuidItemObj)):           
+            if (InfGuidItemObj) in self.Guids:
                 GuidList = self.Guids[InfGuidItemObj]                 
                 GuidList.append(InfGuidItemObj)
                 self.Guids[InfGuidItemObj] = GuidList
@@ -350,4 +350,4 @@ class InfGuidObject():
         return True
     
     def GetGuid(self):
-        return self.Guids
\ No newline at end of file
+        return self.Guids
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
index e588c6ba66d8..5de1832b71fa 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfLibraryClassesObject.py
@@ -238,7 +238,7 @@ class InfLibraryClassObject():
                 LibItemObj.SetVersion(LibItem[1])
                 LibItemObj.SetSupArchList(__SupArchList)
 
-            if self.LibraryClasses.has_key((LibItemObj)):
+            if (LibItemObj) in self.LibraryClasses:
                 LibraryList = self.LibraryClasses[LibItemObj]
                 LibraryList.append(LibItemObj)
                 self.LibraryClasses[LibItemObj] = LibraryList
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py b/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
index 37f8cb2336bb..4ed739d66fb2 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfMisc.py
@@ -114,7 +114,7 @@ class InfSpecialCommentObject(InfSectionCommonDef):
            Type == DT.TYPE_EVENT_SECTION or \
            Type == DT.TYPE_BOOTMODE_SECTION:
             for Item in SepcialSectionList:
-                if self.SpecialComments.has_key(Type):           
+                if Type in self.SpecialComments:
                     ObjList = self.SpecialComments[Type]
                     ObjList.append(Item)
                     self.SpecialComments[Type] = ObjList
@@ -145,4 +145,4 @@ def ErrorInInf(Message=None, ErrorCode=None, LineInfo=None, RaiseError=True):
                  File=LineInfo[0], 
                  Line=LineInfo[1],
                  ExtraData=LineInfo[2], 
-                 RaiseError=RaiseError)
\ No newline at end of file
+                 RaiseError=RaiseError)
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
index 01c854a8470e..bfac2b6b571c 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPackagesObject.py
@@ -171,7 +171,7 @@ class InfPackageObject():
                                 #
                                 pass
                                             
-            if self.Packages.has_key((PackageItemObj)):   
+            if (PackageItemObj) in self.Packages:
                 PackageList = self.Packages[PackageItemObj]
                 PackageList.append(PackageItemObj)
                 self.Packages[PackageItemObj] = PackageList
@@ -184,4 +184,4 @@ class InfPackageObject():
     
     def GetPackages(self, Arch = None):
         if Arch is None:
-            return self.Packages
\ No newline at end of file
+            return self.Packages
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
index 62c1e8409a09..3b9dfaed0c98 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py
@@ -411,7 +411,7 @@ class InfPcdObject():
                 else:
                     PcdItemObj.SetSupportArchList(SupArchList)
 
-                if self.Pcds.has_key((PcdTypeItem, PcdItemObj)):
+                if (PcdTypeItem, PcdItemObj) in self.Pcds:
                     PcdsList = self.Pcds[PcdTypeItem, PcdItemObj]
                     PcdsList.append(PcdItemObj)
                     self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
@@ -456,7 +456,7 @@ class InfPcdObject():
                                                       PackageInfo)
 
             PcdTypeItem = KeysList[0][0]
-            if self.Pcds.has_key((PcdTypeItem, PcdItemObj)):
+            if (PcdTypeItem, PcdItemObj) in self.Pcds:
                 PcdsList = self.Pcds[PcdTypeItem, PcdItemObj]
                 PcdsList.append(PcdItemObj)
                 self.Pcds[PcdTypeItem, PcdItemObj] = PcdsList
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
index eb6b6927140b..0f865c569665 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfPpiObject.py
@@ -327,7 +327,7 @@ class InfPpiObject():
                                 # 
                                 pass
             
-            if self.Ppis.has_key((InfPpiItemObj)):           
+            if (InfPpiItemObj) in self.Ppis:
                 PpiList = self.Ppis[InfPpiItemObj]
                 PpiList.append(InfPpiItemObj)
                 self.Ppis[InfPpiItemObj] = PpiList
@@ -340,4 +340,4 @@ class InfPpiObject():
         
     
     def GetPpi(self):
-        return self.Ppis
\ No newline at end of file
+        return self.Ppis
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
index eb03095d6fec..6cadeb5a211c 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfProtocolObject.py
@@ -296,7 +296,7 @@ class InfProtocolObject():
                                 #
                                 pass      
                                       
-            if self.Protocols.has_key((InfProtocolItemObj)):           
+            if (InfProtocolItemObj) in self.Protocols:
                 ProcotolList = self.Protocols[InfProtocolItemObj]
                 ProcotolList.append(InfProtocolItemObj)
                 self.Protocols[InfProtocolItemObj] = ProcotolList
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
index 2302dd5b9673..285e89aacbfc 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfSoucesObject.py
@@ -224,7 +224,7 @@ class InfSourcesObject(InfSectionCommonDef):
                 
             ItemObj.SetSupArchList(__SupArchList) 
                                                                                                       
-            if self.Sources.has_key((ItemObj)):           
+            if (ItemObj) in self.Sources:
                 SourceContent = self.Sources[ItemObj]
                 SourceContent.append(ItemObj)
                 self.Sources[ItemObj] = SourceContent
@@ -237,4 +237,3 @@ class InfSourcesObject(InfSectionCommonDef):
      
     def GetSources(self):
         return self.Sources
-    
\ No newline at end of file
diff --git a/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py b/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py
index 27a1c6ad25a0..f9db2944a495 100644
--- a/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py
+++ b/BaseTools/Source/Python/UPT/Object/Parser/InfUserExtensionObject.py
@@ -103,7 +103,7 @@ class InfUserExtensionObject():
 #                            Line=LineNo,
 #                            ExtraData=None)
             
-            if self.UserExtension.has_key(IdContentItem):           
+            if IdContentItem in self.UserExtension:
                 #
                 # Each UserExtensions section header must have a unique set 
                 # of UserId, IdString and Arch values.
@@ -130,4 +130,4 @@ class InfUserExtensionObject():
         return True
         
     def GetUserExtension(self):
-        return self.UserExtension
\ No newline at end of file
+        return self.UserExtension
diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py
index 416aa73549d1..344b006bc424 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -77,7 +77,7 @@ TmpTableDict = {}
 #   Otherwise, False is returned
 #
 def IsToolInPath(tool):
-    if os.environ.has_key('PATHEXT'):
+    if 'PATHEXT' in os.environ:
         extns = os.environ['PATHEXT'].split(os.path.pathsep)
     else:
         extns = ('',)
-- 
2.17.1



  parent reply	other threads:[~2018-06-25 10:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 10:31 [PATCH v4 00/20] BaseTools: One step toward python3 Gary Lin
2018-06-25 10:31 ` [PATCH v4 01/13] BaseTools: Fix a typo in ini.py Gary Lin
2018-06-25 10:31 ` [PATCH v4 02/13] BaseTools: Refactor python except statements Gary Lin
2018-06-25 10:31 ` [PATCH v4 03/13] BaseTools: Refactor python print statements Gary Lin
2018-06-25 10:31 ` [PATCH v4 04/13] BaseTools: Remove the old python "not-equal" Gary Lin
2018-06-25 10:31 ` [PATCH v4 05/13] BaseTools: Remove tuple parameter in python scripts Gary Lin
2018-06-25 10:31 ` Gary Lin [this message]
2018-06-25 10:31 ` [PATCH v4 07/13] BaseTools: Replace StandardError with Expression Gary Lin
2018-06-25 10:31 ` [PATCH v4 08/13] BaseTools: Remove types.TypeType Gary Lin
2018-06-25 10:31 ` [PATCH v4 09/13] BaseTools: Refactor python raise statement Gary Lin
2018-06-25 10:31 ` [PATCH v4 10/13] BaseTools: Adjust the spaces around commas and colons Gary Lin
2018-06-25 10:31 ` [PATCH v4 11/13] BaseTools: Migrate to the new octal literal Gary Lin
2018-06-25 10:31 ` [PATCH v4 12/13] BaseTools: Fix old python2 idioms Gary Lin
2018-06-25 10:31 ` [PATCH v4 13/13] BaseTools: Replace StringIO.StringIO with io.BytesIO Gary Lin
2018-06-26  3:40 ` [PATCH v4 00/20] BaseTools: One step toward python3 Gary Lin
2018-06-26  4:48 ` Zhu, Yonghong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180625103136.12531-7-glin@suse.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox