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.138.199.4
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : mailcap.cpython-310.opt-1.pyc
o

^b��@s�dZddlZddlZddgZdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
ddgfdd�Zd dd�Zgfdd�Z
dd�Zdd�Zdd�ZedkrRe�dSdS)!z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCsd|vr
d|dfSdS)N�linenor)�r�)�entryrr�0/usr/local/python-3.10/lib/python3.10/mailcap.py�lineno_sort_key	sr	c	Cs�i}d}t�D]F}zt|d�}Wn	tyYqw|�t||�\}}Wd�n1s.wY|��D]\}}||vrD|||<q7|||||<q7q|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"

��
�cCsRdtjvrtjd}|�tj�}|Sdtjvrtjd}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�homerrrr-s

	
��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�readmailcapfile?s
�r c	Csi}	|��}|s
||fS|ddks|��dkrq|}|dd�dkr<|��}|s,d}|dd�|}|dd�dks$t|�\}}|rF|sGq|durS||d	<|d7}|�d
�}tt|��D]
}||��||<q^d
�|���}||vr|||�|�n|g||<q)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".
    rr�#����Nz\
�
r�/)	�readline�strip�	parseliner�range�len�join�lower�append)	rrr�lineZnextliner�fields�types�jrrrrGs6	��

�rc
Cs�g}dt|�}}||kr"t|||�\}}|�|�|d}||ks
t|�dkr*dS|d|d|dd�}}}d|i}|D]+}|�d�}|dkrP|}d}	n|d|���}||dd���}	||vrgq@|	||<q@||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*�
parsefieldr-�findr')
r.r/�i�n�fieldrr3�restZfkeyZfvaluerrrr(ps,
� 

r(cCsT|}||kr ||}|dkrq |dkr|d}n|d}||ks|||���|fS)z/Separate one key-value pair in a mailcap entry.�;�\rr)r')r.r7r8�start�crrrr5�s
�r5r3z	/dev/nullc	Csbt|||�}|D]&}d|vr t|d||�}|r t�|�dkr qt|||||�}||fSdS)aFind 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.

    �testrr2)�lookup�substr�system)	r�MIMEtyper�filename�plist�entries�er?�commandrrrr�s	cslg}||vr|||}|�d�}|dd}||vr!|||}�dur.�fdd�|D�}t|td�}|S)Nr%rz/*csg|]}�|vr|�qSrr)�.0rG�rrr�
<listcomp>�szlookup.<locals>.<listcomp>rJ)r�sortedr	)rrCrrFZ	MIMEtypesrrJrr@�s
r@c
Csd}dt|�}}||kr�||}|d}|dkr.|dkr)|||d�}|d}||}nY||}|d}|dkr?||}nH|dkrH||}n?|dkrQ||}n6|dkr�|}||kro||d	kro|d}||kro||d	ksa|||�}	|d}|t|	|�}n|d|}||ks
|S)
Nr"rr�%r<�s�t�{�})r*�	findparam)
r9rCrDrE�resr7r8r>r=�namerrrrA�s4



��rAcCsF|��d}t|�}|D]}|d|���|kr ||d�SqdS)Nr4r")r,r*)rTrEr8�prrrrR�s�rRc	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] ...r3zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr)r*�printr�typerrB�waitstatus_to_exitcode)	rVrr7�argsrC�filerHrG�stsrrrr?�s,



��r?cCs�td�t�D]}td|�qt�|st�}td�t�t|�}|D]$}t|�||}|D]}t|�}|D]}td|||�q9t�q1q%dS)NzMailcap files:�	zMailcap entries:z  %-15s)rYrrrL)r�fnZckeysrZrFrG�keys�krrrrXs"
��rX�__main__)N)�__doc__rr�__all__r	rrr rr(r5rr@rArRr?rX�__name__rrrr�<module>s(
)

 
�
© 2025 GrazzMean