From da88cf33c6f1c8e79bf52299cbf8bffbedf06742 Mon Sep 17 00:00:00 2001 From: marcosschroh Date: Tue, 23 Jan 2024 14:58:59 +0100 Subject: [PATCH] fix: coroutine anext introduced for python versions lower than 3.10 --- kstreams/streams.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kstreams/streams.py b/kstreams/streams.py index 8c2ea807..8001b03e 100644 --- a/kstreams/streams.py +++ b/kstreams/streams.py @@ -1,10 +1,12 @@ import asyncio import inspect import logging +import sys import uuid from functools import update_wrapper from typing import ( Any, + AsyncGenerator, Awaitable, Callable, Dict, @@ -32,6 +34,12 @@ StreamFunc = Callable +if sys.version_info < (3, 10): + + async def anext(async_gen: AsyncGenerator): + return await async_gen.__anext__() + + class Stream: """ Attributes: