
from launch_control.utils.json import PlainOldData


class HardwareDevice(PlainOldData):
    """
    Model representing any HardwareDevice

    A device is just a "device_type" attribute with a bag of properties
    and a human readable description. Individual device types can be
    freely added. For simplicity some common types of devices are
    provided as class properties DEVICE_xxx.

    Instances will come from a variety of factory classes, each capable
    of enumerating devices that it understands. The upside of having a
    common class like this is that it's easier to store it in the
    database _and_ not have to agree on a common set of properties for,
    say, all CPUs.

    If you want you can create instances manually, like this:
    >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU)
    >>> cpu.desc = "800MHz OMAP3 Processor"
    >>> cpu.attributes['machine'] = 'arm'
    >>> cpu.attributes['mhz'] = 800
    >>> cpu.attributes['vendor'] = 'Texas Instruments'
    """

    DEVICE_CPU = "device.cpu"
    DEVICE_MEM = "device.mem"
    DEVICE_USB = "device.usb"
    DEVICE_PCI = "device.pci"
    DEVICE_BOARD = "device.board"

    __slots__ = ('device_type', 'desc', 'attributes')

    def __init__(self, device_type, description, attributes=None):
        self.device_type = device_type
        self.description = description
        self.attributes = attributes or {}


from launch_control.utils.json import PlainOldData


class HardwareDevice(PlainOldData):
    """
    Model representing any HardwareDevice

    A device is just a "device_type" attribute with a bag of properties
    and a human readable description. Individual device types can be
    freely added. For simplicity some common types of devices are
    provided as class properties DEVICE_xxx.

    Instances will come from a variety of factory classes, each capable
    of enumerating devices that it understands. The upside of having a
    common class like this is that it's easier to store it in the
    database _and_ not have to agree on a common set of properties for,
    say, all CPUs.

    If you want you can create instances manually, like this:
    >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU,
    ...     u"800MHz OMAP3 Processor")
    >>> cpu.attributes[u'machine'] = u'arm'
    >>> cpu.attributes[u'mhz'] = '800'
    >>> cpu.attributes[u'vendor'] = u'Texas Instruments'
    """

    DEVICE_CPU = "device.cpu"
    DEVICE_MEM = "device.mem"
    DEVICE_USB = "device.usb"
    DEVICE_PCI = "device.pci"
    DEVICE_BOARD = "device.board"

    __slots__ = ('device_type', 'desc', 'attributes')

    def __init__(self, device_type, description, attributes=None):
        self.device_type = device_type
        self.description = description
        self.attributes = attributes or {}

Fix HardwareDevice docstring to match implementation
Fix HardwareDevice docstring to match implementation


  
  from launch_control.utils.json import PlainOldData
  
  
  class HardwareDevice(PlainOldData):
      """
      Model representing any HardwareDevice
  
      A device is just a "device_type" attribute with a bag of properties
      and a human readable description. Individual device types can be
      freely added. For simplicity some common types of devices are
      provided as class properties DEVICE_xxx.
  
      Instances will come from a variety of factory classes, each capable
      of enumerating devices that it understands. The upside of having a
      common class like this is that it's easier to store it in the
      database _and_ not have to agree on a common set of properties for,
      say, all CPUs.
  
      If you want you can create instances manually, like this:
-     >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU)
+     >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU,
-     >>> cpu.desc = "800MHz OMAP3 Processor"
+     ...     u"800MHz OMAP3 Processor")
-     >>> cpu.attributes['machine'] = 'arm'
+     >>> cpu.attributes[u'machine'] = u'arm'
-     >>> cpu.attributes['mhz'] = 800
+     >>> cpu.attributes[u'mhz'] = '800'
-     >>> cpu.attributes['vendor'] = 'Texas Instruments'
+     >>> cpu.attributes[u'vendor'] = u'Texas Instruments'
      """
  
      DEVICE_CPU = "device.cpu"
      DEVICE_MEM = "device.mem"
      DEVICE_USB = "device.usb"
      DEVICE_PCI = "device.pci"
      DEVICE_BOARD = "device.board"
  
      __slots__ = ('device_type', 'desc', 'attributes')
  
      def __init__(self, device_type, description, attributes=None):
          self.device_type = device_type
          self.description = description
          self.attributes = attributes or {}
  
Fix HardwareDevice docstring to match implementation
## Code Before:

from launch_control.utils.json import PlainOldData


class HardwareDevice(PlainOldData):
    """
    Model representing any HardwareDevice

    A device is just a "device_type" attribute with a bag of properties
    and a human readable description. Individual device types can be
    freely added. For simplicity some common types of devices are
    provided as class properties DEVICE_xxx.

    Instances will come from a variety of factory classes, each capable
    of enumerating devices that it understands. The upside of having a
    common class like this is that it's easier to store it in the
    database _and_ not have to agree on a common set of properties for,
    say, all CPUs.

    If you want you can create instances manually, like this:
    >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU)
    >>> cpu.desc = "800MHz OMAP3 Processor"
    >>> cpu.attributes['machine'] = 'arm'
    >>> cpu.attributes['mhz'] = 800
    >>> cpu.attributes['vendor'] = 'Texas Instruments'
    """

    DEVICE_CPU = "device.cpu"
    DEVICE_MEM = "device.mem"
    DEVICE_USB = "device.usb"
    DEVICE_PCI = "device.pci"
    DEVICE_BOARD = "device.board"

    __slots__ = ('device_type', 'desc', 'attributes')

    def __init__(self, device_type, description, attributes=None):
        self.device_type = device_type
        self.description = description
        self.attributes = attributes or {}

## Instruction:
Fix HardwareDevice docstring to match implementation
## Code After:

from launch_control.utils.json import PlainOldData


class HardwareDevice(PlainOldData):
    """
    Model representing any HardwareDevice

    A device is just a "device_type" attribute with a bag of properties
    and a human readable description. Individual device types can be
    freely added. For simplicity some common types of devices are
    provided as class properties DEVICE_xxx.

    Instances will come from a variety of factory classes, each capable
    of enumerating devices that it understands. The upside of having a
    common class like this is that it's easier to store it in the
    database _and_ not have to agree on a common set of properties for,
    say, all CPUs.

    If you want you can create instances manually, like this:
    >>> cpu = HardwareDevice(HardwareDevice.DEVICE_CPU,
    ...     u"800MHz OMAP3 Processor")
    >>> cpu.attributes[u'machine'] = u'arm'
    >>> cpu.attributes[u'mhz'] = '800'
    >>> cpu.attributes[u'vendor'] = u'Texas Instruments'
    """

    DEVICE_CPU = "device.cpu"
    DEVICE_MEM = "device.mem"
    DEVICE_USB = "device.usb"
    DEVICE_PCI = "device.pci"
    DEVICE_BOARD = "device.board"

    __slots__ = ('device_type', 'desc', 'attributes')

    def __init__(self, device_type, description, attributes=None):
        self.device_type = device_type
        self.description = description
        self.attributes = attributes or {}
