def _deserialize_set(stream, member_transform):
        # type: (io.BytesIO, Callable) -> List[Union[dynamodb_types.BINARY, dynamodb_types.STRING]]
        """Deserializes contents of serialized set.

        :param stream: Stream containing serialized object
        :type stream: io.BytesIO
        :rtype: list
        """
        member_count = decode_length(stream)
        return sorted([member_transform(decode_value(stream)) for _ in range(member_count)])
    def _deserialize_list(stream):
        # type: (io.BytesIO) -> Dict[Text, dynamodb_types.LIST]
        """Deserializes a list object.

        :param stream: Stream containing serialized object
        :type stream: io.BytesIO
        :rtype: dict
        """
        member_count = decode_length(stream)
        return {Tag.LIST.dynamodb_tag: [_deserialize(stream) for _ in range(member_count)]}
Ejemplo n.º 3
0
    def _deserialize_list(stream):
        # type: (io.BytesIO) -> Dict[Text, dynamodb_types.LIST]
        # pylint: disable=no-member
        # for some reason pylint can't follow the Enum member attributes
        """Deserializes a list object.

        :param stream: Stream containing serialized object
        :type stream: io.BytesIO
        :rtype: dict
        """
        member_count = decode_length(stream)
        return {
            Tag.LIST.dynamodb_tag:
            [_deserialize(stream) for _ in range(member_count)]
        }
    def _deserialize_map(stream):
        # type: (io.BytesIO) -> Dict[Text, dynamodb_types.MAP]
        """Deserializes a map object.

        :param stream: Stream containing serialized object
        :type stream: io.BytesIO
        :rtype: dict
        """
        member_count = decode_length(stream)
        members = {}  # type: dynamodb_types.MAP
        for _ in range(member_count):
            key = _deserialize(stream)
            if Tag.STRING.dynamodb_tag not in key:
                raise DeserializationError(
                    'Malformed serialized map: found "{}" as map key.'.format(list(key.keys())[0])
                )

            value = _deserialize(stream)
            members[key[Tag.STRING.dynamodb_tag]] = value

        return {Tag.MAP.dynamodb_tag: members}