# Path: cartographer/exceptions/request_exceptions.py
# class DataMissing(ParameterMissing):
#     parameter_name = 'data'
# 
# class BadPageCountParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[count]',
#                          parameter_value=parameter_value)
#         self.error_description = "Page sizes must be integers."
# 
# class BadPageCursorParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[cursor]',
#                          parameter_value=parameter_value)
#         self.error_description = "Provided cursor was not parsable."
# 
# class BadPageOffsetParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[offset]',
#                          parameter_value=parameter_value)
#         self.error_description = "Page offsets must be integers."
# 
# Path: cartographer/requests/jsonapi_request_interface.py
# class JSONAPIRequestInterface(object):
#     _metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def get_json_api_version(self):
#         return
# 
#     @abstractmethod
#     def get_json(self, force=False):
#         return
# 
#     @abstractmethod
#     def get_includes(self):
#         return
# 
#     @abstractmethod
#     def get_requested_fields(self):
#         return
# 
# Path: cartographer/utils/version.py
# class JSONAPIVersion(Enum):
#     JSONAPI_RC2 = "1.0RC2"
#     JSONAPI_RC3 = "1.0RC3"
#     JSONAPI_1_0 = "1.0"
# 
# def get_default_version():
#     return _JSONAPI_DEFAULT_VERSION


import json
import re
from cartographer.exceptions.request_exceptions import DataMissing, BadPageCountParameter, BadPageCursorParameter, \
    BadPageOffsetParameter
from cartographer.requests.jsonapi_request_interface import JSONAPIRequestInterface
from cartographer.utils.version import JSONAPIVersion, get_default_version

        page_offset = self.args.get('page[offset]')
        if page_offset is not None:
            try:
                page_offset = int(page_offset)
            except TypeError:
                raise BadPageOffsetParameter(page_offset)

        return page_cursor, page_offset, per_page

    def get_includes(self):
        """Returns a list of the requested resources to include in the response for this request."""
        includes_string = self.args.get('include')
        if includes_string:
            if includes_string in ['null', 'none', '[]']:
                return []
            else:
                return includes_string.split(',')
        else:
            return None

    def get_requested_fields(self):
        """Returns a list of the requested attributes to include in the response for this request."""
        type_to_list = self.dictionary_from_get('fields')
        return {key: val.split(',') for key, val in type_to_list.items()}

    def get_included(self):
        """Returns a list of the included resources sent from the client"""
        sent_json = self.get_jsonapi_json()
        if not sent_json:

# Path: cartographer/exceptions/request_exceptions.py
# class DataMissing(ParameterMissing):
#     parameter_name = 'data'
# 
# class BadPageCountParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[count]',
#                          parameter_value=parameter_value)
#         self.error_description = "Page sizes must be integers."
# 
# class BadPageCursorParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[cursor]',
#                          parameter_value=parameter_value)
#         self.error_description = "Provided cursor was not parsable."
# 
# class BadPageOffsetParameter(ParameterInvalid):
#     def __init__(self, parameter_value):
#         super().__init__(parameter_name='page[offset]',
#                          parameter_value=parameter_value)
#         self.error_description = "Page offsets must be integers."
# 
# Path: cartographer/requests/jsonapi_request_interface.py
# class JSONAPIRequestInterface(object):
#     _metaclass__ = ABCMeta
# 
#     @abstractmethod
#     def get_json_api_version(self):
#         return
# 
#     @abstractmethod
#     def get_json(self, force=False):
#         return
# 
#     @abstractmethod
#     def get_includes(self):
#         return
# 
#     @abstractmethod
#     def get_requested_fields(self):
#         return
# 
# Path: cartographer/utils/version.py
# class JSONAPIVersion(Enum):
#     JSONAPI_RC2 = "1.0RC2"
#     JSONAPI_RC3 = "1.0RC3"
#     JSONAPI_1_0 = "1.0"
# 
# def get_default_version():
#     return _JSONAPI_DEFAULT_VERSION


# Path: cartographer/requests/jsonapi_flask_request_mixin.py
import json
import re
from cartographer.exceptions.request_exceptions import DataMissing, BadPageCountParameter, BadPageCursorParameter, \
    BadPageOffsetParameter
from cartographer.requests.jsonapi_request_interface import JSONAPIRequestInterface
from cartographer.utils.version import JSONAPIVersion, get_default_version


        page_offset = self.args.get('page[offset]')
        if page_offset is not None:
            try:
                page_offset = int(page_offset)
            except TypeError:
                raise BadPageOffsetParameter(page_offset)

        return page_cursor, page_offset, per_page

    def get_includes(self):
        """Returns a list of the requested resources to include in the response for this request."""
        includes_string = self.args.get('include')
        if includes_string:
            if includes_string in ['null', 'none', '[]']:
                return []
            else:
                return includes_string.split(',')
        else:
            return None

    def get_requested_fields(self):
        """Returns a list of the requested attributes to include in the response for this request."""
        type_to_list = self.dictionary_from_get('fields')
        return {key: val.split(',') for key, val in type_to_list.items()}

    def get_included(self):
        """Returns a list of the included resources sent from the client"""
        sent_json = self.get_jsonapi_json()
        if not sent_json:

            raise DataMissing()