HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/zope/interface/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/zope/interface/__pycache__/declarations.cpython-311.pyc
�

JDvc1���2�dZdZddlZddlmZddlmZddlmZddlZddlm	Z	ddl
mZdd	l
mZdd
l
m
Z
ddl
mZddl
mZdd
lmZddlmZddlmZgZiZdZdZd�ZGd�de��ZGd�de��ZGd�de��ZGd�dee��Zd�Zd�Z ed���Z!d�Z"d�Z#d �Z$dBd"�Z%d#�Z&Gd$�d%e��Z'Gd&�d'e��Z(d(�Z)d)�Z*d*�Z+Gd+�d,e��Z,e,Z-ej.��Z/d-�Z,d.e,_0d/�Z1d0�Z2d1�Z3eGd2�d3e
����Z4Gd4�d5ee4��Z5d6�Z6d7�Z7d8�Z8Gd9�d:e��Z9d;�Z:d<�Z;ed=���Z<ed>���Z=eGd?�d@e����Z>dCdA�Z?e��Z@e>��ZAdS)Da�Implementation of interface declarations

There are three flavors of declarations:

  - Declarations are used to simply name declared interfaces.

  - ImplementsDeclarations are used to express the interfaces that a
    class implements (that instances of the class provides).

    Implements specifications support inheriting interfaces.

  - ProvidesDeclarations are used to express interfaces directly
    provided by objects.

�restructuredtext�N)�FunctionType)�
MethodType)�
ModuleType)�addClassAdvisor)�	Interface)�InterfaceClass)�SpecificationBase)�
Specification)�NameAndModuleComparisonMixin)�CLASS_TYPES)�PYTHON3)�_use_c_implzIClass advice impossible in Python3.  Use the @%s class decorator instead.z\The %s API is deprecated, and will not work in Python3  Use the @%s class decorator instead.c�l�|j}|j}|j}||�|��dz}|S)N�)�__self_class__�
__thisclass__�__mro__�index)�ob�
self_class�class_that_invoked_super�complete_mro�
next_classs     �=/usr/lib/python3/dist-packages/zope/interface/declarations.py�_next_super_classr=sA���"�J�!�/���%�L��l�0�0�1I�J�J�Q�N�O�J���c��eZdZd�Zd�ZdS)�namedc��||_dS�N)�name)�selfr"s  r�__init__znamed.__init__Is
����	�	�	rc��|j|_|Sr!)r"�__component_name__�r#rs  r�__call__znamed.__call__Ls�� $�	����	rN)�__name__�
__module__�__qualname__r$r(�rrrrGs2�������������rrc�j�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
e
Zed	���Z
ed
���ZdS)�DeclarationzInterface declarationsr,c�J�tj|t|����dSr!)rr$�_normalizeargs)r#�basess  rr$zDeclaration.__init__Vs#����t�^�E�%:�%:�;�;�;�;�;rc�X�|�|��o||���vS)z:Test whether an interface is in the specification
        )�extends�
interfaces)r#�	interfaces  r�__contains__zDeclaration.__contains__Ys*���|�|�I�&�&�I�9����8I�8I�+I�Irc�*�|���S)zCReturn an iterator for the interfaces in the specification
        �r4�r#s r�__iter__zDeclaration.__iter___s����� � � rc�*�t|j��S)zCReturn an iterator of all included and extended interfaces
        )�iter�__iro__r9s r�	flattenedzDeclaration.flattenedds���D�L�!�!�!rc�R��t�fd�|���D���S)z/Remove interfaces from a specification
        c�V���g|]$��fd�����D���"���%S)c�@��g|]}��|d���|��S)r�r3)�.0�j�is  �r�
<listcomp>z2Declaration.__sub__.<locals>.<listcomp>.<listcomp>ns;��������9�9�Q��?�?�����rr8)rCrE�others @�rrFz'Declaration.__sub__.<locals>.<listcomp>ls_����
�
�
�������)�)�+�+����
�
�
�
�
r)r.r4)r#rGs `r�__sub__zDeclaration.__sub__isB����
�
�
�
����(�(�
�
�
��	rc�n��g}t|�����}t|��}|���D]b��|vr�|����t	�fd�|D����r|�����M|�����ct
||z�S)a�
        Add two specifications or a specification and an interface
        and produce a new declaration.

        .. versionchanged:: 5.4.0
           Now tries to preserve a consistent resolution order. Interfaces
           being added to this object are added to the front of the resulting resolution
           order if they already extend an interface in this object. Previously,
           they were always added to the end of the order, which easily resulted in
           invalid orders.
        c3�B�K�|]}��|��V��dSr!rB)rC�xrEs  �r�	<genexpr>z&Declaration.__add__.<locals>.<genexpr>�s-�����0�0�A�1�9�9�Q�<�<�0�0�0�0�0�0r)�listr4�set�add�any�appendr.)r#rG�before�result�seenrEs     @r�__add__zDeclaration.__add__us�������d�o�o�'�'�(�(���6�{�{���!�!�#�#�		!�		!�A��D�y�y���H�H�Q�K�K�K��0�0�0�0��0�0�0�0�0�
!��
�
�a� � � � ��
�
�a� � � � ��V�f�_�.�.rc�d��t|���t�fd�|D����}|�fzS)Nc�>��g|]}��|���|��Sr,)�isOrExtends)rC�iface�implemented_by_clss  �rrFz6Declaration._add_interfaces_to_cls.<locals>.<listcomp>�s=���
�
�
��%�1�1�%�8�8�
��
�
�
r)�
implementedBy�tuple)r4�clsrZs  @r�_add_interfaces_to_clsz"Declaration._add_interfaces_to_cls�sY���
+�3�/�/���
�
�
�
�#�
�
�
���
�
�/�1�1�1rc���g}t��}|D]�}t}t|t��r|j}t
}nYt|t��r|j}t}n5t|t��r|j	s
|j
|vr�wt|��}||v}|�|��|r||��}|�|����d�
|��S)N�, )rN�repr�
isinstancer	r)�str�type�_implements_name�
Implements�declared�inheritrOrQ�join)r4�
ordered_names�namesrY�duplicate_transform�	this_name�already_seens       r�_argument_names_for_reprz$Declaration._argument_names_for_repr�s��
�
������	,�	,�E�"&���%��0�0�
(�"�N�	�&)�#�#��E�4�(�(�

(�"�N�	�&6�#�#��U�J�/�/�
(��.�
(��m�z�1�1�� ��K�K�	�$��-�L��I�I�i� � � ��
7�/�/��6�6�	�� � ��+�+�+�+��y�y��'�'�'rN)r)r*r+�__doc__�	__slots__r$r6r:r>rHrU�__radd__�staticmethodr^ror,rrr.r.Qs������� � ��I�<�<�<�J�J�J�!�!�!�
"�"�"�

�
�
�/�/�/�<�H��
2�
2��\�
2��"(�"(��\�"(�"(�"(rr.c���eZdZdZdZd�Zd�Zed���Zej	d���Zed���Z
d�xZxZZ
d	�Zdd�Zdd�Zdd
�Zed���Zej	d���ZdS)�_ImmutableDeclarationr,Nc�z�tj�$t�|��t_tjSr!)ru�_ImmutableDeclaration__instance�object�__new__)r]s rryz_ImmutableDeclaration.__new__�s)�� �+�3�/5�~�~�c�/B�/B�!�,�$�/�/rc��dS)N�_emptyr,r9s r�
__reduce__z _ImmutableDeclaration.__reduce__�s���xrc��dS�Nr,r,r9s r�	__bases__z_ImmutableDeclaration.__bases__�s���rrc�0�|dkrtd���dS)Nr,z7Cannot set non-empty bases on shared empty Declaration.)�	TypeError)r#�	new_basess  rrz_ImmutableDeclaration.__bases__�s#����?�?��U�V�V�V��?rc��iSr!r,r9s r�
dependentsz _ImmutableDeclaration.dependents�s���	rc��dSr!r,)r#�_ignoreds  r�<lambda>z_ImmutableDeclaration.<lambda>�s��t�rc� �td��Sr~)r<r9s rr4z _ImmutableDeclaration.interfaces�s
���B�x�x�rTc��||juSr!)�_ROOT)r#r5�stricts   rr3z_ImmutableDeclaration.extends�s���D�J�&�&rc��|Sr!r,)r#r"�defaults   r�getz_ImmutableDeclaration.get�s���rc��tSr!)ru)r#�callbacks  r�weakrefz_ImmutableDeclaration.weakref�s
��%�$rc��iSr!r,r9s r�_v_attrsz_ImmutableDeclaration._v_attrss	���	rc��dSr!r,)r#�	new_attrss  rr�z_ImmutableDeclaration._v_attrss���r)Tr!)r)r*r+rqrwryr|�propertyr�setterr��changed�	subscribe�unsubscriber4r3r�r�r�r,rrruru�s.�������I��J�0�0�0�
�������X����W�W���W�����X��)D�(C�C�G�C�i�+����'�'�'�'�����%�%�%�%�����X���_�
�
��_�
�
�
rruc�P��eZdZdZdZdZdZed���Z�fd�Zd�Z	d�Z
�xZS)rfNr,�?c�R�|�|��}||_|j|�|Sr!)ryr)r$)r]r"r1�insts    rrzImplements.namedAs0���{�{�3������
���
�u����rc�|��	|`n#t$rYnwxYwtt|���|��Sr!)�_super_cache�AttributeError�superrfr�)r#�originally_changed�	__class__s  �rr�zImplements.changedMsP���	��!�!���	�	�	��D�	�����Z��&�&�.�.�/A�B�B�Bs��
�c���|jr+t|jdd��pt|j��}n|j}|�|j��}|rd|z}d|�|�d�S)Nr)r`zclassImplements(�))rh�getattrrer)rorg)r#r"�declared_namess   r�__repr__zImplements.__repr__Tsq���<�	!��4�<��T�:�:�\�>N�t�|�>\�>\�D�D��=�D��6�6�t�}�E�E���	3�!�N�2�N��*.�$����?�?rc� �t|jffSr!)r[rhr9s rr|zImplements.__reduce__^s���t�|�.�.�.r)r)r*r+rhrgr��classmethodrr�r�r|�
__classcell__)r�s@rrfrfs��������2�G��H��L��H��	�	��[�	�C�C�C�C�C�@�@�@�/�/�/�/�/�/�/rrfc�V�t|dd��pddzt|dd��pdzS)Nr*r��.r))r�)rs rrerebs>��
�B��c�*�*�1�c����r�:�s�+�+�2�s�4�4rc���t|j��}|j}|�tj��x}|_|j}	||S#t$rYnwxYwt|��}t|��}|jj}|�	|��}||d�}d�|D��}	tj|jdz|jzg|	�R�}
|j
|
_
|j|
_|
||<|
S)Nc�,�g|]}t|����Sr,�r[�rC�cs  rrFz(_implementedBy_super.<locals>.<listcomp>�s ��;�;�;�a��q�!�!�;�;�;r�:)r[rr�r��WeakKeyDictionaryr�KeyErrorrrrrfrr)rhrg)�sup�implemented_by_self�cache�key�next_cls�implemented_by_next�mro�ix_next_cls�classes_to_keepr��news           r�_implementedBy_superr�os%��(��(:�;�;���,�E��}�3:�3L�3N�3N�N��#�0�

�
�C�
��S�z����
�
�
���
����!��%�%�H�
(��1�1��

�
�
$�C��)�)�H�%�%�K��+�,�,�'�O�;�;�?�;�;�;�I�
�
��$�s�*�-@�-I�I��	����C�&�-�C�K�&�/�C�L��E�#�J��Js�A�
A�Ac
�|�	t|t��rt|��S|j�d��}nw#t
$rjt
|dd��}|�)t�|��}|�|cYStcYS|j	tkr|cYStt|f���cYSwxYwt|t��r|S|�t�|��}|�|St|��}|�,|f}tj|gt|���R�}d|_|`n]	|j}n1#t
$r$t%|��st'd|���d}YnwxYwtj|gd�|D���R�}||_	||_t)|d��st*|_t|t.��r:d|jvr1t1|t
|dt3|������|_n?#t&$r2t|t2��st'd	|���|t|<YnwxYw|S)
z�Return the interfaces implemented for a class' instances

      The value returned is an `~zope.interface.interfaces.IDeclaration`.
    �__implemented__Nz$ImplementedBy called for non-factoryr,c�,�g|]}t|����Sr,r�r�s  rrFz!implementedBy.<locals>.<listcomp>�s ��,M�,M�,M�!�]�1�-=�-=�,M�,M�,Mr�__providedBy__�__provides__r�z!ImplementedBy called for non-type)rbr�r��__dict__r�r�r��#BuiltinImplementationSpecificationsr{r�rfr.r0rerrhr�r�callabler��hasattr�objectSpecificationDescriptorr��DescriptorAwareMetaClasses�
ClassProvidesrdr�)r]�spec�	spec_namer1s    rr[r[�s���#6��c�5�!�!�	-�(��,�,�,��|��� 1�2�2�����6�6�6��s�-�t�4�4���<�6�:�:�3�?�?�D��������M�M�M��>�Z�'�'��K�K�K�
�N�D�8�4�4�5�5�5�5�96����<�$�
�#�#�����|�2�6�6�s�;�;�����K�!��%�%�I����x����	�A�N�4�,@�,@�A�A�A��������	��M�E�E���	�	�	��C�=�=�
M�� F��L�L�L��E�E�E�	����
��	�N�,M�,M�u�,M�,M�,M�N�N�N�����8�"����s�,�-�-�	?�!>�C���s�6�7�7�	�"�#�,�6�6�,����[�$�s�)�)�4�4� � �C����
�8�8�8��#�t�$�$�	F��?��E�E�E�37�+�C�0�0�0�8����
�KsM�#A�A�;B5�>B5�B5�B5�4B5�-D5�5+E#�"E#�
A2G=�=9H9�8H9c�p�t|��}d|_d|_d|_t	||d��dS)a
    Declare the only interfaces implemented by instances of a class

    The arguments after the class are one or more interfaces or interface
    specifications (`~zope.interface.interfaces.IDeclaration` objects).

    The interfaces given (including the interfaces in the specifications)
    replace any previous declarations, *including* inherited definitions. If you
    wish to preserve inherited declarations, you can pass ``implementedBy(cls)``
    in *interfaces*. This can be used to alter the interface resolution order.
    r,N)r[rgrhr�_classImplements_ordered)r]r4r�s   r�classImplementsOnlyr��s@������D�
�D�M��D�L��D�N��T�:�r�2�2�2�2�2rc�Z�t|��}tt|����}g}g}|D]M}|jD].}|�|��r|�|��n�/|�|���Nt
|t|��t|����dS)aN
    Declare additional interfaces implemented for instances of a class

    The arguments after the class are one or more interfaces or
    interface specifications (`~zope.interface.interfaces.IDeclaration` objects).

    The interfaces given (including the interfaces in the specifications)
    are added to any interfaces previously declared. An effort is made to
    keep a consistent C3 resolution order, but this cannot be guaranteed.

    .. versionchanged:: 5.0.0
       Each individual interface in *interfaces* may be added to either the
       beginning or end of the list of interfaces declared for *cls*,
       based on inheritance, in order to try to maintain a consistent
       resolution order. Previously, all interfaces were added to the end.
    .. versionchanged:: 5.1.0
       If *cls* is already declared to implement an interface (or derived interface)
       in *interfaces* through inheritance, the interface is ignored. Previously, it
       would redundantly be made direct base of *cls*, which often produced inconsistent
       interface resolution orders. Now, the order will be consistent, but may change.
       Also, if the ``__bases__`` of the *cls* are later changed, the *cls* will no
       longer be considered to implement such an interface (changing the ``__bases__`` of *cls*
       has never been supported).
    N)r[r\r0rgr3rQr�)r]r4r�rR�afterrY�bs       r�classImplementsr�s���2����D��~�j�1�1�2�2�J�
�F��E�
� � ����	 �	 �A��}�}�Q���
��
�
�e�$�$�$���
�
�L�L�������T�5��=�=�%��,�,�?�?�?�?�?rc�H�t|��}t||fd��dS)a-
    Declare that instances of *cls* additionally provide *iface*.

    The second argument is an interface or interface specification.
    It is added as the highest priority (first in the IRO) interface;
    no attempt is made to keep a consistent resolution order.

    .. versionadded:: 5.0.0
    r,N)r[r�)r]rYr�s   r�classImplementsFirstr�<s+������D��T�E�8�R�0�0�0�0�0rr,c�����fd�|D��}�fd�|D��}g}t��}|�j|fD]5}|D]0}||vr*|�|��|�|���1�6t	|���_|}�j�L�jjD]?}t|��}||vr*|�|��|�|���@t	|���_dS)Nc�^��g|])}��|��r|tu� �j�'|��*Sr,�rXrrg�rCrKr�s  �rrFz,_classImplements_ordered.<locals>.<listcomp>PsH������
�����"�"��()�I�~�~�d�m�~�	
�'5�~�~rc�^��g|])}��|��r|tu� �j�'|��*Sr,r�r�s  �rrFz,_classImplements_ordered.<locals>.<listcomp>UsH���
�
�
�
�����"�"�
�()�I�~�~�d�m�~�	
�'5�~�~r)rNrgrQrOr\rhrr[)	r�rRr��new_declaredrT�lr�r1r�s	`        rr�r�Js6�����������F�

�
�
�
��
�
�
�E��L��5�5�D�
�T�]�E�
)�����	�	�A���}�}��#�#�A�&�&�&���������	�
�,�'�'�D�M�
�E��|����'�	 �	 �A��a� � �A���}�}�����������Q������5�\�\�D�N�N�Nrc�<�|jd\}}|`||g|�R�|S)N�__implements_advice_data__)r�r�)r]r4�do_classImplementss   r�_implements_advicer�ss9��%(�\�2N�%O�"�J�"��&���s�(�Z�(�(�(�(��Jrc�"�eZdZdZdZd�Zd�ZdS)�implementera�
    Declare the interfaces implemented by instances of a class.

    This function is called as a class decorator.

    The arguments are one or more interfaces or interface
    specifications (`~zope.interface.interfaces.IDeclaration`
    objects).

    The interfaces given (including the interfaces in the
    specifications) are added to any interfaces previously declared,
    unless the interface is already implemented.

    Previous declarations include declarations for base classes unless
    implementsOnly was used.

    This function is provided for convenience. It provides a more
    convenient way to call `classImplements`. For example::

        @implementer(I1)
        class C(object):
            pass

    is equivalent to calling::

        classImplements(C, I1)

    after the class has been created.

    .. seealso:: `classImplements`
       The change history provided there applies to this function too.
    r8c��||_dSr!r8�r#r4s  rr$zimplementer.__init__��
