%PDF- %PDF-
Mini Shell

Mini Shell

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

�

���f�B�	��gd�ZddlmZddlZddlZddlmZddlmZdZ	dZ
dZd	Zd
Z
dZdZid
e	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�de	e	df�d
d�de
e
df�de
e
df�de
ddf�de
ddf�e
ddfe
e
dfee
dfd ��Zid!d
�d"d
�d#d�d$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�dddd2dd3d
d4��Zd5d6dd7�Zdd8�Zd9�Zd:�Zd;�ZGd<�d=�Zy)>)�Charset�	add_alias�add_charset�	add_codec�)�partialN)�errors)�encode_7or8bit�����us-asciizunknown-8bit�z
iso-8859-1z
iso-8859-2z
iso-8859-3z
iso-8859-4z
iso-8859-9ziso-8859-10ziso-8859-13ziso-8859-14ziso-8859-15ziso-8859-16zwindows-1252�viscii)NNN�big5�gb2312zeuc-jp�iso-2022-jp�	shift_jis�utf-8)rzkoi8-rr�latin_1zlatin-1�latin_2zlatin-2�latin_3zlatin-3�latin_4zlatin-4�latin_5zlatin-5�latin_6zlatin-6�latin_7zlatin-7�latin_8zlatin-8�latin_9zks_c_5601-1987zeuc-kr)zlatin-9�latin_10zlatin-10�cp949�euc_jp�euc_kr�ascii�eucgb2312_cn�big5_tw)rrrc�D�|tk(rtd��|||ft|<y)a>Add character set properties to the global registry.

    charset is the input character set, and must be the canonical name of a
    character set.

    Optional header_enc and body_enc is either charset.QP for
    quoted-printable, charset.BASE64 for base64 encoding, charset.SHORTEST for
    the shortest of qp or base64 encoding, or None for no encoding.  SHORTEST
    is only valid for header_enc.  It describes how message headers and
    message bodies in the input charset are to be encoded.  Default is no
    encoding.

    Optional output_charset is the character set that the output should be
    in.  Conversions will proceed from input charset, to Unicode, to the
    output charset when the method Charset.convert() is called.  The default
    is to output in the same character set as the input.

    Both input_charset and output_charset must have Unicode codec entries in
    the module's charset-to-codec mapping; use add_codec(charset, codecname)
    to add codecs the module does not know about.  See the codecs module's
    documentation for more information.
    z!SHORTEST not allowed for body_encN)�SHORTEST�
ValueError�CHARSETS)�charset�
header_enc�body_enc�output_charsets    �$/usr/lib/python3.12/email/charset.pyrrjs)��.�8���<�=�=�#�X�~�>�H�W��c��|t|<y)z�Add a character set alias.

    alias is the alias name, e.g. latin-1
    canonical is the character set's canonical name, e.g. iso-8859-1
    N)�ALIASES)�alias�	canonicals  r.rr�s
���G�E�Nr/c��|t|<y)a$Add a codec that map characters in the given charset to/from Unicode.

    charset is the canonical name of a character set.  codecname is the name
    of a Python codec, as appropriate for the second argument to the unicode()
    built-in, or to the encode() method of a Unicode string.
    N)�	CODEC_MAP)r*�	codecnames  r.rr�s��#�I�g�r/c�Z�|tk(r|jdd�S|j|�S)Nr#�surrogateescape)�UNKNOWN8BIT�encode)�string�codecs  r.�_encoder=�s+������}�}�W�&7�8�8��}�}�U�#�#r/c�J�eZdZdZefd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
y)ra@	Map character sets to their email properties.

    This class provides information about the requirements imposed on email
    for a specific character set.  It also provides convenience routines for
    converting between character sets, given the availability of the
    applicable codecs.  Given a character set, it will do its best to provide
    information on how to use that character set in an email in an
    RFC-compliant way.

    Certain character sets must be encoded with quoted-printable or base64
    when used in email headers or bodies.  Certain character sets must be
    converted outright, and are not allowed in email.  Instances of this
    module expose the following information about a character set:

    input_charset: The initial character set specified.  Common aliases
                   are converted to their `official' email names (e.g. latin_1
                   is converted to iso-8859-1).  Defaults to 7-bit us-ascii.

    header_encoding: If the character set must be encoded before it can be
                     used in an email header, this attribute will be set to
                     charset.QP (for quoted-printable), charset.BASE64 (for
                     base64 encoding), or charset.SHORTEST for the shortest of
                     QP or BASE64 encoding.  Otherwise, it will be None.

    body_encoding: Same as header_encoding, but describes the encoding for the
                   mail message's body, which indeed may be different than the
                   header encoding.  charset.SHORTEST is not allowed for
                   body_encoding.

    output_charset: Some character sets must be converted before they can be
                    used in email headers or bodies.  If the input_charset is
                    one of them, this attribute will contain the name of the
                    charset output will be converted to.  Otherwise, it will
                    be None.

    input_codec: The name of the Python codec used to convert the
                 input_charset to Unicode.  If no conversion codec is
                 necessary, this attribute will be None.

    output_codec: The name of the Python codec used to convert Unicode
                  to the output_charset.  If no conversion codec is necessary,
                  this attribute will have the same value as the input_codec.
    c��	t|t�r|jd�nt|d�}|j
�}tj||�|_	tj|jttdf�\}}}|s|j}||_
||_tj||�|_t j|j|j�|_t j|j|j�|_y#t$rt	j
|��wxYw)Nr#)�
isinstance�strr:�UnicodeErrorr�CharsetError�lowerr1�get�
input_charsetr)r'�BASE64�header_encoding�
body_encodingr-r5�input_codec�output_codec)�selfrF�henc�benc�convs     r.�__init__zCharset.__init__�s��
	5��-��-��$�$�W�-� #�M�7� ;�
�&�+�+�-�
�$�[�[��
�F���$�<�<��(:�(:�)1�6�4�(@�B���d�D���%�%�D�#���!���%�k�k�$��5���%�=�=��);�);�)-�);�);�=���%�M�M�$�*=�*=�*.�*=�*=�?����)�	5��%�%�m�4�4�	5�s�.D � D?c�6�|jj�S�N)rFrD�rLs r.�__repr__zCharset.__repr__�s���!�!�'�'�)�)r/c�L�t|�t|�j�k(SrR)rArD)rL�others  r.�__eq__zCharset.__eq__�s���4�y�C��J�,�,�.�.�.r/c��|jtk7sJ�|jtk(ry|jtk(rytS)aPReturn the content-transfer-encoding used for body encoding.

        This is either the string `quoted-printable' or `base64' depending on
        the encoding used, or it is a function in which case you should call
        the function with a single argument, the Message object being
        encoded.  The function should then set the Content-Transfer-Encoding
        header itself to whatever is appropriate.

        Returns "quoted-printable" if self.body_encoding is QP.
        Returns "base64" if self.body_encoding is BASE64.
        Returns conversion function otherwise.
        zquoted-printable�base64)rIr'�QPrGr	rSs r.�get_body_encodingzCharset.get_body_encoding�s@���!�!�X�-�-�-�����#�%�
�
�
�6�
)��!�!r/c�6�|jxs|jS)z�Return the output character set.

        This is self.output_charset if that is not None, otherwise it is
        self.input_charset.
        )r-rFrSs r.�get_output_charsetzCharset.get_output_charset
s���"�"�8�d�&8�&8�8r/c��|jxsd}t||�}|j|�}|�|S|j||�S)a�Header-encode a string by converting it first to bytes.

        The type of encoding (base64 or quoted-printable) will be based on
        this charset's `header_encoding`.

        :param string: A unicode string for the header.  It must be possible
            to encode this string to bytes using the character set's
            output codec.
        :return: The encoded string, with RFC 2047 chrome.
        r)rKr=�_get_encoder�
header_encode)rLr;r<�header_bytes�encoder_modules     r.r`zCharset.header_encodesN���!�!�/�Z���v�u�-���*�*�<�8���!��M��+�+�L�%�@�@r/c���|jxsd}t||�}|j|�}t|j|��}|j�}t
|�tz}g}	g}
t|�|z
}|D]�}|
j|�tj|
�}
|jt|
|��}||kDs�J|
j�|	s|
s|	jd�n8tj|
�}t||�}|	j||��|g}
t|�|z
}��tj|
�}t||�}|	j||��|	S)afHeader-encode a string by converting it first to bytes.

        This is similar to `header_encode()` except that the string is fit
        into maximum line lengths as given by the argument.

        :param string: A unicode string for the header.  It must be possible
            to encode this string to bytes using the character set's
            output codec.
        :param maxlengths: Maximum line length iterator.  Each element
            returned from this iterator will provide the next maximum line
            length.  This parameter is used as an argument to built-in next()
            and should never be exhausted.  The maximum line lengths should
            not count the RFC 2047 chrome.  These line lengths are only a
            hint; the splitter does the best it can.
        :return: Lines of encoded strings, each with RFC 2047 chrome.
        r)r*N)rKr=r_rr`r]�len�RFC2047_CHROME_LEN�next�append�EMPTYSTRING�join�
header_length�pop)rLr;�
maxlengthsr<rarb�encoderr*�extra�lines�current_line�maxlen�	character�	this_line�length�joined_lines                r.�header_encode_lineszCharset.header_encode_lines%s[��$�!�!�/�Z���v�u�-���*�*�<�8���.�6�6��F���)�)�+���G��1�1�������j�!�E�)���	2�I����	�*�#�(�(��6�I�#�1�1�'�)�W�2M�N�F����� � �"��\��L�L��&�"-�"2�"2�<�"@�K�#*�;��#>�L��L�L���!6�7� )�{���j�)�E�1��	2� "�&�&�|�4���{�E�2��
���W�\�*�+��r/c�|�|jtk(rtjS|jtk(rtj
S|jtk(rctjj|�}tj
j|�}||krtjStj
SyrR)rHrG�email�
base64mimerZ�
quoprimimer'rj)rLra�len64�lenqps    r.r_zCharset._get_encoderbs������6�)��#�#�#�
�
!�
!�R�
'��#�#�#�
�
!�
!�X�
-��$�$�2�2�<�@�E��$�$�2�2�<�@�E��u�}��'�'�'��'�'�'�r/c��|s|S|jturJt|t�r|j	|j
�}tjj|�S|jtur[t|t�r|j	|j
�}|jd�}tjj|�St|t�r*|j	|j
�jd�}|S)avBody-encode a string by converting it first to bytes.

        The type of encoding (base64 or quoted-printable) will be based on
        self.body_encoding.  If body_encoding is None, we assume the
        output charset is a 7bit encoding, so re-encoding the decoded
        string using the ascii codec produces the correct string version
        of the content.
        �latin1r#)rIrGr@rAr:r-rxry�body_encoderZ�decoderz)rLr;s  r.rzCharset.body_encodeqs�����M�����'��&�#�&����t�':�':�;���#�#�/�/��7�7�
�
�
�2�
%��&�#�&����t�':�':�;���]�]�8�,�F��#�#�/�/��7�7��&�#�&����t�':�':�;�B�B�7�K���Mr/N)�__name__�
__module__�__qualname__�__doc__�DEFAULT_CHARSETrPrTrWr[r]r`rvr_r�r/r.rr�s=��*�V&5�?�B*�/�"�*9�A�&;�z
�r/r)�__all__�	functoolsr�email.base64mimerx�email.quoprimimer�email.encodersr	rZrGr'rer�r9rhr)r1r5rrrr=rr�r/r.�<module>r�s���
������)�����������������B�r��-���B�r��-���B�r��-�	�
�B�r��-���B�r��-���B�r��-���B�r��-���B�r��-���B�r��-�� �B�r��-�!�"�B�r��-�#�$
�B�r��-�%�&�-�'�(�F�v��-�)�*
�F�v��-�+�,
�F�t�
�6�-�.�F�t�
�6�/�0�t��-��v��-��v�w�/�5��>�
�|��
�|���|���|�	�
�|���|�
��|���|���|���|���}���}���}���}���}�� �}�!�"�}�#�$�������1��<"���

�	�?�8�#�$�l�lr/

Zerion Mini Shell 1.0