Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/local/lib/python3.12/site-packages/blinker/__pycache__/
Upload File :
Current File : //proc/2568807/root/usr/local/lib/python3.12/site-packages/blinker/__pycache__/base.cpython-312.pyc

�

'ٜg�J���UddlmZddlmZddlZddlZddlZddl	m
Z
ddlmZddl
mZddlmZddlmZdd	lmZdd
lmZej*dej,dej.f�
�Zed�Z	dZGd�d�ZGd�de�ZGd�deeef�ZGd�dej@�Z!e�Z"de#d<	e"jHZ$de#d<y)�)�annotationsN)�defaultdict)�contextmanager)�cached_property)�iscoroutinefunction�)�make_id)�make_ref)�Symbol�F.)�bound�ANYc�<�eZdZUdZeZ	eZded<	edd��Z	edd��Z
ddd�Zedfdd	�Zddd
�Z
eef					dd��Zed d��Z	ddd
�							d!d�Z	ddd�							d"d�Zd#d�Z				d$d�Zefd%d�Zd&d�Z				d'd�Z				d(d�Zd)d�Zd)d�Zy)*�SignalzKA notification emitter.

    :param doc: The docstring for the signal.
    ztype[set[t.Any]]�	set_classc��td��S)z�Emitted at the end of each :meth:`connect` call.

        The signal sender is the signal instance, and the :meth:`connect`
        arguments are passed through: ``receiver``, ``sender``, and ``weak``.

        .. versionadded:: 1.2
        z"Emitted after a receiver connects.��doc�r��selfs �7/usr/local/lib/python3.12/site-packages/blinker/base.py�receiver_connectedzSignal.receiver_connected)s���>�?�?�c��td��S)a�Emitted at the end of each :meth:`disconnect` call.

        The sender is the signal instance, and the :meth:`disconnect` arguments
        are passed through: ``receiver`` and ``sender``.

        This signal is emitted **only** when :meth:`disconnect` is called
        explicitly. This signal cannot be emitted by an automatic disconnect
        when a weakly referenced receiver or sender goes out of scope, as the
        instance is no longer be available to be used as the sender for this
        signal.

        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
        z%Emitted after a receiver disconnects.rrrs r�receiver_disconnectedzSignal.receiver_disconnected4s��&�A�B�BrNc��|r||_i|_	d|_t|j�|_t|j�|_i|_y)NF)�__doc__�	receivers�is_mutedrr�_by_receiver�
_by_sender�
_weak_senders)rrs  r�__init__zSignal.__init__IsO����D�L�
�	
��	�$��
�5@����5P���3>�t�~�~�3N���>@��rTc��t|�}|turtn
t|�}|r)t||j	|��|j
|<n||j
|<|j|j|�|j|j|�|tur7||jvr)	t||j|��|j|<d|jvr8|jj
r"	|jj||||��|S|S#t$rY�SwxYw#t$r|j||��wxYw)a�Connect ``receiver`` to be called when the signal is sent by
        ``sender``.

        :param receiver: The callable to call when :meth:`send` is called with
            the given ``sender``, passing ``sender`` as a positional argument
            along with any extra keyword arguments.
        :param sender: Any object or :data:`ANY`. ``receiver`` will only be
            called when :meth:`send` is called with this sender. If ``ANY``, the
            receiver will be called for any sender. A receiver may be connected
            to multiple senders by calling :meth:`connect` multiple times.
        :param weak: Track the receiver with a :mod:`weakref`. The receiver will
            be automatically disconnected when it is garbage collected. When
            connecting a receiver defined within a function, set to ``False``,
            otherwise it will be disconnected when the function scope ends.
        r)�receiver�sender�weak)r	r�ANY_IDr
