def inspect_middlewares(app: App) -> 'MiddlewareInfo':
    "Inspects the middleware components of an application.\n\n    Args:\n        app (falcon.App): The application to inspect. Works with both\n            :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n    Returns:\n        MiddlewareInfo: Information about the app's middleware components.\n    "
    types_ = app_helpers.prepare_middleware(app._unprepared_middleware, True, app._ASGI)
    type_infos = []
    for stack in types_:
        current = []
        for method in stack:
            (_, name) = _get_source_info_and_name(method)
            cls = type(method.__self__)
            (_, cls_name) = _get_source_info_and_name(cls)
            current.append(MiddlewareTreeItemInfo(name, cls_name))
        type_infos.append(current)
    middlewareTree = MiddlewareTreeInfo(*type_infos)
    middlewareClasses = []
    names = ('Process request', 'Process resource', 'Process response')
    for m in app._unprepared_middleware:
        fns = app_helpers.prepare_middleware([m], True, app._ASGI)
        (class_source_info, cls_name) = _get_source_info_and_name(type(m))
        methods = []
        for (method, name) in zip(fns, names):
            if method:
                real_func = method[0]
                source_info = _get_source_info(real_func)
                methods.append(MiddlewareMethodInfo(real_func.__name__, source_info))
        m_info = MiddlewareClassInfo(cls_name, class_source_info, methods)
        middlewareClasses.append(m_info)
    return MiddlewareInfo(middlewareTree, middlewareClasses, app._independent_middleware)
Inspects the middleware components of an application.

Args:
    app (falcon.App): The application to inspect. Works with both
        :class:`falcon.App` and :class:`falcon.asgi.App`.

Returns:
    MiddlewareInfo: Information about the app's middleware components.
def inspect_middlewares(app: App) -> 'MiddlewareInfo':
    "Inspects the middleware components of an application.\n\n    Args:\n        app (falcon.App): The application to inspect. Works with both\n            :class:`falcon.App` and :class:`falcon.asgi.App`.\n\n    Returns:\n        MiddlewareInfo: Information about the app's middleware components.\n    "
    types_ = app_helpers.prepare_middleware(app._unprepared_middleware, True, app._ASGI)
    type_infos = []
    for stack in types_:
        current = []
        for method in stack:
            (_, name) = _get_source_info_and_name(method)
            cls = type(method.__self__)
            (_, cls_name) = _get_source_info_and_name(cls)
            current.append(MiddlewareTreeItemInfo(name, cls_name))
        type_infos.append(current)
    middlewareTree = MiddlewareTreeInfo(*type_infos)
    middlewareClasses = []
    names = ('Process request', 'Process resource', 'Process response')
    for m in app._unprepared_middleware:
        fns = app_helpers.prepare_middleware([m], True, app._ASGI)
        (class_source_info, cls_name) = _get_source_info_and_name(type(m))
        methods = []
        for (method, name) in zip(fns, names):
            if method:
                real_func = method[0]
                source_info = _get_source_info(real_func)
                methods.append(MiddlewareMethodInfo(real_func.__name__, source_info))
        m_info = MiddlewareClassInfo(cls_name, class_source_info, methods)
        middlewareClasses.append(m_info)
    return MiddlewareInfo(middlewareTree, middlewareClasses, app._independent_middleware)