This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import concurrent | |
from concurrent.futures import Future | |
from typing import Any | |
class CombinedFuture(Future[Future | None]): | |
""" | |
This class provides "waiting" mechanisms similar to concurrent.futures.wait(...) except that there is no blocking wait. | |
This class extends concurrent.futures.Future and thus it can be used like any other Future. | |
You can use the .result() and .done() (and other) methods and also use this class with the aforementioned concurrent.futures.wait function. | |