��$����rc���t|t��rt|g|j�R�|St	|��}tj|g|j�R�}	||_n#t$rtd|���wxYw|S)NzCan't declare implements)
rbr�r�r4rerfrr�r�r�)r#rr�r�s    rr(zimplementer.__call__�s����b�4�5�5�	�
�B�1���1�1�1�1��I�$�R�(�(�	���	�<�D�O�<�<�<��	<�!%�B�����	<�	<�	<��6��;�;�;�	<�����	s�A�A4N)r)r*r+rprqr$r(r,rrr�r�zsD��������@ �I�%�%�%�
�
�
�
�
rr�c��eZdZdZd�Zd�ZdS)�implementer_onlya�Declare the only interfaces implemented by instances of a class

      This function is called as a class decorator.

      The arguments are one or more interfaces or interface
      specifications (`~zope.interface.interfaces.IDeclaration` objects).

      Previous declarations including declarations for base classes
      are overridden.

      This function is provided for convenience. It provides a more
      convenient way to call `classImplementsOnly`. For example::

        @implementer_only(I1)
        class C(object): pass

      is equivalent to calling::

        classImplementsOnly(I1)

      after the class has been created.
      c��||_dSr!r8r�s  rr$zimplementer_only.__init__�r�rc��t|ttf��rtd���t	|g|j�R�|S)NzIThe implementer_only decorator is not supported for methods or functions.)rbrr�
ValueErrorr�r4r's  rr(zimplementer_only.__call__�sV���b�<��4�5�5�	D��C�D�D�
D�	�B�1���1�1�1�1��	rN�r)r*r+rpr$r(r,rrr�r��s<������
�
�.%�%�%�
�
�
�
�
rr�c���tjd��}|j}||jusd|vrt	|dz���d|vrt	|dz���||f|d<ttd���dS)N�r*z* can be used only from a class definition.r�z- can be used only once in a class definition.���depth)�sys�	_getframe�f_locals�	f_globalsr�rr�)r"r4r��frame�localss     r�_implementsr��s���
�M�!���E�
�^�F�
��� � �L��$>�$>���I�I�J�J�J�#�v�-�-���L�L�M�M�M�+5�7I�+I�F�'�(��&�a�0�0�0�0�0�0rc�n�trttdz���td|t��dS)ac
    Declare interfaces implemented by instances of a class.

    .. deprecated:: 5.0
        This only works for Python 2. The `implementer` decorator
        is preferred for all versions.

    This function is called in a class definition.

    The arguments are one or more interfaces or interface
    specifications (`~zope.interface.interfaces.IDeclaration`
    objects).

    The interfaces given (including the interfaces in the
    specifications) are added to any interfaces previously declared.

    Previous declarations include declarations for base classes unless
    `implementsOnly` was used.

    This function is provided for convenience. It provides a more
    convenient way to call `classImplements`. For example::

        implements(I1)

    is equivalent to calling::

        classImplements(C, I1)

    after the class has been created.
    r��
implementsN)rr��
_ADVICE_ERRORr�r�r8s rr�r��s8��B�7��
�
�5�6�6�6���j�/�:�:�:�:�:rc�n�trttdz���td|t��dS)akDeclare the only interfaces implemented by instances of a class

      This function is called in a class definition.

      The arguments are one or more interfaces or interface
      specifications (`~zope.interface.interfaces.IDeclaration` objects).

      Previous declarations including declarations for base classes
      are overridden.

      This function is provided for convenience. It provides a more
      convenient way to call `classImplementsOnly`. For example::

        implementsOnly(I1)

      is equivalent to calling::

        classImplementsOnly(I1)

      after the class has been created.
    r��implementsOnlyN)rr�r�r�r�r8s rrr
s:��0�<��
�(:�:�;�;�;�� �*�.A�B�B�B�B�Brc�2�eZdZdZd�ZdZd�Zd�ZdZd�ZdS)	�Providesz�Implement ``__provides__``, the instance-specific specification

    When an object is pickled, we pickle the interfaces that it implements.
    c�v�|f|z|_||_tj|g|�||���R�dSr!)�_Provides__args�_clsr.r$r^)r#r]r4s   rr$zProvides.__init__3sF���g�
�*�����	���T�Q�D�$?�$?�
�C�$P�$P�Q�Q�Q�Q�Q�Qrr,c��d}|jtur|jrd}|jdd�}nd}|jf|jz}|�|��}|r-|j}t
|��dkrd|dz}|�d�|z}|�d|�d	�S)
N�directlyProvidesTrFzsys.modules[%r]rr`�(r�)rr�_v_module_namesrrro�len)r#�
function_name�providing_on_moduler4rj�	mod_namess      rr�zProvides.__repr__;s���+�
��9�
�"�"�t�';�"�"&����Q�R�R��J�J�"'���)����6�J��5�5�j�A�A�
��	��,�I��9�~�~��"�"�-�	�!��<�	�#�)�)�%���M�
�M�M��M�M�
�	
rc��t|jfSr!)rrr9s rr|zProvides.__reduce__[s�����$�$rzzope.interfacec�:�|�||jur|Std���)zHMake sure that a class __provides__ doesn't leak to an instance
        Nr�)rr��r#r�r]s   r�__get__zProvides.__get__bs*���<�C�4�9�,�,��K��^�,�,�,rN)	r)r*r+rpr$r	r�r|rr,rrrr-sl��������
R�R�R��O�
�
�
�@%�%�%�
"�J�	-�	-�	-�	-�	-rrc�d�t�|��}|�t|�}|t|<|S)z�Cache instance declarations

      Instance declarations are shared among instances that have the same
      declaration. The declarations are cached in a weak value dictionary.
    )�InstanceDeclarationsr��
ProvidesClass)r4r�s  rrrss6�� �#�#�J�/�/�D��|��j�)��+/��Z�(��KrTc���t|dd��}|�7t|dd��|ur$t|t��std���t	|��}|�t|��}d}tD]}t
||��rd}n�|rt||g|�R�|_dSt|g|�R�x}|_t
|t��r(t|d��r|xj|j
fz
c_dSdSdS)aYDeclare interfaces declared directly for an object

      The arguments after the object are one or more interfaces or interface
      specifications (`~zope.interface.interfaces.IDeclaration` objects).

      The interfaces given (including the interfaces in the specifications)
      replace interfaces previously declared for the object.
    r�NzHAttempt to make an interface declaration on a non-descriptor-aware classFTr))r�rbr�r�r0rd�
issubclassr�r�rrr�r	r))rxr4r]�issub�damc�providess      rrr�sS���&�+�t�
,�
,�C�
��7�3��T�:�:�c�A�A��&�4�6�6�	:��9�:�:�
:� �
�+�+�J�
�{��6�l�l���E�*�����c�4� � �	��E��E�	�
�;�,�F�C�E�*�E�E�E�����)1�#�)C�
�)C�)C�)C�C��6�&��c�:�&�&�	;�7�6�:�+F�+F�	;��$�$���(:�:�$�$�$�$�	;�	;�	;�	;rc�<�t|t|��g|�R�dS)aZDeclare interfaces declared directly for an object

    The arguments after the object are one or more interfaces or interface
    specifications (`~zope.interface.interfaces.IDeclaration` objects).

    The interfaces given (including the interfaces in the specifications) are
    added to the interfaces previously declared for the object.
    N)r�directlyProvidedBy)rxr4s  r�alsoProvidesr�s+���V�/��7�7�E�*�E�E�E�E�E�Erc��t|t|��|z
��|�|��rtd���dS)z; Removes a directly provided interface from an object.
    z-Can only remove directly provided interfaces.N)rr�
providedByr�)rxr5s  r�noLongerProvidesr�sT���V�/��7�7�)�C�D�D�D����F�#�#�J��H�I�I�I�J�Jrc��eZdZdZd�ZdS)�ClassProvidesBase)rr�c�H�||jur|�|S|jStd����Nr�)rr�r�rs   rrzClassProvidesBase.__get__�s6���$�)����|����#�#��^�,�,�,rN)r)r*r+rqrr,rrr!r!�s*�������I�

-�
-�
-�
-�
-rr!c�6�eZdZdZdZd�Zd�Zd�Zej	Z	dS)r�z�Special descriptor for class ``__provides__``

    The descriptor caches the implementedBy info, so that
    we can get declarations for objects without instance-specific
    interfaces a bit quicker.
    )�__argsc��||_t|��|_||f|z|_t	j|g|�||���R�dSr!)rr[r��_ClassProvides__argsr.r$r^)r#r]�metaclsr4s    rr$zClassProvides.__init__�sY����	�(��-�-����G�&��3�����T�U�D�$?�$?�
�G�$T�$T�U�U�U�U�U�Urc�h�|jf|jdd�z}|�|��}d|�d�S)Nr�zdirectlyProvides(r�)rr'ro)r#r4rjs   rr�zClassProvides.__repr__�s>���i�]�T�[����_�4�
��5�5�j�A�A�
�
�)6���8�8rc��|j|jfSr!)r�r'r9s rr|zClassProvides.__reduce__�s���~�t�{�*�*rN)
r)r*r+rprqr$r�r|r!rr,rrr�r��sY���������I�V�V�V�
9�
9�
9�+�+�+� �'�G�G�Grr�c��t|dd��}|�t|t��rtSt	|jdd���S)z�Return the interfaces directly provided by the given object

    The value returned is an `~zope.interface.interfaces.IDeclaration`.
    r�N���)r�rbrfr{r.r)rxrs  rrr�sR��
�v�~�t�4�4�H����(�J�/�/�	
��
��x�)�#�2�#�.�/�/�/rc�&�trttdz���tjd��}|j}||jusd|vrtd���d|vrtd���t|��|d<ttd���d	S)
a�Declare interfaces provided directly by a class

      This function is called in a class definition.

      The arguments are one or more interfaces or interface specifications
      (`~zope.interface.interfaces.IDeclaration` objects).

      The given interfaces (including the interfaces in the specifications)
      are used to create the class's direct-object interface specification.
      An error will be raised if the module class has an direct interface
      specification. In other words, it is an error to call this function more
      than once in a class definition.

      Note that the given interfaces have nothing to do with the interfaces
      implemented by instances of the class.

      This function is provided for convenience. It provides a more convenient
      way to call `directlyProvides` for a class. For example::

        classProvides(I1)

      is equivalent to calling::

        directlyProvides(theclass, I1)

      after the class has been created.
    �providerrr*z7classProvides can be used only from a class definition.r�z:classProvides can only be used once in a class definition.r�r�N)
rr�r�r�r�r�r�r0r�_classProvides_advice)r4r�r�s   r�
classProvidesr0s���>�4��
�
�2�3�3�3��M�!���E�
�^�F�	�%�/�!�!�|�6�'A�'A��,�-�-�	-������H�J�J�	J�,�J�7�7�F�>���)��3�3�3�3�3�3rc�>�|jd}|`t|g|�R�|Sr#)r�r�r)r]r4s  rr/r/Ds1����n�-�J����S�&�:�&�&�&�&��Jrc��eZdZdZd�Zd�ZdS)r.z(Class decorator version of classProvidesc��||_dSr!r8r�s  rr$zprovider.__init__Pr�rc�*�t|g|j�R�|Sr!)rr4r's  rr(zprovider.__call__Ss����.�d�o�.�.�.�.��	rNr�r,rrr.r.Ms8������2�2�%�%�%�����rr.c��tjd��}|j}||jusd|vrt	d���d|vrt	d���ttgt|���R�x}|d<|xj|dfz
c_dS)aDeclare interfaces provided by a module

    This function is used in a module definition.

    The arguments are one or more interfaces or interface specifications
    (`~zope.interface.interfaces.IDeclaration` objects).

    The given interfaces (including the interfaces in the specifications) are
    used to create the module's direct-object interface specification.  An
    error will be raised if the module already has an interface specification.
    In other words, it is an error to call this function more than once in a
    module definition.

    This function is provided for convenience. It provides a more convenient
    way to call directlyProvides. For example::

      moduleProvides(I1)

    is equivalent to::

      directlyProvides(sys.modules[__name__], I1)
    rr)z9moduleProvides can only be used from a module definition.r�z<moduleProvides can only be used once in a module definition.N)	r�r�r�r�r�rrr0r	)r4r�r��ps    r�moduleProvidesr7Xs���.
