# blinker - pydoc - phpman

Help on package blinker:

## NAME
    blinker

## PACKAGE CONTENTS
    _saferef
    _utilities
    base

## CLASSES
    builtins.dict(builtins.object)
        blinker.base.Namespace
    builtins.object
        blinker.base.Signal
            blinker.base.NamedSignal
    weakref.WeakValueDictionary(collections.abc.MutableMapping)
        blinker.base.WeakNamespace

### class NamedSignal
     |  NamedSignal(name, doc=None)
     |
     |  A named generic notification emitter.
     |
     |  Method resolution order:
     |      NamedSignal
     |      Signal
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  __init__(self, name, doc=None)
     |      :param doc: optional.  If provided, will be assigned to the signal's
     |        __doc__ attribute.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from Signal:
     |
     |  connect(self, receiver, sender=ANY, weak=True)
     |      Connect *receiver* to signal events sent by *sender*.
     |
     |      :param receiver: A callable.  Will be invoked by :meth:`send` with
     |        `sender=` as a single positional argument and any \*\*kwargs that
     |        were provided to a call to :meth:`send`.
     |
     |      :param sender: Any object or :obj:`ANY`, defaults to ``ANY``.
     |        Restricts notifications delivered to *receiver* to only those
     |        :meth:`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 :meth:`connect`.
     |
     |      :param 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.
     |
     |  connect_via(self, sender, weak=False)
     |      Connect the decorated function as a receiver for *sender*.
     |
     |      :param sender: Any object or :obj:`ANY`.  The decorated function
     |        will only receive :meth:`send` emissions sent by *sender*.  If
     |        ``ANY``, the receiver will always be notified.  A function may be
     |        decorated multiple times with differing *sender* values.
     |
     |      :param weak: If true, the Signal will hold a weakref to the
     |        decorated function and automatically disconnect when *receiver*
     |        goes out of scope or is garbage collected.  Unlike
     |        :meth:`connect`, this defaults to False.
     |
     |      The decorated function will be invoked by :meth:`send` with
     |        `sender=` as a single positional argument and any \*\*kwargs that
     |        were provided to the call to :meth:`send`.
     |
     |
     |      .. versionadded:: 1.1
     |
     |  connected_to(self, receiver, sender=ANY)
     |      Execute a block with the signal temporarily connected to *receiver*.
     |
     |      :param receiver: a receiver callable
     |      :param sender: optional, a sender to filter on
     |
     |      This is a context manager for use in the ``with`` statement.  It can
     |      be useful in unit tests.  *receiver* is connected to the signal for
     |      the duration of the ``with`` block, and will be disconnected
     |      automatically when exiting the block:
     |
     |      .. testsetup::
     |
     |        from __future__ import with_statement
     |        from blinker import Signal
     |        on_ready = Signal()
     |        receiver = lambda sender: None
     |
     |      .. testcode::
     |
     |        with on_ready.connected_to(receiver):
     |           # do stuff
     |           [on_ready.send(123)](https://www.chedong.com/phpMan.php/man/onready.send/123/markdown)
     |
     |      .. versionadded:: 1.1
     |
     |  disconnect(self, receiver, sender=ANY)
     |      Disconnect *receiver* from this signal's events.
     |
     |      :param receiver: a previously :meth:`connected<connect>` callable
     |
     |      :param sender: a specific sender to disconnect from, or :obj:`ANY`
     |        to disconnect from all senders.  Defaults to ``ANY``.
     |
     |  has_receivers_for(self, sender)
     |      True if there is probably a receiver for *sender*.
     |
     |      Performs an optimistic check only.  Does not guarantee that all
     |      weakly referenced receivers are still alive.  See
     |      :meth:`receivers_for` for a stronger search.
     |
     |  receiver_connected = <blinker._utilities.lazy_property object>
     |      Emitted after each :meth:`connect`.
     |
     |      The signal sender is the signal instance, and the :meth:`connect`
     |      arguments are passed through: *receiver*, *sender*, and *weak*.
     |
     |      .. versionadded:: 1.2
     |
     |  receiver_disconnected = <blinker._utilities.lazy_property object>
     |      Emitted after :meth:`disconnect`.
     |
     |      The sender is the signal instance, and the :meth:`disconnect` arguments
     |      are passed through: *receiver* and *sender*.
     |
     |      Note, this signal is emitted **only** when :meth:`disconnect` is
     |      called explicitly.
     |
     |      The disconnect signal can not be emitted by an automatic disconnect
     |      (due to a weakly referenced receiver or sender going out of scope),
     |      as the receiver and/or sender instances are no longer available for
     |      use at the time this signal would be emitted.
     |
     |      An alternative approach is available by subscribing to
     |      :attr:`receiver_connected` and setting up a custom weakref cleanup
     |      callback on weak receivers and senders.
     |
     |      .. versionadded:: 1.2
     |
     |  receivers_for(self, sender)
     |      Iterate all live receivers listening for *sender*.
     |
     |  send(self, *sender, **kwargs)
     |      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.
     |
     |      :param \*sender: Any object or ``None``.  If omitted, synonymous
     |        with ``None``.  Only accepts one positional argument.
     |
     |      :param \*\*kwargs: Data to be sent to receivers.
     |
     |  temporarily_connected_to(self, receiver, sender=ANY)
     |      An alias for :meth:`connected_to`.
     |
     |      :param receiver: a receiver callable
     |      :param sender: optional, a sender to filter on
     |
     |      .. versionadded:: 0.9
     |
     |      .. versionchanged:: 1.1
     |        Renamed to :meth:`connected_to`.  ``temporarily_connected_to`` was
     |        deprecated in 1.2 and will be removed in a subsequent version.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from Signal:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from Signal:
     |
     |  ANY = ANY
     |      Token for "any sender".

### class Namespace
     |  A mapping of signal names to signals.
     |
     |  Method resolution order:
     |      Namespace
     |      builtins.dict
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  signal(self, name, doc=None)
     |      Return the :class:`NamedSignal` *name*, creating it if required.
     |
     |      Repeated calls to this function will return the same signal object.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.dict:
     |
     |  __contains__(self, key, /)
     |      True if the dictionary has the specified key, else False.
     |
     |  __delitem__(self, key, /)
     |      Delete self[key].
     |
     |  __eq__(self, value, /)
     |      Return self==value.
     |
     |  __ge__(self, value, /)
     |      Return self>=value.
     |
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |
     |  __gt__(self, value, /)
     |      Return self>value.
     |
     |  __init__(self, /, *args, **kwargs)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __ior__(self, value, /)
     |      Return self|=value.
     |
     |  __iter__(self, /)
     |      Implement iter(self).
     |
     |  __le__(self, value, /)
     |      Return self<=value.
     |
     |  __len__(self, /)
     |      Return len(self).
     |
     |  __lt__(self, value, /)
     |      Return self<value.
     |
     |  __ne__(self, value, /)
     |      Return self!=value.
     |
     |  __or__(self, value, /)
     |      Return self|value.
     |
     |  __repr__(self, /)
     |      Return repr(self).
     |
     |  __reversed__(self, /)
     |      Return a reverse iterator over the dict keys.
     |
     |  __ror__(self, value, /)
     |      Return value|self.
     |
     |  __setitem__(self, key, value, /)
     |      Set self[key] to value.
     |
     |  __sizeof__(...)
     |      D.__sizeof__() -> size of D in memory, in bytes
     |
     |  clear(...)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  copy(...)
     |      D.copy() -> a shallow copy of D
     |
     |  get(self, key, default=None, /)
     |      Return the value for key if key is in the dictionary, else default.
     |
     |  items(...)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  keys(...)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  pop(...)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |
     |      If the key is not found, return the default if given; otherwise,
     |      raise a KeyError.
     |
     |  popitem(self, /)
     |      Remove and return a (key, value) pair as a 2-tuple.
     |
     |      Pairs are returned in LIFO (last-in, first-out) order.
     |      Raises KeyError if the dict is empty.
     |
     |  setdefault(self, key, default=None, /)
     |      Insert key with a value of default if key is not in the dictionary.
     |
     |      Return the value for key if key is in the dictionary, else default.
     |
     |  update(...)
     |      D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
     |      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
     |      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
     |      In either case, this is followed by: for k in F:  D[k] = F[k]
     |
     |  values(...)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from builtins.dict:
     |
     |  __class_getitem__(...) from builtins.type
     |      See PEP 585
     |
     |  fromkeys(iterable, value=None, /) from builtins.type
     |      Create a new dictionary with keys from iterable and values set to value.
     |
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.dict:
     |
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from builtins.dict:
     |
     |  __hash__ = None

### class Signal
     |  Signal(doc=None)
     |
     |  A notification emitter.
     |
     |  Methods defined here:
     |
     |  __init__(self, doc=None)
     |      :param doc: optional.  If provided, will be assigned to the signal's
     |        __doc__ attribute.
     |
     |  connect(self, receiver, sender=ANY, weak=True)
     |      Connect *receiver* to signal events sent by *sender*.
     |
     |      :param receiver: A callable.  Will be invoked by :meth:`send` with
     |        `sender=` as a single positional argument and any \*\*kwargs that
     |        were provided to a call to :meth:`send`.
     |
     |      :param sender: Any object or :obj:`ANY`, defaults to ``ANY``.
     |        Restricts notifications delivered to *receiver* to only those
     |        :meth:`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 :meth:`connect`.
     |
     |      :param 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.
     |
     |  connect_via(self, sender, weak=False)
     |      Connect the decorated function as a receiver for *sender*.
     |
     |      :param sender: Any object or :obj:`ANY`.  The decorated function
     |        will only receive :meth:`send` emissions sent by *sender*.  If
     |        ``ANY``, the receiver will always be notified.  A function may be
     |        decorated multiple times with differing *sender* values.
     |
     |      :param weak: If true, the Signal will hold a weakref to the
     |        decorated function and automatically disconnect when *receiver*
     |        goes out of scope or is garbage collected.  Unlike
     |        :meth:`connect`, this defaults to False.
     |
     |      The decorated function will be invoked by :meth:`send` with
     |        `sender=` as a single positional argument and any \*\*kwargs that
     |        were provided to the call to :meth:`send`.
     |
     |
     |      .. versionadded:: 1.1
     |
     |  connected_to(self, receiver, sender=ANY)
     |      Execute a block with the signal temporarily connected to *receiver*.
     |
     |      :param receiver: a receiver callable
     |      :param sender: optional, a sender to filter on
     |
     |      This is a context manager for use in the ``with`` statement.  It can
     |      be useful in unit tests.  *receiver* is connected to the signal for
     |      the duration of the ``with`` block, and will be disconnected
     |      automatically when exiting the block:
     |
     |      .. testsetup::
     |
     |        from __future__ import with_statement
     |        from blinker import Signal
     |        on_ready = Signal()
     |        receiver = lambda sender: None
     |
     |      .. testcode::
     |
     |        with on_ready.connected_to(receiver):
     |           # do stuff
     |           [on_ready.send(123)](https://www.chedong.com/phpMan.php/man/onready.send/123/markdown)
     |
     |      .. versionadded:: 1.1
     |
     |  disconnect(self, receiver, sender=ANY)
     |      Disconnect *receiver* from this signal's events.
     |
     |      :param receiver: a previously :meth:`connected<connect>` callable
     |
     |      :param sender: a specific sender to disconnect from, or :obj:`ANY`
     |        to disconnect from all senders.  Defaults to ``ANY``.
     |
     |  has_receivers_for(self, sender)
     |      True if there is probably a receiver for *sender*.
     |
     |      Performs an optimistic check only.  Does not guarantee that all
     |      weakly referenced receivers are still alive.  See
     |      :meth:`receivers_for` for a stronger search.
     |
     |  receiver_connected = <blinker._utilities.lazy_property object>
     |      Emitted after each :meth:`connect`.
     |
     |      The signal sender is the signal instance, and the :meth:`connect`
     |      arguments are passed through: *receiver*, *sender*, and *weak*.
     |
     |      .. versionadded:: 1.2
     |
     |  receiver_disconnected = <blinker._utilities.lazy_property object>
     |      Emitted after :meth:`disconnect`.
     |
     |      The sender is the signal instance, and the :meth:`disconnect` arguments
     |      are passed through: *receiver* and *sender*.
     |
     |      Note, this signal is emitted **only** when :meth:`disconnect` is
     |      called explicitly.
     |
     |      The disconnect signal can not be emitted by an automatic disconnect
     |      (due to a weakly referenced receiver or sender going out of scope),
     |      as the receiver and/or sender instances are no longer available for
     |      use at the time this signal would be emitted.
     |
     |      An alternative approach is available by subscribing to
     |      :attr:`receiver_connected` and setting up a custom weakref cleanup
     |      callback on weak receivers and senders.
     |
     |      .. versionadded:: 1.2
     |
     |  receivers_for(self, sender)
     |      Iterate all live receivers listening for *sender*.
     |
     |  send(self, *sender, **kwargs)
     |      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.
     |
     |      :param \*sender: Any object or ``None``.  If omitted, synonymous
     |        with ``None``.  Only accepts one positional argument.
     |
     |      :param \*\*kwargs: Data to be sent to receivers.
     |
     |  temporarily_connected_to(self, receiver, sender=ANY)
     |      An alias for :meth:`connected_to`.
     |
     |      :param receiver: a receiver callable
     |      :param sender: optional, a sender to filter on
     |
     |      .. versionadded:: 0.9
     |
     |      .. versionchanged:: 1.1
     |        Renamed to :meth:`connected_to`.  ``temporarily_connected_to`` was
     |        deprecated in 1.2 and will be removed in a subsequent version.
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  ANY = ANY
     |      Token for "any sender".

### class WeakNamespace
     |  WeakNamespace(other=(), /, **kw)
     |
     |  A weak mapping of signal names to signals.
     |
     |  Automatically cleans up unused Signals when the last reference goes out
     |  of scope.  This namespace implementation exists for a measure of legacy
     |  compatibility with Blinker <= 1.2, and may be dropped in the future.
     |
     |  .. versionadded:: 1.3
     |
     |  Method resolution order:
     |      WeakNamespace
     |      weakref.WeakValueDictionary
     |      collections.abc.MutableMapping
     |      collections.abc.Mapping
     |      collections.abc.Collection
     |      collections.abc.Sized
     |      collections.abc.Iterable
     |      collections.abc.Container
     |      builtins.object
     |
     |  Methods defined here:
     |
     |  signal(self, name, doc=None)
     |      Return the :class:`NamedSignal` *name*, creating it if required.
     |
     |      Repeated calls to this function will return the same signal object.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes defined here:
     |
     |  __abstractmethods__ = frozenset()
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from weakref.WeakValueDictionary:
     |
     |  __contains__(self, key)
     |
     |  __copy__ = copy(self)
     |
     |  __deepcopy__(self, memo)
     |
     |  __delitem__(self, key)
     |
     |  __getitem__(self, key)
     |
     |  __init__(self, other=(), /, **kw)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |
     |  __ior__(self, other)
     |
     |  __iter__ = keys(self)
     |
     |  __len__(self)
     |
     |  __or__(self, other)
     |      Return self|value.
     |
     |  __repr__(self)
     |      Return repr(self).
     |
     |  __ror__(self, other)
     |      Return value|self.
     |
     |  __setitem__(self, key, value)
     |
     |  copy(self)
     |
     |  get(self, key, default=None)
     |      D.get(k[,d]) -> D[k] if k in D, else d.  d defaults to None.
     |
     |  items(self)
     |      D.items() -> a set-like object providing a view on D's items
     |
     |  itervaluerefs(self)
     |      Return an iterator that yields the weak references to the values.
     |
     |      The references are not guaranteed to be 'live' at the time
     |      they are used, so the result of calling the references needs
     |      to be checked before being used.  This can be used to avoid
     |      creating references that will cause the garbage collector to
     |      keep the values around longer than needed.
     |
     |  keys(self)
     |      D.keys() -> a set-like object providing a view on D's keys
     |
     |  pop(self, key, *args)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |      If key is not found, d is returned if given, otherwise KeyError is raised.
     |
     |  popitem(self)
     |      D.popitem() -> (k, v), remove and return some (key, value) pair
     |      as a 2-tuple; but raise KeyError if D is empty.
     |
     |  setdefault(self, key, default=None)
     |      D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D
     |
     |  update(self, other=None, /, **kwargs)
     |      D.update([E, ]**F) -> None.  Update D from mapping/iterable E and F.
     |      If E present and has a .keys() method, does:     for k in E: D[k] = E[k]
     |      If E present and lacks .keys() method, does:     for (k, v) in E: D[k] = v
     |      In either case, this is followed by: for k, v in F.items(): D[k] = v
     |
     |  valuerefs(self)
     |      Return a list of weak references to the values.
     |
     |      The references are not guaranteed to be 'live' at the time
     |      they are used, so the result of calling the references needs
     |      to be checked before being used.  This can be used to avoid
     |      creating references that will cause the garbage collector to
     |      keep the values around longer than needed.
     |
     |  values(self)
     |      D.values() -> an object providing a view on D's values
     |
     |  ----------------------------------------------------------------------
     |  Data descriptors inherited from weakref.WeakValueDictionary:
     |
     |  __dict__
     |      dictionary for instance variables (if defined)
     |
     |  __weakref__
     |      list of weak references to the object (if defined)
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.MutableMapping:
     |
     |  clear(self)
     |      D.clear() -> None.  Remove all items from D.
     |
     |  ----------------------------------------------------------------------
     |  Methods inherited from collections.abc.Mapping:
     |
     |  __eq__(self, other)
     |      Return self==value.
     |
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from collections.abc.Mapping:
     |
     |  __hash__ = None
     |
     |  __reversed__ = None
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Collection:
     |
     |  __subclasshook__(C) from abc.ABCMeta
     |      Abstract classes can override this to customize issubclass().
     |
     |      This is invoked early on by abc.ABCMeta.__subclasscheck__().
     |      It should return True, False or NotImplemented.  If it returns
     |      NotImplemented, the normal algorithm is used.  Otherwise, it
     |      overrides the normal algorithm (and the outcome is cached).
     |
     |  ----------------------------------------------------------------------
     |  Class methods inherited from collections.abc.Iterable:
     |
     |  __class_getitem__ = GenericAlias(...) from abc.ABCMeta
     |      Represent a PEP 585 generic type
     |
     |      E.g. for t = list[int], t.__origin__ is list and t.__args__ is (int,).

## FUNCTIONS
### signal
        Return the :class:`NamedSignal` *name*, creating it if required.

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

## DATA
    ANY = ANY
        Token for "any sender".

    __all__ = ['ANY', 'NamedSignal', 'Namespace', 'Signal', 'WeakNamespace...
    receiver_connected = <blinker.base.Signal object>
        Sent by a :class:`Signal` after a receiver connects.

        :argument: the Signal that was connected to
        :keyword receiver_arg: the connected receiver
        :keyword sender_arg: the sender to connect to
        :keyword weak_arg: true if the connection to receiver_arg is a weak reference

        .. deprecated:: 1.2

        As of 1.2, individual signals have their own private
        :attr:`~Signal.receiver_connected` and
        :attr:`~Signal.receiver_disconnected` signals with a slightly simplified
        call signature.  This global signal is planned to be removed in 1.6.

## VERSION
    1.4

## FILE
    /usr/lib/python3/dist-packages/blinker/__init__.py


