diff --git a/ssb/muxrpc.py b/ssb/muxrpc.py index 1dc0055..e70584f 100644 --- a/ssb/muxrpc.py +++ b/ssb/muxrpc.py @@ -1,7 +1,5 @@ from functools import wraps -from async_generator import async_generator, yield_ - from ssb.packet_stream import PSMessageType @@ -30,12 +28,11 @@ class MuxRPCSourceHandler(MuxRPCHandler): def __init__(self, ps_handler): self.ps_handler = ps_handler - @async_generator async def __aiter__(self): async for msg in self.ps_handler: try: self.check_message(msg) - await yield_(msg) + yield msg except MuxRPCAPIException: raise diff --git a/ssb/packet_stream.py b/ssb/packet_stream.py index 917a958..c10c9aa 100644 --- a/ssb/packet_stream.py +++ b/ssb/packet_stream.py @@ -6,8 +6,6 @@ from math import ceil import simplejson -from async_generator import async_generator, yield_ - from secret_handshake import SHSClient, SHSServer @@ -32,13 +30,12 @@ async def process(self, msg): async def stop(self): await self.queue.put(None) - @async_generator async def __aiter__(self): while True: elem = await self.queue.get() if not elem: return - await yield_(elem) + yield elem class PSRequestHandler(object): @@ -113,7 +110,6 @@ def register_handler(self, handler): def is_connected(self): return self.connection.is_connected - @async_generator async def __aiter__(self): while True: msg = await self.read() @@ -121,7 +117,7 @@ async def __aiter__(self): return # filter out replies if msg.req >= 0: - await yield_(msg) + yield msg async def __await__(self): async for data in self: