
    	a                         d Z ddlm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 G d de      Z G d de      Zy)zExceptions module for rfc3986.   )compatc                       e Zd ZdZy)RFC3986Exceptionz-Base class for all rfc3986 exception classes.N__name__
__module____qualname____doc__     4/usr/lib/python3/dist-packages/rfc3986/exceptions.pyr   r      s    7r   r   c                   "     e Zd ZdZ fdZ xZS )InvalidAuthorityz/Exception when the authority string is invalid.c                 R    t         |   dt        j                  |       d       y)z4Initialize the exception with the invalid authority.zThe authority (z) is not valid.N)super__init__r   to_str)self	authority	__class__s     r   r   zInvalidAuthority.__init__   s&    fmmI67G	
r   r   r   r	   r
   r   __classcell__r   s   @r   r   r      s    9
 
r   r   c                   "     e Zd ZdZ fdZ xZS )InvalidPortz#Exception when the port is invalid.c                 ,    t         |   d| d       y)z/Initialize the exception with the invalid port.zThe port ("z") is not valid.N)r   r   )r   portr   s     r   r   zInvalidPort.__init__   s    ;tf,<=>r   r   r   s   @r   r   r      s    -? ?r   r   c                   "     e Zd ZdZ fdZ xZS )ResolutionErrorz1Exception to indicate a failure to resolve a URI.c                 ^    t         |   dj                  |j                                      y)z)Initialize the error with the failed URI.z1{} does not meet the requirements for resolution.N)r   r   formatunsplit)r   urir   s     r   r   zResolutionError.__init__    s'    ?FF	
r   r   r   s   @r   r   r      s    ;
 
r   r   c                       e Zd ZdZy)ValidationErrorz,Exception raised during Validation of a URI.Nr   r   r   r   r%   r%   )   s    6r   r%   c                   "     e Zd ZdZ fdZ xZS )MissingComponentErrorz6Exception raised when a required component is missing.c                     d}t        |      dkD  rd}|| _        t        |      | _        dj	                  | j                        }t
        |   | d| d|| j                         y)z5Initialize the error with the missing component name.wasr   were,  z required but missingNlenr#   sorted
componentsjoinr   r   r   r#   component_namesverbr0   r   s        r   r   zMissingComponentError.__init__2   sg    !#D 1YYt/
l!D6!67OO	
r   r   r   s   @r   r'   r'   /   s    @
 
r   r'   c                   "     e Zd ZdZ fdZ xZS )UnpermittedComponentErrorz;Exception raised when a component has an unpermitted value.c           
          t         |   dj                  |t        t	        |            |      |||       || _        || _        || _        y)z4Initialize the error with the unpermitted component.z.{} was required to be one of {!r} but was {!r}N)r   r   r!   listr/   component_namecomponent_valueallowed_values)r   r9   r:   r;   r   s       r   r   z"UnpermittedComponentError.__init__E   sV    <CCVN+,
 		
 -.,r   r   r   s   @r   r6   r6   B   s    E- -r   r6   c                   "     e Zd ZdZ fdZ xZS )PasswordForbiddenzCException raised when a URL has a password in the userinfo section.c                 |    t        dfd      }t        | 	  dj                   |                    | _        y)z9Initialize the error with the URI that failed validation.r"   c                       S )Nr   )r#   s   r   <lambda>z,PasswordForbidden.__init__.<locals>.<lambda>[   s    # r   z4"{}" contained a password when validation forbade itN)getattrr   r   r!   r#   )r   r#   r"   r   s    ` r   r   zPasswordForbidden.__init__Y   s:    #y+6BII		

 r   r   r   s   @r   r=   r=   V   s    M r   r=   c                   "     e Zd ZdZ fdZ xZS )InvalidComponentsErrorz9Exception raised when one or more components are invalid.c                     d}t        |      dkD  rd}|| _        t        |      | _        dj	                  | j                        }t
        |   | d| d|| j                         y)z8Initialize the error with the invalid component name(s).r)   r   r*   r+   r,   z found to be invalidNr-   r2   s        r   r   zInvalidComponentsError.__init__g   sg    !#D 1YYt/
l!D6!56OO	
r   r   r   s   @r   rC   rC   d   s    C
 
r   rC   c                       e Zd ZdZy)MissingDependencyErrorzBException raised when an IRI is encoded without the 'idna' module.Nr   r   r   r   rF   rF   w   s    Lr   rF   N)r
    r   	Exceptionr   r   r   r   r%   r'   r6   r=   rC   rF   r   r   r   <module>rI      s    $ 	y 	
' 
?" ?	
& 	
	& 	
O 
&- -( 
_ 
&M- Mr   