U
    P|jø!  ã                   @   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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G d+d,„ d,eƒZG d-d.„ d.eƒZG d/d0„ d0eƒZG d1d2„ d2eƒZG d3d4„ d4eƒZG d5d6„ d6eƒZG d7d8„ d8eƒZG d9d:„ d:eƒZG d;d<„ d<eƒZ G d=d>„ d>eƒZ!G d?d@„ d@e!ƒZ"G dAdB„ dBe"ƒZ#G dCdD„ dDe"ƒZ$G dEdF„ dFeƒZ%G dGdH„ dHeƒZ&G dIdJ„ dJeƒZ'G dKdL„ dLeƒZ(G dMdN„ dNe(ƒZ)G dOdP„ dPe(ƒZ*G dQdR„ dRe(ƒZ+G dSdT„ dTe(ƒZ,G dUdV„ dVe(ƒZ-dWS )Xz 
Exceptions in L{twisted.mail}.
é    )ÚOptionalc                   @   s   e Zd ZdS )ÚIMAP4ExceptionN©Ú__name__Ú
__module__Ú__qualname__© r   r   ú8/tmp/pip-unpacked-wheel-audpp6lv/twisted/mail/_except.pyr      s   r   c                   @   s   e Zd ZdS )ÚIllegalClientResponseNr   r   r   r   r	   r
      s   r
   c                   @   s   e Zd ZdS )ÚIllegalOperationNr   r   r   r   r	   r      s   r   c                   @   s   e Zd ZdS )ÚIllegalMailboxEncodingNr   r   r   r   r	   r      s   r   c                   @   s   e Zd ZdS )ÚMailboxExceptionNr   r   r   r   r	   r      s   r   c                   @   s   e Zd Zedœdd„ZdS )ÚMailboxCollision©Úreturnc                 C   s
   d| j  S )NzMailbox named %s already exists©Úargs©Úselfr   r   r	   Ú__str__    s    zMailboxCollision.__str__N©r   r   r   Ústrr   r   r   r   r	   r      s   r   c                   @   s   e Zd Zedœdd„ZdS )ÚNoSuchMailboxr   c                 C   s
   d| j  S )NzNo mailbox named %s existsr   r   r   r   r	   r   %   s    zNoSuchMailbox.__str__Nr   r   r   r   r	   r   $   s   r   c                   @   s   e Zd Zedœdd„ZdS )ÚReadOnlyMailboxr   c                 C   s   dS )NzMailbox open in read-only stater   r   r   r   r	   r   *   s    zReadOnlyMailbox.__str__Nr   r   r   r   r	   r   )   s   r   c                   @   s   e Zd ZdS )ÚUnhandledResponseNr   r   r   r   r	   r   .   s   r   c                   @   s   e Zd ZdS )ÚNegativeResponseNr   r   r   r   r	   r   2   s   r   c                   @   s"   e Zd Zdd„ Zedœdd„ZdS )ÚNoSupportedAuthenticationc                 C   s   t  | d¡ || _|| _d S )Nz-No supported authentication schemes available)r   Ú__init__ÚserverSupportsÚclientSupports)r   r   r   r   r   r	   r   7   s    z"NoSupportedAuthentication.__init__r   c                 C   s   t  | ¡d | j| j¡ S )Nz,: Server supports {!r}, client supports {!r})r   r   Úformatr   r   r   r   r   r	   r   <   s    ÿþþz!NoSupportedAuthentication.__str__N©r   r   r   r   r   r   r   r   r   r	   r   6   s   r   c                   @   s   e Zd ZdS )ÚIllegalServerResponseNr   r   r   r   r	   r"   E   s   r"   c                   @   s   e Zd ZdS )ÚIllegalIdentifierErrorNr   r   r   r   r	   r#   I   s   r#   c                   @   s   e Zd ZdS )ÚIllegalQueryErrorNr   r   r   r   r	   r$   M   s   r$   c                   @   s   e Zd ZdS )ÚMismatchedNestingNr   r   r   r   r	   r%   Q   s   r%   c                   @   s   e Zd ZdS )ÚMismatchedQuotingNr   r   r   r   r	   r&   U   s   r&   c                   @   s   e Zd ZdS )Ú	SMTPErrorNr   r   r   r   r	   r'   Y   s   r'   c                   @   sN   e Zd ZdZdeeee ee eedœdd„Z	e
