Your IP : 3.146.176.191


Current Path : /opt/alt/python312/lib64/python3.12/email/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/email/__pycache__/_parseaddr.cpython-312.pyc

�

�Q�f�E���dZgd�ZddlZddlZdZdZdZgd�Zgd�Zddddd	d
dd	ddd
ddd
d�Z	d�Z
d�Zd�Zd�Z
d�ZGd�d�ZGd�de�Zy)zcEmail address parsing code.

Lifted directly from rfc822.py.  This should eventually be rewritten.
)�	mktime_tz�	parsedate�parsedate_tz�quote�N� �z, )�jan�feb�mar�apr�may�jun�jul�aug�sep�oct�nov�dec�january�february�march�aprilr
�june�july�august�	september�october�november�december)�mon�tue�wed�thu�fri�sat�sunip���i���i���i����iD���i��)�UT�UTC�GMT�Z�AST�ADT�EST�EDT�CST�CDT�MST�MDT�PST�PDTc�H�t|�}|sy|d�d|d<t|�S)zQConvert a date string to a time tuple.

    Accounts for military timezones.
    N�	r)�
_parsedate_tz�tuple)�data�ress  �7/opt/alt/python312/lib64/python3.12/email/_parseaddr.pyrr-s0��
��
�C���
�1�v�~���A����:��c
��|sy|j�}|sy|djd�s|dj�tvr|d=n'|dj	d�}|dk\r|d|dzd|d<t|�dk(r*|djd�}t|�dk(r||ddz}t|�dk(rP|d}|j
d�}|d	k(r|j
d�}|dkDr|d|||dg|ddn|jd
�t|�dkry|dd}|\}}}}}|r|r|sy|j�}|tvr||j�}}|tvrytj|�dz}|dkDr|dz}|d	dk(r|dd	}|j
d
�}|dkDr||}}|d	dk(r|dd	}|sy|dj�s||}}|d	dk(r|dd	}|jd
�}t|�dk(r|\}	}
d}nkt|�dk(r|\}	}
}nVt|�dk(rGd|dvr@|djd�}t|�dk(r|\}	}
d}nt|�dk(r|\}	}
}nyy	t|�}t|�}t|	�}	t|
�}
t|�}|dkr|dkDr|dz
}n|dz
}d}|j�}|tvr
t|}n$	t|�}|dk(r|jd�rd}|r!|dkrd	}
|}nd}
|
|dzdz|dzdzzz}||||	|
|ddd	|g
S#t$rYywxYw#t$rY�awxYw)a�Convert date to extended time tuple.

    The last (additional) element is the time zone offset in seconds, except if
    the timezone was specified as -0000.  In that case the last element is
    None.  This indicates a UTC timestamp that explicitly declaims knowledge of
    the source timezone, as opposed to a +0000 timestamp that indicates the
    source timezone really was UTC.

    Nr�,���-��+���r���:��0�.�d�Dili�i�<)�split�endswith�lower�	_daynames�rfind�len�find�append�_monthnames�index�isdigit�int�
ValueError�upper�
_timezones�
startswith)r9�i�stuff�s�dd�mm�yy�tm�tz�thh�tmm�tss�tzoffset�tzsigns              r;r7r79s������:�:�<�D����A�w������Q��
�
��9� <���G���G�M�M�#�����6��1�g�a��c�d�m�D��G�
�4�y�A�~��Q��
�
�c�"���u�:��?��4���8�#�D�
�4�y�A�~���G��
�F�F�3�K����7����s��A��q�5��"�1��q���u�~�D���H��K�K��O�
�4�y�1�}�����8�D���R��R��R��2�"��	����B�	����R�X�X�Z�B��
�[� ��	�	�	�2�	��	"�B�	�B�w�
�b���	�"�v��}�
���W��
�����A��1�u��R�B��	�"�v��}�
���W����
�a�5�=�=�?��R�B��	�"�v��}�
���W��	���#��B�
�2�w�!�|��
��c���	�R��A�����c�3�	�R��A��#��A��,�
��U�[�[��
���r�7�a�<��J�S�#��C�
��W��\� �O�S�#�s����
��W��
��W���#�h���#�h���#�h��
�C�x�
��7��$�J�B�
�$�J�B��H�	����B�	�Z���b�>��	��2�w�H��Q�;�2�=�=��-��H���a�<��F� �y�H��F��x��}�d�2�h��n�b�5H�H�I����B��S�#�q�!�R��:�:��E�����*�	��	�s$�+7L.�L=�.	L:�9L:�=	M	�M	c�F�t|�}t|t�r|ddS|S)z&Convert a time string to a time tuple.Nr6)r�
isinstancer8�r9�ts  r;rr�s&���T��A��!�U����!�u���r<c�|�|d�tj|dddz�Stj|�}||dz
S)zETurn a 10-tuple as returned by parsedate_tz() into a POSIX timestamp.r6N�)rD)�time�mktime�calendar�timegmrms  r;rr�sA���A�w���{�{�4���8�e�+�,�,��O�O�D�!���4��7�{�r<c�F�|jdd�jdd�S)z�Prepare string to be used in a quoted string.

    Turns backslash and double quote characters into quoted pairs.  These
    are the only characters that need to be quoted inside a quoted string.
    Does not add the surrounding double quotes.
    �\z\\�"z\")�replace)�strs r;rr�s"���;�;�t�V�$�,�,�S�%�8�8r<c�b�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
dd	�Zd
�Zd�Z
d�Zdd�Zd�Zy
)�
AddrlistClassaAddress parser class by Ben Escoto.

    To understand what this class does, it helps to have a copy of RFC 2822 in
    front of you.

    Note: this class interface is deprecated and may be removed in the future.
    Use email.utils.AddressList instead.
    c�,�d|_d|_d|_d|_|j|jz|_|j|jz|jz|_|j
j
dd�|_||_g|_	y)z�Initialize a new instance.

        `field' is an unparsed address header field, containing
        one or more addresses.
        z()<>@,:;."[]rz 	z
rJrN)
�specials�pos�LWS�CR�FWS�atomendsrx�
phraseends�field�commentlist��selfr�s  r;�__init__zAddrlistClass.__init__�sz��(��
�����������8�8�d�g�g�%����
�
����0�4�7�7�:��
��-�-�/�/��R�8�����
���r<c�J�g}|jt|j�kr�|j|j|jdzvrY|j|jdvr(|j	|j|j�|xjdz
c_nG|j|jdk(r*|j
j	|j
��nn#|jt|j�kr��tj|�S)z&Skip white space and extract comments.z

r?�()	r~rSr�rrUr��
getcomment�EMPTYSTRING�join)r��wslists  r;�gotonextzAddrlistClass.gotonext�s������h�h��T�Z�Z��(��z�z�$�(�(�#�t�x�x�&�'8�8��:�:�d�h�h�'�v�5��M�M�$�*�*�T�X�X�"6�7����A�
�����D�H�H�%��,�� � �'�'����(9�:���h�h��T�Z�Z��(�����'�'r<c���g}|jt|j�krL|j�}|r||z
}n|j	d�|jt|j�kr�L|S)zVParse all addresses.

        Returns a list containing all of the addresses.
        )rr)r~rSr��
getaddressrU)r��result�ads   r;�getaddrlistzAddrlistClass.getaddrlist�s^��
���h�h��T�Z�Z��(����"�B���"����
�
�h�'��h�h��T�Z�Z��(��
r<c��g|_|j�|j}|j}|j�}|j�g}|jt	|j
�k\r*|�rftj|j�|dfg}�n?|j
|jdvrB||_||_|j�}tj|j�|fg}�n�|j
|jdk(r�g}t	|j
�}|xjdz
c_|jt	|j
�k�rw|j�|j|kr3|j
|jdk(r|xjdz
c_�n%||j�z}|jt	|j
�kr��n�|j
|jdk(rp|j�}|jr;tj|�dzdj|j�zd	z|fg}n{tj|�|fg}nb|r&tj|j�|dfg}n:|j
|j|jvr|xjdz
c_|j�|jt	|j
�kr1|j
|jd
k(r|xjdz
c_|S)zParse the next address.rz.@rGr?�;�<z (r�)r>)r�r�r~�
getphraselistrSr��SPACEr��getaddrspecr��getrouteaddrr})r��oldpos�oldcl�plist�
returnlist�addrspec�fieldlen�	routeaddrs        r;r�zAddrlistClass.getaddresss�������
�
������� � ���"�"�$���
�
���
��8�8�s�4�:�:��&��$�z�z�$�*:�*:�;�U�1�X�F�G�
�
�Z�Z����
!�T�
)��D�H�$�D���'�'�)�H� �:�:�d�&6�&6�7��B�C�J�
�Z�Z����
!�S�
(��J��4�:�:��H��H�H��M�H��(�(�S����_�,��
�
���8�8�h�&�4�:�:�d�h�h�+?�3�+F��H�H��M�H��'�$�/�/�*;�;�
��(�(�S����_�,��Z�Z����
!�S�
(��)�)�+�I����$�z�z�%�0�4�7�"�x�x��(8�(8�9� :�<?� @�AJ�L�M�
� %�z�z�%�0�)�<�=�
��$�z�z�$�*:�*:�;�U�1�X�F�G�
����D�H�H�%����6����A�
���
�
���8�8�c�$�*�*�o�%�$�*�*�T�X�X�*>�#�*E��H�H��M�H��r<c���|j|jdk7ryd}|xjdz
c_|j�d}|jt|j�k�r|r|j	�d}n�|j|jdk(r|xjdz
c_	|S|j|jdk(r|xjdz
c_d}nZ|j|jd	k(r|xjdz
c_n(|j�}|xjdz
c_	|S|j�|jt|j�kr��|S)
z�Parse a route address (Return-path value).

        This method just skips all the route stuff and returns the addrspec.
        r�NFr?r�>�@TrG)r�r~r�rS�	getdomainr�)r��expectroute�adlists   r;r�zAddrlistClass.getrouteaddrGs&��
�:�:�d�h�h��3�&�������A�
���
�
�����h�h��T�Z�Z��(����� �#�����D�H�H�%��,����A�
����
����D�H�H�%��,����A�
��"�����D�H�H�%��,����A�
���)�)�+�����A�
����
�
�M�M�O�!�h�h��T�Z�Z��(�$�
r<c��g}|j�|jt|j�k�rgd}|j|jdk(rN|r#|dj	�s|j�|j
d�|xjdz
c_d}n�|j|jdk(r,|j
dt|j��z�nj|j|j|jvr&|r#|dj	�s|j�nh|j
|j��|j�}|r|r|j
|�|jt|j�kr��g|jt|j�k\s|j|jdk7rtj|�S|j
d�|xjdz
c_|j�|j�}|stStj|�|zS)	zParse an RFC 2822 addr-spec.TrJrDr?Frwz"%s"r�)r�r~rSr��strip�poprUr�getquoter��getatomr�r�r�)r��aslist�preserve_ws�ws�domains     r;r�zAddrlistClass.getaddrspecgs������
�
���h�h��T�Z�Z��(��K��z�z�$�(�(�#�s�*��&��*�"2�"2�"4��J�J�L��
�
�c�"����A�
��#�����D�H�H�%��,��
�
�f�u�T�]�]�_�'=�=�>����D�H�H�%����6��&��*�"2�"2�"4��J�J�L���
�
�d�l�l�n�-�����B��r��
�
�b�!�%�h�h��T�Z�Z��(�(�8�8�s�4�:�:��&�$�*�*�T�X�X�*>�#�*E��#�#�F�+�+��
�
�c�����A�
���
�
�����!���������'�&�0�0r<c��g}|jt|j�k�r�|j|j|jvr|xjdz
c_�n,|j|jdk(r*|jj|j
��n�|j|jdk(r |j|j��n�|j|jdk(r'|xjdz
c_|jd�ng|j|jdk(rtS|j|j|jvrnC|j|j��|jt|j�kr���tj|�S)z-Get the complete domain name from an address.r?r��[rJr�)r~rSr�rr�rUr��getdomainliteralr�r�r�r�)r��sdlists  r;r�zAddrlistClass.getdomain�s=�����h�h��T�Z�Z��(��z�z�$�(�(�#�t�x�x�/����A�
�����D�H�H�%��,�� � �'�'����(9�:����D�H�H�%��,��
�
�d�3�3�5�6����D�H�H�%��,����A�
���
�
�c�"����D�H�H�%��,�#�"����D�H�H�%����6���
�
�d�l�l�n�-�#�h�h��T�Z�Z��(�$����'�'r<c��|j|j|k7rydg}d}|xjdz
c_|jt|j�k�r|r+|j|j|j�d}n�|j|j|vr|xjdz
c_n�|r<|j|jdk(r |j|j	����|j|jdk(rd}n(|j|j|j�|xjdz
c_|jt|j�kr��t
j
|�S)a�Parse a header fragment delimited by special characters.

        `beginchar' is the start character for the fragment.
        If self is not looking at an instance of `beginchar' then
        getdelimited returns the empty string.

        `endchars' is a sequence of allowable end-delimiting characters.
        Parsing stops when one of these is encountered.

        If `allowcomments' is non-zero, embedded RFC 2822 comments are allowed
        within the parsed fragment.
        rFr?r�rvT)r�r~rSrUr�r�r�)r��	beginchar�endchars�
allowcomments�slistrs      r;�getdelimitedzAddrlistClass.getdelimited�s%���:�:�d�h�h��9�,����������A�
���h�h��T�Z�Z��(�����T�Z�Z����1�2������D�H�H�%��1����A�
����4�:�:�d�h�h�#7�3�#>����T�_�_�.�/�����D�H�H�%��-������T�Z�Z����1�2��H�H��M�H��h�h��T�Z�Z��(� ����&�&r<c�(�|jddd�S)z1Get a quote-delimited fragment from self's field.rwz"
F�r��r�s r;r�zAddrlistClass.getquote�s��� � ��e�U�3�3r<c�(�|jddd�S)z7Get a parenthesis-delimited fragment from self's field.r�z)
Tr�r�s r;r�zAddrlistClass.getcomment�s��� � ��e�T�2�2r<c�.�d|jddd�zS)z!Parse an RFC 2822 domain-literal.z[%s]r�z]
Fr�r�s r;r�zAddrlistClass.getdomainliteral�s����)�)�#�u�e�<�<�<r<Nc��dg}|�|j}|jt|j�kr||j|j|vrn`|j	|j|j�|xjdz
c_|jt|j�kr�|t
j
|�S)aParse an RFC 2822 atom.

        Optional atomends specifies a different set of end token delimiters
        (the default is to use self.atomends).  This is used e.g. in
        getphraselist() since phrase endings must not include the `.' (which
        is legal in phrases).rr?)r�r~rSr�rUr�r�)r�r��atomlists   r;r�zAddrlistClass.getatom�s����4�����}�}�H��h�h��T�Z�Z��(��z�z�$�(�(�#�x�/������
�
�4�8�8� 4�5��H�H��M�H��h�h��T�Z�Z��(�����)�)r<c��g}|jt|j�k�r3|j|j|jvr|xjdz
c_n�|j|jdk(r |j	|j��n�|j|jdk(r*|jj	|j��nR|j|j|jvr	|S|j	|j|j��|jt|j�kr��3|S)z�Parse a sequence of RFC 2822 phrases.

        A phrase is a sequence of words, which are in turn either RFC 2822
        atoms or quoted-strings.  Phrases are canonicalized by squeezing all
        runs of continuous whitespace into one space.
        r?rwr�)
r~rSr�r�rUr�r�r�r�r�)r�r�s  r;r�zAddrlistClass.getphraselist�s������h�h��T�Z�Z��(��z�z�$�(�(�#�t�x�x�/����A�
�����D�H�H�%��,����T�]�]�_�-����D�H�H�%��,�� � �'�'����(9�:����D�H�H�%����8�������T�\�\�$�/�/�:�;��h�h��T�Z�Z��(��r<)T�N)�__name__�
__module__�__qualname__�__doc__r�r�r�r�r�r�r�r�r�r�r�r�r��r<r;r{r{�sL����&(��9�v�@$1�L(�.#'�J4�3�=�*�(r<r{c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�AddressListz@An AddressList encapsulates a list of parsed RFC 2822 addresses.c�n�tj||�|r|j�|_yg|_yr�)r{r�r��addresslistr�s  r;r�zAddressList.__init__s.�����t�U�+��#�/�/�1�D��!�D�r<c�,�t|j�Sr�)rSr�r�s r;�__len__zAddressList.__len__	s���4�#�#�$�$r<c��td�}|jdd|_|jD],}||jvs�|jj|��.|Sr��r�r�rU�r��other�newaddr�xs    r;�__add__zAddressList.__add__sX���d�#��"�.�.�q�1����"�"�A���(�(�(��#�#�*�*�1�-�#��r<c�|�|jD],}||jvs�|jj|��.|Sr�)r�rU�r�r�r�s   r;�__iadd__zAddressList.__iadd__s;���"�"�A���(�(�(�� � �'�'��*�#��r<c��td�}|jD],}||jvs�|jj|��.|Sr�r�r�s    r;�__sub__zAddressList.__sub__sE���d�#���!�!�A���)�)�)��#�#�*�*�1�-�"��r<c�|�|jD],}||jvs�|jj|��.|Sr�)r��remover�s   r;�__isub__zAddressList.__isub__$s;���"�"�A��D�$�$�$�� � �'�'��*�#��r<c� �|j|Sr�)r�)r�rWs  r;�__getitem__zAddressList.__getitem__+s������&�&r<N)r�r�r�r�r�r�r�r�r�r�r�r�r<r;r�r�s(��J�"�%�����'r<r�)r��__all__rqrsr�r��
COMMASPACErVrQr\rr7rrrr{r�r�r<r;�<module>r�s����
�������
�
�I��

>�	��A�Q�A��$��$��$��$��$��
�
�z;�z��9�k�k�Z	-'�-�-'r<

?>