Andreas Sandberg has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/15984
Change subject: python: Replace DictMixin with Mapping / MutableMapping
......................................................................
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 <[email protected]>
---
M src/python/m5/debug.py
M src/python/m5/util/orderdict.py
2 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py
index f7e34a7..d2892f7 100644
--- a/src/python/m5/debug.py
+++ b/src/python/m5/debug.py
@@ -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 @@
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 @@
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 @@
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()
diff --git a/src/python/m5/util/orderdict.py
b/src/python/m5/util/orderdict.py
index 26bc9be..5a32151 100644
--- a/src/python/m5/util/orderdict.py
+++ b/src/python/m5/util/orderdict.py
@@ -31,9 +31,9 @@
__all__ = [ 'orderdict' ]
-from UserDict import DictMixin
+from collections import MutableMapping
-class orderdict(dict, DictMixin):
+class orderdict(dict, MutableMapping):
def __init__(self, *args, **kwargs):
if len(args) > 1:
raise TypeError("expected at most one argument, got %d" % \
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15984
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I61fbe366d2c9fc6e01b470f82f49cc02b99dec32
Gerrit-Change-Number: 15984
Gerrit-PatchSet: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev