MCPcopy
hub / github.com/marshmallow-code/marshmallow / _deserialize

Method _deserialize

src/marshmallow/fields.py:866–891  ·  view source on GitHub ↗
(
        self,
        value: typing.Any,
        attr: str | None,
        data: typing.Mapping[str, typing.Any] | None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

864 )
865
866 def _deserialize(
867 self,
868 value: typing.Any,
869 attr: str | None,
870 data: typing.Mapping[str, typing.Any] | None,
871 **kwargs,
872 ) -> tuple:
873 if not utils.is_sequence_but_not_string(value):
874 raise self.make_error("invalid")
875
876 self.validate_length(value)
877
878 result = []
879 errors = {}
880
881 for idx, (field, each) in enumerate(zip(self.tuple_fields, value, strict=True)):
882 try:
883 result.append(field.deserialize(each, **kwargs))
884 except ValidationError as error:
885 if error.valid_data is not None:
886 result.append(error.valid_data)
887 errors.update({idx: error.messages})
888 if errors:
889 raise ValidationError(errors, valid_data=result)
890
891 return tuple(result)
892
893
894class String(Field[str]):

Callers

nothing calls this directly

Calls 3

ValidationErrorClass · 0.90
make_errorMethod · 0.80
deserializeMethod · 0.80

Tested by

no test coverage detected