from collections import OrderedDict

from malcolm.core.serializable import Serializable


class AttributeMeta(Serializable):
    """Abstract base class for Meta objects"""

    # Type constants
    SCALAR = "scalar"
    TABLE = "table"
    SCALARARRAY = "scalar_array"

    def __init__(self, name, description, *args):
        super(AttributeMeta, self).__init__(name, *args)
        self.description = description

    def validate(self, value):
        """
        Abstract function to validate a given value

        Args:
            value(abstract): Value to validate
        """

        raise NotImplementedError(
            "Abstract validate function must be implemented in child classes")

    def to_dict(self):
        """Convert object attributes into a dictionary"""

        d = OrderedDict()
        d["description"] = self.description
        d["typeid"] = self.typeid

        return d

from collections import OrderedDict

from malcolm.core.serializable import Serializable


class AttributeMeta(Serializable):
    """Abstract base class for Meta objects"""

    def __init__(self, name, description, *args):
        super(AttributeMeta, self).__init__(name, *args)
        self.description = description

    def validate(self, value):
        """
        Abstract function to validate a given value

        Args:
            value(abstract): Value to validate
        """

        raise NotImplementedError(
            "Abstract validate function must be implemented in child classes")

    def to_dict(self):
        """Convert object attributes into a dictionary"""

        d = OrderedDict()
        d["description"] = self.description
        d["typeid"] = self.typeid

        return d

Remove unused AttributeMeta type constants
Remove unused AttributeMeta type constants

  from collections import OrderedDict
  
  from malcolm.core.serializable import Serializable
  
  
  class AttributeMeta(Serializable):
      """Abstract base class for Meta objects"""
- 
-     # Type constants
-     SCALAR = "scalar"
-     TABLE = "table"
-     SCALARARRAY = "scalar_array"
  
      def __init__(self, name, description, *args):
          super(AttributeMeta, self).__init__(name, *args)
          self.description = description
  
      def validate(self, value):
          """
          Abstract function to validate a given value
  
          Args:
              value(abstract): Value to validate
          """
  
          raise NotImplementedError(
              "Abstract validate function must be implemented in child classes")
  
      def to_dict(self):
          """Convert object attributes into a dictionary"""
  
          d = OrderedDict()
          d["description"] = self.description
          d["typeid"] = self.typeid
  
          return d
  
Remove unused AttributeMeta type constants
## Code Before:
from collections import OrderedDict

from malcolm.core.serializable import Serializable


class AttributeMeta(Serializable):
    """Abstract base class for Meta objects"""

    # Type constants
    SCALAR = "scalar"
    TABLE = "table"
    SCALARARRAY = "scalar_array"

    def __init__(self, name, description, *args):
        super(AttributeMeta, self).__init__(name, *args)
        self.description = description

    def validate(self, value):
        """
        Abstract function to validate a given value

        Args:
            value(abstract): Value to validate
        """

        raise NotImplementedError(
            "Abstract validate function must be implemented in child classes")

    def to_dict(self):
        """Convert object attributes into a dictionary"""

        d = OrderedDict()
        d["description"] = self.description
        d["typeid"] = self.typeid

        return d

## Instruction:
Remove unused AttributeMeta type constants
## Code After:
from collections import OrderedDict

from malcolm.core.serializable import Serializable


class AttributeMeta(Serializable):
    """Abstract base class for Meta objects"""

    def __init__(self, name, description, *args):
        super(AttributeMeta, self).__init__(name, *args)
        self.description = description

    def validate(self, value):
        """
        Abstract function to validate a given value

        Args:
            value(abstract): Value to validate
        """

        raise NotImplementedError(
            "Abstract validate function must be implemented in child classes")

    def to_dict(self):
        """Convert object attributes into a dictionary"""

        d = OrderedDict()
        d["description"] = self.description
        d["typeid"] = self.typeid

        return d
