summaryrefslogtreecommitdiff
path: root/docs/conf.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2015-02-23 17:21:21 +0100
committermathieui <mathieui@mathieui.net>2015-02-23 17:32:31 +0100
commit8fd0d7c993a5c26663efb82c19d3f3e49539521a (patch)
treedd8d70be32b6a8b71899facbc5a6326dffdce15c /docs/conf.py
parent1450d3637729186efef8d61297cb03601879b63c (diff)
downloadslixmpp-8fd0d7c993a5c26663efb82c19d3f3e49539521a.tar.gz
slixmpp-8fd0d7c993a5c26663efb82c19d3f3e49539521a.tar.bz2
slixmpp-8fd0d7c993a5c26663efb82c19d3f3e49539521a.tar.xz
slixmpp-8fd0d7c993a5c26663efb82c19d3f3e49539521a.zip
Add a coroutine_wrapper decorator
This decorator checks for the coroutine=True keyword arg and wraps the result of the function call in a coroutine if it isn’t. This allows to have constructs like: @coroutine_wrapper def toto(xmpp, *, coroutine=False): if xmpp.cached: return xmpp.cached else: return xmpp.make_iq_get().send(coroutine=coroutine) @asyncio.coroutine def main(xmpp): result = yield from toto(xmpp, coroutine=True) xmpp.cached = result result2 = yield from toto(xmpp, coroutine=True) If the wrapper wasn’t there, the second fetch would fail. This decorator does not do anything if the coroutine argument is False.
Diffstat (limited to 'docs/conf.py')
0 files changed, 0 insertions, 0 deletions