U e5d T ã @ sö d Z ddlZddlZddlZddlZzddlZW n ek rH dZY nX ddddddd d ddd ddg Z dddddddddg Z dadaG dd„ dƒZ d&dd„Zd'dd„Zd(dd„Zd)dd „Zd*dd „Zd d„ Zd!d"„ Zeƒ d#d$„ Zed%kròeƒ dS )+aì Guess the MIME type of a file. This module defines two useful functions: guess_type(url, strict=True) -- guess the MIME type and encoding of a URL. guess_extension(type, strict=True) -- 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 é NÚ knownfilesÚinitedÚ MimeTypesÚ guess_typeÚguess_all_extensionsÚguess_extensionÚadd_typeÚinitÚread_mime_typesÚ suffix_mapÚ encodings_mapÚ types_mapÚcommon_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc @ s` e Zd ZdZddd„Zddd„Zddd „Zdd d„Zddd „Zddd„Z ddd„Z ddd„ZdS )r zç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. © Tc C sŒ t s tƒ t ¡ | _t ¡ | _i i f| _i i f| _t ¡ D ]\}}| ||d¡ q:t ¡ D ]\}}| ||d¡ qZ|D ]}| ||¡ qvd S ©NTF)r r Ú_encodings_map_defaultÚcopyr Ú_suffix_map_defaultr r Ú types_map_invÚ_types_map_defaultÚitemsr Ú_common_types_defaultÚread)ÚselfÚ filenamesÚstrictÚextÚtypeÚnamer r ú!/usr/lib64/python3.8/mimetypes.pyÚ__init__B s zMimeTypes.__init__c C s6 || j | |<