From 6e08be1ec41342e0710f5335b79cae7986822862 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Fri, 25 Jan 2019 12:00:20 +0000 Subject: [PATCH] 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 Reviewed-on: https://gem5-review.googlesource.com/c/15984 Reviewed-by: Jason Lowe-Power --- src/python/m5/debug.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py index f7e34a728..d2892f7e3 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 @@ 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() -- 2.30.2