�_make_cleanup_receiverrr"�addr!r#�_make_cleanup_sender�	TypeError�__dict__r�send�
disconnect)rr&r'r(�receiver_id�	sender_ids      r�connectzSignal.connect[sG�� �h�'��$��m�F����	��*2��$�5�5�k�B�+�D�N�N�;�'�+3�D�N�N�;�'����	�"�&�&�{�3����+�&�*�*�9�5�����$�2D�2D�!D�
�08��D�5�5�i�@�1��"�"�9�-� �4�=�=�0�T�5L�5L�5V�5V�
��'�'�,�,��8�F��-����x����
��
���
�����&�1��
�s�2(D"�?D1�"	D.�-D.�1Ec�����d���fd�}|S)a�Connect the decorated function to be called when the signal is sent
        by ``sender``.

        The decorated function will be called when :meth:`send` is called with
        the given ``sender``, passing ``sender`` as a positional argument along
        with any extra keyword arguments.

        :param sender: Any object or :data:`ANY`. ``receiver`` will only be
            called when :meth:`send` is called with this sender. If ``ANY``, the
            receiver will be called for any sender. A receiver may be connected
            to multiple senders by calling :meth:`connect` multiple times.
        :param weak: Track the receiver with a :mod:`weakref`. The receiver will
            be automatically disconnected when it is garbage collected. When
            connecting a receiver defined within a function, set to ``False``,
            otherwise it will be disconnected when the function scope ends.=

        .. versionadded:: 1.1
        c�.���j|���|S�N)r3)�fnrr'r(s ���r�	decoratorz%Signal.connect_via.<locals>.decorator�s����L�L��V�T�*��Ir)r7r�returnr�)rr'r(r8s``` r�connect_viazSignal.connect_via�s���(	��rc#�K�|j||d��	d��|j|�y#|j|�wxYw�w)a�A context manager that temporarily connects ``receiver`` to the
        signal while a ``with`` block executes. When the block exits, the
        receiver is disconnected. Useful for tests.

        :param receiver: The callable to call when :meth:`send` is called with
            the given ``sender``, passing ``sender`` as a positional argument
            along with any extra keyword arguments.
        :param sender: Any object or :data:`ANY`. ``receiver`` will only be
            called when :meth:`send` is called with this sender. If ``ANY``, the
            receiver will be called for any sender.

        .. versionadded:: 1.1
        F)r'r(N)r3r0)rr&r's   r�connected_tozSignal.connected_to�s<����"	
���X�f�5��9�	&��J��O�O�H�%��D�O�O�H�%�s�A�.�A�A�Ac#�JK�d|_	d��d|_y#d|_wxYw�w)z�A context manager that temporarily disables the signal. No receivers
        will be called if the signal is sent, until the ``with`` block exits.
        Useful for tests.
        TNF)r rs r�mutedzSignal.muted�s'������
�	"��J�!�D�M��E�D�M�s�#��#�	 �#)�_async_wrapperc���|jrgSg}|j|�D]F}t|�r|�td��||�|fi|��}n	||fi|��}|j	||f��H|S)a/Call all receivers that are connected to the given ``sender``
        or :data:`ANY`. Each receiver is called with ``sender`` as a positional
        argument along with any extra keyword arguments. Return a list of
        ``(receiver, return value)`` tuples.

        The order receivers are called is undefined, but can be influenced by
        setting :attr:`set_class`.

        If a receiver raises an exception, that exception will propagate up.
        This makes debugging straightforward, with an assumption that correctly
        implemented receivers will not raise.

        :param sender: Call receivers connected to this sender, in addition to
            those connected to :data:`ANY`.
        :param _async_wrapper: Will be called on any receivers that are async
            coroutines to turn them into sync callables. For example, could run
            the receiver with an event loop.
        :param kwargs: Extra keyword arguments to pass to each receiver.

        .. versionchanged:: 1.7
            Added the ``_async_wrapper`` argument.
        z$Cannot send to a coroutine function.�r �
receivers_forr�RuntimeError�append)rr'r@�kwargs�resultsr&�results       rr/zSignal.send�s���B�=�=��I����*�*�6�2�H�"�8�,�!�)�&�'M�N�N�1���1�&�C�F�C��!�&�3�F�3���N�N�H�f�-�.�3��r)�
_sync_wrapperc��
K�|jrgSg}|j|�D]V}t|�s%|�td��||�|fi|���d{���}n||fi|���d{���}|j	||f��X|S7�-7��w)a�Await all receivers that are connected to the given ``sender``
        or :data:`ANY`. Each receiver is called with ``sender`` as a positional
        argument along with any extra keyword arguments. Return a list of
        ``(receiver, return value)`` tuples.

        The order receivers are called is undefined, but can be influenced by
        setting :attr:`set_class`.

        If a receiver raises an exception, that exception will propagate up.
        This makes debugging straightforward, with an assumption that correctly
        implemented receivers will not raise.

        :param sender: Call receivers connected to this sender, in addition to
            those connected to :data:`ANY`.
        :param _sync_wrapper: Will be called on any receivers that are sync
            callables to turn them into async coroutines. For example,
            could call the receiver in a thread.
        :param kwargs: Extra keyword arguments to pass to each receiver.

        .. versionadded:: 1.7
        Nz(Cannot send to a non-coroutine function.rB)rr'rIrFrGr&rHs       r�
send_asynczSignal.send_async�s�����@�=�=��I����*�*�6�2�H�&�x�0� �(�&�'Q�R�R�6�}�X�6�v�H��H�H��'��9�&�9�9���N�N�H�f�-�.�3���
I��9�s$�AB�A?�B�#B�$B�Bc��|jsy|jtry|turyt	|�|jvS)a�Check if there is at least one receiver that will be called with the
        given ``sender``. A receiver connected to :data:`ANY` will always be
        called, regardless of sender. Does not check if weakly referenced
        receivers are still live. See :meth:`receivers_for` for a stronger
        search.

        :param sender: Check for receivers connected to this sender, in addition
            to those connected to :data:`ANY`.
        FT)rr"r)rr	)rr's  r�has_receivers_forzSignal.has_receivers_for1s:���~�~���?�?�6�"���S�=���v��$�/�/�1�1rc#�K�|jsyt|�}||jvr$|jt|j|z}n!|jtj	�}|D]c}|jj|�}|��!t
|tj�r%|�}|�|j|t��[|���`|���ey�w)aIYield each receiver to be called for ``sender``, in addition to those
        to be called for :data:`ANY`. Weakly referenced receivers that are not
        live will be disconnected and skipped.

        :param sender: Yield receivers connected to this sender, in addition
            to those connected to :data:`ANY`.
        N)
