b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/mailcap.pyo
Size7.02 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:27
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@s¬dZddkZddgZd�Zd�Zd�Zd�Zd �Zd
d gd �Zdd
�Z
gd�Z d�Z d�Z
d�Zedjo e
�ndS(s%Mailcap file handling. See RFC 1524.iÿÿÿÿNtgetcapst findmatchcCsªh}x�t�D]�}yt|d�}Wntj
o
qnXt|�}|i�xG|i�D]9\}}||jo|||<qe|||||<qeWqW|S(s 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".

tr(tlistmailcapfilestopentIOErrortreadmailcapfiletcloset iteritems(tcapstmailcaptfptmorecapstkeytvalue((s/usr/lib64/python2.6/mailcap.pyR s

 


cCsqdtijo tid}|id�}n>dtijotid}nd}|ddddg}|S( s7Return a list of all mailcap files found on the system.tMAILCAPSt:tHOMEt.s /.mailcaps /etc/mailcaps/usr/etc/mailcaps/usr/local/etc/mailcap(tostenvirontsplit(tstrtmailcapsthome((s/usr/lib64/python2.6/mailcap.pyR"s

 cCsHh}x;|i�}|pPn|ddjp|i�djoq n|}xA|ddjo/|i�}|p
d}n|d |}qUWt|�\}}|o|pq n|id�}x.tt|��D]}||i�||<qßWdi|�i�}||jo||i|�q |g||<q |S(s�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".
it#tiþÿÿÿs\
s
t/( treadlinetstript parselineRtrangetlentjointlowertappend(R R tlinetnextlineR
tfieldsttypestj((s/usr/lib64/python2.6/mailcap.pyR5s4  $ 

c
Cs(g}dt|�}}xA||jo3t|||�\}}|i|�|d}qWt|�djodS|d|d|d}}}h|d6}xy|D]q}|id�}|djo|}d} n%|| i�}||di�} ||joq©| ||<q©W||fS( sÈ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.
iiitviewt=RN(NN(R t
parsefieldR#tNonetfindR(
R$R&titntfieldR
R)tresttfkeytfvalue((s/usr/lib64/python2.6/mailcap.pyR[s.

 



cCss|}xS||joE||}|djoPq |djo|d}q |d}q W|||!i�|fS(s/Separate one key-value pair in a mailcap entry.t;s\ii(R(R$R.R/tstarttc((s/usr/lib64/python2.6/mailcap.pyR+zs



R)s /dev/nullc Cs�t|||�}xy|D]q}d|jo>t|d||�}|oti|�djoqqjnt|||||�}||fSWdS(sFind 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.

ttestiN(NN(tlookuptsubstRtsystemR,( R tMIMEtypeR
tfilenametplisttentriesteR7tcommand((s/usr/lib64/python2.6/mailcap.pyR�s 
  cCs�g}||jo|||}n|id�}|dd}||jo|||}n|dj ot|d�|�}n|S(NRis/*cSs
||jS(((R?R
((s/usr/lib64/python2.6/mailcap.pyt<lambda>§s(RR,tfilter(R R;R
R>t MIMEtypes((s/usr/lib64/python2.6/mailcap.pyR8�s


c
Csqd}dt|�}}xQ||joC||}|d}|djo:|djo|||d!}|d}n||}q||}|d}|djo||}q|djo||}q|djo||}q|djod|}x-||jo||d jo|d}qÿW|||!} |d}|t| |�}q|d|}qW|S(
NRiit%s\tsttt{t}(R t findparam(
R0R;R<R=tresR.R/R6R5tname((s/usr/lib64/python2.6/mailcap.pyR9ªs:












cCsQ|i�d}t|�}x.|D]&}|| i�|jo ||Sq#WdS(NR*R(R"R (RKR=R/tp((s/usr/lib64/python2.6/mailcap.pyRIÊs 
c Csüddk}t�}|idpt|�dSxÃtdt|i�d�D]¦}|i||d!}t|�djo
dGHdS|d}|d}t||d|�\}}|p
dGtGHqNdG|GHti |�}|o
d G|GHqNqNWdS(
Niÿÿÿÿiis"usage: mailcap [MIMEtype file] ...iR)sNo viewer found fors
Executing:s Exit status:(
tsysRtargvtshowRR RttypeRR:( RMR R.targsR;tfileR@R?tsts((s/usr/lib64/python2.6/mailcap.pyR7Õs(  



 cCsÁdGHxt�D]}d|GHqWH|p
t�}ndGHH|i�}|i�xg|D]_}|GH||}xG|D]?}|i�}|i�x|D]}d|G||GHq�WHqvWqZWdS(NsMailcap files:s sMailcap entries:s %-15s(RRtkeystsort(R tfntckeysRPR>R?RTtk((s/usr/lib64/python2.6/mailcap.pyROës.


 

 
t__main__(t__doc__Rt__all__RRRRR+RR,R8R9RIR7ROt__name__(((s/usr/lib64/python2.6/mailcap.pyt<module>s     &