o
    Ñ­j)  ã                
   @  s
  d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlZddl	m
Z
 dddd	d
dœZdAdd„ZdBdd„ZdCdd„ZdddddœZdAdd„ZdBdd „ZdCd!d"„Zd#d$d%d&d'd(d)d*d+d,œ	ZdDd.d/„ZdBd0d1„ZdCd2d3„ZdDd4d5„ZdBd6d7„ZdCd8d9„ZdEdFd?d@„ZdS )Gé    )ÚannotationsN)ÚIOé   )Ú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ÚwebpÚfeatureÚstrÚreturnÚboolc              
   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Úwarnr   )r   ÚmsgÚmoduleÚverÚex© r"   úI/var/www/html/CropPilot/venv/lib/python3.10/site-packages/PIL/features.pyÚcheck_module   s   
€þr$   ú
str | Nonec                 C  s,   t | ƒsdS t|  \}}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)   ú	list[str]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=   ó   r2   )ÚjpegÚjpeglib)Újpeg2kÚjp2klib)ÚzipÚzlib)Úlibtiffr:   )ÚjpgÚjpg_2000r9   r:   c                 C  s:   | 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
   
rC   c                 C  sN   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Ú_versionr:   Ú
r   zVersion r   )rC   r>   r(   r   r@   Úsplit)r   rA   rB   Úversionr"   r"   r#   Úversion_codec]   s   rH   c                   C  r+   )z3
    :returns: A list of all supported codecs.
    c                 S  r,   r"   )rC   r-   r"   r"   r#   r0   v   r1   z(get_supported_codecs.<locals>.<listcomp>)r>   r"   r"   r"   r#   Úget_supported_codecsr   r3   rI   )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Úxcbúbool | Nonec              
   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   
€þrf   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&   )rf   rc   r(   r   )r   r   rd   r    r"   r"   r#   Úversion_featurež   s   rg   c                   C  r+   )z5
    :returns: A list of all supported features.
    c                 S  r,   r"   )rf   r-   r"   r"   r#   r0   ³   r1   z*get_supported_features.<locals>.<listcomp>)rc   r"   r"   r"   r#   Úget_supported_features¯   r3   rh   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$   r>   rC   rc   rf   r   r   ©r   r"   r"   r#   Úcheck¶   s   rl   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)   r>   rH   rc   rg   rk   r"   r"   r#   rG   È   s   rG   c                  C  s"   t ƒ } |  tƒ ¡ |  tƒ ¡ | S )zJ
    :returns: A list of all supported modules, features, and codecs.
    )r2   Úextendrh   rI   )Úretr"   r"   r#   Úget_supportedØ   s   ro   TÚoutúIO[str] | NoneÚsupported_formatsÚNonec              	   C  st  | 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
pMd
› �| d� t jt jkrctdt j› �| d� tdt j› �| d� t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}|dkr³tdƒ}|dur³d| }|du r»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� q˜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 �rN|› dtj| › �}t|| d� ||v �ritd$ d  t|| ƒ¡¡| d� g }|tj!v �rv| 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� �q9dS dS )+a  
    Prints information about this installation of Pillow.
    This function can be called with ``python3 -m PIL``.
    It can also be called with ``python3 -m PIL.report`` or ``python3 -m PIL --report``
    to have "supported_formats" set to ``False``, omitting the list of all supported
    image file formats.

    :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 executable is Úunknownz%Environment Python files loaded from z System Python files loaded from z"Python Pillow modules loaded from z"Binary Pillow modules loaded from ))r   zPIL CORE)r   ÚTKINTER)r   Ú	FREETYPE2)r   Ú
LITTLECMS2)r   ÚWEBP)rZ   zWEBP Transparency)rY   ÚWEBPMUX)rX   zWEBP Animation)r;   ÚJPEG)r<   zOPENJPEG (JPEG2000))r9   zZLIB (PNG/ZIP))r:   ÚLIBTIFF)r[   zRAQM (Bidirectional Text))r_   z#LIBIMAGEQUANT (Quantization method))r`   zXCB (X protocol)r;   r^   zlibjpeg-turbo )r   r;   r   c                 s  s   � | ]}t |ƒV  qd S )N)Úint)r.   Úxr"   r"   r#   Ú	<genexpr>)  s   € zpilinfo.<locals>.<genexpr>Ú.)ri   é   zcompiled forÚloadedr[   )r\   r]   z, ú z---zsupport ok,z
support okz***zsupport not installedzExtensions: {}ÚopenÚsaveÚsave_allÚdecodeÚencodezFeatures: {})&ÚsysÚstdoutr   ÚinitÚprintrb   Ú__version__rG   Ú
splitlinesÚstripÚ
executableÚprefixÚbase_prefixÚosÚpathÚdirnameÚ__file__r@   rl   rg   ÚtuplerF   ÚcollectionsÚdefaultdictÚlistÚ	EXTENSIONÚitemsÚappendÚsortedÚIDÚMIMEÚformatÚjoinÚOPENÚSAVEÚSAVE_ALLÚDECODERSÚENCODERS)rp   rr   Úpy_version_linesÚ
py_versionÚnamer   ÚvrT   Úversion_staticÚtr/   Úv2Ú
extensionsÚextÚiÚlinerc   r"   r"   r#   Úpilinfoã   s˜   
þþ

€

ÿ




ãr³   )r   r   r   r   )r   r   r   r%   )r   r*   )r   r   r   ra   )NT)rp   rq   rr   r   r   rs   )Ú
__future__r   r˜   r“   r‰   r   Útypingr   rb   Ú r   r   r$   r)   r2   r>   rC   rH   rI   rc   rf   rg   rh   rl   rG   ro   r³   r"   r"   r"   r#   Ú<module>   sT    û
	

ü


÷





