a
    ¥Q•h’%  ã                
   @   sØ   d dl Z d dlZd dlZd dlZd dlZddlmZ dddddd	œZd
d„ Zdd„ Z	dd„ Z
dddddœZdd„ Zdd„ Zdd„ Zdddddd d!d"d#d$œ	Zd%d&„ Zd'd(„ Zd)d*„ Zd+d,„ Zd-d.„ Zd/d0„ Zd4d2d3„ZdS )5é    Né   )ÚImage)úPIL._imagingÚPILLOW_VERSION)zPIL._tkinter_finderZ
tk_version)úPIL._imagingftZfreetype2_version)zPIL._imagingcmsZlittlecms_version)ú	PIL._webpZwebpdecoder_version)ÚpilÚtkinterÚ	freetype2Ú
littlecms2Úwebpc              
   C   s€   | t vrd| › �}t|ƒ‚t |  \}}zt|ƒ W dS  tyH   Y dS  tyz } zt t|ƒ¡ W Y d}~dS d}~0 0 dS )zâ
    Checks if a module is available.

    :param feature: The module to check for.
    :returns: ``True`` if available, ``False`` otherwise.
    :raises ValueError: If the module is not defined in this version of Pillow.
    zUnknown module TFN)ÚmodulesÚ
ValueErrorÚ
__import__ÚModuleNotFoundErrorÚImportErrorÚwarningsÚwarnÚstr)ÚfeatureÚmsgÚmoduleÚverÚex© r   úE/var/www/sistema_ama/venv/lib/python3.9/site-packages/PIL/features.pyÚcheck_module   s    
r   c                 C   s8   t | ƒsdS t|  \}}|du r$dS tt||gd�|ƒS )zè
    :param feature: The module to check for.
    :returns:
        The loaded version number as a string, or ``None`` if unknown or not available.
    :raises ValueError: If the module is not defined in this version of Pillow.
    N©Úfromlist)r   r   Úgetattrr   )r   r   r   r   r   r   Úversion_module+   s    r    c                   C   s   dd„ t D ƒS )z4
    :returns: A list of all supported modules.
    c                 S   s   g | ]}t |ƒr|‘qS r   )r   ©Ú.0Úfr   r   r   Ú
<listcomp>A   ó    z)get_supported_modules.<locals>.<listcomp>)r   r   r   r   r   Úget_supported_modules=   s    r&   )ÚjpegZjpeglib)Zjpeg2kZjp2klib)ÚzipÚzlib)Úlibtiffr*   )ÚjpgÚjpg_2000r)   r*   c                 C   s8   | t vrd| › �}t|ƒ‚t |  \}}|d ttjƒv S )zß
    Checks if a codec is available.

    :param feature: The codec to check for.
    :returns: ``True`` if available, ``False`` otherwise.
    :raises ValueError: If the codec is not defined in this version of Pillow.
    zUnknown codec Ú_encoder)Úcodecsr   Údirr   Úcore)r   r   ÚcodecÚlibr   r   r   Úcheck_codecL   s
    
r3   c                 C   sL   t | ƒsdS t|  \}}ttj|d ƒ}| dkrH| d¡d  d¡d S |S )a  
    :param feature: The codec to check for.
    :returns:
        The version number as a string, or ``None`` if not available.
        Checked at compile time for ``jpg``, run-time otherwise.
    :raises ValueError: If the codec is not defined in this version of Pillow.
    NÚ_versionr*   Ú
r   zVersion r   )r3   r.   r   r   r0   Úsplit)r   r1   r2   Úversionr   r   r   Úversion_codec]   s    r8   c                   C   s   dd„ t D ƒS )z3
    :returns: A list of all supported codecs.
    c                 S   s   g | ]}t |ƒr|‘qS r   )r3   r!   r   r   r   r$   v   r%   z(get_supported_codecs.<locals>.<listcomp>)r.   r   r   r   r   Úget_supported_codecsr   s    r9   )r   ZHAVE_WEBPANIMN)r   ZHAVE_WEBPMUXN)r   ZHAVE_TRANSPARENCYN)r   Z	HAVE_RAQMZraqm_version)r   ZHAVE_FRIBIDIZfribidi_version)r   ZHAVE_HARFBUZZZharfbuzz_version)r   ÚHAVE_LIBJPEGTURBOÚlibjpeg_turbo_version)r   ÚHAVE_LIBIMAGEQUANTZimagequant_version)r   ÚHAVE_XCBN)	Ú	webp_animÚwebp_muxÚtransp_webpÚraqmÚfribidiÚharfbuzzÚlibjpeg_turboÚlibimagequantÚxcbc              
   C   sŽ   | t vrd| › �}t|ƒ‚t |  \}}}zt|dgd�}t||ƒW S  tyV   Y dS  tyˆ } zt t|ƒ¡ W Y d}~dS d}~0 0 dS )zÿ
    Checks if a feature is available.

    :param feature: The feature to check for.
    :returns: ``True`` if available, ``False`` if unavailable, ``None`` if unknown.
    :raises ValueError: If the feature is not defined in this version of Pillow.
    zUnknown feature ÚPILr   N)	Úfeaturesr   r   r   r   r   r   r   r   )r   r   r   Úflagr   Zimported_moduler   r   r   r   Úcheck_feature†   s    
