Hacked By AnonymousFox

Current Path : /opt/alt/python312/lib64/python3.12/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/__pycache__/weakref.cpython-312.pyc

�

6�f	T��2�dZddlmZmZmZmZmZmZmZm	Z	ddl
mZmZddl
Z
ddlZddlZeefZgd�Ze
j$j'e�Gd�de�ZGd�d	e
j*�ZGd
�de�ZGd�d
e
j*�ZGd�d�Zy)ztWeak reference support for Python.

This module is an implementation of PEP 205:

https://peps.python.org/pep-0205/
�)�getweakrefcount�getweakrefs�ref�proxy�CallableProxyType�	ProxyType�
ReferenceType�_remove_dead_weakref)�WeakSet�_IterationGuardN)
rrrr�WeakKeyDictionaryr	rr�
ProxyTypes�WeakValueDictionaryr�
WeakMethod�finalizec�R��eZdZdZdZdd�Z�fd�Zd�Zd�Ze	jZ
�xZS)rz�
    A custom `weakref.ref` subclass which simulates a weak reference to
    a bound method, working around the lifetime problem of bound methods.
    )�	_func_ref�
_meth_type�_alive�__weakref__c�>���	|j}|j}��fd�}t
j|||�}t
||�|_t|�|_	d|_
t
|��|S#t$r%tdj	t|���d�wxYw)Nz)argument should be a bound method, not {}c�R����}|jrd|_��	�|�yyy�NF)r)�arg�self�callback�self_wrs  ���./opt/alt/python312/lib64/python3.12/weakref.py�_cbzWeakMethod.__new__.<locals>._cb5s1����9�D��{�{�#����'��T�N�(��T)�__self__�__func__�AttributeError�	TypeError�format�typer�__new__rrr)�cls�methr�obj�funcrrrs  `    @rr'zWeakMethod.__new__.s����	;��-�-�C��=�=�D�	#��{�{�3��S�)���T�3�����t�*�������d�)�����!�	;��G�#�V�D��J�/�1�6:�
;�	;�s�A.�..Bc�n��t�|��}|j�}|�|�y|j||�S�N)�super�__call__rr)rr*r+�	__class__s   �rr/zWeakMethod.__call__Ds9����g�� ���~�~����;�$�,�����t�S�)�)r c���t|t�rM|jr|js||uStj||�xr|j
|j
k(StSr-)�
isinstancerrr�__eq__r�NotImplemented�r�others  rr3zWeakMethod.__eq__KsL���e�Z�(��;�;�e�l�l��u�}�$��:�:�d�E�*�P�t�~�~����/P�P��r c���t|t�rM|jr|js||uStj||�xs|j
|j
k7StSr-)r2rrr�__ne__rr4r5s  rr8zWeakMethod.__ne__RsM���e�Z�(��;�;�e�l�l��5�(�(��:�:�d�E�*�O�d�n�n����.O�O��r r-)�__name__�
__module__�__qualname__�__doc__�	__slots__r'r/r3r8r�__hash__�
__classcell__�r0s@rrr&s/����
C�I��,*����|�|�Hr rc��eZdZdZdd�Zefd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
e
Zd�Zdd
�Zd�Zd�ZeZd�Zd�Zd�Zd�Zdd�Zdd�Zd�Zd�Zd�Zd�Zy)rz�Mapping class that references values weakly.

    Entries in the dictionary will be discarded when no strong
    reference to the value exists anymore
    c��t|�tfd�}||_g|_t	�|_i|_|j|fi|��y)Nc��|�}|�P|jr&|jj|j�y||j|j�yyr-)�
_iterating�_pending_removals�append�key�data)�wr�selfref�_atomic_removalrs    r�removez,WeakValueDictionary.__init__.<locals>.removeisG���9�D����?�?��*�*�1�1�"�&�&�9�$�D�I�I�r�v�v�6�
 r )rr
