%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/zope/interface/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/zope/interface/__pycache__/adapter.cpython-312.pyc

�

��ez����dZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZdd	l
mZd
dgZ
Gd�d
�Ze�ZeGd�d��ZeGd�de��ZGd�d�ZGd�dee�Zee	�Gd�d
e��ZGd�dee�Zee	�Gd�de��Zd�Zd�Zd�Zd�Zy)zAdapter management
�N)�implementer)�
providedBy��	Interface)�ro)�IAdapterRegistry)�_normalize_name)�_use_c_impl�AdapterRegistry�VerifyingAdapterRegistryc���eZdZdZdZdZdd�Zd�Zed�d��Z	d�Z
eZe
ZeZeZd	�Zd
�Zd�Zd�Zd
�Zdd�Zedd��Zd�Zd�Zdd�Zd�Zd�Zd�Zdd�Z d�Z!d�Z"y)�BaseAdapterRegistrya�
    A basic implementation of the data storage and algorithms required
    for a :class:`zope.interface.interfaces.IAdapterRegistry`.

    Subclasses can set the following attributes to control how the data
    is stored; in particular, these hooks can be helpful for ZODB
    persistence. They can be class attributes that are the named (or similar) type, or
    they can be methods that act as a constructor for an object that behaves
    like the types defined here; this object will not assume that they are type
    objects, but subclasses are free to do so:

    _sequenceType = list
      This is the type used for our two mutable top-level "byorder" sequences.
      Must support mutation operations like ``append()`` and ``del seq[index]``.
      These are usually small (< 10). Although at least one of them is
      accessed when performing lookups or queries on this object, the other
      is untouched. In many common scenarios, both are only required when
      mutating registrations and subscriptions (like what
      :meth:`zope.interface.interfaces.IComponents.registerUtility` does).
      This use pattern makes it an ideal candidate to be a
      :class:`~persistent.list.PersistentList`.
    _leafSequenceType = tuple
      This is the type used for the leaf sequences of subscribers.
      It could be set to a ``PersistentList`` to avoid many unnecessary data
      loads when subscribers aren't being used. Mutation operations are directed
      through :meth:`_addValueToLeaf` and :meth:`_removeValueFromLeaf`; if you use
      a mutable type, you'll need to override those.
    _mappingType = dict
      This is the mutable mapping type used for the keyed mappings.
      A :class:`~persistent.mapping.PersistentMapping`
      could be used to help reduce the number of data loads when the registry is large
      and parts of it are rarely used. Further reductions in data loads can come from
      using a :class:`~BTrees.OOBTree.OOBTree`, but care is required
      to be sure that all required/provided
      values are fully ordered (e.g., no required or provided values that are classes
      can be used).
    _providedType = dict
      This is the mutable mapping type used for the ``_provided`` mapping.
      This is separate from the generic mapping type because the values
      are always integers, so one might choose to use a more optimized data
      structure such as a :class:`~BTrees.OIBTree.OIBTree`.
      The same caveats regarding key types
      apply as for ``_mappingType``.

    It is possible to also set these on an instance, but because of the need to
    potentially also override :meth:`_addValueToLeaf` and :meth:`_removeValueFromLeaf`,
    this may be less useful in a persistent scenario; using a subclass is recommended.

    .. versionchanged:: 5.3.0
        Add support for customizing the way internal data
        structures are created.
    .. versionchanged:: 5.3.0
        Add methods :meth:`rebuild`, :meth:`allRegistrations`
        and :meth:`allSubscriptions`.
    )	�lookup�queryMultiAdapter�lookup1�queryAdapter�adapter_hook�	lookupAll�names�
subscriptions�subscribersrc��|j�|_|j�|_|j�|_|j�||_y�N)�
_sequenceType�	_adapters�_subscribers�
_providedType�	_provided�
_createLookup�	__bases__��self�basess  �8/usr/lib/python3/dist-packages/zope/interface/adapter.py�__init__zBaseAdapterRegistry.__init__�sP���+�+�-���!�.�.�0����+�+�-��� 	
�������c�x�||jd<tj|�|_|j|�y)z�
        If subclasses need to track when ``__bases__`` changes, they
        can override this method.

        Subclasses must still call this method.
        r N)�__dict__r�changedr!s  r$�	_setBaseszBaseAdapterRegistry._setBases�s-��&+��
�
�k�"��%�%��+������T�r&c� �|jdS)Nr )r(�r"s r$�<lambda>zBaseAdapterRegistry.<lambda>�s��d�m�m�K�&@�r&c�$�|j|�Sr)r*r!s  r$r-zBaseAdapterRegistry.<lambda>�s��T�^�^�E�-B�r&c��|j|�|_|jD]%}t|j|�|j|<�'yr)�LookupClass�	_v_lookup�
_delegated�getattrr()r"�names  r$rz!BaseAdapterRegistry._createLookup�sB���)�)�$�/����O�O�	@�D�")�$�.�.�$�"?�D�M�M�$��	@r&c��|�|fS||fzS)a
        Add the value *new_item* to the *existing_leaf_sequence*, which may
        be ``None``.

        Subclasses that redefine `_leafSequenceType` should override this method.

        :param existing_leaf_sequence:
            If *existing_leaf_sequence* is not *None*, it will be an instance
            of `_leafSequenceType`. (Unless the object has been unpickled
            from an old pickle and the class definition has changed, in which case
            it may be an instance of a previous definition, commonly a `tuple`.)

        :return:
           This method returns the new value to be stored. It may mutate the
           sequence in place if it was not ``None`` and the type is mutable, but
           it must also return it.

        .. versionadded:: 5.3.0
        �)r"�existing_leaf_sequence�new_items   r$�_addValueToLeafz#BaseAdapterRegistry._addValueToLeaf�s��("�)��;��%���3�3r&c�J�t|D�cgc]
}||k7s�	|��c}�Scc}w)aa
        Remove the item *to_remove* from the (non-``None``, non-empty)
        *existing_leaf_sequence* and return the mutated sequence.

        If there is more than one item that is equal to *to_remove*
        they must all be removed.

        Subclasses that redefine `_leafSequenceType` should override
        this method. Note that they can call this method to help
        in their implementation; this implementation will always
        return a new tuple constructed by iterating across
        the *existing_leaf_sequence* and omitting items equal to *to_remove*.

        :param existing_leaf_sequence:
           As for `_addValueToLeaf`, probably an instance of
           `_leafSequenceType` but possibly an older type; never `None`.
        :return:
           A version of *existing_leaf_sequence* with all items equal to
           *to_remove* removed. Must not return `None`. However,
           returning an empty
           object, even of another type such as the empty tuple, ``()`` is
           explicitly allowed; such an object will never be stored.

        .. versionadded:: 5.3.0
        )�tuple)r"r7�	to_remove�vs    r$�_removeValueFromLeafz(BaseAdapterRegistry._removeValueFromLeaf�s$��4�!7�J�A�1�	�>�a�J�K�K��Js�
 � c�d�|xjdz
c_|jj|�y�N�)�_generationr1r))r"�originally_changeds  r$r)zBaseAdapterRegistry.changeds&�����A��������1�2r&c���t|t�std��|�|j||||�yt	|D�cgc]
}t|���c}�}t
|�}t|�}|j}t|�|kr.|j|j��t|�|kr�.||}||fz}	|	D],}
|j|
�}|�|j�}|||
<|}�.|j|�|ury|||<|jj|d�dz}||j|<|dk(r|jj|�|j|�ycc}w)N�name is not a stringrrA)�
isinstance�str�
ValueError�
unregisterr;�_convert_None_to_Interfacer	�lenr�append�_mappingType�getrr1�add_extendorr))
r"�required�providedr4�value�r�order�byorder�
components�key�k�d�ns
             r$�registerzBaseAdapterRegistry.registers_���$��$��3�4�4��=��O�O�H�h��e�<����J�A�4�Q�7�J�K���t�$���H�
���.�.���'�l�e�#��N�N�4�,�,�.�/��'�l�e�#��U�^�
��(��$���	�A����q�!�A��y��%�%�'�� !�
�1�
��J�	��>�>�$��5�(�� �
�4���N�N���x��+�a�/��#$����x� ���6��N�N�'�'��1����T���5Ks�E(c��t|D�cgc]
}t|���c}�}t|�}t|�|kry||}||fz}|D]}	|j|	�}
|
�y|
}�|j|�Scc}wr)r;rJrKrN)r"rUrPrQr4rSrTrVrWrXrYs           r$�
_find_leafzBaseAdapterRegistry._find_leaf*s�����J�A�4�Q�7�J�K���H�
���w�<�5� ���U�^�
��(��$���	�A����q�!�A��y���J�		��~�~�d�#�#��Ks�A7c�P�|j|j||t|��Sr)r]rr	)r"rPrQr4s    r$�
registeredzBaseAdapterRegistry.registered@s(������N�N����D�!�	
�	
r&c#��K�|dk(r#|j�D]\}}||fz|f���y|j�D])\}}||fz}|j||dz
|�Ed{����+y7��w)NrrA)�items�_allKeys)�clsrV�i�parent_krXr=�new_parent_ks       r$rbzBaseAdapterRegistry._allKeysHs�������6�"�(�(�*�
)���1��!��o�q�(�(�
)�#�(�(�*�
@���1�'�1�$����<�<��1�q�5�,�?�?�?�
@�?�s�AA*� A(�!A*c#�K�t|�D]L\}}|j||dz�D]/\}}t|�|dzk(sJ�|d|}|d}|d}||||f���1�Ny�w)NrA�������)�	enumeraterbrK)	r"rUrdrVrWrRrPrQr4s	         r$�_all_entriesz BaseAdapterRegistry._all_entriesRs�����'�w�/�	8�M�A�z�#�m�m�J��A��>�
8�
��U��3�x�1�q�5�(�(�(��r��7���r�7���2�w����4��7�7�
8�	8�s�AAc#�VK�|j|j�Ed{���y7��w)aT
        Yields tuples ``(required, provided, name, value)`` for all
        the registrations that this object holds.

        These tuples could be passed as the arguments to the
        :meth:`register` method on another adapter registry to
        duplicate the registrations this object holds.

        .. versionadded:: 5.3.0
        N)rlrr,s r$�allRegistrationsz$BaseAdapterRegistry.allRegistrationsds �����$�$�T�^�^�4�4�4�s�)�'�)Nc�|�t|D�cgc]
}t|���c}�}t|�}|j}|t|�k\ry||}||fz}	g}
|	D],}|j	|�}|�y|
j||f�|}�.|j	|�}
|
�y|�|
|ury||=|s1t
|
�D]\}}||}|rn||=�|r|ds|d=|r|ds�|j|dz
}|dk(r)|j|=|jj|�n||j|<|j|�ycc}w)NFrjrAr)r;rJrKrrNrL�reversedrr1�remove_extendorr))r"rPrQr4rRrSrTrUrVrW�lookupsrXrY�old�comprZs                r$rIzBaseAdapterRegistry.unregisterqsm����J�A�4�Q�7�J�K���H�
���.�.���C��L� ���U�^�
��(��$�����	�A����q�!�A��y���N�N�J��?�+��J�	��n�n�T�"���;����C�u�$4���t���$�G�,�
 ���a���G�����Q��
 ��'�"�+��B�K��'�"�+��N�N�8�$�q�(����6����x�(��N�N�*�*�8�4�'(�D�N�N�8�$����T���[Ks�D9c�~�t|D�cgc]
}t|���c}�}d}t|�}|j}t|�|kr.|j	|j��t|�|kr�.||}||fz}	|	D],}
|j
|
�}|�|j�}|||
<|}�.|j|j
|�|�||<|�N|jj
|d�dz}||j|<|dk(r|jj|�|j|�ycc}w)N�rrA)r;rJrKrrLrMrNr9rr1rOr))
r"rPrQrRrSr4rTrUrVrWrXrYrZs
             r$�	subscribezBaseAdapterRegistry.subscribe�s4����J�A�4�Q�7�J�K�����H�
���#�#���'�l�e�#��N�N�4�,�,�.�/��'�l�e�#��U�^�
��(��$���	�A����q�!�A��y��%�%�'�� !�
�1�
��J�	� �/�/�
���t�0D�e�L�
�4�������"�"�8�Q�/�!�3�A�'(�D�N�N�8�$��A�v����+�+�H�5����T���1Ks�D:c�V�|j|j||d�xsd}||vr|SdS)Nrvr6)r]r)r"rPrQ�
subscriberrs     r$�
subscribedzBaseAdapterRegistry.subscribed�sC���o�o�������	
��
�	�(�;�6�z�@�D�@r&c#�rK�|j|j�D]\}}}}|D]	}|||f����y�w)aM
        Yields tuples ``(required, provided, value)`` for all the
        subscribers that this object holds.

        These tuples could be passed as the arguments to the
        :meth:`subscribe` method on another adapter registry to
        duplicate the registrations this object holds.

        .. versionadded:: 5.3.0
        N)rlr)r"rPrQ�_namerRr=s      r$�allSubscriptionsz$BaseAdapterRegistry.allSubscriptions�sM����15�0A�0A�$�BS�BS�0T�	.�,�H�h��u��
.����1�-�-�
.�	.�s�57c��t|D�cgc]
}t|���c}�}t|�}|j}|t|�k\ry||}||fz}g}	|D],}
|j	|
�}|�y|	j||
f�|}�.|j	d�}|syt|�}
|�d}n|j
||�}~t|�|
k(ry|r||d<n4|d=t|	�D]\}}
||
}|rn||
=�|r|ds|d=|r|ds�|�[|j|t|�z|
z
}|dk(r)|j|=|jj|�n||j|<|j|�ycc}w)Nrvr6rjr)r;rJrKrrNrLr>rprr1rqr))r"rPrQrRrSrTrUrVrWrrrXrYrs�len_old�newrtrZs                 r$�unsubscribezBaseAdapterRegistry.unsubscribe�s�����J�A�4�Q�7�J�K���H�
���#�#���C��L� ���U�^�
��(��$�����	�A����q�!�A��y���N�N�J��?�+��J�	��n�n�R� �����c�(���=�
�C��+�+�C��7�C�
��s�8�w���� �J�r�N��2��#�G�,�
 ���a���G�����Q��
 ��'�"�+��B�K��'�"�+������x�(�3�s�8�3�g�=�A��A�v��N�N�8�,����.�.�x�8�+,����x�(����T���EKs�E8c��|j�}|j�}d�}||�}||�}|j|j�|D]}|j|��|D]}|j
|��y)aE
        Rebuild (and replace) all the internal data structures of this
        object.

        This is useful, especially for persistent implementations, if
        you suspect an issue with reference counts keeping interfaces
        alive even though they are no longer used.

        It is also useful if you or a subclass change the data types
        (``_mappingType`` and friends) that are to be used.

        This method replaces all internal data structures with new objects;
        it specifically does not re-use any storage.

        .. versionadded:: 5.3.0
        c�|�	t|�}tj|f|�S#t$rtd�cYSwxYw�Nr6)�next�
StopIteration�iter�	itertools�chain)�it�firsts  r$�bufferz+BaseAdapterRegistry.rebuild.<locals>.buffer/s?��
 ��R����?�?�E�8�R�0�0��!�
 ��B�x��
 �s�$�;�;N)rnr}r%r r[rw)r"�
