summaryrefslogtreecommitdiff
path: root/slixmpp/xmlstream/handler
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-01 18:46:33 +0200
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-07-01 18:46:33 +0200
commit3502480384bd7d9f4e4eb1a3b92e8df08f4e487c (patch)
treea2e68835f4de6c32808412455f88310c05528191 /slixmpp/xmlstream/handler
parent66909aafb300868ffd3ed9ab02bc3bd28c49a6e9 (diff)
downloadslixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.gz
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.bz2
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.tar.xz
slixmpp-3502480384bd7d9f4e4eb1a3b92e8df08f4e487c.zip
Switch from @asyncio.coroutine to async def everywhere.
Diffstat (limited to 'slixmpp/xmlstream/handler')
-rw-r--r--slixmpp/xmlstream/handler/coroutine_callback.py5
-rw-r--r--slixmpp/xmlstream/handler/waiter.py5
2 files changed, 4 insertions, 6 deletions
diff --git a/slixmpp/xmlstream/handler/coroutine_callback.py b/slixmpp/xmlstream/handler/coroutine_callback.py
index 1ca4ab0a..0708a6e4 100644
--- a/slixmpp/xmlstream/handler/coroutine_callback.py
+++ b/slixmpp/xmlstream/handler/coroutine_callback.py
@@ -45,10 +45,9 @@ class CoroutineCallback(BaseHandler):
if not asyncio.iscoroutinefunction(pointer):
raise ValueError("Given function is not a coroutine")
- @asyncio.coroutine
- def pointer_wrapper(stanza, *args, **kwargs):
+ async def pointer_wrapper(stanza, *args, **kwargs):
try:
- yield from pointer(stanza, *args, **kwargs)
+ await pointer(stanza, *args, **kwargs)
except Exception as e:
stanza.exception(e)
diff --git a/slixmpp/xmlstream/handler/waiter.py b/slixmpp/xmlstream/handler/waiter.py
index 8a4d74ea..b82fa5ca 100644
--- a/slixmpp/xmlstream/handler/waiter.py
+++ b/slixmpp/xmlstream/handler/waiter.py
@@ -50,8 +50,7 @@ class Waiter(BaseHandler):
"""Do not process this handler during the main event loop."""
pass
- @asyncio.coroutine
- def wait(self, timeout=None):
+ async def wait(self, timeout=None):
"""Block an event handler while waiting for a stanza to arrive.
Be aware that this will impact performance if called from a
@@ -70,7 +69,7 @@ class Waiter(BaseHandler):
stanza = None
try:
- stanza = yield from self._payload.get()
+ stanza = await self._payload.get()
except TimeoutError:
log.warning("Timed out waiting for %s", self.name)
self.stream().remove_handler(self.name)