§
    JDvcä   ã                   ó  — d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ ddl
mZ dd	l
mZ dd
l
mZ ddl
mZ ddlmZmZmZ ddgZefZdd„Zd„ Zdd„Zdd„Zej         e_         dZ eef¦  «        Zd„ Zd„ ZdS )z!Verify interface implementations
é    )Úprint_functionN)ÚFunctionType)Ú
MethodType)ÚPYPY2)ÚBrokenImplementation)ÚBrokenMethodImplementation)ÚDoesNotImplement)ÚInvalid)ÚMultipleInvalid)Ú
fromMethodÚfromFunctionÚMethodÚverifyObjectÚverifyClassFc                 ó¨  — |dk    r| j         }n| j        }g }|s. ||¦  «        s#|                     t          | |¦  «        ¦  «         |                      d¬¦  «        D ]E\  }}	 t          | ||||¦  «         Œ# t          $ r}|                     |¦  «         Y d}~Œ>d}~ww xY w|r,t          |¦  «        dk    r|d         ‚t          | ||¦  «        ‚dS )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Øð 8˜V˜V IÑ.Ô.ð 8Ø�ŠÕ$ U¨IÑ6Ô6Ñ7Ô7Ð7à×0Ò0°TÐ0Ñ:Ô:ð ð ‰
ˆˆdð	Ý˜E 4¨¨y¸%Ñ@Ô@Ð@Ð@øÝð 	ð 	ð 	Ø�KŠK˜‰NŒNˆNˆNˆNˆNˆNˆNøøøøð	øøøð ð 6Ýˆt‰9Œ9˜Š>ˆ>Ø�q”'ˆMÝ˜e Y°Ñ5Ô5Ð5àˆ4s   Á$A8Á8
B!ÂBÂB!c                 óÌ  — 	 t          ||¦  «        }n=# t          $ r0 t          |t          ¦  «        s	|dk    rY d S t	          | ||¦  «        ‚w xY wt          |t          ¦  «        sd S t          j        |¦  «        st          j        |¦  «        rd S t          |t          ¦  «        rXt          j
        d         dk    r/t          |t          ¦  «        r|dk    rt          || |d¬¦  «        }n–t          || |¬¦  «        }nƒt          |t          ¦  «        r-t          |j        ¦  «        t          u rt          || |¦  «        }nAt          |t           ¦  «        r|dk    rd S t#          |¦  «        st%          |d|| |¦  «        ‚d S t'          |                     ¦   «         |                     ¦   «         ¦  «        }|r-t*          rt-          |||¦  «        rd S t%          |||| |¦  «        ‚d S )Nr   r   é   r   )r!   Úimlevel)r!   zimplementation is not a method)ÚgetattrÚAttributeErrorÚ
isinstancer   r   ÚinspectÚismethoddescriptorÚ	isbuiltinr   ÚsysÚversion_infoÚtyper   ÚMethodTypesÚ__func__r   ÚpropertyÚcallabler   Ú	_incompatÚgetSignatureInfor   Ú_pypy2_false_positive)r   r!   r"   r   r   ÚattrÚmethÚmesss           r$   r   r   `   s,  € ð;Ý�y $Ñ'Ô'ˆˆøÝð ;ð ;ð ;Ý˜4¥Ñ(Ô(ð 	¨e°sªl¨lð ˆFˆFå" 5¨$°	Ñ:Ô:Ð:ð;øøøõ �d�FÑ#Ô#ð àˆåÔ! $Ñ'Ô'ð ­7Ô+<¸TÑ+BÔ+Bð ð 	ˆå�$�Ñ%Ô%ð ÝÔ˜AÔ !Ò#Ð#­
°9½dÑ(CÔ(CÐ#ÈÐQTÊÈõ
    e°$Ø()ð+ñ +ô +ˆDˆDõ    e°$Ð7Ñ7Ô7ˆDˆDÝ
�T�;Ñ
'Ô
'ð Ý�4”=Ñ!Ô!¥\Ð1Ð1Ý˜$  tÑ,Ô,ˆˆÝ	�D�(Ñ	#Ô	#ð ¨°ª¨ð
 	ˆõ ˜‰~Œ~ð 	EÝ,¨TÐ3SØ-1°5¸)ñEô Eð Eð 	ˆõ �T×*Ò*Ñ,Ô,¨d×.CÒ.CÑ.EÔ.EÑFÔF€DØð MÝð 	Õ*¨4°¸EÑBÔBð 	ØˆFÝ(¨¨t°T¸5À)ÑLÔLÐLðMð Ms   ‚ “%A»Ac                 ó(   — t          | ||d¬¦  «        S )zF
    Verify that the *candidate* might correctly provide *iface*.
    r   ©r   ©r%   ©r   r   r   s      r$   r   r   ¥   s   € õ �5˜) Y°cÐ:Ñ:Ô:Ð:ó    c                 ó(   — t          | ||d¬¦  «        S )NÚor=   r>   r?   s      r$   r   r   «   s   € Ý�5˜) Y°cÐ:Ñ:Ô:Ð:r@   z*implementation requires too many argumentsc                 ó¢   — | t           vrdS t          t          ¦  «                             ¦   «         }|dk    r|nt	          |¦  «        }||v rdS dS )NFr   T)Ú_KNOWN_PYPY2_FALSE_POSITIVESÚvarsÚ__builtins__Úvaluesr1   )Úmsgr   r   Úknown_builtin_typesÚcandidate_types        r$   r8   r8   ¶   s\   € ð Õ.Ð.Ð.Øˆuå�|Ñ,Ô,×3Ò3Ñ5Ô5ÐØ"'¨3¢, ,�Y�YµD¸±O´O€NØÐ,Ð,Ð,Øˆtàˆ5r@   c                 ó$  — t          |d         ¦  «        t          | d         ¦  «        k    rt          S t          |d         ¦  «        t          | d         ¦  «        k     r
|d         sdS | d         r
|d         sdS | d         r
|d         sdS d S d S )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)rL   Úimplementeds     r$   r6   r6   Í   sÂ   € õ
 ˆ;�zÔ"Ñ#Ô#¥c¨(°:Ô*>Ñ&?Ô&?Ò?Ð?ÝÐÝ	ˆ[˜Ô&Ñ	'Ô	'­#¨h°|Ô.DÑ*EÔ*EÒ	EÐ	EØ˜IÔ&ð 
Fà>Ð>Ø�Ôð B +¨hÔ"7ð BØAÐAØ�	Ôð C ;¨yÔ#9ð CØBÐBðCð Cð Cð Cr@   )FN)F)Ú__doc__Ú
__future__r   r,   r/   Útypesr   r   Úzope.interface._compatr   Úzope.interface.exceptionsr   r   r	   r
   r   Úzope.interface.interfacer   r   r   Ú__all__r2   r%   r   r   r   rP   Ú	frozensetrD   r8   r6   © r@   r$   ú<module>r[      s¤  ððð à %Ð %Ð %Ð %Ð %Ð %Ø €€€Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à (Ð (Ð (Ð (Ð (Ð (à :Ð :Ð :Ð :Ð :Ð :Ø @Ð @Ð @Ð @Ð @Ð @Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø -Ð -Ð -Ð -Ð -Ð -Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5à EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ EÐ Eð Øð€ð ˆn€ð4ð 4ð 4ð 4ðlAMð AMð AMðJ;ð ;ð ;ð ;ð;ð ;ð ;ð ;ð ”€Ô à<€Ø(˜yØð*ñ  ô  Ð ð
ð ð ð.Cð Cð Cð Cð Cr@   