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

Method load

src/marshmallow/schema.py:708–737  ·  view source on GitHub ↗

Deserialize a data structure to an object defined by this Schema's fields. :param data: The data to deserialize. :param many: Whether to deserialize `data` as a collection. If `None`, the value for `self.many` is used. :param partial: Whether to ignore missing fi

(
        self,
        data: Mapping[str, typing.Any] | Sequence[Mapping[str, typing.Any]],
        *,
        many: bool | None = None,
        partial: bool | types.StrSequenceOrSet | None = None,
        unknown: types.UnknownOption | None = None,
    )

Source from the content-addressed store, hash-verified

706 return ret_d
707
708 def load(
709 self,
710 data: Mapping[str, typing.Any] | Sequence[Mapping[str, typing.Any]],
711 *,
712 many: bool | None = None,
713 partial: bool | types.StrSequenceOrSet | None = None,
714 unknown: types.UnknownOption | None = None,
715 ):
716 """Deserialize a data structure to an object defined by this Schema's fields.
717
718 :param data: The data to deserialize.
719 :param many: Whether to deserialize `data` as a collection. If `None`, the
720 value for `self.many` is used.
721 :param partial: Whether to ignore missing fields and not require
722 any fields declared. Propagates down to ``Nested`` fields as well. If
723 its value is an iterable, only missing fields listed in that iterable
724 will be ignored. Use dot delimiters to specify nested fields.
725 :param unknown: Whether to exclude, include, or raise an error for unknown
726 fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
727 If `None`, the value for `self.unknown` is used.
728 :return: Deserialized data
729
730 .. versionchanged:: 3.0.0b7
731 This method returns the deserialized data rather than a ``(data, errors)`` tuple.
732 A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
733 if invalid data are passed.
734 """
735 return self._do_load(
736 data, many=many, partial=partial, unknown=unknown, postprocess=True
737 )
738
739 def loads(
740 self,

Calls 1

_do_loadMethod · 0.95