# Path: src/cloudant/_2to3.py
# STRTYPE = basestring if PY2 else str
# 
# def iteritems_(adict):
#     """
#     iterate dict key, value tuples in a py2 and 3 compatible way
# 
#     :param dict adict:
#     :return: iterator of (key, value) tuples
#     """
#     return adict.iteritems()
# 
# Path: src/cloudant/_common_util.py
# JSON_INDEX_TYPE = 'json'
# 
# Path: src/cloudant/_common_util.py
# TEXT_INDEX_TYPE = 'text'
# 
# Path: src/cloudant/_common_util.py
# SPECIAL_INDEX_TYPE = 'special'
# 
# Path: src/cloudant/_common_util.py
# TEXT_INDEX_ARGS = {'fields': list, 'default_field': dict, 'selector': dict}
# 
# Path: src/cloudant/_common_util.py
# def response_to_json_dict(response, **kwargs):
#     """
#     Standard place to convert responses to JSON.
# 
#     :param response: requests response object
#     :param **kwargs: arguments accepted by json.loads
# 
#     :returns: dict of JSON response
#     """
#     if response.encoding is None:
#         response.encoding = 'utf-8'
#     return json.loads(response.text, **kwargs)
# 
# Path: src/cloudant/error.py
# class CloudantArgumentError(CloudantException):
#     """
#     Provides a way to issue Cloudant Python client library specific exceptions
#     that pertain to invalid argument errors.
# 
#     Note:  The intended use for this class is internal to the Cloudant Python
#     client library.
# 
#     :param int code: An optional code value used to identify the exception.
#         Defaults to 100.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = ARGUMENT_ERROR[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = ARGUMENT_ERROR[code]
#         super(CloudantArgumentError, self).__init__(msg, code)
# 
# class CloudantIndexException(CloudantException):
#     """
#     Provides a way to issue Cloudant library index specific exceptions.
# 
#     :param int code: A code value used to identify the index exception.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = INDEX[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = INDEX[code]
#         super(CloudantIndexException, self).__init__(msg, code)


import json
from ._2to3 import STRTYPE, iteritems_
from ._common_util import JSON_INDEX_TYPE
from ._common_util import TEXT_INDEX_TYPE
from ._common_util import SPECIAL_INDEX_TYPE
from ._common_util import TEXT_INDEX_ARGS
from ._common_util import response_to_json_dict
from .error import CloudantArgumentError, CloudantIndexException
    recommended that you use that method to view the "special" index rather than
    directly interfacing with the SpecialIndex object.
    """
    def __init__(
            self,
            database,
            design_document_id=None,
            name='_all_docs',
            **kwargs
    ):
        super(SpecialIndex, self).__init__(
            database,
            design_document_id,
            name,
            **kwargs
        )
        self._type = SPECIAL_INDEX_TYPE

    def create(self):
        """
        A "special" index cannot be created.  This method is disabled for a
        SpecialIndex object.
        """
        raise CloudantIndexException(101)

    def delete(self):
        """
        A "special" index cannot be deleted.  This method is disabled for a
        SpecialIndex object.
        """

# Path: src/cloudant/_2to3.py
# STRTYPE = basestring if PY2 else str
# 
# def iteritems_(adict):
#     """
#     iterate dict key, value tuples in a py2 and 3 compatible way
# 
#     :param dict adict:
#     :return: iterator of (key, value) tuples
#     """
#     return adict.iteritems()
# 
# Path: src/cloudant/_common_util.py
# JSON_INDEX_TYPE = 'json'
# 
# Path: src/cloudant/_common_util.py
# TEXT_INDEX_TYPE = 'text'
# 
# Path: src/cloudant/_common_util.py
# SPECIAL_INDEX_TYPE = 'special'
# 
# Path: src/cloudant/_common_util.py
# TEXT_INDEX_ARGS = {'fields': list, 'default_field': dict, 'selector': dict}
# 
# Path: src/cloudant/_common_util.py
# def response_to_json_dict(response, **kwargs):
#     """
#     Standard place to convert responses to JSON.
# 
#     :param response: requests response object
#     :param **kwargs: arguments accepted by json.loads
# 
#     :returns: dict of JSON response
#     """
#     if response.encoding is None:
#         response.encoding = 'utf-8'
#     return json.loads(response.text, **kwargs)
# 
# Path: src/cloudant/error.py
# class CloudantArgumentError(CloudantException):
#     """
#     Provides a way to issue Cloudant Python client library specific exceptions
#     that pertain to invalid argument errors.
# 
#     Note:  The intended use for this class is internal to the Cloudant Python
#     client library.
# 
#     :param int code: An optional code value used to identify the exception.
#         Defaults to 100.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = ARGUMENT_ERROR[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = ARGUMENT_ERROR[code]
#         super(CloudantArgumentError, self).__init__(msg, code)
# 
# class CloudantIndexException(CloudantException):
#     """
#     Provides a way to issue Cloudant library index specific exceptions.
# 
#     :param int code: A code value used to identify the index exception.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = INDEX[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = INDEX[code]
#         super(CloudantIndexException, self).__init__(msg, code)


# Path: src/cloudant/index.py
import json
from ._2to3 import STRTYPE, iteritems_
from ._common_util import JSON_INDEX_TYPE
from ._common_util import TEXT_INDEX_TYPE
from ._common_util import SPECIAL_INDEX_TYPE
from ._common_util import TEXT_INDEX_ARGS
from ._common_util import response_to_json_dict
from .error import CloudantArgumentError, CloudantIndexException

    recommended that you use that method to view the "special" index rather than
    directly interfacing with the SpecialIndex object.
    """
    def __init__(
            self,
            database,
            design_document_id=None,
            name='_all_docs',
            **kwargs
    ):
        super(SpecialIndex, self).__init__(
            database,
            design_document_id,
            name,
            **kwargs
        )
        self._type = SPECIAL_INDEX_TYPE

    def create(self):
        """
        A "special" index cannot be created.  This method is disabled for a
        SpecialIndex object.
        """
        raise CloudantIndexException(101)

    def delete(self):
        """
        A "special" index cannot be deleted.  This method is disabled for a
        SpecialIndex object.
        """

        raise CloudantIndexException(102)