uawdijnntqw1x1x1
IP : 3.138.120.251
Hostname : host45.registrar-servers.com
Kernel : Linux host45.registrar-servers.com 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
..
/
lib64
/
td-agent-bit
/
..
/
python3.8
/
collections
/
..
/
__pycache__
/
mimetypes.cpython-38.pyc
/
/
U e5d�T� @s�dZddlZddlZddlZddlZzddlZWnek rHdZYnXddddddd d ddd ddg Z dddddddddg Z dadaGdd�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`eZdZdZddd�Zddd�Zddd �Zdd d�Zddd �Zddd�Z ddd�Z ddd�ZdS)rz�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. �TcCs�ts t�t��|_t��|_iif|_iif|_t � �D]\}}|�||d�q:t� �D]\}}|�||d�qZ|D]}|� ||�qvdS�NTF)rr �_encodings_map_default�copyr�_suffix_map_defaultrr � types_map_inv�_types_map_default�itemsr�_common_types_default�read)�self� filenames�strict�ext�type�namerr�!/usr/lib64/python3.8/mimetypes.py�__init__Bs zMimeTypes.__init__cCs6||j||<|j|�|g�}||kr2|�|�dS)a�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� setdefault�append)rrrrZextsrrrrPszMimeTypes.add_typecCsrt�|�}tj�|�\}}|dkr�|�d�}|dkr8dS|�dd|�}|dkr\|d|�}n|d|�}d|ksxd|kr|d }|dfSt�|�\}}||jkr�t�||j|�\}}q�||j kr�|j |} t�|�\}}nd} |j d } || kr�| || fS|��| k�r| |��| fS|�r(d| fS|j d} || k�rH| || fS|��| k�rf| |��| fSd| fSdS)aUGuess the type of a file which is either a URL or a path-like object. 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. �data�,r)NN�;N�=�/� text/plainTF)�os�fspath�urllib�parseZ _splittype�find� posixpath�splitextrrr �lower)r�urlrZschemeZcommaZsemir�baser�encodingr rrrrasB zMimeTypes.guess_typecCsL|��}|jd�|g�}|sH|jd�|g�D]}||kr0|�|�q0|S)a�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. TF)r0r�getr")rrr� extensionsrrrrr�szMimeTypes.guess_all_extensionscCs|�||�}|sdS|dS)aGuess 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. Nr)r)rrrr5rrrr�s zMimeTypes.guess_extensionc Cs(t|dd��}|�||�W5QRXdS)z� 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. �utf-8�r3N)�open�readfp)r�filenamer�fprrrr�szMimeTypes.readc Cs�|��}|sq�|��}tt|��D]"}||ddkr"||d�=qFq"|sLq|d|dd�}}|D]}|�|d||�qfqdS)z� 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. r�#N��.)�readline�split�range�lenr) rr;r�lineZwords�ir�suffixesZsuffrrrr9�s zMimeTypes.readfpcCs�tsdSdd�}t�tjd���}||�D]�}zjt�||��T}|�d�sTW5QR�Wq(t�|d�\}}|tjkr|W5QR�Wq(|�|||�W5QRXWq(tk r�Yq(Yq(Xq(W5QRXdS)z� 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. NcssJd}zt�||�}Wntk r,YqFYnXd|kr<|V|d7}qdS)Nr�r=)�_winregZEnumKey�OSError)ZmimedbrDZctyperrr� enum_types�s z3MimeTypes.read_windows_registry.<locals>.enum_types�r>zContent Type)rG�OpenKeyZHKEY_CLASSES_ROOT� startswithZQueryValueExZREG_SZrrH)rrrIZhkcrZ subkeynameZsubkeyZmimetypeZdatatyperrr�read_windows_registry�s$ � zMimeTypes.read_windows_registryN)rT)T)T)T)T)T)T)T)�__name__� __module__�__qualname__�__doc__r rrrrrr9rMrrrrr:s ? TcCstdkrt�t�||�S)a�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)�_dbr r)r1rrrrrscCstdkrt�t�||�S)a�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)rRr r�rrrrrr's cCstdkrt�t�||�S)a�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)rRr rrSrrrr8scCstdkrt�t�|||�S)aiAdd 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)rRr r)rrrrrrrHscCs�da|dkstdkrBt�}tr&|��|dkr4t}qFtt|�}nt}|D]}tj� |�rJ|� |�qJ|ja|ja|j da |j da|adSr)rrRrrGrMr�listr)�path�isfilerrrr r)�files�db�filerrrr Ys" c Cs`zt|dd�}Wntk r&YdSX|�*t�}|�|d�|jdW5QR�SQRXdS)Nr6r7T)r8rHrr9r )rY�frXrrrr usc�CsXddddddd�aadddd d �aadddd ddddddddddddddddddddddddddddddddddd d!d!d"d"d#d$d$d%d&d'd(d)d*d+d,d-d-d.d.d.d/d0d1d2d3d4d4d4d4d5d6d6d7d7d8d8d8d9d:d;d<d=d>d>d>d?d@dAdAdBdCdDdEdFdGdHdIdJdKdLdMdMdMdMdNdOdPdPdQdQdQdQdQdQdRdSdTdUdVdVdWdXdYdZdZdZdZdZd[d[d\d]d^d_��aad`dadadbdcdcdcddde�aadS)fNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzip�compressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/javascriptzapplication/jsonzapplication/manifest+jsonzapplication/mswordzapplication/octet-streamzapplication/odazapplication/pdfzapplication/pkcs7-mimezapplication/postscriptzapplication/vnd.apple.mpegurlzapplication/vnd.ms-excelzapplication/vnd.ms-powerpointzapplication/wasmzapplication/x-bcpiozapplication/x-cpiozapplication/x-cshzapplication/x-dvizapplication/x-gtarzapplication/x-hdfzapplication/x-hdf5zapplication/x-latexzapplication/x-mifzapplication/x-netcdfzapplication/x-pkcs12zapplication/x-pn-realaudiozapplication/x-python-codezapplication/x-shzapplication/x-sharzapplication/x-shockwave-flashzapplication/x-sv4cpiozapplication/x-sv4crczapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfozapplication/x-troffzapplication/x-troff-manzapplication/x-troff-mezapplication/x-troff-mszapplication/x-ustarzapplication/x-wais-sourcezapplication/xmlzapplication/zipzaudio/basicz audio/mpegzaudio/x-aiffzaudio/x-pn-realaudiozaudio/x-wavz image/bmpz image/gifz image/iefz image/jpegz image/pngz image/svg+xmlz image/tiffzimage/vnd.microsoft.iconzimage/x-cmu-rasterzimage/x-ms-bmpzimage/x-portable-anymapzimage/x-portable-bitmapzimage/x-portable-graymapzimage/x-portable-pixmapzimage/x-rgbzimage/x-xbitmapzimage/x-xpixmapzimage/x-xwindowdumpzmessage/rfc822ztext/cssztext/csvz text/htmlr(z text/richtextztext/tab-separated-valuesz text/x-pythonz text/x-setextztext/x-sgmlztext/x-vcardztext/xmlz video/mp4z video/mpegzvideo/quicktimez video/webmzvideo/x-msvideozvideo/x-sgi-movie)�z.jsz.mjsz.jsonz.webmanifestz.docz.dotz.wizz.binz.az.dllz.exez.oz.objz.soz.odaz.pdfz.p7cz.psz.aiz.epsz.m3uz.m3u8z.xlsz.xlbz.pptz.potz.ppaz.ppsz.pwzz.wasmz.bcpioz.cpioz.cshz.dviz.gtarz.hdfz.h5z.latexz.mifz.cdfz.ncz.p12z.pfxz.ramz.pycz.pyoz.shz.sharz.swfz.sv4cpioz.sv4crcz.tarz.tclz.texz.texiz.texinfoz.roffz.tz.trz.manz.mez.msz.ustarz.srcz.xslz.rdfz.wsdlz.xpdlz.zipz.auz.sndz.mp3z.mp2z.aifz.aifcz.aiffz.raz.wav�.bmpz.gifz.ief�.jpgz.jpez.jpegz.pngz.svgz.tiffz.tifz.icoz.rasr\z.pnmz.pbmz.pgmz.ppmz.rgbz.xbmz.xpmz.xwdz.emlz.mhtz.mhtmlz.nwsz.cssz.csvz.htmlz.htmz.txtz.batz.cz.hz.kshz.plz.rtxz.tsvz.pyz.etxz.sgmz.sgmlz.vcfz.xmlz.mp4z.mpegz.m1vz.mpaz.mpez.mpgz.movz.qtz.webmz.aviz.moviezapplication/rtfz audio/midiz image/jpgz image/pictztext/xul)z.rtfz.midiz.midr]z.pictz.pctz.picz.xul)rrrrr rrrrrrr�_default_mime_types�s8� � �� �r^c sddl}d�d�fdd� }z&|�tjdd�ddd d g�\}}Wn.|jk rn}z|d|�W5d}~XYnXd}d}|D]4\}}|dkr�|d�q||dkr�d}q||d kr|d}q||D]Z} |r�t| |�} | s�td| �nt| �q�t| |�\} }| �std| �q�td| d|�q�dS)Nra4Usage: 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. rJcs"t��|rt|�t�|�dS)N)�print�sys�exit)�code�msg�ZUSAGErr�usageFsz_main.<locals>.usager=Zhle�helpZlenient� extension)z-hz--help)z-lz --lenient)z-ez--extensionz I don't know anything about typeztype:z encoding:)rJ)�getoptr`�argv�errorrr_r)rhreZopts�argsrcrrg�opt�argZgtypeZguessr3rrdr�_main7s8� rn�__main__)T)T)T)T)N)rQr)r`r.Zurllib.parser+�winregrG�ImportError�__all__rrrRrrrrrr r r^rnrNrrrr�<module>s` ��W 5.
/home/../lib64/td-agent-bit/../python3.8/collections/../__pycache__/mimetypes.cpython-38.pyc