# Path: riak/datatypes/errors.py
# class ContextRequired(RiakError):
#     """
#     This exception is raised when removals of map fields and set
#     entries are attempted and the datatype hasn't been initialized
#     with a context.
#     """
# 
#     _default_message = ("A context is required for remove operations, "
#                         "fetch the datatype first")
# 
#     def __init__(self, message=None):
#         super(ContextRequired, self).__init__(message or
#                                               self._default_message)
# 
# Path: riak/datatypes/types.py
# TYPES = {}


from .errors import ContextRequired
from . import TYPES

        :param r: the read quorum
        :type r: integer, string, None
        :param pr: the primary read quorum
        :type pr: integer, string, None
        :param basic_quorum: whether to use the "basic quorum" policy
           for not-founds
        :type basic_quorum: bool
        :param notfound_ok: whether to treat not-found responses as successful
        :type notfound_ok: bool
        :param timeout: a timeout value in milliseconds
        :type timeout: int
        :param include_context: whether to return the opaque context
          as well as the value, which is useful for removal operations
          on sets and maps
        :type include_context: bool
        :rtype: :class:`Datatype`
        """
        if not self.bucket:
            raise ValueError('bucket property not assigned')

        if not self.key:
            raise ValueError('key property not assigned')

        dtype, value, context = self.bucket._client._fetch_datatype(
            self.bucket, self.key, **params)

        if not dtype == self.type_name:
            raise TypeError("Expected datatype {} but "
                            "got datatype {}".format(self.__class__,

# Path: riak/datatypes/errors.py
# class ContextRequired(RiakError):
#     """
#     This exception is raised when removals of map fields and set
#     entries are attempted and the datatype hasn't been initialized
#     with a context.
#     """
# 
#     _default_message = ("A context is required for remove operations, "
#                         "fetch the datatype first")
# 
#     def __init__(self, message=None):
#         super(ContextRequired, self).__init__(message or
#                                               self._default_message)
# 
# Path: riak/datatypes/types.py
# TYPES = {}


# Path: riak/datatypes/datatype.py
from .errors import ContextRequired
from . import TYPES


        :param r: the read quorum
        :type r: integer, string, None
        :param pr: the primary read quorum
        :type pr: integer, string, None
        :param basic_quorum: whether to use the "basic quorum" policy
           for not-founds
        :type basic_quorum: bool
        :param notfound_ok: whether to treat not-found responses as successful
        :type notfound_ok: bool
        :param timeout: a timeout value in milliseconds
        :type timeout: int
        :param include_context: whether to return the opaque context
          as well as the value, which is useful for removal operations
          on sets and maps
        :type include_context: bool
        :rtype: :class:`Datatype`
        """
        if not self.bucket:
            raise ValueError('bucket property not assigned')

        if not self.key:
            raise ValueError('key property not assigned')

        dtype, value, context = self.bucket._client._fetch_datatype(
            self.bucket, self.key, **params)

        if not dtype == self.type_name:
            raise TypeError("Expected datatype {} but "
                            "got datatype {}".format(self.__class__,

                                                     TYPES[dtype]))