%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3.12/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3.12/__pycache__/imaplib.cpython-312.pyc

�

���f����d�dZdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZmZm
Z
ddlmZ	ddlZdZgd�Zd	ZdZd
ZdZdZd
Zidd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�d d�d!d�d"d�d#d�id$d�d%d�d&d�d'd�d(d�d)d�d*d�d+d�d,d�d-d�d.d�d/d�d0d�d1d�d2d�d3d�d4d��ddddddddd5��Zej6d6�Zej6d7�Zej6d8�Zej6d9ej>�Z ej6d:�Z!ej6d;�Z"ej6d<�Z#ej6d=ej>�Z$d9Z%d=Z&Gd>�d?�Z'erGd@�dAe'�Z(ejSdA�GdB�dCe'�Z*GdD�dE�Z+dFjYdG�Z-e.e-dHd�D��cic]\}}|j_�|dHz��c}}Z0dI�Z1dJ�Z2dK�Z3dL�Z4e5dMk(�r�ddl6Z6ddl7Z7	e6jlejpdHddN�\Z9Z:dZ=e9D]!\Z>Z<e>dPk(r	e?e<�Z�e>dQk(s�e<Z=e:r�e=fZ:�#e:sdRZ:e:dZ@e7j��ZBe7jndSeB�dTe@xsdU�dV��ZCdWeBdXdY�zZDdZeBeCffd[d\d]d^d_ddeDffd`dadbdcdddedfdgdhfZEdidjdkdld^dddeDffdgdmfZFdn�ZG	e=r	e*e=�ZHne'e@�ZHeHj�dok(reEdHdZEeHj�dpeHj�z�eHj�dqeHj����eED]\ZMZ:eGeMe:��eGdrds�D]FZNej�dteN�ZPePrePj�dH�ZRneNjY�duZReGdveRf��HeFD]>\ZMZ:eGeMe:�ZSeMe:fdkk7r�eSdujY�ZTeTs�-eGdwddxeTduzdyf��@eUdz�yy#e$rdZY���wxYwcc}}w#e6jv$rZ<dO\Z9Z:YdZ<[<���dZ<[<wwxYw#eUd{�eseUd|ejpdz��xYw)}z�IMAP4 client.

Based on RFC 2060.

Public class:           IMAP4
Public variable:        Debug
Public functions:       Internaldate2tuple
                        Int2AP
                        ParseFlags
                        Time2Internaldate
z2.58�N)�datetime�timezone�	timedelta)�DEFAULT_BUFFER_SIZETF)�IMAP4�IMAP4_stream�Internaldate2tuple�Int2AP�
ParseFlags�Time2Internaldate�
�i�)�	IMAP4REV1ri@B�APPEND)�AUTH�SELECTED�AUTHENTICATE)�NONAUTH�
CAPABILITY)rrr�LOGOUT�CHECK)r�CLOSE�COPY�CREATE�DELETE�	DELETEACL�ENABLE)r�EXAMINE�EXPUNGE�FETCH�GETACL�
GETANNOTATION�GETQUOTA�GETQUOTAROOT�MYRIGHTS�LIST�LOGINr�LSUB�MOVE�	NAMESPACE�NOOP�PARTIAL�	PROXYAUTH�RENAME�SEARCH�SELECT�SETACL�
SETANNOTATION�SETQUOTA�SORT)�STARTTLS�STATUS�STORE�	SUBSCRIBE�THREAD�UID�UNSUBSCRIBE�UNSELECTs\+( (?P<data>.*))?s.*FLAGS \((?P<flags>[^\)]*)\)s�.*INTERNALDATE "(?P<day>[ 0123][0-9])-(?P<mon>[A-Z][a-z][a-z])-(?P<year>[0-9][0-9][0-9][0-9]) (?P<hour>[0-9][0-9]):(?P<min>[0-9][0-9]):(?P<sec>[0-9][0-9]) (?P<zonen>[-+])(?P<zoneh>[0-9][0-9])(?P<zonem>[0-9][0-9])"s.*{(?P<size>\d+)}$s
\r\n|\r|\ns%\[(?P<type>[A-Z-]+)( (?P<data>.*))?\]s$\* (?P<type>[A-Z-]+)( (?P<data>.*))?s3\* (?P<data>\d+) (?P<type>[A-Z-]+)( (?P<data2>.*))?c�8�eZdZdZGd�de�ZGd�de�ZGd�de�Zded	fd
�Z	d�Z
d�Zd
�Zd�Z
d�Zd�Zd�Zded	fd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd �Zd!�Z d"�Z!d#�Z"d$�Z#d%�Z$d&�Z%d'�Z&d(�Z'd)�Z(dVd*�Z)d+�Z*d,�Z+d-�Z,d.�Z-dVd/�Z.d0�Z/d1�Z0d2�Z1d3�Z2d4�Z3d5�Z4d6�Z5dWd7�Z6d8�Z7d9�Z8d:�Z9d;�Z:dXd<�Z;d=�Z<d>�Z=d?�Z>d@�Z?dA�Z@dB�ZAdC�ZBdD�ZCdE�ZDdF�ZEdG�ZFdH�ZGdI�ZHdJ�ZIdYdK�ZJdL�ZKdM�ZLdN�ZMdO�ZNdP�ZOdQ�ZP	dXdR�ZQdS�ZRdT�ZSdU�ZTy	)Zra�IMAP4 client class.

    Instantiate with: IMAP4([host[, port[, timeout=None]]])

            host - host's name (default: localhost);
            port - port number (default: standard IMAP4 port).
            timeout - socket timeout (default: None)
                      If timeout is not given or is None,
                      the global default socket timeout is used

    All IMAP4rev1 commands are supported by methods of the same
    name (in lowercase).

    All arguments to commands are converted to strings, except for
    AUTHENTICATE, and the last argument to APPEND which is passed as
    an IMAP4 literal.  If necessary (the string contains any
    non-printing characters or white-space and isn't enclosed with
    either parentheses or double quotes) each string is quoted.
    However, the 'password' argument to the LOGIN command is always
    quoted.  If you want to avoid having an argument string quoted
    (eg: the 'flags' argument to STORE) then enclose the string in
    parentheses (eg: "(\Deleted)").

    Each command returns a tuple: (type, [data, ...]) where 'type'
    is usually 'OK' or 'NO', and 'data' is either the text from the
    tagged response, or untagged results from command. Each 'data'
    is either a string, or a tuple. If a tuple, then the first part
    is the header of the response, and the second part contains
    the data (ie: 'literal' value).

    Errors raise the exception class <instance>.error("<reason>").
    IMAP4 server errors raise <instance>.abort("<reason>"),
    which is a sub-class of 'error'. Mailbox status changes
    from READ-WRITE to READ-ONLY raise the exception class
    <instance>.readonly("<reason>"), which is a sub-class of 'abort'.

    "error" exceptions imply a program error.
    "abort" exceptions imply the connection should be reset, and
            the command re-tried.
    "readonly" exceptions imply the command should be re-tried.

    Note: to use this module, you must read the RFCs pertaining to the
    IMAP4 protocol, as the semantics of the arguments to each IMAP4
    command are left to the invoker, not to mention the results. Also,
    most IMAP servers implement a sub-set of the commands available here.
    c��eZdZy)�IMAP4.errorN��__name__�
__module__�__qualname__���/usr/lib/python3.12/imaplib.py�errorr?���rErGc��eZdZy)�IMAP4.abortNr@rDrErF�abortrJ�rHrErKc��eZdZy)�IMAP4.readonlyNr@rDrErF�readonlyrM�rHrErN�Nc�N�t|_d|_d|_i|_i|_d|_d|_d|_d|_	|j�|j|||�	|j�y#t$r"	|j��#t$rY�wxYwwxYw)NrrOFr)�Debug�debug�state�literal�tagged_commands�untagged_responses�continuation_response�is_readonly�tagnum�_tls_established�_mode_ascii�open�_connect�	Exception�shutdown�OSError��self�host�port�timeouts    rF�__init__zIMAP4.__init__�s�����
���
����!���"$���%'��"� ������ %�������	
�	�	�$��g�&�	��M�M�O���	�
��
�
��
���
���
��	�s0�(A9�9	B$�B�B$�	B �B$�B � B$c���d|_d|_tjttj
�|_tjttj
�|_y)NF�ascii)	�utf8_enabled�	_encoding�re�compile�_Literal�ASCII�Literal�_Untagged_status�Untagged_status�rbs rFr[zIMAP4._mode_ascii�s?��!��� ����z�z�(�B�H�H�5���!�z�z�*:�B�H�H�E��rEc��d|_d|_tjt�|_tjt�|_y)NT�utf-8)rirjrkrlrmrorprqrrs rF�
_mode_utf8zIMAP4._mode_utf8�s3�� ��� ����z�z�(�+���!�z�z�*:�;��rEc��ttjdd��|_t	j
d|jzdztj�|_	d|_d|_	i|_
|jdk\r6|jdtz�|jd	|jz�|j�|_d
|j vrd|_n1d|j vrd
|_n|j%|j��|j'�	|jdk\r|jd|j(���t*D]}||j(vr�||_y|j%d��)Nii��s(?P<tag>s"\d+) (?P<type>[A-Z]+) (?P<data>.*)�
r�zimaplib version %sznew IMAP4 connection, tag=%s�PREAUTHr�OKr�zCAPABILITIES: zserver not IMAP4 compliant)r
�random�randint�tagprerkrlrn�tagre�_cmd_log_len�_cmd_log_idx�_cmd_logrR�_mesg�__version__�
_get_response�welcomerVrSrG�_get_capabilities�capabilities�AllowedVersions�PROTOCOL_VERSION)rb�versions  rFr]zIMAP4._connect�sR���V�^�^�D�%�8�9����Z�Z���+�+�!&�@�!A�BD�(�(�L��
�� "�D�� !�D���D�M��z�z�Q���
�
�/�+�=�>��
�
�9�D�K�K�G�H��)�)�+�����/�/�/��D�J�
�T�,�,�
,�"�D�J��*�*�T�\�\�*�*���� ���z�z�Q���
�
��1B�1B�D�E�&�	�G��d�/�/�/��$+�D�!��		��j�j�5�6�6rEc�b�|tvrt||j��Std|z��)NzUnknown IMAP4 command: '%s')�Commands�getattr�lower�AttributeError)rb�attrs  rF�__getattr__zIMAP4.__getattr__
s.���8���4�����.�.��:�T�A�B�BrEc��|S�NrDrrs rF�	__enter__zIMAP4.__enter__s���rEc�d�|jdk(ry	|j�y#t$rYywxYw)Nr)rS�logoutr`)rb�argss  rF�__exit__zIMAP4.__exit__s1���:�:��!��	��K�K�M���	��	�s�#�	/�/c�"�|�
|std��|jsdn|j}tjd||j|j�||jf}|�tj||�Stj|�S)Nz0Non-blocking socket (timeout=0) is not supportedzimaplib.open)�
ValueErrorrc�sys�auditrd�socket�create_connection)rbrerc�addresss    rF�_create_socketzIMAP4._create_socket#s{����w��O�P�P��9�9�t�$�)�)���	�	�.�$��	�	�4�9�9�=�����#�����+�+�G�W�=�=��'�'��0�0rEc��||_||_|j|�|_|jj	d�|_y)z�Setup connection to remote server on "host:port"
            (default: localhost:standard IMAP4 port).
        This connection will be used by the routines:
            read, readline, send, shutdown.
        �rbN)rcrdr��sock�makefile�fileras    rFr\z
IMAP4.open0s:����	���	��'�'��0��	��I�I�&�&�t�,��	rEc�8�|jj|�S�zRead 'size' bytes from remote.)r��read�rb�sizes  rFr�z
IMAP4.read<s���y�y�~�~�d�#�#rEc��|jjtdz�}t|�tkDr|j	dtz��|S)�Read line from remote.rxzgot more than %d bytes)r��readline�_MAXLINE�lenrG�rb�lines  rFr�zIMAP4.readlineAs@���y�y�!�!�(�Q�,�/���t�9�x���*�*�5��@�A�A��rEc�h�tjd||�|jj|�y)�Send data to remote.zimaplib.sendN)r�r�r��sendall�rb�datas  rF�sendz
IMAP4.sendIs$���	�	�.�$��-��	�	���$�rEc��|jj�	|jjtj
�|jj�y#t$r8}|jtjk7rt|dd�dk7r�Yd}~�Wd}~wwxYw#|jj�wxYw)� Close I/O established in "open".�winerrorri&'N)
r��closer�r_r��	SHUT_RDWRr`�errno�ENOTCONNr�)rb�excs  rFr_zIMAP4.shutdownOs����	�	����
	��I�I���v�/�/�0�
�I�I�O�O����	��	�	�U�^�^�+��3�
�A�.�%�7����
	��
�I�I�O�O��s)�)A � 	B!�).B�B$�B!�!B$�$Cc��|jS)zfReturn socket instance used to connect to IMAP4 server.

        socket = <instance>.socket()
        )r�rrs rFr�zIMAP4.socket_s��
�y�y�rEc��d}|jddg|�\}}|dr||fS|j�\}}|j|||�S)aReturn most recent 'RECENT' responses if any exist,
        else prompt server for an update using the 'NOOP' command.

        (typ, [data]) = <instance>.recent()

        'data' is None if no new messages,
        else list of RECENT responses, most recent last.
        �RECENTrzN���)�_untagged_response�noop�rb�name�typ�dats    rF�recentzIMAP4.recentksW�����*�*�4�$���>���S��r�7���8�O��9�9�;���S��&�&�s�C��6�6rEc�F�|j|dg|j��S)z�Return data for response 'code' if received, or None.

        Old value for response 'code' is cleared.

        (code, [data]) = <instance>.response(code)
        N)r��upper)rb�codes  rF�responsezIMAP4.response|s!���&�&�t�d�V�T�Z�Z�\�B�BrEc���d}|sd}|r|d|dfdk7rd|z}nd}|rt|�}nd}tjt|�}|jrd|zd	z}||_|j
||||�S)
z�Append message to named mailbox.

        (typ, [data]) = <instance>.append(mailbox, flags, date_time, message)

                All args except `message' can be None.
        r�INBOXrr���(�)�(%s)NsUTF8 (�))r�MapCRLF�sub�CRLFrirT�_simple_command)rb�mailbox�flags�	date_time�messager�rTs       rF�appendzIMAP4.append�s�������G���a���r��#�y�0������E��)�)�4�I��I��+�+�d�G�,������'�)�D�0�G�����#�#�D�'�5�)�D�DrEc���|j�}t|�j|_|j	d|�\}}|dk7r$|j|dj
dd���d|_||fS)asAuthenticate command - requires response processing.

        'mechanism' specifies which authentication mechanism is to
        be used - it must appear in <instance>.capabilities in the
        form AUTH=<mechanism>.

        'authobject' must be a callable object:

                data = authobject(response)

        It will be called to process server continuation responses; the
        response argument it is passed will be a bytes.  It should return bytes
        data that will be base64 encoded and sent to the server.  It should
        return None if the client abort response '*' should be sent instead.
        rrzr�rt�replacer)r��_Authenticator�processrTr�rG�decoderS)rb�	mechanism�
authobject�mechr�r�s      rF�authenticatezIMAP4.authenticate�so�� ��� ��
&�j�1�9�9����'�'���=���S��$�;��*�*�S��W�^�^�G�Y�?�@�@���
��C�x�rEc�T�d}|j|�\}}|j|||�S)zT(typ, [data]) = <instance>.capability()
        Fetch capabilities list from server.r�r�r�r�s    rF�
capabilityzIMAP4.capability�s2�����'�'��-���S��&�&�s�C��6�6rEc�$�|jd�S)zRCheckpoint mailbox on server.

        (typ, [data]) = <instance>.check()
        r�r�rrs rF�checkzIMAP4.check�s��
�#�#�G�,�,rEc�Z�	|jd�\}}d|_||fS#d|_wxYw)z�Close currently selected mailbox.

        Deleted messages are removed from writable mailbox.
        This is the recommended command before 'LOGOUT'.

        (typ, [data]) = <instance>.close()
        rr�r�rS�rbr�r�s   rFr�zIMAP4.close�s6��	 ��+�+�G�4�H�C���D�J��C�x��� �D�J���!�	*c�(�|jd||�S)z�Copy 'message_set' messages onto end of 'new_mailbox'.

        (typ, [data]) = <instance>.copy(message_set, new_mailbox)
        rr�)rb�message_set�new_mailboxs   rF�copyz
IMAP4.copy�s��
�#�#�F�K��E�ErEc�&�|jd|�S)zPCreate new mailbox.

        (typ, [data]) = <instance>.create(mailbox)
        rr��rbr�s  rF�createzIMAP4.create����
�#�#�H�g�6�6rEc�&�|jd|�S)zPDelete old mailbox.

        (typ, [data]) = <instance>.delete(mailbox)
        rr�r�s  rF�deletezIMAP4.delete�r�rEc�(�|jd||�S)z�Delete the ACLs (remove any rights) set for who on mailbox.

        (typ, [data]) = <instance>.deleteacl(mailbox, who)
        rr�)rbr��whos   rF�	deleteaclzIMAP4.deleteacl�s��
�#�#�K��#�>�>rEc���d|jvrtjd��|jd|�\}}|dk(r"d|j	�vr|j�||fS)zlSend an RFC5161 enable string to the server.

        (typ, [data]) = <instance>.enable(capability)
        rzServer does not support ENABLErzzUTF8=ACCEPT)r�rrGr�r�ru)rbr�r�r�s    rF�enablezIMAP4.enable�sc��
�4�,�,�,��+�+�>�?�?��(�(��:�>�	��T��$�;�=�J�,<�,<�,>�>��O�O���D�y�rEc�T�d}|j|�\}}|j|||�S)z�Permanently remove deleted items from selected mailbox.

        Generates 'EXPUNGE' response for each deleted message.

        (typ, [data]) = <instance>.expunge()

        'data' is list of 'EXPUNGE'd message numbers in order received.
        rr�r�s    rF�expungez
IMAP4.expunges2�����'�'��-���S��&�&�s�C��6�6rEc�X�d}|j|||�\}}|j|||�S)a#Fetch (parts of) messages.

        (typ, [data, ...]) = <instance>.fetch(message_set, message_parts)

        'message_parts' should be a string of selected parts
        enclosed in parentheses, eg: "(UID BODY[TEXT])".

        'data' are tuples of message part envelope and data.
        r r�)rbr��
message_partsr�r�r�s      rF�fetchzIMAP4.fetchs6�����'�'��k�=�I���S��&�&�s�C��6�6rEc�R�|jd|�\}}|j||d�S)zXGet the ACLs for a mailbox.

        (typ, [data]) = <instance>.getacl(mailbox)
        r!�ACLr��rbr�r�r�s    rF�getaclzIMAP4.getacl(s/��
�'�'��'�:���S��&�&�s�C��7�7rEc�V�|jd|||�\}}|j||d�S)za(typ, [data]) = <instance>.getannotation(mailbox, entry, attribute)
        Retrieve ANNOTATIONs.r"�
ANNOTATIONr�)rbr��entry�	attributer�r�s      rF�
getannotationzIMAP4.getannotation1s3���'�'���%��S���S��&�&�s�C��>�>rEc�R�|jd|�\}}|j||d�S)z�Get the quota root's resource usage and limits.

        Part of the IMAP4 QUOTA extension defined in rfc2087.

        (typ, [data]) = <instance>.getquota(root)
        r#�QUOTAr�)rb�rootr�r�s    rF�getquotazIMAP4.getquota9s/���'�'�
�D�9���S��&�&�s�C��9�9rEc��|jd|�\}}|j||d�\}}|j||d�\}}|||gfS)z�Get the list of quota roots for the named mailbox.

        (typ, [[QUOTAROOT responses...], [QUOTA responses]]) = <instance>.getquotaroot(mailbox)
        r$r�	QUOTAROOTr�)rbr�r�r��quota�	quotaroots      rF�getquotarootzIMAP4.getquotarootDsZ��
�'�'���@���S��,�,�S�#�w�?�
��U��0�0��c�;�G���Y��Y��&�&�&rEc�X�d}|j|||�\}}|j|||�S)z�List mailbox names in directory matching pattern.

        (typ, [data]) = <instance>.list(directory='""', pattern='*')

        'data' is list of LIST responses.
        r&r��rb�	directory�patternr�r�r�s      rF�listz
