Skip to content

Commit

Permalink
chore: !17 ♻️ Better naming for comparable type check
Browse files Browse the repository at this point in the history
  • Loading branch information
ddanier committed Nov 7, 2023
1 parent 7bcb6d6 commit a4e90b8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pydantic_changedetect/changedetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a4e90b8

Please sign in to comment.