fix: Union type alias in Python 3.9

This commit is contained in:
Mike A.
2024-09-02 23:42:41 +02:00
parent 99f2ee6f82
commit cb9b9dd0cc

View File

@@ -1,7 +1,9 @@
"""Utility types."""
from typing import Coroutine, TypeVar
from typing import Coroutine, TypeVar, Union
T = TypeVar("T")
MaybeCoro = T | Coroutine[None, None, T]
# Cannot use `|` operator (PEP 604) in python 3.9,
# even with __future__ import since it is evaluated directly
MaybeCoro = Union[T, Coroutine[None, None, T]]