#####################################################################
from __future__ import print_function
-from six import add_metaclass
+from six import with_metaclass
import six
if six.PY3:
long = int
# Dummy base class to identify types that are legitimate for SimObject
# parameters.
-@add_metaclass(MetaParamValue)
-class ParamValue(object):
+class ParamValue(with_metaclass(MetaParamValue, object)):
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.
-@add_metaclass(MetaParamValue)
-class VectorParamValue(list):
+class VectorParamValue(with_metaclass(MetaParamValue, list)):
def __setattr__(self, attr, value):
raise AttributeError("Not allowed to set %s on '%s'" % \
(attr, type(self).__name__))
# class is subclassed to generate parameter classes with specific
# bounds. Initialization of the min and max bounds is done in the
# metaclass CheckedIntType.__init__.
-@add_metaclass(CheckedIntType)
-class CheckedInt(NumericParamValue):
+class CheckedInt(with_metaclass(CheckedIntType, NumericParamValue)):
cmd_line_settable = True
def _check(self):
# Base class for enum types.
-@add_metaclass(MetaEnum)
-class Enum(ParamValue):
+class Enum(with_metaclass(MetaEnum, ParamValue)):
vals = []
cmd_line_settable = True
return self.value
# This param will generate a scoped c++ enum and its python bindings.
-@add_metaclass(MetaEnum)
class ScopedEnum(Enum):
vals = []
cmd_line_settable = True
# make_param_value() above that lets these be assigned where a
# SimObject is required.
# only one copy of a particular node
-@add_metaclass(Singleton)
-class NullSimObject(object):
+class NullSimObject(with_metaclass(Singleton, object)):
_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.
-@add_metaclass(Singleton)
-class PortParamDesc(object):
+class PortParamDesc(with_metaclass(Singleton, object)):
ptype_str = 'Port'
ptype = Port