(self)
Does a couple of cleanup tasks to ensure consistent data for later
        processing.
Does a couple of cleanup tasks to ensure consistent data for later
        processing.
Does a couple of cleanup tasks to ensure consistent data for later processing .
def _validate_todo(self) -> None:
        """Does a couple of cleanup tasks to ensure consistent data for later
        processing."""
        if self.storage_backend.exists(self.todolist):
            try:
                with self.storage_backend.open_file(self.todolist, text=True) as fh:
                    saved_todo = iter(fh)
                    int(next(saved_todo).strip())
                    for line in saved_todo:
                        _, serial = line.strip().split(maxsplit=1)
                        int(serial)
            except (StopIteration, ValueError, TypeError):
                # The todo list was inconsistent. This may happen if we get
                # killed e.g. by the timeout wrapper. Just remove it - we'll
                # just have to do whatever happened since the last successful
                # sync.
                logger.error("Removing inconsistent todo list.")
                self.storage_backend.delete_file(self.todolist)
def _validate_todo ( self ) -> None : if self . storage_backend . exists ( self . todolist ) : try : with self . storage_backend . open_file ( self . todolist , text = True ) as fh : saved_todo = iter ( fh ) int ( next ( saved_todo ) . strip ( ) ) for line in saved_todo : _ , serial = line . strip ( ) . split ( maxsplit = 1 ) int ( serial ) except ( StopIteration , ValueError , TypeError ) : # The todo list was inconsistent. This may happen if we get # killed e.g. by the timeout wrapper. Just remove it - we'll # just have to do whatever happened since the last successful # sync. logger . error ( "Removing inconsistent todo list." ) self . storage_backend . delete_file ( self . todolist )