Skip to content

Commit

Permalink
fix iter_chunks type hint (aio-libs#3230)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfroger committed Aug 31, 2018
1 parent e38ff2d commit 0b9f694
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions aiohttp/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,15 @@ async def __anext__(self) -> bytes:
return rv


class ChunkTupleAsyncStreamIterator(AsyncStreamIterator):
async def __anext__(self) -> bytes:
class ChunkTupleAsyncStreamIterator:

def __init__(self, read_func: Callable[[], Awaitable[Tuple[bytes, bool]]]) -> None:
self.read_func = read_func

def __aiter__(self) -> 'ChunkTupleAsyncStreamIterator':
return self

async def __anext__(self) -> Tuple[bytes, bool]:
rv = await self.read_func()
if rv == (b'', False):
raise StopAsyncIteration # NOQA
Expand Down

0 comments on commit 0b9f694

Please sign in to comment.