Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/zope/interface/__pycache__/verify.cpython-39.pyc
Ðазад
a i�h� � @ s� d Z ddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm Z dd lmZ dd lm Z ddlmZ ddlmZ d dgZefZddd�Zdd� Zddd�Zddd �Zej e_ dZdd� ZdS )z!Verify interface implementations � N)�FunctionType)� MethodType)�BrokenImplementation)�BrokenMethodImplementation)�DoesNotImplement)�Invalid)�MultipleInvalid)�Method)�fromFunction)� fromMethod�verifyObject�verifyClassFc C s� |dkr| j }n| j}g }|s6||�s6|�t| |�� | jdd�D ]L\}}zt| ||||� W qB ty� } z|�|� W Y d}~qBd}~0 0 qB|r�t|�dkr�|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 ) Z implementedByZ providedBy�appendr ZnamesAndDescriptions�_verify_elementr �lenr ) �iface� candidate� tentative�vtype�testerZexcs�name�desc�e� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/zope/interface/verify.py�_verify) s !"r c C s0 zt ||�}W n6 tyD t|t�s4|dkr4Y d S t| ||��Y n0 t|t�sTd S t�|�sht�|�rld S t|t�r�t|t �r�|dkr�t || |dd�}nt || |d�}nZt|t�r�t |j�tu r�t || |�}n4t|t�r�|dkr�d S t|��s t|d|| |��d S t|�� |�� �}|�r,t|||| |��d S )Nr r )r Zimlevel)r zimplementation is not a method)�getattr�AttributeError� isinstancer r �inspect�ismethoddescriptor� isbuiltinr �typer �MethodTypes�__func__r �property�callabler � _incompatZgetSignatureInfo)r r r r r �attr�methZmessr r r r a sB �� � r c C s t | ||dd�S )zF Verify that the *candidate* might correctly provide *iface*. r �r �r �r r r r r r r � s c C s t | ||dd�S )N�or- r. r/ r r r r � s z*implementation requires too many argumentsc C sl t |d �t | d �krtS t |d �t | d �k r@|d s@dS | d rT|d sTdS | d rh|d shdS 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)r1 Zimplementedr r r r* � s ��r* )FN)F)F)�__doc__r"