
    Of                         d 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 ddl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d ZdS )z!Verify interface implementations
    N)FunctionType)
MethodType)BrokenImplementation)BrokenMethodImplementation)DoesNotImplement)Invalid)MultipleInvalid)Method)fromFunction)
fromMethod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	            G/var/www/html/env/lib/python3.11/site-packages/zope/interface/verify.py_verifyr#   )   s   B ||$!D 8VVI.. 8$UI6677700T0::  
d	E4y%@@@@ 	 	 	KKNNNNNNNN	  6t99>>q'MeY5554s   $A88
B!BB!c                 l   	 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                    rBt          |t                    r|dk    rt          || |d          }nt          || |          }nt          |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!          |||| |          d S )Nr   r   )r   imlevel)r   zimplementation is not a method)getattrAttributeError
isinstancer
   r   inspectismethoddescriptor	isbuiltinr   typer   MethodTypes__func__r   propertycallabler   	_incompatgetSignatureInfo)r   r   r    r   r   attrmethmesss           r"   r   r   a   s   
;y$'' ; ; ;4(( 	esll FF #5$	:::; dF## !$'' 7+<T+B+B  	$%% $i&& 	85C<<
  e$BBBDD  e$777DD 	4%%T]|++$t,,	D(	#	# 
 	 ~~ 	,0   	 T**,,d.C.C.E.EFFD M(tT5)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)Yc::::    c                 (    t          | ||d          S )Nor7   r8   r9   s      r"   r   r      s    5)Yc::::r:   z*implementation requires too many argumentsc                 $   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)r>   implementeds     r"   r1   r1      s    
 ;z"##c(:*>&?&??? 
[&	'	'#h|.D*E*E	E	E	" 
F ?> B+h"7 BAA	 C;y#9 CBBC C C Cr:   )FN)F)__doc__r)   systypesr   r   zope.interface.exceptionsr   r   r   r   r	   zope.interface.interfacer
   r   r   __all__r-   r#   r   r   r   rB   r1    r:   r"   <module>rK      so     



             : : : : : : @ @ @ @ @ @ 6 6 6 6 6 6 - - - - - - 5 5 5 5 5 5 + + + + + + 1 1 1 1 1 1 / / / / / /  n5 5 5 5pKM KM KM\; ; ; ;; ; ; ;  <C C C C Cr:   