
    Ofv!                         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dS )zInterface-specific exceptions
)InvalidDoesNotImplementBrokenImplementationBrokenMethodImplementationMultipleInvalidBadImplementsInvalidInterfacec                       e Zd ZdZdS )r   z A specification is violated
    N__name__
__module____qualname____doc__     K/var/www/html/env/lib/python3.11/site-packages/zope/interface/exceptions.pyr   r                 r   r   c                       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dS )_TargetInvalid       z<Not Given>Nc                 B    	 | 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:    	9R= $ 	 	 	NNN	s    c                 6    |                      | j                  S r   )r   _IX_INTERFACEr   s    r   	interfacez_TargetInvalid.interface?   s    ''(:;;;r   c                 B    |                      | j        | j                  S r   )r   
_IX_TARGET
_NOT_GIVENr!   s    r   targetz_TargetInvalid.targetC   s    ''IIIr   c                 0    | j         }|| j        u rdS d|S )Nz	An objectzThe object )r&   r%   )r   r&   s     r   _str_subjectz_TargetInvalid._str_subject[   s)    T_$$;'V'''r   c                     d| j         pdz  S )Nz$has failed to implement interface %sz	<Unknown>)r"   r!   s    r   _str_descriptionz_TargetInvalid._str_descriptionb   s    5N)k
 	
r   z: z	<unknown>.c                 f    d                     | j        | j        | j        | j        | j                  S )Nz{} {}{}{}{})formatr(   r*   _str_conjunction_str_details_str_trailerr!   s    r   __str__z_TargetInvalid.__str__l   s8    ##!!
 
 	
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    < < X< J J XJ. ( ( X( 
 
 X

 LL
 
 
 
 
r   r   c                       e Zd ZdZdZdS )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LLLr   r   c                   \    e Zd ZdZej        dz   Zedz   Zed             Z	ed             Z
dS )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       y|r   c                 r    dt          | j        t                    rt          | j                  n| j        z  S )Nz!The %s attribute was not provided)
isinstancer9   strreprr!   s    r   r/   z!BrokenImplementation._str_details   s1    2)$)S99HDOOOty
 	
r   N)r   r   r   r   r   r    _IX_NAMEr$   r3   r9   r/   r   r   r   r   r      sj        
 
 +a/HAJ  X 
 
 X
 
 
r   r   c                       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dS )	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                 (   dd l }	 |j        }t          }n# t          $ r |j        }|j        }Y nw xY w	  ||           }n&# t          t          f$ r t          |           cY S w xY w	 | j	        }n# t          $ r
 | j
        }Y nw xY w| ||          z   S rC   )inspect	signaturer=   AttributeError
getargspecformatargspec
ValueError	TypeErrorr>   r   r   )implrH   sig	formatsigr9   s        r   __implementation_strz/BrokenMethodImplementation.__implementation_str   s     		.#CII 	. 	. 	.$C-III	.	#d))CCI& 	 	 	
 ::		!$DD 	! 	! 	!=DDD	! iinn$$s/    00A    A#"A#'A/ /BBc                 Z   |                      | j        | j                  }| j        }|| j        ur3d|v r/|                    dd          }||                     |          fz  }d                    t          | j        t                    rt          | j                  n| 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G)t&&+;w+F+Foo&6==G!:!:4!@!@ BBG:AA!+DK!=!=ND4;
 
 	
r   N)r   r   r   r   rU   r    r$   r3   rD   rF   staticmethodrW   r/   r   r   r   r   r      s         * HqLM"J  X   X % % \%6 

 

 X

 

 

r   r   c                   Z     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                 h    t                                          ||t          |                     d S 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                 P    dd                     d | j        D                       z   S )Nz
    c              3      K   | ]A}t          |t                    r|j                                        nt	          |          V  Bd S r   )r<   r   r/   stripr=   ).0xs     r   	<genexpr>z/MultipleInvalid._str_details.<locals>.<genexpr>  s^       (
 (
 '1N&C&COAN  """Q(
 (
 (
 (
 (
 (
r   )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      s          ? ? ? ? ?   X 
 
 X
 LLLLLr   r   c                       e Zd ZdZdS )r   z'The interface has invalid contents
    Nr
   r   r   r   r   r     r   r   r   c                       e Zd ZdZdS )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      s   
 
 
    i   
P
 P
 P
 P
 P
W P
 P
 P
fD D D D D~ D D D
 
 
 
 
> 
 
 
6I
 I
 I
 I
 I
 I
 I
 I
X    n   B    y   
    I     r   