IMAP4.listO�6�����'�'��i��A���S��&�&�s�C��6�6rEc��|jd||j|��\}}|dk7r|j|d��d|_||fS)z�Identify client using plaintext password.

        (typ, [data]) = <instance>.login(user, password)

        NB: 'password' will be quoted.
        r'rzr�r)r��_quoterGrS)rb�user�passwordr�r�s     rF�loginzIMAP4.login[sO���'�'���t�{�{�8�7L�M���S��$�;��*�*�S��W�%�%���
��C�x�rEc�X�||c|_|_|jd|j�S)zr Force use of CRAM-MD5 authentication.

        (typ, [data]) = <instance>.login_cram_md5(user, password)
        zCRAM-MD5)r!r"r��_CRAM_MD5_AUTH)rbr!r"s   rF�login_cram_md5zIMAP4.login_cram_md5is-��
$(�� ��	�4�=�� � ��T�-@�-@�A�ArEc���ddl}t|jt�r|jj	d�n|j}|j
dz|j
||d�j�zS)z1 Authobject to use with CRAM-MD5 authentication. rNrt� �md5)�hmac�
isinstancer"�str�encoder!�HMAC�	hexdigest)rb�	challenger*�pwds    rFr%zIMAP4._CRAM_MD5_AUTHrsY���0:�4�=�=�#�0N�t�}�}�#�#�G�,�26�-�-�	��y�y�3�����3�	�5�!A�!K�!K�!M�M�MrEc�`�d|_|jd�\}}|j�||fS)z|Shutdown connection to server.

        (typ, [data]) = <instance>.logout()

        Returns server 'BYE' response.
        r)rSr�r_r�s   rFr�zIMAP4.logoutzs1����
��'�'��1���S��
�
���C�x�rEc�X�d}|j|||�\}}|j|||�S)z�List 'subscribed' mailbox names in directory matching pattern.

        (typ, [data, ...]) = <instance>.lsub(directory='""', pattern='*')

        'data' are tuples of message part envelope and data.
        r(r�rs      rF�lsubz
IMAP4.lsub�rrEc�R�|jd|�\}}|j||d�S)z�Show my ACLs for a mailbox (i.e. the rights that I have on mailbox).

        (typ, [data]) = <instance>.myrights(mailbox)
        r%r�r	s    rF�myrightszIMAP4.myrights�s/��
�&�&�z�7�;���C��&�&�s�C��<�<rEc�T�d}|j|�\}}|j|||�S)zb Returns IMAP namespaces ala rfc2342

        (typ, [data, ...]) = <instance>.namespace()
        r*r�r�s    rF�	namespacezIMAP4.namespace�s2��
���'�'��-���S��&�&�s�C��6�6rEc�z�	|jdk\r|j|j�|jd�S)zFSend NOOP command.

        (typ, [data]) = <instance>.noop()
        r{r+)rR�_dump_urrVr�rrs rFr�z
IMAP4.noop�s5��
��z�z�Q���
�
�d�5�5�6��#�#�F�+�+rEc�\�d}|j|||||�\}}|j||d�S)z�Fetch truncated part of a message.

        (typ, [data, ...]) = <instance>.partial(message_num, message_part, start, length)

        'data' is tuple of message part envelope and data.
        r,r r�)rb�message_num�message_part�start�lengthr�r�r�s        rF�partialz
IMAP4.partial�s;�����'�'��k�<��PV�W���S��&�&�s�C��9�9rEc�*�d}|jd|�S)z�Assume authentication as "user".

        Allows an authorised administrator to proxy into any user's
        mailbox.

        (typ, [data]) = <instance>.proxyauth(user)
        r-r�)rbr!r�s   rF�	proxyauthzIMAP4.proxyauth�s�����#�#�K��6�6rEc�(�|jd||�S)zkRename old mailbox name to new.

        (typ, [data]) = <instance>.rename(oldmailbox, newmailbox)
        r.r�)rb�
oldmailbox�
newmailboxs   rF�renamezIMAP4.rename�s��
�#�#�H�j�*�E�ErEc���d}|r:|jrtjd��|j|d|g|���\}}n|j|g|���\}}|j	|||�S)z�Search mailbox for matching messages.

        (typ, [data]) = <instance>.search(charset, criterion, ...)

        'data' is space separated list of matching message numbers.
        If UTF8 is enabled, charset MUST be None.
        r/z'Non-None charset not valid in UTF8 mode�CHARSET)rirrGr�r�)rb�charset�criteriar�r�r�s      rF�searchzIMAP4.search�st������ � ��k�k�"K�L�L�+�t�+�+�D�)�W�P�x�P�H�C��+�t�+�+�D�<�8�<�H�C���&�&�s�C��6�6rEc�`�i|_||_|rd}nd}|j||�\}}|dk7rd|_||fSd|_d|jvrA|s?	|jdk\r|j|j�|j
d|z��||jjd	d
g�fS)atSelect a mailbox.

        Flush all untagged responses.

        (typ, [data]) = <instance>.select(mailbox='INBOX', readonly=False)

        'data' is count of messages in mailbox ('EXISTS' response).

        Mandated responses are ('FLAGS', 'EXISTS', 'RECENT', 'UIDVALIDITY'), so
        other responses should be obtained via <instance>.response('FLAGS') etc.
        rr0rzrr�	READ-ONLYrxz%s is not writable�EXISTSN)rVrXr�rSrRr:rN�get)rbr�rNr�r�r�s      rF�selectzIMAP4.select�s���#%���#�����D��D��'�'��g�6���S��$�;��D�J���8�O���
��$�1�1�1� ���:�:��?��M�M�$�"9�"9�:��-�-� 4�w� >�?�?��D�+�+�/�/��4�&�A�A�ArEc�*�|jd|||�S)zZSet a mailbox acl.

        (typ, [data]) = <instance>.setacl(mailbox, who, what)
        r1r�)rbr�r��whats    rF�setaclzIMAP4.setacls��
�#�#�H�g�s�D�A�ArEc�T�|jdg|���\}}|j||d�S)z_(typ, [data]) = <instance>.setannotation(mailbox[, entry, attribute]+)
        Set ANNOTATIONs.r2rr�)rbr�r�r�s    rF�
setannotationzIMAP4.setannotation
s4��(�4�'�'��?�$�?���S��&�&�s�C��>�>rEc�T�|jd||�\}}|j||d�S)ziSet the quota root's resource limits.

        (typ, [data]) = <instance>.setquota(root, limits)
        r3rr�)rbr�limitsr�r�s     rF�setquotazIMAP4.setquotas1��
�'�'�
�D�&�A���S��&�&�s�C��9�9rEc��d}|d|dfdk7rd|z}|j|||g|���\}}|j|||�S)z�IMAP4rev1 extension SORT command.

        (typ, [data]) = <instance>.sort(sort_criteria, charset, search_criteria, ...)
        r4rr�r�r�r�)rb�
