python: Replace DictMixin with Mapping / MutableMapping
Python 3 has removed support for DictMixin, so switch to Mapping / MutableMapping in collections which provides the same functionality. Change-Id: I61fbe366d2c9fc6e01b470f82f49cc02b99dec32 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15984 Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
from UserDict import DictMixin
|
||||
from collections import Mapping
|
||||
|
||||
import _m5.debug
|
||||
from _m5.debug import SimpleFlag, CompoundFlag
|
||||
@@ -56,7 +56,7 @@ def help():
|
||||
printList([ c.name() for c in children ], indent=8)
|
||||
print()
|
||||
|
||||
class AllFlags(DictMixin):
|
||||
class AllFlags(Mapping):
|
||||
def __init__(self):
|
||||
self._version = -1
|
||||
self._dict = {}
|
||||
@@ -79,6 +79,14 @@ class AllFlags(DictMixin):
|
||||
self._update()
|
||||
return self._dict[item]
|
||||
|
||||
def __iter__(self):
|
||||
self._update()
|
||||
return iter(self._dict)
|
||||
|
||||
def __len__(self):
|
||||
self._update()
|
||||
return len(self._dict)
|
||||
|
||||
def keys(self):
|
||||
self._update()
|
||||
return self._dict.keys()
|
||||
@@ -91,16 +99,4 @@ class AllFlags(DictMixin):
|
||||
self._update()
|
||||
return self._dict.items()
|
||||
|
||||
def iterkeys(self):
|
||||
self._update()
|
||||
return self._dict.iterkeys()
|
||||
|
||||
def itervalues(self):
|
||||
self._update()
|
||||
return self._dict.itervalues()
|
||||
|
||||
def iteritems(self):
|
||||
self._update()
|
||||
return self._dict.iteritems()
|
||||
|
||||
flags = AllFlags()
|
||||
|
||||
Reference in New Issue
Block a user