Your IP : 18.116.49.143


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

�

�Q�f�>���	gd�ZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	m
Z
ddl	mZmZmZddlmZdZd	Zd	Zd
ZdZej0d�Zej0d
�Zd�Zd�Zd&d�Zd�Zd�ZdZ dd�d�Z!d�Z"d�Z#d�Z$d�Z%d'd�Z&d(d�Z'd)d�Z(d�Z)dd�d�Z*d�Z+d �Z,d)d!�Z-ej0d"ej\�Z/d#�Z0		d*d$�Z1d)d%�Z2y)+)�collapse_rfc2231_value�
decode_params�decode_rfc2231�encode_rfc2231�
formataddr�
formatdate�format_datetime�getaddresses�
make_msgid�	mktime_tz�	parseaddr�	parsedate�parsedate_tz�parsedate_to_datetime�unquote�N)�quote)�AddressList)r)r
r�
_parsedate_tz)�Charsetz, �z
�'z[][\\()<>@,:;".]z[\\"]c�F�		|j�y#t$rYywxYw)NFT)�encode�UnicodeEncodeError)�ss �2/opt/alt/python312/lib64/python3.12/email/utils.py�_has_surrogatesr4s(��E��	���
�������s��	 � c�J�|jdd�}|jdd�S)N�utf-8�surrogateescape�replace)r�decode)�string�original_bytess  r�	_sanitizer%As(��
�]�]�7�,=�>�N�� � ��)�4�4�c�X�	|\}}|jd�|rM	|jd�d}tj|�rd}tj	d|�}|�|�|�d|�d�S|S#t
$r7t
|t�rt|�}|j|�}|�d|�d�cYSwxYw)N�asciir�"z\\\g<0>z <�>)
r�
specialsre�search�	escapesre�subr�
isinstance�strr�
header_encode)�pair�charset�name�address�quotes�encoded_names      rrrMs�����M�D�'��N�N�7���	C��K�K�� ��F�� � ��&����=�=��T�2�D�$*�D�&�'�B�B��N��"�	7��'�3�'�!�'�*��"�0�0��6�L� ,�g�6�6�		7�s�A)�)=B)�(B)c#�K�d}d}t|�D]!\}}|r|d|zf��d}�|dk(rd}�||f���#|r|df��yy�w)NrF�\T)�	enumerate)�addr�pos�escape�chs    r�_iter_escaped_charsr?nsb����
�C�
�F��T�?���R����r�	�"�"��F�
�4�Z��F���)�O�#���D�k���s�>Ac��	d|vr|Sd}d}g}t|�D]0\}}|dk(s�|�|}�||k7r|j|||�|dz}d}�2|t|�kr|j||d�dj|�S)Nr)r�r)r?�append�len�join)r;�start�open_pos�resultr<r>s      r�_strip_quoted_realnamesrH}s���*�
�$����
�E��H�
�F�&�t�,���R�
��9������H�$��M�M�$�u�X�"6�7��a�����-�
�s�4�y���
�
�d�5�6�l�#�
�7�7�6�?�r&T)�strictc��	|s3tjd�|D��}t|�}|jS|D�cgc]
}t	|���}}t|�}tj|�}t|�}t
|j�}d}|D]$}t|�}|d|jd�zz
}�&t|�|k7rdgS|Scc}w)Nc3�2K�|]}t|����y�w)N�r0)�.0�vs  r�	<genexpr>zgetaddresses.<locals>.<genexpr>�s����:�k��c�!�f�k�s�rrA�,�rr)
�
COMMASPACErD�_AddressList�addresslistr0�_pre_parse_validation�_post_parse_validationrH�countrC)�fieldvaluesrI�all�arNr;rG�ns        rr	r	�s����"��o�o�:�k�:�:�������}�}��#.�/�;�a�3�q�6�;�K�/�'��4�K��?�?�;�'�D��T��A�
#�A�M�M�
2�F�	
�A�
��
$�A�&��	�Q������
�����6�{�a���z���M��%0s�C
c��t|�}d}t|�D]"\}}|dk(r|dz
}�|dk(s�|dz}|dks�"y|dk(S)Nr�(rA�)F)rHr?)r;�opensr<r>s    r�_check_parenthesisr`�sZ��"�4�(�D�
�E�&�t�,���R�
��9��Q�J�E�
�3�Y��Q�J�E��q�y��
-�
�Q�J�r&c�T�g}|D] }t|�sd}|j|��"|S)Nz('', ''))r`rB)�email_header_fields�accepted_valuesrNs   rrUrU�s4���O�
 ��!�!�$��A����q�!�!�
�r&c�L�g}|D]}d|dvrd}|j|��|S)N�[rArQ)rB)�parsed_email_header_tuplesrcrNs   rrVrV�s9���O�(���!�A�$�;��A����q�!�(�
�r&c	�`�dgd�|d|dgd�|ddz
|d|d|d	|d
|fzS)Nz"%s, %02d %s %04d %02d:%02d:%02d %s)�Mon�Tue�Wed�Thu�Fri�Sat�Sun��)�Jan�Feb�Mar�Apr�May�Jun�Jul�Aug�Sep�Oct�Nov�DecrAr����)�	timetuple�zones  r�_format_timetuple_and_zoner��sZ��/�9�)�A�,�G��!��	3�3<�Q�<�!�3C�	E��!��i��l�I�a�L�)�A�,��
3��r&c�
�	|�tj�}tjj|tjj�}|r|j�}d}n|s|j
d��}t||�S)NF)�tzinfo)�time�datetime�
fromtimestamp�timezone�utc�
astimezoner!r)�timeval�	localtime�usegmt�dts    rrr�sp���"���)�)�+��	�	�	�	(�	(��(�2C�2C�2G�2G�	H�B��
�]�]�_����
�
�Z�Z�t�Z�
$���2�v�&�&r&c��	|j�}|rA|j�'|jtjjk7rtd��d}n |j�d}n|j
d�}t||�S)Nz%usegmt option requires a UTC datetime�GMTz-0000z%z)r�r�r�r�r��
ValueError�strftimer�)r�r��nowr�s    rrrss���
�,�,�.�C�
�
�9�9���	�	�X�->�->�-B�-B� B��D�E�E���	���	����{�{�4� ��%�c�4�0�0r&c���	ttj�dz�}tj�}t	j
d�}|�d}nd|z}|�t
j�}d|||||fz}|S)N�d�@r�.z<%d.%d.%d%s@%s>)�intr��os�getpid�random�getrandbits�socket�getfqdn)�idstring�domainr��pid�randint�msgids      rr
r
"sw����$�)�)�+�c�/�"�G�
�)�)�+�C�� � ��$�G�������>��
�~����!����#�w��&� I�I�E��Lr&c	��t|�}|�tdt|�z��|�^}}|�tj|dd�Stj|dddtjtj
|���i�S)Nz!Invalid date value or format "%s"ror�)�seconds)rr�r0r�r��	timedelta)�data�parsed_date_tz�dtuple�tzs    rrr9s���"�4�(�N����<�s�4�y�H�I�I� �K�V�R�	�z�� � �&��!�*�-�-����f�R�a�j�F��$�$�X�%7�%7��%C�D�F�Fr&c��	|st|�j}|sy|dSt|t�r|d}t|t�syt|g�d}t
t|�j�}|rt|�dkDry|dS)NrQrrA)rSrTr/�listr0rUrVrC)r;rI�addrss   rrrDs������T�"�.�.�����Q�x���$����A�w���d�C� �� �$��(��+�D�"�<��#5�#A�#A�B�E��C��J��N����8�Or&c��	t|�dkDrn|jd�r6|jd�r%|ddjdd�jdd�S|jd�r|jd�r|ddS|S)	NrAr)���z\\r9z\"�<r*)rC�
startswith�endswithr!rLs rrrcsu��&�
�3�x�!�|��>�>�#��3�<�<��#4��q��9�$�$�V�T�2�:�:�5�#�F�F��>�>�#��3�<�<��#4��q��9���Jr&c�Z�	|jtd�}t|�dkrdd|fS|S)Nrp)�split�TICKrC)r�partss  rrros1��-�
�G�G�D�!��E�
�5�z�Q���T�1�}���Lr&c�x�	tjj|d|xsd��}|�|�|S|�d}|�d|�d|��S)Nrr()�safe�encodingr)�urllib�parser)rr3�languages   rrrwsP���	�����1�2��0B�7��C�A���8�+������� �(�A�.�.r&z&^(?P<name>\w+)\*((?P<num>[0-9]+)\*?)?$c��	|dg}i}|ddD]�\}}|jd�}t|�}tj|�}|rG|j	dd�\}}|�t|�}|j
|g�j|||f���|j|dt|�zf���|r�|j�D]�\}}g}d}	|j�|D]<\}}
}|r#tjj|
d�	�}
d
}	|j|
��>ttj|��}|	r)t|�\}}}|j|||d|zff���|j|d|zf���|S)NrrA�*r4�numz"%s"Fzlatin-1)r�T)r�r�rfc2231_continuation�match�groupr��
setdefaultrBr�items�sortr�r��EMPTYSTRINGrDr)
�params�
new_params�rfc2231_paramsr4�value�encoded�mor��
continuations�extendedrr3r�s
             rrr�s������)��J��N��a�b�z���e��-�-��$������
!�
'�
'��
-��
������/�I�D�#����#�h���%�%�d�B�/�6�6��U�G�7L�M����t�V�e�E�l�%:�;�<�"��#1�#7�#7�#9��D�-��E��H���� �$1���Q������,�,�Q��,�C�A�#�H����Q��$1��+�*�*�5�1�2�E��+9�%�+@�(���5��!�!�4�'�8�V�e�^�)L�"M�N��!�!�4��%��"8�9�/$:�0�r&c���t|t�rt|�dk7rt|�S|\}}}|�|}t	|d�}	t|||�S#t$rt|�cYSwxYw)Nr}zraw-unicode-escape)r/�tuplerCr�bytesr0�LookupError)r��errors�fallback_charsetr3r��text�rawbytess       rrr�st���e�U�#�s�5�z�Q���u�~��$��G�X�t���#���T�/�0�H���8�W�f�-�-�����t�}���s�A�A%�$A%c��	|�ddl}|jddd��|�tjj�}|j	�S)Nrz$The 'isdst' parameter to 'localtime'z>{name} is deprecated and slated for removal in Python {remove})r}�)�message�remove)�warnings�_deprecatedr�r�r�)r��isdstr�s   rr�r��sU���
������2�T��	�	�

�z�
�
�
�
"�
"�
$��
�=�=�?�r&)r)NFF)F)NN)r!zus-ascii)3�__all__r��rer�r�r�r��urllib.parser��email._parseaddrrrrSrr
rr�
email.charsetrrRr��UEMPTYSTRING�CRLFr��compiler+r-rr%rr?rH�supports_strict_parsingr	r`rUrVr�rrr
rrrrr�ASCIIr�rrr�r�r&r�<module>r�s��
���$
�	��
�
���"�8�&�C�C�"�
�
�����
��
��
�R�Z�Z�+�
,�
��B�J�J�x� �	�	�5��B��2��(,�)�X��	��'�:1�&�.F�#��>��/�"�r�z�z�"K��H�H���.�`*3�,6��4r&

?>