
    Vhv!                         d Z g dZ G d de      Z G d de      Z G d de      Z G d d	e      Z G d
 de      Z G d de      Z G d de      Z	 G d de
      Zy)zInterface-specific exceptions
)InvalidDoesNotImplementBrokenImplementationBrokenMethodImplementationMultipleInvalidBadImplementsInvalidInterfacec                       e Zd ZdZy)r   z A specification is violated
    N__name__
__module____qualname____doc__     I/home/dcms/DCMS/lib/python3.12/site-packages/zope/interface/exceptions.pyr   r          r   r   c                   v    e Zd ZdZdZeZdZddZe	d        Z
e	d        Ze	d        Ze	d	        Zd
ZdZdZd Zy)_TargetInvalid       z<Not Given>Nc                 P    	 | j                   |   S # | j                  $ r |cY S w xY wN)args_NOT_GIVEN_CATCH)selfixdefaults      r   _get_arg_or_defaultz"_TargetInvalid._get_arg_or_default9   s/    	99R= $$ 	N	s    %%c                 8    | j                  | j                        S r   )r   _IX_INTERFACEr   s    r   	interfacez_TargetInvalid.interface?   s    ''(:(:;;r   c                 N    | j                  | j                  | j                        S r   )r   
_IX_TARGET
_NOT_GIVENr!   s    r   targetz_TargetInvalid.targetC   s    ''IIr   c                 B    | j                   }|| j                  u ryd|S )Nz	An objectzThe object )r&   r%   )r   r&   s     r   _str_subjectz_TargetInvalid._str_subject[   s'    T__$VJ''r   c                 (    d| j                   xs dz  S )Nz$has failed to implement interface %sz	<Unknown>)r"   r!   s    r   _str_descriptionz_TargetInvalid._str_descriptionb   s    5NN)k
 	
r   z: z	<unknown>.c                     dj                  | j                  | j                  | j                  | j                  | j
                        S )Nz{} {}{}{}{})formatr(   r*   _str_conjunction_str_details_str_trailerr!   s    r   __str__z_TargetInvalid.__str__l   sB    ##!!!!
 	
r   r   )r   r   r   r    r$   
IndexErrorr   r%   r   propertyr"   r&   r(   r*   r.   r/   r0   r1   r   r   r   r   r   #   s     MJ "J < < J J. ( ( 
 

 LL
r   r   c                       e Zd ZdZdZy)r   a  
    DoesNotImplement(interface[, target])

    The *target* (optional) does not implement the *interface*.

    .. versionchanged:: 5.0.0
       Add the *target* argument and attribute, and change the resulting
       string value of this object accordingly.
    z.Does not declaratively implement the interfaceN)r   r   r   r   r/   r   r   r   r   r   v   s     DLr   r   c                   X    e Zd ZdZej
                  dz   Zedz   Zed        Z	ed        Z
y)r   a[  
    BrokenImplementation(interface, name[, target])

    The *target* (optional) is missing the attribute *name*.

    .. versionchanged:: 5.0.0
       Add the *target* argument and attribute, and change the resulting
       string value of this object accordingly.

       The *name* can either be a simple string or a ``Attribute`` object.
    r   c                      | j                   d   S Nr   r   r!   s    r   namezBrokenImplementation.name       yy|r   c                     dt        | j                  t              rt        | j                        z  S | j                  z  S )Nz!The %s attribute was not provided)
isinstancer9   strreprr!   s    r   r/   z!BrokenImplementation._str_details   s8    2)$))S9DO
 	
?Cyy
 	
r   N)r   r   r   r   r   r    _IX_NAMEr$   r3   r9   r/   r   r   r   r   r      sH    
 ++a/HAJ  
 