rr	r"r)�copy�get�
isinstance�weakref�ref�_disconnect)rr'r2�idsr1r&�strongs       rrCzSignal.receivers_forFs������~�~���F�O�	�����'��/�/�&�)�D�O�O�I�,F�F�C��/�/�&�)�.�.�0�C��K��~�~�)�)�+�6�H�����(�G�K�K�0�!����>��$�$�[�&�9�������s�CCc��|turt}nt|�}t|�}|j||�d|jvr6|j
jr|j
j|||��yyy)aDisconnect ``receiver`` from being called when the signal is sent by
        ``sender``.

        :param receiver: A connected receiver callable.
        :param sender: Disconnect from only this sender. By default, disconnect
            from all senders.
        r)r&r'N)rr)r	rTr.rrr/)rr&r'r2r1s     rr0zSignal.disconnectlsu���S�=��I����I��h�'������i�0�
$�t�}�}�4��*�*�4�4��&�&�+�+�D�8�F�+�S�5�
5rc�`�|tk(ri|jj|d��0|jj	�D]}|j|��|jj|d�y|j|j|�|j|j|�yr6)r)r!�popr"�values�discardr)rr1r2�buckets    rrTzSignal._disconnect�s������� � �$�$�[�$�7�C�"�o�o�4�4�6�F��N�N�;�/�7�
�N�N���{�D�1��O�O�I�&�.�.�{�;����k�*�2�2�9�=rc����d��fd�}|S)ztCreate a callback function to disconnect a weakly referenced
        receiver when it is garbage collected.
        c�\��tj�s�j�t�yyr6)�sys�
is_finalizingrTr))rSr1rs ��r�cleanupz.Signal._make_cleanup_receiver.<locals>.cleanup�s&����$�$�&�� � ��f�5�'r)rSz#weakref.ref[c.Callable[..., t.Any]]r9�Noner:)rr1ras`` rr*zSignal._make_cleanup_receiver�s���	6��rc�.����tk7sJ�d��fd�}|S)z�Create a callback function to disconnect all receivers for a weakly
        referenced sender when it is garbage collected.
        c����jj�d��jj�d�D] }�j|j	���"y)Nr:)r#rYr"r!r[)rSr1rr2s  ��rraz,Signal._make_cleanup_sender.<locals>.cleanup�sN������"�"�9�d�3�#���2�2�9�b�A���!�!�+�.�6�6�y�A� Br)rSzweakref.ref[t.Any]r9rb)r))rr2ras`` rr,zSignal._make_cleanup_sender�s ����F�"�"�"�	B��rc��|j|jfD]8}t|j��D]\}}|r�	|j	|d���:y)aEPrune unused sender/receiver bookkeeping. Not threadsafe.

        Connecting & disconnecting leaves behind a small amount of bookkeeping
        data. Typical workloads using Blinker, for example in most web apps,
        Flask, CLI scripts, etc., are not adversely affected by this
        bookkeeping.

        With a long-running process performing dynamic signal routing with high
        volume, e.g. connecting to function closures, senders are all unique
        object instances. Doing all of this over and over may cause memory usage
        to grow due to extraneous bookkeeping. (An empty ``set`` for each stale
        sender/receiver pair.)

        This method will prune that bookkeeping away, with the caveat that such
        pruning is not threadsafe. The risk is that cleanup of a fully
        disconnected receiver/sender pair occurs while another thread is
        connecting that same pair. If you are in the highly dynamic, unique
        receiver/sender situation that has lead you to this method, that failure
        mode is perhaps not a big deal for you.
        N)r"r!�list�itemsrY)r�mapping�identr\s    r�_cleanup_bookkeepingzSignal._cleanup_bookkeeping�sG��*����):�):�;�G�!%�g�m�m�o�!6�
��v���K�K��t�,�"7�<rc���|jj�|jj�|jj�|jj�y)z7Disconnect all receivers and senders. Useful for tests.N)r#�clearrr"r!rs r�_clear_statezSignal._clear_state�sF����� � �"������������������!r)r9rr6)r�
str | Noner9rb)r&rr'�t.Anyr(�boolr9r)F)r'ror(rpr9zc.Callable[[F], F])r&�c.Callable[..., t.Any]r'ror9�c.Generator[None, None, None])r9rr)r'�t.Any | Noner@z^c.Callable[[c.Callable[..., c.Coroutine[t.Any, t.Any, t.Any]]], c.Callable[..., t.Any]] | NonerFror9�*list[tuple[c.Callable[..., t.Any], t.Any]])r'rsrIz^c.Callable[[c.Callable[..., t.Any]], c.Callable[..., c.Coroutine[t.Any, t.Any, t.Any]]] | NonerFror9rt)r'ror9rp)r'ror9z/c.Generator[c.Callable[..., t.Any], None, None])r&rqr'ror9rb)r1�
c.Hashabler2rur9rb)r1rur9z7c.Callable[[weakref.ref[c.Callable[..., t.Any]]], None])r2rur9z&c.Callable[[weakref.ref[t.Any]], None])r9rb)�__name__�
__module__�__qualname__rr�setr�__annotations__rrrr$r3r;rr=r?r/rKrMrCr0rTr*r,rjrmr:rrrrs���
�C�>�"%�I��%���@��@��C��C�(A�$47�T�0�d�4�@C�&�.�&�8=�&�	&�&��&�.�
"��
"� $�1��1��1�
�1��1�
4�1�j $�0��0��0�
�0��0�
4�0�d2�*$��$�	8�$�LLO�T�0	>�
�%�
�	@�
��#��	/�� -�4"rrc�2��eZdZdZdd�fd�
Zd�fd�Z�xZS)�NamedSignalaA named generic notification emitter. The name is not used by the signal
    itself, but matches the key in the :class:`Namespace` that it belongs to.

    :param name: The name of the signal within the namespace.
    :param doc: The docstring for the signal.
    c�2��t�|�|�||_yr6)�superr$�name)rrr�	__class__s   �rr$zNamedSignal.__init__�s���
�������	rc�J��t�|��}|dd�d|j�d�S)N���z; �>)r~�__repr__r)r�baser�s  �rr�zNamedSignal.__repr__�s-����w��!���s��)��B�t�y�y�m�1�-�-rr6)r�strrrnr9rb)r9r�)rvrwrxrr$r��
__classcell__)r�s@rr|r|�s�����.�.rr|c��eZdZdZddd�Zy)�	Namespacez A dict mapping names to signals.Nc�2�||vrt||�||<||S)z�Return the :class:`NamedSignal` for the given ``name``, creating it
        if required. Repeated calls with the same name return the same signal.

        :param name: The name of the signal.
        :param doc: The docstring of the signal.
        )r|�rrrs   r�signalzNamespace.signal�s&���t��$�T�3�/�D��J��D�z�rr6�rr�rrnr9r|)rvrwrxrr�r:rrr�r��s
��*�
rr�c��eZdZddd�Zy)�_PNamespaceSignalNc��yr6r:r�s   r�__call__z_PNamespaceSignal.__call__�s��#rr6r�)rvrwrxr�r:rrr�r��s��Mrr��default_namespacer�)%�
__future__r�collections.abc�abc�cr_�typing�trR�collectionsr�
contextlibr�	functoolsr�inspectr�
_utilitiesr	r
r�TypeVar�Callable�Anyrrr)rr|�dictr�r��Protocolr�r�rzr�r:rr�<module>r�s���"��
���#�%�%�'�� ��
�A�I�I�c����C����J�/�0���U�m���	
��u"�u"�p
.�&�.�&
��S�+�%�&�
� N��
�
�N� )�{��9�*��.�4�4���4�r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists