Skip to content

Commit

Permalink
Mod: Refactor warn_once from log_utils.
Browse files Browse the repository at this point in the history
  • Loading branch information
Labbeti committed Apr 22, 2024
1 parent 0ac44d9 commit 53a4cfd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/aac_metrics/functional/evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import logging
import time
from functools import cache, partial
from functools import partial
from pathlib import Path
from typing import Any, Callable, Iterable, Optional, Union

Expand All @@ -24,6 +24,7 @@
from aac_metrics.functional.spider_max import spider_max
from aac_metrics.functional.vocab import vocab
from aac_metrics.utils.checks import check_metric_inputs
from aac_metrics.utils.log_utils import warn_once
from aac_metrics.utils.tokenization import preprocess_mono_sents, preprocess_mult_sents

pylog = logging.getLogger(__name__)
Expand Down Expand Up @@ -160,7 +161,8 @@ def evaluate(
)
if len(corpus_overlap) > 0 or len(sents_overlap) > 0:
warn_once(
f"Found overlapping metric outputs names. (found {corpus_overlap=} and {sents_overlap=} at least twice)"
f"Found overlapping metric outputs names. (found {corpus_overlap=} and {sents_overlap=} at least twice)",
pylog,
)

outs_corpus |= outs_corpus_i
Expand Down Expand Up @@ -393,8 +395,3 @@ def _get_metric_factory_functions(
),
}
return factory


@cache
def warn_once(msg: str) -> None:
pylog.warning(msg)

0 comments on commit 53a4cfd

Please sign in to comment.