o
    €Ýh  ã                   @   s´   d Z ddlmZ G dd„ deƒZG dd„ deƒZG dd„ deƒZG d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZ	G dd„ deƒZ
G dd„ deƒZG dd„ deƒZG dd„ deƒZdS )zExceptions module for rfc3986.é   )Úcompatc                   @   ó   e Zd ZdZdS )ÚRFC3986Exceptionz-Base class for all rfc3986 exception classes.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r
   r
   úZ/var/www/html/magazine_api/magazine_env/lib/python3.10/site-packages/rfc3986/exceptions.pyr      ó    r   c                       ó    e Zd ZdZ‡ fdd„Z‡  ZS )ÚInvalidAuthorityz/Exception when the authority string is invalid.c                    s    t t| ƒ d t |¡¡¡ dS )z4Initialize the exception with the invalid authority.z!The authority ({0}) is not valid.N)Úsuperr   Ú__init__Úformatr   Zto_str)ÚselfÚ	authority©Ú	__class__r
   r   r      s
   
ÿÿzInvalidAuthority.__init__©r   r   r   r	   r   Ú__classcell__r
   r
   r   r   r      ó    r   c                       r   )ÚInvalidPortz#Exception when the port is invalid.c                    s   t t| ƒ d |¡¡ dS )z/Initialize the exception with the invalid port.zThe port ("{0}") is not valid.N)r   r   r   r   )r   Úportr   r
   r   r      s   
ÿzInvalidPort.__init__r   r
   r
   r   r   r      r   r   c                       r   )ÚResolutionErrorz1Exception to indicate a failure to resolve a URI.c                    s   t t| ƒ d | ¡ ¡¡ dS )z)Initialize the error with the failed URI.z{0} is not an absolute URI.N)r   r   r   r   Úunsplit)r   Úurir   r
   r   r   &   s   
ÿzResolutionError.__init__r   r
   r
   r   r   r   #   r   r   c                   @   r   )ÚValidationErrorz,Exception raised during Validation of a URI.Nr   r
   r
   r
   r   r   -   r   r   c                       r   )ÚMissingComponentErrorz6Exception raised when a required component is missing.c                    óR   d}t |ƒdkr
d}|| _t|ƒ| _d | j¡}tt| ƒ d ||¡|| j¡ dS )z5Initialize the error with the missing component name.Úwasr   Úwereú, z{} {} required but missingN)	Úlenr   ÚsortedÚ
componentsÚjoinr   r   r   r   ©r   r   Zcomponent_namesZverbr&   r   r
   r   r   6   ó   


ýzMissingComponentError.__init__r   r
   r
   r   r   r   3   r   r   c                       r   )ÚUnpermittedComponentErrorz;Exception raised when a component has an unpermitted value.c                    s>   t t| ƒ d |tt|ƒƒ|¡|||¡ || _|| _|| _dS )z4Initialize the error with the unpermitted component.z.{} was required to be one of {!r} but was {!r}N)	r   r*   r   r   Úlistr%   Úcomponent_nameÚcomponent_valueÚallowed_values)r   r,   r-   r.   r   r
   r   r   I   s   

ýø

z"UnpermittedComponentError.__init__r   r
   r
   r   r   r*   F   r   r*   c                       r   )ÚPasswordForbiddenzCException raised when a URL has a password in the userinfo section.c                    s6   t ˆ d‡ fdd„ƒ}tt| ƒ d |ƒ ¡¡ ˆ | _dS )z9Initialize the error with the URI that failed validation.r   c                      s   ˆ S )Nr
   r
   ©r   r
   r   Ú<lambda>_   s    z,PasswordForbidden.__init__.<locals>.<lambda>z4"{}" contained a password when validation forbade itN)Úgetattrr   r/   r   r   r   )r   r   r   r   r0   r   r   ]   s   
ÿÿ
zPasswordForbidden.__init__r   r
   r
   r   r   r/   Z   r   r/   c                       r   )ÚInvalidComponentsErrorz9Exception raised when one or more components are invalid.c                    r    )z8Initialize the error with the invalid component name(s).r!   r   r"   r#   z{} {} found to be invalidN)	r$   r   r%   r&   r'   r   r3   r   r   r(   r   r
   r   r   k   r)   zInvalidComponentsError.__init__r   r
   r
   r   r   r3   h   r   r3   c                   @   r   )ÚMissingDependencyErrorzBException raised when an IRI is encoded without the 'idna' module.Nr   r
   r
   r
   r   r4   {   s    r4   N)r	   Ú r   Ú	Exceptionr   r   r   r   r   r   r*   r/   r3   r4   r
   r
   r
   r   Ú<module>   s   

