tzh
2024-08-22 c7d0944258c7d0943aa7b2211498fd612971ce27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
L\¬Qc    @sqdZddlZddlZddlZddlZyddlZWnek
r_dZnXddddddgZd    d
d d d ddddg    Z    e
a da dd-d„ƒYZ ed„Zed„Zed„Zed„Zdd„Zd„Zd„ZeƒedkrmddlZdZdd„Zy/ejejddd d!d"gƒ\ZZWn#ejk
r‹ZedeƒnXdZd#Z xWeD]O\Z!Z"e!d.krÄed#ƒqŸe!d/krÙd#ZqŸe!d0krŸdZ qŸqŸWxxeD]mZ#e r.ee#eƒZ$e$s&d*Ge#GHqfe$GHqùee#eƒ\Z$Z%e$sUd*Ge#GHqùd+Ge$Gd,Ge%GHqùWndS(1sæ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 (on Windows, the
  default values are taken from the registry)
read_mime_types(file) -- parse one file, return a dictionary or None
iÿÿÿÿNt
guess_typetguess_extensiontguess_all_extensionstadd_typetread_mime_typestinits/etc/mime.typess/etc/httpd/mime.typess/etc/httpd/conf/mime.typess/etc/apache/mime.typess/etc/apache2/mime.typess$/usr/local/etc/httpd/conf/mime.typess"/usr/local/lib/netscape/mime.typess/usr/local/etc/mime.typest    MimeTypescBsqeZdZd    ed„Zed„Zed„Zed„Zed„Zed„Z    ed„Z
ed„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.
    cCsÑtstƒntjƒ|_tjƒ|_iif|_iif|_x-tjƒD]\}}|j||t    ƒqYWx-t
jƒD]\}}|j||t ƒq‰Wx|D]}|j ||ƒq³WdS(N( tinitedRt encodings_maptcopyt
suffix_mapt    types_mapt types_map_invtitemsRtTruet common_typestFalsetread(tselft    filenameststricttextttypetname((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyt__init__@s
 cCsJ||j||<|j|j|gƒ}||krF|j|ƒndS(s‰Add a mapping between a type and an extension.
 
        When the extension is already known, the new
        type will replace the old one. When the type
        is already known the extension will be added
        to the list of known extensions.
 
        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        N(R R t
setdefaulttappend(RRRRtexts((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRNs  c Csàtj|ƒ\}}|dkr£|jdƒ}|dkr@d    S|jdd|ƒ}|dkrn|| }n
|| }d|ksd|kr™d}n|dfStj|ƒ\}}x3||jkrítj||j|ƒ\}}q»W||jkr"|j|}    tj|ƒ\}}nd}    |jt    }
||
krO|
||    fS|j
ƒ|
kru|
|j
ƒ|    fS|r…d|    fS|jt }
||
kr¬|
||    fS|j
ƒ|
krÒ|
|j
ƒ|    fSd|    fSdS(
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.
        tdatat,it;t=t/s
text/plainN(NN( turllibt    splittypetfindtNonet    posixpathtsplitextR
RR RtlowerR( RturlRtschemetcommatsemiRtbaseRtencodingR ((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR_s@    
    
$   
  cCsr|jƒ}|jtj|gƒ}|snx@|jtj|gƒD]"}||krE|j|ƒqEqEWn|S(sÓGuess the extensions for a file based on its MIME type.
 
        Return value is a list of strings giving the possible filename
        extensions, 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().
 
        Optional `strict' argument when false adds a bunch of commonly found,
        but non-standard types.
        (R'R RtgetRR(RRRt
extensionsR((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRs   cCs$|j||ƒ}|sdS|dS(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.
        iN(RR$(RRRR/((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR°s cCs)t|ƒ}|j||ƒWdQXdS(s×
        Read a single mime.types-format file, specified by pathname.
 
        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        N(topentreadfp(RtfilenameRtfp((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRÂsc    Cs±xª|jƒ}|sPn|jƒ}x9tt|ƒƒD]%}||ddkr8||3Pq8q8W|smqn|d|d}}x%|D]}|j|d||ƒq‰WqdS(sÀ
        Read a single mime.types-format file.
 
        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        it#it.N(treadlinetsplittrangetlenR(    RR3RtlinetwordstiRtsuffixestsuff((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR1Ís   c sþts
dS‡fd†}tjƒ‰tjtjdƒ¾}x´||ƒD]¦}y7tj||ƒ}tj|dƒ\}}WdQXWntk
rqJnX|tjkr³qJny|jˆƒ}Wnt    k
rÜqJnX|j
|||ƒqJWWdQXdS(sÎ
        Load the MIME types database from Windows registry.
 
        If strict is true, information will be added to
        list of standard types, else to the list of non-standard
        types.
        Nc3sxd}xktrsytj||ƒ}Wntk
r9PnXy|jˆƒ}Wntk
r`nX|V|d7}q    WdS(Nii(Rt_winregtEnumKeytEnvironmentErrortencodetUnicodeEncodeError(tmimedbR<tctype(tdefault_encoding(sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyt
enum_typesñs      sMIME\Database\Content Typet    Extension( R?tsystgetdefaultencodingtOpenKeytHKEY_CLASSES_ROOTt QueryValueExRAtREG_SZRBRCR(RRRGRDREtkeytsuffixtdatatype((RFsQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pytread_windows_registryäs(
         (( t__name__t
__module__t__doc__RRRRRRRR1RR(((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR8s  >   cCs&tdkrtƒntj||ƒ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(t_dbR$RR(R(R((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRs 
cCs&tdkrtƒntj||ƒS(sýGuess the extensions for a file based on its MIME type.
 
    Return value is a list of strings giving the possible filename
    extensions, 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(RVR$RR(RR((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR*s 
cCs&tdkrtƒntj||ƒ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(RVR$RR(RR((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR;s 
cCs)tdkrtƒntj|||ƒS(siAdd a mapping between a type and an extension.
 
    When the extension is already known, the new
    type will replace the old one. When the type
    is already known the extension will be added
    to the list of known extensions.
 
    If strict is true, information will be added to
    list of standard types, else to the list of non-standard
    types.
    N(RVR$RR(RRR((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRKs 
cCs tatƒ}|dkr7tr.|jƒnt}nx0|D](}tjj    |ƒr>|j
|ƒq>q>W|j a |j a |j ta |j ta|adS(N(RRRR$R?RRt
knownfilestostpathtisfileRRR
R RRRV(tfilestdbtfile((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyR\s                     cCsIyt|ƒ}Wntk
r$dSXtƒ}|j|tƒ|jtS(N(R0tIOErrorR$RR1RR (R]tfR\((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyRps     cCsðidd6dd6dd6dd6dd6aid    d
6d d 6d d6dd6ai{dd6dd6dd6dd6dd6dd6dd6dd6dd 6dd!6d"d#6dd$6d%d&6d'd&6d(d)6d*d+6d,d-6dd.6d/d06d/d16d2d36d4d56dd66d7d86dd96d:d;6d<d=6dd>6d?d@6dAdB6dAdC6dDdE6dFdG6dHdI6dHdJ6dHdK6dLdM6ddN6dOdP6dQdR6dSdT6dUdV6d4dW6d4dX6dYdZ6d[d\6d]d^6d_d`6d_da6dbdc6dQdd6dQde6dQdf6dQdg6dhdi6d'dj6d4dk6ddl6ddm6dndo6dpdq6drds6dtdu6dvdw6dpdx6dydz6dd{6d|d}6d~d6d€d6d€d‚6dƒd„6d€d…6d€d†6dd‡6d€dˆ6d‰dŠ6d‹dŒ6d‹d6d[dŽ6dd6d‘d’6d“d”6d•d–6d—d˜6d™dš6d›dœ6ddž6ddŸ6d d¡6d¢d£6dd¤6dd¥6d¦d§6d¨d©6dªd«6d¬d­6d™d®6d¯d°6d±d²6d³d´6dµd¶6dµd·6d¸d¹6d¸dº6d™d»6d¼d½6dd¾6d¿dÀ6dÁdÂ6dÃdÄ6d/dÅ6d•dÆ6dÇdÈ6dÉdÊ6dËdÌ6dÉdÌ6dÍdÎ6d•dÏ6dÐdÑ6d•dÒ6dÓdÔ6dÕdÖ6aid×dK6dØdÙ6dØdÚ6dÛdÜ6dÛdÝ6dÛdÞ6dßdà6dádâ6adS(ãNs.tar.gzs.tgzs.tazs.tzs.tar.bz2s.tbz2s.tar.xzs.txztgzips.gztcompresss.Ztbzip2s.bz2txzs.xzsapplication/octet-streams.asapplication/postscripts.ais audio/x-aiffs.aifs.aifcs.aiffs audio/basics.ausvideo/x-msvideos.avis
text/plains.batsapplication/x-bcpios.bcpios.binsimage/x-ms-bmps.bmps.csapplication/x-cdfs.cdfsapplication/x-netcdfsapplication/x-cpios.cpiosapplication/x-cshs.cshstext/csss.csss.dllsapplication/mswords.docs.dotsapplication/x-dvis.dvismessage/rfc822s.emls.epss text/x-setexts.etxs.exes    image/gifs.gifsapplication/x-gtars.gtars.hsapplication/x-hdfs.hdfs    text/htmls.htms.htmlsimage/vnd.microsoft.icons.icos    image/iefs.iefs
image/jpegs.jpes.jpegs.jpgsapplication/javascripts.jss.kshsapplication/x-latexs.latexs
video/mpegs.m1vsapplication/x-troff-mans.mansapplication/x-troff-mes.mes.mhts.mhtmlsapplication/x-mifs.mifsvideo/quicktimes.movsvideo/x-sgi-movies.movies
audio/mpegs.mp2s.mp3s    video/mp4s.mp4s.mpas.mpes.mpegs.mpgsapplication/x-troff-mss.mss.ncs.nwss.os.objsapplication/odas.odasapplication/x-pkcs12s.p12sapplication/pkcs7-mimes.p7csimage/x-portable-bitmaps.pbmsapplication/pdfs.pdfs.pfxsimage/x-portable-graymaps.pgms.pls    image/pngs.pngsimage/x-portable-anymaps.pnmsapplication/vnd.ms-powerpoints.pots.ppasimage/x-portable-pixmaps.ppms.ppss.ppts.pss.pwzs text/x-pythons.pysapplication/x-python-codes.pycs.pyos.qtsaudio/x-pn-realaudios.rasapplication/x-pn-realaudios.ramsimage/x-cmu-rasters.rassapplication/xmls.rdfs image/x-rgbs.rgbsapplication/x-troffs.roffs text/richtexts.rtxs text/x-sgmls.sgms.sgmlsapplication/x-shs.shsapplication/x-shars.shars.snds.sosapplication/x-wais-sources.srcsapplication/x-sv4cpios.sv4cpiosapplication/x-sv4crcs.sv4crcsapplication/x-shockwave-flashs.swfs.tsapplication/x-tars.tarsapplication/x-tcls.tclsapplication/x-texs.texsapplication/x-texinfos.texis.texinfos
image/tiffs.tifs.tiffs.trstext/tab-separated-valuess.tsvs.txtsapplication/x-ustars.ustars text/x-vcards.vcfs audio/x-wavs.wavs.wizs.wsdlsimage/x-xbitmaps.xbmsapplication/vnd.ms-excels.xlbsapplication/excels.xlsstext/xmls.xmls.xpdlsimage/x-xpixmaps.xpms.xslsimage/x-xwindowdumps.xwdsapplication/zips.zips    image/jpgs
audio/midis.mids.midis
image/picts.pcts.pics.pictsapplication/rtfs.rtfstext/xuls.xul(R
RR R(((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyt_default_mime_typeszs 
 
 
t__main__s4Usage: 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.
tcCs$tGH|r|GHntj|ƒdS(N(tUSAGERItexit(tcodetmsg((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pytusage6sithlethelptlenientt    extensionis-hs--helps-ls    --lenients-es --extensions I don't know anything about typestype:s    encoding:((s-hs--help(s-ls    --lenient(s-es --extension(&RURXRIR%R!R?t ImportErrorR$t__all__RWRRRVRRRRRRRRRdRStgetoptRgRktargvtoptstargsterrorRjRRotopttargtgtypetguessR-(((sQ/tmp/ndk-User/buildhost/install/prebuilt/darwin-x86_64/lib/python2.7/mimetypes.pyt<module>st     
        Û         
   ª