Skip to content

Commit

Permalink
feat: change pydantic validator decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMissx committed Jul 15, 2024
1 parent b8c099e commit 724ce39
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions anjani/internal_plugins/spam_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 = [
Expand Down

0 comments on commit 724ce39

Please sign in to comment.