Edit File: mailcap.cpython-311.opt-1.pyc
� �����f�$���������������������������d�Z�ddlZddlZddlZddgZdZ�ej��������eed��������������d��Z�ej ��������d ������������j ��������Z�G�d ��de������������Z d��Zd ��Zd��Zd��Zd��Zd��Zddg�fd�Zdd�Zg�fd�Zd��Zd��Zd��Zedk����r�e���������������dS�dS�)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|�v�r d|�d���������fS�dS�)N�linenor���)����r�����)�entrys��� �./opt/alt/python311/lib64/python3.11/mailcap.py�lineno_sort_keyr������s!�������5����%��/�!�!��t�����z[^\xa1-\U0010FFFF\w@+=:,./-]c�������������������������e�Zd�ZdZdS�)�UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)�__name__� __module__�__qualname__�__doc__r���r���r ���r���r������s��������������3�3�3�3r���r���c�������������������2����i�}�d}t������������������������D�]�} �t����������|d������������}n#�t����������$�r�Y�� w�xY�w|5��t����������||������������\��}}ddd�������������n#�1�swxY�w�Y���|�����������������������������������D�]\��}}||�vr||�|<����|�|���������|z���|�|<������|�S�)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 ���r���r������s�������D� �F�#�%�%��.��.�� ��g�s�#�#�B�B���� �� �� ��H� ���� �� <�� <�/��F�;�;��H�f� <�� <�� <�� <�� <�� <�� <�� <�� <�� <�� <����� <�� <�� <�� <�"�.�.�*�*�� .�� .�J�C���$�;�;�!��S� � � ��I��-��S� � � .� ��Ks����'� 4�4�A�A � A c�������������������������dt�����������j��������v�r2t�����������j��������d���������}�|����������������������t�����������j��������������������}n,dt�����������j��������v�rt�����������j��������d���������}nd}|dz���dddg}|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 ���r���r���9���sp��������R�Z����*�Z�(���=�=���,�,����R�Z����:�f�%�D�D���D��;�&��"�$<�>���Or���c������������������b�����t����������j��������dt����������d�������������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���)r���r����_s��� r ����readmailcapfiler4���K���s6�������M�F�$�a�)��)��)��r�4�(�(�G�D�!��Kr���c����������������������i�} �|�������������������������������������}|s�n+|d���������dk����s|�����������������������������������dk����r�>|}|dd����������dk����r3|�������������������������������������}|sd}|dd����������|z���}|dd����������dk�����3t����������|������������\��}}|r|s��|� ||d <���|dz ��}|���������������������d ������������}t ����������t����������|������������������������D�]}||��������������������������������������������||<���� d ���������������������|�����������������������������������������������}||v�r||������������������������������|�������������n|g||<�����C||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 ���r����#�����Nz\ � r ����/) �readline�strip� parseliner)����range�len�join�lower�append) r���r ���r����line�nextliner!����fields�types�js ��� r ���r���r���S���sw�������D�!��{�{�}�}����U���7�c�>�>�T�Z�Z�\�\�R�/�/�����r�s�s�m�v�%�%��{�{�}�}�H��,��X�����9�x�'�D���r�s�s�m�v�%�%� � ��o�o���V��� ��� ����%�F�8���a�K�F�� � �#�����s�5�z�z�"�"�� (�� (�A��Q�x�~�~�'�'�E�!�H�H��h�h�u�o�o�#�#�%�%���$�;�;���I���V�$�$�$�$���D��I�9!�:���<�r���c�����������������������g�}dt����������|�������������}}||k�����r4t����������|�||������������\��}}|���������������������|�������������|dz���}||k������4t����������|������������dk�����rdS�|d���������|d���������|dd����������}}}d|i}|D�]g}|���������������������d������������}|dk�����r|}d} n;|d|���������������������������������������������}||dz���d���������������������������������������������} ||v�r�b| ||<����h||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. r���r ���r/����NNN�view�=r7���)r?���� parsefieldrB����findr<���) rC���rE����i�n�fieldr!���rJ����rest�fkey�fvalues ��� r ���r=���r=���|���s �������F��c�$�i�i�q�A� �a�%�%��d�A�q�)�)���q�� � �e���� �a�C����a�%�%���6�{�{�Q����z��Q�i����F�1�2�2�J�t��C��d�^�F���"��"���J�J�s�O�O���q�5�5��D��F�F���!��9�?�?�$�$�D��1�Q�3�4�4�[�&�&�(�(�F��6�>�>��!�F�4�L�L���;�r���c�����������������������|}||k�����r&|�|���������}|dk����rn|dk����r|dz���}n|dz���}||k������&|�||����������������������������������������������|fS�)z/Separate one key-value pair in a mailcap entry.�;�\r/���r ���)r<���)rC���rN���rO����start�cs��� r ���rL���rL�������sn������ �E� �a�%�%���G����8�8�� �$�Y�Y��!��A�A��!��A���a�%�%����a��=��� � �!�#�#r���rJ���z /dev/nullc������������������F����t����������|������������r"d|�d�}t����������j��������|t�����������������������dS�t ����������|�||������������}|D�][}d|v�r5t����������|d���������||������������}|�� |rt ����������j��������|������������dk����r�;t����������||���������|||������������} | �| |fc�S��\dS�)a��Find 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����testNr���)�_find_unsafer0���r1���r����lookup�substr'����system) r����MIMEtyper!����filename�plist�msg�entries�erZ����commands ��� r ���r���r�������s���������H�������\d�\d�\d�f��� �c�-�.�.�.��z��T�8�S�)�)�G� �� �� ���Q�;�;���6��H�e�4�4�D��|���� �� �$���1�,�,����#���(�E�:�:�����A�:�������:r���c�������������������������g�}||�v�r||�|���������z���}|����������������������d������������}|d���������dz���}||�v�r||�|���������z���}���fd�|D���������������}t����������|t�����������������������}|S�)Nr:���r���z/*c������������������������g�|�]}�|v��|�� S�r���r���)�.0rd���r!���s��� �r ���� <listcomp>zlookup.<locals>.<listcomp>����s�������2�2�2������1���r���)r!���)r)����sortedr���)r���r_���r!���rc���� MIMEtypess��� ` r ���r\���r\�������s���������G��4����D��N�*�����s�#�#�I���|�d�"�H��4����D��N�*�� ��2�2�2�2�g�2�2�2���W�/�2�2�2�G��Nr���c����������������������d}dt����������|�������������}}||k������r,|�|���������}|dz���}|dk����r|dk����r|�||dz�������������}|dz���}||z���}n�|�|���������}|dz���}|dk����r||z���}n�|dk����r||z���}n�|dk����r7t����������|������������r"d|�d �}t����������j��������|t�����������������������d�S�||z���}n�|d k����r�|} ||k�����r#|�|���������dk����r|dz���}||k�����r|�|���������dk�����|�| |����������} |dz���}t����������| |������������}t����������|������������r%d|�d | �d�}t����������j��������|t�����������������������d�S�||z���}n|dz���|z���}||k�������,|S�)Nr7���r���r ����%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[���r0���r1���r���� findparam)rP���r_���r`���ra����resrN���rO���rX���rb���rW����name�params��� r ���r]���r]�������s������ �C��c�%�j�j�q�A� �a�%�%��!�H��!�A�#�a���8�8��D�y�y��!�A�a�C�%�L��a��c�!���'�C�C��a��A�a��c�!��C�x�x��A�g����c����H�n����c�����)�)�� �� �Ya�Ya�Ya�c�C��M�#�'9�:�:�:��4��H�n����c������!�e�e��a��C����!��A���!�e�e��a��C����U�1�W�~���a�C��!�$��.�.����&�&�� �� �]b�]b�]b�dh�dh�dh�i�C��M�#�'9�:�:�:��4��E�k��� ��C�i�!�m��E��a�%�%�F��Jr���c�����������������������|�������������������������������������dz���}�t����������|�������������}|D�].}|d�|����������������������������������������������|�k����r||d�����������c�S��/dS�)NrK���r7���)rA���r?���)rt���ra���rO����ps��� r ���rr���rr�������sd�������:�:�<�<�#��D��D� � �A� �������R�a�R�5�;�;�=�=�D� � ��Q�R�R�5�L�L�L��!� �2r���c�������������������2����dd�l�}�t������������������������}|�j��������dd�����������st����������|�������������d�S�t ����������dt����������|�j��������������������d������������D�]�}|�j��������||dz�������������}t����������|������������dk�����rt ����������d��������������d�S�|d���������}|d���������}t����������||d|������������\��}}|st ����������dt������������������������vt ����������d|�������������t����������j ��������|������������}t����������j��������|������������}|rt ����������d|���������������d�S�) Nr���r ���r/���z"usage: mailcap [MIMEtype file] ...rJ���zNo viewer found forz Executing:zExit status:)�sysr����argv�showr>���r?����printr����typer'���r^����waitstatus_to_exitcode) ry���r���rN����argsr_����filere���rd����stss ��� r ���rZ���rZ�����s(������J�J�J��9�9�D��8�A�B�B�<����T� � � ��� �1�c�#�(�m�m�Q� '� '��+��+���x��!�A�#�����t�9�9�q�=�=��6�7�7�7��F�F���7���A�w���t�X�v�t�<�<� ����� +��'��.�.�.�.��,��(�(�(��)�G�$�$�C��+�C�0�0�C��� +��n�c�*�*�*��+��+r���c����������������������t����������d�������������t������������������������D�]}t����������d|z�����������������t�������������������������|�st������������������������}�t����������d�������������t�������������������������t����������|�������������}|D�]Y}t����������|�������������|�|���������}|D�]=}t����������|������������}|D�]}t����������d|z��||�����������������������t��������������������������>�Zd�S�)NzMailcap files:� zMailcap entries:z %-15s)r|���r���r���rj���)r����fn�ckeysr}���rc���rd����keys�ks��� r ���r{���r{�����s������� � ����� � �2�2��%��r� �"2�"2�"2�"2� �G�G�G��!�� � �� � ���� �G�G�G��4�L�L�E������� �d�����t�*���� �� �A��!�9�9�D��� +�� +���i�!�m�Q�q�T�*�*�*�*��G�G�G�G� ���r����__main__)N)r���r'���r0����re�__all__�_DEPRECATION_MSG�_deprecatedr���r����compile�searchr[����Warningr���r���r���r4���r���r=���rL���r���r\���r]���rr���rZ���r{���r���r���r ����<module>r�������s������+��+�� � � � ������� � � � ��[� !��#��������X�/���@��@��@��@��������r�z�9�:�:�A��4��4��4��4��4���4��4��4������4�����$�����'��'��'�R�����>$��$��$� �#)�;�b���������6��������,.��'��'��'��'�R�����+��+��+�.�����"��z����D�F�F�F�F�F���r���