rJ   c                 C   s:   t | ƒsdS t|  \}}}|du r&dS tt||gd�|ƒS )zÐ
    :param feature: The feature to check for.
    :returns: The version number as a string, or ``None`` if not available.
    :raises ValueError: If the feature is not defined in this version of Pillow.
    Nr   )rJ   rH   r   r   )r   r   rI   r   r   r   r   Úversion_featurež   s    rK   c                   C   s   dd„ t D ƒS )z5
    :returns: A list of all supported features.
    c                 S   s   g | ]}t |ƒr|‘qS r   )rJ   r!   r   r   r   r$   ³   r%   z*get_supported_features.<locals>.<listcomp>)rH   r   r   r   r   Úget_supported_features¯   s    rL   c                 C   sJ   | t v rt| ƒS | tv r t| ƒS | tv r0t| ƒS tjd| › d�dd� dS )z²
    :param feature: A module, codec, or feature name.
    :returns:
        ``True`` if the module, codec, or feature is available,
        ``False`` or ``None`` otherwise.
    zUnknown feature 'z'.é   )Ú
stacklevelF)r   r   r.   r3   rH   rJ   r   r   ©r   r   r   r   Úcheck¶   s    rP   c                 C   s4   | t v rt| ƒS | tv r t| ƒS | tv r0t| ƒS dS )z¬
    :param feature:
        The module, codec, or feature to check for.
    :returns:
        The version number as a string, or ``None`` if unknown or not available.
    N)r   r    r.   r8   rH   rK   rO   r   r   r   r7   È   s    r7   c                  C   s"   t ƒ } |  tƒ ¡ |  tƒ ¡ | S )zJ
    :returns: A list of all supported modules, features, and codecs.
    )r&   ÚextendrL   r9   )Úretr   r   r   Úget_supportedØ   s    rS   Tc              	   C   s  | du rt j} t ¡  td| d� tdtj› �| d� t j ¡ }td|d  	¡ › �| d� |dd… D ]}td| 	¡ › �| d� qftd| d� td	t
j tj¡› �| d� td
t
j tjj¡› �| d� td| d� dD ]ö\}}t|ƒ�r¾|dk�rtdƒ�rdtdƒ }nt|ƒ}|du�r¬|dv }|dk�rLtdd„ | d¡D ƒƒdk }|�rVdnd}|dk�r–dD ],}t|ƒ}	|	du�rh|d|› d|	› �7 }�qhtd|d||| d� ntd|d| d� qØtd|d| d� qØtd| d� |�rt t¡}
tj ¡ D ]\}}|
|  |¡ �qöttjƒD ]ø}|› }|tjv �rD|› dtj| › �}t|| d� ||
v �rztd  d t|
| ƒ¡¡| d� g }|tjv �r”| d!¡ |tj v �rª| d"¡ |tj!v �rÀ| d#¡ |tj"v �rÖ| d$¡ |tj#v �rì| d%¡ td& d |¡¡| d� td| d� �qdS )'aG  
    Prints information about this installation of Pillow.
    This function can be called with ``python3 -m PIL``.

    :param out:
        The output stream to print to. Defaults to ``sys.stdout`` if ``None``.
    :param supported_formats:
        If ``True``, a list of all supported image file formats will be printed.
    NzD--------------------------------------------------------------------)ÚfilezPillow zPython r   r   z       zPython modules loaded from zBinary modules loaded from ))r   zPIL CORE)r	   ZTKINTER)r
   Z	FREETYPE2)r   Z
LITTLECMS2)r   ZWEBP)r@   zWEBP Transparency)r?   ZWEBPMUX)r>   zWEBP Animation)r+   ÚJPEG)r,   zOPENJPEG (JPEG2000))r)   zZLIB (PNG/ZIP))r*   ZLIBTIFF)rA   zRAQM (Bidirectional Text))rE   z#LIBIMAGEQUANT (Quantization method))rF   zXCB (X protocol)r+   rD   zlibjpeg-turbo )r   r+   r   c                 s   s   | ]}t |ƒV  qd S )N)Úint)r"   Úxr   r   r   Ú	<genexpr>  r%   zpilinfo.<locals>.<genexpr>Ú.)rM   é   zcompiled forÚloadedrA   )rB   rC   z, ú z---zsupport ok,z
support okz***zsupport not installedzExtensions: {}ÚopenÚsaveÚsave_allÚdecodeÚencodezFeatures: {})$ÚsysÚstdoutr   ÚinitÚprintrG   Ú__version__r7   Ú
splitlinesÚstripÚosÚpathÚdirnameÚ__file__r0   rP   rJ   rK   Útupler6   ÚcollectionsÚdefaultdictÚlistÚ	EXTENSIONÚitemsÚappendÚsortedÚIDÚMIMEÚformatÚjoinÚOPENÚSAVEÚSAVE_ALLÚDECODERSÚENCODERS)ÚoutÚsupported_formatsÚ
py_versionÚnamer   ÚvZversion_staticÚtr#   Úv2Ú
extensionsÚextÚiÚlinerH   r   r   r   Úpilinfoã   s€    
þþ






ÿ




r‰   )NT)rn   ri   rb   r   rG   Ú r   r   r   r    r&   r.   r3   r8   r9   rH   rJ   rK   rL   rP   r7   rS   r‰   r   r   r   r   Ú<module>   sN   û	ü÷