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>
This commit is contained in:
Gary Lin
2018-06-25 18:31:29 +08:00
committed by Yonghong Zhu
parent 890d8ede68
commit 27c4ceb41c
18 changed files with 39 additions and 40 deletions

View File

@ -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)