from copy import copy


def manifest_metadata(var_meta, settings):
    """Evaluate callable metadata fields given the current settings."""

    out = {}

    for var_name, var_val in var_meta.items():
        var_val = copy(var_val)
        for attr, attr_val in vars(var_val).items():
            if callable(attr_val) and attr != "get_mask":
                setattr(var_val, attr, attr_val(settings))

        out[var_name] = var_val

    return out