
    Bwg+                    
   U 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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d 
Zd!ed"<   d-d#Zd+d$Zd,d%Zd-d&Zd+d'Zd,d(Zd.d/d)Zy)0    )annotationsN)IO   )Image)	deprecate)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                    | t         vrd|  }t        |      t         |    \  }}	 t        |       y# t        $ r Y yt        $ r(}t        j                  t        |             Y d}~yd}~ww xY 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exs        C/var/www/horilla/myenv/lib/python3.12/site-packages/PIL/features.pycheck_moduler$      sn     gy)o'"KFC6  c"gs   2 	A-A-A((A-c                b    t        |       syt        |    \  }}t        t        ||g      |      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!   s      r#   version_moduler)   /   s3      '"KFC:fu5s;;    c                 L    t         D  cg c]  } t        |       s|  c} S c c} w )z4
    :returns: A list of all supported modules.
    )r   r$   fs    r#   get_supported_modulesr.   >   s     2!,q/A222   !!)jpegjpeglib)jpeg2kjp2klib)zipzlib)libtiffr6   )jpgjpg_2000r5   r6   c                    | 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libs       r#   check_codecr@   M   sI     fwi(oJE3WHUZZ00r*   c                    t        |       syt        |    \  }}t        t        j                  | d      }| dk(  r&|j                  d      d   j                  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_versionr6   
r   zVersion r   )r@   r;   r(   r   r=   split)r   r>   r?   versions       r#   version_codecrF   ^   sd     wJE3ejjSE"23G)}}T"1%++J7::Nr*   c                 L    t         D  cg c]  } t        |       s|  c} S c c} w )z3
    :returns: A list of all supported codecs.
    )r;   r@   r,   s    r#   get_supported_codecsrH   s   s     0!QA000r/   )r   TN)r   	HAVE_RAQMraqm_version)r   HAVE_FRIBIDIfribidi_version)r   HAVE_HARFBUZZharfbuzz_version)r   HAVE_LIBJPEGTURBOlibjpeg_turbo_version)r   HAVE_ZLIBNGzlib_ng_version)r   HAVE_LIBIMAGEQUANTimagequant_version)r   HAVE_XCBN)
	webp_animwebp_muxtransp_webpraqmfribidiharfbuzzlibjpeg_turbozlib_nglibimagequantxcbz-dict[str, tuple[str, str | bool, str | None]]featuresc                b   | t         vrd|  }t        |      t         |    \  }}}t        |t              rt	        d|  dd       	 t        |dg      }t        |t              r|S t        ||      S # t        $ r Y yt        $ r(}t        j                  t        |             Y d}~yd}~ww xY 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 zcheck_feature("z")   PILr&   N)r`   r   
isinstanceboolr   r   r(   r   r   r   r   r   )r   r   r    flagr!   imported_moduler"   s          r#   check_featurerh      s     h 	*o )FD#$OG9B/4	$Vug>dD!K--  c"gs$   A3 'A3 3	B.>B.B))B.c                j    t        |       syt        |    \  }}}|yt        t        ||g      |      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&   )rh   r`   r(   r   )r   r    rf   r!   s       r#   version_featurerj      s>     ! )FD#
{:fu5s;;r*   c                    g } t         j                         D ]m  \  }\  }}}|du rCt        j                         D ]+  \  }\  }}||k(  st        |      r| j	                  |        O Qt        |      s]| j	                  |       o | S )z5
    :returns: A list of all supported features.
    T)r`   itemsr   r$   appendrh   )supported_featuresr-   r    rf   _r   feature_modules          r#   get_supported_featuresrq      s      ( 0 )FD!4<07 ,,.!!V+#G,*11!4	
 1%%a() r*   c                    | t         v rt        |       S | t        v rt        |       S | t        v rt        |       S t        j                  d|  dd       y)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;   r@   r`   rh   r   r   r   s    r#   checkrv      sX     'G$$&7##(W%%MM%gYb1a@r*   c                v    | t         v rt        |       S | t        v rt        |       S | t        v rt        |       S y)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;   rF   r`   rj   ru   s    r#   rE   rE      s@     'g&&&W%%(w''r*   c                 ~    t               } | j                  t                      | j                  t                      | S )zJ
    :returns: A list of all supported modules, features, and codecs.
    )r.   extendrq   rH   )rets    r#   get_supportedr{      s1    
  
