�
JDvc� � � � d Z ddlmZ ddlZddlZddlmZ ddlmZ ddlm Z ddl
mZ ddl
mZ dd l
m
Z
dd
l
mZ ddl
mZ ddlmZmZmZ d
dgZefZdd�Zd� Zdd�Zdd�Zej e_ dZ eef� � Zd� Zd� ZdS )z!Verify interface implementations
� )�print_functionN)�FunctionType)�
MethodType)�PYPY2)�BrokenImplementation)�BrokenMethodImplementation)�DoesNotImplement)�Invalid)�MultipleInvalid)�
fromMethod�fromFunction�Method�verifyObject�verifyClassFc � � |dk r| j }n| j }g }|s. ||� � s#|� t | |� � � � | � d�� � D ]E\ }} t | ||||� � �# t $ r}|� |� � Y d}~�>d}~ww xY w|r,t |� � dk r|d �t | ||� � �dS )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 |dk rY d S t | ||� � �w xY wt |t � � sd S t j |� � st j |� � rd S t |t � � rXt j
d dk r/t |t � � r|dk rt || |d�� � }n�t || |�� � }n�t |t � � r-t |j � � t u rt || |� � }nAt |t � � r|dk rd S t# |� � st% |d|| |� � �d S t' |