From d841e82241a209573a1da638aa64921c7e65b811 Mon Sep 17 00:00:00 2001 From: jason kirtland Date: Thu, 23 Jul 2015 17:18:39 +0200 Subject: Adds Signal.send_async for asyncio --- blinker/base.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'blinker/base.py') diff --git a/blinker/base.py b/blinker/base.py index cc5880e..67aa41d 100644 --- a/blinker/base.py +++ b/blinker/base.py @@ -266,6 +266,17 @@ class Signal(object): return [(receiver, receiver(sender, **kwargs)) for receiver in self.receivers_for(sender)] + def send_async(self, *sender, **kwargs): + """Send and collect results from connected functions and coroutines. + + As `Signal.send`, but also schedules any coroutines connected to the + signal, and uniformly presents all receiver return values as futures, + even if one or more receivers are regular functions. + + Available only if asyncio and `yield from` are present. + """ + raise NotImplementedError("asyncio support unavailable") + def has_receivers_for(self, sender): """True if there is probably a receiver for *sender*. -- cgit v1.2.1