# Path: rest_framework_extensions/key_constructor/constructors.py
# class DefaultKeyConstructor(KeyConstructor):
#     unique_method_id = bits.UniqueMethodIdKeyBit()
#     format = bits.FormatKeyBit()
#     language = bits.LanguageKeyBit()
# 
# class DefaultObjectKeyConstructor(DefaultKeyConstructor):
#     retrieve_sql_query = bits.RetrieveSqlQueryKeyBit()
# 
# class DefaultListKeyConstructor(DefaultKeyConstructor):
#     list_sql_query = bits.ListSqlQueryKeyBit()
#     pagination = bits.PaginationKeyBit()
# 
# class DefaultAPIModelInstanceKeyConstructor(KeyConstructor):
#     """
#     Use this constructor when the values of the model instance are required
#     to identify the resource.
#     """
#     retrieve_model_values = bits.RetrieveModelKeyBit()
# 
# class DefaultAPIModelListKeyConstructor(KeyConstructor):
#     """
#     Use this constructor when the values of the model instance are required
#     to identify many resources.
#     """
#     list_model_values = bits.ListModelKeyBit()
# 
# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]


import itertools
import rest_framework
from distutils.version import LooseVersion
from rest_framework_extensions.key_constructor.constructors import (
    DefaultKeyConstructor,
    DefaultObjectKeyConstructor,
    DefaultListKeyConstructor,
    DefaultAPIModelInstanceKeyConstructor,
    DefaultAPIModelListKeyConstructor
)
from rest_framework_extensions.settings import extensions_api_settings
    return '.'.join([
        view_instance.__module__,
        view_instance.__class__.__name__,
        view_method.__name__
    ])


def get_model_opts_concrete_fields(opts):
    # todo: test me
    if not hasattr(opts, 'concrete_fields'):
        opts.concrete_fields = [f for f in opts.fields if f.column is not None]
    return opts.concrete_fields


def compose_parent_pk_kwarg_name(value):
    return '{0}{1}'.format(
        extensions_api_settings.DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX,
        value
    )


default_cache_key_func = DefaultKeyConstructor()
default_object_cache_key_func = DefaultObjectKeyConstructor()
default_list_cache_key_func = DefaultListKeyConstructor()

default_etag_func = default_cache_key_func
default_object_etag_func = default_object_cache_key_func
default_list_etag_func = default_list_cache_key_func

# API (object-centered) functions

# Path: rest_framework_extensions/key_constructor/constructors.py
# class DefaultKeyConstructor(KeyConstructor):
#     unique_method_id = bits.UniqueMethodIdKeyBit()
#     format = bits.FormatKeyBit()
#     language = bits.LanguageKeyBit()
# 
# class DefaultObjectKeyConstructor(DefaultKeyConstructor):
#     retrieve_sql_query = bits.RetrieveSqlQueryKeyBit()
# 
# class DefaultListKeyConstructor(DefaultKeyConstructor):
#     list_sql_query = bits.ListSqlQueryKeyBit()
#     pagination = bits.PaginationKeyBit()
# 
# class DefaultAPIModelInstanceKeyConstructor(KeyConstructor):
#     """
#     Use this constructor when the values of the model instance are required
#     to identify the resource.
#     """
#     retrieve_model_values = bits.RetrieveModelKeyBit()
# 
# class DefaultAPIModelListKeyConstructor(KeyConstructor):
#     """
#     Use this constructor when the values of the model instance are required
#     to identify many resources.
#     """
#     list_model_values = bits.ListModelKeyBit()
# 
# Path: rest_framework_extensions/settings.py
# USER_SETTINGS = getattr(settings, 'REST_FRAMEWORK_EXTENSIONS', None)
# DEFAULTS = {
#     # caching
#     'DEFAULT_USE_CACHE': 'default',
#     'DEFAULT_CACHE_RESPONSE_TIMEOUT': None,
#     'DEFAULT_CACHE_ERRORS': True,
#     'DEFAULT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_cache_key_func',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_object_cache_key_func',
#     'DEFAULT_LIST_CACHE_KEY_FUNC': 'rest_framework_extensions.utils.default_list_cache_key_func',
# 
#     # ETAG
#     'DEFAULT_ETAG_FUNC': 'rest_framework_extensions.utils.default_etag_func',
#     'DEFAULT_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_object_etag_func',
#     'DEFAULT_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_list_etag_func',
# 
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_object_etag_func',
#     'DEFAULT_API_LIST_ETAG_FUNC': 'rest_framework_extensions.utils.default_api_list_etag_func',
# 
#     # other
#     'DEFAULT_KEY_CONSTRUCTOR_MEMOIZE_FOR_REQUEST': False,
#     'DEFAULT_BULK_OPERATION_HEADER_NAME': 'X-BULK-OPERATION',
#     'DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX': 'parent_lookup_'
# }
# IMPORT_STRINGS = [
#     'DEFAULT_CACHE_KEY_FUNC',
#     'DEFAULT_OBJECT_CACHE_KEY_FUNC',
#     'DEFAULT_LIST_CACHE_KEY_FUNC',
#     'DEFAULT_ETAG_FUNC',
#     'DEFAULT_OBJECT_ETAG_FUNC',
#     'DEFAULT_LIST_ETAG_FUNC',
#     # API - ETAG
#     'DEFAULT_API_OBJECT_ETAG_FUNC',
#     'DEFAULT_API_LIST_ETAG_FUNC',
# ]


# Path: rest_framework_extensions/utils.py
import itertools
import rest_framework
from distutils.version import LooseVersion
from rest_framework_extensions.key_constructor.constructors import (
    DefaultKeyConstructor,
    DefaultObjectKeyConstructor,
    DefaultListKeyConstructor,
    DefaultAPIModelInstanceKeyConstructor,
    DefaultAPIModelListKeyConstructor
)
from rest_framework_extensions.settings import extensions_api_settings

    return '.'.join([
        view_instance.__module__,
        view_instance.__class__.__name__,
        view_method.__name__
    ])


def get_model_opts_concrete_fields(opts):
    # todo: test me
    if not hasattr(opts, 'concrete_fields'):
        opts.concrete_fields = [f for f in opts.fields if f.column is not None]
    return opts.concrete_fields


def compose_parent_pk_kwarg_name(value):
    return '{0}{1}'.format(
        extensions_api_settings.DEFAULT_PARENT_LOOKUP_KWARG_NAME_PREFIX,
        value
    )


default_cache_key_func = DefaultKeyConstructor()
default_object_cache_key_func = DefaultObjectKeyConstructor()
default_list_cache_key_func = DefaultListKeyConstructor()

default_etag_func = default_cache_key_func
default_object_etag_func = default_object_cache_key_func
default_list_etag_func = default_list_cache_key_func

# API (object-centered) functions

default_api_object_etag_func = DefaultAPIModelInstanceKeyConstructor()