<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
ž
¦ÿ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 rq« |	 | | <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   & 