from .exceptions import MalformedRequestException


class Request(object):
    def __init__(self, version, metadata, **kwargs):
        self._version = version
        self._metadata = metadata
        self._arguments = kwargs

    @property
    def version(self):
        return self._version

    @property
    def arguments(self):
        return self._arguments

    @property
    def metadata(self):
        return self._metadata

    @staticmethod
    def loads(s, serializer):
        try:
            l = serializer.loads(s)
        except(ValueError, TypeError):
            raise MalformedRequestException(serializer.__name__, s)

        try:
            version, metadata, args = l[0:3]
        except ValueError:
            raise MalformedRequestException(serializer.__name__, s)
        else:
            return Request(version, metadata, args)

    @staticmethod
    def dumps(obj, serializer):
        return serializer.dumps([obj.version, obj.metadata, obj.arguments])


from .exceptions import MalformedRequestException


class Request(object):
    def __init__(self, version, metadata, arguments):
        self._version = version
        self._metadata = metadata
        self._arguments = arguments

    @property
    def version(self):
        return self._version

    @property
    def arguments(self):
        return self._arguments

    @property
    def metadata(self):
        return self._metadata

    @staticmethod
    def loads(s, serializer):
        try:
            l = serializer.loads(s)
        except(ValueError, TypeError):
            raise MalformedRequestException(serializer.__name__, s)

        try:
            version, metadata, args = l[0:3]
        except ValueError:
            raise MalformedRequestException(serializer.__name__, s)
        else:
            return Request(version, metadata, args)

    @staticmethod
    def dumps(obj, serializer):
        return serializer.dumps([obj.version, obj.metadata, obj.arguments])


Fix rpc argument handling when constructing a Request
Fix rpc argument handling when constructing a Request

  from .exceptions import MalformedRequestException
  
  
  class Request(object):
-     def __init__(self, version, metadata, **kwargs):
+     def __init__(self, version, metadata, arguments):
          self._version = version
          self._metadata = metadata
-         self._arguments = kwargs
+         self._arguments = arguments
  
      @property
      def version(self):
          return self._version
  
      @property
      def arguments(self):
          return self._arguments
  
      @property
      def metadata(self):
          return self._metadata
  
      @staticmethod
      def loads(s, serializer):
          try:
              l = serializer.loads(s)
          except(ValueError, TypeError):
              raise MalformedRequestException(serializer.__name__, s)
  
          try:
              version, metadata, args = l[0:3]
          except ValueError:
              raise MalformedRequestException(serializer.__name__, s)
          else:
              return Request(version, metadata, args)
  
      @staticmethod
      def dumps(obj, serializer):
          return serializer.dumps([obj.version, obj.metadata, obj.arguments])
  
  
Fix rpc argument handling when constructing a Request
## Code Before:
from .exceptions import MalformedRequestException


class Request(object):
    def __init__(self, version, metadata, **kwargs):
        self._version = version
        self._metadata = metadata
        self._arguments = kwargs

    @property
    def version(self):
        return self._version

    @property
    def arguments(self):
        return self._arguments

    @property
    def metadata(self):
        return self._metadata

    @staticmethod
    def loads(s, serializer):
        try:
            l = serializer.loads(s)
        except(ValueError, TypeError):
            raise MalformedRequestException(serializer.__name__, s)

        try:
            version, metadata, args = l[0:3]
        except ValueError:
            raise MalformedRequestException(serializer.__name__, s)
        else:
            return Request(version, metadata, args)

    @staticmethod
    def dumps(obj, serializer):
        return serializer.dumps([obj.version, obj.metadata, obj.arguments])


## Instruction:
Fix rpc argument handling when constructing a Request
## Code After:
from .exceptions import MalformedRequestException


class Request(object):
    def __init__(self, version, metadata, arguments):
        self._version = version
        self._metadata = metadata
        self._arguments = arguments

    @property
    def version(self):
        return self._version

    @property
    def arguments(self):
        return self._arguments

    @property
    def metadata(self):
        return self._metadata

    @staticmethod
    def loads(s, serializer):
        try:
            l = serializer.loads(s)
        except(ValueError, TypeError):
            raise MalformedRequestException(serializer.__name__, s)

        try:
            version, metadata, args = l[0:3]
        except ValueError:
            raise MalformedRequestException(serializer.__name__, s)
        else:
            return Request(version, metadata, args)

    @staticmethod
    def dumps(obj, serializer):
        return serializer.dumps([obj.version, obj.metadata, obj.arguments])

