From a4e90b8fe726e44532cbb97e83bd599d72e73ed9 Mon Sep 17 00:00:00 2001 From: David Danier Date: Tue, 7 Nov 2023 08:29:47 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20!17=20=E2=99=BB=EF=B8=8F=20Better=20na?= =?UTF-8?q?ming=20for=20comparable=20type=20check?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pydantic_changedetect/changedetect.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pydantic_changedetect/changedetect.py b/pydantic_changedetect/changedetect.py index 6809d2e..b902191 100644 --- a/pydantic_changedetect/changedetect.py +++ b/pydantic_changedetect/changedetect.py @@ -206,7 +206,7 @@ def model_set_changed(self, *fields: str, original: Any = NO_VALUE) -> None: self.model_original[name] = original self.model_self_changed_fields.add(name) - def _model_is_change_comparable_type(self, value: Any) -> bool: + def _model_value_is_comparable_type(self, value: Any) -> bool: return ( value is None or isinstance(value, (str, int, float, bool, decimal.Decimal)) @@ -241,8 +241,8 @@ def __setattr__(self, name, value) -> None: # noqa: ANN001 # (when validate_assignment == True) current_value = self.__dict__[name] if ( - self._model_is_change_comparable_type(original_value) - and self._model_is_change_comparable_type(current_value) + self._model_value_is_comparable_type(original_value) + and self._model_value_is_comparable_type(current_value) and original_value == current_value ): has_changed = False