Andreas Sandberg has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/39584 )

Change subject: python: Remove Python 2.7 compatibility code
......................................................................

python: Remove Python 2.7 compatibility code

We don't support Python 2.7 anymore. Remove glue code like the six
dependency and "from __future__" imports from gem5's standard library.

Change-Id: I71834c325f86ff0329b222be87794ead96081f05
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39584
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
---
M src/python/importer.py
M src/python/m5/SimObject.py
M src/python/m5/__init__.py
M src/python/m5/core.py
M src/python/m5/debug.py
M src/python/m5/event.py
M src/python/m5/ext/__init__.py
M src/python/m5/internal/params.py
M src/python/m5/main.py
M src/python/m5/objects/__init__.py
M src/python/m5/options.py
M src/python/m5/params.py
M src/python/m5/proxy.py
M src/python/m5/simulate.py
M src/python/m5/stats/__init__.py
M src/python/m5/ticks.py
M src/python/m5/trace.py
M src/python/m5/util/__init__.py
M src/python/m5/util/attrdict.py
M src/python/m5/util/code_formatter.py
M src/python/m5/util/convert.py
M src/python/m5/util/dot_writer.py
M src/python/m5/util/fdthelper.py
M src/python/m5/util/grammar.py
M src/python/m5/util/jobfile.py
M src/python/m5/util/multidict.py
M src/python/m5/util/pybind.py
M src/python/m5/util/terminal.py
28 files changed, 32 insertions(+), 133 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Jason Lowe-Power: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/python/importer.py b/src/python/importer.py
index c29fb7b..b89b4a8 100644
--- a/src/python/importer.py
+++ b/src/python/importer.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 # Simple importer that allows python to import data from a dict of
 # code objects.  The keys are the module path, and the items are the
 # filename and bytecode of the file.
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index b47d98d..1697237 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -38,13 +38,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-from six import add_metaclass
-import six
-if six.PY3:
-    long = int
-
 import sys
 from types import FunctionType, MethodType, ModuleType
 from functools import wraps
@@ -1178,8 +1171,7 @@
 # The SimObject class is the root of the special hierarchy.  Most of
 # the code in this class deals with the configuration hierarchy itself
 # (parent/child node relationships).
-@add_metaclass(MetaSimObject)
-class SimObject(object):
+class SimObject(object, metaclass=MetaSimObject):
     # Specify metaclass.  Any class inheriting from SimObject will
     # get this metaclass.
     type = 'SimObject'
diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py
index 309764d..254d9a6 100644
--- a/src/python/m5/__init__.py
+++ b/src/python/m5/__init__.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 # Import useful subpackages of M5, but *only* when run as an m5
 # script.  This is mostly to keep backward compatibility with existing
 # scripts while allowing new SCons code to operate properly.
diff --git a/src/python/m5/core.py b/src/python/m5/core.py
index 34d54bc..fcbf4aa 100644
--- a/src/python/m5/core.py
+++ b/src/python/m5/core.py
@@ -36,8 +36,5 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 from _m5.core import setOutputDir
 from _m5.loader import setInterpDir
diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py
index 6b45b16..10d0980 100644
--- a/src/python/m5/debug.py
+++ b/src/python/m5/debug.py
@@ -24,8 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 from collections import Mapping

 import _m5.debug
diff --git a/src/python/m5/event.py b/src/python/m5/event.py
index 9b5532c..f0230cf 100644
--- a/src/python/m5/event.py
+++ b/src/python/m5/event.py
@@ -38,8 +38,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 import m5
 import _m5.event

diff --git a/src/python/m5/ext/__init__.py b/src/python/m5/ext/__init__.py
index f950c98..cdd1f42 100644
--- a/src/python/m5/ext/__init__.py
+++ b/src/python/m5/ext/__init__.py
@@ -35,5 +35,3 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
diff --git a/src/python/m5/internal/params.py b/src/python/m5/internal/params.py
index 1cc6e3a..2fc79c0 100644
--- a/src/python/m5/internal/params.py
+++ b/src/python/m5/internal/params.py
@@ -36,9 +36,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 import inspect
 import _m5

diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 3408889..9342ad0 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -36,8 +36,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 import code
 import datetime
 import os
diff --git a/src/python/m5/objects/__init__.py b/src/python/m5/objects/__init__.py
index f1ff900..3ec3b8c 100644
--- a/src/python/m5/objects/__init__.py
+++ b/src/python/m5/objects/__init__.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 from m5.internal import params
 from m5.SimObject import *

diff --git a/src/python/m5/options.py b/src/python/m5/options.py
index eea2e1d..a580160 100644
--- a/src/python/m5/options.py
+++ b/src/python/m5/options.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 import optparse
 import sys

diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 45082d7..5ff5071 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -54,12 +54,6 @@
 #
 #####################################################################

-from __future__ import print_function
-from six import with_metaclass
-import six
-if six.PY3:
-    long = int
-
 import copy
 import datetime
 import re
@@ -97,7 +91,7 @@

 # Dummy base class to identify types that are legitimate for SimObject
 # parameters.
-class ParamValue(with_metaclass(MetaParamValue, object)):
+class ParamValue(object, metaclass=MetaParamValue):
     cmd_line_settable = False

     # Generate the code needed as a prerequisite for declaring a C++
@@ -235,7 +229,7 @@
 # that the value is a vector (list) of the specified type instead of a
 # single value.

-class VectorParamValue(with_metaclass(MetaParamValue, list)):
+class VectorParamValue(list, metaclass=MetaParamValue):
     def __setattr__(self, attr, value):
         raise AttributeError("Not allowed to set %s on '%s'" % \
                              (attr, type(self).__name__))
@@ -467,9 +461,6 @@
     def __float__(self):
         return float(self.value)

-    def __long__(self):
-        return long(self.value)
-
     def __int__(self):
         return int(self.value)

@@ -538,11 +529,6 @@
     def __lt__(self, other):
         return self.value < NumericParamValue.unwrap(other)

-    # Python 2.7 pre __future__.division operators
-    # TODO: Remove these when after "import division from __future__"
-    __div__ =  __truediv__
-    __idiv__ = __itruediv__
-
     def config_value(self):
         return self.value

@@ -586,7 +572,7 @@
 # class is subclassed to generate parameter classes with specific
 # bounds.  Initialization of the min and max bounds is done in the
 # metaclass CheckedIntType.__init__.
-class CheckedInt(with_metaclass(CheckedIntType, NumericParamValue)):
+class CheckedInt(NumericParamValue, metaclass=CheckedIntType):
     cmd_line_settable = True

     def _check(self):
@@ -597,8 +583,8 @@
     def __init__(self, value):
         if isinstance(value, str):
             self.value = convert.toInteger(value)
-        elif isinstance(value, (int, long, float, NumericParamValue)):
-            self.value = long(value)
+        elif isinstance(value, (int, float, NumericParamValue)):
+            self.value = int(value)
         else:
raise TypeError("Can't convert object of type %s to CheckedInt" \
                   % type(value).__name__)
@@ -617,7 +603,7 @@
         code('#include "base/types.hh"')

     def getValue(self):
-        return long(self.value)
+        return int(self.value)

class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False class Unsigned(CheckedInt): cxx_type = 'unsigned'; size = 32; unsigned = True
@@ -666,7 +652,7 @@
     cmd_line_settable = True

     def __init__(self, value):
- if isinstance(value, (int, long, float, NumericParamValue, Float, str)):
+        if isinstance(value, (int, float, NumericParamValue, Float, str)):
             self.value = float(value)
         else:
             raise TypeError("Can't convert object of type %s to Float" \
@@ -732,7 +718,7 @@
             except (TypeError, ValueError):
                 # Convert number to string and use long() to do automatic
                 # base conversion (requires base=0 for auto-conversion)
-                self.value = long(str(value), base=0)
+                self.value = int(str(value), base=0)

         self._check()
     def __add__(self, other):
@@ -744,8 +730,8 @@
         try:
             val = convert.toMemorySize(value)
         except TypeError:
-            val = long(value)
-        return "0x%x" % long(val)
+            val = int(value)
+        return "0x%x" % int(val)

 class AddrRange(ParamValue):
     cxx_type = 'AddrRange'
@@ -772,7 +758,7 @@
                 self.intlvMatch = int(kwargs.pop('intlvMatch'))

             if 'masks' in kwargs:
-                self.masks = [ long(x) for x in list(kwargs.pop('masks')) ]
+                self.masks = [ int(x) for x in list(kwargs.pop('masks')) ]
                 self.intlvBits = len(self.masks)
             else:
                 if 'intlvBits' in kwargs:
@@ -825,7 +811,7 @@

     def size(self):
         # Divide the size by the size of the interleaving slice
-        return (long(self.end) - long(self.start)) >> self.intlvBits
+        return (int(self.end) - int(self.start)) >> self.intlvBits

     @classmethod
     def cxx_predecls(cls, code):
@@ -875,7 +861,7 @@
         # Go from the Python class to the wrapped C++ class
         from _m5.range import AddrRange

-        return AddrRange(long(self.start), long(self.end),
+        return AddrRange(int(self.start), int(self.end),
                          self.masks, int(self.intlvMatch))

 # Boolean parameter type.  Python doesn't let you subclass bool, since
@@ -1016,7 +1002,7 @@
             try:
                 self.ip = convert.toIpAddress(value)
             except TypeError:
-                self.ip = long(value)
+                self.ip = int(value)
         self.verifyIp()

     def __call__(self, value):
@@ -1218,7 +1204,7 @@
     if isinstance(value, struct_time):
         return value

-    if isinstance(value, (int, long)):
+    if isinstance(value, int):
         return gmtime(value)

     if isinstance(value, (datetime, date)):
@@ -1444,7 +1430,7 @@


 # Base class for enum types.
-class Enum(with_metaclass(MetaEnum, ParamValue)):
+class Enum(ParamValue, metaclass=MetaEnum):
     vals = []
     cmd_line_settable = True

@@ -1538,7 +1524,7 @@
         return value

     def getValue(self):
-        return long(self.value)
+        return int(self.value)

     @classmethod
     def cxx_ini_predecls(cls, code):
@@ -1583,7 +1569,7 @@
             value = self.value
         else:
             value = ticks.fromSeconds(self.value)
-        return long(value)
+        return int(value)

     def config_value(self):
         return self.getValue()
@@ -1626,7 +1612,7 @@
             value = self.value
         else:
             value = ticks.fromSeconds(1.0 / self.value)
-        return long(value)
+        return int(value)

     def config_value(self):
         return self.getValue()
@@ -1792,7 +1778,7 @@
 # make_param_value() above that lets these be assigned where a
 # SimObject is required.
 # only one copy of a particular node
-class NullSimObject(with_metaclass(Singleton, object)):
+class NullSimObject(object, metaclass=Singleton):
     _name = 'Null'

     def __call__(cls):
@@ -2159,7 +2145,7 @@
 # 'Fake' ParamDesc for Port references to assign to the _pdesc slot of
 # proxy objects (via set_param_desc()) so that proxy error messages
 # make sense.
-class PortParamDesc(with_metaclass(Singleton, object)):
+class PortParamDesc(object, metaclass=Singleton):
     ptype_str = 'Port'
     ptype = Port

diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index d15b6f2..fe4cb65 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -42,15 +42,8 @@
 #
 #####################################################################

-from __future__ import print_function
-from __future__ import absolute_import
-import six
-if six.PY3:
-    long = int
-
 import copy

-
 class BaseProxy(object):
     def __init__(self, search_self, search_up):
         self._search_self = search_self
@@ -74,7 +67,7 @@

     def _gen_op(operation):
         def op(self, operand):
-            if not (isinstance(operand, (int, long, float)) or \
+            if not (isinstance(operand, (int, float)) or \
                 isproxy(operand)):
                 raise TypeError(
"Proxy operand must be a constant or a proxy to a param")
diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py
index 080d725..a1a05dc 100644
--- a/src/python/m5/simulate.py
+++ b/src/python/m5/simulate.py
@@ -37,8 +37,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 import atexit
 import os
 import sys
diff --git a/src/python/m5/stats/__init__.py b/src/python/m5/stats/__init__.py
index 1fc6c9c..cba1a32 100644
--- a/src/python/m5/stats/__init__.py
+++ b/src/python/m5/stats/__init__.py
@@ -37,9 +37,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 import m5

 import _m5.stats
diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py
index cdba1e8..1ec012b 100644
--- a/src/python/m5/ticks.py
+++ b/src/python/m5/ticks.py
@@ -24,11 +24,7 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
 import decimal
-import six
-if six.PY3:
-    long = int

 import sys
 from m5.util import warn
@@ -42,7 +38,7 @@
     from m5.util import convert
     import _m5.core

-    if isinstance(ticksPerSecond, (int, long)):
+    if isinstance(ticksPerSecond, int):
         tps = ticksPerSecond
     elif isinstance(ticksPerSecond, float):
         tps = ticksPerSecond
diff --git a/src/python/m5/trace.py b/src/python/m5/trace.py
index f7b464c..9603914 100644
--- a/src/python/m5/trace.py
+++ b/src/python/m5/trace.py
@@ -24,8 +24,5 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 # Export native methods to Python
 from _m5.trace import output, ignore, disable, enable
diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py
index deab0fc..74c0ec0 100644
--- a/src/python/m5/util/__init__.py
+++ b/src/python/m5/util/__init__.py
@@ -37,14 +37,11 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 import os
 import re
 import sys

-from six import string_types
-from six.moves import zip_longest
+from itertools import zip_longest

 from . import convert
 from . import jobfile
@@ -123,7 +120,7 @@
     def make_version_list(v):
         if isinstance(v, (list,tuple)):
             return v
-        elif isinstance(v, string_types):
+        elif isinstance(v, str):
             return list(map(lambda x: int(re.match('\d+', x).group()),
                             v.split('.')))
         else:
diff --git a/src/python/m5/util/attrdict.py b/src/python/m5/util/attrdict.py
index 453daf7..a072783 100644
--- a/src/python/m5/util/attrdict.py
+++ b/src/python/m5/util/attrdict.py
@@ -24,8 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 __all__ = [ 'attrdict', 'multiattrdict', 'optiondict' ]

 class attrdict(dict):
diff --git a/src/python/m5/util/code_formatter.py b/src/python/m5/util/code_formatter.py
index 37880de..0ca8c98 100644
--- a/src/python/m5/util/code_formatter.py
+++ b/src/python/m5/util/code_formatter.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from six import add_metaclass
-
 try:
     import builtins
 except ImportError:
@@ -112,8 +109,7 @@
                 }
cls.pattern = re.compile(pat, re.VERBOSE | re.DOTALL | re.MULTILINE)

-@add_metaclass(code_formatter_meta)
-class code_formatter(object):
+class code_formatter(object, metaclass=code_formatter_meta):
     delim = r'$'
     ident = r'[_A-z]\w*'
     pos = r'[0-9]+'
diff --git a/src/python/m5/util/convert.py b/src/python/m5/util/convert.py
index 73335e6..ff452cd 100644
--- a/src/python/m5/util/convert.py
+++ b/src/python/m5/util/convert.py
@@ -25,10 +25,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-import six
-if six.PY3:
-    long = int
-
 # metric prefixes
 atto  = 1.0e-18
 femto = 1.0e-15
diff --git a/src/python/m5/util/dot_writer.py b/src/python/m5/util/dot_writer.py
index 8b757e8..7b10fdc 100644
--- a/src/python/m5/util/dot_writer.py
+++ b/src/python/m5/util/dot_writer.py
@@ -53,9 +53,6 @@
 #
 #####################################################################

-from __future__ import print_function
-from __future__ import absolute_import
-
 import m5, os, re
 from m5.SimObject import isRoot, isSimObjectVector
 from m5.params import PortRef, isNullPointer
diff --git a/src/python/m5/util/fdthelper.py b/src/python/m5/util/fdthelper.py
index 7ad3aba..d9dec11 100644
--- a/src/python/m5/util/fdthelper.py
+++ b/src/python/m5/util/fdthelper.py
@@ -35,10 +35,6 @@
 #
 # Author: Glenn Bergmans

-import six
-if six.PY3:
-    long = int
-
 from m5.ext.pyfdt import pyfdt
 import re
 import os
@@ -56,7 +52,7 @@
             words = [words]
# Make sure all values are ints (use automatic base detection if the
         # type is str)
- words = [long(w, base=0) if type(w) == str else long(w) for w in words] + words = [int(w, base=0) if type(w) == str else int(w) for w in words]
         super(FdtPropertyWords, self).__init__(name, words)

 class FdtPropertyStrings(pyfdt.FdtPropertyStrings):
@@ -122,7 +118,7 @@
     def int_to_cells(self, value, cells):
"""Helper function for: generates a list of 32 bit cells from an int,
         used to split up addresses in appropriate 32 bit chunks."""
-        value = long(value)
+        value = int(value)

         if (value >> (32 * cells)) != 0:
             fatal("Value %d doesn't fit in %d cells" % (value, cells))
diff --git a/src/python/m5/util/grammar.py b/src/python/m5/util/grammar.py
index e09c989..9aba746 100644
--- a/src/python/m5/util/grammar.py
+++ b/src/python/m5/util/grammar.py
@@ -25,7 +25,6 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 import os
-from six import string_types

 import ply.lex
 import ply.yacc
@@ -94,7 +93,7 @@
             "'%s' object has no attribute '%s'" % (type(self), attr))

def parse_string(self, data, source='<string>', debug=None, tracking=0):
-        if not isinstance(data, string_types):
+        if not isinstance(data, str):
             raise AttributeError(
                 "argument must be a string, was '%s'" % type(f))

@@ -113,7 +112,7 @@
         return result

     def parse_file(self, f, **kwargs):
-        if isinstance(f, string_types):
+        if isinstance(f, str):
             source = f
             f = open(f, 'r')
         elif isinstance(f, file):
diff --git a/src/python/m5/util/jobfile.py b/src/python/m5/util/jobfile.py
index e1bd5b2..e262cf1 100644
--- a/src/python/m5/util/jobfile.py
+++ b/src/python/m5/util/jobfile.py
@@ -24,9 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-
 import sys

 class Data(object):
diff --git a/src/python/m5/util/multidict.py b/src/python/m5/util/multidict.py
index 1558907..78b2c8b 100644
--- a/src/python/m5/util/multidict.py
+++ b/src/python/m5/util/multidict.py
@@ -24,8 +24,6 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-
 __all__ = [ 'multidict' ]

 class multidict(object):
diff --git a/src/python/m5/util/pybind.py b/src/python/m5/util/pybind.py
index 18df3bb..bb73be9 100644
--- a/src/python/m5/util/pybind.py
+++ b/src/python/m5/util/pybind.py
@@ -33,14 +33,9 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-from __future__ import print_function
-from __future__ import absolute_import
-from six import add_metaclass
-
 from abc import *

-@add_metaclass(ABCMeta)
-class PyBindExport(object):
+class PyBindExport(object, metaclass=ABCMeta):
     @abstractmethod
     def export(self, code, cname):
         pass
diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py
index bb4ac80..f50e92db 100644
--- a/src/python/m5/util/terminal.py
+++ b/src/python/m5/util/terminal.py
@@ -26,9 +26,6 @@
 #
 # Author: Steve Reinhardt

-from __future__ import print_function
-from __future__ import absolute_import
-
 import sys

 # Intended usage example:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/39584
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I71834c325f86ff0329b222be87794ead96081f05
Gerrit-Change-Number: 39584
Gerrit-PatchSet: 3
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Bobby R. Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to