�M�!���E�
�^�F�	�e�o�%�%�:�V�+C�+C��G�I�I�	I������J�L�L�	L�"*�*�"G�+9�*�+E�+E�"G�"G�"G�G�A��~�����&��,�.�.����rc�"�t||��S)zfProvide object specifications

    These combine information for the object and for it's classes.
    )r)�directr]s  r�ObjectSpecificationr:�s��
�C�� � � rc���	|j}n#t$rd}YnwxYw|�t|t��r|S	|j}n#t$r
t
cYSwxYwt
|��Sr!)r�r�rbr
r�r{r[)rrr]s   r�getObjectSpecificationr<�s�����?�������������������h� 1�2�2�	��O���l���������
�
�
���������s�
���>�A�Ac��	t|t��rt|��S|j}n#t$rt|��cYSwxYw	|jn{#t$rn	|j}n&#t$rt|j��cYcYSwxYw	|jj}n#t$r|cYcYSwxYw||urt|j��cYSYnwxYw|S)a
    Return the interfaces provided by *ob*.

    If *ob* is a :class:`super` object, then only interfaces implemented
    by the remainder of the classes in the method resolution order are
    considered. Interfaces directly provided by the object underlying *ob*
    are not.
    )	rbr�r[r�r�r<r3r�r�)r�r�cps   rrr�s<��*��b�%� � �	%� ��$�$�$�������*�*�*�%�b�)�)�)�)�)�*����!/�
	