�_removerE�setrDrH�update)rr6�kwrLs    r�__init__zWeakValueDictionary.__init__hsE��"�4�y�:N�	7����!#����%�����	�����E� �R� r c��|jj}|j}		|�}|||��#t$rYywxYwr-)rE�poprH�
IndexError)rrKrS�drGs     r�_commit_removalsz$WeakValueDictionary._commit_removalsysR���$�$�(�(���I�I���
��e��
�A�s�#����
��
�s�6�	A�Ac��|jr|j�|j|�}|�t|��|Sr-�rErVrH�KeyError�rrG�os   r�__getitem__zWeakValueDictionary.__getitem__�s=���!�!��!�!�#��D�I�I�c�N����9��3�-���Hr c�V�|jr|j�|j|=yr-)rErVrH�rrGs  r�__delitem__zWeakValueDictionary.__delitem__�s"���!�!��!�!�#��I�I�c�Nr c�d�|jr|j�t|j�Sr-)rErV�lenrH�rs r�__len__zWeakValueDictionary.__len__�s%���!�!��!�!�#��4�9�9�~�r c��|jr|j�	|j|�}|duS#t$rYywxYwrrXrZs   r�__contains__z WeakValueDictionary.__contains__�sN���!�!��!�!�#�	���	�	�#�� �A���}����	��	�s�6�	A�Ac�J�d|jjt|�fzS�Nz<%s at %#x>�r0r9�idrbs r�__repr__zWeakValueDictionary.__repr__�� ������ 7� 7��D��B�B�Br c��|jr|j�t||j|�|j|<yr-)rErV�KeyedRefrMrH�rrG�values   r�__setitem__zWeakValueDictionary.__setitem__�s1���!�!��!�!�#�!�%����s�;��	�	�#�r c��|jr|j�t�}t|�5|jj�D]\}}|�}|��|||<�	ddd�|S#1swY|SxYwr-)rErVrrrH�items)r�newrGrIr[s     r�copyzWeakValueDictionary.copy�ss���!�!��!�!�#�!�#��
�T�
"�	!��9�9�?�?�,���R��D���=� �C��H�-�	!�
�
�	!�
�
�s�*A/�A/�/A9c��ddlm}|jr|j�|j	�}t|�5|jj�D]\}}|�}|��|||||�<�	ddd�|S#1swY|SxYw�Nr)�deepcopy)rtrwrErVr0rrHrr)r�memorwrsrGrIr[s       r�__deepcopy__z WeakValueDictionary.__deepcopy__�s���!��!�!��!�!�#��n�n���
�T�
"�	1��9�9�?�?�,���R��D���=�/0�C���d�+�,�-�	1�
�
�	1�
�
�s�*B�)B�BNc��|jr|j�	|j|}|�}|�|S|S#t$r|cYSwxYwr-rX)rrG�defaultrIr[s     r�getzWeakValueDictionary.get�sW���!�!��!�!�#�
	����3��B���A��y�������	��N�	�s�:�A�Ac#��K�|jr|j�t|�5|jj	�D]\}}|�}|��||f���	ddd�y#1swYyxYw�wr-�rErVrrHrr)r�krI�vs    rrrzWeakValueDictionary.items�se�����!�!��!�!�#�
�T�
"�	������*���2��D���=��Q�$�J�+�	�	�	�s"�(A3�*A'�A'�	A3�'A0�,A3c#��K�|jr|j�t|�5|jj	�D]\}}|���|���	ddd�y#1swYyxYw�wr-r~)rrrIs   r�keyszWeakValueDictionary.keys�s]�����!�!��!�!�#�
�T�
"�	������*���2��4�#��G�+�	�	�	�s"�(A/�(A#�A#�	A/�#A,�(A/c#��K�|jr|j�t|�5|jj	�Ed{���ddd�y7�
#1swYyxYw�w)a�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.

        N�rErVrrH�valuesrbs r�
itervaluerefsz!WeakValueDictionary.itervaluerefs�sX�����!�!��!�!�#�
�T�
"�	*��y�y�'�'�)�)�)�	*�	*�)��	*�	*�s.�(A$�A�A�	A�
	A$�A�A!�A$c#��K�|jr|j�t|�5|jj	�D]}|�}|��
|���	ddd�y#1swYyxYw�wr-r��rrIr*s   rr�zWeakValueDictionary.values�s_�����!�!��!�!�#�
�T�
"�	��i�i�&�&�(���d���?��I�)�	�	�	�s"�(A.�'A"�A"�	A.�"A+�'A.c��|jr|j�	|jj�\}}|�}|�||fS�+r-)rErVrH�popitem)rrGrIr[s    rr�zWeakValueDictionary.popitem�sJ���!�!��!�!�#���i�i�'�'�)�G�C����A��}��A�v�
�	r c���|jr|j�	|jj|��}|�|r|dSt	|��|S#t$rd}Y�#wxYw)Nr)rErVrHrSrY)rrG�argsr[s    rrSzWeakValueDictionary.popsk���!�!��!�!�#�	�"��	�	�
�
�c�"�$�A�
�9���A�w���s�m�#��H���	��A�	�s� A�A"�!A"c���	|j|�}|�B|jr|j�t	||j
|�|j|<|S|S#t$rd}Y�SwxYwr-)rHrYrErVrmrM)rrGr{r[s    r�
setdefaultzWeakValueDictionary.setdefaultso��	���	�	�#�� �A�
�9��%�%��%�%�'�%�g�t�|�|�S�A�D�I�I�c�N��N��H���	��A�	�s�A�A*�)A*c�N�|jr|j�|j}|�It|d�st	|�}|j�D]\}}t
||j|�||<�!|j�D]\}}t
||j|�||<�!y�Nrr)rErVrH�hasattr�dictrrrmrM)rr6�kwargsrUrGr[s      rrOzWeakValueDictionary.update!s����!�!��!�!�#��I�I�����5�'�*��U����+�+�-���Q�!�!�T�\�\�3�7��#��(��l�l�n�F�C���a����s�3�A�c�F�%r c��|jr|j�t|jj	��S)a~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.

        )rErV�listrHr�rbs r�	valuerefszWeakValueDictionary.valuerefs-s1���!�!��!�!�#��D�I�I�$�$�&�'�'r c�(�|j|�|Sr-�rOr5s  r�__ior__zWeakValueDictionary.__ior__;������E���r c��t|tj�r#|j�}|j	|�|St
Sr-�r2�_collections_abc�MappingrtrOr4�rr6�cs   r�__or__zWeakValueDictionary.__or__?�4���e�-�5�5�6��	�	��A�
�H�H�U�O��H��r c��t|tj�r4|j�}|j	|�|j	|�|St
Sr-�r2r�r�r0rOr4r�s   r�__ror__zWeakValueDictionary.__ror__F�@���e�-�5�5�6���� �A�
�H�H�U�O�
�H�H�T�N��H��r )�r-)r9r:r;r<rQr
rVr\r_rcrerjrprt�__copy__ryr|rrr��__iter__r�r�r�rSr�rOr�r�r�r�r�r rrr\s����!�"0D�
$���
�
�C�<�
	��H�
�
����H�
*���
��
4�(���r rc�,��eZdZdZdZd�Z�fd�Z�xZS)rma[Specialized reference that includes a key corresponding to the value.

    This is used in the WeakValueDictionary to avoid having to create
    a function object for each key stored in the mapping.  A shared
    callback object can use the 'key' attribute of a KeyedRef instead
    of getting a reference to the key from an enclosing scope.

    �rGc�B�tj|||�}||_|Sr-)rr'rG)r&�obrrGrs     rr'zKeyedRef.__new__[s ���{�{�4��X�.������r c�&��t�|�||�yr-)r.rQ)rr�rrGr0s    �rrQzKeyedRef.__init__`s���
����X�&r )r9r:r;r<r=r'rQr?r@s@rrmrmOs�����I��
'�'r rmc��eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�ZeZ
d�Zdd
�Zd�Zd�Zd�ZeZd�Zd�Zd�Zd�Zdd�Zdd�Zd�Zd�Zd�Zy)r
a� Mapping class that references keys weakly.

    Entries in the dictionary will be discarded when there is no
    longer a strong reference to the key. This can be used to
    associate additional data with an object owned by other parts of
    an application without adding attributes to those objects. This
    can be especially useful with objects that override attribute
    accesses.
    Nc��i|_t|�fd�}||_g|_t	�|_d|_|�|j|�yy)Nc��|�}|�7|jr|jj|�y	|j|=yy#t$rYywxYwr-)rDrErFrHrY)rrJrs   rrLz*WeakKeyDictionary.__init__.<locals>.removeqsS���9�D����?�?��*�*�1�1�!�4�� �I�I�a�L� ��$����s�
A�	A�
AF)rHrrMrErNrD�
_dirty_lenrO)rr�rLs   rrQzWeakKeyDictionary.__init__osM����	�!�$�i�		����!#����%���������K�K���r c��|jj}|j}		|�}	||=�
#t$rYywxYw#t$rY�wxYwr-)rErSrHrTrY)rrSrUrGs    rrVz"WeakKeyDictionary._commit_removals�se��
�$�$�(�(���I�I���
��e��
��c�F����
��
��
�
��
�s�1�A�	=�=�	A�Ac�|�|j}|jD�cgc]	}||vs�|��c}|_d|_ycc}wr)rHrEr�)rrUrs   r�_scrub_removalsz!WeakKeyDictionary._scrub_removals�s7���I�I��-1�-C�-C�!N��q�A�v�!�!N�������"Os�	9�9c�>�d|_|jt|�=y�NT)r�rHrr^s  rr_zWeakKeyDictionary.__delitem__�s������I�I�c�#�h�r c�2�|jt|�Sr-)rHrr^s  rr\zWeakKeyDictionary.__getitem__�s���y�y��S��"�"r c��|jr|jr|j�t|j�t|j�z
Sr-)r�rEr�rarHrbs rrczWeakKeyDictionary.__len__�s=���?�?�t�5�5�
� � �"��4�9�9�~��D�$:�$:� ;�;�;r c�J�d|jjt|�fzSrgrhrbs rrjzWeakKeyDictionary.__repr__�rkr c�J�||jt||j�<yr-)rHrrMrns   rrpzWeakKeyDictionary.__setitem__�s��,1��	�	�#�c�4�<�<�(�)r c��t�}t|�5|jj�D]\}}|�}|��|||<�	ddd�|S#1swY|SxYwr-)r
rrHrr)rrsrGror[s     rrtzWeakKeyDictionary.copy�s^���!��
�T�
"�	#�"�i�i�o�o�/�
��U��E���=�"�C��F�0�	#�
�
�	#�
�
�s�*A�A�Ac���ddlm}|j�}t|�5|jj�D]\}}|�}|��|||�||<�	ddd�|S#1swY|SxYwrv)rtrwr0rrHrr)rrxrwrsrGror[s       rryzWeakKeyDictionary.__deepcopy__�sl��!��n�n���
�T�
"�	3�"�i�i�o�o�/�
��U��E���=�%�e�T�2�C��F�0�	3�
�
�	3�
�
�s�*A&�
A&�&A0c�L�|jjt|�|�Sr-)rHr|r�rrGr{s   rr|zWeakKeyDictionary.get�s���y�y�}�}�S��X�g�.�.r c�T�	t|�}||jvS#t$rYywxYwr)rr$rH)rrGrIs   rrezWeakKeyDictionary.__contains__�s4��	��S��B��T�Y�Y�����	��	�s��	'�'c#�K�t|�5|jj�D]\}}|�}|��||f���	ddd�y#1swYyxYw�wr-�rrHrr)rrIrorGs    rrrzWeakKeyDictionary.items�sQ����
�T�
"�	%�!�Y�Y�_�_�.�	��E��d���?��u�*�$�/�	%�	%�	%�s!�A�*A�A�	A�A�Ac#�K�t|�5|jD]}|�}|��
|���	ddd�y#1swYyxYw�wr-)rrHr�s   rr�zWeakKeyDictionary.keys�sA����
�T�
"�	��i�i���d���?��I� �	�	�	�s�A�8�8�	A�A�Ac#�K�t|�5|jj�D]\}}|���|���	ddd�y#1swYyxYw�wr-r�)rrIros   rr�zWeakKeyDictionary.values�sH����
�T�
"�	 �!�Y�Y�_�_�.�	��E��4�#��K�/�	 �	 �	 �s �A�(A�A�	A�A�Ac�,�t|j�S)azReturn a list of weak references to the keys.

        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 keys around longer than needed.

        )r�rHrbs r�keyrefszWeakKeyDictionary.keyrefs�s���D�I�I��r c�h�d|_	|jj�\}}|�}|�||fS�+r�)r�rHr�)rrGror[s    rr�zWeakKeyDictionary.popitem�s<���������*�*�,�J�C����A��}��%�x��	r c�\�d|_|jjt|�g|���Sr�)r�rHrSr)rrGr�s   rrSzWeakKeyDictionary.pop�s'������t�y�y�}�}�S��X�-��-�-r c�b�|jjt||j�|�Sr-)rHr�rrMr�s   rr�zWeakKeyDictionary.setdefault�s$���y�y�#�#�C��T�\�\�$:�7�C�Cr c��|j}|�Nt|d�sti�|�}|j�D]\}}||t	||j
�<� t
|�r|j|�yyr�)rHr�r&rrrrMrarO)rr�r�rUrGros      rrOzWeakKeyDictionary.update�sk���I�I�����4��)��t�B�x��~��"�j�j�l�
��U�,1��#�c�4�<�<�(�)�+��v�;��K�K���r c�(�|j|�|Sr-r�r5s  rr�zWeakKeyDictionary.__ior__r�r c��t|tj�r#|j�}|j	|�|St
Sr-r�r�s   rr�zWeakKeyDictionary.__or__r�r c��t|tj�r4|j�}|j	|�|j	|�|St
Sr-r�r�s   rr�zWeakKeyDictionary.__ror__r�r r-)r9r:r;r<rQrVr�r_r\rcrjrprtr�ryr|rerrr�r�r�r�r�rSr�rOr�r�r�r�r rr
r
ds�����(�$ �
 �#�<�C�2���H��/��%���H� �
� �.�D� ���r r
c���eZdZdZdZiZdZej�Z	dZ
dZGd�d�Zd�Z
dd�Zd	�Zd
�Zed��Zed��Zej(d
��Zd�Zed��Zed��Zy)raClass for finalization of weakrefable objects

    finalize(obj, func, *args, **kwargs) returns a callable finalizer
    object which will be called when obj is garbage collected. The
    first time the finalizer is called it evaluates func(*arg, **kwargs)
    and returns the result. After this the finalizer is dead, and
    calling it just returns None.

    When the program exits any remaining finalizers for which the
    atexit attribute is true will be run in reverse order of creation.
    By default atexit is true.
    r�Fc��eZdZdZy)�finalize._Info)�weakrefr+r�r��atexit�indexN)r9r:r;r=r�r r�_Infor�5s��L�	r r�c�Z�|js*ddl}|j|j�dt_|j�}t
||�|_||_||_	|xsd|_
d|_t|j�|_
||j|<dt_y)NrT)�_registered_with_atexitr��register�	_exitfuncrr�rr�r+r�r��next�_index_iterr��	_registry�_dirty)rr*r+r�r�r��infos       rrQzfinalize.__init__8s����+�+�
��O�O�D�N�N�+�/3�H�,��z�z�|���3��~�����	���	��n��������$�*�*�+��
�#����t����r Nc��|jj|d�}|r7|js*|j|ji|j
xsi��Syy)zZIf alive then mark as dead and return func(*args, **kwargs);
        otherwise return NoneN)r�rS�	_shutdownr+r�r�)r�_r�s   rr/zfinalize.__call__IsM���~�~�!�!�$��-�������4�9�9�d�i�i�?�D�K�K�,=�2�?�?�'�4r c���|jj|�}|xr|j�}|�E|jj|d�r(||j|j
|jxsifSyy)z^If alive then mark as dead and return (obj, func, args, kwargs);
        otherwise return NoneN)r�r|r�rSr+r�r��rr�r*s   r�detachzfinalize.detachPsg���~�~�!�!�$�'���%�t�|�|�~���?�t�~�~�1�1�$��=�����D�I�I�t�{�{�/@�b�A�A� >�?r c��|jj|�}|xr|j�}|�(||j|j|j
xsifSy)zMIf alive then return (obj, func, args, kwargs);
        otherwise return NoneN)r�r|r�r+r�r�r�s   r�peekz
finalize.peekXsR���~�~�!�!�$�'���%�t�|�|�~���?�����D�I�I�t�{�{�/@�b�A�A�r c��||jvS)zWhether finalizer is alive)r�rbs r�alivezfinalize.alive`s���t�~�~�%�%r c�j�|jj|�}t|�xr|jS)z*Whether finalizer should be called at exit�r�r|�boolr�)rr�s  rr�zfinalize.atexites+���~�~�!�!�$�'���D�z�)�d�k�k�)r c�`�|jj|�}|rt|�|_yyr-r�)rror�s   rr�zfinalize.atexitks)���~�~�!�!�$�'����u�+�D�K�r c�,�|jj|�}|xr|j�}|�#dt|�jt|�fzSdt|�jt|�t|�jt|�fzS)Nz<%s object at %#x; dead>z!<%s object at %#x; for %r at %#x>)r�r|r�r&r9rir�s   rrjzfinalize.__repr__qs����~�~�!�!�$�'���%�t�|�|�~���;�-��d��1D�1D�b��h�0O�O�O�6��d��$�$�b��h��S�	�0B�0B�B�s�G�L�M�
Mr c���|jj�D��cgc]\}}|js�||f��}}}|jd���|D��cgc]\}}|��	c}}Scc}}wcc}}w)Nc� �|djS)N�)r�)�items r�<lambda>z+finalize._select_for_exit.<locals>.<lambda>~s��t�A�w�}�}r r�)r�rrr��sort)r(�f�i�Ls    r�_select_for_exitzfinalize._select_for_exitzs_��!$�
�
� 3� 3� 5�B�u��!����a��U�B��B�	���,��-� �!�e�q���!�!��
C��!s�A$�A$�A*c��d}	|jr�ddl}|j�rd}|j�d}	|�tj
r|j
�}dt_|sn)|j�}	|�||jvsJ��Ydt_|rj�yy#t$r'tjtj��Y�_wxYw#dt_|rj�wwxYw)NFrT)r��gc�	isenabled�disablerr�r�rS�	Exception�sys�
excepthook�exc_infor��enable)r(�reenable_gcr��pendingr�s     rr�zfinalize._exitfunc�s���
��	��}�}���<�<�>�"&�K��J�J�L������(�/�/�"%�"6�"6�"8��*/���"�����
�A�8�
���C�M�M�1�1�1��$"&�H����	�	����
%�8��������7�8��
"&�H����	�	���s0�A5C$�:B1�C$�1-C!�C$� C!�!C$�$ Dr-)r9r:r;r<r=r�r��	itertools�countr�r�r�r�rQr/r�r��propertyr�r��setterrj�classmethodr�r�r�r rrrs����"�I��I��I�!�)�/�/�#�K�
�F�#��M�M��"@�B�B��&��&��*��*�
�]�]�&��&�
M��"��"�� �� r r)r<�_weakrefrrrrrrr	r
�_weakrefsetrrr�r�rr�__all__�
MutableSetr�r�MutableMappingrrmr
rr�r r�<module>rs�������1��
���*�
+�
�0�����$�$�W�-�3��3�lp�*�9�9�p�f'�s�'�*u�(�7�7�u�pF�Fr 

Hacked By AnonymousFox1.0, Coded By AnonymousFox