o
    ¯b"  ã                   @   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                   @   ó   e Zd ZdS )ÚIMAP4ExceptionN©Ú__name__Ú
__module__Ú__qualname__© r	   r	   ú6/usr/lib/python3/dist-packages/twisted/mail/_except.pyr      ó    r   c                   @   r   )ÚIllegalClientResponseNr   r	   r	   r	   r
   r      r   r   c                   @   r   )ÚIllegalOperationNr   r	   r	   r	   r
   r      r   r   c                   @   r   )ÚIllegalMailboxEncodingNr   r	   r	   r	   r
   r      r   r   c                   @   r   )ÚMailboxExceptionNr   r	   r	   r	   r
   r      r   r   c                   @   ó   e Zd Zdefdd„ZdS )ÚMailboxCollisionÚreturnc                 C   ó
   d| j  S )NzMailbox named %s already exists©Úargs©Úselfr	   r	   r
   Ú__str__    ó   
zMailboxCollision.__str__N©r   r   r   Ústrr   r	   r	   r	   r
   r      ó    r   c                   @   r   )ÚNoSuchMailboxr   c                 C   r   )NzNo mailbox named %s existsr   r   r	   r	   r
   r   %   r   zNoSuchMailbox.__str__Nr   r	   r	   r	   r
   r   $   r   r   c                   @   r   )Ú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   )   r   r   c                   @   r   )ÚUnhandledResponseNr   r	   r	   r	   r
   r   .   r   r   c                   @   r   )ÚNegativeResponseNr   r	   r	   r	   r
   r    2   r   r    c                   @   ó"   e Zd Zdd„ Zdef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                   @   r   )ÚIllegalServerResponseNr   r	   r	   r	   r
   r(   E   r   r(   c                   @   r   )ÚIllegalIdentifierErrorNr   r	   r	   r	   r
   r)   I   r   r)   c                   @   r   )ÚIllegalQueryErrorNr   r	   r	   r	   r
   r*   M   r   r*   c                   @   r   )ÚMismatchedNestingNr   r	   r	   r	   r
   r+   Q   r   r+   c                   @   r   )ÚMismatchedQuotingNr   r	   r	   r	   r
   r,   U   r   r,   c                   @   r   )Ú	SMTPErrorNr   r	   r	   r	   r
   r-   Y   r   r-   c                   @   s`   e Zd ZdZ				ddededee dee ded	efd
d„Z	de
fdd„Zdef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/   r0   r1   r2   r3   r4   ©r   r/   r0   r1   r2   r3   r4   r	   r	   r
   r#   b   s   




zSMTPClientError.__init__r   c                 C   s   |   ¡  d¡S )Nr5   )Ú	__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r%| | j¡ | d¡ d |¡S )Nr   Ú03dú ó    ó   
)r/   r7   r0   r1   ÚappendÚjoin)r   Úresr	   r	   r
   r9   ‡   s   


zSMTPClientError.__bytes__)NNFF)r   r   r   Ú__doc__ÚintÚbytesr   ÚobjectÚboolr#   r   r   r9   r	   r	   r	   r
   r.   ]   s*    ùþýüûú
ù"r.   c                   @   ó   e Zd ZdZdS )ÚESMTPClientErrorz-
    Base class for ESMTP client errors.
    N©r   r   r   rB   r	   r	   r	   r
   rH   ’   ó    rH   c                   @   rG   )ÚEHLORequiredErrorz{
    The server does not support EHLO.

    This is considered a non-fatal error (the connection will not be dropped).
    NrI   r	   r	   r	   r
   rK   ˜   rJ   rK   c                   @   rG   )ÚAUTHRequiredErrorz™
    Authentication was required but the server does not support it.

    This is considered a non-fatal error (the connection will not be dropped).
    NrI   r	   r	   r	   r
   rL       rJ   rL   c                   @   rG   )Ú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).
    NrI   r	   r	   r	   r
   rM   ¨   rJ   rM   c                   @   rG   )Ú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).
    NrI   r	   r	   r	   r
   rN   °   rJ   rN   c                   @   rG   )Ú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).
    NrI   r	   r	   r	   r
   rO   ¼   rJ   rO   c                   @   rG   )ÚSMTPTLSErrorz–
    An error occurred while negiotiating for transport security.

    This is considered a non-fatal error (the connection will not be dropped).
    NrI   r	   r	   r	   r
   rP   È   rJ   rP   c                   @   ó   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   ó   t  | ||||||¡ d S ©N©r.   r#   r8   r	   r	   r
   r#   ×   ó   zSMTPConnectError.__init__©NNTT©r   r   r   rB   r#   r	   r	   r	   r
   rR   Ð   ó    rR   c                   @   rQ   )Ú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   rS   rT   rU   r8   r	   r	   r
   r#   â   rV   zSMTPTimeoutError.__init__rW   rX   r	   r	   r	   r
   rZ   Û   rY   rZ   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   rS   rT   rU   r8   r	   r	   r
   r#   í   rV   zSMTPProtocolError.__init__)NNTFrX   r	   r	   r	   r
   r[   æ   rY   r[   c                   @   rG   )ÚSMTPDeliveryErrorz=
    Indicates that a delivery attempt has had an error.
    NrI   r	   r	   r	   r
   r\   ñ   rJ   r\   c                   @   r!   )ÚSMTPServerErrorc                 C   s   || _ || _d S rT   ©r/   r0   )r   r/   r0   r	   r	   r
   r#   ø   s   
zSMTPServerError.__init__r   c                 C   s   d| j | jf S )Nz%.3d %sr^   r   r	   r	   r
   r   ü   s   zSMTPServerError.__str__Nr'   r	   r	   r	   r
   r]   ÷   s    r]   c                   @   r!   )ÚSMTPAddressErrorc                 C   s(   ddl m} t | ||¡ ||ƒ| _d S )Nr   )ÚAddress)Útwisted.mail.smtpr`   r]   r#   Úaddr)r   rb   r/   r0   r`   r	   r	   r
   r#     s   zSMTPAddressError.__init__r   c                 C   s   d| j | j| jf S )Nz%.3d <%s>... %s)r/   rb   r0   r   r	   r	   r
   r     ó   zSMTPAddressError.__str__Nr'   r	   r	   r	   r
   r_      s    r_   c                   @   ó   e Zd Zddd„ZdS )ÚSMTPBadRcpté&  ú$Cannot receive for specified addressc                 C   ó   t  | |||¡ d S rT   ©r_   r#   ©r   rb   r/   r0   r	   r	   r
   r#     rc   zSMTPBadRcpt.__init__N)rf   rg   ©r   r   r   r#   r	   r	   r	   r
   re     ó    re   c                   @   rd   )ÚSMTPBadSenderrf   úSender not acceptablec                 C   rh   rT   ri   rj   r	   r	   r
   r#     rc   zSMTPBadSender.__init__N)rf   rn   rk   r	   r	   r	   r
   rm     rl   rm   c                   @   rG   )ÚAddressErrorz 
    Parse error in address
    NrI   r	   r	   r	   r
   ro     rJ   ro   c                   @   rG   )Ú	POP3Errorz)
    The base class for POP3 errors.
    NrI   r	   r	   r	   r
   rp     s    rp   c                   @   rG   )Ú_POP3MessageDeletedzb
    An internal control-flow error which indicates that a deleted message was
    requested.
    NrI   r	   r	   r	   r
   rq   #  rJ   rq   c                   @   rG   )ÚPOP3ClientErrorzA
    The base class for all exceptions raised by POP3Client.
    NrI   r	   r	   r	   r
   rr   *  rJ   rr   c                   @   rG   )Ú InsecureAuthenticationDisallowedze
    An error indicating secure authentication was required but no mechanism
    could be found.
    NrI   r	   r	   r	   r
   rs   0  rJ   rs   c                   @   rG   )ÚTLSErrorzš
    An error indicating secure authentication was required but either the
    transport does not support TLS or no TLS context factory was supplied.
    NrI   r	   r	   r	   r
   rt   7  rJ   rt   c                   @   rG   )ÚTLSNotSupportedErrorzi
    An error indicating secure authentication was required but the server does
    not support TLS.
    NrI   r	   r	   r	   r
   ru   >  rJ   ru   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)rr   r#   Úconsumer)r   Úreasonrw   r	   r	   r
   r#   M  s   	
zServerErrorResponse.__init__rT   rX   r	   r	   r	   r
   rv   E  s    rv   c                   @   rG   )ÚLineTooLongz†
    An error indicating that the server sent a line which exceeded the
    maximum line length (L{LineOnlyReceiver.MAX_LENGTH}).
    NrI   r	   r	   r	   r
   ry   Z  rJ   ry   N).rB   Útypingr   Ú	Exceptionr   r   r   r   r   r   r   r   r   r    r"   r(   r)   r*   r+   r,   r-   r.   rH   rK   rL   rM   rN   rO   rP   rR   rZ   r[   r\   r]   r_   re   rm   ro   rp   rq   rr   rs   rt   ru   rv   ry   r	   r	   r	   r
   Ú<module>   sX   5	