def seek(self, offsets: Mapping[Partition, int]) -> None: if offsets.keys() - self.__consumer.tell().keys(): raise ConsumerError("cannot seek on unassigned partitions") for partition in offsets: if partition in self.__previous_messages: del self.__previous_messages[partition] return self.__consumer.seek(offsets)