%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__/header.cpython-312.pyc

�

���f^���dZgd�ZddlZddlZddlZddlZddlmZddlm	Z
e
jZdZdZ
dZd	Zd
ZdZdZed
�Zed�Zej*dej,ej.z�Zej*d�Zej*d�Zej6j8Zd�Z		dd�ZGd�d�ZGd�d�Z Gd�de!�Z"y)z+Header encoding and decoding functionality.)�Header�
decode_header�make_header�N)�HeaderParseError)�charset�
� � z        ��Nz 	�us-asciizutf-8ai
  =\?                   # literal =?
  (?P<charset>[^?]*?)   # non-greedy up to the next ? is the charset
  \?                    # literal ?
  (?P<encoding>[qQbB])  # either a "q" or a "b", case insensitive
  \?                    # literal ?
  (?P<encoded>.*?)      # non-greedy up to the next ?= is the encoded string
  \?=                   # literal ?=
  z[\041-\176]+:$z
\n[^ \t]+:c
��t|d�rG|jD��cgc]/\}}tj|t	|��t	|�f��1c}}St
j
|�s|dfgSg}|j�D]�}t
j|�}d}|s�|jd�}|r|j�}d}|r|j|ddf�|rc|jd�j�}|jd�j�}|jd�}	|j|	||f�|r����g}
t|�D]K\}}|dkDs�|ds�||dz
ds�||dz
dj�s�8|
j|dz
��Mt|
�D]}
||
=�g}|D]�\}}}|�|j||f��|dk(r3t j"j%|�}|j||f��U|d	k(rOt'|�d
z}|r|ddd
|z
z
}	t j(j+|�}|j||f���t3d
|z��g}dx}}|D]Y\}}t5|t�rt7|d�}|�|}|}�)||k7r|j||f�|}|}�F|�
|t8|zz
}�U||z
}�[|j||f�|Scc}}w#t,j.$rt1d��wxYw)a;Decode a message header value without converting charset.

    Returns a list of (string, charset) pairs containing each of the decoded
    parts of the header.  Charset is None for non-encoded parts of the header,
    otherwise a lower-case string containing the name of the character set
    specified in the encoded string.

    header may be a string that may or may not contain RFC2047 encoded words,
    or it may be a Header object.

    An email.errors.HeaderParseError may be raised when certain decoding error
    occurs (e.g. a base64 decoding exception).
    �_chunksNTrF���q�b�z===zBase64 decoding errorzUnexpected encoding: zraw-unicode-escape)�hasattrr�_charset�_encode�str�ecre�search�
splitlines�split�pop�lstrip�append�lower�	enumerate�isspace�reversed�email�
quoprimime�
header_decode�len�
base64mime�decode�binascii�Errorr�AssertionError�
isinstance�bytes�BSPACE)�header�stringr�words�line�parts�first�	unencoded�encoding�encoded�droplist�n�w�d�
decoded_words�encoded_string�word�paderr�	collapsed�	last_word�last_charsets                     �#/usr/lib/python3.12/email/header.pyrr;sN���v�y�!�+1�>�>�;�'����!�!�&�#�g�,�7��W��F�;�	;��;�;�v�������
�E��!�!�#�;���
�
�4� ������	�	�!��I��%�,�,�.�	�������i��t�4�5���)�)�A�,�,�,�.�� �9�9�Q�<�-�-�/���)�)�A�,�����g�x��9�:��;�"�H��%� �!���1��Q�3�1�Q�4�E�!�A�#�J�q�M�e�A�a�C�j��m�.C�.C�.E��O�O�A�a�C� �!��h�
����!�H���M�-2�E�)���'���� � �.�'�!:�;�
��_��#�#�1�1�.�A�D�� � �$���1�
��_���(�1�,�F���%���V��"4�4��
6��'�'�.�.�~�>���$�$�d�G�_�5� �!8�8�!C�D�D�%E�*�I�#�#�I��&�
�
��g��d�C� ���3�4�D����I�"�L�
��
$����i��6�7��I�"�L�
�
!���$��&�I����I�
����i��.�/����W;��d�>�>�
@�&�'>�?�?�
@�s�4K%�*K+�+L
c��t|||��}|D]4\}}|�t|t�st|�}|j||��6|S)a�Create a Header from a sequence of pairs as returned by decode_header()

    decode_header() takes a header value string and returns a sequence of
    pairs of the format (decoded_string, charset) where charset is the string
    name of the character set.

    This function takes one of those sequence of pairs and returns a Header
    instance.  Optional maxlinelen, header_name, and continuation_ws are as in
    the Header constructor.
    )�
maxlinelen�header_name�continuation_ws)rr-�Charsetr)�decoded_seqrFrGrH�h�srs       rDrr�sV��	�*�+�.�	0�A�!��
��7���z�'�7�'C��g�&�G�	����G��	�

�H�c�B�eZdZ			d	d�Zd�Zd�Zd
d�Zd�Zdd�Zd�Z	y)rNc��|�t}nt|t�st|�}||_||_g|_|�|j
|||�|�t}||_|�d|_	yt|�dz|_	y)aDCreate a MIME-compliant header that can contain many character sets.

        Optional s is the initial header value.  If None, the initial header
        value is not set.  You can later append to the header with .append()
        method calls.  s may be a byte string or a Unicode string, but see the
        .append() documentation for semantics.

        Optional charset serves two purposes: it has the same meaning as the
        charset argument to the .append() method.  It also sets the default
        character set for all subsequent .append() calls that omit the charset
        argument.  If charset is not provided in the constructor, the us-ascii
        charset is used both as s's initial charset and as the default for
        subsequent .append() calls.

        The maximum line length can be specified explicitly via maxlinelen. For
        splitting the first line to a shorter value (to account for the field
        header which isn't included in s, e.g. `Subject') pass in the name of
        the field in header_name.  The default maxlinelen is 78 as recommended
        by RFC 2822.

        continuation_ws must be RFC 2822 compliant folding whitespace (usually
        either a space or a hard tab) which will be prepended to continuation
        lines.

        errors is passed through to the .append() call.
        Nrr)�USASCIIr-rIr�_continuation_wsrr�
MAXLINELEN�_maxlinelen�
_headerlenr')�selfrLrrFrGrH�errorss       rD�__init__zHeader.__init__�s���:�?��G��G�W�-��g�&�G���
� /�������=��K�K��7�F�+���#�J�%������D�O�"�+�.��2�D�OrMc��|j�g}d}d}|jD]�\}}|}|tjk(r$|j	dd�}|jdd�}|rU|xr|j
|d�}|dvr|dvr5|s3|jt�d}n|dvr|s|jt�|xr|j
|d�}|}|j|���tj|�S)z&Return the string value of the header.N�ascii�surrogateescape�replacer�Nr
���)�
_normalizerr�UNKNOWN8BIT�encoder)�	_nonctextr�SPACE�EMPTYSTRING�join)	rU�uchunks�lastcs�	lastspacer1r�nextcs�original_bytes�hasspaces	         rD�__str__zHeader.__str__�s������������	�#�|�|�	#�O�F�G��F���-�-�-�!'���w�8I�!J��'�.�.�w�	�B���!�?�d�n�n�V�A�Y�&?���!3�3��!3�3�H����u�-�!%���#5�5�i��N�N�5�)��=�4�>�>�&��*�#=�I��F��N�N�6�"�+	#�,����(�(rMc��|t|�k(S�N)r)rU�others  rD�__eq__z
Header.__eq__�s����D�	�!�!rMc���|�
|j}nt|t�st|�}t|t�sH|jxsd}|tj
k(r|j
dd�}n|j
||�}|jxsd}|tj
k7r	|j||�|jj||f�y#t$r|dk7r�t}Y�5wxYw)a.Append a string to the MIME header.

        Optional charset, if given, should be a Charset instance or the name
        of a character set (which will be converted to a Charset instance).  A
        value of None (the default) means that the charset given in the
        constructor is used.

        s may be a byte string or a Unicode string.  If it is a byte string
        (i.e. isinstance(s, str) is false), then charset is the encoding of
        that byte string, and a UnicodeError will be raised if the string
        cannot be decoded with that charset.  If s is a Unicode string, then
        charset is a hint specifying the character set of the characters in
        the string.  In either case, when producing an RFC 2822 compliant
        header using RFC 2047 rules, the string will be encoded using the
        output codec of the charset.  If the string cannot be encoded to the
        output codec, a UnicodeError will be raised.

        Optional `errors' is passed as the errors argument to the decode
        call if s is a byte string.
        Nr
rZ)
rr-rIr�input_codecr_r)�output_codecr`�UnicodeEncodeError�UTF8rr)rUrLrrV�
input_charset�output_charsets      rDrz
Header.appends���*�?��m�m�G��G�W�-��g�&�G��!�S�!�#�/�/�=�:�M��� 4� 4�4��H�H�Z�):�;���H�H�]�F�3��!�-�-�;����X�1�1�1�
������0�
	
�����Q��L�)��	&�
�!�:�-����
�s�'C�C/�.C/c�.�|j�xs|dvS)z=True if string s is not a ctext character of RFC822.
        )�(�)�\)r")rUrLs  rDrazHeader._nonctext0s���y�y�{�3�a�#3�3�3rMc�.�|j�|�|j}|dk(rd}t|j||j|�}d}dx}}|j
D�][\}}	|�I|xr|j
|d�}|dvr|r|	dvr'|j�n|	dvr|s|j�|xr|j
|d�}|	}d}|j�}
|
r|jd|
d|	�n|jdd|	�|
ddD]�}|j�|	j�/|j|jd	|j�z|	��N|j�}|dt|�t|�z
}
|j|
||	���t|
�dkDs��L|j���^|j
r|j�|j|�}tj!|�rt#d
j%|���|S)a�Encode a message header into an RFC-compliant format.

        There are many issues involved in converting a given string for use in
        an email header.  Only certain character sets are readable in most
        email clients, and as header strings can only contain a subset of
        7-bit ASCII, care must be taken to properly convert and encode (with
        Base64 or quoted-printable) header strings.  In addition, there is a
        75-character length limit on any given encoded header field, so
        line-wrapping must be performed, even with double-byte character sets.

        Optional maxlinelen specifies the maximum length of each generated
        line, exclusive of the linesep string.  Individual lines may be longer
        than maxlinelen if a folding point cannot be found.  The first line
        will be shorter by the length of the header name plus ": " if a header
        name was specified at Header construction time.  The default value for
        maxlinelen is determined at header construction time.

        Optional splitchars is a string containing characters which should be
        given extra weight by the splitting algorithm during normal header
        wrapping.  This is in very rough support of RFC 2822's `higher level
        syntactic breaks':  split points preceded by a splitchar are preferred
        during line splitting, with the characters preferred in the order in
        which they appear in the string.  Space and tab may be included in the
        string to indicate whether preference should be given to one over the
        other as a split point when other split chars do not appear in the line
        being split.  Splitchars does not affect RFC 2047 encoded lines.

        Optional linesep is a string to be used to separate the lines of
        the value.  The default value is the most useful for typical
        Python applications, but it can be set to \r\n to produce RFC-compliant
        line separators when needed.
        Nri@Br\r]Frrr	z8header value appears to contain an embedded header: {!r})r^rS�_ValueFormatterrTrQrra�add_transitionr�feed�newline�header_encodingrr'�_str�_embedded_headerrr�format)rU�
splitcharsrF�linesep�	formatterrfrjrgr1r�linesr3�sline�fws�values               rDr`z
Header.encode5s��B	
�������)�)�J���?� �J�#�D�O�O�Z�$(�$9�$9�:�G�	���#�#��9�#�|�|�	$�O�F�G��#�!�?�d�n�n�V�A�Y�&?���!3�3�#�w�6H�'H�!�0�0�2��$6�6�y��,�,�.��=�4�>�>�&��*�#=�I��F��H��%�%�'�E�����r�5��8�W�5����r�2�w�/��a�b�	�
8���!�!�#��*�*�6��N�N�4�#8�#8�#����
�:M�#*�,�!�K�K�M�E��4��D�	�#�e�*� 4�5�C��N�N�3��w�7�
8��5�z�A�~��!�!�#�5	$�6�<�<��$�$�&����w�'���"�"�5�)�"�$+�+1�6�%�=�:�
:��rMc��g}d}g}|jD]I\}}||k(r|j|��|�&|jtj|�|f�|g}|}�K|r&|jtj|�|f�||_yrm)rrrbrd)rU�chunksrC�
last_chunkr1rs      rDr^zHeader._normalize�s��������
�#�|�|�	'�O�F�G��,�&��!�!�&�)��+��M�M�5�:�:�j�#9�<�"H�I�$�X�
�&��	'���M�M�5�:�:�j�1�<�@�A���rM)NNNNr	�strict)Nr�)z;, 	Nr)
�__name__�
__module__�__qualname__rWrkrorrar`r^�rMrDrr�s3��'+�.2�-5�-3�^)�@"�)*�V4�
N�`rMrc�B�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)r|c�|�||_||_t|�|_||_g|_t
|�|_yrm)�_maxlenrQr'�_continuation_ws_len�_splitchars�_lines�_Accumulator�
_current_line)rU�	headerlen�maxlenrHr�s     rDrWz_ValueFormatter.__init__�s:����� /���$'��$8��!�%������)�)�4��rMc�X�|j�|j|j�Srm)rrdr�)rUr�s  rDr�z_ValueFormatter._str�s�������|�|�D�K�K�(�(rMc�,�|jt�Srm)r��NL�rUs rDrkz_ValueFormatter.__str__�s���y�y��}�rMc���|jj�}|dk7r|jj|�t|j�dkDr|jj	�r7|j
r+|j
dxxt
|j�z
cc<n.|j
jt
|j��|jj�y)N)r	rrr])	r�r�pushr'�	is_onlywsr�rr�reset)rU�end_of_lines  rDrz_ValueFormatter.newline�s����(�(�,�,�.���)�#�#�D���#�#�[�1��t�!�!�"�Q�&��!�!�+�+�-�$�+�+����B��3�t�'9�'9�#:�:�����"�"�3�t�'9�'9�#:�;���� � �"rMc�<�|jjdd�y)Nr	r)r�r�r�s rDr}z_ValueFormatter.add_transition�s��������R�(rMc��|j�|j|||j�y|j||j	��}	|jd�}|�|j||�	|j�}|j�|jj|j|�|D]*}|jj|j|z��,y#t$rYywxYw#t$rYywxYw�Nr)r��_ascii_splitr��header_encode_lines�_maxlengthsr�
IndexError�
_append_chunkrr�r�rQr�r)rUr�r1r�
encoded_lines�
first_line�	last_liner3s        rDr~z_ValueFormatter.feed�s���"�"�*����c�6�4�+;�+;�<�� �3�3�F�D�<L�<L�<N�O�
�	�&�*�*�1�-�J��!����s�J�/�	�%�)�)�+�I�	
���������� 5� 5�y�A�!�	=�D��K�K���t�4�4�t�;�<�	=���	��	���	��	�s$�C(�2C7�(	C4�3C4�7	D�Dc#�K�|jt|j�z
��	|j|jz
����wrm)r�r'r�r�r�s rDr�z_ValueFormatter._maxlengths�s=�����l�l�S��!3�!3�4�4�4���,�,��!:�!:�:�:��s�AAc���tjdtzdz||z�}|drdg|ddn|jd�t	t|�gdz�D]\}}|j
||��y)Nz([z]+)rrr)�rer�FWSr�zip�iterr�)rUr�r1r�r4�parts      rDr�z_ValueFormatter._ascii_split�sq������c��%���V��4����8���E�"�1�I��I�I�a�L��t�E�{�m�A�o�.�	*�I�C�����s�D�)�	*rMc�:�|jj||�t|j�|jkD�r\|jD]�}t|jj
�dz
dd�D]R}|j�r|j|d}|r
|d|k(rn%|j|dz
d}|s�I|d|k(s�Rn��nh|jj�\}}|jjdkDr|j�|sd}|jj||�y|jj|�}|jjt|j��|jj|�yy)Nrrr]r	)r�r�r'r�r��range�
part_countr"r�
_initial_sizer�pop_fromr�rrr�)rUr�r1�ch�i�prevpartr��	remainders        rDr�z_ValueFormatter._append_chunk�sx��������V�,��t�!�!�"�T�\�\�1��&�&�
���t�1�1�<�<�>�q�@�!�R�H�	�A��z�z�|�"�0�0��3�A�6���3�q�6�2�:�!�#�1�1�!�A�#�6�q�9�H��H�R�L�"�$4��	���
�!�.�.�2�2�4�	��T��%�%�3�3�a�7��L�L�N��"���"�"�'�'��T�2���*�*�3�3�A�6�I��K�K���s�4�#5�#5�6�7����$�$�Y�/�92rMN)r�r�r�rWr�rkrr}r~r�r�r�r�rMrDr|r|�s0��5�)��	#�)�#=�J;�*�,0rMr|c�\��eZdZd
�fd�	Zd�Zd
d�Z�fd�Zd�Zd�Zdd�Z	d�Z
�fd	�Z�xZS)r�c�0��||_t�|�	�yrm)r��superrW)rU�initial_size�	__class__s  �rDrWz_Accumulator.__init__s���)���
���rMc�*�|j||f�yrm)r)rUr�r1s   rDr�z_Accumulator.pushs�����S�&�M�"rMc��||d}g||d|Srmr�)rUr��poppeds   rDr�z_Accumulator.pop_from!s���a�b�����Q�R���
rMc�H��|j�dk(ryt�|�	�S)Nr)rr)r�r�r�rUr�s �rDrz_Accumulator.pop&s!����?�?��a����w�{�}�rMc�<�td�|D�|j�S)Nc3�PK�|]\}}t|�t|�z��� y�wrm)r'��.0r�r�s   rD�	<genexpr>z'_Accumulator.__len__.<locals>.<genexpr>,s!����=�9�3��C��H�S��Y�&�=���$&)�sumr�r�s rD�__len__z_Accumulator.__len__+s ���=��=��%�%�'�	'rMc�:�tjd�|D��S)Nc3�PK�|]\}}tj||f���� y�wrm�rcrdr�s   rDr�z'_Accumulator.__str__.<locals>.<genexpr>0s+����!7�$-�C��"-�!1�!1�3��+�!>�!7�r�r�r�s rDrkz_Accumulator.__str__/s"�����!7�15�!7�8�	8rMc�$�|�g}||ddd|_yr�)r�)rU�startvals  rDr�z_Accumulator.reset3s�����H���Q����rMc�`�|jdk(xr|xst|�j�Sr�)r�rr"r�s rDr�z_Accumulator.is_onlyws9s,���!�!�1�$�J�d�(�*I�c�$�i�6G�6G�6I�JrMc� ��t�|��Srm)r�r�r�s �rDr�z_Accumulator.part_count<s����w�� � rM)rrm)
r�r�r�rWr�r�rr�rkr�r�r��
__classcell__)r�s@rDr�r�s6����#��
�
'�8��K�!�!rMr�)NNr	)#�__doc__�__all__r�r*�email.quoprimimer$�email.base64mime�email.errorsrrrrIr�rbr/�SPACE8rcrRr�rPrt�compile�VERBOSE�	MULTILINEr�fcrer�r%�_max_appendrrrr|�listr�r�rMrD�<module>r�s��
2���
����)�%�
�
�
��	����	
��	����
�
���
�*�
���w����r�z�z��
�z�z�B�L�L� �"���r�z�z�#�$���2�:�:�m�,�����*�*��[�|;?� #�
�,f�f�R}0�}0�@%!�4�%!rM

Zerion Mini Shell 1.0