Mini Shell
�
ٚ�(p��� � � d Z g d�ZddlZddlZddlZddlZddlZddlZddlZ ddl
mZ ddl
mZ
ddl
mZ ddl
mZmZmZ ddlmZ d Zd
Zd
ZdZdZ ej d
� � Z ej d� � Zd� Zd� Zd,d�Zd� Zd� Z dZ!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. ej d%ej/ � � Z0d&� Z1 d0d)�Z2d1d+�Z3dS )2zMiscellaneous utilities.)�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 �R � | � � � dS # t $ r Y dS w xY w)z;Return True if s may contain surrogate-escaped binary data.FT)�encode�UnicodeEncodeError)�ss �2/opt/alt/python311/lib64/python3.11/email/utils.py�_has_surrogatesr 4 s; � �
� ���
�
�
��u��� � � ��t�t����s � �
&�&c �Z � | � dd� � }|� dd� � S )N�utf-8�surrogateescape�replace)r �decode)�string�original_bytess r � _sanitizer% A s. � �
�]�]�7�,=�>�>�N�� � ��)�4�4�4� r c � � | \ }}|� d� � |r� |� d� � d}t � |� � rd}t � d|� � }|�|�|�d|�d�S # t
$ rD t
|t � � rt |� � }|� |� � }|�d|�d�cY S w xY w|S )a� The inverse of parseaddr(), this takes a 2-tuple of the form
(realname, email_address) and returns the string value suitable
for an RFC 2822 From, To or Cc header.
If the first element of pair is false, then the second element is
returned unmodified.
The optional charset is the character set that is used to encode
realname in case realname is not ASCII safe. Can be an instance of str or
a Charset-like object which has a header_encode method. Default is
'utf-8'.
�asciir �"z\\\g<0>z <�>)
r �
specialsre�search� escapesre�subr �
isinstance�strr �
header_encode)�pair�charset�name�address�quotes�encoded_names r r r M s� � � �M�D�'��N�N�7�����
C� C��K�K�� � � � �F�� � ��&�&�
����=�=��T�2�2�D�$*�F�D�D�&�&�&�'�'�'�B�B�� "� 7� 7� 7��'�3�'�'�
+�!�'�*�*��"�0�0��6�6�L� ,���g�g�g�6�6�6�6� 7���� �Ns �A8 �8AC�Cc # � K � d}d}t | � � D ]"\ }}|r|d|z fV � d}�|dk rd}�||fV � �#|r|dfV � d S d S )Nr F�\T)� enumerate)�addr�pos�escape�chs r �_iter_escaped_charsr? n s� � � � �
�C�
�F��T�?�?� � ���R�� ���r� �"�"�"�"��F�F�
�4�Z�Z��F�F���)�O�O�O�O�
� ��D�k������� r&