-
<c       s\    d  Z    d k Z  d k Z  d k Z  d d d d g Z  d d d d g Z & d	 a ) d
 f  d     YZ  d d  a  d d  a	  e
 d  Z  d   Z  h  d d <d d <d d <a  h  d d <d d <a  h  d d <d d <d d <d d <d d  <d! d" <d# d$ <d% d& <d' d( <d d) <d* d+ <d% d, <d- d. <d/ d. <d0 d1 <d2 d3 <d4 d5 <d d6 <d7 d8 <d7 d9 <d: d; <d< d= <d d> <d? d@ <d dA <dB dC <dD dE <d% dF <dG dH <dI dJ <dI dK <dL dM <dN dO <dN dP <dN dQ <dR dS <d% dT <dU dV <dW dX <dY dZ <d[ d\ <d< d] <d< d^ <d_ d` <da db <dc dd <de df <de dg <dW dh <dW di <dW dj <dW dk <dl dm <d/ dn <d< do <d dp <d dq <dr ds <dt du <dv dw <dx dy <dz d{ <dt d| <d} d~ <d% d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <da d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d! d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d d <d% d <d d <d d <d d <d7 d <d d <d d <d d <d d <d d <d d <d d <d d <d d <a {h  d dQ <d d <d d <d d <d d <d d <d d <d d <a e d j od k Z d k Z d Z d d  Z y5 e i e i d d d d d g  \ Z Z Wn+ e i j
 o Z e d e  n Xd Z d	 Z x e D]y \ Z Z e d d f j o e d	  nG e d d f j o d	 Z n$ e d d f j o d Z n q3Wx e D] Z e o9 t	 e e  Z  e  o d Ge GHn	 e  GHnH t e e  \ Z  Z! e  o d Ge GHn d Ge  Gd Ge! GHqWn d S(   s  Guess the MIME type of a file.

This module defines two useful functions:

guess_type(url, strict=1) -- guess the MIME type and encoding of a URL.

guess_extension(type, strict=1) -- guess the extension for a given MIME type.

It also contains the following, for tuning the behavior:

Data:

knownfiles -- list of files to parse
inited -- flag set when init() has been called
suffix_map -- dictionary mapping suffixes to suffixes
encodings_map -- dictionary mapping suffixes to encodings
types_map -- dictionary mapping suffixes to types

Functions:

init([files]) -- parse a list of files, default knownfiles
read_mime_types(file) -- parse one file, return a dictionary or None
Ns
   guess_types   guess_extensions   read_mime_typess   inits$   /usr/local/etc/httpd/conf/mime.typess"   /usr/local/lib/netscape/mime.typess   /usr/local/etc/mime.typesi    s	   MimeTypesc      sY   ) t  Z d  Z / 1 f  d  Z ; d d  Z y d d  Z  d   Z  d   Z RS(   s   MIME-types datastore.

    This datastore can handle information from mime.types-style files
    and supports basic determination of MIME type from a filename or
    URL, and can guess a reasonable extension given a MIME type.
    c    s   1 2 t  o 3 t   n 4 t i   |  _ 5 t i   |  _ 6 t i   |  _ 7 t i   |  _ 8 x! | D8 ] } 9 |  i
 |  qn Wd  S(   N(   s   initeds   inits   encodings_maps   copys   selfs
   suffix_maps	   types_maps   common_typess	   filenamess   names   read(   s   selfs	   filenamess   name(    (    s   /usr/lib/python2.2/mimetypes.pys   __init__1 s   
 	i   c    s  ; M N t  i |  \ } } O | d j o V | i d  } W | d j  o Y t t f Sn Z | i d d |  } [ | d j o \ | |  }	 n ^ | |  }	 _ d |	 j p
 d |	 j o ` d }	 n a |	 t f Sn b t	 i
 |  \ } } c x> c |  i i |  o' d t	 i
 | |  i |  \ } } q We |  i i |  o, f |  i | } g t	 i
 |  \ } } n
 i t } j |  i } k |  i }
 l | i |  o m | | | f Sn n | i | i    o o | | i   | f Sn p | o q t | f Snj r |
 i |  o s |
 | | f SnB t |
 i | i    o u |
 | i   | f Sn w t | f Sd S(	   s:  Guess the type of a file based on its URL.

        Return value is a tuple (type, encoding) where type is None if
        the type can't be guessed (no or unknown suffix) or a string
        of the form type/subtype, usable for a MIME Content-type
        header; and encoding is None for no encoding or the name of
        the program used to encode (e.g. compress or gzip).  The
        mappings are table driven.  Encoding suffixes are case
        sensitive; type suffixes are first tried case sensitive, then
        case insensitive.

        The suffixes .tgz, .taz and .tz (case sensitive!) are all
        mapped to '.tar.gz'.  (This is table-driven too, using the
        dictionary suffix_map.)

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        s   datas   ,i    s   ;s   =s   /s
   text/plainN(   s   urllibs	   splittypes   urls   schemes   finds   commas   Nones   semis   types	   posixpaths   splitexts   bases   exts   selfs
   suffix_maps   has_keys   encodings_maps   encodings	   types_maps   common_typess   lowers   strict(   s   selfs   urls   stricts   semis   encodings   exts   bases   commas   schemes   types   common_typess	   types_map(    (    s   /usr/lib/python2.2/mimetypes.pys
   guess_type; sD    (	
c    s   y   | i   }  x; |  i i   D ]' \ } }  | | j o  | Sn q( W | oB  x8 t i   D ]' \ } }  | | j o  | Sn qq Wn  t	 Sd S(   s  Guess the extension for a file based on its MIME type.

        Return value is a string giving a filename extension,
        including the leading dot ('.').  The extension is not
        guaranteed to have been associated with any particular data
        stream, but would be mapped to the MIME type `type' by
        guess_type().  If no extension can be guessed for `type', None
        is returned.

        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        N(
   s   types   lowers   selfs	   types_maps   itemss   exts   stypes   stricts   common_typess   None(   s   selfs   types   stricts   exts   stype(    (    s   /usr/lib/python2.2/mimetypes.pys   guess_extensiony s     c    s6      t  |  }  |  i |   | i   d S(   s<   Read a single mime.types-format file, specified by pathname.N(   s   opens   filenames   fps   selfs   readfps   close(   s   selfs   filenames   fp(    (    s   /usr/lib/python2.2/mimetypes.pys   read s   c 	   s     |  i }  x  d o  | i   }  | o  Pn  | i   }  xG t t	 |   D ]0 }  | | d d j o  | | 3 Pn qi W | o
  q n  | d | d f \ } }  x" | D ] }  | | d | <q Wq Wd S(   s%   Read a single mime.types-format file.i   i    s   #s   .N(   s   selfs	   types_maps   maps   fps   readlines   lines   splits   wordss   ranges   lens   is   types   suffixess   suff(	   s   selfs   fps   maps   suffs   is   wordss   lines   types   suffixes(    (    s   /usr/lib/python2.2/mimetypes.pys   readfp s&    
 	


 	(   s   __name__s
   __module__s   __doc__s   __init__s
   guess_types   guess_extensions   reads   readfp(    (    (    s   /usr/lib/python2.2/mimetypes.pys	   MimeTypes) s   
>i   c    s$      t     t |  |  Sd S(   s  Guess the type of a file based on its URL.

    Return value is a tuple (type, encoding) where type is None if the
    type can't be guessed (no or unknown suffix) or a string of the
    form type/subtype, usable for a MIME Content-type header; and
    encoding is None for no encoding or the name of the program used
    to encode (e.g. compress or gzip).  The mappings are table
    driven.  Encoding suffixes are case sensitive; type suffixes are
    first tried case sensitive, then case insensitive.

    The suffixes .tgz, .taz and .tz (case sensitive!) are all mapped
    to ".tar.gz".  (This is table-driven too, using the dictionary
    suffix_map).

    Optional `strict' argument when false adds a bunch of commonly found, but
    non-standard types.
    N(   s   inits
   guess_types   urls   strict(   s   urls   strict(    (    s   /usr/lib/python2.2/mimetypes.pys
   guess_type s   
c    s$      t     t |  |  Sd S(   s  Guess the extension for a file based on its MIME type.

    Return value is a string giving a filename extension, including the
    leading dot ('.').  The extension is not guaranteed to have been
    associated with any particular data stream, but would be mapped to the
    MIME type `type' by guess_type().  If no extension can be guessed for
    `type', None is returned.

    Optional `strict' argument when false adds a bunch of commonly found,
    but non-standard types.
    N(   s   inits   guess_extensions   types   strict(   s   types   strict(    (    s   /usr/lib/python2.2/mimetypes.pys   guess_extension s   
c    s        d a   t   }  |  t j o  t }  n  xA |  D ]6 }  t i i	 |  o  | i
 t |   n qH W | i a  | i a  | i a  | i a  | i a  | i a d  S(   Ni   (   s   initeds	   MimeTypess   dbs   filess   Nones
   knownfiless   files   oss   paths   isfiles   readfps   opens   encodings_maps
   suffix_maps	   types_maps   guess_extensions
   guess_types   common_types(   s   filess   dbs   file(    (    s   /usr/lib/python2.2/mimetypes.pys   init s"   	
 	c    sc     y  t  |   } Wn  t j
 o  t Sn X t   }  | i |   | i Sd  S(   N(	   s   opens   files   fs   IOErrors   Nones	   MimeTypess   dbs   readfps	   types_map(   s   files   fs   db(    (    s   /usr/lib/python2.2/mimetypes.pys   read_mime_types s   s   .tar.gzs   .tgzs   .tazs   .tzs   gzips   .gzs   compresss   .Zs   application/octet-streams   .as   application/postscripts   .ais   audio/x-aiffs   .aifs   .aifcs   .aiffs   audio/basics   .aus   video/x-msvideos   .avis
   text/plains   .bats   application/x-bcpios   .bcpios   .bins   image/x-ms-bmps   .bmps   .cs   application/x-cdfs   .cdfs   application/x-netcdfs   application/x-cpios   .cpios   application/x-cshs   .cshs   text/csss   .csss   .dlls   application/mswords   .docs   .dots   application/x-dvis   .dvis   message/rfc822s   .emls   .epss   text/x-setexts   .etxs   .exes	   image/gifs   .gifs   application/x-gtars   .gtars   .hs   application/x-hdfs   .hdfs	   text/htmls   .htms   .htmls	   image/iefs   .iefs
   image/jpegs   .jpes   .jpegs   .jpgs   application/x-javascripts   .jss   .kshs   application/x-latexs   .latexs
   video/mpegs   .m1vs   application/x-troff-mans   .mans   application/x-troff-mes   .mes   .mhts   .mhtmls   application/x-mifs   .mifs   video/quicktimes   .movs   video/x-sgi-movies   .movies
   audio/mpegs   .mp2s   .mp3s   .mpas   .mpes   .mpegs   .mpgs   application/x-troff-mss   .mss   .ncs   .nwss   .os   .objs   application/odas   .odas   application/x-pkcs12s   .p12s   application/pkcs7-mimes   .p7cs   image/x-portable-bitmaps   .pbms   application/pdfs   .pdfs   .pfxs   image/x-portable-graymaps   .pgms   .pls	   image/pngs   .pngs   image/x-portable-anymaps   .pnms   application/vnd.ms-powerpoints   .pots   .ppas   image/x-portable-pixmaps   .ppms   .ppss   .ppts   .pss   .pwzs   text/x-pythons   .pys   application/x-python-codes   .pycs   .pyos   .qts   audio/x-pn-realaudios   .ras   application/x-pn-realaudios   .rams   image/x-cmu-rasters   .rass   application/xmls   .rdfs   image/x-rgbs   .rgbs   application/x-troffs   .roffs   text/richtexts   .rtxs   text/x-sgmls   .sgms   .sgmls   application/x-shs   .shs   application/x-shars   .shars   .snds   .sos   application/x-wais-sources   .srcs   application/x-sv4cpios   .sv4cpios   application/x-sv4crcs   .sv4crcs   .ts   application/x-tars   .tars   application/x-tcls   .tcls   application/x-texs   .texs   application/x-texinfos   .texis   .texinfos
   image/tiffs   .tifs   .tiffs   .trs   text/tab-separated-valuess   .tsvs   .txts   application/x-ustars   .ustars   text/x-vcards   .vcfs   audio/x-wavs   .wavs   .wizs   image/x-xbitmaps   .xbms   application/vnd.ms-excels   .xlbs   application/excels   .xlss   text/xmls   .xmls   image/x-xpixmaps   .xpms   .xsls   image/x-xwindowdumps   .xwds   application/zips   .zips	   image/jpgs
   audio/midis   .mids   .midis
   image/picts   .pcts   .pics   .picts   application/rtfs   .rtfs   text/xuls   .xuls   __main__s4  Usage: mimetypes.py [options] type

Options:
    --help / -h       -- print this message and exit
    --lenient / -l    -- additionally search of some common, but non-standard
                         types.
    --extension / -e  -- guess extension instead of type

More than one type argument may be given.
s    c    s5   t  GH| o | GHn t i |   d  S(   N(   s   USAGEs   msgs   syss   exits   code(   s   codes   msg(    (    s   /usr/lib/python2.2/mimetypes.pys   usages   
 s   hles   helps   lenients	   extensions   -hs   --helps   -ls	   --lenients   -es   --extensions    I don't know anything about types   type:s	   encoding:("   s   __doc__s   oss	   posixpaths   urllibs   __all__s
   knownfiless   initeds	   MimeTypess
   guess_types   guess_extensions   Nones   inits   read_mime_typess
   suffix_maps   encodings_maps	   types_maps   common_typess   __name__s   syss   getopts   USAGEs   usages   argvs   optss   argss   errors   msgs   stricts	   extensions   opts   args   gtypes   guesss   encoding(   s   opts	   MimeTypess   encodings   argss   syss   USAGEs   msgs   read_mime_typess   args
   knownfiless   guesss	   posixpaths   __all__s	   extensions   urllibs   stricts   inits   usages   getopts   gtypes   oss   opts(    (    s   /usr/lib/python2.2/mimetypes.pys   ? sd   	
$
    3Q			
 
 	
  