From 724ce3968ee00b5e0316558c1441b6531816ea94 Mon Sep 17 00:00:00 2001 From: MrMissx Date: Mon, 15 Jul 2024 20:50:15 +0700 Subject: [PATCH] feat: change pydantic validator decorator --- anjani/internal_plugins/spam_prediction.py | 6 ++---- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/anjani/internal_plugins/spam_prediction.py b/anjani/internal_plugins/spam_prediction.py index dcdc8a531..86f2a7467 100644 --- a/anjani/internal_plugins/spam_prediction.py +++ b/anjani/internal_plugins/spam_prediction.py @@ -37,9 +37,7 @@ InlineKeyboardMarkup, Message, ) -from pydantic import BaseModel -from pydantic.functional_validators import field_validator - +from pydantic import BaseModel, validator from anjani import command, filters, listener, plugin, util from anjani.core.metrics import SpamPredictionStat @@ -56,7 +54,7 @@ class PredictionResult(BaseModel): spam_score: float ham_score: float - @field_validator("spam_score", "ham_score") + @validator("spam_score", "ham_score") def calc_score(cls, value: float) -> float: return value * 100 diff --git a/pyproject.toml b/pyproject.toml index 3ef98f8c0..b7a1d9430 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "anjani" -version = "2.14.11" +version = "2.14.12" description = "Telegram group management bot" license = "GPL-3.0-or-later" authors = [