Skip to content

Commit

Permalink
Remove unnecessary cast
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed Jan 20, 2025
1 parent 94234ac commit 31d7814
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/marshmallow/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ def _repr_args(self) -> str:
return f"validators={self.validators!r}"

def __call__(self, value: typing.Any) -> typing.Any:
errors = []
kwargs = {}
errors: list[str | dict] = []
kwargs: dict[str, typing.Any] = {}
for validator in self.validators:
try:
r = validator(value)
Expand All @@ -93,8 +93,7 @@ def __call__(self, value: typing.Any) -> typing.Any:
if isinstance(err.messages, dict):
errors.append(err.messages)
else:
# FIXME : Get rid of cast
errors.extend(typing.cast(list, err.messages))
errors.extend(err.messages)
if errors:
raise ValidationError(errors, **kwargs)
return value
Expand Down

0 comments on commit 31d7814

Please sign in to comment.