registrationsrr��argss     r$�rebuildzBaseAdapterRegistry.rebuilds���&�-�-�/�
��-�-�/�
�		1��}�-�
��}�-�
�	
�
�
�d�n�n�%�"�	!�D��D�M�M�4� �	!�!�	"�D��D�N�N�D�!�	"r&c��Gd�d�}|S)Nc��eZdZiZy)�2BaseAdapterRegistry.get.<locals>.XXXTwistedFakeOutN)�__name__�
__module__�__qualname__�selfImpliedr6r&r$�XXXTwistedFakeOutr�Qs���Kr&r�r6)r"�_r�s   r$rNzBaseAdapterRegistry.getPs��	�	� � r&�r6�rvr)#r�r�r��__doc__r2rBr%r*�propertyr r�listrr;�_leafSequenceType�dictrMrr9r>r)r[r]r_�classmethodrbrlrnrIrwrzr}r�r�rNr6r&r$rr@s���6�r2�J��K�-�^	��@�B��I�@��M����L��M�4�0L�83�!�F$�,
��@��@�8�$5�.�`�6A�
.�C�J3"�n!r&rc�X��eZdZd�Zd
d�Zd�Zdd�Zdd�Zdd�Zd�fd�	Z	d�Z
d	�Z�xZS)�
LookupBasec�.�i|_i|_i|_yr)�_cache�_mcache�_scacher,s r$r%zLookupBase.__init__[s����������r&c��|jj�|jj�|jj�yr)r��clearr�r�)r"�ignoreds  r$r)zLookupBase.changed`s2�������������������r&c��|jj|�}|�i}||j|<|r|j|�}|�i}|||<|}|Sr)r�rN)r"rQr4�cache�cs     r$�	_getcachezLookupBase._getcacheesY��������)���=��E�$)�D�K�K��!���	�	�$��A��y�����d���E��r&c��t|t�std��|j||�}t	|�}t|�dk(r|j
|dt�}n|j
t	|�t�}|tur8|j|||�}t|�dk(r	|||d<n||t	|�<|�|S|S)NrErAr)	rFrGrHr�r;rKrN�_not_in_mapping�_uncached_lookup�r"rPrQr4�defaultr��results       r$rzLookupBase.lookuprs����$��$��3�4�4����x��.����?���x�=�A���Y�Y�x��{�O�<�F��Y�Y�u�X���@�F��_�$��*�*�8�X�t�D�F��8�}��!�%+��h�q�k�"�)/��e�H�o�&��>��N��
r&c���t|t�std��|j||�}|j	|t
�}|t
ur|j
|f|||�S|�|S|S�NrE)rFrGrHr�rNr�rr�s       r$rzLookupBase.lookup1�sf���$��$��3�4�4����x��.�����8�_�5���_�$��;�;��|�X�t�W�E�E��>��N��
r&c�*�|j||||�Sr)r)r"�objectrQr4r�s     r$rzLookupBase.queryAdapter�s��� � ��6�4��A�Ar&c�0��t|t�std��t|�}|j	||�}|j|t�}|tur|j|f||�}|�(t|t�r|j}||�}|�|S|Sr�)
rFrGrHrr�rNr�r�super�__self__)
r"rQr�r4r�rPr��factoryr��	__class__s
         �r$rzLookupBase.adapter_hook�s�����$��$��3�4�4��f�%�����x��.���)�)�H�o�6���o�%��k�k�8�,��$�?�G����&�%�(������V�_�F��!��
��r&c���|jj|�}|�i}||j|<t|�}|j|t�}|tur|j	||�}|||<|Sr)r�rNr;r��_uncached_lookupAll�r"rPrQr�r�s     r$rzLookupBase.lookupAll�so����� � ��*���=��E�%*�D�L�L��"���?�����8�_�5���_�$��-�-�h��A�F�$�E�(�O��
r&c���|jj|�}|�i}||j|<t|�}|j|t�}|tur|j	||�}|||<|Sr)r�rNr;r��_uncached_subscriptionsr�s     r$rzLookupBase.subscriptions�so����� � ��*���=��E�%*�D�L�L��"���?�����8�_�5���_�$��1�1�(�H�E�F�$�E�(�O��
r&r�rvN)
r�r�r�r%r)r�rrrrrr�
__classcell__�r�s@r$r�r�Xs1����
�
��,�B��$�r&r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�
VerifyingBasec���tj||�|jjdd|_|jD�cgc]}|j
��c}|_ycc}wr@)�LookupBaseFallbackr)�	_registryr�
_verify_rorB�_verify_generations)r"rCrSs   r$r)zVerifyingBase.changed�sI���"�"�4�);�<��.�.�+�+�A�B�/���;?�?�?�#K�a�A�M�M�#K�� ��#Ks�Ac��|jD�cgc]}|j��c}|jk7r|jd�yycc}wr)r�rBr�r)�r"rSs  r$�_verifyzVerifyingBase._verify�s:��$(�O�O�4�q�Q�]�]�4��'�'�
(��L�L���
(��4s�Ac�P�|j�tj|||�Sr)r�r�r�)r"rQr4s   r$r�zVerifyingBase._getcache�s ������!�+�+�D�(�D�A�Ar&c�P�|j�tj|||�Sr)r�r�r�r"rPrQs   r$rzVerifyingBase.lookupAll�s ������!�+�+�D�(�H�E�Er&c�P�|j�tj|||�Sr)r�r�rr�s   r$rzVerifyingBase.subscriptions�s ������!�/�/��h��I�Ir&N)r�r�r�r)r�r�rrr6r&r$r�r��s��L�
�
B�F�Jr&r�c�n��eZdZ�fd�Zd
�fd�	Zd�Zd�Zd�Zd�Zdd�Z	d�fd�	Z
d	�Zd
�Zd�Z
d�Z�xZS)�AdapterLookupBasec�^��||_i|_|j�t�|��yr)r��	_required�init_extendorsr�r%)r"�registryr�s  �r$r%zAdapterLookupBase.__init__�s(���!����������
���r&c����t�|�d�|jj�D]}|�}|��
|j	|��|jj�yr)r�r)r��keysr�r�)r"r�rSr�s   �r$r)zAdapterLookupBase.changed�sU���
��������$�$�&�	$�A���A��}��
�
�d�#�	$�	
�����r&c�j�i|_|jjD]}|j|��yr)�
_extendorsr�rrO)r"�ps  r$r�z AdapterLookupBase.init_extendors
s0��������)�)�	!�A����a� �	!r&c��|j}|jD]`}|j|d�}|D�cgc]}|j|�s�|��c}|gz|D�cgc]}|j|�r�|��c}z||<�bycc}wcc}wr�)r��__iro__rN�isOrExtends)r"rQr�rd�	extendors�es      r$rOzAdapterLookupBase.add_extendors����_�_�
��!�!�	�A�"���q�"�-�I�%�A�q��)=�)=�a�)@��A��
��&�E�q�X�-A�-A�!�-D��E�	F�
�q�M�	��B��Fs�A=�	A=�B�.Bc��|j}|jD]*}|j|d�D�cgc]	}||k7r|��c}||<�,ycc}wr�)r�r�rN)r"rQr�rdr�s     r$rqz!AdapterLookupBase.remove_extendorsR���_�_�
��!�!�	/�A�(2���q�"�(=�/�1� !�X�
��/�J�q�M�	/��/s�Ac��|j}|D]-}|j�}||vs�|j|�d||<�/yr@)r��weakrefrw)r"rP�_refsrS�refs     r$�
_subscribezAdapterLookupBase._subscribe%sB�������	�A��)�)�+�C��%�����D�!���c�
�		r&c	�B�t|�}d}t|�}|jjD]^}|j}|t|�k\r�|j
jj|�}|s�F||}	t|	|||d|�}|��^n|j|�|S�Nr)
r;rKr�rrr1r�rN�_lookupr�)
r"rPrQr4r�rTr�rUr�rVs
          r$r�z"AdapterLookupBase._uncached_lookup-s�����?�����H�
�����)�)�
	�H��(�(�G���G��$�� �*�*�5�5�9�9�(�C�I��� ���J��Z��9�d�A�"�$�F��!��
	�	�����"��
r&c	����|j|D�cgc]
}t|���c}||�}|�|S||D�cgc] }t|t�r|jn|��"c}�}|�|S|Scc}wcc}wr)rrrFr�r�)	r"�objectsrQr4r��or�r�r�s	        �r$rz#AdapterLookupBase.queryMultiAdapterDso����+�+�g�>��z�!�}�>��$�O���?��N��g�V���A�u�)=�1�:�:�1�D�V�W���>��N��
��?��Ws
�A%�%A*c	�z�t|�}t|�}i}t|jj�D]Z}|j
}|t|�k\r�|jjj|�}|s�F||}t||||d|��\|j|�t|j��Sr�)r;rKrpr�rrr1r�rN�
_lookupAllr�ra)	r"rPrQrTr�r�rUr�rVs	         r$r�z%AdapterLookupBase._uncached_lookupAllOs�����?���H�
���� ����!2�!2�3�	J�H��(�(�G���G��$�� �*�*�5�5�9�9�(�C�I��� ���J��z�8�Y���5�I�	J�	�����"��V�\�\�^�$�$r&c�R�|j||�D�cgc]}|d��	c}Scc}wr�)r)r"rPrQr�s    r$rzAdapterLookupBase.namesas%��"�n�n�X�x�@�A���!��A�A��As�$c
�V�t|�}t|�}g}t|jj�D]_}|j
}|t|�k\r�|�|f}n(|jjj|�}|��Lt||||d|d|��a|j|�|S)Nrvr)r;rKrpr�rrr1r�rN�_subscriptionsr�)r"rPrQrTr�r�rUr�s        r$r�z)AdapterLookupBase._uncached_subscriptionsds�����?���H�
���� ����!2�!2�3�
	-�H��+�+�G���G��$����%�L�	�$�.�.�9�9�=�=�h�G�	��$���7�5�>�8�Y��!�1�e�
-�
	-�	�����"��
r&c���|j|D�cgc]
}t|���c}|�}|�d}|D]}||��	|Sg}|D]}||�}|��|j|��|Scc}wr�)rrrL)r"r�rQr�rr��subscriptionrys        r$rzAdapterLookupBase.subscribers{s����*�*�7�+K�a�J�q�M�+K�X�V�
����F� -�
'���g�&�
'��
��F� -�
.��)�7�3�
��)��M�M�*�-�
.��
��,Ls�A rr�r�)r�r�r�r%r)r�rOrqr�r�rr�rr�rr�r�s@r$r�r��s@�����>!�

�/���.	�%�$B��.r&r�c��eZdZy)�
AdapterLookupN�r�r�r�r6r&r$r�r�����r&r�c�H��eZdZdZeZd�fd�	Zd�Zd�Z�fd�Z	�fd�Z
�xZS)rza
    A full implementation of ``IAdapterRegistry`` that adds support for
    sub-registries.
    c�V��tj�|_t�|�|�yr)r��WeakKeyDictionary�_v_subregistriesr�r%)r"r#r�s  �r$r%zAdapterRegistry.__init__�s#���!(� 9� 9� ;���
����r&c�"�d|j|<yr@�r�r�s  r$�_addSubregistryzAdapterRegistry._addSubregistry�s��#$����a� r&c�<�||jvr|j|=yyrr�r�s  r$�_removeSubregistryz"AdapterRegistry._removeSubregistry�s#����%�%�%��%�%�a�(�&r&c����|jjdd�}|D]}||vs�|j|��|D]}||vs�|j|��t�|�|�y)Nr r6)r(rNrrr�r*)r"r#rsrSr�s    �r$r*zAdapterRegistry._setBases�sr����m�m����R�0���	+�A���~��$�$�T�*�	+��	(�A���|��!�!�$�'�	(�	���%� r&c���t�|�|�|jj�D]}|j|��yr)r�r)r�r�)r"rC�subr�s   �r$r)zAdapterRegistry.changed�s;���
���*�+��(�(�-�-�/�	,�C��K�K�*�+�	,r&r�)r�r�r�r�r�r0r%rrr*r)r�r�s@r$rr�s-����
 �K� �%�)�	!�,�,r&c��eZdZy)�VerifyingAdapterLookupNr�r6r&r$rr�r�r&rc��eZdZdZeZy)rz2
    The most commonly-used adapter registry.
    N)r�r�r�r�rr0r6r&r$rr�s���)�Kr&c��|�tS|Srr)�xs r$rJrJ�s���y����r&c	���|j}||kr9||jD]&}||�}|s�t|||||dz|�}	|	��$|	cSy|D]$}
||
�}|s�|j|�}	|	��"|	cSyr@)rN�__sro__r�)rV�specsrQr4rd�l�components_get�spec�compsrS�ifaces           r$r�r��s���
 �^�^�N��1�u��!�H�$�$�	�D�"�4�(�E���E�5�(�D�!�A�#�q�A���=��H�	���	�E�"�5�)�E���I�I�d�O���=��H�	�r&c	��|j}||kr<t||j�D] }||�}|s�t|||||dz|��"yt|�D]}	||	�}|s�|j	|�� yr@)rNrprr��update)
rVr
rQr�rdrrrrrs
          r$r�r��s����^�^�N��1�u��U�1�X�-�-�.�	C�D�"�4�(�E���5�%��6�1�Q�3��B�	C�
�h�'�	%�E�"�5�)�E���
�
�e�$�	%r&c
� �|j}||kr=t||j�D]!}||�}	|	s�t|	|||||dz|��#yt|�D]2}
||
�}	|	s�|	j|�}	|	s�"|j	|	��4yr@)rNrprr��extend)rVr
rQr4r�rdrrrrrs           r$r�r��s����^�^�N��1�u��U�1�X�-�-�.�	M�D�"�4�(�E���u�e�X�t�V�Q�q�S�!�L�	M�
�h�'�	)�E�"�5�)�E���	�	�$�����M�M�%�(�	)r&)r�r�r��zope.interfacerrrr�zope.interface.interfacesr�zope.interface._compatr	r
�__all__rr�r�r�r�r�r�r�rrrrJr�r�r�r6r&r$�<module>rs	�����&�%�$��6�2�.�����HS!�S!�l�(���l�l�
�l�^
�J�&�J�
�J�:a�a�F	�%�z�	�
�
��%,�)�%,��%,�P	�.�
�	�
�
��)�2�)��)���.%�
)r&

Zerion Mini Shell 1.0