build: Remove async_generator as a dependency
As Python <3.6 is no longer supported, this library is obsolete.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import struct
|
||||
from asyncio import IncompleteReadError
|
||||
|
||||
from async_generator import async_generator, yield_
|
||||
from nacl.secret import SecretBox
|
||||
|
||||
from .util import inc_nonce, split_chunks
|
||||
@@ -59,13 +58,16 @@ class UnboxStream(object):
|
||||
self.nonce = inc_nonce(inc_nonce(self.nonce))
|
||||
return body
|
||||
|
||||
@async_generator
|
||||
async def __aiter__(self):
|
||||
while True:
|
||||
data = await self.read()
|
||||
if data is None:
|
||||
return
|
||||
await yield_(data)
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
data = await self.read()
|
||||
|
||||
if data is None:
|
||||
raise StopAsyncIteration()
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class BoxStream(object):
|
||||
|
@@ -21,8 +21,6 @@
|
||||
|
||||
import asyncio
|
||||
|
||||
from async_generator import async_generator, yield_
|
||||
|
||||
from .boxstream import get_stream_pair
|
||||
from .crypto import SHSClientCrypto, SHSServerCrypto
|
||||
|
||||
@@ -48,10 +46,16 @@ class SHSDuplexStream(object):
|
||||
self.read_stream.close()
|
||||
self.is_connected = False
|
||||
|
||||
@async_generator
|
||||
async def __aiter__(self):
|
||||
async for msg in self.read_stream:
|
||||
await yield_(msg)
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
msg = await self.read()
|
||||
|
||||
if msg is None:
|
||||
raise StopAsyncIteration()
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
class SHSEndpoint(object):
|
||||
|
Reference in New Issue
Block a user