# Path: src/cloudant/_2to3.py
# LONGTYPE = long if PY2 else int
# 
# STRTYPE = basestring if PY2 else str
# 
# NONETYPE = type(None)
# 
# UNITYPE = unicode 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/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 CloudantException(Exception):
#     """
#     Provides a way to issue Cloudant Python client library specific exceptions.
#     A CloudantException object is instantiated with a message and optional code.
# 
#     Note:  The intended use for this class is internal to the Cloudant Python
#     client library.
# 
#     :param str msg: A message that describes the exception.
#     :param int code: A code value used to identify the exception.
#     """
#     def __init__(self, msg, code=None):
#         super(CloudantException, self).__init__(msg)
#         self.status_code = code
# 
# class CloudantClientException(CloudantException):
#     """
#     Provides a way to issue Cloudant library client specific exceptions.
# 
#     :param int code: A code value used to identify the client exception.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = CLIENT[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = CLIENT[code]
#         super(CloudantClientException, self).__init__(msg, code)


import sys
import platform
import json
from ._2to3 import LONGTYPE, STRTYPE, NONETYPE, UNITYPE, iteritems_
from .error import CloudantArgumentError, CloudantException, CloudantClientException
    from collections.abc import Sequence
    from collections import Sequence
    platform.machine()
])

QUERY_LANGUAGE = 'query'

# Index Types

JSON_INDEX_TYPE = 'json'
TEXT_INDEX_TYPE = 'text'
SPECIAL_INDEX_TYPE = 'special'

# Argument Types

ANY_ARG = object()
ANY_TYPE = object()

RESULT_ARG_TYPES = {
    'descending': (bool,),
    'endkey': (int, LONGTYPE, STRTYPE, Sequence, bool,),
    'endkey_docid': (STRTYPE,),
    'group': (bool,),
    'group_level': (int, LONGTYPE, NONETYPE,),
    'include_docs': (bool,),
    'inclusive_end': (bool,),
    'key': (int, LONGTYPE, STRTYPE, Sequence, bool,),
    'keys': (list,),
    'limit': (int, LONGTYPE, NONETYPE,),
    'reduce': (bool,),
    'skip': (int, LONGTYPE, NONETYPE,),
    'stable': (bool,),

# Path: src/cloudant/_2to3.py
# LONGTYPE = long if PY2 else int
# 
# STRTYPE = basestring if PY2 else str
# 
# NONETYPE = type(None)
# 
# UNITYPE = unicode 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/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 CloudantException(Exception):
#     """
#     Provides a way to issue Cloudant Python client library specific exceptions.
#     A CloudantException object is instantiated with a message and optional code.
# 
#     Note:  The intended use for this class is internal to the Cloudant Python
#     client library.
# 
#     :param str msg: A message that describes the exception.
#     :param int code: A code value used to identify the exception.
#     """
#     def __init__(self, msg, code=None):
#         super(CloudantException, self).__init__(msg)
#         self.status_code = code
# 
# class CloudantClientException(CloudantException):
#     """
#     Provides a way to issue Cloudant library client specific exceptions.
# 
#     :param int code: A code value used to identify the client exception.
#     :param args: A list of arguments used to format the exception message.
#     """
#     def __init__(self, code=100, *args):
#         try:
#             msg = CLIENT[code].format(*args)
#         except (KeyError, IndexError):
#             code = 100
#             msg = CLIENT[code]
#         super(CloudantClientException, self).__init__(msg, code)


# Path: src/cloudant/_common_util.py
import sys
import platform
import json
from ._2to3 import LONGTYPE, STRTYPE, NONETYPE, UNITYPE, iteritems_
from .error import CloudantArgumentError, CloudantException, CloudantClientException
    from collections.abc import Sequence
    from collections import Sequence

    platform.machine()
])

QUERY_LANGUAGE = 'query'

# Index Types

JSON_INDEX_TYPE = 'json'
TEXT_INDEX_TYPE = 'text'
SPECIAL_INDEX_TYPE = 'special'

# Argument Types

ANY_ARG = object()
ANY_TYPE = object()

RESULT_ARG_TYPES = {
    'descending': (bool,),
    'endkey': (int, LONGTYPE, STRTYPE, Sequence, bool,),
    'endkey_docid': (STRTYPE,),
    'group': (bool,),
    'group_level': (int, LONGTYPE, NONETYPE,),
    'include_docs': (bool,),
    'inclusive_end': (bool,),
    'key': (int, LONGTYPE, STRTYPE, Sequence, bool,),
    'keys': (list,),
    'limit': (int, LONGTYPE, NONETYPE,),
    'reduce': (bool,),
    'skip': (int, LONGTYPE, NONETYPE,),
    'stable': (bool,),

    'stale': (STRTYPE,),