U
    ÕCd  ã                   @   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                   @   s   e Zd ZdZdS )ÚRFC3986Exceptionz-Base class for all rfc3986 exception classes.N©Ú__name__Ú
__module__Ú__qualname__Ú__doc__© r	   r	   ú6/tmp/pip-unpacked-wheel-79v45wuf/rfc3986/exceptions.pyr      s   r   c                       s    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      s   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )Ú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      s   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )Ú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   #   s   r   c                   @   s   e Zd ZdZdS )ÚValidationErrorz,Exception raised during Validation of a URI.Nr   r	   r	   r	   r
   r   -   s   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚMissingComponentErrorz6Exception raised when a required component is missing.c                    sR   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   s    


ýzMissingComponentError.__init__r   r	   r	   r   r
   r   3   s   r   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )Ú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   s   r$   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )Ú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>_   ó    z,PasswordForbidden.__init__.<locals>.<lambda>z4"{}" contained a password when validation forbade itN)Úgetattrr   r)   r   r   r   )r   r   r   r   r*   r
   r   ]   s    
ÿÿzPasswordForbidden.__init__r   r	   r	   r   r
   r)   Z   s   r)   c                       s    e Zd ZdZ‡ fdd„Z‡  ZS )ÚInvalidComponentsErrorz9Exception raised when one or more components are invalid.c                    sR   d}t |ƒdkrd}|| _t|ƒ| _d | j¡}tt| ƒ d ||¡|| j¡ dS )z8Initialize the error with the invalid component name(s).r   r   r   r   z{} {} found to be invalidN)	r   r   r    r!   r"   r   r.   r   r   r#   r   r	   r
   r   k   s    


ýzInvalidComponentsError.__init__r   r	   r	   r   r
   r.   h   s   r.   c                   @   s   e Zd ZdZdS )ÚMissingDependencyErrorzBException raised when an IRI is encoded without the 'idna' module.Nr   r	   r	   r	   r
   r/   {   s   r/   N)r   Ú r   Ú	Exceptionr   r   r   r   r   r   r$   r)   r.   r/   r	   r	   r	   r
   Ú<module>   s   

