aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/PySide6/QtAsyncio/futures.py
diff options
context:
space:
mode:
authorAdrian Herrmann <adrian.herrmann@qt.io>2024-05-10 15:26:35 +0200
committerAdrian Herrmann <adrian.herrmann@qt.io>2024-05-10 17:07:07 +0200
commitaf71b84085195afd4ef5e97b1c9dcf372fc72afd (patch)
tree5d043749e2ee5a3bc37b7fedbfcc7ded41515fd3 /sources/pyside6/PySide6/QtAsyncio/futures.py
parent8302b87659d82561b033c72991b0a2d3f1f13ae7 (diff)
QtAsyncio: Improve documentation (part 2)
Improve the inline documentation of QtAsyncio with more comprehensive comments. Pick-to: 6.7 Task-number: PYSIDE-769 Change-Id: I7306da43d8f1f350dae188f5346cdec8f60a7a06 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/PySide6/QtAsyncio/futures.py')
-rw-r--r--sources/pyside6/PySide6/QtAsyncio/futures.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/pyside6/PySide6/QtAsyncio/futures.py b/sources/pyside6/PySide6/QtAsyncio/futures.py
index 611bd5634..cbb005fc9 100644
--- a/sources/pyside6/PySide6/QtAsyncio/futures.py
+++ b/sources/pyside6/PySide6/QtAsyncio/futures.py
@@ -36,10 +36,11 @@ class QAsyncioFuture():
self._result: typing.Any = None
self._exception: typing.Optional[BaseException] = None
- self._callbacks: typing.List[typing.Callable] = list()
-
self._cancel_message: typing.Optional[str] = None
+ # List of callbacks that are called when the future is done.
+ self._callbacks: typing.List[typing.Callable] = list()
+
def __await__(self):
if not self.done():
self._asyncio_future_blocking = True
@@ -51,6 +52,7 @@ class QAsyncioFuture():
__iter__ = __await__
def _schedule_callbacks(self, context: typing.Optional[contextvars.Context] = None):
+ """ A future can optionally have callbacks that are called when the future is done. """
for cb in self._callbacks:
self._loop.call_soon(
cb, self, context=context if context else self._context)