def _annotate_coverage()

in glean_parser/coverage.py [0:0]


def _annotate_coverage(metrics, coverage_entries):
    """
    Annotate each metric with whether it is covered. Sets the attribute
    `covered` to 1 on each metric that is covered.
    """
    mapping = {}
    for category in metrics.values():
        for metric in category.values():
            mapping[metric.identifier()] = metric

    for entry in coverage_entries:
        metric_id = _coverage_entry_to_metric_id(entry)
        if metric_id in mapping:
            mapping[metric_id].covered = 1