quart.signals module#
- class quart.signals.AsyncNamedSignal(name: str, doc: Optional[str] = None)#
Bases:
NamedSignal- connect(receiver: Callable, *args: Any, **kwargs: Any) Callable#
Connect receiver to signal events sent by sender.
- Parameters:
receiver – A callable. Will be invoked by
send()with sender= as a single positional argument and anykwargsthat were provided to a call tosend().sender – Any object or
ANY, defaults toANY. Restricts notifications delivered to receiver to only thosesend()emissions sent by sender. IfANY, the receiver will always be notified. A receiver may be connected to multiple sender values on the same Signal through multiple calls toconnect().weak – If true, the Signal will hold a weakref to receiver and automatically disconnect when receiver goes out of scope or is garbage collected. Defaults to True.
- async send(*sender: Any, **kwargs: Any) List[Tuple[Callable, Any]]#
Emit this signal on behalf of sender, passing on
kwargs.Returns a list of 2-tuples, pairing receivers with their return value. The ordering of receiver notification is undefined.
- Parameters:
sender – Any object or
None. If omitted, synonymous withNone. Only accepts one positional argument.kwargs – Data to be sent to receivers.
- class quart.signals.AsyncNamespace#
Bases:
Namespace- signal(name: str, doc: Optional[str] = None) AsyncNamedSignal#
Return the
NamedSignalname, creating it if required.Repeated calls to this function will return the same signal object.