sort_criteriarI�search_criteriar�r�r�s       rF�sortz
IMAP4.sorts`��
��
�!��]�2�.�/�9�<�"�]�2�M�'�4�'�'��m�W�W��W���S��&�&�s�C��6�6rEc��d}ts|jd��|jr|jd��||jvr|jd��|�tj�}|j|�\}}|dk(rd|j|j|j��|_	|jjd�|_d|_|j�n|jd	��|j|||�S)
Nr5zSSL support missingzTLS session already establishedzTLS not supported by serverrz��server_hostnamer�TzCouldn't establish TLS session)�HAVE_SSLrGrZrKr��ssl�_create_stdlib_contextr��wrap_socketr�rcr�r�r�r�)rb�ssl_contextr�r�r�s     rF�starttlszIMAP4.starttls)s�������*�*�2�3�3�� � ��*�*�>�?�?��t�(�(�(��*�*�:�;�;����4�4�6�K��'�'��-���S��$�;�#�/�/��	�	�@D�	�	�0�K�D�I��	�	�*�*�4�0�D�I�$(�D�!��"�"�$��*�*�=�>�>��&�&�s�C��6�6rEc�X�d}|j|||�\}}|j|||�S)zpRequest named status conditions for mailbox.

        (typ, [data]) = <instance>.status(mailbox, names)
        r6r�)rbr��namesr�r�r�s      rF�statuszIMAP4.status@s8��
���'�'��g�u�=���S��&�&�s�C��6�6rEc�z�|d|dfdk7rd|z}|jd|||�\}}|j||d�S)z�Alters flag dispositions for messages in mailbox.

        (typ, [data]) = <instance>.store(message_set, command, flags)
        rr�r�r�r7r r�)rbr��commandr�r�r�s      rF�storezIMAP4.storeLsQ��

�!�H�U�2�Y��9�,��U�N�E��'�'���g�u�M���S��&�&�s�C��9�9rEc�&�|jd|�S)zYSubscribe to new mailbox.

        (typ, [data]) = <instance>.subscribe(mailbox)
        r8r�r�s  rF�	subscribezIMAP4.subscribeWs��
�#�#�K��9�9rEc�\�d}|j|||g|���\}}|j|||�S)z�IMAPrev1 extension THREAD command.

        (type, [data]) = <instance>.thread(threading_algorithm, charset, search_criteria, ...)
        r9r�)rb�threading_algorithmrIr[r�r�r�s       rF�threadzIMAP4.thread_s>��
��'�4�'�'��.A�7�]�_�]���S��&�&�s�C��6�6rEc�b�|j�}|tvr|jd|z��|jt|vr:|jd|�d|j�ddj	t|�����d}|j
||g|���\}}|dvr|}nd}|j
|||�S)	z�Execute "command arg ..." with messages identified by UID,
                rather than message number.

        (typ, [data]) = <instance>.uid(command, arg1, arg2, ...)

        Returns response appropriate to 'command'.
        zUnknown IMAP4 UID command: %s�command � illegal in state �, only allowed in states �, r:)r/r4r9r )r�r�rGrS�joinr�r�)rbrjr�r�r�r�s      rF�uidz	IMAP4.uidis����-�-�/���(�"��*�*�<�w�F�G�G��:�:�X�g�.�.��*�*�%�t�z�z�"�i�i���(9�:�<�=�
=���'�4�'�'��g�=��=���S��2�2��D��D��&�&�s�C��6�6rEc�&�|jd|�S)z_Unsubscribe from old mailbox.

        (typ, [data]) = <instance>.unsubscribe(mailbox)
        r;r�r�s  rF�unsubscribezIMAP4.unsubscribe�s��
�#�#�M�7�;�;rEc�Z�	|jd�\}}d|_||fS#d|_wxYw)aMFree server's resources associated with the selected mailbox
        and returns the server to the authenticated state.
        This command performs the same actions as CLOSE, except
        that no messages are permanently removed from the currently
        selected mailbox.

        (typ, [data]) = <instance>.unselect()
        r<rr�)rbr�r�s   rF�unselectzIMAP4.unselect�s7��	 ��,�,�Z�8�I�C���D�J��D�y��� �D�J�r�c��|j�}|tvr|jft|<|j|g|���S)aAllow simple extension commands
                notified by server in CAPABILITY response.

        Assumes command is legal in current state.

        (typ, [data]) = <instance>.xatom(name, arg, ...)

        Returns response appropriate to extension command `name'.
        )r�r�rSr��rbr�r�s   rF�xatomzIMAP4.xatom�s@���z�z�|���x��"�j�j�]�H�T�N�#�t�#�#�D�0�4�0�0rEc���|�d}|j}	|jdk\r4|jd|�dt|j	|d���d|�d��||vr||j|�y|g||<y)NrE��untagged_responses[z] rOz += ["z"])rVrRr�r�rOr�)rbr�r��urs    rF�_append_untaggedzIMAP4._append_untagged�sn���;��C�
�
$�
$����z�z�Q���
�
��c�"�&�&��R�.�1�3�8�9��"�9��s�G�N�N�3���e�B�s�GrEc��|jjd�}|r.|j|dj|jd���y)N�BYEr�r�)rVrOrKr�rj)rb�byes  rF�
_check_byezIMAP4._check_bye�sB���%�%�)�)�%�0����*�*�S��W�^�^�D�N�N�I�F�G�G�rEc�V�|jt|vrAd|_|jd|�d|j�ddj	t|�����dD]}||j
vs�|j
|=� d|j
vr|js|jd��|j�}t||j�}|dz|z}|D]3}|��t|t�rt||j�}|dz|z}�5|j}|�Qd|_t|�t|j�ur|}n'd}|td	t|�z|j�z}	|j d
k\r|j#d|z�n|j%d|z�	|j'|t(z�|�|S	|j/�r"|j0|r|S|j/�r�"r||j2�}	|j d
k\r|j#d
t|�z�	|j'|�|j't(�|s	|S��#t*$r}	|j-d|	z��d}	~	wwxYw#t*$r}	|j-d|	z��d}	~	wwxYw)Nrrrsrtru�rz�NO�BADrMz#mailbox status changed to READ-ONLY� z {%s}�z> %rzsocket error: %szwrite literal size %s)rSr�rTrGrvrVrXrN�_new_tag�bytesrjr+r,�type�_commandr�rRr��_logr�r�r`rKr�rUrW)
rbr�r�r��tagr��argrT�	literator�vals
          rFr�zIMAP4._command�s����:�:�X�d�^�+��D�L��*�*�"�D�J�J�"�i�i����7�9�:�
:�
'�	1�C��d�-�-�-��+�+�C�0�	1��$�1�1�1�� � ��-�-� E�F�F��m�m�o���T�4�>�>�*���T�z�D� ���	%�C��{�H��#�s�#��C����0���$�;��$�D�		%��,�,�����D�L��G�}��T�]�]� 3�3�#�	� �	��e�G�c�'�l�$:�D�N�N�K�K����z�z�Q���
�
�6�D�=�)��	�	�&�4�-�(�	7��I�I�d�T�k�"��?��J���$�$�&��'�'��,��J��$�$�&��#�D�$>�$>�?����:�:��?��J�J�6��W��E�F�
;��	�	�'�"��	�	�$�����
�3��
�	7��*�*�/�#�5�6�6��	7��2�
;��j�j�!3�c�!9�:�:��
;�s0�$I!�5&J�!	J�*I>�>J�	J(�J#�#J(c�t�|dk(}|s|j�	|j||��\}}|s|j�|dk(r|j|�d|�d|����||fS#|j$r}|jd|�d|����d}~w|j$r}|jd|�d|����d}~wwxYw)Nr)�
expect_byez	command: � => r�z command error: r()r��_get_tagged_responserKrG)rbr�r�r�r�r�r�s       rF�_command_completezIMAP4._command_completes����(�"����O�O��	@��1�1�#�&�1�I�I�C��
��O�O���%�<��*�*�$��T�J�K�K��D�y����z�z�	@��*�*�D�#�>�?�?���z�z�	@��*�*�D�#�>�?�?��	@�s#�A#�#B7�2B	�	B7�B2�2B7c���|j�\}}|dgk(r|jd��t|d|j�}|j	�}t|j
��|_y)Nz"no CAPABILITY response from serverr�)r�rGr,rjr��tuple�splitr�r�s   rFr�zIMAP4._get_capabilities#s]���?�?�$���S��4�&�=��*�*�A�B�B��#�b�'�4�>�>�*���i�i�k��!�#�)�)�+�.��rEc�h�|j�}|j|j|�r�|jj	d�}||j
vr|j
d|z��|jj	d�}t||j�}|jj	d�}||gf|j
|<�n�d}|jt|�s7|j|j|�r|jj	d�}|j�K|jt|�r!|jj	d�|_y|j
d|z��|jj	d�}t||j�}|jj	d�}|�d}|r|dz|z}|j|j|�r�t|jj	d	��}	|jd
k\r|j!d|z�|j#|�}|j%|||f�|j�}|j|j|�r��|j%||�|dvrr|jt&|�r\|jj	d�}t||j�}|j%||jj	d��	|jd
k\r|dvr|j!|�d|���|S)Nr�zunexpected tagged response: %rr�r��data2zunexpected response: %rrEr�r�r�zread literal size %sr�rx)r�r�r�z response: )�	_get_line�_matchr�mo�grouprUrKr,rj�Untagged_responserq�ContinuationrWro�intrRr�r�r��
Response_code)rb�respr�r�r��dat2r�r�s        rFr�zIMAP4._get_response,s����~�~����;�;�t�z�z�4�(��'�'�-�-��&�C��$�.�.�.��j�j�!A�D�!H�I�I��'�'�-�-��'�C��c�4�>�>�*�C��'�'�-�-��'�C�),�s�e��D� � ��%��D��;�;�0�$�7��;�;�t�3�3�T�:��7�7�=�=��1�D��w�w���;�;�|�T�2�15�����v�1F�D�.���j�j�!:�T�!A�B�B��'�'�-�-��'�C��c�4�>�>�*�C��'�'�-�-��'�C��{�#�C��3��:��,�S��+�+�d�l�l�C�0��4�7�7�=�=��0�1����z�z�Q���
�
�#9�D�#@�A��y�y�����%�%�c�C��;�7��n�n�&��!�+�+�d�l�l�C�0�$
�!�!�#�s�+��%�%�$�+�+�m�S�*I��'�'�-�-��'�C��c�4�>�>�*�C��!�!�#�t�w�w�}�}�V�'<�=���z�z�Q��3�*>�#>��
�
��S�9�:��rEc�D�	|j|}|�|j|=|S|r$d}|jj|d�}|�||fS|j�	|j	��h#|j
$r&}	|jdk\r|j��d}~wwxYw)Nrxr�)rUrV�popr�r�rKrR�	print_log)rbr�r��resultr�r�r�s       rFr�zIMAP4._get_tagged_response|s�����)�)�#�.�F��!��(�(��-��
�����-�-�1�1�#�t�<���?���:�%�
�O�O��
��"�"�$�/��0�:�:�
���z�z�Q�����(���	
�s�A*�*B�9!B�Bc��|j�}|s|jd��|jd�s|jd|z��|dd}	|jdk\r|j	d|z�|S|jd|z�|S)Nzsocket error: EOFr
z#socket error: unterminated line: %r���r�z< %r)r�rK�endswithrRr�r�r�s  rFr�zIMAP4._get_line�s����}�}�����*�*�0�1�1��}�}�W�%��*�*�B�T�I�J�J��C�R�y����z�z�Q���
�
�6�D�=�)����	�	�&�4�-�(��rEc���|j|�|_	|j�H|jdk\r9|jd|j�d|jj����|jduS)Nr�z		matched r�)�matchr�rRr�r�groups)rb�cre�ss   rFr�zIMAP4._match�sY��
�)�)�A�,�����w�w�"�t�z�z�Q���
�
�3�;�;������@P�Q�R��w�w�d�"�"rEc��|jtt|j�|j�z}|jdz|_d|j
|<|S)Nrx)r~r�r,rYrjrU)rbr�s  rFr�zIMAP4._new_tag�sH���k�k�E�#�d�k�k�"2�D�N�N�C�C���k�k�A�o���$(����S�!��
rEc�Z�|jdd�}|jdd�}d|zdzS)N�\z\\�"z\")r�)rbr�s  rFr zIMAP4._quote�s0���k�k�$��'���k�k�#�u�%���S�y�3��rEc�H�|j||j|g|����Sr�)r�r�r}s   rFr�zIMAP4._simple_command�s%���%�%�d�M�D�M�M�$�,F��,F�G�GrEc���|dk(r||fS||jvr|dgfS|jj|�}	|jdk\r|jd|�d|���||fS)Nr�r�r�z] => )rVr�rRr�)rbr�r�r�r�s     rFr�zIMAP4._untagged_response�sk���$�;���8�O��t�.�.�.����;���&�&�*�*�4�0����z�z�Q���
�
�T�4�H�I��D�y�rEc��|�tj�}tjdtj|��}tjjd||dzdz|fz�tjj
�y)Nz%M:%Sz
  %s.%02d %s
�d)�time�strftime�	localtimer��stderr�write�flush)rbr��secs�tms    rFr�zIMAP4._mesg�sb���|��y�y�{�����w����t�(<�=�B��J�J���-��d�3�h��^�Q�0G�G�H��J�J���rEc�~�|syd�|j�D�}|jddj|�z�y)Nc3�0K�|]\}}|�d|�����y�w)�: NrD)�.0�key�values   rF�	<genexpr>z!IMAP4._dump_ur.<locals>.<genexpr>�s)����B�"��U��u�B�u�i�(�B�s�zuntagged responses dump:z
		)�itemsr�rv)rb�untagged_resp_dictr�s   rFr:zIMAP4._dump_ur�s=��%��B�&8�&>�&>�&@�B�E��J�J�1�H�M�M�%�4H�H�IrEc���|tj�f|j|j<|xjdz
c_|j|jk\rd|_yy)Nrxr)r�r�r�r�r�s  rFr�z
IMAP4._log�sS��04�d�i�i�k�/B�D�M�M�$�+�+�,�����"��� � �D�$5�$5�5�$%��!�6rEc��|jdt|j�z�|j|j}}|r<	|j|j|�|dz
}||jk\rd}|dz}|r�;yy#Y�$xYw)Nzlast %d IMAP4 interactions:rxr)r�r�r�r�r�)rb�i�ns   rFr�zIMAP4.print_log�s����J�J�4�s�4�=�=�7I�I�J��$�$�d�&7�&7�q�A����D�J�J��
�
�a� 0�1��Q�����)�)�)��A��Q�������s�A?�?B)z""�*)r�Fr�)F)UrArBrC�__doc__r^rGrKrN�
IMAP4_PORTrfr[rur]r�r�r�r�r\r�r�r�r_r�r�r�r�r�r�r�r�r�r�r�r�rrrr
rrrrr#r&r%r�r4r6r8r�r@rBrFrKrPrSrUrXr\rerhrkrmrprwryr{r~r�r�r�r�r�r�r�r�r�r�r r�r�r�r:r�r�rDrErFrr�s���-�^!�	� �����5���Z���2F�<�'7�TC���1���T�	-�$�
� �
� �7�"C�E�4�:7�-��F�7�7�?�
�7�7�8�?�:�'�	7��B�N�
�	7�=�7�,�	:�
7�F�7�$B�@B�?�:�7�7�.	7�:�:�7�7�2<�
� 1�,�H�J�Z�$/�M�`�B�&	#���H�
	��	�	J�	&�	rErc�8�eZdZdZdefddd�d�Zd�Zdedfd�Zy)�	IMAP4_SSLa�IMAP4 client class over SSL connection

        Instantiate with: IMAP4_SSL([host[, port[, ssl_context[, timeout=None]]]])

                host - host's name (default: localhost);
                port - port number (default: standard IMAP4 SSL port);
                ssl_context - a SSLContext object that contains your certificate chain
                              and private key (default: None)
                timeout - socket timeout (default: None) If timeout is not given or is None,
                          the global default socket timeout is used

        for more documentation see the docstring of the parent class IMAP4.
        rON)rdrec�n�|�tj�}||_tj	||||�yr�)rarbrdrrf)rbrcrdrdres     rFrfzIMAP4_SSL.__init__s0���"�!�8�8�:��*�D���N�N�4��t�W�5rEc�|�tj||�}|jj||j��S)Nr^)rr�rdrcrc)rbrer�s   rFr�zIMAP4_SSL._create_sockets=���'�'��g�6�D��#�#�/�/��@D�	�	�0�K�
KrEc�4�tj||||�y)z�Setup connection to remote server on "host:port".
                (default: localhost:standard IMAP4 SSL port).
            This connection will be used by the routines:
                read, readline, send, shutdown.
            N)rr\ras    rFr\zIMAP4_SSL.open!s��
�J�J�t�T�4��1rE)rArBrCr��IMAP4_SSL_PORTrfr�r\rDrErFr�r�s1��	�!#��	6�$(�$�	6�	K�
�^�T�	2rEr�c�6�eZdZdZd�Zd	d�Zd�Zd�Zd�Zd�Z	y)
rz�IMAP4 client class over a stream

    Instantiate with: IMAP4_stream(command)

            "command" - a string that can be passed to subprocess.Popen()

    for more documentation see the docstring of the parent class IMAP4.
    c�<�||_tj|�yr�)rjrrf)rbrjs  rFrfzIMAP4_stream.__init__8s�����
���t�rENc�<�d|_d|_d|_d|_t	j
|jttjtjdd��|_	|jj|_|jj|_
y)z�Setup a stream connection.
        This connection will be used by the routines:
            read, readline, send, shutdown.
        NT)�bufsize�stdin�stdout�shell�	close_fds)rcrdr�r��
subprocess�Popenrjr�PIPEr�r��	writefiler��readfileras    rFr\zIMAP4_stream.open=sq��
��	���	���	���	�!�'�'����'��/�/�*�/�/��$�(������+�+������+�+��
rEc�8�|jj|�Sr�)r�r�r�s  rFr�zIMAP4_stream.readMs���}�}�!�!�$�'�'rEc�6�|jj�S)r�)r�r�rrs rFr�zIMAP4_stream.readlineRs���}�}�%�%�'�'rEc�n�|jj|�|jj�y)r�N)r�r�r�r�s  rFr�zIMAP4_stream.sendWs$�������T�"������rEc��|jj�|jj�|jj	�y)r�N)r�r�r�r��waitrrs rFr_zIMAP4_stream.shutdown]s2���
�
���������������rE)NNN)
rArBrCr�rfr\r�r�r�r_rDrErFrr,s%����
,� (�
(�
�rErc�(�eZdZdZd�Zd�Zd�Zd�Zy)r�zcPrivate class to provide en/decoding
            for base64-based authentication conversation.
    c��||_yr�)r�)rb�mechinsts  rFrfz_Authenticator.__init__ks	����	rEc�j�|j|j|��}|�y|j|�S)N�*)r�r�r-)rbr��rets   rFr�z_Authenticator.processns0���i�i����D�)�*���;���{�{�3��rEc���d}t|t�r|jd�}|r?t|�dkDr|dd}|dd}n|}d}t	j
|�}|r||ddz}|r�?|S)NrErt�0r�)r+r,r-r��binascii�
b2a_base64)rb�inp�oup�t�es     rFr-z_Authenticator.encodets}�����c�3���*�*�W�%�C���3�x�"�}����H���"�#�h�������#�#�A�&�A���A�c�r�F�l����
rEc�2�|sytj|�S)NrE)r��
a2b_base64)rbr�s  rFr�z_Authenticator.decode�s�����"�"�3�'�'rEN)rArBrCr�rfr�r-r�rDrErFr�r�es���� ��0(rEr�z0 Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Decr(rxc	��tj|�}|syt|jd�}|jd�}t	|jd��}t	|jd��}t	|jd��}t	|jd��}t	|jd��}t	|jd	��}	t	|jd
��}
|	dz|
zdz}|dk(r|}||||||d
d
d
f	}tj|�|z
}
tj|
�S)z�Parse an IMAP4 INTERNALDATE string.

    Return corresponding local time.  The return value is a
    time.struct_time tuple or None if the string has wrong format.
    N�mon�zonen�day�year�hour�min�sec�zoneh�zonem�<�-r�)	�InternalDater��Mon2numr�r��calendar�timegmr�r�)r�r�rrrrrrrrr�zone�tt�utcs              rFr	r	�s��
�	�	�D�	!�B�
��
�"�(�(�5�/�
"�C��H�H�W��E�

�b�h�h�u�o�
�C��r�x�x��� �D��r�x�x��� �D�

�b�h�h�u�o�
�C�

�b�h�h�u�o�
�C������!�"�E������!�"�E�
�"�H�u��b� �D���}��u��
��S�$��S�"�b�"�	5�B�
�/�/�"�
��
$�C��>�>�#��rEc�t�d}d}tt|��}|rt|d�\}}|||dz|z}|r�|S)z-Convert integer to A-P string representation.rEsABCDEFGHIJKLMNOP�rx)r��abs�divmod)�numr��AP�mods    rFr
r
�sM���C�'�r�

�c�#�h�-�C�

��#�r�?���S���S��U�m�c�!����JrEc��tj|�}|syt|jd�j	��S)z-Convert IMAP4 flags response to python tuple.rDr�)�Flagsr�r�r�r�)r�r�s  rFrr�s5��
���T�	�B�
������'�"�(�(�*�+�+rEc�:�t|ttf�r3tj|t
j�j�}n�t|t�r1	|j}t!|��}t|dddt|�i�}nTt|t�r|j"�t%d��|}n*t|t&�r|d|dfd	k(r|St%d
��dj)t*|j,�}|j/|�S#t$rtjrZ|d}|dk(r+tjtj|��d}tj
tjf|}ntj
}Y��2wxYw)a�Convert date_time to IMAP4 INTERNALDATE representation.

    Return string in form: '"DD-Mmm-YYYY HH:MM:SS +HHMM"'.  The
    date_time argument can be a number (int or float) representing
    seconds since epoch (as returned by time.time()), a 9-tuple
    representing local time, an instance of time.struct_time (as
    returned by time.localtime()), an aware datetime instance or a
    double-quoted string.  In the last case, it is assumed to already
    be in the correct format.
    �r�)�secondsN��tzinfozdate_time must be awarer)r�r�zdate_time not of a known typez"%d-{}-%Y %H:%M:%S %z")r+r��floatr�
fromtimestamprr�
astimezoner��	tm_gmtoffr�r��daylightr��mktime�altzonerrr�r,�format�Months�monthr�)r��dt�gmtoff�dst�delta�fmts      rFrr�s]���)�c�5�\�*�
�
#�
#�I�$,�L�L�2�2<�*�,�	�	�I�u�	%�		(��(�(�F��&�)��
�y��!�}�
=�X�e�_�
=��	�I�x�	(����#��6�7�7�
��	�I�s�	#��1��i��m�(D�	�(Q����8�9�9�
"�
)�
)�&����*:�
;�C�
�;�;�s����'�	(��}�}���l���"�9��.�.����Y�)?�@��C�C��=�=�$�,�,�7��<�<���-�-����	(�s�D�BF�F�__main__zd:s:)rDrDz-dz-s)rOzIMAP password for z on �	localhostr�zJFrom: %(user)s@localhost%(lf)sSubject: IMAP4 test%(lf)s%(lf)sdata...%(lf)s�
)r!�lfr#)r�)�
/tmp/xxx 1)rF)r3z/tmp/yyy)r��
/tmp/yyz 2r�r5)r)z/tmpzyy*)rPr4)rK)N�SUBJECT�test)r)�1z(FLAGS INTERNALDATE RFC822))rk)r8�FLAGSz
(\Deleted))r8rD)rrD)r�rD)r�rD)rPrD)r�)�UIDVALIDITY)rw)r/�ALL)r�)rN)r�rDc��tj|�d|���tt|�|�\}}tj|�d|�d|���|dk(r|d�|S)Nr(r�r�r)�Mr�r�)�cmdr�r�r�s    rF�runr?0sP��	���3��%�&�"�7�1�c�?�D�)���S�	����c�3�/�0��$�;�c�!�f���
rErzPROTOCOL_VERSION = %szCAPABILITIES = r)z/tmp/zyy%z.*"([^"]+)"$r�r�rwz%sz:(FLAGS INTERNALDATE RFC822.SIZE RFC822.HEADER RFC822.TEXT)z
All tests OK.z
Tests failed.z8
If you would like to see debugging output,
try: %s -d5
)Vr�r�r�r�r|rkr�r�r�r�r
rrr�iorrar`�ImportError�__all__r�rQr�r�r�r�r�rlr�rrrnror�r�r�rqrmrprr�r�rr�r�r(�	enumerater-rr	r
rrrA�getopt�getpass�argv�optlistr�rGr��stream_command�optr�rc�getuser�USER�PASSWD�	test_mesg�	test_seq1�	test_seq2r?r=rSr�r�r�r>�mlr�r�r��pathr�rw�print)r�r�s00rF�<module>rSsv��
�,��K�K�K�K�K�2�2�"����H�8��
��	��
�
���(����
,
��,�,
�	��,
�	�A�	,
�
	�
�,
�	�
�
,
�	�
�,
�	�,�,
�	�,�,
�	�,�,
�	�
�,
�	�,�,
�	�
�,
�	�
�,
�	�,�,
� 	�,�!,
�"	�,�#,
�$	�,�%,
�&	�,�',
�(	�,�),
�*	��+,
�,	�A�-,
�.	�,�/,
�0	�
�1,
�2	�,�3,
�4	�A�5,
�6	�
�7,
�8	�	�9,
�:	�,�;,
�<	�
�=,
�>	�,�?,
�@	�,�A,
�B	�,�C,
�D	�,�E,
�F	�
�G,
�H%�,�%�,�%�%�,�%�W,
��`�r�z�z�0�1����
�
�4�5���r�z�z�����"�*�*�+�R�X�X�
6��
�"�*�*�^�
$����
�
�D�E�
��B�J�J�G�H���"�*�*�;�R�X�X�G��"��J��x�x�v#�#2�E�#2�J�N�N�;��5�5�5�r*(�*(�X
<�	A�	A�#�	F��&/��q�r�
�&;�
<�d�a��1�8�8�:�a��c�>�
<���F	�,�%�R�z����%��
�
�c�h�h�q�r�l�F�;�
����N��2���C��$�;���H�E�
�D�[� �N��� 1��2������7�D��7�?�?��D�
�W�_�_�t�T�EX�[�EX�Y�
Z�F�\�gk�rv�_w�w�I��t�V�n���*��
��d�D�)�4�5���)�3�,������I�$�!���
��d�D�)�,�-����I��)���^�,�A��d��A��7�7�f��!�!�"�
�I�	���'�!�*<�*<�<�=�	���q�~�~�7�8�!�	�H�C����T�N�	��f�.�/�	#�B�����/�2�.�B��"�(�(�1�+�4�����B��$���4�'�"�		#�"�		S�H�C���c�4�.�C��D�z�7�7���b�'�-�-�/�C��������B���P�R�
S�		S�	�� �{��q.���H���d+=��`�<�<���
������j	�
�� ����
�h�h�q�k��
�
	�s<�O�O"�#O(�?DP
�O�O�(P�7P�P�
%P/

Zerion Mini Shell 1.0