����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
usr
/
lib64
/
python3.6
/
__pycache__
/
Filename :
mailcap.cpython-36.opt-1.pyc
back
Copy
3 Ow�hk#������������������@���s����d�Z�ddlZddlZddlZddgZdd��Zejd�jZG�dd ��d e �Z d d��Zdd��Zd d��Z dd��Zdd��Zdd��Zddg�fdd�Zd#dd�Zg�fdd�Zdd��Zdd��Zd d!��Zed"kr�e���dS�)$z%Mailcap file handling. See RFC 1524.�����N�getcaps� findmatchc�������������C���s���d|�krd|�d�fS�dS�d�S�)N�linenor�������)r���r�����)�entryr���r����/usr/lib64/python3.6/mailcap.py�lineno_sort_key ���s����r ���z[^\xa1-\U0010FFFF\w@+=:,./-]c���������������@���s���e�Zd�ZdZdS�)�UnsafeMailcapInputz)Warning raised when refusing unsafe inputN)�__name__� __module__�__qualname__�__doc__r���r���r���r���r ������s���r ���c��������������C���s����i�}�d}x�t���D�]�}yt|d�}W�n�tk r8���wY�nX�|��t||�\}}W�dQ�R�X�x6|j��D�]*\}}||�kr|||�|<�qb|�|�|�|�|<�qbW�qW�|�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���Zmailcap�fpZmorecaps�key�valuer���r���r���r������s���� c��������������C���sP���dt�jkr"t�jd�}�|�jt�j�}n*dt�jkr8t�jd�}nd}|d�dddg}|S�)z7Return a list of all mailcap files found on the system.ZMAILCAPS�HOME�.z /.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homer���r���r���r���3���s���� r���c�������������C���s ���t�jdtd��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����_r���r���r����readmailcapfileE���s����r%���c������� ������C���s��i�}x�|�j���}|sP�|d�dks|j��dkr.q|}x4|dd��dkrf|�j���}|sTd}|dd��|�}q4W�t|�\}}|oz|s~q|dk r�||d<�|d 7�}|jd �}x$tt|��D�]}||�j��||<�q�W�d j|�j��}||kr�||�j|��q|g||<�qW�||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���r����/���r*���) �readline�strip� parseliner����range�len�join�lower�append) r���r���r����lineZnextliner����fields�types�jr���r���r���r���M���s6���� �� r���c������� ������C���s����g�}dt�|���}}x.||k�r@t|�||�\}}|j|��|d�}qW�t�|�dk�rRdS�|d�|d�|dd����}}}d|i}x^|D�]V}|jd�}|dk�r�|}d} n$|d|��j��}||d�d��j��} ||kr�q�| ||<�q�W�||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 ���N�view�=r'���)NN)r/���� parsefieldr2����findr,���) r3���r4����i�n�fieldr���r7����restZfkeyZfvaluer���r���r���r-���v���s*���� r-���c�������������C���sT���|}x:||k�r>|�|�}|dkr"P�q|dkr4|d�}q|d�}qW�|�||��j���|fS�)z/Separate one key-value pair in a mailcap entry.�;�\r ���r���)r,���)r3���r;���r<����start�cr���r���r���r9�������s���� r9���r7���z /dev/nullc������� ������C���s����t�|�r"d|f�}tj|t��dS�t|�||�}xd|D�]\}d|krnt|d�||�}|dkrZq4|rntj|�dkrnq4t||�|||�} | dk r4| |fS�q4W�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. zHRefusing to use mailcap with filename %r. Use a safe temporary filename.N�testr���)NN)NN)�_find_unsafer!���r"���r ����lookup�substr����system) r����MIMEtyper����filename�plist�msg�entries�erC����commandr���r���r���r�������s ���� c����������������sl���g�}||�kr||�|��}|j�d�}|d�d�}||�krB||�|��}��d�k r\��fdd�|D��}t|td�}|S�)Nr)���r���z/*c����������������s���g�|�]}��|kr|�qS�r���r���)�.0rM���)r���r���r���� <listcomp>����s����zlookup.<locals>.<listcomp>)r���)r����sortedr ���)r���rH���r���rL���Z MIMEtypesr���)r���r���rE�������s���� rE���c�������������C���s\��d}dt�|���}}�xB||k��rV|�|�}|d�}|dkrb|dkrX|�||d���}|d�}||�}q|�|�}|d�}|dkr�||�}q|dkr�||�}q|dkr�t|�r�d|f�}tj|t��d�S�||�}q|d k�rH|} x ||k�r�|�|�d kr�|d�}q�W�|�| |��} |d�}t| |�}t|��r>d|| f�}tj|t��d�S�||�}q|d�|�}qW�|S�)Nr'���r���r����%r@����s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r/���rD���r!���r"���r ���� findparam)r=���rH���rI���rJ����resr;���r<���rB���rK���rA����nameZparamr���r���r���rF�������sH������ � rF���c�������������C���sF���|�j���d�}�t|��}x,|D�]$}|d�|��j���|�kr||d���S�qW�dS�)Nr8���r'���)r1���r/���)rY���rJ���r<����pr���r���r���rW�������s���� rW���c�������� ������C���s����dd�l�}�t��}|�jdd���s(t|��d�S�x�tdt|�j�d�D�]�}|�j||d���}t|�dk�rjtd��d�S�|d�}|d�}t||d|�\}}|s�tdt��q<td|��t j |�}|r<td|��q<W�d�S�) Nr���r���r ���z"usage: mailcap [MIMEtype file] ...r7���zNo viewer found forz Executing:zExit status:)�sysr����argv�showr.���r/����printr����typer���rG���) r[���r���r;����argsrH����filerN���rM����stsr���r���r���rC�����s&���� rC���c�������������C���s����t�d��xt��D�]}t�d|���qW�t����|�s4t��}�t�d��t����t|��}xX|D�]P}t�|��|�|�}x:|D�]2}t|�}x|D�]}t�d|�||���q|W�t����qjW�qPW�d�S�)NzMailcap files:� zMailcap entries:z %-15s)r^���r���r���rQ���)r����fnZckeysr_���rL���rM����keys�kr���r���r���r]�����s"������ r]����__main__)N)r���r���r!����re�__all__r ����compile�searchrD����Warningr ���r���r���r%���r���r-���r9���r���rE���rF���rW���rC���r]���r���r���r���r���r����<module>���s*���) )