Python rest_framework.viewsets 模块,ViewSetMixin() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用rest_framework.viewsets.ViewSetMixin()

项目:py2swagger    作者:Arello-Mobile    | 项目源码 | 文件源码
def get_view_introspector(api):
    """
    Creates view introspector based on api

    :param api:
    :rtype: BaseViewIntrospector
    """
    callback = api['callback']

    def inmodule(callback, module_name):
        return callback.__module__ == module_name

    map = (
        (issubclass, ViewSetMixin, ViewSetIntrospector),
        (inmodule, 'rest_framework.decorators', WrappedApiViewIntrospector),
        (issubclass, APIView, ApiViewIntrospector),
    )

    for f, param, introspector_class in map:
        if f(callback, param):
            return introspector_class(**api)

    raise IntrospectorException('View introspector not recognized')