live #ˆl–äY>” je¶…8 Cq§nµ1hßÀ ƒtL¿¿ÃÂGa ´iœ#ã@sÈdZddlZddlZddlZddgZdd„Ze d¡jZGdd „d e ƒZ d d„Z d d „Z d d„Z dd„Zdd„Zdd„Zddgfdd„Zd#dd„Zgfdd„Zdd„Zdd„Zd d!„Zed"krÄeƒdS)$z%Mailcap file handling. See RFC 1524.éNÚgetcapsÚ findmatchcCsd|vrd|dfSdSdS)NÚlinenor)ér©)Úentryrrú/usr/lib64/python3.9/mailcap.pyÚlineno_sort_key s r z[^\xa1-\U0010FFFF\w@+=:,./-]c@seZdZdZdS)ÚUnsafeMailcapInputz)Warning raised when refusing unsafe inputN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rrrrr sr c Cs¤i}d}tƒD]�}zt|dƒ}Wnty6YqYn0|�t||ƒ\}}Wdƒn1s`0Y| ¡D]*\}}||vrŒ|||<qr|||||<qrq|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)ÚcapsrZmailcapÚfpZmorecapsÚkeyÚvaluerrrrs    , cCsPdtjvr"tjd}| tj¡}n*dtjvr8tjd}nd}|ddddg}|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Úhomerrrr3s    ÿrcCs t dtd¡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)rrÚ_rrrÚreadmailcapfileEs ÿr%c Csöi}| ¡}|sqî|ddks| ¡dkr,q|}|dd…dkrb| ¡}|sPd}|dd…|}q0t|ƒ\}}|r|sxq|dur�||d<|d 7}| d ¡}tt|ƒƒD]}|| ¡||<q¦d  |¡ ¡}||vrâ|| |¡q|g||<q||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ú#ÚéþÿÿÿNz\ Ú rrú/) ÚreadlineÚstripÚ parselinerÚrangeÚlenÚjoinÚlowerÚappend) rrrÚlineZnextlinerÚfieldsÚtypesÚjrrrrMs0    rc CsÚg}dt|ƒ}}||kr>t|||ƒ\}}| |¡|d}qt|ƒdkrNdS|d|d|dd…}}}d|i}|D]V}| d¡}|dkrš|}d} n$|d|… ¡}||dd… ¡} ||vrÈqz| ||<qz||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. rrr ©NNNÚviewú=r')r/Ú parsefieldr2Úfindr,) r3r4ÚiÚnÚfieldrr8ÚrestZfkeyZfvaluerrrr-vs*      r-cCsP|}||kr<||}|dkr q