def get_message_metadata(self, key: str) -> MaildirMessage: """Like :meth:`~mailbox.Maildir.get_message` but the message contents are not read from disk. """ msg = MaildirMessage() subpath = self._lookup(key) subdir, name = os.path.split(subpath) msg.set_subdir(subdir) if self.colon in name: msg.set_info(name.rsplit(self.colon, 1)[-1]) msg.set_date(os.path.getmtime(os.path.join(self._path, subpath))) return msg