quart.signals module

class quart.signals.AsyncNamedSignal(name: str, doc: Optional[str] = None)

Bases: blinker.base.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 any **kwargs that were provided to a call to send().

  • sender – Any object or ANY, defaults to ANY. Restricts notifications delivered to receiver to only those send() emissions sent by sender. If ANY, the receiver will always be notified. A receiver may be connected to multiple sender values on the same Signal through multiple calls to connect().

  • 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 with None. Only accepts one positional argument.

  • **kwargs – Data to be sent to receivers.

class quart.signals.AsyncNamespace

Bases: blinker.base.Namespace

signal(name: str, doc: Optional[str] = None) → quart.signals.AsyncNamedSignal

Return the NamedSignal name, creating it if required.

Repeated calls to this function will return the same signal object.