def catalogs(func):
    """A decorator used by click command functions for loading catalogs"""

    def wrapper(*args, **kwargs):
        ctx = args[0]
        assert isinstance(ctx, Context)

        req_strs = ["flags", "profile", "project"]
        reqs = [ctx.obj.get(req_str) for req_str in req_strs]
        if None in reqs:
            raise DbtProjectError("profile and flags required to load catalogs")

        flags = ctx.obj["flags"]
        ctx_project = ctx.obj["project"]

        _catalogs = load_catalogs(flags.PROJECT_DIR, ctx_project.project_name, flags.VARS)
        ctx.obj["catalogs"] = _catalogs

        return func(*args, **kwargs)

    return update_wrapper(wrapper, func)
A decorator used by click command functions for loading catalogs
core/dbt/cli/requires.py