(self)
Cancel the current task (if any).
Cancel the current task (if any).
Cancel the current task ( if any ) .
def cancel(self):
        """
        Cancel the current task (if any).
        """
        if self._task is not None:
            self._task.cancel()
            assert self._task.future.done()
            # disconnect the `_task_finished` slot
            self._task.watcher.done.disconnect(self._task_finished)
            self._task = None
def cancel ( self ) : if self . _task is not None : self . _task . cancel ( ) assert self . _task . future . done ( ) # disconnect the `_task_finished` slot self . _task . watcher . done . disconnect ( self . _task_finished ) self . _task = None