�	�	�	���/�/�/�	/���A�A���	/�	/�	/� ���.�.�.�.�.�.�.�	/����	���*�B�B���	�	�	��H�H�H�H�H�	����

��7�7�!���.�.�.�.�.��7�1/����:
�Hsm�#.�.�A
�	A
�A�
C�!A)�(C�)B�C�B�C�B�C�B.�)C�-B.�.C�
Cc��eZdZdZd�ZdS)�ObjectSpecificationDescriptora�Implement the ``__providedBy__`` attribute

    The ``__providedBy__`` attribute computes the interfaces provided by
    an object. If an object has an ``__provides__`` attribute, that is returned.
    Otherwise, `implementedBy` the *cls* is returned.

    .. versionchanged:: 5.4.0
       Both the default (C) implementation and the Python implementation
       now let exceptions raised by accessing ``__provides__`` propagate.
       Previously, the C version ignored all exceptions.
    .. versionchanged:: 5.4.0
       The Python implementation now matches the C implementation and lets
       a ``__provides__`` of ``None`` override what the class is declared to
       implement.
    c�r�|�t|��S	|jS#t$rt|��cYSwxYw)z2Get an object specification for an object
        )r<r�r�r[rs   rrz%ObjectSpecificationDescriptor.__get__�sT���<�)�#�.�.�.�	&��$�$���	&�	&�	&� ��%�%�%�%�%�	&���s��6�6N)r)r*r+rprr,rrrArA�s-�������� 	&�	&�	&�	&�	&rrAc��|�g}|j}t|jvst|jvr|�|��n|D]}t||���|S)z�Normalize declaration arguments

    Normalization arguments might contain Declarions, tuples, or single
    interfaces.

    Anything but individual interfaces or implements specs will be expanded.
    )r�r	rrfrQr0)�sequence�outputr]�vs    rr0r0sk���~���
�
�C����$�$�
�c�k�(A�(A��
�
�h������	&�	&�A��1�f�%�%�%�%��Mr)r,r,r!)Brp�
__docformat__r��typesrrrr��zope.interface.advicer�zope.interface.interfacerr	r
rr�zope.interface._compatr
r�rr�__all__r�r��_ADVICE_WARNINGrrxrr.rurfrer�r[r�r�r�r�r�r�r�r�r�rrr�WeakValueDictionaryr�__safe_for_unpickling__rrrr!r�rr0r/r.r7r:r<rrAr0r{r�r,rr�<module>rPs"����#�
�
�
�
�
�����������������������1�1�1�1�1�1�.�.�.�.�.�.�3�3�3�3�3�3�6�6�6�6�6�6�2�2�2�2�2�2�A�A�A�A�A�A�L�L�L�L�L�L�*�*�*�*�*�*�.�.�.�.�.�.���')�#�8�
�:����������F����t(�t(�t(�t(�t(�-�t(�t(�t(�nJ
�J
�J
�J
�J
�K�J
�J
�J
�fD/�D/�D/�D/�D/�-��D/�D/�D/�N
4�
4�
4�,�,�,�^
�W�W�
��W�t3�3�3�.)@�)@�)@�X1�1�1�&"�&"�&"�&"�R���3�3�3�3�3�&�3�3�3�j%�%�%�%�%�v�%�%�%�N1�1�1�$#;�#;�#;�JC�C�C�@>-�>-�>-�>-�>-�{�>-�>-�>-�@�
�3�w�2�4�4�����$(�� �$;�$;�$;�P	F�	F�	F�J�J�J�
�-�-�-�-�-�)�-�-�
��-�.%(�%(�%(�%(�%(�K�!2�%(�%(�%(�P0�0�0�&04�04�04�d��������v����1/�1/�1/�x!�!�!�
���
���$
�9
�9
�
��9
�x
�&�&�&�&�&�F�&�&�
��&�>����(
�	�	 �	 �� =� =� ?� ?���r