Skip to content

Commit ab8709e

Browse files
authored
Log deprecation message only once (#354)
1 parent a4d4c29 commit ab8709e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

luxonis_ml/data/datasets/annotation.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from luxonis_ml.data.utils.parquet import ParquetRecord
2626
from luxonis_ml.typing import PathType, check_type
2727
from luxonis_ml.utils import BaseModelExtraForbid
28+
from luxonis_ml.utils.logging import log_once
2829

2930
KeypointVisibility: TypeAlias = Literal[0, 1, 2]
3031
NormalizedFloat: TypeAlias = Annotated[float, Field(ge=0, le=1)]
@@ -548,9 +549,9 @@ def validate_task_name_valid_identifier(self) -> Self:
548549
@classmethod
549550
def validate_task_name(cls, values: dict[str, Any]) -> dict[str, Any]:
550551
if "task" in values:
551-
warnings.warn(
552+
log_once(
553+
logger.warning,
552554
"The 'task' field is deprecated. Use 'task_name' instead.",
553-
stacklevel=2,
554555
)
555556
values["task_name"] = values.pop("task")
556557
return values

0 commit comments

Comments
 (0)