dœdd	„Zedœd
d„ZdS )ÚSMTPClientErrorz,
    Base class for SMTP client errors.
    NF)ÚcodeÚrespÚlogÚ	addressesÚisFatalÚretryc                 C   sP   t |tƒr| d¡}t |tƒr(| d¡}|| _|| _|| _|| _|| _|| _dS )a  
        @param code: The SMTP response code associated with this error.
        @param resp: The string response associated with this error.
        @param log: A string log of the exchange leading up to and including
            the error.
        @param isFatal: A boolean indicating whether this connection can
            proceed or not. If True, the connection will be dropped.
        @param retry: A boolean indicating whether the delivery should be
            retried. If True and the factory indicates further retries are
            desirable, they will be attempted, otherwise the delivery will be
            failed.
        úutf-8N)	Ú
isinstancer   Úencoder)   r*   r+   r,   r-   r.   ©r   r)   r*   r+   r,   r-   r.   r   r   r	   r   b   s    



zSMTPClientError.__init__r   c                 C   s   |   ¡  d¡S )Nr/   )Ú	__bytes__Údecoder   r   r   r	   r   „   s    zSMTPClientError.__str__c                 C   sT   | j dkr&| j d›d� ¡ | j g}n| jg}| jrJ| | j¡ | d¡ d |¡S )Nr   Z03dú ó    ó   
)r)   r1   r*   r+   ÚappendÚjoin)r   Úresr   r   r	   r3   ‡   s    