r   r   c                   h    e Zd ZdZdZedz   Zedz   Zed        Zed        Z	e
d        Zed        Zy)	r   a  
    BrokenMethodImplementation(
        method, message[, implementation, interface, target]
    )

    The *target* (optional) has a *method* in *implementation* that violates
    its contract in a way described by *mess*.

    .. versionchanged:: 5.0.0
       Add the *interface* and *target* argument and attribute,
       and change the resulting string value of this object accordingly.

       The *method* can either be a simple string or a ``Method`` object.

    .. versionchanged:: 5.0.0
       If *implementation* is given, then the *message* will have the
       string "implementation" replaced with an short but informative
       representation of *implementation*.

       r   c                      | j                   d   S Nr   r8   r!   s    r   methodz!BrokenMethodImplementation.method   r:   r   c                      | j                   d   S r7   r8   r!   s    r   messzBrokenMethodImplementation.mess   r:   r   c                 6   dd l }	 |j                  }t        }	  ||       }	 | j                  }| ||      z   S # t        $ r |j                  }|j
                  }Y Dw xY w# t        t        f$ r t        |       cY S w xY w# t        $ r | j                  }Y iw xY wrC   )inspect	signaturer=   AttributeError
getargspecformatargspec
ValueError	TypeErrorr>   r   r   )implrH   sig	formatsigr9   s        r   __implementation_strz/BrokenMethodImplementation.__implementation_str   s     		.##CI
	d)C	!$$D in$$%  	.$$C--I	. I& 	
 :	  	!==D	!s1   9 A  B  !AA A=<A= BBc                 x   | j                  | j                  | j                        }| j                  }|| j                  ur+d|v r'|j	                  dd      }|| j                  |      fz  }dj                  t        | j                  t              rt        | j                        |      S | j                  |      S )Nimplementationz%rz)The contract of {} is violated because {})r   _IX_IMPLr%   rF   replace/_BrokenMethodImplementation__implementation_strr-   r<   rD   r=   r>   )r   rO   messages      r   r/   z'BrokenMethodImplementation._str_details   s    ''tG))t&+;w+Foo&6=G!:!:4!@ BBG:AA!+DKK!=D
 	
CG;;
 	
r   N)r   r   r   r   rU   r    r$   r3   rD   rF   staticmethodrW   r/   r   r   r   r   r      so    * HqLM"J    % %6 

 

r   r   c                   N     e Zd ZdZdZ fdZed        Zed        ZdZ	dZ
 xZS )r   z
    The *target* has failed to implement the *interface* in
    multiple ways.

    The failures are described by *exceptions*, a collection of
    other `Invalid` instances.

    .. versionadded:: 5.0
    r   c                 :    t         |   ||t        |             y r   )super__init__tuple)r   r"   r&   
exceptions	__class__s       r   r]   zMultipleInvalid.__init__   s    FE*,=>r   c                      | j                   d   S )NrA   r8   r!   s    r   r_   zMultipleInvalid.exceptions   r:   r   c                 L    ddj                  d | j                  D              z   S )Nz
    c              3      K   | ]9  }t        |t              r|j                  j                         n
t	        |       ; y wr   )r<   r   r/   stripr=   ).0xs     r   	<genexpr>z/MultipleInvalid._str_details.<locals>.<genexpr>  s7      (
 '1N&CANN  "QO(
s   ?A)joinr_   r!   s    r   r/   zMultipleInvalid._str_details   s-     (-- (
__(
 
 
 	
r   : )r   r   r   r   r   r]   r3   r_   r/   r.   r0   __classcell__)r`   s   @r   r   r      sJ     ?   
 
 Lr   r   c                       e Zd ZdZy)r   z'The interface has invalid contents
    Nr
   r   r   r   r   r     r   r   r   c                       e Zd ZdZy)r   zAn implementation assertion is invalid

    because it doesn't contain an interface or a sequence of valid
    implementation assertions.
    Nr
   r   r   r   r   r     s    r   r   N)r   __all__	Exceptionr   r   r   r   r   r   r   rN   r   r   r   r   <module>rp      sz   
i 
P
W P
fD~ D
> 
6I
 I
Xn By 
I r   