%PDF- %PDF-
Mini Shell

Mini Shell

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

�

��e�����dZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lm
Z
mZmZddgZefZdd
�Zd�Zdd�Zdd�Zeje_dZd�Zy)z!Verify interface implementations
�N)�FunctionType)�
MethodType)�BrokenImplementation)�BrokenMethodImplementation)�DoesNotImplement)�Invalid)�MultipleInvalid)�
fromMethod�fromFunction�Method�verifyObject�verifyClassc�t�|dk(r
|j}n|j}g}|s#||�s|jt||��|j	d��D]\}}	t|||||��|r t|�dk(r|d�t|||��y#t$r}|j|�Yd}~�Zd}~wwxYw)a�
    Verify that *candidate* might correctly provide *iface*.

    This involves:

    - Making sure the candidate claims that it provides the
      interface using ``iface.providedBy`` (unless *tentative* is `True`,
      in which case this step is skipped). This means that the candidate's class
      declares that it `implements <zope.interface.implementer>` the interface,
      or the candidate itself declares that it `provides <zope.interface.provider>`
      the interface

    - Making sure the candidate defines all the necessary methods

    - Making sure the methods have the correct signature (to the
      extent possible)

    - Making sure the candidate defines all the necessary attributes

    :return bool: Returns a true value if everything that could be
       checked passed.
    :raises zope.interface.Invalid: If any of the previous
       conditions does not hold.

    .. versionchanged:: 5.0
        If multiple methods or attributes are invalid, all such errors
        are collected and reported. Previously, only the first error was reported.
        As a special case, if only one such error is present, it is raised
        alone, like before.
    �cT)�allN�r)	�
implementedBy�
providedBy�appendr�namesAndDescriptions�_verify_elementr�lenr	)	�iface�	candidate�	tentative�vtype�tester�excs�name�desc�es	         �7/usr/lib/python3/dist-packages/zope/interface/verify.py�_verifyr#'s���@
��|��$�$���!�!��
�D��V�I�.����$�U�I�6�7��0�0�T�0�:��
��d�	��E�4��y�%�@����t�9��>��q�'�M��e�Y��5�5����	��K�K��N�N��	�s�B�	B7�B2�2B7c���	t||�}t|t�sytj|�stj|�ryt|t�r4t|t�r|dk(rt|||d��}nyt|||��}njt|t�r)t|j�turt|||�}n1t|t�r|dk(ryt|�st!|d|||��yt#|j%�|j%��}|rt!|||||��y#t$r%t|t�s|dk(rYyt	|||��wxYw)Nrr)r�imlevel)rzimplementation is not a method)�getattr�AttributeError�
isinstancerr�inspect�ismethoddescriptor�	isbuiltinr�typer�MethodTypes�__func__r
�property�callabler�	_incompat�getSignatureInfo)rrr rr�attr�meth�messs        r"rr]sV��;��y�$�'���d�F�#���!�!�$�'�7�+<�+<�T�+B�	��$��%��i��&�5�C�<�
 ��e�$��B�D� ��e�$�7�D�
�T�;�
'��4�=�=�!�\�1��$��t�,��	�D�(�	#����
	���~�,�T�3S�-1�5�)�E�
E�	��T�*�*�,�d�.C�.C�.E�F�D��(��t�T�5�)�L�L���s�;��4��(�e�s�l�
�"�5�$�	�:�:�
;�s�D2�2E �E c� �t|||d��S)zF
    Verify that the *candidate* might correctly provide *iface*.
    r�r�r#�rrrs   r"rr�s���5�)�Y�c�:�:�c� �t|||d��S)N�or7r8r9s   r"r
r
�s���5�)�Y�c�:�:r:z*implementation requires too many argumentsc��t|d�t|d�kDrtSt|d�t|d�kr|dsy|dr|dsy|dr|dsyyy)N�required�
positional�varargsz-implementation doesn't allow enough arguments�kwargsz0implementation doesn't support keyword argumentsz1implementation doesn't support variable arguments)r�
_MSG_TOO_MANY)r>�implementeds  r"r1r1�sy��
�;�z�"�#�c�(�:�*>�&?�?���	�[��
&�	'�#�h�|�.D�*E�	E��I�&�>����+�h�"7�A��	��;�y�#9�B�$:�r:)FN)F)�__doc__r)�sys�typesrr�zope.interface.exceptionsrrrrr	�zope.interface.interfacer
rr�__all__r-r#rrr
rBr1�r:r"�<module>rKss����
���:�@�6�-�5�E�E������n��4�l>M�D;�;������<�
�
Cr:

Zerion Mini Shell 1.0