def task(*args, **kwargs):
    invoked = bool(not args or kwargs)
    task_class = kwargs.pop("task_class", tasks.WrappedCallableTask)
    if not invoked:
        func, args = args[0], ()

    def wrapper(func):
        return task_class(func, *args, **kwargs)

    return wrapper if invoked else wrapper(func)
Decorator declaring the wrapped function to be a new-style task.
dataset/ETHPy150Open fabric/fabric/fabric/decorators.py/task