o
    svXj”%  ã                
   @   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_finderÚ
tk_version)úPIL._imagingftÚfreetype2_version)zPIL._imagingcmsÚlittlecms_version)ú	PIL._webpÚwebpdecoder_version)ÚpilÚtkinterÚ	freetype2Ú
littlecms2Úwebpc              
   C   s|   | t vrd| › �}t|ƒ‚t |  \}}zt|ƒ W dS  ty$   Y dS  ty= } zt t|ƒ¡ W Y d}~dS d}~ww )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   úI/var/www/html/myproject/venv/lib/python3.10/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   ó   dd„ t D ƒS )z4
    :returns: A list of all supported modules.
    c                 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=   ó   r,   )ÚjpegÚjpeglib)Újpeg2kÚjp2klib)ÚzipÚzlib)Úlibtiffr4   )ÚjpgÚjpg_2000r3   r4   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
   
r=   c                 C   sL   t | ƒsdS t|  \}}ttj|d ƒ}| dkr$| 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Ú_versionr4   Ú
r   zVersion r   )r=   r8   r#   r   r:   Úsplit)r   r;   r<   Úversionr   r   r   Úversion_codec]   s   rB   c                   C   r%   )z3
    :returns: A list of all supported codecs.
    c                 S   r&   r   )r=   r'   r   r   r   r*   v   r+   z(get_supported_codecs.<locals>.<listcomp>)r8   r   r   r   r   Úget_supported_codecsr   r-   rC   )r
   ÚHAVE_WEBPANIMN)r
   ÚHAVE_WEBPMUXN)r
   ÚHAVE_TRANSPARENCYN)r   Ú	HAVE_RAQMÚraqm_version)r   ÚHAVE_FRIBIDIÚfribidi_version)r   ÚHAVE_HARFBUZZÚharfbuzz_version)r   ÚHAVE_LIBJPEGTURBOÚlibjpeg_turbo_version)r   ÚHAVE_LIBIMAGEQUANTÚ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y+   Y dS  tyD } zt t|ƒ¡ W Y d}~dS d}~ww )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   Úimported_moduler   r   r   r   Úcheck_feature†   s   
€þr_   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!   )r_   r\   r#   r   )r   r   r]   r   r   r   r   Úversion_featurež   s   r`   c                   C   r%   )z5
    :returns: A list of all supported features.
    c                 S   r&   r   )r_   r'   r   r   r   r*   ³   r+   z*get_supported_features.<locals>.<listcomp>)r\   r   r   r   r   Úget_supported_features¯   r-   ra   c                 C   sJ   | t v rt| ƒS | tv rt| ƒS | tv rt| ƒ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    r8   r=   r\   r_   r   r   ©r   r   r   r   Úcheck¶   s   re   c                 C   s4   | t v rt| ƒS | tv rt| ƒS | tv rt| ƒ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$   r8   rB   r\   r`   rd   r   r   r   rA   È   s   rA   c                  C   s"   t ƒ } |  tƒ ¡ |  tƒ ¡ | S )zJ
    :returns: A list of all supported modules, features, and codecs.
    )r,   Úextendra   rC   )Úretr   r   r   Úget_supportedØ   s   rh   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� q3td| d� td	t
j tj¡› �| d� td
t
j tjj¡› �| d� td| d� dD ]r\}}t|ƒrÖ|dkrƒtdƒrƒdtdƒ }nt|ƒ}|durÍ|dv }|dkr¡tdd„ | d¡D ƒƒdk }|r¥dnd}|dkrÂdD ]}t|ƒ}	|	durÁ|d|› d|	› �7 }q­td|d||| d� qltd|d| d� qltd|d| d� qltd| d� |�r€t t¡}
tj ¡ D ]\}}|
|  |¡ qòttjƒD ]~}|› }|tjv �r|› dtj| › �}t|| d� ||
v �r3td  d t|
| ƒ¡¡| d� g }|tjv �r@| d!¡ |tj v �rK| d"¡ |tj!v �rV| d#¡ |tj"v �ra| d$¡ |tj#v �rl| d%¡ td& d |¡¡| d� td| d� �qdS 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   ÚTKINTER)r   Ú	FREETYPE2)r   Ú
LITTLECMS2)r   ÚWEBP)rT   zWEBP Transparency)rS   ÚWEBPMUX)rR   zWEBP Animation)r5   ÚJPEG)r6   zOPENJPEG (JPEG2000))r3   zZLIB (PNG/ZIP))r4   ÚLIBTIFF)rU   zRAQM (Bidirectional Text))rY   z#LIBIMAGEQUANT (Quantization method))rZ   zXCB (X protocol)r5   rX   zlibjpeg-turbo )r   r5   r   c                 s   s   � | ]}t |ƒV  qd S )N)Úint)r(   Úxr   r   r   Ú	<genexpr>  s   € zpilinfo.<locals>.<genexpr>Ú.)rb   é   zcompiled forÚloadedrU   )rV   rW   z, ú z---zsupport ok,z
support okz***zsupport not installedzExtensions: {}ÚopenÚsaveÚsave_allÚdecodeÚencodezFeatures: {})$ÚsysÚstdoutr   ÚinitÚprintr[   Ú__version__rA   Ú
splitlinesÚstripÚosÚpathÚdirnameÚ__file__r:   re   r_   r`   Útupler@   ÚcollectionsÚdefaultdictÚlistÚ	EXTENSIONÚitemsÚappendÚsortedÚIDÚMIMEÚformatÚjoinÚOPENÚSAVEÚSAVE_ALLÚDECODERSÚENCODERS)ÚoutÚsupported_formatsÚ
py_versionÚnamer   ÚvÚversion_staticÚtr)   Úv2Ú
extensionsÚextÚiÚliner\   r   r   r   Úpilinfoã   s†   
þþ€

ÿ




ãr¥   )NT)r‰   r„   r}   r   r[   Ú r   r   r    r$   r,   r8   r=   rB   rC   r\   r_   r`   ra   re   rA   rh   r¥   r   r   r   r   Ú<module>   sP    û	ü÷