zSMTPClientError.__bytes__)NNFF)r   r   r   Ú__doc__ÚintÚbytesr   ÚobjectÚboolr   r   r   r3   r   r   r   r	   r(   ]   s       ùù"r(   c                   @   s   e Zd ZdZdS )ÚESMTPClientErrorz-
    Base class for ESMTP client errors.
    N©r   r   r   r;   r   r   r   r	   r@   ’   s   r@   c                   @   s   e Zd ZdZdS )ÚEHLORequiredErrorz{
    The server does not support EHLO.

    This is considered a non-fatal error (the connection will not be dropped).
    NrA   r   r   r   r	   rB   ˜   s   rB   c                   @   s   e Zd ZdZdS )ÚAUTHRequiredErrorz™
    Authentication was required but the server does not support it.

    This is considered a non-fatal error (the connection will not be dropped).
    NrA   r   r   r   r	   rC       s   rC   c                   @   s   e Zd ZdZdS )ÚTLSRequiredErrorz�
    Transport security was required but the server does not support it.

    This is considered a non-fatal error (the connection will not be dropped).
    NrA   r   r   r   r	   rD   ¨   s   rD   c                   @   s   e Zd ZdZdS )ÚAUTHDeclinedErrorzâ
    The server rejected our credentials.

    Either the username, password, or challenge response
    given to the server was rejected.

    This is considered a non-fatal error (the connection will not be
    dropped).
    NrA   r   r   r   r	   rE   °   s   rE   c                   @   s   e Zd ZdZdS )ÚAuthenticationErrorzñ
    An error occurred while authenticating.

    Either the server rejected our request for authentication or the
    challenge received was malformed.

    This is considered a non-fatal error (the connection will not be
    dropped).
    NrA   r   r   r   r	   rF   ¼   s   rF   c                   @   s   e Zd ZdZdS )ÚSMTPTLSErrorz–
    An error occurred while negiotiating for transport security.

    This is considered a non-fatal error (the connection will not be dropped).
    NrA   r   r   r   r	   rG   È   s   rG   c                   @   s   e Zd ZdZddd„ZdS )ÚSMTPConnectErrorzt
    Failed to connect to the mail exchange host.

    This is considered a fatal error.  A retry will be made.
    NTc              	   C   s   t  | ||||||¡ d S ©N©r(   r   r2   r   r   r	   r   ×   s    zSMTPConnectError.__init__)NNTT©r   r   r   r;   r   r   r   r   r	   rH   Ð   s   rH   c                   @   s   e Zd ZdZddd„ZdS )ÚSMTPTimeoutErrorz‘
    Failed to receive a response from the server in the expected time period.

    This is considered a fatal error.  A retry will be made.
    NTc              	   C   s   t  | ||||||¡ d S rI   rJ   r2   r   r   r	   r   â   s    zSMTPTimeoutError.__init__)NNTTrK   r   r   r   r	   rL   Û   s   rL   c                   @   s   e Zd ZdZddd„ZdS )ÚSMTPProtocolErrorzo
    The server sent a mangled response.

    This is considered a fatal error.  A retry will not be made.
    NTFc              	   C   s   t  | ||||||¡ d S rI   rJ   r2   r   r   r	   r   í   s    zSMTPProtocolError.__init__)NNTFrK   r   r   r   r	   rM   æ   s   rM   c                   @   s   e Zd ZdZdS )ÚSMTPDeliveryErrorz=
    Indicates that a delivery attempt has had an error.
    NrA   r   r   r   r	   rN   ñ   s   rN   c                   @   s"   e Zd Zdd„ Zedœdd„ZdS )ÚSMTPServerErrorc                 C   s   || _ || _d S rI   ©r)   r*   )r   r)   r*   r   r   r	   r   ø   s    zSMTPServerError.__init__r   c                 C   s   d| j | jf S )Nz%.3d %srP   r   r   r   r	   r   ü   s    zSMTPServerError.__str__Nr!   r   r   r   r	   rO   ÷   s   rO   c                   @   s"   e Zd Zdd„ Zedœdd„ZdS )ÚSMTPAddressErrorc                 C   s(   ddl m} t | ||¡ ||ƒ| _d S )Nr   )ÚAddress)Ztwisted.mail.smtprR   rO   r   Úaddr)r   rS   r)   r*   rR   r   r   r	   r     s    zSMTPAddressError.__init__r   c                 C   s   d| j | j| jf S )Nz%.3d <%s>... %s)r)   rS   r*   r   r   r   r	   r     s    zSMTPAddressError.__str__Nr!   r   r   r   r	   rQ      s   rQ   c                   @   s   e Zd Zddd„ZdS )ÚSMTPBadRcpté&  ú$Cannot receive for specified addressc                 C   s   t  | |||¡ d S rI   ©rQ   r   ©r   rS   r)   r*   r   r   r	   r     s    zSMTPBadRcpt.__init__N)rU   rV   ©r   r   r   r   r   r   r   r	   rT     s   rT   c                   @   s   e Zd Zddd„ZdS )ÚSMTPBadSenderrU   úSender not acceptablec                 C   s   t  | |||¡ d S rI   rW   rX   r   r   r	   r     s    zSMTPBadSender.__init__N)rU   r[   rY   r   r   r   r	   rZ     s   rZ   c                   @   s   e Zd ZdZdS )ÚAddressErrorz 
    Parse error in address
    NrA   r   r   r   r	   r\     s   r\   c                   @   s   e Zd ZdZdS )Ú	POP3Errorz)
    The base class for POP3 errors.
    NrA   r   r   r   r	   r]     s   r]   c                   @   s   e Zd ZdZdS )Ú_POP3MessageDeletedzb
    An internal control-flow error which indicates that a deleted message was
    requested.
    NrA   r   r   r   r	   r^   #  s   r^   c                   @   s   e Zd ZdZdS )ÚPOP3ClientErrorzA
    The base class for all exceptions raised by POP3Client.
    NrA   r   r   r   r	   r_   *  s   r_   c                   @   s   e Zd ZdZdS )Ú InsecureAuthenticationDisallowedze
    An error indicating secure authentication was required but no mechanism
    could be found.
    NrA   r   r   r   r	   r`   0  s   r`   c                   @   s   e Zd ZdZdS )ÚTLSErrorzš
    An error indicating secure authentication was required but either the
    transport does not support TLS or no TLS context factory was supplied.
    NrA   r   r   r   r	   ra   7  s   ra   c                   @   s   e Zd ZdZdS )ÚTLSNotSupportedErrorzi
    An error indicating secure authentication was required but the server does
    not support TLS.
    NrA   r   r   r   r	   rb   >  s   rb   c                   @   s   e Zd ZdZddd„ZdS )ÚServerErrorResponsez
    An error indicating that the server returned an error response to a
    request.

    @ivar consumer: See L{__init__}
    Nc                 C   s   t  | |¡ || _dS )a  
        @type reason: L{bytes}
        @param reason: The server response minus the status indicator.

        @type consumer: callable that takes L{object}
        @param consumer: The function meant to handle the values for a
            multi-line response.
        N)r_   r   Úconsumer)r   Úreasonrd   r   r   r	   r   M  s    	zServerErrorResponse.__init__)NrK   r   r   r   r	   rc   E  s   rc   c                   @   s   e Zd ZdZdS )ÚLineTooLongz†
    An error indicating that the server sent a line which exceeded the
    maximum line length (L{LineOnlyReceiver.MAX_LENGTH}).
    NrA   r   r   r   r	   rf   Z  s   rf   N).r;   Útypingr   Ú	Exceptionr   r
   r   r   r   r   r   r   r   r   r   r"   r#   r$   r%   r&   r'   r(   r@   rB   rC   rD   rE   rF   rG   rH   rL   rM   rN   rO   rQ   rT   rZ   r\   r]   r^   r_   r`   ra   rb   rc   rf   r   r   r   r	   Ú<module>   sV   5	