!CJJ%'(JJ#%&Jr*   c                F	   | t         j                  } t        j                          t	        d|        t	        dt
        j                   |        t         j                  j                         }t	        d|d   j                          |        |dd D ]   }t	        d|j                          |        " t	        d|        t	        d	t         j                  xs d
 |        t         j                  t         j                  k7  rt	        dt         j                   |        t	        dt         j                   |        t	        d|        t	        dt        j                  j                  t        j                          |        t	        dt        j                  j                  t        j"                  j                          |        t	        d|        dD ]  \  }}t%        |      rd}|dk(  rt'        d      }|d|z   }|t        |      }||dv }|dk(  r$t)        d |j+                  d      D              dk  }|rdnd}	|dk(  rt'        d      }
|
.|d|
z   z  }n%|dk(  r dD ]  }t'        |      }||d| d | z  } t	        d!|d"|	||        t	        d!|d#|        t	        d$|d%|         t	        d|        |rt-        j.                  t0              }t        j2                  j5                         D ]  \  }}||   j7                  |        t9        t        j:                        D ]a  }| }|t        j<                  v r| d t        j<                  |    }t	        ||        ||v r7t	        d&j?                  djA                  t9        ||                     |        g }|t        jB                  v r|j7                  d'       |t        jD                  v r|j7                  d(       |t        jF                  v r|j7                  d)       |t        jH                  v r|j7                  d*       |t        jJ                  v r|j7                  d+       t	        d,j?                  djA                  |            |        t	        d|        d yy)-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)r7   JPEG)r8   zOPENJPEG (JPEG2000))r5   zZLIB (PNG/ZIP))r6   LIBTIFF)rY   zRAQM (Bidirectional Text))r^   z#LIBIMAGEQUANT (Quantization method))r_   zXCB (X protocol)r7   r\   zlibjpeg-turbo )r   r7   r   c              3  2   K   | ]  }t        |        y w)N)int).0xs     r#   	<genexpr>zpilinfo.<locals>.<genexpr>6  s     *Ha3q6*Hs   .)rs      zcompiled forloadedr5   r]   z, compiled for zlib-ng rY   )rZ   r[   z,  z---zsupport ok,z
support okz***zsupport not installedzExtensions: {}opensavesave_alldecodeencodezFeatures: {})&sysstdoutr   initprintrc   __version__rE   
splitlinesstrip
executableprefixbase_prefixospathdirname__file__r=   rv   rj   tuplerD   collectionsdefaultdictlist	EXTENSIONrl   rm   sortedIDMIMEformatjoinOPENSAVESAVE_ALLDECODERSENCODERS)outsupported_formatspy_version_lines
py_versionnamer   vrP   version_statictrR   r-   v2
extensionsextiliner`   s                     r#   pilinfor      s    {jj	JJL	(	GCOO$
%C0{{--/	G$Q'--/0
1<&qr* 8

((*+,378	(	!#.."=I!>
?cJ
zzS__$5cjj\BM	,S__,=
>SI	(	
,RWW__U^^-L,MN 

,RWW__UZZ=P=P-Q,RS 
( )Eg ; Au}(7(H%(4(+@@AyDM}!%!7<'%**H1773<*H%H6%QN&4N(6>&5i&@O&26HHV^4 /,Q/>2aS".A/ eWmQDeWl=%"9DS)ET 
( ,,T2
oo++- 	&FCqM  %	& ! 	&ASDEJJqA0$S!J$++DIIfZ]6K,LMTW HEJJ'EJJ'ENN"
+ENN")ENN").''		((;<3G(%1	& r*   )r   r   returnre   )r   r   r   z
str | None)r   z	list[str])r   r   r   zbool | None)NT)r   zIO[str] | Noner   re   r   None)
__future__r   r   r   r   r   typingr   rc    r   
_deprecater   r   r$   r)   r.   r;   r@   rF   rH   r`   __annotations__rh   rj   rq   rv   rE   r{   r    r*   r#   <module>r      s    "  	 
   
  ! .48:00<3 %%	
1"*1 +),;DGSAQ-;
7 8<""$ r&r*   