Python 3.5 compatibility

Close #1 and #3
This commit is contained in:
Pedro Ferreira
2017-08-01 22:34:06 +02:00
parent ad8d1b89ae
commit 9fc910c37d
5 changed files with 17 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
from functools import wraps
from async_generator import async_generator, yield_
from ssb.packet_stream import PSMessageType
@@ -28,11 +30,12 @@ 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)
yield msg
await yield_(msg)
except MuxRPCAPIException:
raise