Hacked By AnonymousFox

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

�

0�f]!��2�dZddlZddlZddlZddlZddlmZmZddlm	Z	gd�Z
ejejd�jd��Zd�ZGd	�d
e�Ze�Zdeed�<d
�Zd�Zd�Zd�Zd�Zeed�Zd�Zeed�Zeed�Zdd�Zy)z� Routines for manipulating RFC2047 encoded words.

This is currently a package-private API, but will be considered for promotion
to a public API if there is demand.

�N)�
ascii_letters�digits)�errors)�decode_q�encode_q�decode_b�encode_b�len_q�len_b�decode�encodes=([a-fA-F0-9]{2})c�f�tj|jd�j��S)N�)�bytes�fromhex�groupr)�ms �;/opt/alt/python312/lib64/python3.12/email/_encoded_words.py�<lambda>rAs��%�-�-�����
� 1� 1� 3�4�c�@�|jdd�}t|�gfS)N�_� )�replace�_q_byte_subber)�encodeds rrrCs"���o�o�d�D�)�G��'�"�B�&�&rc�b�eZdZdejd�zejd�zZd�Zy)�	_QByteMaps-!*+/�asciic�v�||jvrt|�||<||Sdj|�||<||S)Nz={:02X})�safe�chr�format)�self�keys  r�__missing__z_QByteMap.__missing__MsG���$�)�)���C��D��I��C�y��"�(�(��-�D��I��C�y�rN)�__name__�
__module__�__qualname__rr
rr!r&�rrrrIs/���*�m�*�*�7�3�3�m�f�m�m�G�6L�L�D�rr�_� c�2�djd�|D��S)N�c3�.K�|]
}t|���y�w�N)�_q_byte_map��.0�xs  r�	<genexpr>zencode_q.<locals>.<genexpr>Zs����3�a�;�q�>�3�s�)�join��bstrings rrrYs��
�7�7�3�7�3�3�3rc�&�td�|D��S)Nc3�@K�|]}tt|����y�wr0)�lenr1r2s  rr5zlen_q.<locals>.<genexpr>]s����4�q�s�;�q�>�"�4�s�)�sumr7s rr
r
\s���4�G�4�4�4rc�P�t|�dz}|rddd|z
nd}	tj||zd��|rtj�gfSgfS#t
j$r�	tj|d��tj�gfcYS#t
j$r|	tj|dzd��tj�tj�gfcYcYS#t
j$r|tj�gfcYcYcYSwxYwwxYwwxYw)N�s===rT)�validateFs==)	r;�base64�	b64decoder�InvalidBase64PaddingDefect�binascii�Error�InvalidBase64CharactersDefect�InvalidBase64LengthDefect)r�pad_err�missing_paddings   rrrds7���'�l�Q��G�,3�f�Z�a��i�(��O�E����W��6��F�5<�V�
.�
.�
0�1�
�	
�BD�
�	
���>�>�E�	E�� � ��5�9��5�5�7�8��
���~�~�	E�
E��$�$�W�u�_�u�E��9�9�;��6�6�8�:����
�>�>�
E���!A�!A�!C� D�D�D�

E��	E��E�sZ�0A�
A�D%�$+B�D%�D!�&AC,�'D!�(D%�,*D�D!�D%�D�D!�!D%c�J�tj|�jd�S)Nr)r@�	b64encoderr7s rr	r	�s�����G�$�+�+�G�4�4rc�N�tt|�d�\}}|dz|rdzSdzS)N�r>r)�divmodr;)r8�groups_of_3�leftovers   rrr�s0��"�3�w�<��3��K����?�8�a�3�3��3�3r)�q�bc�<�|jd�\}}}}}|jd�\}}}|j�}|jdd�}t	||�\}}	|j|�}||||fS#t$r=|jtjd|�d���|j|d�}Y�Kttf$rP|jdd�}|j�dk7r(|jtjd|�d	���Y��wxYw)
a�Decode encoded word and return (string, charset, lang, defects) tuple.

    An RFC 2047/2243 encoded word has the form:

        =?charset*lang?cte?encoded_string?=

    where '*lang' may be omitted but the other parts may not be.

    This function expects exactly such a string (that is, it does not check the
    syntax and may raise errors if the string is not well formed), and returns
    the encoded_string decoded first from its Content Transfer Encoding and
    then from the resulting bytes into unicode using the specified charset.  If
    the cte-decoded string does not successfully decode using the specified
    character set, a defect is added to the defects list and the unknown octets
    are replaced by the unicode 'unknown' character \uFDFF.

    The specified charset and language are returned.  The default for language,
    which is rarely if ever encountered, is the empty string.

    �?�*r�surrogateescapez0Encoded word contains bytes not decodable using z charset�unknown-8bitzUnknown charset z* in encoded word; decoded as unknown bytes)
�split�	partition�lowerr
�
_cte_decodersr�UnicodeDecodeError�appendr�UndecodableBytesDefect�LookupError�UnicodeEncodeError�CharsetError)	�ewr+�charset�cte�
cte_string�langr8�defects�strings	         rrr�s1��*&(�X�X�c�]�"�A�w��Z���(�(��-��G�Q��

�)�)�+�C�����):�;�G�$�S�)�'�2��G�W�
?�����(���7�D�'�)�)���<����v�4�4�62�29��H�6F�G�	H�����):�;���+�,�?�����):�;���=�=�?�n�,��N�N�6�.�.�1A�'��M<�0=�>�
?��?�s�!A8�8AD�=AD�Dc��|dk(r|jdd�}n|j|�}|�(td|�}td|�}||z
dkrdnd}t||�}|rd|z}dj||||�S)	aEncode string using the CTE encoding that produces the shorter result.

    Produces an RFC 2047/2243 encoded word of the form:

        =?charset*lang?cte?encoded_string?=

    where '*lang' is omitted unless the 'lang' parameter is given a value.
    Optional argument charset (defaults to utf-8) specifies the charset to use
    to encode the string to binary before CTE encoding it.  Optional argument
    'encoding' is the cte specifier for the encoding that should be used ('q'
    or 'b'); if it is None (the default) the encoding which produces the
    shortest encoded sequence is used, except that 'q' is preferred if it is up
    to five characters longer.  Optional argument 'lang' (default '') gives the
    RFC 2243 language string to specify in the encoded word.

    rVrrUrPrQ�rTz=?{}{}?{}?{}?=)r
�_cte_encode_length�
_cte_encodersr#)rgrb�encodingrer8�qlen�blenrs        rr
r
�s���"�.� ��-�-��):�;���-�-��(����!�#�&�w�/��!�#�&�w�/����+��/�3�s���H�%�g�.�G���T�z���"�"�7�D�(�G�D�Dr)zutf-8Nr.)�__doc__�rer@rC�	functoolsrgrr�emailr�__all__�partial�compile�subrr�dictrr1�ordrr
rr	rrZrrkrjr
r*rr�<module>rys����R
�
���(��
��#��"�"�:�2�:�:�.C�#D�#H�#H�4�6��'�	��	��k����C��H��4�5�$E�L5�4�
�	��
�
'*�V
�	��
�
�	���
Er

Hacked By AnonymousFox1.0, Coded By AnonymousFox