code: def set_messages(self, messages: Sequence[CachedMessage]) -> None:
          
          uids = {msg.uid for msg in messages}
          expunged = self._messages._uids - uids
          return self.add_updates(messages, expunged)
docs: This is the non-optimized alternative to :meth:`.add_updates` for
          backend implementations that cannot detect their own updates and must
          instead compare the entire state of the mailbox.
  
          The ``messages`` list should contain the entire set of messages in the
          mailbox, ordered by UID. Any UID that previously existed and is not
          included in ``messages`` will be expunged.
  
          Args:
              messages: The entire set of cached message objects.