# (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.
# (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
# 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'
# (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.
# (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
# (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
# (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
# (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
# (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
# (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
# (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 *
# (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
#
#####################################################################
-from __future__ import print_function
-from six import with_metaclass
-import six
-if six.PY3:
- long = int
-
import copy
import datetime
import re
# 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++
# 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__))
def __float__(self):
return float(self.value)
- def __long__(self):
- return long(self.value)
-
def __int__(self):
return int(self.value)
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
# 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):
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__)
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
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" \
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):
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'
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:
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):
# 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
try:
self.ip = convert.toIpAddress(value)
except TypeError:
- self.ip = long(value)
+ self.ip = int(value)
self.verifyIp()
def __call__(self, value):
if isinstance(value, struct_time):
return value
- if isinstance(value, (int, long)):
+ if isinstance(value, int):
return gmtime(value)
if isinstance(value, (datetime, date)):
# Base class for enum types.
-class Enum(with_metaclass(MetaEnum, ParamValue)):
+class Enum(ParamValue, metaclass=MetaEnum):
vals = []
cmd_line_settable = True
return value
def getValue(self):
- return long(self.value)
+ return int(self.value)
@classmethod
def cxx_ini_predecls(cls, code):
value = self.value
else:
value = ticks.fromSeconds(self.value)
- return long(value)
+ return int(value)
def config_value(self):
return self.getValue()
value = self.value
else:
value = ticks.fromSeconds(1.0 / self.value)
- return long(value)
+ return int(value)
def config_value(self):
return self.getValue()
# 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):
# '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
#
#####################################################################
-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
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")
# (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
# (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
# (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
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
# (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
# (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
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:
# (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):
# (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:
}
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]+'
# (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
#
#####################################################################
-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
#
# Author: Glenn Bergmans
-import six
-if six.PY3:
- long = int
-
from m5.ext.pyfdt import pyfdt
import re
import os
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):
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))
# 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
"'%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))
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):
# (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):
# (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):
# (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
#
# Author: Steve Reinhardt
-from __future__ import print_function
-from __future__ import absolute_import
-
import sys
# Intended usage example: