����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
self
/
root
/
opt
/
alt
/
python33
/
lib64
/
python3.3
/
__pycache__
/
Filename :
mailcap.cpython-33.pyc
back
Copy
� ��f ��c���������������@���s����d��Z��d�d�l�Z�d�d�g�Z�d�d����Z�d�d����Z�d�d ����Z�d �d����Z�d�d ����Z�d�d�g��d�d���Z�d�d�d���Z �g��d�d���Z�d�d����Z�d�d����Z �d�d����Z�e�d�k�r��e ����n��d�S(���u%���Mailcap file handling. See RFC 1524.i����Nu���getcapsu ���findmatchc��������������C���s����i��}��x��t�����D]��}�y�t�|�d���}�Wn�t�k �r@�w�Yn�X|���t�|���}�Wd�QXxE�|�j����D]7�\�}�}�|�|��k�r��|�|��|�<qg�|��|�|�|��|�<qg�Wq�W|��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". u���rN(���u���listmailcapfilesu���openu���IOErroru���readmailcapfileu���items(���u���capsu���mailcapu���fpu���morecapsu���keyu���value(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���getcaps ���s���� c��������������C���sp���d�t��j�k�r1�t��j�d�}��|��j�t��j���}�n;�d�t��j�k�rP�t��j�d�}�n�d�}�|�d�d�d�d�g�}�|�S(���u7���Return a list of all mailcap files found on the system.u���MAILCAPSu���HOMEu���.u ���/.mailcapu���/etc/mailcapu���/usr/etc/mailcapu���/usr/local/etc/mailcap(���u���osu���environu���splitu���pathsep(���u���pathstru���mailcapsu���home(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���listmailcapfiles"���s���� u���listmailcapfilesc�������������C���sF��i��}�x9|��j�����}�|�s�Pn��|�d�d�k�s �|�j����d�k�rG�q �n��|�}�xI�|�d �d���d�k�r��|��j�����}�|�s��d�}�n��|�d�d ���|�}�qP�Wt�|���\�}�}�|�o��|�s��q �n��|�j�d���}�x.�t�t�|�����D]�}�|�|�j����|�|�<q��Wd�j�|���j����}�|�|�k�r2|�|�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". i����u���#u����i���Nu���\ u��� u���/i����i����( ���u���readlineu���stripu ���parselineu���splitu���rangeu���lenu���joinu���loweru���append(���u���fpu���capsu���lineu���nextlineu���keyu���fieldsu���typesu���j(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���readmailcapfile5���s0���� �"� u���readmailcapfilec������� ������C���s2��g��}�d�t��|����}�}�x?�|�|�k��rZ�t�|��|�|���\�}�}�|�j�|���|�d�}�q�Wt��|���d�k��rq�d�S|�d�|�d�|�d�d���}�}�}�i�|�d�6}�x��|�D]y�}�|�j�d���}�|�d�k��r��|�}�d�} �n0�|�d�|���j����}�|�|�d�d���j����} �|�|�k�rq��| �|�|�<q��W|�|�f�S( ���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. i����i���i���Nu���viewu���=u����(���NN(���u���lenu ���parsefieldu���appendu���Noneu���findu���strip( ���u���lineu���fieldsu���iu���nu���fieldu���keyu���viewu���restu���fkeyu���fvalue(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu ���parseline[���s*���� & u ���parselinec�������������C���sp���|�}�xM�|�|�k��rU�|��|�}�|�d�k�r/�Pq �|�d�k�rH�|�d�}�q �|�d�}�q �W|��|�|���j�����|�f�S(���u/���Separate one key-value pair in a mailcap entry.u���;u���\i���i���(���u���strip(���u���lineu���iu���nu���startu���c(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu ���parsefieldz���s���� u ���parsefieldu���viewu ���/dev/nullc������� ������C���s����t��|��|�|���}�xt�|�D]l�}�d�|�k�re�t�|�d�|�|���}�|�re�t�j�|���d�k�re�q�qe�n��t�|�|�|�|�|���}�|�|�f�SWd�S(���u��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. u���testi����N(���NN(���u���lookupu���substu���osu���systemu���None( ���u���capsu���MIMEtypeu���keyu���filenameu���plistu���entriesu���eu���testu���command(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu ���findmatch����s���� c����������������s����g��}�|�|��k�r#�|�|��|�}�n��|�j��d���}�|�d�d�}�|�|��k�r]�|�|��|�}�n�����d��k �r�����f�d�d����|�D��}�n��|�S(���Nu���/i����u���/*c����������������s"���g��|��]�}����|�k�r�|���q�S(����(����(���u���.0u���e(���u���key(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu ���<listcomp>����s��� �u���lookup.<locals>.<listcomp>(���u���splitu���None(���u���capsu���MIMEtypeu���keyu���entriesu ���MIMEtypes(����(���u���keyu,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���lookup����s����u���lookupc������� ������C���sf��d�}�d�t��|����}�}�xF|�|�k��ra|��|�}�|�d�}�|�d�k�r��|�d�k�ru�|��|�|�d���}�|�d�}�n��|�|�}�q�|��|�}�|�d�}�|�d�k�r��|�|�}�q�|�d�k�r��|�|�}�q�|�d�k�r��|�|�}�q�|�d�k�rP|�}�x*�|�|�k��r|��|�d �k�r|�d�}�q��W|��|�|���} �|�d�}�|�t�| �|���}�q�|�d�|�}�q�W|�S( ���Nu����i����i���u���%u���\u���su���tu���{u���}(���u���lenu ���findparam( ���u���fieldu���MIMEtypeu���filenameu���plistu���resu���iu���nu���cu���startu���name(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���subst����s6���� � � � u���substc�������������C���s[���|��j�����d�}��t�|����}�x8�|�D]0�}�|�d��|���j�����|��k�r#�|�|�d����Sq#�Wd�S(���Nu���=u����(���u���loweru���len(���u���nameu���plistu���nu���p(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu ���findparam����s���� u ���findparamc�������� ������C���s��d�d��l��}��t����}�|��j�d�d����s6�t�|���d��Sx��t�d�t�|��j���d���D]��}�|��j�|�|�d���}�t�|���d�k��r��t�d���d��S|�d�}�|�d�}�t�|�|�d�|���\�}�}�|�s��t�d�t���qR�t�d�|���t �j �|���}�|�rR�t�d�|���qR�qR�Wd��S( ���Ni����i���i���u"���usage: mailcap [MIMEtype file] ...u���viewu���No viewer found foru ���Executing:u���Exit status:(���u���sysu���getcapsu���argvu���showu���rangeu���lenu���printu ���findmatchu���typeu���osu���system( ���u���sysu���capsu���iu���argsu���MIMEtypeu���fileu���commandu���eu���sts(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���test����s&���� " u���testc�������������C���s����t��d���x�t����D]�}�t��d�|���q�Wt�����|��sE�t����}��n��t��d���t�����t�|����}�xl�|�D]d�}�t��|���|��|�}�xG�|�D]?�}�t�|���}�x#�|�D]�}�t��d�|�|�|���q��Wt�����q��Wqi�Wd��S(���Nu���Mailcap files:u��� u���Mailcap entries:u��� %-15s(���u���printu���listmailcapfilesu���getcapsu���sorted(���u���capsu���fnu���ckeysu���typeu���entriesu���eu���keysu���k(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���show����s"���� �� u���showu���__main__(���u���__doc__u���osu���__all__u���getcapsu���listmailcapfilesu���readmailcapfileu ���parselineu ���parsefieldu ���findmatchu���Noneu���lookupu���substu ���findparamu���testu���showu���__name__(����(����(����u,���/opt/alt/python33/lib64/python3.3/mailcap.pyu���<module>���s���&