"""Query the datapath about its current state."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import ConstantTypeList, UBInt16
# Local imports
from pyof.v0x01.common.header import Header, Type
from pyof.v0x01.controller2switch.common import StatsTypes

__all__ = ('StatsRequest',)


class StatsRequest(GenericMessage):
    """Response to the config request."""

    #: OpenFlow :class:`.Header`
    header = Header(message_type=Type.OFPT_STATS_REQUEST)
    body_type = UBInt16(enum_ref=StatsTypes)
    flags = UBInt16()
    body = ConstantTypeList()

    def __init__(self, xid=None, body_type=None, flags=None, body=None):
        """The constructor just assings parameters to object attributes.

        Args:
            body_type (StatsTypes): One of the OFPST_* constants.
            flags (int): OFPSF_REQ_* flags (none yet defined).
            body (ConstantTypeList): Body of the request.
        """
        super().__init__(xid)
        self.body_type = body_type
        self.flags = flags
        self.body = [] if body is None else body

"""Query the datapath about its current state."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import BinaryData, UBInt16
# Local imports
from pyof.v0x01.common.header import Header, Type
from pyof.v0x01.controller2switch.common import StatsTypes

__all__ = ('StatsRequest',)


class StatsRequest(GenericMessage):
    """Response to the config request."""

    #: OpenFlow :class:`.Header`
    header = Header(message_type=Type.OFPT_STATS_REQUEST)
    body_type = UBInt16(enum_ref=StatsTypes)
    flags = UBInt16()
    body = BinaryData()

    def __init__(self, xid=None, body_type=None, flags=0, body=b''):
        """The constructor just assings parameters to object attributes.

        Args:
            body_type (StatsTypes): One of the OFPST_* constants.
            flags (int): OFPSF_REQ_* flags (none yet defined).
            body (ConstantTypeList): Body of the request.
        """
        super().__init__(xid)
        self.body_type = body_type
        self.flags = flags
        self.body = body

Fix StatsRequest body type; add default values
Fix StatsRequest body type; add default values

  """Query the datapath about its current state."""
  
  # System imports
  
  # Third-party imports
  
  from pyof.foundation.base import GenericMessage
- from pyof.foundation.basic_types import ConstantTypeList, UBInt16
+ from pyof.foundation.basic_types import BinaryData, UBInt16
  # Local imports
  from pyof.v0x01.common.header import Header, Type
  from pyof.v0x01.controller2switch.common import StatsTypes
  
  __all__ = ('StatsRequest',)
  
  
  class StatsRequest(GenericMessage):
      """Response to the config request."""
  
      #: OpenFlow :class:`.Header`
      header = Header(message_type=Type.OFPT_STATS_REQUEST)
      body_type = UBInt16(enum_ref=StatsTypes)
      flags = UBInt16()
-     body = ConstantTypeList()
+     body = BinaryData()
  
-     def __init__(self, xid=None, body_type=None, flags=None, body=None):
+     def __init__(self, xid=None, body_type=None, flags=0, body=b''):
          """The constructor just assings parameters to object attributes.
  
          Args:
              body_type (StatsTypes): One of the OFPST_* constants.
              flags (int): OFPSF_REQ_* flags (none yet defined).
              body (ConstantTypeList): Body of the request.
          """
          super().__init__(xid)
          self.body_type = body_type
          self.flags = flags
-         self.body = [] if body is None else body
+         self.body = body
  
Fix StatsRequest body type; add default values
## Code Before:
"""Query the datapath about its current state."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import ConstantTypeList, UBInt16
# Local imports
from pyof.v0x01.common.header import Header, Type
from pyof.v0x01.controller2switch.common import StatsTypes

__all__ = ('StatsRequest',)


class StatsRequest(GenericMessage):
    """Response to the config request."""

    #: OpenFlow :class:`.Header`
    header = Header(message_type=Type.OFPT_STATS_REQUEST)
    body_type = UBInt16(enum_ref=StatsTypes)
    flags = UBInt16()
    body = ConstantTypeList()

    def __init__(self, xid=None, body_type=None, flags=None, body=None):
        """The constructor just assings parameters to object attributes.

        Args:
            body_type (StatsTypes): One of the OFPST_* constants.
            flags (int): OFPSF_REQ_* flags (none yet defined).
            body (ConstantTypeList): Body of the request.
        """
        super().__init__(xid)
        self.body_type = body_type
        self.flags = flags
        self.body = [] if body is None else body

## Instruction:
Fix StatsRequest body type; add default values
## Code After:
"""Query the datapath about its current state."""

# System imports

# Third-party imports

from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import BinaryData, UBInt16
# Local imports
from pyof.v0x01.common.header import Header, Type
from pyof.v0x01.controller2switch.common import StatsTypes

__all__ = ('StatsRequest',)


class StatsRequest(GenericMessage):
    """Response to the config request."""

    #: OpenFlow :class:`.Header`
    header = Header(message_type=Type.OFPT_STATS_REQUEST)
    body_type = UBInt16(enum_ref=StatsTypes)
    flags = UBInt16()
    body = BinaryData()

    def __init__(self, xid=None, body_type=None, flags=0, body=b''):
        """The constructor just assings parameters to object attributes.

        Args:
            body_type (StatsTypes): One of the OFPST_* constants.
            flags (int): OFPSF_REQ_* flags (none yet defined).
            body (ConstantTypeList): Body of the request.
        """
        super().__init__(xid)
        self.body_type = body_type
        self.flags = flags
        self.body = body
