

def wrap_fun(fun, injector):
    if isinstance(fun, LocalProxy):
        return fun
    if hasattr(fun, '__bindings__'):
        return wrap_function(fun, injector)
    if (hasattr(fun, '__call__') and (not isinstance(fun, type))):
        bindings_from_annotations = injector._infer_injected_bindings(fun)
        if bindings_from_annotations:
            return wrap_fun(inject(**bindings_from_annotations)(fun), injector)
    if hasattr(fun, 'view_class'):
        return wrap_class_based_view(fun, injector)
    return fun

dataset/ETHPy150Open alecthomas/flask_injector/flask_injector.py wrap_fun/original