????

Your IP : 18.188.236.178


Current Path : /lib/python3.10/__pycache__/
Upload File :
Current File : //lib/python3.10/__pycache__/mailcap.cpython-310.pyc

o

�*�g�#�@s�dZddlZddlZddlZddgZdd�Ze�d�jZGdd	�d	e	�Z
d
d�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zddgfdd�Zd#dd�Zgfdd�Zdd�Zdd�Zd d!�Zed"krde�dSdS)$z%Mailcap file handling.  See RFC 1524.�N�getcaps�	findmatchcCsd|vr
d|dfSdS)N�linenor)�r�)�entryrr�/usr/lib/python3.10/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]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)�capsr�mailcap�fp�morecaps�key�valuerrrrs"

��
�cCsRdtjvrtjd}|�tj�}|Sdtjvrtjd}nd}|ddddg}|S)z7Return a list of all mailcap files found on the system.�MAILCAPS�HOME�.z	/.mailcapz/etc/mailcapz/usr/etc/mailcapz/usr/local/etc/mailcap)�os�environ�split�pathsep)�pathstr�mailcaps�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	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�line�nextliner�fields�types�jrrrrMs6	��

�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,)r4�
parsefieldr7�findr1)
r8r:�i�n�fieldrr>�rest�fkey�fvaluerrrr2vs,
� 

r2cCsT|}||kr ||}|dkrn|dkr|d}n|d}||ks|||���|fS)z/Separate one key-value pair in a mailcap entry.�;�\r%r)r1)r8rBrC�start�crrrr@�s
�r@r>z	/dev/nullc
Cs�t|�rd|f}t�|t�dSt|||�}|D]0}d|vr6t|d||�}|dur,q|r6t�|�dkr6qt|||||�}	|	durI|	|fSqdS)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.

    zHRefusing to use mailcap with filename %r. Use a safe temporary filename.r=�testNr)�_find_unsafer&r'r
�lookup�substr�system)
r�MIMEtyper�filename�plist�msg�entries�erL�commandrrrr�s"	
�cslg}||vr|||}|�d�}|dd}||vr!|||}�dur.�fdd�|D�}t|td�}|S)Nr/rz/*csg|]}�|vr|�qSrr)�.0rV�rrr�
<listcomp>�szlookup.<locals>.<listcomp>rY)r �sortedr	)rrQrrU�	MIMEtypesrrYrrN�s
rNcCsdd}dt|�}}||kr�||}|d}|dkr.|dkr)|||d�}|d}||}n~||}|d}|dkr?||}nm|dkrH||}nd|dkrbt|�r]d|f}t�|t�dS||}nJ|d	kr�|}	||kr�||d
kr�|d}||kr�||d
ksr||	|�}
|d}t|
|�}t|�r�d||
f}t�|t�dS||}n|d|}||ks
|S)Nr,rr�%rI�s�tz9Refusing to substitute MIME type %r into a shell command.�{�}z=Refusing to substitute parameter %r (%s) into a shell command)r4rMr&r'r
�	findparam)rDrQrRrS�resrBrCrKrTrJ�name�paramrrrrO�sF




�

�#rOcCsF|��d}t|�}|D]}|d|���|kr ||d�SqdS)Nr?r,)r6r4)rdrSrC�prrrrb�s�rbc	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)	Nrrr%z"usage: mailcap [MIMEtype file] ...r>zNo viewer found forz
Executing:zExit status:)�sysr�argv�showr3r4�printr�typerrP�waitstatus_to_exitcode)	rgrrB�argsrQ�filerWrV�stsrrrrLs,



��rLcCs�td�t�D]}td|�qt�|st�}td�t�t|�}|D]$}t|�||}|D]}t|�}|D]}td|||�q9t�q1q%dS)NzMailcap files:�	zMailcap entries:z  %-15s)rjrrr[)r�fn�ckeysrkrUrV�keys�krrrris"
��ri�__main__)N)rrr&�re�__all__r	�compile�searchrM�Warningr
rrr*rr2r@rrNrOrbrLrirrrrr�<module>s.)

)
�

Page not found | The NCLEX Doctor

Page not found!

Sorry, this page is not available...