

class ContentBody(object):
    """ContentBody carries the value for an AMQP message body frame"""
    name = 'ContentBody'

    def __init__(self, value=None):
        """Create a new instance of a ContentBody object, passing in the value
        of the message body

        :param str|unicode|bytes value: The content body

        """
        self.value = value

    def __len__(self):
        """Return the length of the content body value

        :rtype: int

        """
        return len(self.value)

    def marshal(self):
        """Return the marshaled content body. This method is here for API
        compatibility, there is no special marhsaling for the payload in a
        content frame.

        :rtype: str|unicode|bytes

        """
        return self.value

    def unmarshal(self, data):
        """Apply the data to the object. This method is here for API
        compatibility, there is no special unmarhsaling for the payload in a
        content frame.

        :rtype: str|unicode|bytes

        """
        self.value = data

import typing


class ContentBody:
    """ContentBody carries the value for an AMQP message body frame"""
    def __init__(self, value: typing.Optional[bytes] = None):
        """Create a new instance of a ContentBody object"""
        self.value = value

    def __len__(self) -> int:
        """Return the length of the content body value"""
        return len(self.value) if self.value else 0

    def marshal(self) -> bytes:
        """Return the marshaled content body. This method is here for API
        compatibility, there is no special marshaling for the payload in a
        content frame.

        """
        return self.value

    def unmarshal(self, data: bytes) -> typing.NoReturn:
        """Apply the data to the object. This method is here for API
        compatibility, there is no special unmarhsaling for the payload in a
        content frame.

        """
        self.value = data

Update to include typing, cleanup docstrings and code
Update to include typing, cleanup docstrings and code

+ import typing
  
  
- class ContentBody(object):
+ class ContentBody:
      """ContentBody carries the value for an AMQP message body frame"""
+     def __init__(self, value: typing.Optional[bytes] = None):
-     name = 'ContentBody'
- 
-     def __init__(self, value=None):
-         """Create a new instance of a ContentBody object, passing in the value
+         """Create a new instance of a ContentBody object"""
-         of the message body
- 
-         :param str|unicode|bytes value: The content body
- 
-         """
          self.value = value
  
-     def __len__(self):
+     def __len__(self) -> int:
-         """Return the length of the content body value
+         """Return the length of the content body value"""
+         return len(self.value) if self.value else 0
  
-         :rtype: int
- 
-         """
-         return len(self.value)
- 
-     def marshal(self):
+     def marshal(self) -> bytes:
          """Return the marshaled content body. This method is here for API
-         compatibility, there is no special marhsaling for the payload in a
+         compatibility, there is no special marshaling for the payload in a
          content frame.
- 
-         :rtype: str|unicode|bytes
  
          """
          return self.value
  
-     def unmarshal(self, data):
+     def unmarshal(self, data: bytes) -> typing.NoReturn:
          """Apply the data to the object. This method is here for API
          compatibility, there is no special unmarhsaling for the payload in a
          content frame.
  
-         :rtype: str|unicode|bytes
- 
          """
          self.value = data
  
Update to include typing, cleanup docstrings and code
## Code Before:


class ContentBody(object):
    """ContentBody carries the value for an AMQP message body frame"""
    name = 'ContentBody'

    def __init__(self, value=None):
        """Create a new instance of a ContentBody object, passing in the value
        of the message body

        :param str|unicode|bytes value: The content body

        """
        self.value = value

    def __len__(self):
        """Return the length of the content body value

        :rtype: int

        """
        return len(self.value)

    def marshal(self):
        """Return the marshaled content body. This method is here for API
        compatibility, there is no special marhsaling for the payload in a
        content frame.

        :rtype: str|unicode|bytes

        """
        return self.value

    def unmarshal(self, data):
        """Apply the data to the object. This method is here for API
        compatibility, there is no special unmarhsaling for the payload in a
        content frame.

        :rtype: str|unicode|bytes

        """
        self.value = data

## Instruction:
Update to include typing, cleanup docstrings and code
## Code After:
import typing


class ContentBody:
    """ContentBody carries the value for an AMQP message body frame"""
    def __init__(self, value: typing.Optional[bytes] = None):
        """Create a new instance of a ContentBody object"""
        self.value = value

    def __len__(self) -> int:
        """Return the length of the content body value"""
        return len(self.value) if self.value else 0

    def marshal(self) -> bytes:
        """Return the marshaled content body. This method is here for API
        compatibility, there is no special marshaling for the payload in a
        content frame.

        """
        return self.value

    def unmarshal(self, data: bytes) -> typing.NoReturn:
        """Apply the data to the object. This method is here for API
        compatibility, there is no special unmarhsaling for the payload in a
        content frame.

        """
        self.value = data
