summaryrefslogtreecommitdiffstats
path: root/BaseTools/Scripts
diff options
context:
space:
mode:
authorGary Lin <glin@suse.com>2018-06-25 18:31:29 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2018-06-27 16:33:23 +0800
commit27c4ceb41cf6b79d440deae215c68e117d69d641 (patch)
tree07b096fb976ac5d38043580f1724092f3c7be427 /BaseTools/Scripts
parent890d8ede6867dd43d96b5b04454f0b571938e3a3 (diff)
downloadedk2-27c4ceb41cf6b79d440deae215c68e117d69d641.tar.gz
edk2-27c4ceb41cf6b79d440deae215c68e117d69d641.tar.bz2
edk2-27c4ceb41cf6b79d440deae215c68e117d69d641.zip
BaseTools: Remove the deprecated hash_key()
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> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Scripts')
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py2
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py6
-rw-r--r--BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/inf.py8
3 files changed, 8 insertions, 8 deletions
diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py
index ea83327052..ccfef6b6e2 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 7c120d85c2..b49c87c8bd 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 32b26850e7..793e95efed 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: