AlkantarClanX12

Your IP : 3.142.54.136


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

�

�Q�fu$���dZddlZddlZddlZddgZdZejeed��d�Zejd	�jZGd
�de�Z
d�Zd
�Zd�Zd�Zd�Zd�Zddgfd�Zdd�Zgfd�Zd�Zd�Zd�Zedk(re�yy)z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchztThe {name} module is deprecated and will be removed in Python {remove}. See the mimetypes module for an alternative.)��
)�removec��d|vrd|dfSy)N�linenor)�r�)�entrys �./opt/alt/python312/lib64/python3.12/mailcap.py�lineno_sort_keyrs���5���%��/�!�!��z[^\xa1-\U0010FFFF\w@+=:,./-]c��eZdZdZy)�UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)�__name__�
__module__�__qualname__�__doc__rrr
rrs��3rrc�
�i}d}t�D]V}	t|d�}|5t||�\}}ddd�j	�D]\}}||vr|||<�|||z||<��X|S#t$rY�fwxYw#1swY�IxYw)a�Return a dictionary containing the mailcap database.

    The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain')
    to a list of dictionaries corresponding to mailcap entries.  The list
    collects all the entries for that MIME type from all available mailcap
    files.  Each dictionary contains key-value pairs for that MIME type,
    where the viewing command is stored with the key "view".

    r�rN)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsr	�mailcap�fp�morecaps�key�values       r
rrs����D�
�F�#�%��	��g�s�#�B��/��F�;��H�f��"�.�.�*�J�C���$�;�!��S�	� ��I��-��S�	�	+�&��K���	��	��
�R�s�A*�A9�*	A6�5A6�9B	c���dtjvr4tjd}|jtj�}|Sdtjvrtjd}nd}|dzdddg}|S)z7Return a list of all mailcap files found on the system.�MAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)�pathstr�mailcaps�homes   r
rr9sv���R�Z�Z���*�*�Z�(���=�=����,���O��R�Z�Z���:�:�f�%�D��D��;�&��"�$<�>���Orc�Z�tjdtd�t|d�\}}|S)z?Read a mailcap file and return a dictionary keyed by MIME type.z2readmailcapfile is deprecated, use getcaps instead�N)�warnings�warn�DeprecationWarningr)rr�_s   r
�readmailcapfiler4Ks+���M�M�F�$�a�)��r�4�(�G�D�!��Krc�(�i}|j�x}r�|ddk(s|j�dk(r�.|}|dddk(r%|j�}|sd}|dd|z}|dddk(r�%t|�\}}|r|s�p|�
||d<|d	z
}|jd
�}t	t|��D]}||j�||<�d
j
|�j�}||vr||j|�n|g||<|j�x}r��||fS)a�Read a mailcap file and return a dictionary keyed by MIME type.

    Each MIME type is mapped to an entry consisting of a list of
    dictionaries; the list will contain more than one such dictionary
    if a given MIME type appears more than once in the mailcap file.
    Each dictionary contains key-value pairs for that MIME type, where
    the viewing command is stored with the key "view".
    r�#����Nz\
�
r	r
�/)	�readline�strip�	parseliner)�range�len�join�lower�append)	rr	r�line�nextliner!�fields�types�js	         r
rrSs7���D��+�+�-�
�$�
���7�c�>�T�Z�Z�\�R�/�����r�s�m�v�%��{�{�}�H���X����9�x�'�D��r�s�m�v�%�
 ��o���V������%�F�8���a�K�F��	�	�#����s�5�z�"�A��Q�x�~�~�'�E�!�H�#��h�h�u�o�#�#�%���$�;���I���V�$���D��I�5�+�+�-�
�$�
�6��<�rc�x�g}dt|�}}||kr,t|||�\}}|j|�|dz}||kr�,t|�dkry|d|d|dd}}}d|i}|D]P}|jd�}|dkr|}d}	n)|d|j	�}||dzdj	�}	||vr�L|	||<�R||fS)	z�Parse one entry in a mailcap file and return a dictionary.

    The viewing command is stored as the value with the key "view",
    and the rest of the fields produce key-value pairs in the dict.
    rr
r/�NNN�view�=r7)r?�
parsefieldrB�findr<)
rCrE�i�n�fieldr!rJ�rest�fkey�fvalues
          r
r=r=zs����F��c�$�i�q�A�
�a�%��d�A�q�)���q��
�
�e��
�a�C���a�%��6�{�Q����Q�i����F�1�2�J�t��C��d�^�F����J�J�s�O���q�5��D��F���!�9�?�?�$�D��1�Q�3�4�[�&�&�(�F��6�>��!�F�4�L����;�rc�|�|}||kr!||}|dk(rn|dk(r|dz}n|dz}||kr�!|||j�|fS)z/Separate one key-value pair in a mailcap entry.�;�\r/r
)r<)rCrNrO�start�cs     r
rLrL�s_��
�E�
�a�%���G����8��
�$�Y��!��A��!��A��a�%���a�=��� �!�#�#rrJz	/dev/nullc��t|�r!d|�d�}tj|t�yt	|||�}|D]M}d|vr.t|d||�}|��|rt
j|�dk7r�5t|||||�}	|	��I|	|fcSy)aFind a match for a mailcap entry.

    Return a tuple containing the command line, and the mailcap entry
    used; (None, None) if no match is found.  This may invoke the
    'test' command of several matching entries before deciding which
    entry to use.

    z&Refusing to use mailcap with filename z . Use a safe temporary filename.rI�testr)�_find_unsafer0r1r�lookup�substr'�system)
r�MIMEtyper!�filename�plist�msg�entries�erZ�commands
          r
rr�s����H��\d�f���
�
�c�-�.���T�8�S�)�G�
���Q�;���6��H�e�4�D��|����	�	�$��1�,����#���(�E�:�����A�:���rc���g}||vr|||z}|jd�}|ddz}||vr|||z}|�|D�cgc]	}||vs�|��}}t|t��}|Scc}w)Nr:rz/*)r!)r)�sortedr)rr_r!rc�	MIMEtypesrds      r
r\r\�s����G��4���D��N�*�����s�#�I���|�d�"�H��4���D��N�*��
��%�2�g�����1�g��2��W�/�2�G��N��3s�	A�Ac�*�d}dt|�}}||kr�||}|dz}|dk7r|dk(r
|||dz}|dz}||z}n�||}|dz}|dk(r||z}n�|dk(r||z}n�|dk(r2t|�r!d|�d	�}tj|t�y||z}nz|d
k(rm|}	||kr||dk7r|dz}||kr	||dk7r�||	|}
|dz}t|
|�}t|�r$d|�d
|
�d�}tj|t�y||z}n|dz|z}||kr��|S)Nr7rr
�%rV�s�tz!Refusing to substitute MIME type z into a shell command.�{�}z!Refusing to substitute parameter z (z) into a shell command)r?r[r0r1r�	findparam)rPr_r`ra�resrNrOrXrbrW�name�params            r
r]r]�se��
�C��c�%�j�q�A�
�a�%��!�H��!�A�#�a���8��D�y��!�A�a�C�L��a��c�!���'�C��a��A�a��c�!��C�x��A�g���c���H�n���c����)�Ya�c�C��M�M�#�'9�:���H�n���c�����!�e��a��C���!��A��!�e��a��C���U�1�~���a�C��!�$��.����&�]b�dh�i�C��M�M�#�'9�:���E�k��
�C�i�!�m��E�a�%�F�Jrc��|j�dz}t|�}|D]}|d|j�|k(s�||dcSy)NrKr7)rAr?)rqrarO�ps    r
roro�sI���:�:�<�#��D��D�	�A�
���R�a�5�;�;�=�D� ��Q�R�5�L��rc���ddl}t�}|jddst|�yt	dt|j�d�D]�}|j||dz}t|�dkr
t
d�y|d}|d}t||d|�\}}|st
dt��^t
d|�tj|�}tj|�}|s��t
d|���y)	Nrr
r/z"usage: mailcap [MIMEtype file] ...rJzNo viewer found forz
Executing:zExit status:)�sysr�argv�showr>r?�printr�typer'r^�waitstatus_to_exitcode)	rvrrN�argsr_�filererd�stss	         r
rZrZs�����9�D��8�8�A�B�<��T�
��
�1�c�#�(�(�m�Q�
'���x�x��!�A�#����t�9�q�=��6�7����7���A�w���t�X�v�t�<�
�����'��.��,��(��)�)�G�$�C��+�+�C�0�C���n�c�*�(rc�X�td�t�D]}td|z��t�|s
t�}td�t�t|�}|D]G}t|�||}|D]0}t|�}|D]}td|z||��t��2�Iy)NzMailcap files:�	zMailcap entries:z  %-15s)ryrrrg)r�fn�ckeysrzrcrd�keys�ks        r
rxrxs���	�
��� ��%��r�	�"2� �	�G���	��	�
��	�G��4�L�E���
�d���t�*���A��!�9�D����i�!�m�Q�q�T�*���G�	�r�__main__)N)rr'r0�re�__all__�_DEPRECATION_MSG�_deprecatedrr�compile�searchr[�Warningrrrr4rr=rLrr\r]rorZrxrrr
�<module>r�s���+�	��	��[�
!��#������X�/��@���r�z�z�9�:�A�A��4��4��4�$�%�N�>$� #)�;�b��6�,.�'�R�+�.�"�z���F�r