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

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