Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.144.89.120
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : mailcap.cpython-32.pyc
l
��bc@s�dZddlZddgZd�Zd�Zd�Zd�Zd	�Zd
dgd�Zdd
�Z
gd�Zd�Zd�Z
d�Zedkr�e
�ndS(u%Mailcap file handling.  See RFC 1524.iNugetcapsu	findmatchc
Cs�i}x�t�D]�}yt|d�}Wntk
r@wYnXt|�}|j�xE|j�D]7\}}||kr�|||<qd|||||<qdWqW|S(u�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".

    ur(ulistmailcapfilesuopenuIOErrorureadmailcapfileucloseuitems(ucapsumailcapufpumorecapsukeyuvalue((u./usr/local/python-3.2/lib/python3.2/mailcap.pyugetcaps	s



cCsmdtjkr.tjd}|jd�}n;dtjkrMtjd}nd}|ddddg}|S(	u7Return a list of all mailcap files found on the system.uMAILCAPSu:uHOMEu.u	/.mailcapu/etc/mailcapu/usr/etc/mailcapu/usr/local/etc/mailcap(uosuenvironusplit(ustrumailcapsuhome((u./usr/local/python-3.2/lib/python3.2/mailcap.pyulistmailcapfiles"s

cCsFi}x9|j�}|sPn|ddks	|j�dkrGq	n|}xI|d	d�dkr�|j�}|s�d}n|dd
�|}qPWt|�\}}|o�|s�q	n|jd�}x.tt|��D]}||j�||<q�Wdj|�j�}||kr2||j|�q	|g||<q	|S(u�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".
    iu#uiNu\
u
u/i����i����(	ureadlineustripu	parselineuspliturangeulenujoinuloweruappend(ufpucapsulineunextlineukeyufieldsutypesuj((u./usr/local/python-3.2/lib/python3.2/mailcap.pyureadmailcapfile5s0	"	c
Cs2g}dt|�}}x?||krZt|||�\}}|j|�|d}qWt|�dkrqdS|d|d|dd�}}}i|d6}x�|D]y}|jd�}|dkr�|}d}	n0|d|�j�}||dd�j�}	||krq�|	||<q�W||fS(	u�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.
    iiiNuviewu=u(NN(ulenu
parsefielduappenduNoneufindustrip(
ulineufieldsuiunufieldukeyuviewurestufkeyufvalue((u./usr/local/python-3.2/lib/python3.2/mailcap.pyu	parseline[s*
&

	cCsp|}xM||krU||}|dkr/Pq	|dkrH|d}q	|d}q	W|||�j�|fS(u/Separate one key-value pair in a mailcap entry.u;u\ii(ustrip(ulineuiunustartuc((u./usr/local/python-3.2/lib/python3.2/mailcap.pyu
parsefieldzs

uviewu	/dev/nullc	Cs�t|||�}xt|D]l}d|kret|d||�}|retj|�dkreqqent|||||�}||fSWdS(uFind 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.

    utestiN(NN(ulookupusubstuosusystemuNone(	ucapsuMIMEtypeukeyufilenameuplistuentriesueutestucommand((u./usr/local/python-3.2/lib/python3.2/mailcap.pyu	findmatch�s	
	cs�g}||kr#|||}n|jd�}|dd}||kr]|||}n�dk	r��fd�|D�}n|S(Nu/iu/*cs"g|]}�|kr|�qS(((u.0ue(ukey(u./usr/local/python-3.2/lib/python3.2/mailcap.pyu
<listcomp>�s	(usplituNone(ucapsuMIMEtypeukeyuentriesu	MIMEtypes((ukeyu./usr/local/python-3.2/lib/python3.2/mailcap.pyulookup�sc
Csfd}dt|�}}xF||kra||}|d}|dkr�|dkru|||d�}|d}n||}q||}|d}|dkr�||}q|dkr�||}q|dkr�||}q|dkrP|}x*||kr||d	kr|d}q�W|||�}	|d}|t|	|�}q|d|}qW|S(
Nuiiu%u\usutu{u}(ulenu	findparam(
ufielduMIMEtypeufilenameuplisturesuiunucustartuname((u./usr/local/python-3.2/lib/python3.2/mailcap.pyusubst�s6









cCs[|j�d}t|�}x8|D]0}|d|�j�|kr#||d�Sq#WdS(Nu=u(ulowerulen(unameuplistunup((u./usr/local/python-3.2/lib/python3.2/mailcap.pyu	findparam�s
c	Csddl}t�}|jdd�s6t|�dSx�tdt|j�d�D]�}|j||d�}t|�dkr�td�dS|d}|d}t||d|�\}}|s�tdt�qRtd|�t	j
|�}|rRtd|�qRqRWdS(	Niiiu"usage: mailcap [MIMEtype file] ...uviewuNo viewer found foru
Executing:uExit status:(usysugetcapsuargvushowurangeulenuprintu	findmatchutypeuosusystem(	usysucapsuiuargsuMIMEtypeufileucommandueusts((u./usr/local/python-3.2/lib/python3.2/mailcap.pyutest�s&	
"



cCs�td�xt�D]}td|�qWt�|sEt�}ntd�t�t|�}xl|D]d}t|�||}xG|D]?}t|�}x#|D]}td|||�q�Wt�q�WqiWdS(NuMailcap files:u	uMailcap entries:u  %-15s(uprintulistmailcapfilesugetcapsusorted(ucapsufnuckeysutypeuentriesueukeysuk((u./usr/local/python-3.2/lib/python3.2/mailcap.pyushow�s"






u__main__(u__doc__uosu__all__ugetcapsulistmailcapfilesureadmailcapfileu	parselineu
parsefieldu	findmatchuNoneulookupusubstu	findparamutestushowu__name__(((u./usr/local/python-3.2/lib/python3.2/mailcap.pyu<module>s			&		 			
© 2025 GrazzMean