python: Replace dict.has_key with 'key in dict'
Python 3 has removed dict.has_key in favour of 'key in dict'. Change-Id: I9852a5f57d672bea815308eb647a0ce45624fad5 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15987 Reviewed-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
This commit is contained in:
@@ -157,12 +157,12 @@ class ParamDesc(object):
|
||||
else:
|
||||
raise TypeError('too many arguments')
|
||||
|
||||
if kwargs.has_key('desc'):
|
||||
if 'desc' in kwargs:
|
||||
assert(not hasattr(self, 'desc'))
|
||||
self.desc = kwargs['desc']
|
||||
del kwargs['desc']
|
||||
|
||||
if kwargs.has_key('default'):
|
||||
if 'default' in kwargs:
|
||||
assert(not hasattr(self, 'default'))
|
||||
self.default = kwargs['default']
|
||||
del kwargs['default']
|
||||
@@ -1224,14 +1224,14 @@ class MetaEnum(MetaParamValue):
|
||||
return cls
|
||||
|
||||
def __init__(cls, name, bases, init_dict):
|
||||
if init_dict.has_key('map'):
|
||||
if 'map' in init_dict:
|
||||
if not isinstance(cls.map, dict):
|
||||
raise TypeError("Enum-derived class attribute 'map' " \
|
||||
"must be of type dict")
|
||||
# build list of value strings from map
|
||||
cls.vals = cls.map.keys()
|
||||
cls.vals.sort()
|
||||
elif init_dict.has_key('vals'):
|
||||
elif 'vals' in init_dict:
|
||||
if not isinstance(cls.vals, list):
|
||||
raise TypeError("Enum-derived class attribute 'vals' " \
|
||||
"must be of type list")
|
||||
@@ -1855,7 +1855,7 @@ class PortRef(object):
|
||||
"cannot splice in new peers\n", self)
|
||||
|
||||
def clone(self, simobj, memo):
|
||||
if memo.has_key(self):
|
||||
if self in memo:
|
||||
return memo[self]
|
||||
newRef = copy.copy(self)
|
||||
memo[self] = newRef
|
||||
@@ -1978,7 +1978,7 @@ class VectorPortRef(object):
|
||||
self._get_next().connect(other)
|
||||
|
||||
def clone(self, simobj, memo):
|
||||
if memo.has_key(self):
|
||||
if self in memo:
|
||||
return memo[self]
|
||||
newRef = copy.copy(self)
|
||||
memo[self] = newRef
|
||||
|
||||
Reference in New Issue
Block a user