Your IP : 18.189.170.65


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/mailcap.cpython-310.opt-2.pyc

o

6��f�#�@s�	ddlZddlZddlZddgZdd�Ze�d�jZGdd�de�Z	d	d�Z
d
d�Zdd
�Zdd�Z
dd�Zdd�Zddgfdd�Zd"dd�Zgfdd�Zdd�Zdd�Zdd �Zed!krce�dSdS)#�N�getcaps�	findmatchcCsd|vr
d|dfSdS)N�linenor)�r�)�entryrr�./opt/alt/python310/lib64/python3.10/mailcap.py�lineno_sort_key
sr	z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdS)�UnsafeMailcapInputN)�__name__�
__module__�__qualname__rrrrr
sr
c	Cs�	i}d}t�D]F}zt|d�}Wn	tyYqw|�t||�\}}Wd�n1s/wY|��D]\}}||vrE|||<q8|||||<q8q|S)Nr�r)�listmailcapfiles�open�OSError�_readmailcapfile�items)�capsrZmailcap�fpZmorecaps�key�valuerrrrs$	
��
�cCsT	dtjvrtjd}|�tj�}|Sdtjvrtjd}nd}|ddddg}|S)NZMAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)ZpathstrZmailcaps�homerrrr3s

	
��rcCs"	t�dtd�t|d�\}}|S)Nz2readmailcapfile is deprecated, use getcaps instead�)�warnings�warn�DeprecationWarningr)rr�_rrr�readmailcapfileEs�r$c	Cs	i}	|��}|s||fS|ddks|��dkrq|}|dd�dkr=|��}|s-d}|dd�|}|dd�dks%t|�\}}|rG|sHq|durT||d<|d7}|�d	�}tt|��D]
}||��||<q_d	�|���}||vr}||�|�n|g||<q)
Nrr�#����z\
�
r�/)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrMs8��

�rc
Cs�	g}dt|�}}||kr#t|||�\}}|�|�|d}||kst|�dkr+dS|d|d|dd�}}}d|i}|D]+}|�d�}|dkrQ|}d}	n|d|���}||dd���}	||vrhqA|	||<qA||fS)Nrrr�NN�view�=r&)r.�
parsefieldr1�findr+)
r2r3�i�n�fieldrr7�restZfkeyZfvaluerrrr,vs.
� 

r,cCsV	|}||kr!||}|dkrn|dkr|d}n|d}||ks|||���|fS)N�;�\rr)r+)r2r;r<�start�crrrr9�s
�r9r7z	/dev/nullc
Cs�	t|�rd|f}t�|t�dSt|||�}|D]0}d|vr7t|d||�}|dur-q|r7t�|�dkr7qt|||||�}	|	durJ|	|fSqdS)NzHRefusing to use mailcap with filename %r. Use a safe temporary filename.r6�testr)�_find_unsafer r!r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erC�commandrrrr�s$
�cslg}||vr|||}|�d�}|dd}||vr!|||}�dur.�fdd�|D�}t|td�}|S)Nr)rz/*csg|]}�|vr|�qSrr)�.0rM�rrr�
<listcomp>�szlookup.<locals>.<listcomp>rP)r�sortedr	)rrHrrLZ	MIMEtypesrrPrrE�s
rEcCsdd}dt|�}}||kr�||}|d}|dkr.|dkr)|||d�}|d}||}n~||}|d}|dkr?||}nm|dkrH||}nd|dkrbt|�r]d|f}t�|t�dS||}nJ|d	kr�|}	||kr�||d
kr�|d}||kr�||d
ksr||	|�}
|d}t|
|�}t|�r�d||
f}t�|t�dS||}n|d|}||ks
|S)Nr&rr�%r@�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r.rDr r!r
�	findparam)r=rHrIrJ�resr;r<rBrKrA�nameZparamrrrrF�sF




�

�#rFcCsF|��d}t|�}|D]}|d|���|kr ||d�SqdS)Nr8r&)r0r.)rZrJr<�prrrrX�s�rXc	Cs�ddl}t�}|jdd�st|�dStdt|j�d�D]G}|j||d�}t|�dkr5td�dS|d}|d}t||d|�\}}|sNtdt�qtd|�t	�
|�}t	�|�}|rdtd|�qdS)	Nrrrz"usage: mailcap [MIMEtype file] ...r7zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr-r.�printr�typerrG�waitstatus_to_exitcode)	r\rr;�argsrH�filerNrM�stsrrrrCs,



��rCcCs�td�t�D]}td|�qt�|st�}td�t�t|�}|D]$}t|�||}|D]}t|�}|D]}td|||�q9t�q1q%dS)NzMailcap files:�	zMailcap entries:z  %-15s)r_rrrR)r�fnZckeysr`rLrM�keys�krrrr^s"
��r^�__main__)N)rr �re�__all__r	�compile�searchrD�Warningr
rrr$rr,r9rrErFrXrCr^rrrrr�<module>s.)

)
�

?>